lkml.org 
[lkml]   [2022]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [patch V2 25/33] PCI/MSI: Provide post-enable dynamic allocation interfaces for MSI-X
Date
On Thu, Nov 24 2022 at 02:58, Kevin Tian wrote:
>> +
>> +/**
>> + * pci_msix_free_irq - Free an interrupt on a PCI/MSIX interrupt domain
>> + * which was allocated via pci_msix_alloc_irq_at()
>> + *
>> + * @dev: The PCI device to operate on
>> + * @map: A struct msi_map describing the interrupt to free
>> + * as returned from the allocation function.
>> + */
>
> Can this be used on preallocated descriptors? If not any guard required
> or just treat it as a driver responsibility to not misuse?

The preallocated descriptors are only relevant during setup, but not
post setup. So yes, you can do:

pci_alloc_irq_vectors(dev, 10, 10, PCI_IRQ_MSIX);

and then

map = { .index = 9, .virq = $IRQ };
pci_msix_free_irq(dev, &map);

It just works.

>> +void pci_msix_free_irq(struct pci_dev *dev, struct msi_map map)
>> +{
>> + if (WARN_ON_ONCE(map.index < 0 || map.virq <= 0))
>
> map.virq cannot be negative.

Why? Callers can make up whatever they want, no?

Thanks,

tglx

\
 
 \ /
  Last update: 2022-11-24 10:10    [W:0.081 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site