From 0484ab5c575de615458d9177b195f0e5a7cd6554 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 10 Nov 2025 11:58:45 -0500 Subject: [PATCH] xtask: use `-cpu host` iff host == guest --- xtask/src/run.rs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/xtask/src/run.rs b/xtask/src/run.rs index a5da361f..2580f26d 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -476,8 +476,33 @@ pub(crate) fn run(opts: Options) -> Result<()> { let guest_arch = guest_arch.trim(); let (guest_arch, machine, cpu, console) = match guest_arch { - "ARM64" => ("aarch64", Some("virt"), Some("max"), "ttyAMA0"), - "x86" => ("x86_64", None, Some("host"), "ttyS0"), + "ARM64" => ( + "aarch64", + Some("virt"), + // NB: we'd prefer to write: + // + // ``` + // Some(if cfg!(target_arch = "aarch64") { + // "host" + // } else { + // "max" + // })) + // ``` + // + // but that only works in the presence of KVM or HVF and + // Github arm64 runners do not support nested + // virtualization. Since we aren't doing our own KVM/HVF + // detection (we let QEMU pick the best accelerator), we + // use "max" instead. + Some("max"), + "ttyAMA0", + ), + "x86" => ( + "x86_64", + None, + cfg!(target_arch = "x86_64").then_some("host"), + "ttyS0", + ), guest_arch => (guest_arch, None, None, "ttyS0"), };