From nobody Mon Feb 9 06:01:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90943+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90943+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1656631790; cv=none; d=zohomail.com; s=zohoarc; b=RNXQqpbG1RExeXxzduHqtz4fOorcheLWvskjsaxEofvqfwAaQ5DGOGytAx+tOWEsTRfnkRl8ZaZ5dhSLOBFIiS0i7rOTV8nF3GRPOSAifiahieluZwHvyZmAwhxn7tV305biYp0LdLW/HLgUJ3IYOGSAnAqIOHkoY0rWAyvVZgE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656631790; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=pZ9Tf4mbCKMItZn+4AOUqqsSovF9+DZfG+VZie0cz4Y=; b=VUvBm8fU+lIfQnAgEiqz5kJzuduF3kahDRp96fpR8eEfRoXuhibUvmo6akuxcpMeRDGYR/lKi4m8YTH8gqJrtayv+Pc3nReOtiIvXWfwBQxdacGT9F21a2ZByfX4WYTp7oqKUt9tEMMZ3fiZzTOkc8Xcj/t/J+aX0MOq01ZoaUg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90943+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1656631790243790.2780979612525; Thu, 30 Jun 2022 16:29:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id gzroYY1788612xFiO8JUP3wR; Thu, 30 Jun 2022 16:29:49 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web12.32335.1656631779038420889 for ; Thu, 30 Jun 2022 16:29:48 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10394"; a="265528335" X-IronPort-AV: E=Sophos;i="5.92,235,1650956400"; d="scan'208";a="265528335" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2022 16:29:45 -0700 X-IronPort-AV: E=Sophos;i="5.92,235,1650956400"; d="scan'208";a="648098681" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.210]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2022 16:29:44 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [edk2-devel] [PATCH V4 4/8] OvmfPkg/PlatformPei: Update ReserveEmuVariableNvStore Date: Fri, 1 Jul 2022 07:29:13 +0800 Message-Id: <1aab00b3eba2fd8a019f9941da46e62dbfa80f82.1656630360.git.min.m.xu@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: BybJxVFyEuj33kQbKrOxXgtMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1656631789; bh=Ar6qb3zSuYziDZdio9cWkSqaLnUHbMu+jpW7eqjjIUI=; h=Cc:Date:From:Reply-To:Subject:To; b=T34u32483vlJNWUZlHFnq46kxW4mQYqlAPhPCItMPZQniPNLLWSjjpOqp3BTlgMFy+a Hr63KEcmuMy2zs1iIB1ERjZwls2fqbEwORONZM+twyWqJCiAblmVpOmkB/er57pslXv+Y MJdBxfNbrV34e/MptiPHS8De/Rf/3Tyw1nc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1656631792449100007 Content-Type: text/plain; charset="utf-8" From: Min M Xu ReserveEmuVariableNvStore is updated with below 2 functions defined in PlatformInitLib: - PlatformReserveEmuVariableNvStore - PlatformInitEmuVariableNvStore PlatformInitEmuVariableNvStore works when secure boot feature is enabled. This is because secure boot needs the EFI variables (PK/KEK/DB/DBX, etc) and EmuVariableNvStore is cleared when OVMF is launched with -bios parameter. Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Signed-off-by: Min Xu --- OvmfPkg/PlatformPei/Platform.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 009db67ee60a..b1f8140d6041 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -220,24 +220,13 @@ ReserveEmuVariableNvStore ( EFI_PHYSICAL_ADDRESS VariableStore; RETURN_STATUS PcdStatus; =20 - // - // Allocate storage for NV variables early on so it will be - // at a consistent address. Since VM memory is preserved - // across reboots, this allows the NV variable storage to survive - // a VM reboot. - // - VariableStore =3D - (EFI_PHYSICAL_ADDRESS)(UINTN) - AllocateRuntimePages ( - EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) - ); - DEBUG (( - DEBUG_INFO, - "Reserved variable store memory: 0x%lX; size: %dkb\n", - VariableStore, - (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024 - )); - PcdStatus =3D PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore); + VariableStore =3D (EFI_PHYSICAL_ADDRESS)(UINTN)PlatformReserveEmuVariabl= eNvStore (); + PcdStatus =3D PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStor= e); + + #ifdef SECURE_BOOT_FEATURE_ENABLED + PlatformInitEmuVariableNvStore ((VOID *)(UINTN)VariableStore); + #endif + ASSERT_RETURN_ERROR (PcdStatus); } =20 --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90943): https://edk2.groups.io/g/devel/message/90943 Mute This Topic: https://groups.io/mt/92098439/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-