Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] test-runner: Enable interrupt remapping for PCIe passthrough
@ 2026-09-15 21:37 Luiz Augusto von Dentz
  2026-09-15 22:58 ` [BlueZ,v1] " bluez.test.bot
  2026-09-16 18:30 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2026-09-15 21:37 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(-)

diff --git a/doc/test-runner.rst b/doc/test-runner.rst
index 6429e80fc75b..dc1e51305c51 100644
--- a/doc/test-runner.rst
+++ b/doc/test-runner.rst
@@ -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
diff --git a/tools/test-runner.c b/tools/test-runner.c
index 2de05e26dcf3..338e5b9da544 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -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);
 	}
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-16 18:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15 21:37 [PATCH BlueZ v1] test-runner: Enable interrupt remapping for PCIe passthrough Luiz Augusto von Dentz
2026-09-15 22:58 ` [BlueZ,v1] " bluez.test.bot
2026-09-16 18:30 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox