Re: [PATCH v2 5/5] rust: pci: expose the allocated interrupt type

"Danilo Krummrich" <[email protected]>
Newsgroups org.kernel.vger.linux-pci,dev.linux.lists.driver-core,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Wed Aug 12, 2026 at 8:16 PM CEST, Gary Guo wrote:
> On Wed Aug 12, 2026 at 6:57 PM BST, Danilo Krummrich wrote:
>> On Wed Aug 12, 2026 at 6:44 PM CEST, Gary Guo wrote:
>>> On Wed Aug 12, 2026 at 12:39 AM BST, Danilo Krummrich wrote:
>>>> +    pub fn irq_type(&self) -> IrqType {
>>>> +        self.reg.irq_type()
>>>
>>> Do you expect people to call this on the `IrqVetor` (or even
>>> `IrqVectorRegistration`)? This is really a property of the device, and not on a
>>> specific IRQ vector/allocation.
>>
>> You are not wrong, but the C API sets msix_enabled and msi_enabled in
>> pci_alloc_irq_vectors() and clears them in pci_free_irq_vectors().
>
> Right, then putting it on `IrqVectorRegistration` does make sense. Speaking of
> which, what prevents people from calling pci_alloc_irq_vectors twice with
> different irq types or with both IrqType::Intx?

Most cases are fine: INTX is idempotent; MSI and MSIX mixed up should be caught
by the C API already.

I'm aware of a preexisting issue with mixing INTX and either MSI or MSIX, since
calling pci_free_irq_vectors() on the INTX one would also disable MSI/MSIX.

I plan to fix it up when fixing the C bitfied issue [1] with an additional flag.

[1] https://lore.kernel.org/all/[email protected]/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.