* [PATCH bluez 0/3] tools/test-runner: Add arm64 host support
@ 2026-11-22 10:34 Zijun Hu
2026-11-22 10:34 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Zijun Hu
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Zijun Hu @ 2026-11-22 10:34 UTC (permalink / raw)
To: Linux Bluetooth; +Cc: Marcel Holtmann, Luiz Augusto von Dentz, Zijun Hu
This series mainly:
- Adds support for running test-runner on arm64 hosts
- Allows starting bluetoothd without debug output
---
Zijun Hu (3):
doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/
tools/test-runner: Support running on arm64 hosts
tools/test-runner: Allow suppressing noisy bluetoothd debug output
doc/test-runner.rst | 26 ++++++++++--
tools/test-runner.c | 114 +++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 112 insertions(+), 28 deletions(-)
---
base-commit: 1adfe662efeff12997df9ddd0960dbd0de9c8ea7
change-id: 20261122-tr_arm64-c6751a5cf021
Best regards,
--
Zijun Hu <zijun.hu@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ 2026-11-22 10:34 [PATCH bluez 0/3] tools/test-runner: Add arm64 host support Zijun Hu @ 2026-11-22 10:34 ` Zijun Hu 2026-11-22 18:56 ` tools/test-runner: Add arm64 host support bluez.test.bot 2026-11-25 8:59 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Bastien Nocera 2026-11-22 10:34 ` [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts Zijun Hu 2026-11-22 10:34 ` [PATCH bluez 3/3] tools/test-runner: Allow suppressing noisy bluetoothd debug output Zijun Hu 2 siblings, 2 replies; 18+ messages in thread From: Zijun Hu @ 2026-11-22 10:34 UTC (permalink / raw) To: Linux Bluetooth; +Cc: Marcel Holtmann, Luiz Augusto von Dentz, Zijun Hu The btintel_pcie driver is enabled by CONFIG_BT_INTEL_PCIE, not CONFIG_BT_HCIBTINTEL_PCIE, which does not exist. Also split CONFIG_SERIAL_8250_PCI=yCONFIG_DEBUG_KERNEL=y into two lines. Assisted-by: Claude:claude-opus-5-5 --- doc/test-runner.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/test-runner.rst b/doc/test-runner.rst index 220a2cec1c55..b5876e4f5108 100644 --- a/doc/test-runner.rst +++ b/doc/test-runner.rst @@ -190,17 +190,18 @@ option (like the Bluetooth subsystem) can be enabled on top of this. CONFIG_NET_9P=y CONFIG_NET_9P_VIRTIO=y CONFIG_9P_FS=y CONFIG_9P_FS_POSIX_ACL=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y - CONFIG_SERIAL_8250_PCI=yCONFIG_DEBUG_KERNEL=y + CONFIG_SERIAL_8250_PCI=y + CONFIG_DEBUG_KERNEL=y CONFIG_SERIAL_8250_NR_UARTS=4 CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_TMPFS_XATTR=y CONFIG_DEVTMPFS=y CONFIG_DEBUG_FS=y @@ -381,17 +382,17 @@ Running shell with host controller PCIe-passthrough In addition the above kernel config option the following is required: .. code-block:: CONFIG_PCI=y CONFIG_PCI_MSI=y CONFIG_ACPI=y - CONFIG_BT_HCIBTINTEL_PCIE=y + CONFIG_BT_INTEL_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 -- 2.34.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* RE: tools/test-runner: Add arm64 host support 2026-11-22 10:34 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Zijun Hu @ 2026-11-22 18:56 ` bluez.test.bot 2026-11-25 8:59 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Bastien Nocera 1 sibling, 0 replies; 18+ messages in thread From: bluez.test.bot @ 2026-11-22 18:56 UTC (permalink / raw) To: linux-bluetooth, zijun.hu [-- Attachment #1: Type: text/plain, Size: 1023 bytes --] 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/1218567/ ---Test result--- Test Summary: CheckPatch PASS 1.60 seconds GitLint PASS 1.05 seconds BuildEll PASS 20.21 seconds BluezMake PASS 313.02 seconds MakeCheck PASS 14.56 seconds MakeDistcheck PASS 146.23 seconds CheckValgrind PASS 349.47 seconds CheckSmatch PASS 316.64 seconds bluezmakeextell PASS 100.20 seconds TestFunctional PASS 1218.91 seconds IncrementalBuild PASS 318.38 seconds ScanBuild PASS 1190.69 seconds https://github.com/bluez/bluez/pull/2866 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ 2026-11-22 10:34 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Zijun Hu 2026-11-22 18:56 ` tools/test-runner: Add arm64 host support bluez.test.bot @ 2026-11-25 8:59 ` Bastien Nocera 2026-11-25 10:43 ` Zijun Hu 1 sibling, 1 reply; 18+ messages in thread From: Bastien Nocera @ 2026-11-25 8:59 UTC (permalink / raw) To: Zijun Hu, Linux Bluetooth Cc: Marcel Holtmann, Luiz Augusto von Dentz, Zijun Hu Hey, On Sun, 2026-11-22 at 02:34 -0800, Zijun Hu wrote: > The btintel_pcie driver is enabled by CONFIG_BT_INTEL_PCIE, not > CONFIG_BT_HCIBTINTEL_PCIE, which does not exist. > > Also split CONFIG_SERIAL_8250_PCI=yCONFIG_DEBUG_KERNEL=y into two > lines. If you need to write "also" in a commit message, that usually means that you need to create a separate commit fixing that separate problem. This is the case here. > > Assisted-by: Claude:claude-opus-5-5 > --- > doc/test-runner.rst | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/doc/test-runner.rst b/doc/test-runner.rst > index 220a2cec1c55..b5876e4f5108 100644 > --- a/doc/test-runner.rst > +++ b/doc/test-runner.rst > @@ -190,17 +190,18 @@ option (like the Bluetooth subsystem) can be > enabled on top of this. > CONFIG_NET_9P=y > CONFIG_NET_9P_VIRTIO=y > > CONFIG_9P_FS=y > CONFIG_9P_FS_POSIX_ACL=y > > CONFIG_SERIAL_8250=y > CONFIG_SERIAL_8250_CONSOLE=y > - CONFIG_SERIAL_8250_PCI=yCONFIG_DEBUG_KERNEL=y > + CONFIG_SERIAL_8250_PCI=y > + CONFIG_DEBUG_KERNEL=y > CONFIG_SERIAL_8250_NR_UARTS=4 > > CONFIG_TMPFS=y > CONFIG_TMPFS_POSIX_ACL=y > CONFIG_TMPFS_XATTR=y > > CONFIG_DEVTMPFS=y > CONFIG_DEBUG_FS=y > @@ -381,17 +382,17 @@ Running shell with host controller PCIe- > passthrough > > In addition the above kernel config option the following is > required: > > .. code-block:: > > CONFIG_PCI=y > CONFIG_PCI_MSI=y > CONFIG_ACPI=y > - CONFIG_BT_HCIBTINTEL_PCIE=y > + CONFIG_BT_INTEL_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 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ 2026-11-25 8:59 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Bastien Nocera @ 2026-11-25 10:43 ` Zijun Hu 2026-11-25 11:06 ` Bastien Nocera 0 siblings, 1 reply; 18+ messages in thread From: Zijun Hu @ 2026-11-25 10:43 UTC (permalink / raw) To: Bastien Nocera; +Cc: linux-bluetooth, Luiz Augusto von Dentz Hi Bastien, Provided this repo also follows https://elixir.bootlin.com/linux/v7.4-rc1/source/Documentation/process/maintainer-netdev.rst "Netdev discourages patches which perform simple clean-ups, which are not in the context of other work." Thanks, Zijun ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ 2026-11-25 10:43 ` Zijun Hu @ 2026-11-25 11:06 ` Bastien Nocera 0 siblings, 0 replies; 18+ messages in thread From: Bastien Nocera @ 2026-11-25 11:06 UTC (permalink / raw) To: Zijun Hu; +Cc: linux-bluetooth, Luiz Augusto von Dentz On Wed, 2026-11-25 at 02:43 -0800, Zijun Hu wrote: > Hi Bastien, > > Provided this repo also follows > https://elixir.bootlin.com/linux/v7.4-rc1/source/Documentation/process/maintainer-netdev.rst > > "Netdev discourages patches which perform simple clean-ups, which are > not in the context of other work." Given that it's a fix next to somewhere where you're touching the code, it's fine. That's not the kind of change that the documentation is warning against. ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-22 10:34 [PATCH bluez 0/3] tools/test-runner: Add arm64 host support Zijun Hu 2026-11-22 10:34 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Zijun Hu @ 2026-11-22 10:34 ` Zijun Hu 2026-11-22 16:24 ` Pauli Virtanen 2026-11-25 9:04 ` Bastien Nocera 2026-11-22 10:34 ` [PATCH bluez 3/3] tools/test-runner: Allow suppressing noisy bluetoothd debug output Zijun Hu 2 siblings, 2 replies; 18+ messages in thread From: Zijun Hu @ 2026-11-22 10:34 UTC (permalink / raw) To: Linux Bluetooth; +Cc: Marcel Holtmann, Luiz Augusto von Dentz, Zijun Hu Add arm64 support by: - Using qemu-system-aarch64 with the virt machine and the arm64 Image - Passing -cpu max or host, as the default virt CPU is 32-bit - Using earlycon and leaving out the x86-only options - Warning when /dev/kvm is not accessible, as QEMU then falls back to TCG Assisted-by: Claude:claude-opus-5-5 --- doc/test-runner.rst | 5 ++++- tools/test-runner.c | 49 ++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/doc/test-runner.rst b/doc/test-runner.rst index b5876e4f5108..4ff9d1b02c1b 100644 --- a/doc/test-runner.rst +++ b/doc/test-runner.rst @@ -21,17 +21,20 @@ OPTIONS :-m/--monitor: Start btmon :-l/--emulator[=num]: Start btvirt :-A/-audio[=path]: Start audio server :-u/--unix[=path]: Provide serial device :-U/--usb=<qemu_args>: Provide USB device :-P/--pcie=<qemu_args>: Provide PCIe device :-q/--qemu=<path>: QEMU binary :-H/--qemu-host-cpu: Use host CPU (requires KVM support) -:-k/--kernel=<image>: Kernel image (bzImage) or User Mode Linux binary +:-k/--kernel=<image>: Kernel image or source tree path: + + | x86: bzImage or User Mode Linux binary + | arm64: Image :-F/--virtiofs[=<path>]: Path to virtiofsd, or no to disable virtio-fs :-T/--time-travel: Run a User Mode Linux kernel on simulated time, with btvirt as time travel calendar (default if the kernel supports it) :-R/--real-time: Run a User Mode Linux kernel on real time :-o/--option=<opt>: Additional argument passed to QEMU, or kernel parameter with User Mode Linux :-h/--help: Show help options diff --git a/tools/test-runner.c b/tools/test-runner.c index 0bca31a46351..a2105977c1ee 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -128,20 +128,25 @@ static void strv_cleanup(struct strv *s) for (i = 0; i < s->i; ++i) free(s->strv[i]); memset(s, 0, sizeof(*s)); } static const char *qemu_table[] = { +#if defined(__aarch64__) + "qemu-system-aarch64", + "/usr/bin/qemu-system-aarch64", +#else "qemu-system-x86_64", "qemu-system-i386", "/usr/bin/qemu-system-x86_64", "/usr/bin/qemu-system-i386", +#endif NULL }; static const char *find_qemu(void) { int i; for (i = 0; qemu_table[i]; i++) { @@ -150,21 +155,26 @@ static const char *find_qemu(void) if (!stat(qemu_table[i], &st)) return qemu_table[i]; } return NULL; } static const char *kernel_table[] = { +#if defined(__aarch64__) + "Image", + "arch/arm64/boot/Image", +#else "bzImage", "arch/x86/boot/bzImage", "vmlinux", "arch/x86/boot/vmlinux", "linux", +#endif NULL }; /* A User Mode Linux kernel is an executable with the .uml.setup.init * section, through which it registers its command line options. */ static bool is_uml_kernel(const char *path) { @@ -420,16 +430,19 @@ static char *const qemu_envp[] = { static void check_virtualization(void) { #ifdef HAVE_GET_CPUID unsigned int eax, ebx, ecx, edx; if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && (ecx & (1 << 5))) printf("Found support for Virtual Machine eXtensions\n"); +#elif defined(__aarch64__) + if (access("/dev/kvm", R_OK | W_OK) < 0) + fprintf(stderr, "No access to /dev/kvm, falling back to TCG\n"); #endif } #define PCI_DEVICES_PATH "/sys/bus/pci/devices" static char pcie_bdf[16]; static char pcie_driver[64]; @@ -894,16 +907,18 @@ static void qemu_signal(int sig) if (qemu_pid > 0) kill(qemu_pid, sig); } static int start_qemu(void) { char cwd[PATH_MAX/2], initcmd[PATH_MAX], testargs[PATH_MAX]; const char *fscmdline; + const char *earlycon; + const char *noacpi; char cmdline[CMDLINE_MAX]; char *argv_strv[EXTRA_OPT_MAX + 64]; struct strv _cleanup_(strv_cleanup) argv = { argv_strv, ARRAY_SIZE(argv_strv) }; struct rootfs _cleanup_(rootfs_cleanup) rootfs = {{0}}; int i, pos, status = 0; pid_t pid; @@ -933,54 +948,71 @@ static int start_qemu(void) } if (!virtiofsd) fscmdline = "rootfstype=9p " "rootflags=trans=virtio,version=9p2000.u"; else fscmdline = "rootfstype=virtiofs root=/dev/root"; +#if defined(__aarch64__) + earlycon = "earlycon"; + noacpi = ""; +#else + earlycon = "earlyprintk=serial"; + /* PCIe passthrough requires ACPI and APIC for device enumeration + * and MSI interrupts. + */ + noacpi = pcie_dev ? "" : "acpi=off pci=noacpi noapic"; +#endif + snprintf(cmdline, sizeof(cmdline), - "console=hvc0 earlyprintk=serial " + "console=hvc0 %s " "no_hash_pointers=1 %s %s quiet ro init=%s " "TESTHOME=%s TESTDBUS=%u TESTDAEMON=%u " "TESTDBUSSESSION=%u XDG_RUNTIME_DIR=/run/user/0 " "TESTMONITOR=%u TESTEMULATOR=%u TESTDEVS=%d " "TESTAUTO=%u TESTAUDIO='%s' TESTARGS=\'%s\'", + earlycon, fscmdline, - /* PCIe passthrough requires ACPI and APIC for - * device enumeration and MSI interrupts. - */ - pcie_dev ? "" : "acpi=off pci=noacpi noapic", + noacpi, initcmd, cwd, start_dbus, start_daemon, start_dbus_session, start_monitor, num_emulator, num_devs, run_auto, audio_server ? audio_server : "", testargs); /* Make sure qemu_binary is not null */ if (!qemu_binary) { fprintf(stderr, "No QEMU binary is set\n"); return EXIT_FAILURE; } strv_append(&argv, "%s", qemu_binary); strv_concat(&argv, qemu_argv); +#if defined(__aarch64__) + strv_append(&argv, "-machine"); + strv_append(&argv, "virt,gic-version=max,accel=kvm:tcg"); + + strv_append(&argv, "-cpu"); + strv_append(&argv, qemu_host_cpu ? "host" : "max"); +#else /* 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"); } +#endif strv_append(&argv, "-kernel"); strv_append(&argv, "%s", kernel_image); strv_append(&argv, "-append"); strv_append(&argv, "%s", cmdline); coverage_setup(&argv, cwd); @@ -994,18 +1026,20 @@ static int start_qemu(void) if (usb_dev) { strv_append(&argv, "-device"); strv_append(&argv, "qemu-xhci"); strv_append(&argv, "-device"); strv_append(&argv, "%s", usb_dev); } if (pcie_dev) { +#if !defined(__aarch64__) strv_append(&argv, "-device"); strv_append(&argv, "intel-iommu,intremap=on"); +#endif strv_append(&argv, "-device"); strv_append(&argv, "%s", pcie_dev); } if (!rootfs_setup(&rootfs, &argv)) return EXIT_FAILURE; for (i = 0; i < num_extra_opts; ++i) @@ -2193,18 +2227,19 @@ static void usage(void) "\t-m, --monitor Start btmon\n" "\t-l, --emulator[=num] Start btvirt\n" "\t-A, --audio[=path] Start audio server\n" "\t-u, --unix[=path] Provide serial device\n" "\t-U, --usb <qemu_args> Provide USB device\n" "\t-P, --pcie <qemu_args> Provide PCIe device\n" "\t-q, --qemu <path> QEMU binary\n" "\t-H, --qemu-host-cpu Use host CPU (requires KVM support)\n" - "\t-k, --kernel <image> Kernel bzImage, User Mode Linux\n" - "\t binary or source tree path\n" + "\t-k, --kernel <image> Kernel image or source tree path,\n" + "\t x86: bzImage or User Mode Linux\n" + "\t arm64: Image\n" "\t-F, --virtiofs[=<path>] Virtiofsd path or 'no'\n" "\t-T, --time-travel Run User Mode Linux on simulated\n" "\t time, with btvirt as calendar\n" "\t (default if supported)\n" "\t-R, --real-time Run User Mode Linux on real time\n" "\t-o, --option <opt> Additional argument passed to QEMU,\n" "\t or kernel parameter with User\n" "\t Mode Linux\n" -- 2.34.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-22 10:34 ` [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts Zijun Hu @ 2026-11-22 16:24 ` Pauli Virtanen 2026-11-23 1:04 ` Zijun Hu 2026-11-25 9:04 ` Bastien Nocera 1 sibling, 1 reply; 18+ messages in thread From: Pauli Virtanen @ 2026-11-22 16:24 UTC (permalink / raw) To: linux-bluetooth Hi, su, 2026-11-22 kello 02:34 -0800, Zijun Hu kirjoitti: > Add arm64 support by: > - Using qemu-system-aarch64 with the virt machine and the arm64 Image > - Passing -cpu max or host, as the default virt CPU is 32-bit > - Using earlycon and leaving out the x86-only options > - Warning when /dev/kvm is not accessible, as QEMU then falls back > to TCG Should it actually determine whether to run qemu x86 vs aarch based on what the kernel image is, and not the host system this is compiled for? > Assisted-by: Claude:claude-opus-5-5 > --- > doc/test-runner.rst | 5 ++++- > tools/test-runner.c | 49 ++++++++++++++++++++++++++++++++++++++++++------- > 2 files changed, 46 insertions(+), 8 deletions(-) > > diff --git a/doc/test-runner.rst b/doc/test-runner.rst > index b5876e4f5108..4ff9d1b02c1b 100644 > --- a/doc/test-runner.rst > +++ b/doc/test-runner.rst > @@ -21,17 +21,20 @@ OPTIONS > :-m/--monitor: Start btmon > :-l/--emulator[=num]: Start btvirt > :-A/-audio[=path]: Start audio server > :-u/--unix[=path]: Provide serial device > :-U/--usb=<qemu_args>: Provide USB device > :-P/--pcie=<qemu_args>: Provide PCIe device > :-q/--qemu=<path>: QEMU binary > :-H/--qemu-host-cpu: Use host CPU (requires KVM support) > -:-k/--kernel=<image>: Kernel image (bzImage) or User Mode Linux binary > +:-k/--kernel=<image>: Kernel image or source tree path: > + > + | x86: bzImage or User Mode Linux binary > + | arm64: Image > :-F/--virtiofs[=<path>]: Path to virtiofsd, or no to disable virtio-fs > :-T/--time-travel: Run a User Mode Linux kernel on simulated time, with > btvirt as time travel calendar (default if the kernel supports it) > :-R/--real-time: Run a User Mode Linux kernel on real time > :-o/--option=<opt>: Additional argument passed to QEMU, or kernel > parameter with User Mode Linux > :-h/--help: Show help options > > diff --git a/tools/test-runner.c b/tools/test-runner.c > index 0bca31a46351..a2105977c1ee 100644 > --- a/tools/test-runner.c > +++ b/tools/test-runner.c > @@ -128,20 +128,25 @@ static void strv_cleanup(struct strv *s) > > for (i = 0; i < s->i; ++i) > free(s->strv[i]); > > memset(s, 0, sizeof(*s)); > } > > static const char *qemu_table[] = { > +#if defined(__aarch64__) > + "qemu-system-aarch64", > + "/usr/bin/qemu-system-aarch64", > +#else > "qemu-system-x86_64", > "qemu-system-i386", > "/usr/bin/qemu-system-x86_64", > "/usr/bin/qemu-system-i386", > +#endif > NULL > }; > > static const char *find_qemu(void) > { > int i; > > for (i = 0; qemu_table[i]; i++) { > @@ -150,21 +155,26 @@ static const char *find_qemu(void) > if (!stat(qemu_table[i], &st)) > return qemu_table[i]; > } > > return NULL; > } > > static const char *kernel_table[] = { > +#if defined(__aarch64__) > + "Image", > + "arch/arm64/boot/Image", > +#else > "bzImage", > "arch/x86/boot/bzImage", > "vmlinux", > "arch/x86/boot/vmlinux", > "linux", > +#endif > NULL > }; > > /* A User Mode Linux kernel is an executable with the .uml.setup.init > * section, through which it registers its command line options. > */ > static bool is_uml_kernel(const char *path) > { > @@ -420,16 +430,19 @@ static char *const qemu_envp[] = { > > static void check_virtualization(void) > { > #ifdef HAVE_GET_CPUID > unsigned int eax, ebx, ecx, edx; > > if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && (ecx & (1 << 5))) > printf("Found support for Virtual Machine eXtensions\n"); > +#elif defined(__aarch64__) > + if (access("/dev/kvm", R_OK | W_OK) < 0) > + fprintf(stderr, "No access to /dev/kvm, falling back to TCG\n"); > #endif > } > > #define PCI_DEVICES_PATH "/sys/bus/pci/devices" > > static char pcie_bdf[16]; > static char pcie_driver[64]; > > @@ -894,16 +907,18 @@ static void qemu_signal(int sig) > if (qemu_pid > 0) > kill(qemu_pid, sig); > } > > static int start_qemu(void) > { > char cwd[PATH_MAX/2], initcmd[PATH_MAX], testargs[PATH_MAX]; > const char *fscmdline; > + const char *earlycon; > + const char *noacpi; > char cmdline[CMDLINE_MAX]; > char *argv_strv[EXTRA_OPT_MAX + 64]; > struct strv _cleanup_(strv_cleanup) argv = { argv_strv, > ARRAY_SIZE(argv_strv) }; > struct rootfs _cleanup_(rootfs_cleanup) rootfs = {{0}}; > int i, pos, status = 0; > pid_t pid; > > @@ -933,54 +948,71 @@ static int start_qemu(void) > } > > if (!virtiofsd) > fscmdline = "rootfstype=9p " > "rootflags=trans=virtio,version=9p2000.u"; > else > fscmdline = "rootfstype=virtiofs root=/dev/root"; > > +#if defined(__aarch64__) > + earlycon = "earlycon"; > + noacpi = ""; > +#else > + earlycon = "earlyprintk=serial"; > + /* PCIe passthrough requires ACPI and APIC for device enumeration > + * and MSI interrupts. > + */ > + noacpi = pcie_dev ? "" : "acpi=off pci=noacpi noapic"; > +#endif > + > snprintf(cmdline, sizeof(cmdline), > - "console=hvc0 earlyprintk=serial " > + "console=hvc0 %s " > "no_hash_pointers=1 %s %s quiet ro init=%s " > "TESTHOME=%s TESTDBUS=%u TESTDAEMON=%u " > "TESTDBUSSESSION=%u XDG_RUNTIME_DIR=/run/user/0 " > "TESTMONITOR=%u TESTEMULATOR=%u TESTDEVS=%d " > "TESTAUTO=%u TESTAUDIO='%s' TESTARGS=\'%s\'", > + earlycon, > fscmdline, > - /* PCIe passthrough requires ACPI and APIC for > - * device enumeration and MSI interrupts. > - */ > - pcie_dev ? "" : "acpi=off pci=noacpi noapic", > + noacpi, > initcmd, cwd, start_dbus, start_daemon, > start_dbus_session, > start_monitor, num_emulator, num_devs, > run_auto, audio_server ? audio_server : "", > testargs); > > /* Make sure qemu_binary is not null */ > if (!qemu_binary) { > fprintf(stderr, "No QEMU binary is set\n"); > return EXIT_FAILURE; > } > > strv_append(&argv, "%s", qemu_binary); > strv_concat(&argv, qemu_argv); > > +#if defined(__aarch64__) > + strv_append(&argv, "-machine"); > + strv_append(&argv, "virt,gic-version=max,accel=kvm:tcg"); > + > + strv_append(&argv, "-cpu"); > + strv_append(&argv, qemu_host_cpu ? "host" : "max"); > +#else > /* 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"); > } > +#endif > > strv_append(&argv, "-kernel"); > strv_append(&argv, "%s", kernel_image); > strv_append(&argv, "-append"); > strv_append(&argv, "%s", cmdline); > > coverage_setup(&argv, cwd); > > @@ -994,18 +1026,20 @@ static int start_qemu(void) > if (usb_dev) { > strv_append(&argv, "-device"); > strv_append(&argv, "qemu-xhci"); > strv_append(&argv, "-device"); > strv_append(&argv, "%s", usb_dev); > } > > if (pcie_dev) { > +#if !defined(__aarch64__) > strv_append(&argv, "-device"); > strv_append(&argv, "intel-iommu,intremap=on"); > +#endif > strv_append(&argv, "-device"); > strv_append(&argv, "%s", pcie_dev); > } > > if (!rootfs_setup(&rootfs, &argv)) > return EXIT_FAILURE; > > for (i = 0; i < num_extra_opts; ++i) > @@ -2193,18 +2227,19 @@ static void usage(void) > "\t-m, --monitor Start btmon\n" > "\t-l, --emulator[=num] Start btvirt\n" > "\t-A, --audio[=path] Start audio server\n" > "\t-u, --unix[=path] Provide serial device\n" > "\t-U, --usb <qemu_args> Provide USB device\n" > "\t-P, --pcie <qemu_args> Provide PCIe device\n" > "\t-q, --qemu <path> QEMU binary\n" > "\t-H, --qemu-host-cpu Use host CPU (requires KVM support)\n" > - "\t-k, --kernel <image> Kernel bzImage, User Mode Linux\n" > - "\t binary or source tree path\n" > + "\t-k, --kernel <image> Kernel image or source tree path,\n" > + "\t x86: bzImage or User Mode Linux\n" > + "\t arm64: Image\n" > "\t-F, --virtiofs[=<path>] Virtiofsd path or 'no'\n" > "\t-T, --time-travel Run User Mode Linux on simulated\n" > "\t time, with btvirt as calendar\n" > "\t (default if supported)\n" > "\t-R, --real-time Run User Mode Linux on real time\n" > "\t-o, --option <opt> Additional argument passed to QEMU,\n" > "\t or kernel parameter with User\n" > "\t Mode Linux\n" -- Pauli Virtanen ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-22 16:24 ` Pauli Virtanen @ 2026-11-23 1:04 ` Zijun Hu 2026-11-23 14:45 ` Luiz Augusto von Dentz 0 siblings, 1 reply; 18+ messages in thread From: Zijun Hu @ 2026-11-23 1:04 UTC (permalink / raw) To: linux-bluetooth, Pauli Virtanen On 11/23/2026 12:24 AM, Pauli Virtanen wrote: > su, 2026-11-22 kello 02:34 -0800, Zijun Hu kirjoitti: >> Add arm64 support by: >> - Using qemu-system-aarch64 with the virt machine and the arm64 Image >> - Passing -cpu max or host, as the default virt CPU is 32-bit >> - Using earlycon and leaving out the x86-only options >> - Warning when /dev/kvm is not accessible, as QEMU then falls back >> to TCG > Should it actually determine whether to run qemu x86 vs aarch based on > what the kernel image is, and not the host system this is compiled for? I don't think so. Choosing at build time is correct and simpler than at runtime: 1) The guest shares the host rootfs and runs the host binaries, with test-runner itself as init, so guest arch == host arch == the arch test-runner is built for, namely, the build arch decides both the host and guest arch. 2) Kernel images come in many formats (bzImage, vmlinux, Image, Image.gz, ...), so detecting the arch at runtime would add more logic than it is worth, while QEMU for a given arch already parses its formats with -kernel. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-23 1:04 ` Zijun Hu @ 2026-11-23 14:45 ` Luiz Augusto von Dentz 2026-11-24 2:57 ` Zijun Hu 0 siblings, 1 reply; 18+ messages in thread From: Luiz Augusto von Dentz @ 2026-11-23 14:45 UTC (permalink / raw) To: Zijun Hu; +Cc: linux-bluetooth, Pauli Virtanen Hi Zijun, On Sun, Nov 22, 2026 at 8:04 PM Zijun Hu <zijun.hu@oss.qualcomm.com> wrote: > > On 11/23/2026 12:24 AM, Pauli Virtanen wrote: > > su, 2026-11-22 kello 02:34 -0800, Zijun Hu kirjoitti: > >> Add arm64 support by: > >> - Using qemu-system-aarch64 with the virt machine and the arm64 Image > >> - Passing -cpu max or host, as the default virt CPU is 32-bit > >> - Using earlycon and leaving out the x86-only options > >> - Warning when /dev/kvm is not accessible, as QEMU then falls back > >> to TCG > > Should it actually determine whether to run qemu x86 vs aarch based on > > what the kernel image is, and not the host system this is compiled for? > > I don't think so. Choosing at build time is correct and simpler than > at runtime: > > 1) The guest shares the host rootfs and runs the host binaries, with > test-runner itself as init, so guest arch == host arch == the arch > test-runner is built for, namely, the build arch decides both the > host and guest arch. > > 2) Kernel images come in many formats (bzImage, vmlinux, Image, > Image.gz, ...), so detecting the arch at runtime would add more > logic than it is worth, while QEMU for a given arch already parses > its formats with -kernel. I guess that is a fair point: the tools binaries would have to be built for the same arch of the kernel image. However, that doesn't rule out running test-runner on an x86 host while mounting the rootfs with a cross compiled tools. I guess we shouldn't recommend that setup since it's counterproductive and considerably slower to compile and run. That said we could perhaps print an error if the user attempts to pass a kernel image of a different arch; test-runner should probably fail with a clear message stating that this is not supported. -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-23 14:45 ` Luiz Augusto von Dentz @ 2026-11-24 2:57 ` Zijun Hu 2026-11-24 15:20 ` Luiz Augusto von Dentz 0 siblings, 1 reply; 18+ messages in thread From: Zijun Hu @ 2026-11-24 2:57 UTC (permalink / raw) To: Luiz Augusto von Dentz; +Cc: linux-bluetooth, Pauli Virtanen On 11/23/2026 10:45 PM, Luiz Augusto von Dentz wrote: >>> Should it actually determine whether to run qemu x86 vs aarch based on >>> what the kernel image is, and not the host system this is compiled for? >> I don't think so. Choosing at build time is correct and simpler than >> at runtime: >> >> 1) The guest shares the host rootfs and runs the host binaries, with >> test-runner itself as init, so guest arch == host arch == the arch >> test-runner is built for, namely, the build arch decides both the >> host and guest arch. >> >> 2) Kernel images come in many formats (bzImage, vmlinux, Image, >> Image.gz, ...), so detecting the arch at runtime would add more >> logic than it is worth, while QEMU for a given arch already parses >> its formats with -kernel. > I guess that is a fair point: the tools binaries would have to be > built for the same arch of the kernel image. However, that doesn't > rule out running test-runner on an x86 host while mounting the rootfs > with a cross compiled tools. I guess we shouldn't recommend that setup That doesn't work, e.g. on an x86 host: test-runner(x86) -q qemu-system-aarch64 -k arch/arm64/boot/Image -- /bin/bash(arm64) since test-runner(x86) can't run in the arm64 guest as the init > since it's counterproductive and considerably slower to compile and Agreed. Actually, test-runner requires: arch test-runner is built for == host arch == guest kernel arch and failing when this rule is violated is expected. > run. That said we could perhaps print an error if the user attempts to > pass a kernel image of a different arch; test-runner should probably > fail with a clear message stating that this is not supported. So, is it acceptable to illustrate this rule in the ARCHITECTURE section of doc/test-runner.rst instead of parsing the various guest kernel image formats to detect the arch and print an error? ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-24 2:57 ` Zijun Hu @ 2026-11-24 15:20 ` Luiz Augusto von Dentz 2026-11-25 7:11 ` Zijun Hu 0 siblings, 1 reply; 18+ messages in thread From: Luiz Augusto von Dentz @ 2026-11-24 15:20 UTC (permalink / raw) To: Zijun Hu; +Cc: linux-bluetooth, Pauli Virtanen Hi Zijun, On Mon, Nov 23, 2026 at 9:57 PM Zijun Hu <zijun.hu@oss.qualcomm.com> wrote: > > On 11/23/2026 10:45 PM, Luiz Augusto von Dentz wrote: > >>> Should it actually determine whether to run qemu x86 vs aarch based on > >>> what the kernel image is, and not the host system this is compiled for? > >> I don't think so. Choosing at build time is correct and simpler than > >> at runtime: > >> > >> 1) The guest shares the host rootfs and runs the host binaries, with > >> test-runner itself as init, so guest arch == host arch == the arch > >> test-runner is built for, namely, the build arch decides both the > >> host and guest arch. > >> > >> 2) Kernel images come in many formats (bzImage, vmlinux, Image, > >> Image.gz, ...), so detecting the arch at runtime would add more > >> logic than it is worth, while QEMU for a given arch already parses > >> its formats with -kernel. > > I guess that is a fair point: the tools binaries would have to be > > built for the same arch of the kernel image. However, that doesn't > > rule out running test-runner on an x86 host while mounting the rootfs > > with a cross compiled tools. I guess we shouldn't recommend that setup > > That doesn't work, e.g. on an x86 host: > test-runner(x86) -q qemu-system-aarch64 -k arch/arm64/boot/Image -- /bin/bash(arm64) > since test-runner(x86) can't run in the arm64 guest as the init > > > since it's counterproductive and considerably slower to compile and > > Agreed. Actually, test-runner requires: > arch test-runner is built for == host arch == guest kernel arch > and failing when this rule is violated is expected. > > > run. That said we could perhaps print an error if the user attempts to > > pass a kernel image of a different arch; test-runner should probably > > fail with a clear message stating that this is not supported. > > So, is it acceptable to illustrate this rule in the ARCHITECTURE > section of doc/test-runner.rst instead of parsing the various guest > kernel image formats to detect the arch and print an error? Well, I'd think it probably trivial to parse the header to check if the kernel image matches test-runners arch, or you have a problem doing that? -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-24 15:20 ` Luiz Augusto von Dentz @ 2026-11-25 7:11 ` Zijun Hu 0 siblings, 0 replies; 18+ messages in thread From: Zijun Hu @ 2026-11-25 7:11 UTC (permalink / raw) To: Luiz Augusto von Dentz; +Cc: linux-bluetooth, Pauli Virtanen On 11/24/2026 11:20 PM, Luiz Augusto von Dentz wrote: >>> I guess that is a fair point: the tools binaries would have to be >>> built for the same arch of the kernel image. However, that doesn't >>> rule out running test-runner on an x86 host while mounting the rootfs >>> with a cross compiled tools. I guess we shouldn't recommend that setup >> That doesn't work, e.g. on an x86 host: >> test-runner(x86) -q qemu-system-aarch64 -k arch/arm64/boot/Image -- /bin/bash(arm64) >> since test-runner(x86) can't run in the arm64 guest as the init >> >>> since it's counterproductive and considerably slower to compile and >> Agreed. Actually, test-runner requires: >> arch test-runner is built for == host arch == guest kernel arch >> and failing when this rule is violated is expected. >> >>> run. That said we could perhaps print an error if the user attempts to >>> pass a kernel image of a different arch; test-runner should probably >>> fail with a clear message stating that this is not supported. >> So, is it acceptable to illustrate this rule in the ARCHITECTURE >> section of doc/test-runner.rst instead of parsing the various guest >> kernel image formats to detect the arch and print an error? > Well, I'd think it probably trivial to parse the header to check if > the kernel image matches test-runners arch, or you have a problem > doing that? For arm64, the check below has two issues: 1) It has false positives, since unknown files are accepted and check() may return 1 for a file of the wrong format 2) It is a lot of code, already ~90 lines for arm64, and x86 needs more on top So I'm not sure it is worth checking user input this way. Do you have a simpler and better check to suggest? struct kernel_image_desc { const char *name; size_t min_size; /* -1: unknown, 0: not supported, 1: supported */ int (*check)(const uint8_t *data, size_t size); }; #define KIMG_HDR_SIZE 128 #if defined(__aarch64__) static int arm64_image_check(const uint8_t *data, size_t size) { /* arm64 boot protocol magic at offset 0x38 */ return memcmp(data + 0x38, "ARM\x64", 4) ? -1 : 1; } static int arm64_image_gz_check(const uint8_t *data, size_t size) { /* gzip magic and deflate method */ if (data[0] != 0x1f || data[1] != 0x8b || data[2] != 0x08) return -1; /* gzip carries no arch field, accept it and let QEMU decide */ return 1; } static int arm64_efi_check(const uint8_t *data, size_t size) { uint32_t pe; /* MS-DOS magic and LINUX_PE_MAGIC of EFI bootable Linux images */ if (memcmp(data, "MZ", 2) || bt_get_le32(data + 0x38) != 0x818223cd) return -1; /* PE header offset at 0x3c, machine type follows the signature */ pe = bt_get_le32(data + 0x3c); if (pe > size - 6 || memcmp(data + pe, "PE\0\0", 4)) return -1; return bt_get_le16(data + pe + 4) == 0xaa64; } static int arm64_uimage_check(const uint8_t *data, size_t size) { if (bt_get_be32(data) != 0x27051956) return -1; /* ih_os IH_OS_LINUX and ih_arch IH_ARCH_ARM64 */ return data[28] == 5 && data[29] == 22; } static const struct kernel_image_desc arm64_kimg_table[] = { { "Image", 64, arm64_image_check }, { "Image.gz", 3, arm64_image_gz_check }, { "EFI image", 64, arm64_efi_check }, { "uImage", 64, arm64_uimage_check }, { } }; static bool validate_arm64_kernel_image(const char *kimg_name) { uint8_t data[KIMG_HDR_SIZE]; size_t size; FILE *fp; int i, ret; fp = fopen(kimg_name, "re"); if (!fp) return false; size = fread(data, 1, sizeof(data), fp); fclose(fp); for (i = 0; arm64_kimg_table[i].name; i++) { if (size < arm64_kimg_table[i].min_size) continue; ret = arm64_kimg_table[i].check(data, size); if (ret >= 0) return ret; } /* Unknown image, assume it is good */ fprintf(stderr, "Unknown ARM64 guest kernel image: %s\n", kimg_name); return true; } #endif main(): #if defined(__aarch64__) if (!validate_arm64_kernel_image(kernel_image)) { fprintf(stderr, "Unsupported kernel image %s\n", kernel_image); return EXIT_FAILURE; } #endif ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-22 10:34 ` [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts Zijun Hu 2026-11-22 16:24 ` Pauli Virtanen @ 2026-11-25 9:04 ` Bastien Nocera 2026-11-25 10:46 ` Zijun Hu 1 sibling, 1 reply; 18+ messages in thread From: Bastien Nocera @ 2026-11-25 9:04 UTC (permalink / raw) To: Zijun Hu, Linux Bluetooth Cc: Marcel Holtmann, Luiz Augusto von Dentz, Zijun Hu On Sun, 2026-11-22 at 02:34 -0800, Zijun Hu wrote: > Add arm64 support by: > - Using qemu-system-aarch64 with the virt machine and the arm64 Image > - Passing -cpu max or host, as the default virt CPU is 32-bit > - Using earlycon and leaving out the x86-only options > - Warning when /dev/kvm is not accessible, as QEMU then falls back > to TCG > > Assisted-by: Claude:claude-opus-5-5 > --- > doc/test-runner.rst | 5 ++++- > tools/test-runner.c | 49 ++++++++++++++++++++++++++++++++++++++++++- > ------ > 2 files changed, 46 insertions(+), 8 deletions(-) > > diff --git a/doc/test-runner.rst b/doc/test-runner.rst > index b5876e4f5108..4ff9d1b02c1b 100644 > --- a/doc/test-runner.rst > +++ b/doc/test-runner.rst > @@ -21,17 +21,20 @@ OPTIONS > :-m/--monitor: Start btmon > :-l/--emulator[=num]: Start btvirt > :-A/-audio[=path]: Start audio server > :-u/--unix[=path]: Provide serial device > :-U/--usb=<qemu_args>: Provide USB device > :-P/--pcie=<qemu_args>: Provide PCIe device > :-q/--qemu=<path>: QEMU binary > :-H/--qemu-host-cpu: Use host CPU (requires KVM support) > -:-k/--kernel=<image>: Kernel image (bzImage) or User Mode Linux > binary > +:-k/--kernel=<image>: Kernel image or source tree path: > + > + | x86: bzImage or User Mode Linux binary > + | arm64: Image Is there anything actually stopping running User Mode Linux on aarch64 systems? > :-F/--virtiofs[=<path>]: Path to virtiofsd, or no to disable virtio- > fs > :-T/--time-travel: Run a User Mode Linux kernel on simulated time, > with > btvirt as time travel calendar (default if the kernel supports > it) > :-R/--real-time: Run a User Mode Linux kernel on real time > :-o/--option=<opt>: Additional argument passed to QEMU, or kernel > parameter with User Mode Linux > :-h/--help: Show help options > > diff --git a/tools/test-runner.c b/tools/test-runner.c > index 0bca31a46351..a2105977c1ee 100644 > --- a/tools/test-runner.c > +++ b/tools/test-runner.c > @@ -128,20 +128,25 @@ static void strv_cleanup(struct strv *s) > > for (i = 0; i < s->i; ++i) > free(s->strv[i]); > > memset(s, 0, sizeof(*s)); > } > > static const char *qemu_table[] = { > +#if defined(__aarch64__) > + "qemu-system-aarch64", > + "/usr/bin/qemu-system-aarch64", > +#else > "qemu-system-x86_64", > "qemu-system-i386", > "/usr/bin/qemu-system-x86_64", > "/usr/bin/qemu-system-i386", > +#endif > NULL > }; > > static const char *find_qemu(void) > { > int i; > > for (i = 0; qemu_table[i]; i++) { > @@ -150,21 +155,26 @@ static const char *find_qemu(void) > if (!stat(qemu_table[i], &st)) > return qemu_table[i]; > } > > return NULL; > } > > static const char *kernel_table[] = { > +#if defined(__aarch64__) > + "Image", > + "arch/arm64/boot/Image", > +#else > "bzImage", > "arch/x86/boot/bzImage", > "vmlinux", > "arch/x86/boot/vmlinux", > "linux", > +#endif > NULL > }; > > /* A User Mode Linux kernel is an executable with the > .uml.setup.init > * section, through which it registers its command line options. > */ > static bool is_uml_kernel(const char *path) > { > @@ -420,16 +430,19 @@ static char *const qemu_envp[] = { > > static void check_virtualization(void) > { > #ifdef HAVE_GET_CPUID > unsigned int eax, ebx, ecx, edx; > > if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && (ecx & (1 << > 5))) > printf("Found support for Virtual Machine > eXtensions\n"); > +#elif defined(__aarch64__) > + if (access("/dev/kvm", R_OK | W_OK) < 0) > + fprintf(stderr, "No access to /dev/kvm, falling back > to TCG\n"); > #endif > } > > #define PCI_DEVICES_PATH "/sys/bus/pci/devices" > > static char pcie_bdf[16]; > static char pcie_driver[64]; > > @@ -894,16 +907,18 @@ static void qemu_signal(int sig) > if (qemu_pid > 0) > kill(qemu_pid, sig); > } > > static int start_qemu(void) > { > char cwd[PATH_MAX/2], initcmd[PATH_MAX], testargs[PATH_MAX]; > const char *fscmdline; > + const char *earlycon; > + const char *noacpi; > char cmdline[CMDLINE_MAX]; > char *argv_strv[EXTRA_OPT_MAX + 64]; > struct strv _cleanup_(strv_cleanup) argv = { argv_strv, > ARRAY_SIZE(a > rgv_strv) }; > struct rootfs _cleanup_(rootfs_cleanup) rootfs = {{0}}; > int i, pos, status = 0; > pid_t pid; > > @@ -933,54 +948,71 @@ static int start_qemu(void) > } > > if (!virtiofsd) > fscmdline = "rootfstype=9p " > "rootflags=trans=virtio,version=9p20 > 00.u"; > else > fscmdline = "rootfstype=virtiofs root=/dev/root"; > > +#if defined(__aarch64__) > + earlycon = "earlycon"; > + noacpi = ""; > +#else > + earlycon = "earlyprintk=serial"; > + /* PCIe passthrough requires ACPI and APIC for device > enumeration > + * and MSI interrupts. > + */ > + noacpi = pcie_dev ? "" : "acpi=off pci=noacpi noapic"; > +#endif > + > snprintf(cmdline, sizeof(cmdline), > - "console=hvc0 earlyprintk=serial " > + "console=hvc0 %s " > "no_hash_pointers=1 %s %s quiet ro > init=%s " > "TESTHOME=%s TESTDBUS=%u > TESTDAEMON=%u " > "TESTDBUSSESSION=%u > XDG_RUNTIME_DIR=/run/user/0 " > "TESTMONITOR=%u TESTEMULATOR=%u > TESTDEVS=%d " > "TESTAUTO=%u TESTAUDIO='%s' > TESTARGS=\'%s\'", > + earlycon, > fscmdline, > - /* PCIe passthrough requires ACPI > and APIC for > - * device enumeration and MSI > interrupts. > - */ > - pcie_dev ? "" : "acpi=off pci=noacpi > noapic", > + noacpi, > initcmd, cwd, start_dbus, > start_daemon, > start_dbus_session, > start_monitor, num_emulator, > num_devs, > run_auto, audio_server ? > audio_server : "", > testargs); > > /* Make sure qemu_binary is not null */ > if (!qemu_binary) { > fprintf(stderr, "No QEMU binary is set\n"); > return EXIT_FAILURE; > } > > strv_append(&argv, "%s", qemu_binary); > strv_concat(&argv, qemu_argv); > > +#if defined(__aarch64__) > + strv_append(&argv, "-machine"); > + strv_append(&argv, "virt,gic-version=max,accel=kvm:tcg"); > + > + strv_append(&argv, "-cpu"); > + strv_append(&argv, qemu_host_cpu ? "host" : "max"); > +#else > /* 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"); > } > +#endif > > strv_append(&argv, "-kernel"); > strv_append(&argv, "%s", kernel_image); > strv_append(&argv, "-append"); > strv_append(&argv, "%s", cmdline); > > coverage_setup(&argv, cwd); > > @@ -994,18 +1026,20 @@ static int start_qemu(void) > if (usb_dev) { > strv_append(&argv, "-device"); > strv_append(&argv, "qemu-xhci"); > strv_append(&argv, "-device"); > strv_append(&argv, "%s", usb_dev); > } > > if (pcie_dev) { > +#if !defined(__aarch64__) > strv_append(&argv, "-device"); > strv_append(&argv, "intel-iommu,intremap=on"); > +#endif > strv_append(&argv, "-device"); > strv_append(&argv, "%s", pcie_dev); > } > > if (!rootfs_setup(&rootfs, &argv)) > return EXIT_FAILURE; > > for (i = 0; i < num_extra_opts; ++i) > @@ -2193,18 +2227,19 @@ static void usage(void) > "\t-m, --monitor Start btmon\n" > "\t-l, --emulator[=num] Start btvirt\n" > "\t-A, --audio[=path] Start audio server\n" > "\t-u, --unix[=path] Provide serial device\n" > "\t-U, --usb <qemu_args> Provide USB device\n" > "\t-P, --pcie <qemu_args> Provide PCIe device\n" > "\t-q, --qemu <path> QEMU binary\n" > "\t-H, --qemu-host-cpu Use host CPU (requires KVM > support)\n" > - "\t-k, --kernel <image> Kernel bzImage, User Mode > Linux\n" > - "\t binary or source tree > path\n" > + "\t-k, --kernel <image> Kernel image or source > tree path,\n" > + "\t x86: bzImage or User Mode > Linux\n" > + "\t arm64: Image\n" > "\t-F, --virtiofs[=<path>] Virtiofsd path or > 'no'\n" > "\t-T, --time-travel Run User Mode Linux on > simulated\n" > "\t time, with btvirt as > calendar\n" > "\t (default if supported)\n" > "\t-R, --real-time Run User Mode Linux on > real time\n" > "\t-o, --option <opt> Additional argument passed > to QEMU,\n" > "\t or kernel parameter with > User\n" > "\t Mode Linux\n" ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-25 9:04 ` Bastien Nocera @ 2026-11-25 10:46 ` Zijun Hu 2026-11-25 11:07 ` Bastien Nocera 0 siblings, 1 reply; 18+ messages in thread From: Zijun Hu @ 2026-11-25 10:46 UTC (permalink / raw) To: Bastien Nocera; +Cc: linux-bluetooth, Luiz Augusto von Dentz On Wed, 2026-11-25 at 10:04 +0100, Bastien Nocera wrote: > Is there anything actually stopping running User Mode Linux on aarch64 > systems? No, nothing stops it as far as I know. There is no such requirement on my side, so I did not look into it. Thanks, Zijun ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts 2026-11-25 10:46 ` Zijun Hu @ 2026-11-25 11:07 ` Bastien Nocera 0 siblings, 0 replies; 18+ messages in thread From: Bastien Nocera @ 2026-11-25 11:07 UTC (permalink / raw) To: Zijun Hu; +Cc: linux-bluetooth, Luiz Augusto von Dentz On Wed, 2026-11-25 at 02:46 -0800, Zijun Hu wrote: > On Wed, 2026-11-25 at 10:04 +0100, Bastien Nocera wrote: > > Is there anything actually stopping running User Mode Linux on > > aarch64 > > systems? > > No, nothing stops it as far as I know. There is no such requirement > on > my side, so I did not look into it. OK, then you'll want to fix the docs you modified. > + | x86: bzImage or User Mode Linux binary > + | arm64: Image Cheers ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH bluez 3/3] tools/test-runner: Allow suppressing noisy bluetoothd debug output 2026-11-22 10:34 [PATCH bluez 0/3] tools/test-runner: Add arm64 host support Zijun Hu 2026-11-22 10:34 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Zijun Hu 2026-11-22 10:34 ` [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts Zijun Hu @ 2026-11-22 10:34 ` Zijun Hu 2 siblings, 0 replies; 18+ messages in thread From: Zijun Hu @ 2026-11-22 10:34 UTC (permalink / raw) To: Linux Bluetooth; +Cc: Marcel Holtmann, Luiz Augusto von Dentz, Zijun Hu test-runner always starts bluetoothd with -d, which floods the console with debug output when only the test output is of interest. Add an optional bluetoothd run mode to -d, e.g. -d2: - 1: --nodetach -d [-f src/main.conf] (default) - 2: --nodetach [-f src/main.conf] Also make supporting other run modes easier in the future. Existing usage in doc/test-runner.rst still works since -d without a mode behaves as before. Assisted-by: Claude:claude-opus-5-5 --- doc/test-runner.rst | 16 ++++++++++++- tools/test-runner.c | 65 +++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/doc/test-runner.rst b/doc/test-runner.rst index 4ff9d1b02c1b..b9dc4f1f45a1 100644 --- a/doc/test-runner.rst +++ b/doc/test-runner.rst @@ -12,17 +12,20 @@ it launches a virtual machine using qemu(1) with the host filesystem mounted read-only inside the guest. OPTIONS ======= :-a:--auto: Find tests and run them :-b/--dbus: Start D-Bus system daemon :-s/--dbus-session: Start D-Bus session daemon -:-d/--daemon: Start bluetoothd +:-d/--daemon[=mode]: Start bluetoothd, mode (default 1): + + | 1: --nodetach -d [-f src/main.conf] + | 2: --nodetach [-f src/main.conf] :-m/--monitor: Start btmon :-l/--emulator[=num]: Start btvirt :-A/-audio[=path]: Start audio server :-u/--unix[=path]: Provide serial device :-U/--usb=<qemu_args>: Provide USB device :-P/--pcie=<qemu_args>: Provide PCIe device :-q/--qemu=<path>: QEMU binary :-H/--qemu-host-cpu: Use host CPU (requires KVM support) @@ -359,16 +362,27 @@ Running bluetoothctl with emulated controller and audio support Running shell with host controller using btproxy ------------------------------------------------ .. code-block:: $ tools/btproxy -u [1] $ tools/test-runner -u -d -k /pathto/bzImage -- /bin/bash [2] +Running bluetoothctl with host controller using btproxy for normal output +-------------------------------------------------------------------------- + +With -d2, bluetoothd is started without -d, so the bluetoothctl console +is not flooded with debug output: + +.. code-block:: + + $ tools/btproxy -u [1] + $ tools/test-runner -u -d2 -k /pathto/bzImage -- client/bluetoothctl [2] + Running shell with host controller USB-passthrough -------------------------------------------------- In addition the above kernel config option the following is required: .. code-block:: CONFIG_USB=y diff --git a/tools/test-runner.c b/tools/test-runner.c index a2105977c1ee..bcfa4b2971ff 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -50,25 +50,26 @@ #endif #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define _cleanup_(f) __attribute__((cleanup(f))) #define CMDLINE_MAX (2048 * 10) #define EXTRA_OPT_MAX 64 +#define DAEMON_MODE_MAX 3 static const char *own_binary; static char **test_argv; static int test_argc; static bool run_auto = false; static bool start_dbus = false; static bool start_dbus_session; -static bool start_daemon = false; +static unsigned int start_daemon; static bool start_monitor = false; static bool qemu_host_cpu = false; /* Simulated time with User Mode Linux: -1 if supported by the kernel */ static int time_travel = -1; static int num_devs = 0; static int num_emulator = 0; static const char *device_path = "/tmp/bt-server-bredr"; static const char *qemu_binary = NULL; @@ -1578,17 +1579,17 @@ static const char *daemon_table[] = { "/usr/sbin/bluetoothd", "/usr/libexec/bluetooth/bluetoothd", NULL }; static pid_t start_bluetooth_daemon(const char *home) { const char *daemon = NULL; - char *argv[6], *envp[2]; + char *argv[6] = { NULL }, *envp[2]; pid_t pid; struct stat st; int i; if (chdir(home + 5) < 0) { perror("Failed to change home directory for daemon"); return -1; } @@ -1603,25 +1604,40 @@ static pid_t start_bluetooth_daemon(const char *home) if (!daemon) { fprintf(stderr, "Failed to locate Bluetooth daemon binary\n"); return -1; } printf("Using Bluetooth daemon %s\n", daemon); - argv[0] = (char *) daemon; - argv[1] = "--nodetach"; - argv[2] = "-d"; - argv[3] = NULL; + i = 0; + argv[i++] = (char *) daemon; - if (!stat("src/main.conf", &st)) { - argv[3] = "-f"; - argv[4] = "src/main.conf"; - argv[5] = NULL; + switch (start_daemon) { + case 1: + argv[i++] = "--nodetach"; + argv[i++] = "-d"; + + if (!stat("src/main.conf", &st)) { + argv[i++] = "-f"; + argv[i++] = "src/main.conf"; + } + break; + case 2: + argv[i++] = "--nodetach"; + + if (!stat("src/main.conf", &st)) { + argv[i++] = "-f"; + argv[i++] = "src/main.conf"; + } + break; + default: + fprintf(stderr, "Invalid daemon mode %u\n", start_daemon); + return -1; } envp[0] = "DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket"; envp[1] = NULL; printf("Starting Bluetooth daemon\n"); pid = fork(); @@ -2165,20 +2181,21 @@ static void run_tests(void) } ptr = strstr(cmdline, "TESTDBUSSESSION=1"); if (ptr) { printf("D-Bus session daemon requested\n"); start_dbus_session = true; } - ptr = strstr(cmdline, "TESTDAEMON=1"); + ptr = strstr(cmdline, "TESTDAEMON="); if (ptr) { - printf("bluetoothd requested\n"); - start_daemon = true; + start_daemon = strtoul(ptr + 11, NULL, 0); + if (start_daemon) + printf("bluetoothd mode %u requested\n", start_daemon); } ptr = strstr(cmdline, "TESTMONITOR=1"); if (ptr) { printf("Monitor requested\n"); start_monitor = true; } @@ -2218,17 +2235,19 @@ static void usage(void) { printf("test-runner - Automated test execution utility\n" "Usage:\n"); printf("\ttest-runner [options] [--] <command> [args]\n"); printf("Options:\n" "\t-a, --all,--auto Find tests and run them\n" "\t-b, --dbus Start D-Bus system daemon\n" "\t-s, --dbus-session Start D-Bus session daemon\n" - "\t-d, --daemon Start bluetoothd\n" + "\t-d, --daemon[=mode] Start bluetoothd, mode (default 1):\n" + "\t 1: --nodetach -d [-f src/main.conf]\n" + "\t 2: --nodetach [-f src/main.conf]\n" "\t-m, --monitor Start btmon\n" "\t-l, --emulator[=num] Start btvirt\n" "\t-A, --audio[=path] Start audio server\n" "\t-u, --unix[=path] Provide serial device\n" "\t-U, --usb <qemu_args> Provide USB device\n" "\t-P, --pcie <qemu_args> Provide PCIe device\n" "\t-q, --qemu <path> QEMU binary\n" "\t-H, --qemu-host-cpu Use host CPU (requires KVM support)\n" @@ -2247,17 +2266,17 @@ static void usage(void) } static const struct option main_options[] = { { "all", no_argument, NULL, 'a' }, { "auto", no_argument, NULL, 'a' }, { "dbus", no_argument, NULL, 'b' }, { "dbus-session", no_argument, NULL, 's' }, { "unix", optional_argument, NULL, 'u' }, - { "daemon", no_argument, NULL, 'd' }, + { "daemon", optional_argument, NULL, 'd' }, { "emulator", no_argument, NULL, 'l' }, { "monitor", no_argument, NULL, 'm' }, { "qemu", required_argument, NULL, 'q' }, { "qemu-host-cpu", no_argument, NULL, 'H' }, { "kernel", required_argument, NULL, 'k' }, { "audio", optional_argument, NULL, 'A' }, { "usb", required_argument, NULL, 'U' }, { "pcie", required_argument, NULL, 'P' }, @@ -2288,17 +2307,17 @@ int main(int argc, char *argv[]) reboot(RB_AUTOBOOT); return EXIT_SUCCESS; } for (;;) { int opt; opt = getopt_long(argc, argv, - "au::bdsl::mq:Hk:A::U:P:o:F::TRvh", + "au::bd::sl::mq:Hk:A::U:P:o:F::TRvh", main_options, NULL); if (opt < 0) break; switch (opt) { case 'a': run_auto = true; break; @@ -2310,17 +2329,29 @@ int main(int argc, char *argv[]) case 'b': start_dbus = true; break; case 's': start_dbus_session = true; break; case 'd': start_dbus = true; - start_daemon = true; + start_daemon = 1; + if (optarg) { + char *endptr; + + start_daemon = strtoul(optarg, &endptr, 0); + if (start_daemon >= DAEMON_MODE_MAX || + *endptr) { + fprintf(stderr, + "Invalid daemon mode %s\n", + optarg); + return EXIT_FAILURE; + } + } break; case 'l': num_emulator = optarg ? atoi(optarg) : 1; break; case 'm': start_monitor = true; break; case 'q': -- 2.34.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH bluez v2 1/7] tools/test-runner: Fix TESTHOME parsing for short paths
@ 2026-11-26 2:45 Zijun Hu
2026-11-26 5:40 ` tools/test-runner: Add arm64 host support bluez.test.bot
0 siblings, 1 reply; 18+ messages in thread
From: Zijun Hu @ 2026-11-26 2:45 UTC (permalink / raw)
To: Linux Bluetooth
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Pauli Virtanen,
Bastien Nocera, Zijun Hu
TESTHOME is parsed wrongly if its value is shorter than 4 characters.
Taking command line "TESTHOME=/ TESTDBUS=0" as an example, TESTHOME is
parsed as the wrong "/ TESTDBUS=0" instead of the right "/", which
causes the following error:
$ cd /
$ tools/test-runner -k /pathto/bzImage -- /bin/bash
tools/test-runner TESTHOME=/ TESTDBUS=0 TESTDAEMON=0 ...
......
Running command /bin/bash
New process 67 created
Changing into directory / TESTDBUS=0
Failed to change directory: No such file or directory
Fix by searching from @ptr + 9, the TESTHOME value start, instead of
@home + 9.
Fixes: e622e623de13 ("build: Add test-runner utility for virtual machine execution")
Assisted-by: Claude:claude-opus-5-5
---
Previous version:
https://lore.kernel.org/all/20261119-fix_test_runner-v1-1-ddad300e86ed@oss.qualcomm.com
Changes since previous version:
- Improve the commit message with command and error log
---
tools/test-runner.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/test-runner.c b/tools/test-runner.c
index 0bca31a46351..6b8d0522fa7a 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -2167,17 +2167,17 @@ static void run_tests(void)
audio_server = strndup(start, end - start);
printf("Audio server %s requested\n", audio_server);
}
}
ptr = strstr(cmdline, "TESTHOME=");
if (ptr) {
home = ptr + 4;
- ptr = strpbrk(home + 9, " \r\n");
+ ptr = strpbrk(ptr + 9, " \r\n");
if (ptr)
*ptr = '\0';
}
run_command(cmds, home);
}
static void usage(void)
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread* RE: tools/test-runner: Add arm64 host support 2026-11-26 2:45 [PATCH bluez v2 1/7] tools/test-runner: Fix TESTHOME parsing for short paths Zijun Hu @ 2026-11-26 5:40 ` bluez.test.bot 0 siblings, 0 replies; 18+ messages in thread From: bluez.test.bot @ 2026-11-26 5:40 UTC (permalink / raw) To: linux-bluetooth, zijun.hu [-- Attachment #1: Type: text/plain, Size: 1523 bytes --] 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/1222817/ ---Test result--- Test Summary: CheckPatch PASS 3.47 seconds GitLint FAIL 2.31 seconds BuildEll PASS 20.29 seconds BluezMake PASS 313.61 seconds MakeCheck PASS 14.88 seconds MakeDistcheck PASS 148.04 seconds CheckValgrind PASS 354.53 seconds CheckSmatch PASS 317.68 seconds bluezmakeextell PASS 101.07 seconds TestFunctional PASS 1234.81 seconds IncrementalBuild PASS 325.35 seconds ScanBuild PASS 1211.39 seconds Details ############################## Test: GitLint - FAIL Desc: Run gitlint Output: [bluez,v2,3/7] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ 1: T1 Title exceeds max length (81>80): "[bluez,v2,3/7] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/" [bluez,v2,5/7] tools/test-runner: Allow suppressing noisy bluetoothd debug output 1: T1 Title exceeds max length (81>80): "[bluez,v2,5/7] tools/test-runner: Allow suppressing noisy bluetoothd debug output" https://github.com/bluez/bluez/pull/2930 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2026-11-26 5:40 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-22 10:34 [PATCH bluez 0/3] tools/test-runner: Add arm64 host support Zijun Hu 2026-11-22 10:34 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Zijun Hu 2026-11-22 18:56 ` tools/test-runner: Add arm64 host support bluez.test.bot 2026-11-25 8:59 ` [PATCH bluez 1/3] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Bastien Nocera 2026-11-25 10:43 ` Zijun Hu 2026-11-25 11:06 ` Bastien Nocera 2026-11-22 10:34 ` [PATCH bluez 2/3] tools/test-runner: Support running on arm64 hosts Zijun Hu 2026-11-22 16:24 ` Pauli Virtanen 2026-11-23 1:04 ` Zijun Hu 2026-11-23 14:45 ` Luiz Augusto von Dentz 2026-11-24 2:57 ` Zijun Hu 2026-11-24 15:20 ` Luiz Augusto von Dentz 2026-11-25 7:11 ` Zijun Hu 2026-11-25 9:04 ` Bastien Nocera 2026-11-25 10:46 ` Zijun Hu 2026-11-25 11:07 ` Bastien Nocera 2026-11-22 10:34 ` [PATCH bluez 3/3] tools/test-runner: Allow suppressing noisy bluetoothd debug output Zijun Hu -- strict thread matches above, loose matches on Subject: below -- 2026-11-26 2:45 [PATCH bluez v2 1/7] tools/test-runner: Fix TESTHOME parsing for short paths Zijun Hu 2026-11-26 5:40 ` tools/test-runner: Add arm64 host support bluez.test.bot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.