From: Roman Bogorodskiy Date: Wed, 21 Jan 2026 19:15:37 +0000 (+0100) Subject: bhyve: add capability probing for ACPI X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=caf74fab507c7f0a8c6df13f3fc605d8b985a8aa;p=thirdparty%2Flibvirt.git bhyve: add capability probing for ACPI Bhyve used the '-A' flag to enable ACPI until it was deprecated by commit: https://cgit.freebsd.org/src/commit/?id=6a0e7f908802b86ca5d1c0b3c404b8391d0f626e With that, ACPI tables are always generated. As this change is relatively new and there are likely systems that have bhyve(8) that requires using the '-A' flag, add a capability probing for that, and use this flag if it's supported. Signed-off-by: Roman Bogorodskiy Reviewed-by: Michal Privoznik --- diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c index e4cfc6720b..d2a48ed30c 100644 --- a/src/bhyve/bhyve_capabilities.c +++ b/src/bhyve/bhyve_capabilities.c @@ -255,6 +255,9 @@ bhyveProbeCapsFromHelp(unsigned int *caps, char *binary) if (strstr(help, "-c vcpus") == NULL) *caps |= BHYVE_CAP_CPUTOPOLOGY; + if (strstr(help, "-A:") != NULL) + *caps |= BHYVE_CAP_ACPI; + return 0; } diff --git a/src/bhyve/bhyve_capabilities.h b/src/bhyve/bhyve_capabilities.h index 500b235397..d5346df7ba 100644 --- a/src/bhyve/bhyve_capabilities.h +++ b/src/bhyve/bhyve_capabilities.h @@ -55,6 +55,7 @@ typedef enum { BHYVE_CAP_VIRTIO_9P = 1 << 9, BHYVE_CAP_VIRTIO_RND = 1 << 10, BHYVE_CAP_NVME = 1 << 11, + BHYVE_CAP_ACPI = 1 << 12, } virBhyveCapsFlags; int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps); diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 54e9185e8a..417daefa7f 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -949,7 +949,12 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver, virDomainDef *def, virCommandAddArg(cmd, "-S"); /* Wire guest memory */ /* Options */ - if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON) + if ((def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON) && + (bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_ACPI)) + /* As of FreeBSD commit + * https://cgit.freebsd.org/src/commit/?id=6a0e7f908802b86ca5d1c0b3c404b8391d0f626e + * bhyve(8) generates ACPI tables unconditionally, so nothing needs to be done + * if the capability is missing. */ virCommandAddArg(cmd, "-A"); /* Create an ACPI table */ if (def->features[VIR_DOMAIN_FEATURE_MSRS] == VIR_TRISTATE_SWITCH_ON) { if (def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN] == VIR_DOMAIN_MSRS_UNKNOWN_IGNORE) diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-acpiapic.args b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-acpiapic.args index a3d521069d..26c96a5cee 100644 --- a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-acpiapic.args +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-acpiapic.args @@ -1,7 +1,6 @@ bhyve \ -c 1 \ -m 214 \ --A \ -u \ -H \ -P \ diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index ae43445cde..7dc97daf4f 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -204,6 +204,8 @@ mymain(void) DO_TEST("base"); DO_TEST("wired"); DO_TEST("acpiapic"); + driver.bhyvecaps &= ~BHYVE_CAP_ACPI; + DO_TEST_FAILURE("acpiapic"); DO_TEST("disk-cdrom"); DO_TEST("disk-virtio"); DO_TEST("macaddr");