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 <[email protected]> --- src/bhyve/bhyve_domain.c | 6 ++++++ tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args | 1 - .../bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args | 1 - tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args | 1 - tests/bhyvexml2argvtest.c | 2 ++ tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml | 2 +- .../aarch64/bhyvexml2xmlout-bootloader.xml | 2 +- .../bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml | 2 +- tests/bhyvexml2xmltest.c | 4 +++- 9 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index 0c33a67ca6..df0a008ecd 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -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; } diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args index 51eef94fd0..aef3ebd017 100644 --- a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args @@ -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 \ diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args index a07e70d7d4..1079beee52 100644 --- a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args @@ -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 \ diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args index ae0e6bc1b3..4a031afb71 100644 --- a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args @@ -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 \ diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 47b2726b14..c7c18c3690 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -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"); diff --git a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml b/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml index 573e42bfa9..ee72370047 100644 --- a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml +++ b/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml @@ -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> diff --git a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-bootloader.xml b/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-bootloader.xml index 67047040bb..8c7ca5826e 100644 --- a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-bootloader.xml +++ b/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-bootloader.xml @@ -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> diff --git a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml b/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml index 2bea620cbe..d43ce8fd6f 100644 --- a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml +++ b/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml @@ -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> diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index 1d01436511..5df1f2b6ba 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -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"); -- 2.52.0
