From nobody Mon Feb 2 05:56:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1769324168; cv=none; d=zohomail.com; s=zohoarc; b=ftV5tKAwOqho4PAwLcZRIbSlU+p4jRVagBzfpcltBs3iTLJLKTMTXF+7QYIP6hAzB1v2eWtemTOD14dJ9NG/GzCEoqQ5gyzrdaMA38jWLIr2IOUwviH4c/OwkDuLjyqNg+nf4Q8TGg/LjGfqghADK+NSIQ3ScmLk7Eio+hI/sAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769324168; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=Z2Z2AjX90L/ZSVcF5vqMSiDye2nY+4kkIyepM2tTrbM=; b=FhPKiLWf83hRVFGS2GQsAvZDxN87SfNwn16GDX2pu69jUElh675sqsXtMCLrQLxYN/a+5TyFRP97C097rJB4+7kCezif3zRd48kn/22YPrjdQ7CUj7xW7944QEDb3t1HfQnjOv+vQLjYTwSwUBqp/P2nTIhW3MeGNH0zG/AyGcw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769324168241140.7287716674814; Sat, 24 Jan 2026 22:56:08 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 7F04C419D5; Sun, 25 Jan 2026 01:56:06 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 7E3C741B1B; Sun, 25 Jan 2026 01:55:20 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 0A2014190E; Sun, 25 Jan 2026 01:55:16 -0500 (EST) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 153573FB96 for ; Sun, 25 Jan 2026 01:55:15 -0500 (EST) Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-b8715a4d9fdso430815966b.0 for ; Sat, 24 Jan 2026 22:55:15 -0800 (PST) Received: from tulp.my.domain (2001-1c02-1a15-3000-c218-03ff-feb5-6cc4.cable.dynamic.v6.ziggo.nl. [2001:1c02:1a15:3000:c218:3ff:feb5:6cc4]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b885b6fc4aasm399695066b.36.2026.01.24.22.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jan 2026 22:55:12 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769324113; x=1769928913; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Z2Z2AjX90L/ZSVcF5vqMSiDye2nY+4kkIyepM2tTrbM=; b=B9W4om72aLwLTrBpSOZY5Md9/ckdsJywSioW3Id7ZXTB6GWMylkTck6pSTMMyQ0czW Dwn/lCNWoZkBRJahCUJO97zfUz9xFQUSCGOapYjcJVCIdh8Na/CKrrOQ+1x0+tIfMjcH iVdxAt1a7tvuyvloUe38+jGlBqR2q/3DxAlj+th1bVPcFWh+LsKpt5mUE2rQS873NjYL +LRqlQz+qWTBwSV/MY3lHj/9S2wNgZ3nd40gwkDpvRYcNW2mCzZj9XWX164asBQQMyWV UKksxmYEd3NyFwxWhEQMCuXRjni03x9Mys6A4v8FGrnc1G71DwWyj1fCgg5wZ0ZNHABN On1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769324113; x=1769928913; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Z2Z2AjX90L/ZSVcF5vqMSiDye2nY+4kkIyepM2tTrbM=; b=hGiOeauI2fsGxvYxLDDuhiHxfNnD1gAW4xFVHZYWbDlgOYB1s5PJ5rX+FunEFDmHEn 80D679ge4eIX3rSydiPyVGzNJMFDaAeH6laS//k4UpqwOwL1/przFmq4qoLEJMYKyM1L BxDx4aKEtDFQaZ2TFS+Xxlq9kq1opG4GziDBb4pK363VO3vtkF0J+nKbcEUvIknETHis aGzikNVNAMUtVgo1jNfPlZIumXzTbRqzaDECtf9JowVkV68rDYcPfJEzraLMeLrWUnvK Exans7nEaE5/h2jk921X4CU5tiCYuHyP9Sino76osvu25IId5AYwfuqtQxDfE78uvIN+ BUSg== X-Gm-Message-State: AOJu0YxH9CW9gAxZPJJcNrd59XDlcPeH76h7iyA4dqxtq+ze2yJate++ T5ahalcC6ORpGImd80xoZLabsd6zxsVWrxwKxfPUYWBVSMS9ACxxypv7XxgH79UE X-Gm-Gg: AZuq6aL7081rlWXlre2RCkwsVTpd+hTNkPauVcVVe/i9zK+qWh1AIWMtaAmc1cFcYbx g5C0WNhe+2Z3m8z/EnKHNd6HC2+e2eVsilqgtqtn/6yIFq3F634UgKL2C117wbo9OgFmvbNDmjI UCSONU4JogrRc9blLPqD5JLRz0Wc6IZpFW8rYvnxkOhN9kFsG2nnxE/IPGOgWhYa/yLPw+INSW7 SA7hFWvoRPVVdY5zEzEfoUnzXTQF54iPKTC9Dj+8/Vf+W127tHU49ZjQuxHaUnJwPk6WAUGuyl7 55gUpQbVIE/qyWjYbwKMWhBgj34NZsqgFZ2Gvyq7cifNbmkylCUy5g5UYHnAR1TlTckkMi1iwCL TKuTqjG2QcYYr87tys7vvi1icOyzdB8bfRhFVxgBqQIoCZcL3mEez/9GVDdn8FO6aAZkBxwJQM4 Rp4+NAw6IiPxG392uUyk0TLjE9PZjE99KUJQw/FRlsay+rnXfq0H3uEph34lVQAhHSy3h3y5ARm +ok0IR+1AMbw5Yoq5+JLUJn X-Received: by 2002:a17:907:3e1c:b0:b87:2e8a:e256 with SMTP id a640c23a62f3a-b8d2e712323mr67237166b.31.1769324113264; Sat, 24 Jan 2026 22:55:13 -0800 (PST) From: Roman Bogorodskiy To: devel@lists.libvirt.org Subject: [PATCH] bhyve: improve loader handling on arm64 Date: Sun, 25 Jan 2026 07:54:55 +0100 Message-ID: <20260125065455.41476-1-bogorodskiy@gmail.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ALMSJAP7INMSG4WWVVI3GG6ZDLCXSCQ6 X-Message-ID-Hash: ALMSJAP7INMSG4WWVVI3GG6ZDLCXSCQ6 X-MailFrom: bogorodskiy@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Roman Bogorodskiy X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1769324172643154100 Content-Type: text/plain; charset="utf-8" Bhyve on arm64 does not have the bhyveload(8) tool. That means that it cannot be used as a default if the loader is not configured for the domain. To prevent users from getting unusable configurations, handle loader configuration on arm64 like that: - if loader is specified in the domain XML, just use it - if not specified, try to check whether the default uboot loader is available on the system. In case it is, set is as the loader, otherwise fail with the error. Signed-off-by: Roman Bogorodskiy Reviewed-by: Michal Privoznik --- src/bhyve/bhyve_domain.c | 22 +++++++++++++++++++ .../aarch64/bhyvexml2argv-base.args | 1 + .../aarch64/bhyvexml2argv-base.ldargs | 8 +------ .../aarch64/bhyvexml2argv-console.args | 1 + .../aarch64/bhyvexml2argv-console.ldargs | 8 +------ tests/bhyvexml2argvmock.c | 20 ++++++++++++++++- .../aarch64/bhyvexml2xmlout-base.xml | 1 + .../aarch64/bhyvexml2xmlout-console.xml | 1 + 8 files changed, 47 insertions(+), 15 deletions(-) diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index df0a008ecd..733bacc8c1 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -27,11 +27,14 @@ #include "bhyve_domain.h" #include "bhyve_capabilities.h" #include "viralloc.h" +#include "virfile.h" #include "virlog.h" #include "virutil.h" =20 #define VIR_FROM_THIS VIR_FROM_BHYVE =20 +#define UBOOT_BHYVE DATADIR "/u-boot/u-boot-bhyve-arm64/u-boot.bin" + VIR_LOG_INIT("bhyve.bhyve_domain"); =20 static void * @@ -112,6 +115,25 @@ bhyveDomainDefPostParse(virDomainDef *def, !(bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_RTC_UTC)) def->clock.offset =3D VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME; =20 + /* bhyve/arm64 does not provide the bhyveload(8) tool, + * so if the loader is not specified and we cannot fall back to the + * default one, then this results in an usable configuration. */ + if (ARCH_IS_ARM(def->os.arch)) { + if (def->os.loader =3D=3D NULL) { + if (virFileExists(UBOOT_BHYVE)) { + def->os.loader =3D virDomainLoaderDefNew(); + def->os.loader->path =3D g_strdup(UBOOT_BHYVE); + def->os.loader->readonly =3D true; + def->os.loader->type =3D VIR_DOMAIN_LOADER_TYPE_PFLASH; + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("loader is not specified and the default = loader (%1$s) not found"), + UBOOT_BHYVE); + return -1; + } + } + } + return 0; } =20 diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args b/test= s/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args index aef3ebd017..1079beee52 100644 --- a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.args @@ -2,6 +2,7 @@ bhyve \ -c 1 \ -m 214 \ -s 0:0,hostbridge \ +-o bootrom=3D/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin \ -s 3:0,virtio-net,faketapdev,mac=3D52:54:00:b9:94:02 \ -s 2:0,virtio-blk,/tmp/freebsd.img \ bhyve diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.ldargs b/te= sts/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.ldargs index 264ae48441..421376db9e 100644 --- a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.ldargs +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-base.ldargs @@ -1,7 +1 @@ -timeout \ ---foreground \ ---verbose \ --k 20s 300s bhyveload \ --m 214 \ --d /tmp/freebsd.img \ -bhyve +dummy diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args b/t= ests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args index 4a031afb71..ea2cc15713 100644 --- a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.args @@ -2,6 +2,7 @@ bhyve \ -c 1 \ -m 214 \ -s 0:0,hostbridge \ +-o bootrom=3D/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin \ -s 3:0,virtio-net,faketapdev,mac=3D52:54:00:b9:94:02 \ -s 2:0,virtio-blk,/tmp/freebsd.img \ -o console=3D/dev/nmdm0A \ diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.ldargs b= /tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.ldargs index 264ae48441..421376db9e 100644 --- a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.ldargs +++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-console.ldargs @@ -1,7 +1 @@ -timeout \ ---foreground \ ---verbose \ --k 20s 300s bhyveload \ --m 214 \ --d /tmp/freebsd.img \ -bhyve +dummy diff --git a/tests/bhyvexml2argvmock.c b/tests/bhyvexml2argvmock.c index fe76564d51..f4271563d7 100644 --- a/tests/bhyvexml2argvmock.c +++ b/tests/bhyvexml2argvmock.c @@ -2,7 +2,9 @@ =20 #include =20 +#include "configmake.h" #include "viralloc.h" +#include "virfile.h" #include "virstring.h" #include "virnetdev.h" #include "virnetdevtap.h" @@ -12,11 +14,16 @@ #define VIR_FROM_THIS VIR_FROM_BHYVE =20 static DIR * (*real_opendir)(const char *name); +static bool (*real_virFileExists)(const char *path); =20 static void init_syms(void) { - VIR_MOCK_REAL_INIT(opendir); + if (!real_opendir) + VIR_MOCK_REAL_INIT(opendir); + + if (!real_virFileExists) + VIR_MOCK_REAL_INIT(virFileExists); } =20 #define FAKEFIRMWAREDIR abs_srcdir "/bhyvefirmwaredata/three_firmwares" @@ -89,3 +96,14 @@ int bind(int sockfd G_GNUC_UNUSED, { return 0; } + +bool +virFileExists(const char *path) +{ + init_syms(); + + if (STREQ(path, DATADIR "/u-boot/u-boot-bhyve-arm64/u-boot.bin")) + return true; + + return real_virFileExists(path); +} diff --git a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml b/t= ests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml index ee72370047..d6c9caa225 100644 --- a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml +++ b/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-base.xml @@ -6,6 +6,7 @@ 1 hvm + /usr/local/share/u-boot/u-boo= t-bhyve-arm64/u-boot.bin diff --git a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml = b/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml index d43ce8fd6f..d694ecfb8d 100644 --- a/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml +++ b/tests/bhyvexml2xmloutdata/aarch64/bhyvexml2xmlout-console.xml @@ -6,6 +6,7 @@ 1 hvm + /usr/local/share/u-boot/u-boo= t-bhyve-arm64/u-boot.bin --=20 2.52.0