Re: [PATCH v2 5/5] rust: pci: expose the allocated interrupt type
From: Danilo Krummrich
Date: Wed Aug 12 2026 - 16:48:59 EST
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/DKKG2QM3YJYB.Z2H2B2UXJ75N@xxxxxxxxxx/