bhyve: workaround for the lack of UTC clock on ARM64

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>
This commit is contained in:
Roman Bogorodskiy
2026-01-19 19:27:39 +01:00
parent 7b889af2d2
commit e0dcf278af
9 changed files with 14 additions and 7 deletions
+6
View 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;
}
@@ -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 \
@@ -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 \
@@ -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 \
+2
View 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");
@@ -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>
@@ -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>
@@ -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>
+3 -1
View 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");