From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.75]) by mx.groups.io with SMTP id smtpd.web11.8676.1679391135427298100 for ; Tue, 21 Mar 2023 02:32:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@suse.com header.s=selector1 header.b=5uS8Mpx7; spf=pass (domain: suse.com, ip: 40.107.6.75, mailfrom: jlee@suse.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F6tdbo9ATnAHl8Ttrvy8J6y0eqUUEKhnFyOYRkC/Q9QRikEjkf6YERcGjIMKnVLIjb45V3PltoK4/lrbypxKgzZCpUODKHS2MCH+soWuJci/Eho32HuYYxPc3lR8AypWsjEUtZZ4v1E87GXOb/H/KNArrYtFaBGZCnZwRGDuheg9x7a20Lb9FtugrBKK9gaMEVRu4qaQ9Pl8/fu0uSTwslbKhwZ1XBXGwYNxtgdTFogn4VXhS6yJhbpYVeMOQ+LP9TGh9tWZO3fd1/y76pGoZ7k5GR0hS0F/wBkHSBzPenR3H8p7MMxl70DtqXW59TE2uZzrbyr2h04c5Q4gPrbZBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oXaa9ZF+eTNF9bFuPuwgSh/H/kksA0Xdnl9ziWfp+tc=; b=U4wujteDACqXp3a43mOfU3eDYsuMpkHFsnTEiRScuWB/l7GCgX/fxXilXtKy36QgATnmCm1PX/8VMvthqVhOW2TezVAC2YLQyR3GsydYPNQ+/c2pEse8qYMps4pOHmDjavFxvsbYtNGSuA6CS4RQZUKcBlSBS+ALQITPWDZrp+2PBt7Me3ksBOlkaucfq8dz99VbQPuUproiMtrS+RU555bsLvFeiHijtaVN4cEOCSg7juoKc3xXAEsGhDSUO0uYDLZkX5wXDlE3ixY1QmeYbPCwoZGAAdpieigECtG1LomD5zDCVtS6BOAiF3ekANp2R8L2cut1V1yosoC7vpKVmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oXaa9ZF+eTNF9bFuPuwgSh/H/kksA0Xdnl9ziWfp+tc=; b=5uS8Mpx7doMrW1Ti6WWemLu4t7bOBtJ5ja0553RjV5G+ABxPBzOhR2rMRR2//tGFcfRbZAqYljXHsmOTKvmNvVgSQuRGHOXhpp9s/zUUJeRfi5tRc83g9gKiUIcyxV5nwxTImgIsc2MgNqKBHmxNt9VHm8waffVuqqGmWvA/zdLj6J8i70UFhc+5e2BQJVq2o2Nbkvr983sAQLp9z7AgxTaiPzr2HxB3id8rrb7HfQMshw6oPT6O4+pQKKRdWN5F51votcnlkylB+S3qjq+yK/nXGpSwI54qZpdvikY6XCcUDPMdFIpFdwHWnJtjHZuejxrj610ZBR1BlUuUtQxScw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from DB8PR04MB7164.eurprd04.prod.outlook.com (2603:10a6:10:129::23) by DBBPR04MB7595.eurprd04.prod.outlook.com (2603:10a6:10:20d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 09:32:13 +0000 Received: from DB8PR04MB7164.eurprd04.prod.outlook.com ([fe80::ea33:6d90:451b:6a1c]) by DB8PR04MB7164.eurprd04.prod.outlook.com ([fe80::ea33:6d90:451b:6a1c%6]) with mapi id 15.20.6178.037; Tue, 21 Mar 2023 09:32:13 +0000 Date: Tue, 21 Mar 2023 17:31:52 +0800 From: "joeyli" To: devel@edk2.groups.io, min.m.xu@intel.com Cc: Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: Re: [edk2-devel] [PATCH V5 4/8] OvmfPkg/PlatformPei: Update ReserveEmuVariableNvStore Message-ID: <20230321093152.GF8116@linux-l9pv.suse> References: In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-ClientProxiedBy: TYWPR01CA0034.jpnprd01.prod.outlook.com (2603:1096:400:aa::21) To DB8PR04MB7164.eurprd04.prod.outlook.com (2603:10a6:10:129::23) Return-Path: JLee@suse.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB8PR04MB7164:EE_|DBBPR04MB7595:EE_ X-MS-Office365-Filtering-Correlation-Id: 31fdd871-b3bf-41e2-2fee-08db29ef26ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2TeXYvlHbag5Op4fvoDV0bZ1C8O3MES92qhafP0Z3wBJJptUvkwSdslxVWQw1UmLvDwqCrNb2nPSiWSjAypwQ2fp4+TDZ1bppDN3rlCaBge/Vh08/Mad2gp0qKs1T2pawpa1JMjK9BiVyqFC0qE/88NB/jw+O+b6n3T8ZcO5azwxQB/moa3Qv62lpFhy/9o3cz2VEbIRfa7Wift6u7R83b18oCZPLFiEntbMiYBJx/IPmG7VPq/VQJJH2iOAdbLM793GqKkKqQQ5MX/QvM+BsfiAOtGvv8zUrHekyAm2UPsTBY/KB2PRxEMWI+z0qPSkpIuDBkW9l1oq7p265hFrgvptqC6wgqeXirq7fZcizYHzNww5NtwPeGFizdcaTJt3Ln7G1GieAvdLqb/k0m8Y/W4OYBlINpLZzgCfVVXqIj9wEqQwKhIQLnGSA9xtWbZqOLXKHFiLv3S4jc86QlQhbvinkCAkxC+HgHuWi/Om8SMwLnh3PlwxP3zjNXNyXxAEucFCxHTe9Qdf90yH126BtU83d16wvsmZlFdEYNKPUZwSgKktdoHStZrLMyTrva8luOuI/mEb2712mGiQls4kCCkgk/RhnZslPqxqERG5APppSF9mAjMTxJ+Top+HB1J+kALr4zcvi7qxnwvWmHcx/vK9+OYsbgRfBA5xtFZq9k37pyipwhXT5NR7MncWQO9vebWPIPFHtwW746/Ix/6ukLUO9WXxUm/UWe28FTJ59Uw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB8PR04MB7164.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(6029001)(396003)(376002)(39860400002)(346002)(366004)(136003)(451199018)(66899018)(83380400001)(6486002)(6506007)(6512007)(316002)(478600001)(9686003)(54906003)(966005)(26005)(6666004)(1076003)(33656002)(186003)(15650500001)(86362001)(38100700002)(2906002)(66946007)(5660300002)(8936002)(66556008)(4326008)(36756003)(66476007)(41300700001)(8676002)(43062005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tWgzN0jqISLRdBjdbiTcUfnSAm56UiVvIVjQb0bo5K3LyDGSGQCPS1I5KK8h?= =?us-ascii?Q?OwA4j3gj5msKPecbbCJr3VZcoUE0svqNBys8li69X4rcBTuqvthKKgVN1xIQ?= =?us-ascii?Q?Rdr+UBTHw0v+aipiUw9Ykaz3kFfDTepYzu9crBjZU91PlhsFitzWQ/i7+sHl?= =?us-ascii?Q?Yp7IBc9FKJaYExRueJI67/Zh1dL5J6KW7IEQBiY7nMoUbN7p6kUjFtM0uLVu?= =?us-ascii?Q?8Zy8jAuV5kZyztkvHXxV/KZsAJXYw2kOceEf6S44BW75R7Q1aFAhR3lix5Gq?= =?us-ascii?Q?3GxLEj0fO9EUyKLbJe/cykDvJXcfXYrGhPYT08GWLSRn2YVQI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RJ25KHKvBrZcp/reFFfq6fbgJvo6AxVrju?= =?us-ascii?Q?HyYbpRHdGyA04EhjdEr7AqtXwCV6aBsm8U7xwVC5IY0pKAWQhIPj+p3jDTAa?= =?us-ascii?Q?bxRwdmbTShOWmHCnWgX9QtugHhnrepA/+hlcMlj4LIf0mVNrkSD2jsFmhdWL?= =?us-ascii?Q?OzknVGfRDMRCRFrlCKtUmX3hht+aqGBH4jHxlSQh+Dk0jCqDkff5cgdLh8rY?= =?us-ascii?Q?NR6BXrIEvMni8sV5ArbCwcKyUWSOWdWoArh/XKRXVYyV0Abd8eR7VTze5iJj?= =?us-ascii?Q?foz2gx4mTAsff8z9/h8kaYvX7KQrG5/jA2l2XvOB+ckc4nPJFGsrsbCragCM?= =?us-ascii?Q?jlpXrVRhc55yDcneFHwsdrmWUU2G1XVChaQBm9a3?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31fdd871-b3bf-41e2-2fee-08db29ef26ce X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB7164.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 09:32:13.0838 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eSuYInzUf0QezdavsrS7eluy/u2vswf8B4mJHteIdcfUzJ2IcC92Kv+lMoxotAo7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7595 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Min M Xu, I have filed a EDK2 bug relates to this patch: Bug 4379 - Got NvVarStore FV headers were invalid when using OVMF with AMD SEV https://bugzilla.tianocore.org/show_bug.cgi?id=4379 I got a "NvVarStore FV headers were invalid." assert when using OVMF with AMD SEV. After reverted this patch, the assert is gone. Thanks! Joey Lee On Tue, Sep 06, 2022 at 12:35:56PM +0800, Min Xu via groups.io wrote: > 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 > Acked-by: 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; > > - // > - // 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 = > - (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 = PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore); > + VariableStore = (EFI_PHYSICAL_ADDRESS)(UINTN)PlatformReserveEmuVariableNvStore (); > + PcdStatus = PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore); > + > + #ifdef SECURE_BOOT_FEATURE_ENABLED > + PlatformInitEmuVariableNvStore ((VOID *)(UINTN)VariableStore); > + #endif > + > ASSERT_RETURN_ERROR (PcdStatus); > } > > -- > 2.29.2.windows.2 > > > > >