RE: [Penance PATCH] PCI: clean up the MSI code a bit

From: Nguyen, Tom L
Date: Thu Jun 09 2005 - 19:16:56 EST


On Thursday, June 09, 2005 4:49 PM Stefan Smietanowski wrote:
> pci_enable_msix(dev)
> {
> if (is_dev_msi(dev))
> pci_disable_msi(dev);
> else if (is_dev_msix(dev))
> return(ALREADY_MSIX);
> else
> return(MSIX_NOT_AVAILABLE);
> if (!__pci_enable_msix(dev))
> pci_enable_msi(dev);
>}
>
>That way noone needs to explicitly turn off msi as it's done
>automatically instead and the device will after this call
>always be in either MSIX, MSI or NORMAL IRQ mode, and
>always in the "best" mode the device, motherboard, bios, NB,
>whatever combination is available.

Your logic does not work because existing MSI/MSI-X code does not allow
a driver to switch back and forth between MSI mode and MSI-X mode. A
driver can switch interrupt mode between NORMAL IRQ mode and MSI mode or
between NORMAL IRQ mode and MSI-X mode but NOT between MSI mode and
MSI-X mode. A device driver should know well which MSI mode or MSI-X
mode it wants to run when its device supports both MSI and MSI-X
capability structures. Please read MSI-HOWTO before any attempt. If you
like to continue this path, then think of a better policy of how to
manage vector sources for MSI and MSI-X allocation before making
changes.

Thanks,
Long
-
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/