xtask: use `-cpu host` iff host == guest

reviewable/pr1365/r34
Tamir Duberstein 7 days ago
parent fd18c3f4ab
commit 0484ab5c57
No known key found for this signature in database

@ -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"),
};

Loading…
Cancel
Save