]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
bhyve: add capability probing for ACPI
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Wed, 21 Jan 2026 19:15:37 +0000 (20:15 +0100)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Thu, 12 Feb 2026 17:53:48 +0000 (18:53 +0100)
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 <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/bhyve/bhyve_capabilities.c
src/bhyve/bhyve_capabilities.h
src/bhyve/bhyve_command.c
tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-acpiapic.args
tests/bhyvexml2argvtest.c

index e4cfc6720b6f3c613363471d293e76f13c786f1c..d2a48ed30c61d433a8d77132b4b9e8a3b6b8e5e7 100644 (file)
@@ -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;
 }
 
index 500b2353979a906498d9d6e5f128be79fd37aadb..d5346df7bab657aa72f60954cd0550bc36adfd48 100644 (file)
@@ -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);
index 54e9185e8a9210d35ec9fa018aaec5e4b66992e9..417daefa7fc00678fe1339638d1aaa38ce29cc28 100644 (file)
@@ -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)
index a3d521069d522a7e1e0570829c840abbce8d513b..26c96a5cee21d09cfb7e37cb083c5a08b2717512 100644 (file)
@@ -1,7 +1,6 @@
 bhyve \
 -c 1 \
 -m 214 \
--A \
 -u \
 -H \
 -P \
index ae43445cdef1d8dca43968fbd7c7185ad36667e7..7dc97daf4fa22dd45edf58dfd5756d3043e4df8f 100644 (file)
@@ -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");