From nobody Thu Apr 3 10:04:24 2025 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=1742393681; cv=none; d=zohomail.com; s=zohoarc; b=M3xVOocfv5zCylRBMXUXCXXAH7MvjFYD9GbD6uLHMT9/L6HizqBoQ0EArdr+HJgYkeS9JKozgA5NvBNTC+RpUVto4X7Tv5PGPKDNFngCe3XOYy1ulmIulqaoB01CdHTv3nRPRe89xynus0HwCBWusA99Y0kUdxEZ3unvFE9iC9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742393681; 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=H58D0LCokzKee+mrCl+03ZvgHbdYJbV6BrXAG8kv6Y4=; b=PhHhU8/cJOHWDMy5hYbf6dvUBda3kXcwc/nK8jExPQYXsaN+udu08YcgziSjT9C38jAgw99vIp+XuE6sTD862pIgzdrO8OoOPE6x8e/XQVRttWPHy2gcNRHq9b9eU+Axx7r7YMiU9U6CCQngZ1ACI5gNuEw3WqVVEbPEpW52gck= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742393681930654.938921556008; Wed, 19 Mar 2025 07:14:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuuAM-0001qq-O2; Wed, 19 Mar 2025 10:13:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuu9y-0001eU-SU for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuu9g-0006ix-LO for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:30 -0400 Received: from mx-prod-mc-04.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-634-p-i3B7xvNlm79HKH7QdANg-1; Wed, 19 Mar 2025 10:12:06 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 45D8F1956048; Wed, 19 Mar 2025 14:12:03 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.45.224.38]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A52B51800944; Wed, 19 Mar 2025 14:12:01 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2E0231800391; Wed, 19 Mar 2025 15:11:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742393532; 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=H58D0LCokzKee+mrCl+03ZvgHbdYJbV6BrXAG8kv6Y4=; b=BgbhGnTQUSsB+IAaikdlpBE4IQrd20uuXE/gJS3PRknkHmpM22q/InxAS/5NIg4mCBjwlb M15AMz3nMniyuziQAxQAn+fm/Sl08yeUgs1yNoDrGcxOQKzCTPbwnMIVL7r+MTlxn44zID BF4NTGaLRtjB77/STxyVolRIPakt0lU= X-MC-Unique: p-i3B7xvNlm79HKH7QdANg-1 X-Mimecast-MFC-AGG-ID: p-i3B7xvNlm79HKH7QdANg_1742393525 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Bibo Mao , Kashyap Chamarthy , Paolo Bonzini , Song Gao , Jiaxun Yang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-riscv@nongnu.org, Daniel Henrique Barboza , Liu Zhiwei , Weiwei Li , Gerd Hoffmann , Palmer Dabbelt , Peter Krempa Subject: [PATCH v3 1/6] hw/uefi: flush variable store to disk in post load Date: Wed, 19 Mar 2025 15:11:53 +0100 Message-ID: <20250319141159.1461621-2-kraxel@redhat.com> In-Reply-To: <20250319141159.1461621-1-kraxel@redhat.com> References: <20250319141159.1461621-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.337, 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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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: 1742393682953019000 Content-Type: text/plain; charset="utf-8" Make live migration more robust. Commit 4c0cfc72b31a ("pflash_cfi01: write flash contents to bdrv on incoming migration") elaborates in detail on the motivation. Cc: Peter Krempa Signed-off-by: Gerd Hoffmann Reviewed-by: Peter Krempa --- hw/uefi/var-service-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/uefi/var-service-core.c b/hw/uefi/var-service-core.c index 8ed8378ab991..4836a0cb8116 100644 --- a/hw/uefi/var-service-core.c +++ b/hw/uefi/var-service-core.c @@ -29,6 +29,7 @@ static int uefi_vars_post_load(void *opaque, int version_= id) uefi_vars_state *uv =3D opaque; =20 uefi_vars_update_storage(uv); + uefi_vars_json_save(uv); uv->buffer =3D g_malloc(uv->buf_size); return 0; } --=20 2.48.1 From nobody Thu Apr 3 10:04:24 2025 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=1742393783; cv=none; d=zohomail.com; s=zohoarc; b=f39WoRXeOHcaIHS5nU4uZD0YQ158+taTN7paxF1SNnWwV5ZNkNx059jHrHhCB+tLGNSH7ujs+f3s6M5O92viI5ErQcNAz+5p8dx309J/0Okx72vF5wPN+fbSxnotE1mCp8Mtv0RdeDIqzfyqUV+4FVfmS9Bkospr1pQKgRAiDi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742393783; h=Content-Type: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=Sv7AbRgC/+1LXd3g9+YAfe5gSusJCdICJ4LNnmNXd2E=; b=n/AI88WLh6C5gYajsZxGI7ljuzYb6IT5aLiytyYcON47io7QazxrY1t53CqFgyuZ0u6ImDXjuCQVJrWbaEA6/0gAJdS1jeSYXcdyANeovXSHuYGIvNZIdgp0eDNy4f2uVGLzK0hV4eBbppBm7qiaFO16FkUF/Waq8QGV8UE5ZhA= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742393783842906.5641940489644; Wed, 19 Mar 2025 07:16:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuuAj-0002Jz-TE; Wed, 19 Mar 2025 10:13:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuuAA-0001hT-1s for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuuA2-0006kC-Vi for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:53 -0400 Received: from mx-prod-mc-02.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-208-6g5hZF5QNYa_Xli8xO3Dhw-1; Wed, 19 Mar 2025 10:12:12 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0FD041955EA1; Wed, 19 Mar 2025 14:12:07 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.45.224.38]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C6FFD1828A80; Wed, 19 Mar 2025 14:12:05 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4452418003AD; Wed, 19 Mar 2025 15:11:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742393536; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sv7AbRgC/+1LXd3g9+YAfe5gSusJCdICJ4LNnmNXd2E=; b=fJk0RPkZgb7/3i3QKGrxZOTArscJ3xDMxIZ3oeq23idMXboagJXU7T7LVxNuUmf8KaXHbM 0eWF3g1Hip0kpQjjuZBcI8s1gMbVCtwN5heEGIJWem9bLQZIueXQDqy/mJa+iXILHulQ6H rO2mK3kb2O/ukww5YDf4s8IEJleP+ns= X-MC-Unique: 6g5hZF5QNYa_Xli8xO3Dhw-1 X-Mimecast-MFC-AGG-ID: 6g5hZF5QNYa_Xli8xO3Dhw_1742393529 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Bibo Mao , Kashyap Chamarthy , Paolo Bonzini , Song Gao , Jiaxun Yang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-riscv@nongnu.org, Daniel Henrique Barboza , Liu Zhiwei , Weiwei Li , Gerd Hoffmann , Palmer Dabbelt Subject: [PATCH v3 2/6] hw/uefi: fix error handling in uefi_vars_json_save Date: Wed, 19 Mar 2025 15:11:54 +0100 Message-ID: <20250319141159.1461621-3-kraxel@redhat.com> In-Reply-To: <20250319141159.1461621-1-kraxel@redhat.com> References: <20250319141159.1461621-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.337, 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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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: 1742393786377019100 Catch lseek errors. Return on errors. Use autoptr for the GString to simplify cleanup. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/uefi/var-service-json.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/uefi/var-service-json.c b/hw/uefi/var-service-json.c index 761082c11fc1..f1c20a6b8c1e 100644 --- a/hw/uefi/var-service-json.c +++ b/hw/uefi/var-service-json.c @@ -178,7 +178,7 @@ void uefi_vars_json_init(uefi_vars_state *uv, Error **e= rrp) =20 void uefi_vars_json_save(uefi_vars_state *uv) { - GString *gstr; + g_autoptr(GString) gstr =3D NULL; int rc; =20 if (uv->jsonfd =3D=3D -1) { @@ -187,18 +187,25 @@ void uefi_vars_json_save(uefi_vars_state *uv) =20 gstr =3D uefi_vars_to_json(uv); =20 - lseek(uv->jsonfd, 0, SEEK_SET); + rc =3D lseek(uv->jsonfd, 0, SEEK_SET); + if (rc < 0) { + warn_report("%s: lseek error", __func__); + return; + } + rc =3D ftruncate(uv->jsonfd, 0); if (rc !=3D 0) { warn_report("%s: ftruncate error", __func__); + return; } + rc =3D write(uv->jsonfd, gstr->str, gstr->len); if (rc !=3D gstr->len) { warn_report("%s: write error", __func__); + return; } + fsync(uv->jsonfd); - - g_string_free(gstr, true); } =20 void uefi_vars_json_load(uefi_vars_state *uv, Error **errp) --=20 2.48.1 From nobody Thu Apr 3 10:04:24 2025 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=1742393682; cv=none; d=zohomail.com; s=zohoarc; b=aMTl+eFbA1cTEgIcIW/nPuNxZSJUmo6nnKbTHUcT3qTmo4Z5AbOAXCC6+Z369QeqgUxLhKVAsc+adxdThrfoT15mlg7785ixY7Kq5A9CI2/Nsfb/z5iRWwPpfndaJpHwHVNdwLF8iNqWDu31BT3XgB8kfBIwkrTx91K3tgeSAOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742393682; h=Content-Type: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=rwvLMYJeJG02WQ2NmmkQRE/PFhyFux9noPxSQ5LyLLU=; b=INBu6ZqLexotAhH7+XSD9pB6q+zDMuPxmDY8V2R0OosQaWcGELw1wAexv0rZc6oDnZwrNUh1yGWbQpaJmZG/BHuojINS0pDE9KRpNR+N43NQcJTUYZXqRZqNc6idc1rXje0dfB4mctlWZKje1yTfJmFZwxqiGqW7ORttRY6tbsE= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742393682061641.7191818071993; Wed, 19 Mar 2025 07:14:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuuAf-0002Bb-BF; Wed, 19 Mar 2025 10:13:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuuA8-0001h7-UC for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:54 -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 1tuu9u-0006k1-81 for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:47 -0400 Received: from mx-prod-mc-06.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-601-znOt7mIfP3yPAoL_i1xAoA-1; Wed, 19 Mar 2025 10:12:10 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 056461800257; Wed, 19 Mar 2025 14:12:08 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.45.224.38]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 704D41800944; Wed, 19 Mar 2025 14:12:07 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5C83E18003AE; Wed, 19 Mar 2025 15:11:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742393532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rwvLMYJeJG02WQ2NmmkQRE/PFhyFux9noPxSQ5LyLLU=; b=PhqDDjkqsVaeVMcHS6zGUJ2XyJbIMUuGc5t0Vdezwxit6gBMwXbFQgPG7CUhYbKAVirQEM OyNYK11q45m1I5Tsin2mezhUMb0o3kQyp3pPHr4juhAo+SEejIJ8q/Ah2CjInw9qH6875n uccr92vsVN4lTnlzgQUFURVFM0AqHpU= X-MC-Unique: znOt7mIfP3yPAoL_i1xAoA-1 X-Mimecast-MFC-AGG-ID: znOt7mIfP3yPAoL_i1xAoA_1742393528 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Bibo Mao , Kashyap Chamarthy , Paolo Bonzini , Song Gao , Jiaxun Yang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-riscv@nongnu.org, Daniel Henrique Barboza , Liu Zhiwei , Weiwei Li , Gerd Hoffmann , Palmer Dabbelt Subject: [PATCH v3 3/6] hw/uefi: fix error handling in uefi_vars_json_load Date: Wed, 19 Mar 2025 15:11:55 +0100 Message-ID: <20250319141159.1461621-4-kraxel@redhat.com> In-Reply-To: <20250319141159.1461621-1-kraxel@redhat.com> References: <20250319141159.1461621-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.337, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=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: 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: 1742393682937019000 Catch lseek errors. Return on read errors. Fixes: CID 1593154 Fixes: CID 1593157 Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/uefi/var-service-json.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/uefi/var-service-json.c b/hw/uefi/var-service-json.c index f1c20a6b8c1e..ad3462cd1557 100644 --- a/hw/uefi/var-service-json.c +++ b/hw/uefi/var-service-json.c @@ -214,7 +214,7 @@ void uefi_vars_json_load(uefi_vars_state *uv, Error **e= rrp) QObject *qobj; Visitor *v; char *str; - size_t len; + ssize_t len; int rc; =20 if (uv->jsonfd =3D=3D -1) { @@ -222,7 +222,12 @@ void uefi_vars_json_load(uefi_vars_state *uv, Error **= errp) } =20 len =3D lseek(uv->jsonfd, 0, SEEK_END); + if (len < 0) { + warn_report("%s: lseek error", __func__); + return; + } if (len =3D=3D 0) { + /* empty file */ return; } =20 @@ -231,6 +236,8 @@ void uefi_vars_json_load(uefi_vars_state *uv, Error **e= rrp) rc =3D read(uv->jsonfd, str, len); if (rc !=3D len) { warn_report("%s: read error", __func__); + g_free(str); + return; } str[len] =3D 0; =20 --=20 2.48.1 From nobody Thu Apr 3 10:04:24 2025 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=1742393629; cv=none; d=zohomail.com; s=zohoarc; b=YPmo2b38FgLmHKmLzduFvoXr9roOoGGB7tBHMwBr5l7cIT83hCbjgoojPAKfjRqirteOwQQU6VEMIJVyEoElHBRnO9qHbwB2j6G+X96G0w5YRNGxcp4l87aG30IlBDn/5PFlbHg+NAKuIX4on88HZcUWfS168WeA0MOxijqxcDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742393629; 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=gZxumUja9ZMA7v5/GxYUkXpt869qPq+P/J3qB1Vohng=; b=KkxeqTSGKieM7TiTKDmt9WoegFlNAc+iVUJojUJiCAg4LemqqTYI1Q3O9Dm8HVBZ6TaH4r4wsWAL3TQuV1YRbGqVrVEffFGr7wp0dYMgUoOG/omjtW0Tou6GYYXmvJGoxFNFvuEMEhOhOFkej4vTlun16UbG23Y+kAWXvG7Y6Q0= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742393629202310.68922662289106; Wed, 19 Mar 2025 07:13:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuuAQ-0001w6-VW; Wed, 19 Mar 2025 10:13:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuuA9-0001hO-9b for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuuA2-0006k9-U6 for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:50 -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-460-ZIe5ZpWMPm6Rr-IbSxr0dg-1; Wed, 19 Mar 2025 10:12:12 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 F3097180AF67; Wed, 19 Mar 2025 14:12:10 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.45.224.38]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AFDFC1828A87; Wed, 19 Mar 2025 14:12:09 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6E29D18003B4; Wed, 19 Mar 2025 15:11:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742393536; 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=gZxumUja9ZMA7v5/GxYUkXpt869qPq+P/J3qB1Vohng=; b=BcCbNW/eeLgom00IyKCwnDgBHZprULW30WrgvZ1KRU34OBg46IrjF8Vpcd6OShx3O3GcOJ 3tRR/Erx1EjOXMip/zLn5Pm8dF5JLSCHgDyImGZKMhZdjSrI0h3Aysv5GubvegJa6+65Qr iSafa5rWxAgD1WVfrqBzRuqFISe1JwM= X-MC-Unique: ZIe5ZpWMPm6Rr-IbSxr0dg-1 X-Mimecast-MFC-AGG-ID: ZIe5ZpWMPm6Rr-IbSxr0dg_1742393531 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Bibo Mao , Kashyap Chamarthy , Paolo Bonzini , Song Gao , Jiaxun Yang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-riscv@nongnu.org, Daniel Henrique Barboza , Liu Zhiwei , Weiwei Li , Gerd Hoffmann , Palmer Dabbelt Subject: [PATCH v3 4/6] hw/uefi-vars-sysbus: allow for riscv virt Date: Wed, 19 Mar 2025 15:11:56 +0100 Message-ID: <20250319141159.1461621-5-kraxel@redhat.com> In-Reply-To: <20250319141159.1461621-1-kraxel@redhat.com> References: <20250319141159.1461621-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.337, 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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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: 1742393632124019100 Content-Type: text/plain; charset="utf-8" Allow the device being added to riscv virt VMs. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Henrique Barboza Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/riscv/virt.c | 2 ++ hw/uefi/Kconfig | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index dae46f4733cd..e517002fdfc7 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -57,6 +57,7 @@ #include "hw/acpi/aml-build.h" #include "qapi/qapi-visit-common.h" #include "hw/virtio/virtio-iommu.h" +#include "hw/uefi/var-service-api.h" =20 /* KVM AIA only supports APLIC MSI. APLIC Wired is always emulated by QEMU= . */ static bool virt_use_kvm_aia_aplic_imsic(RISCVVirtAIAType aia_type) @@ -1935,6 +1936,7 @@ static void virt_machine_class_init(ObjectClass *oc, = void *data) hc->plug =3D virt_machine_device_plug_cb; =20 machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_UEFI_VARS_SYSBUS); #ifdef CONFIG_TPM machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); #endif diff --git a/hw/uefi/Kconfig b/hw/uefi/Kconfig index ca6c2bc46a96..f139008b632b 100644 --- a/hw/uefi/Kconfig +++ b/hw/uefi/Kconfig @@ -1,3 +1,3 @@ config UEFI_VARS bool - default y if X86_64 || AARCH64 + default y if X86_64 || AARCH64 || RISCV64 --=20 2.48.1 From nobody Thu Apr 3 10:04:24 2025 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=1742393634; cv=none; d=zohomail.com; s=zohoarc; b=I2OEYhMD1L2pMOCXZEEBXsbZ0s7eSic6KCy3S7ah8vbHCsf+CQpmvcZkJ/nyZu04brr4R9jSa7xLlDcHT1k0JY6eu7ODhxZmgoh92/Il8n0kE9/TYQbYK0xAv1nQSBRetGzXUzF5P40IS6wTsv8n+/Pa6y4Qvw7WGt/30snvVxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742393634; 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=+OMMrBdJVZeaiydw5/kpxjoxLOQi34o3C5q8EbZWnAY=; b=HuOmgjvBwxQmq7SercblZg7KB5ik34n8gpAqXwAf+Nq5x/PGGTtU0hIbGiyHQmTQnUhJHdC8iACIBqJdc8+KfXvwK4EoZp2lSn+TYQ/+A9ihpkcmpdq+BOdedkgXx5rOi+moX+UgLRBqhUXtnZcfvKYe722P6rhGgQoWzjQjLfU= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742393634491768.4364514777583; Wed, 19 Mar 2025 07:13:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuuAX-000239-C8; Wed, 19 Mar 2025 10:13:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuuA9-0001hM-7g for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuuA0-0006ki-IM for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:50 -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-294-l-wgJGBVNk6ssKXS3QIZMQ-1; Wed, 19 Mar 2025 10:12:12 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 DBF331801A00; Wed, 19 Mar 2025 14:12:10 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.45.224.38]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4A9DF1956094; Wed, 19 Mar 2025 14:12:10 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7FE1B18003B7; Wed, 19 Mar 2025 15:11:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742393537; 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=+OMMrBdJVZeaiydw5/kpxjoxLOQi34o3C5q8EbZWnAY=; b=em8EmYqcjWFm5qSZkzfaF4gK3fDIiT+H2HAzXCb4fZT9hn6+KgWY6dV8dgKzm4CjoNBT/y JMTcaI1494Ynk7aAtphVFeothDnpzP0rbEk1SVuygnjwt/Fd1X9QAOH66zcnafeAqxKdf4 QpQWqOMZOCVfT9O+bbv5ZemKFzmTwzQ= X-MC-Unique: l-wgJGBVNk6ssKXS3QIZMQ-1 X-Mimecast-MFC-AGG-ID: l-wgJGBVNk6ssKXS3QIZMQ_1742393531 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Bibo Mao , Kashyap Chamarthy , Paolo Bonzini , Song Gao , Jiaxun Yang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-riscv@nongnu.org, Daniel Henrique Barboza , Liu Zhiwei , Weiwei Li , Gerd Hoffmann , Palmer Dabbelt Subject: [PATCH v3 5/6] hw/uefi-vars-sysbus: allow for loongarch virt Date: Wed, 19 Mar 2025 15:11:57 +0100 Message-ID: <20250319141159.1461621-6-kraxel@redhat.com> In-Reply-To: <20250319141159.1461621-1-kraxel@redhat.com> References: <20250319141159.1461621-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.337, 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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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: 1742393637453019100 Content-Type: text/plain; charset="utf-8" Allow the device being added to loongarch virt VMs. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/loongarch/virt.c | 2 ++ hw/uefi/Kconfig | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index a5840ff96857..b6f5f6a3b546 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -38,6 +38,7 @@ #include "hw/mem/nvdimm.h" #include "hw/platform-bus.h" #include "hw/display/ramfb.h" +#include "hw/uefi/var-service-api.h" #include "hw/mem/pc-dimm.h" #include "system/tpm.h" #include "system/block-backend.h" @@ -1207,6 +1208,7 @@ static void virt_class_init(ObjectClass *oc, void *da= ta) object_class_property_set_description(oc, "v-eiointc", "Enable Virt Extend I/O Interrupt Controller."= ); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_UEFI_VARS_SYSBUS); #ifdef CONFIG_TPM machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); #endif diff --git a/hw/uefi/Kconfig b/hw/uefi/Kconfig index f139008b632b..b55529fca137 100644 --- a/hw/uefi/Kconfig +++ b/hw/uefi/Kconfig @@ -1,3 +1,3 @@ config UEFI_VARS bool - default y if X86_64 || AARCH64 || RISCV64 + default y if X86_64 || AARCH64 || RISCV64 || LOONGARCH64 \ No newline at end of file --=20 2.48.1 From nobody Thu Apr 3 10:04:24 2025 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=1742393763; cv=none; d=zohomail.com; s=zohoarc; b=DsVpqIuQUNgBtNNG/icmOEutUeWGwIRMCC8zewMLojrMxiqpDyxoT42RerpKMd67QX6M+ks5j3x0qB5Er9d2yVofftUn5aOmhkXCQao6zwq/lk8KVkrNLWNriLxmY8ZGS8P4w+IF44HoArQqk6cSQsvUlkYXkJjKiGI5vxoB8Rg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742393763; 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=QzhP9OAVsP3Z1Y7/Rdm8Ho3H/XRS32EXq7epwFlF2GU=; b=l9Stx4geonSywBq3WCjES2ZCQTuKkY25/8ucvtsqwc3Ypb6UCZM1iGToDTCeHCY21tmcJgF95EkDm4rwAdXEutZiqVft4Fj0E30XFjx0o2At/NYKWFhlcYW8pWTUC9gyXsuYRtB5awK+zY0RQ8BDKp6Ysotd84NGvzniavsn+ts= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742393763597111.82436022552668; Wed, 19 Mar 2025 07:16:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tuuAm-0002UQ-W9; Wed, 19 Mar 2025 10:13:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tuuA9-0001hN-8B for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:55 -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 1tuu9y-0006l2-V2 for qemu-devel@nongnu.org; Wed, 19 Mar 2025 10:12:50 -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-577-xbrANIUVNiOUHHec3K9q4Q-1; Wed, 19 Mar 2025 10:12:15 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 37F07180AF57; Wed, 19 Mar 2025 14:12:14 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.45.224.38]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 85C511955BEE; Wed, 19 Mar 2025 14:12:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 94A8618003B9; Wed, 19 Mar 2025 15:11:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742393539; 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=QzhP9OAVsP3Z1Y7/Rdm8Ho3H/XRS32EXq7epwFlF2GU=; b=FL3ulDEwqNuWa17L7SAUb/gwx2AqS/0BS9SH3li/sUJWZGajRX9kmuQpcuRCeCktzjRoCS fcc5k+vCjmQhRMuBYdh6H+KKAztyERlXlFltpgpvkd8nVGmVSePu0ER4gkUC//QWVKFrIO Am/PpmlOsii9O7yOMwg3LHZXY0deRXg= X-MC-Unique: xbrANIUVNiOUHHec3K9q4Q-1 X-Mimecast-MFC-AGG-ID: xbrANIUVNiOUHHec3K9q4Q_1742393534 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Bibo Mao , Kashyap Chamarthy , Paolo Bonzini , Song Gao , Jiaxun Yang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-riscv@nongnu.org, Daniel Henrique Barboza , Liu Zhiwei , Weiwei Li , Gerd Hoffmann , Palmer Dabbelt Subject: [PATCH v3 6/6] docs/firmware: add feature flag for host uefi variable store Date: Wed, 19 Mar 2025 15:11:58 +0100 Message-ID: <20250319141159.1461621-7-kraxel@redhat.com> In-Reply-To: <20250319141159.1461621-1-kraxel@redhat.com> References: <20250319141159.1461621-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 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=lists.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: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.337, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=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: 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: 1742393766916019100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/interop/firmware.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/interop/firmware.json b/docs/interop/firmware.json index 57f55f6c5455..745d21d82232 100644 --- a/docs/interop/firmware.json +++ b/docs/interop/firmware.json @@ -214,13 +214,23 @@ # PL011 UART. @verbose-static is mutually exclusive # with @verbose-dynamic. # +# @host-uefi-vars: The firmware expects the host to provide an uefi +# variable store. qemu supports that via +# "uefi-vars-sysbus" (aarch64, riscv64, loongarch64) +# or "uefi-vars-x64" (x86_64) devices. The firmware +# will not use flash for nvram. When loading the +# firmware into flash the 'stateless' setup should be +# used. It is recommened to load the firmware into +# memory though. +# # Since: 3.0 ## { 'enum' : 'FirmwareFeature', 'data' : [ 'acpi-s3', 'acpi-s4', 'amd-sev', 'amd-sev-es', 'amd-sev-snp', 'intel-tdx', - 'enrolled-keys', 'requires-smm', 'secure-boot', + 'enrolled-keys', 'requires-smm', + 'secure-boot', 'host-uefi-vars', 'verbose-dynamic', 'verbose-static' ] } =20 ## --=20 2.48.1