base: support specifying PCI bdf on irq creation

Required by the seL4 kernel interface for MSI creation and by another upstream
kernel.

Issue #5423
This commit is contained in:
Alexander Boettcher 2025-01-16 13:30:30 +01:00 committed by Christian Helmuth
parent 935681a7f4
commit ea3ed25431
2 changed files with 7 additions and 3 deletions

View File

@ -46,17 +46,20 @@ struct Genode::Irq_connection : Connection<Irq_session>, Irq_session_client
* Constructor * Constructor
* *
* \param label (virtual) interrupt number * \param label (virtual) interrupt number
* \param device_config_phys config-space physical address * \param device_config_phys PCI config-space physical address
* \param type interrupt type (e.g., msi/msi-x) * \param type interrupt type (e.g., msi/msi-x)
* \param bdf PCI bdf of device
*/ */
Irq_connection(Env &env, Irq_connection(Env &env,
Label const &label, Label const &label,
addr_t device_config_phys, addr_t device_config_phys,
Type type = Irq_session::TYPE_MSI) Type type,
unsigned bdf = 0x10000 /* invalid */)
: :
Connection<Irq_session>(env, label, Ram_quota { RAM_QUOTA }, Connection<Irq_session>(env, label, Ram_quota { RAM_QUOTA },
Args("irq_number=", label, ", " Args("irq_number=", label, ", "
"device_config_phys=", Hex(device_config_phys), ", " "device_config_phys=", Hex(device_config_phys), ", "
"bdf=", Hex(bdf), ", "
"irq_type=", unsigned(type))), "irq_type=", unsigned(type))),
Irq_session_client(cap()) Irq_session_client(cap())
{ } { }

View File

@ -168,7 +168,8 @@ Genode::Irq_session_capability Device_component::irq(unsigned idx)
} else } else
error("MSI(-x) detected for device without pci-config!"); error("MSI(-x) detected for device without pci-config!");
irq.irq.construct(_env, irq.number, pci_cfg_addr, irq.type); irq.irq.construct(_env, irq.number, pci_cfg_addr, irq.type,
Pci::Bdf::rid(_pci_config->bdf));
} else } else
irq.irq.construct(_env, irq.number, irq.mode, irq.polarity); irq.irq.construct(_env, irq.number, irq.mode, irq.polarity);