Skip to content

Commit fe5f8e0

Browse files
dcpleungkartben
authored andcommitted
x86: pcie: fix allocating 1 vector under MSI-X
Fix an issue where 1 vector is being requested when MSI-X is enabled. The previous logic always assumed the PCIE device has only fixed or single MSI when we are requesting 1 vector, which is not entirely correct. So if there is no vector allocated already, try to allocate one. Fixes #93319 Signed-off-by: Daniel Leung <[email protected]>
1 parent d4b4da9 commit fe5f8e0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

arch/x86/core/pcie.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,18 @@ uint8_t arch_pcie_msi_vectors_allocate(unsigned int priority,
249249

250250
for (i = 0; i < n_vector; i++) {
251251
if (n_vector == 1) {
252-
/* This path is taken by PCIE device with fixed
253-
* or single MSI: IRQ has been already allocated
254-
* and/or set on the PCIe bus. Thus we only require
255-
* to get it.
252+
/* For PCIE device with fixed or single MSI: IRQ has
253+
* been already allocated and/or set on the PCIe bus.
254+
* We only need to retrieve it.
256255
*/
257256
irq = pcie_get_irq(vectors->bdf);
257+
258+
/* If that is not the case, we will need to allocate
259+
* IRQ before proceeding.
260+
*/
261+
if (irq == PCIE_CONF_INTR_IRQ_NONE) {
262+
irq = arch_irq_allocate();
263+
}
258264
} else {
259265
irq = arch_irq_allocate();
260266
}

0 commit comments

Comments
 (0)