Re: [PATCH 5/8] PCI PCIe portdrv: Fix allocation of interrupts

From: Hidetoshi Seto
Date: Sun Jan 18 2009 - 20:52:51 EST


Rafael J. Wysocki wrote:
> On Friday 16 January 2009, Rafael J. Wysocki wrote:
>> On Friday 16 January 2009, Hidetoshi Seto wrote:
>>> Rafael J. Wysocki wrote:
>>>> On Thursday 15 January 2009, Rafael J. Wysocki wrote:
>>>>> On Thursday 15 January 2009, Rafael J. Wysocki wrote:
(snip)
>>>>>> In any case, I think we should
>>>>>> (a) get the number of the port's MSI-X table entries _first_, without enabling
>>>>>> MSI-X,
>>> We cannot do this because both of PCIE_CAPABILITIES_REG and PCI_ERR_ROOT_STATUS
>>> will indicate the number for MSI, not for MSI-X without enabling MSI-X.
>> Yes, we can. We don't read PCIE_CAPABILITIES_REG and PCI_ERR_ROOT_STATUS at
>> this point yet and the number of entries in the MSI-X table is constant
>> (read-only), so we can read it even before enabling MSI-X. Actually, our MSI-X
>> code does that already anyway.

Now I caught you've mean "get the size of MSI-X table."

>>>>>> (b) allocate as many MSI-X vectors as indicated by this number, even though
>>>>>> some of them may not be used,
>> (b) should be: call pci_enable_msix() with the last argument equal to the
>> number of entries in the MSI-X table or 32, whichever is smaller.

Good.

>>>>>> (c) use PCIE_CAPABILITIES_REG and PCI_ERR_ROOT_STATUS to check
>>>>>> which vector has been allocated to which service.
>>>>> (d) mask the unused vectors.
>>>> However, it's probably simpler to do something like in your patch, although
>>>> I don't like the dummy enabling of MSI-X at all.
>>> How about this?
>>>
>>> #define PCIE_MSIX_ENTRY_HPPME MAGIC_NUMBER_1
>>> #define PCIE_MSIX_ENTRY_AER MAGIC_NUMBER_2
>>>
>>> struct msix_entry msix_entries[] =
>>> {{0, PCIE_MSIX_ENTRY_HPPME}, {0, PCIE_MSIX_ENTRY_AER}};
>>> status = pci_enable_msix(dev, msix_entries, nvec);
>>>
>>> And modify pci_enable_msix() to handle these magic numbers.

I found a down side of my idea:
it requires modification of arch_setup_msi_irqs etc. too.

>> Quite frankly, I prefer the procedure described above in (a) - (d). I'll try
>> to implement it and we'll see how it looks like.
>
> I've just sent the patch in the other thread.

OK. I'll review it.

Thanks,
H.Seto

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/