From 88b5882c260bb064c432dd283e3b666bcd3878b0 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 21 Jul 2025 11:19:02 -0700 Subject: [PATCH 1/3] tests: disk/disk_performance: add CONFIG_NVME for qemu_x86_64 qemu_x86_64 has NVME disk as overlay so we need to enable kconfig CONFIG_NVME or else it would fail to compile. Signed-off-by: Daniel Leung --- tests/drivers/disk/disk_performance/boards/qemu_x86_64.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/drivers/disk/disk_performance/boards/qemu_x86_64.conf b/tests/drivers/disk/disk_performance/boards/qemu_x86_64.conf index 0c14f763bf95d..64343c52aad37 100644 --- a/tests/drivers/disk/disk_performance/boards/qemu_x86_64.conf +++ b/tests/drivers/disk/disk_performance/boards/qemu_x86_64.conf @@ -3,3 +3,4 @@ CONFIG_PCIE=y CONFIG_PCIE_MSI=y CONFIG_PCIE_MSI_X=y CONFIG_PCIE_MSI_MULTI_VECTOR=y +CONFIG_NVME=y From e8019013f92dde14834b75e7fc4f6719c9503d39 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 21 Jul 2025 10:54:56 -0700 Subject: [PATCH 2/3] x86: fix return for arch_pcie_msi_vectors_allocate() arch_pcie_msi_vectors_allocate() has a return type of uint8_t. One of the error path returns -1 which would result in 255 being returned. So fix that by returning 0 instead, as there is no vector being allocated anyway. Signed-off-by: Daniel Leung --- arch/x86/core/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/core/pcie.c b/arch/x86/core/pcie.c index 878e6886d7b8f..3086413a8369b 100644 --- a/arch/x86/core/pcie.c +++ b/arch/x86/core/pcie.c @@ -260,7 +260,7 @@ uint8_t arch_pcie_msi_vectors_allocate(unsigned int priority, } if ((irq == PCIE_CONF_INTR_IRQ_NONE) || (irq == -1)) { - return -1; + return 0; } vector = z_x86_allocate_vector(priority, prev_vector); From dd76162fc0f00856b0dd4ed2c9169d21efd3fa67 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 21 Jul 2025 11:14:58 -0700 Subject: [PATCH 3/3] 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 --- arch/x86/core/pcie.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/x86/core/pcie.c b/arch/x86/core/pcie.c index 3086413a8369b..cf298cc1f9cfa 100644 --- a/arch/x86/core/pcie.c +++ b/arch/x86/core/pcie.c @@ -249,12 +249,18 @@ uint8_t arch_pcie_msi_vectors_allocate(unsigned int priority, for (i = 0; i < n_vector; i++) { if (n_vector == 1) { - /* This path is taken by PCIE device with fixed - * or single MSI: IRQ has been already allocated - * and/or set on the PCIe bus. Thus we only require - * to get it. + /* For PCIE device with fixed or single MSI: IRQ has + * been already allocated and/or set on the PCIe bus. + * We only need to retrieve it. */ irq = pcie_get_irq(vectors->bdf); + + /* If that is not the case, we will need to allocate + * IRQ before proceeding. + */ + if (irq == PCIE_CONF_INTR_IRQ_NONE) { + irq = arch_irq_allocate(); + } } else { irq = arch_irq_allocate(); }