]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
bhyve: workaround for the lack of UTC clock on ARM64
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Tue, 13 Jan 2026 18:30:23 +0000 (19:30 +0100)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Mon, 19 Jan 2026 18:27:39 +0000 (19:27 +0100)
Currently, bhyve does not support UTC clock offset on ARM64.
However, when <clock offset= > is not specified in the domain XML,
UTC offset is used by default. That results in an incorrect
configuration for the bhyve ARM64 guests by default.

Workaround is to extend bhyveDomainDefPostParse() to fall back
to the LOCALTIME clock offset when UTC clock offset is not
supported by bhyve.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/bhyve/bhyve_domain.c
tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args
tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args
tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args
tests/bhyvexml2argvtest.c
tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml
tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-bootloader.xml
tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml
tests/bhyvexml2xmltest.c

index 0c33a67ca6607b0be17840fe634ee2b551a8f090..df0a008ecde2a9b92747bc9e5ee5bc89b833de3c 100644 (file)
@@ -106,6 +106,12 @@ bhyveDomainDefPostParse(virDomainDef *def,
                                        VIR_DOMAIN_CONTROLLER_MODEL_ISA_DEFAULT);
     }
 
+    /* When not specified in the domain XML, clock.offset defaults to UTC which is
+     * not supported by bhyve on ARM64. So force it to LOCALTIME. */
+    if ((def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_UTC) &&
+        !(bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_RTC_UTC))
+        def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME;
+
     return 0;
 }
 
index 51eef94fd00912efab39c1ae5564074f5003d1fb..aef3ebd01782086211fc28be4421debb567c1269 100644 (file)
@@ -1,7 +1,6 @@
 bhyve \
 -c 1 \
 -m 214 \
--u \
 -s 0:0,hostbridge \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 \
 -s 2:0,virtio-blk,/tmp/freebsd.img \
index a07e70d7d4bfbd9ec7e5751434cd0aeee01c76c6..1079beee52477d7640474c408bf4a23b66546b90 100644 (file)
@@ -1,7 +1,6 @@
 bhyve \
 -c 1 \
 -m 214 \
--u \
 -s 0:0,hostbridge \
 -o bootrom=/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 \
index ae0e6bc1b33fa686ce7d5f011460635a380de25c..4a031afb71881be539815e42bd88054d60deedcb 100644 (file)
@@ -1,7 +1,6 @@
 bhyve \
 -c 1 \
 -m 214 \
--u \
 -s 0:0,hostbridge \
 -s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 \
 -s 2:0,virtio-blk,/tmp/freebsd.img \
index 47b2726b14e9fbf88f002c9b846c066fc0ce065b..c7c18c3690fed0b59b3b750b3affde77cf5c335f 100644 (file)
@@ -333,6 +333,8 @@ mymain(void)
     /* arm64 tests */
     virTestSetHostArch(VIR_ARCH_AARCH64);
     driver.caps = virBhyveCapsBuild();
+    /* bhyve does not support UTC clock on ARM */
+    driver.bhyvecaps ^= BHYVE_CAP_RTC_UTC;
 
     DO_TEST("base");
     DO_TEST("console");
index 573e42bfa91a9a4adcd3a7f11cd431bac3ee6f31..ee72370047f9f516b81829f06bfec092c3d35ba4 100644 (file)
@@ -8,7 +8,7 @@
     <type arch='aarch64'>hvm</type>
     <boot dev='hd'/>
   </os>
-  <clock offset='utc'/>
+  <clock offset='localtime'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
index 67047040bb7ac699f365fb790a005f17b9fc06af..8c7ca5826e6471bebc135b572fa2b1e58dec957b 100644 (file)
@@ -9,7 +9,7 @@
     <loader readonly='yes' type='rom'>/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin</loader>
     <boot dev='hd'/>
   </os>
-  <clock offset='utc'/>
+  <clock offset='localtime'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
index 2bea620cbef255c98c251cb345ed6c984d03945b..d43ce8fd6f5934cab0a1294a646d2763863dc460 100644 (file)
@@ -8,7 +8,7 @@
     <type arch='aarch64'>hvm</type>
     <boot dev='hd'/>
   </os>
-  <clock offset='utc'/>
+  <clock offset='localtime'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
index 1d01436511659f8cf69c5175d7893d0e31e68a46..5df1f2b6baee5407c0f2b3a552752985f4666e46 100644 (file)
@@ -77,7 +77,7 @@ mymain(void)
 # define DO_TEST_FAILURE(name) \
     DO_TEST_FULL(name, FLAG_EXPECT_FAILURE)
 
-    driver.bhyvecaps = BHYVE_CAP_AHCI32SLOT;
+    driver.bhyvecaps = BHYVE_CAP_AHCI32SLOT | BHYVE_CAP_RTC_UTC;
 
     DO_TEST_DIFFERENT("acpiapic");
     DO_TEST_DIFFERENT("base");
@@ -146,6 +146,8 @@ mymain(void)
 
     virTestSetHostArch(VIR_ARCH_AARCH64);
     driver.caps = virBhyveCapsBuild();
+    /* bhyve does not support UTC clock on ARM */
+    driver.bhyvecaps ^= BHYVE_CAP_RTC_UTC;
 
     DO_TEST_DIFFERENT("base");
     DO_TEST_DIFFERENT("console");