Re: [patch 12/33] PCI/MSI: Add support for per device MSI[X] domains

From: Thomas Gleixner
Date: Wed Nov 16 2022 - 17:39:29 EST


On Wed, Nov 16 2022 at 15:13, Jason Gunthorpe wrote:
> On Fri, Nov 11, 2022 at 02:58:30PM +0100, Thomas Gleixner wrote:
>> + .info = {
>> + .flags = MSI_COMMON_FLAGS | MSI_FLAG_PCI_MSIX,
>> + .bus_token = DOMAIN_BUS_PCI_DEVICE_MSIX,
>> + },
>> +};
>
> I like this splitting alot, it makes the whole thing make so much more
> sense.

:)

>> +bool pci_setup_msi_device_domain(struct pci_dev *pdev)
>> +{
>> + if (WARN_ON_ONCE(pdev->msix_enabled))
>> + return false;
>> +
>> + if (pci_match_device_domain(pdev, DOMAIN_BUS_PCI_DEVICE_MSI))
>> + return true;
>> + if (pci_match_device_domain(pdev, DOMAIN_BUS_PCI_DEVICE_MSIX))
>> + msi_remove_device_irq_domain(&pdev->dev, MSI_DEFAULT_DOMAIN);
>> +
>> + return pci_create_device_domain(pdev, &pci_msi_template, 1);
>
> Hardwired to one 1? What about multi-msi?

MSI has exactly ONE descriptor whether it's single or multi-MSI.

Multi-MSI can have several interrupts hanging off the same descriptor,
but that's not how MSI looks at it because you write ONE message and the
hardware does the substitution of the low bits depending on which vector
is raised.

I pondered to change that, but that would have required to create yet
another code path for the 20years legacy and to adjust every single
implementation of PCI/MSI domains or the underlying parents to handle
this new world order. About 5 years later we might talk about per device
domains then.

Thanks,

tglx