pcie: msi: pci_msi_enable() to take IRQ as parameter

This changes pci_msi_enable() to take IRQ number as a function
parameter. The old behavior relies on putting the IRQ number
into the interrupt line register in the PCI config space
during IRQ allocation, and reading it back when enabling IRQ.
However, the interrupt line register is only required to be
read-/writable when legacy interrupt is supported on the device.
Otherwise it has undefined behavior. On ACRN, they don't even
care about this register and always wires it to 0x00.
So this commit changes the behavior in pci_msi_enable() to not
require reading back the interrupt line register and instead
takes the IRQ number via function parameter.

Fixes #36765

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-08-11 11:16:11 -07:00 committed by Johan Hedberg
commit ec2b9d42af
3 changed files with 12 additions and 13 deletions

View file

@ -101,11 +101,13 @@ extern uint16_t pcie_msi_mdr(unsigned int irq,
* @param bdf the target PCI endpoint
* @param vectors an array of allocated vector(s)
* @param n_vector the size of the vector array
* @param irq The IRQ we wish to trigger via MSI.
* @return true if the endpoint supports MSI, false otherwise.
*/
extern bool pcie_msi_enable(pcie_bdf_t bdf,
msi_vector_t *vectors,
uint8_t n_vector);
uint8_t n_vector,
unsigned int irq);
/*
* MSI capability IDs in the PCI configuration capability list.