From: Roman Bogorodskiy Date: Mon, 22 Dec 2025 18:07:35 +0000 (+0100) Subject: bhyve: command: handle arm64 bootloader X-Git-Tag: v12.0.0-rc1~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c971cdce185195ec56debcfc2e0ad0e8ded67d4;p=thirdparty%2Flibvirt.git bhyve: command: handle arm64 bootloader Just like consoles, bootloader is handled differently on arm64. It also does not used the LPC bus, and is configured with: -o bootrom=/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin Additionally, fill firmware inforamtion only for amd64. Signed-off-by: Roman Bogorodskiy Reviewed-by: Michal Privoznik --- diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index bf9db963a1..a45a5d1c33 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -1002,17 +1002,24 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver, virDomainDef *def, if (def->os.bootloader == NULL && def->os.loader) { - if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_LPC_BOOTROM)) { + virArch arch = def->os.arch; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; - virBufferAsprintf(&buf, "bootrom,%s", def->os.loader->path); - if (def->os.loader->nvram && def->os.loader->nvram->path) - virBufferAsprintf(&buf, ",%s", def->os.loader->nvram->path); - virCommandAddArgList(cmd, "-l", virBufferContentAndReset(&buf), NULL); - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Installed bhyve binary does not support UEFI loader")); - return NULL; + if (ARCH_IS_X86(arch)) { + if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_LPC_BOOTROM)) { + virBufferAsprintf(&buf, "bootrom,%s", def->os.loader->path); + if (def->os.loader->nvram && def->os.loader->nvram->path) + virBufferAsprintf(&buf, ",%s", def->os.loader->nvram->path); + + virCommandAddArgList(cmd, "-l", virBufferContentAndReset(&buf), NULL); + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Installed bhyve binary does not support UEFI loader")); + return NULL; + } + } else if (ARCH_IS_ARM(arch)) { + virBufferAsprintf(&buf, "bootrom=%s", def->os.loader->path); + virCommandAddArgList(cmd, "-o", virBufferContentAndReset(&buf), NULL); } } diff --git a/src/bhyve/bhyve_firmware.c b/src/bhyve/bhyve_firmware.c index 57ad0031b0..54e3ce296a 100644 --- a/src/bhyve/bhyve_firmware.c +++ b/src/bhyve/bhyve_firmware.c @@ -125,6 +125,9 @@ bhyveFirmwareFillDomain(bhyveConn *driver, virCheckFlags(0, -1); + if (!ARCH_IS_X86(def->os.arch)) + return 0; + if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) goto out; diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args new file mode 100644 index 0000000000..a07e70d7d4 --- /dev/null +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args @@ -0,0 +1,9 @@ +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 \ +-s 2:0,virtio-blk,/tmp/freebsd.img \ +bhyve diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.ldargs b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.ldargs new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.ldargs @@ -0,0 +1 @@ +dummy diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.xml b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.xml new file mode 100644 index 0000000000..6e1123e4e0 --- /dev/null +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.xml @@ -0,0 +1,24 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 1 + + hvm + /usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin + + + + + + +
+ + + + + +
+ + + diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 78e2638658..47b2726b14 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -336,6 +336,7 @@ mymain(void) DO_TEST("base"); DO_TEST("console"); + DO_TEST("bootloader"); virObjectUnref(driver.caps); virObjectUnref(driver.xmlopt);