Skip to contentSkip to conversation

test-runner: Enable interrupt remapping for PCIe passthrough

PATCH Applied Luiz Augusto von Dentz 3 participants 3 messages Sep 15 – Sep 16 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 test-runner: Enable interrupt remapping for PCIe passthrough

From: Luiz Augusto von Dentz <[email protected]>

A device passed through with -P fails to allocate its MSI-X vectors (-ENOSPC) as the guest has no way to remap interrupts, so give it a virtual IOMMU with interrupt remapping enabled, which in turn requires the irqchip to be split.

Without this the guest is not presented with a DMAR table at all, so enabling CONFIG_INTEL_IOMMU and CONFIG_IRQ_REMAP on the test kernel has no effect, and both are now documented as required.

The machine type is moved out of the static argument list as it now depends on whether -P is used, the resulting command line is otherwise unchanged.

The model wrote the change and confirmed the guest is only presented with a DMAR table once the virtual IOMMU is added; it was reviewed and tested by the author.

Assisted-by Claude:claude-opus-5
---
 doc/test-runner.rst | 11 +++++++++++
 tools/test-runner.c | 10 +++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)
doc/test-runner.rst +11 -0
index 6429e80fc75b..dc1e51305c51 100644
@@ -355,6 +355,17 @@ In addition the above kernel config option the following is required:
 	CONFIG_ACPI=y
 	CONFIG_BT_HCIBTINTEL_PCIE=y
 
+IOMMU and interrupt remapping, without which vfio-pci fails to allocate
+MSI-X vectors (-ENOSPC):
+
+.. code-block::
+
+	CONFIG_INTEL_IOMMU=y
+	CONFIG_INTEL_IOMMU_DEFAULT_ON=y
+	CONFIG_INTEL_IOMMU_SVM=y
+	CONFIG_IRQ_REMAP=y
+	CONFIG_AMD_IOMMU=y
+
 On the host, an IOMMU must be enabled in the firmware and on the host kernel
 command line (``intel_iommu=on`` or ``amd_iommu=on``). The controller itself
 does not need any manual preparation: test-runner unbinds it from its current
tools/test-runner.c +9 -1
index 2de05e26dcf3..338e5b9da544 100644
@@ -293,7 +293,6 @@ static const char *const qemu_argv[] = {
 	"-no-user-config",
 	"-monitor", "none",
 	"-display", "none",
-	"-machine", "type=q35,accel=kvm:tcg",
 	"-m", "256M",
 	"-net", "none",
 	"-no-reboot",
@@ -810,6 +809,13 @@ static int start_qemu(void)
 	strv_append(&argv, "%s", qemu_binary);
 	strv_concat(&argv, qemu_argv);
 
+	/* Interrupt remapping is required to pass through a device using
+	 * MSI-X, which in turn needs the split irqchip.
+	 */
+	strv_append(&argv, "-machine");
+	strv_append(&argv, "type=q35,accel=kvm:tcg%s",
+			pcie_dev ? ",kernel-irqchip=split" : "");
+
 	if (qemu_host_cpu) {
 		strv_append(&argv, "-cpu");
 		strv_append(&argv, "host");
@@ -835,6 +841,8 @@ static int start_qemu(void)
 	}
 
 	if (pcie_dev) {
+		strv_append(&argv, "-device");
+		strv_append(&argv, "intel-iommu,intremap=on");
 		strv_append(&argv, "-device");
 		strv_append(&argv, "%s", pcie_dev);
 	}
Signature · 1 line
2.55.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1165938/

---Test result---

Test Summary:

CheckPatch                    PASS      0.56 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      23.08 seconds
BluezMake                     PASS      376.76 seconds
MakeCheck                     PASS      14.60 seconds
MakeDistcheck                 PASS      141.22 seconds
CheckValgrind                 PASS      228.17 seconds
CheckSmatch                   PASS      287.52 seconds
bluezmakeextell               PASS      90.17 seconds
TestFunctional                PASS      1006.00 seconds
IncrementalBuild              PASS      350.20 seconds
ScanBuild                     PASS      1011.61 seconds

https://github.com/bluez/bluez/pull/2531

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Luiz Augusto von Dentz
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Tue, 15 Sep 2026 17:37:23 -0400 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

A device passed through with -P fails to allocate its MSI-X vectors (-ENOSPC) as the guest has no way to remap interrupts, so give it a virtual IOMMU with interrupt remapping enabled, which in turn requires the irqchip to be split.

[...]

Here is the summary with links:
- [BlueZ,v1] test-runner: Enable interrupt remapping for PCIe passthrough

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a410e06a4b61

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html