From nobody Sat May 30 17:44:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1779362948; cv=none; d=zohomail.com; s=zohoarc; b=Wl0TzOnY8WomYXpcdazKX+1sKsEQV4iWjwgSvLauN6BV0yHkNCVrAi1gr1D+prwmZPhkb01I7tqgkgdFS9L+CHaUW2ynoWtz1PuNH5M6hgy1OwEU12kfesvPJ9izOdMH+YeD+UZ88vcVADalMg14ydTehg+kFgQ7X6vro0YlOsk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779362948; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ReZqClySschHCYMohzTwFSGAEfy1GO0za1f1vd3CLQo=; b=hcmrkvDIu6E/REbu0ccuThkaY2ooQvkM33HaAFWOFei3GlPPY3LDkatelsozyselQup0SQB7NdvLGa+N55bUiRDrY5+Ep7bVoGw1CgYJu3NgZP5O65NzuNeh/plZlQfVM6DlSN4WhWcfWzB1dJDho+hBryPpTXH4ho56S+jnhd0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1779362948570931.2695384755649; Thu, 21 May 2026 04:29:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wQ1Zg-0005qZ-51; Thu, 21 May 2026 07:28:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wQ1ZX-0005QQ-Ve for qemu-devel@nongnu.org; Thu, 21 May 2026 07:28:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wQ1ZW-0003aE-4S for qemu-devel@nongnu.org; Thu, 21 May 2026 07:28:15 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-295-VriBjByGO4i8VOb3kQ7ASw-1; Thu, 21 May 2026 07:28:09 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3536419560A7; Thu, 21 May 2026 11:28:08 +0000 (UTC) Received: from dobby.home.kraxel.org (unknown [10.44.32.173]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 699191685; Thu, 21 May 2026 11:28:07 +0000 (UTC) Received: by dobby.home.kraxel.org (Postfix, from userid 1000) id 2FDE87DC644; Thu, 21 May 2026 13:28:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779362893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ReZqClySschHCYMohzTwFSGAEfy1GO0za1f1vd3CLQo=; b=EhFy0cc38YEhWopGrWEunlteUWDKgc/R8Pvb7VnjY6pmY6AEH1IxfTruHIFlUpKekbCE7a 5VqjyNIqtEFPs4r5zkEZi7Sb2tHsvKNs9qHU3QHKQLO8lAHZXPaBZ6/RJJpNGMsUtow7gm 9bZriMdVyywD1weoVst3J8a0bNfLoNs= X-MC-Unique: VriBjByGO4i8VOb3kQ7ASw-1 X-Mimecast-MFC-AGG-ID: VriBjByGO4i8VOb3kQ7ASw_1779362888 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Gerd Hoffmann , Richard Henderson , Paolo Bonzini , Peter Maydell Subject: [PATCH 1/3] hw/nvram: add load_image_to_fw_cfg_file() Date: Thu, 21 May 2026 13:28:04 +0200 Message-ID: <20260521112806.504961-2-kraxel@redhat.com> In-Reply-To: <20260521112806.504961-1-kraxel@redhat.com> References: <20260521112806.504961-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1779362951275154100 Content-Type: text/plain; charset="utf-8" Function is simliar to load_image_to_fw_cfg() but loads the image into a named fw_cfg file instead of fixed keys. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/nvram/fw_cfg.c | 22 ++++++++++++++++++++++ include/hw/nvram/fw_cfg.h | 15 +++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 1d7d835421..d8653d93cd 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -1143,6 +1143,28 @@ void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16= _t size_key, fw_cfg_add_bytes(fw_cfg, data_key, data, size); } =20 +void load_image_to_fw_cfg_file(FWCfgState *fw_cfg, + const char *fw_cfg_name, + const char *image_name) +{ + GMappedFile *mapped_file; + GError *gerr =3D NULL; + + if (image_name =3D=3D NULL) { + return; + } + + mapped_file =3D g_mapped_file_new(image_name, false, &gerr); + if (!mapped_file) { + error_report("qemu: error reading %s: %s", + image_name, gerr->message); + exit(1); + } + fw_cfg_add_file(fw_cfg, fw_cfg_name, + g_mapped_file_get_contents(mapped_file), + g_mapped_file_get_length(mapped_file)); +} + static void fw_cfg_class_init(ObjectClass *klass, const void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index 56f17a0bdc..7b31bd0ba6 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -351,4 +351,19 @@ void load_image_to_fw_cfg(FWCfgState *fw_cfg, uint16_t= size_key, uint16_t data_key, const char *image_name, bool try_decompress); =20 +/** + * load_image_to_fw_cfg_file() - Load an image file into an fw_cfg entry + * identified by fw_cfg file name. + * @fw_cfg: The firmware config instance to store the data in. + * @fw_cfg_name: The name of the fw_cfg (pseudo) file. + * @image_name: The name of the image file to load. If it is NULL, the + * function returns without doing anything. + * + * In case of failure, the function prints an error message to stderr and = the + * process exits with status 1. + */ +void load_image_to_fw_cfg_file(FWCfgState *fw_cfg, + const char *fw_cfg_name, + const char *image_name); + #endif --=20 2.54.0 From nobody Sat May 30 17:44:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1779362953; cv=none; d=zohomail.com; s=zohoarc; b=dp29DAwandmo9bAJFb6UFvAChIqmR0yhjJDPbcmiEIhUfrXrA9BKdQrpzkokyBEzH1B7ozuiPY1gx+Ul64m2iDPeEf0eHyduhGfAvDgRxuZ6QLR2Zge6B2749LpBhrS94MvOPfnSLNxaB/mDH1ar95bLuUEtDB9f24Zv4WYbg9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779362953; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jEfrYhZZe8I3q5wClqrHbfgmmo2Kh4lJvuHDrgVhAYI=; b=kY5fd3Jg9HbrFwlNt2ih/ilkImMQpPK+8uTQP6gAdi96MLmcQxJ6SIIWYdDc4udpciJLYHic1y1E94HTGuH/21pOdPW8TomgKYTJMV8vn+T1aBIQwj2cpWcINyE8tGgCqodzd/yxs7cVAxWzgTpt9BvC444mEX+gIxoKqR/5LiQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1779362953147389.4344784630614; Thu, 21 May 2026 04:29:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wQ1Zi-00060j-F6; Thu, 21 May 2026 07:28:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wQ1ZZ-0005Uk-3P for qemu-devel@nongnu.org; Thu, 21 May 2026 07:28:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wQ1ZX-0003ag-3r for qemu-devel@nongnu.org; Thu, 21 May 2026 07:28:16 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-327-oXyLti_zOQGTdNylx6AVBw-1; Thu, 21 May 2026 07:28:10 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8988D18002C7; Thu, 21 May 2026 11:28:09 +0000 (UTC) Received: from dobby.home.kraxel.org (unknown [10.44.32.173]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2142E19560A3; Thu, 21 May 2026 11:28:09 +0000 (UTC) Received: by dobby.home.kraxel.org (Postfix, from userid 1000) id 3355D7DC646; Thu, 21 May 2026 13:28:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779362894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jEfrYhZZe8I3q5wClqrHbfgmmo2Kh4lJvuHDrgVhAYI=; b=eulP1+Dt5Rq+yWwkkZzcMb+CzNGo3zfTb/x+uZtBcewRechFja2yPP+LBFf4IWuM8xIUFf iuY2W+hj83pVj/EzlwPdVkDqzKDqwHcU6Sj4EtIeunb/8OhBLKPA5kx1eKY8ObbzImkg25 LonJip34v/t1izImhDA65i390jrehmc= X-MC-Unique: oXyLti_zOQGTdNylx6AVBw-1 X-Mimecast-MFC-AGG-ID: oXyLti_zOQGTdNylx6AVBw_1779362889 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Gerd Hoffmann , Richard Henderson , Paolo Bonzini , Peter Maydell Subject: [PATCH 2/3] hw/i386: switch shim loading to load_image_to_fw_cfg_file Date: Thu, 21 May 2026 13:28:05 +0200 Message-ID: <20260521112806.504961-3-kraxel@redhat.com> In-Reply-To: <20260521112806.504961-1-kraxel@redhat.com> References: <20260521112806.504961-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1779362953953158500 Content-Type: text/plain; charset="utf-8" Use the new helper function instead of open-coding the shim image load. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/x86-common.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c index fde05fa7d7..8f9419e7d3 100644 --- a/hw/i386/x86-common.c +++ b/hw/i386/x86-common.c @@ -980,19 +980,8 @@ void x86_load_linux(X86MachineState *x86ms, fw_cfg_add_file(fw_cfg, "etc/boot/kernel", kernel, kernel_size); =20 if (machine->shim_filename) { - GMappedFile *mapped_file; - GError *gerr =3D NULL; - - mapped_file =3D g_mapped_file_new(machine->shim_filename, false, &= gerr); - if (!mapped_file) { - fprintf(stderr, "qemu: error reading shim %s: %s\n", - machine->shim_filename, gerr->message); - exit(1); - } - - fw_cfg_add_file(fw_cfg, "etc/boot/shim", - g_mapped_file_get_contents(mapped_file), - g_mapped_file_get_length(mapped_file)); + load_image_to_fw_cfg_file(fw_cfg, "etc/boot/shim", + machine->shim_filename); } =20 if (sev_enabled()) { --=20 2.54.0 From nobody Sat May 30 17:44:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1779362947; cv=none; d=zohomail.com; s=zohoarc; b=CB3bgVMATtQQT9B9ABEZUNrIrdMswtxQhFk6xq6WQZGe9bgt+2/wNCe8zSQReNGNspJXokBYJ6lQCSEf/WivRic2MyDpWD12mDGiGJvzHSMZA2s+LoM5y5fhZnPNVdPvoYgKN0xoJsf3eOtHxzZzOIs+yJr8zRV/ToA46ZbkReM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779362947; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7mUsQabucQNt9y47LuNlsFptVLP9qvmU+MGspZjqbPk=; b=A+N3a8xhWn8wdpfjj4WgjxWhu04vexNQ8R2yL3kHKenKm7qzVA8mayQedmqGMPScUgAMmLov06tz/nhGJHywczLvu622O9NWXTGfMpBukdLTk6vKnOub/CAmQyvwEu6NYp1WOh6GvTnMHdpWSbOOXOxSDFjotqLek02DCBfsXg0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1779362947347462.07381175659555; Thu, 21 May 2026 04:29:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wQ1Zg-0005t8-PQ; Thu, 21 May 2026 07:28:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wQ1ZY-0005TW-SJ for qemu-devel@nongnu.org; Thu, 21 May 2026 07:28:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wQ1ZX-0003ac-3J for qemu-devel@nongnu.org; Thu, 21 May 2026 07:28:16 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-73--HJZTYaqOtu2DcD8NXNkvA-1; Thu, 21 May 2026 07:28:10 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9E1D91800359; Thu, 21 May 2026 11:28:09 +0000 (UTC) Received: from dobby.home.kraxel.org (unknown [10.44.32.173]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 34D6F1684; Thu, 21 May 2026 11:28:09 +0000 (UTC) Received: by dobby.home.kraxel.org (Postfix, from userid 1000) id 369487DC648; Thu, 21 May 2026 13:28:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779362894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7mUsQabucQNt9y47LuNlsFptVLP9qvmU+MGspZjqbPk=; b=EAcp9TAieWqgCXnCc9wxJhF2ttISm6RFU5puRFut7D1pWJTw76joygMPJkIbnEN7/IETsP CezPuIC+79Nzz+3emurHB+ia0lcUI5Plu/8hqWrSBr8BXDbnSCcKrqlVbGimS3TR776Qyq GwkitYzAbCkxJ/ORmuXsgNraE8Nz4H8= X-MC-Unique: -HJZTYaqOtu2DcD8NXNkvA-1 X-Mimecast-MFC-AGG-ID: -HJZTYaqOtu2DcD8NXNkvA_1779362889 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Gerd Hoffmann , Richard Henderson , Paolo Bonzini , Peter Maydell Subject: [PATCH 3/3] hw/arm: add support for shim loading Date: Thu, 21 May 2026 13:28:06 +0200 Message-ID: <20260521112806.504961-4-kraxel@redhat.com> In-Reply-To: <20260521112806.504961-1-kraxel@redhat.com> References: <20260521112806.504961-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1779362947990158500 Content-Type: text/plain; charset="utf-8" Add support for direct kernel boot with shim to the arm platform. Signed-off-by: Gerd Hoffmann --- hw/arm/boot.c | 6 ++++++ include/hw/arm/boot.h | 1 + 2 files changed, 7 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 780b6be637..9b7553dde5 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -1161,6 +1161,11 @@ static void arm_setup_firmware_boot(ARMCPU *cpu, str= uct arm_boot_info *info) fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, info->kernel_cmdline); } + + if (info->shim_filename) { + load_image_to_fw_cfg_file(fw_cfg, "etc/boot/shim", + info->shim_filename); + } } =20 /* @@ -1195,6 +1200,7 @@ void arm_load_kernel(ARMCPU *cpu, MachineState *ms, s= truct arm_boot_info *info) * doesn't support secure. */ assert(!(info->secure_board_setup && kvm_enabled())); + info->shim_filename =3D ms->shim_filename; info->kernel_filename =3D ms->kernel_filename; info->kernel_cmdline =3D ms->kernel_cmdline; info->initrd_filename =3D ms->initrd_filename; diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h index a2e22bda8a..94386fdbea 100644 --- a/include/hw/arm/boot.h +++ b/include/hw/arm/boot.h @@ -39,6 +39,7 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_f= ilename, /* arm_boot.c */ struct arm_boot_info { uint64_t ram_size; + const char *shim_filename; const char *kernel_filename; const char *kernel_cmdline; const char *initrd_filename; --=20 2.54.0