From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 0296CD80A20 for ; Wed, 16 Aug 2023 07:09:03 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=HK9j6zgoJFap3Tmg76lUMUTdxhFjKGprDQboXoubvC8=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1692169742; v=1; b=Qxl8SU9VgFAW9dDHjCIr+otZAqNrwJ3+LX1cK/kRQy6wW3dPvHdTyAlfSOuzjY91wYZqqz2G seJwVqVgcij2ZnJnlGThr4myHQaap3fytIYUL0eq0+ScR0mg7p+O52R/iJc0vfnsfkct97p4lsW 5lC818GhWGYPIOlIC2nFJCfw= X-Received: by 127.0.0.2 with SMTP id boCGYY7687511x2RZ3EU4gOs; Wed, 16 Aug 2023 00:09:02 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.155539.1692169741904270985 for ; Wed, 16 Aug 2023 00:09:02 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="372459171" X-IronPort-AV: E=Sophos;i="6.01,176,1684825200"; d="scan'208";a="372459171" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2023 00:09:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="848377864" X-IronPort-AV: E=Sophos;i="6.01,176,1684825200"; d="scan'208";a="848377864" X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga002.fm.intel.com with ESMTP; 16 Aug 2023 00:09:01 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 16 Aug 2023 00:09:00 -0700 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Wed, 16 Aug 2023 00:09:00 -0700 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.177) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Wed, 16 Aug 2023 00:09:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MXtXXmvAzBOiGpyRBS1S1dqSSvSTjOpVMerk56dzdn0ieBtH1gC+K3N2RA+HeAHlU9WJjMu8K6pSvU4QK2xoDrMQqFzU2IFnmwnseoQBG7l1xDddbYQ6afOgqcjbVmW7IedMMAzF4kdyU3J0K8g4Kgf5PyQnI1VOn8hEyBmxWwkfO7DSTg7QY+pUcETyVGmsGEcas7r+3HAYku/6cVDsU4mVgCDaRVCaJTLZizyhRl4VFgvVtF8exaKW+Itb2KuuYxe1sc+HjD9J17D2H4dme094Flc4Dd4bJ2eW05Le1uVCk4E8MkQ4aCgcf2VimZhxlZDR1bdD96K1Z9RSgrzkKw== 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=mJio4qFeoIagoZUaYfyoJ9L1yzNTL/KuZmFNtGhI3sU=; b=lSioQi2V6bwa3gJqsCmxFanhc1iWvSuKyzyVDcGYr8Ofp5CxRRtQAi47fZ7zVUDNwMDH21CdkUt9pSzW7sZnwPmceZAW/V5qhepkhpGVW4cuNX1RI+70c92OM4/PxTCBKOd5hIEDbYUbrpCC9otX3TSkUhDIwRG9Ao01LgZc7OGDJ7GBwwgNgsJsB0y/qJuqfdkm7MQwsuDP+QPy2l1wzy2ElB2UDoWGb77bYClC8ZEP2wD8Ye1bhbtYr4X7eaOg5SzfGJj4S8y/B82R83OYdOgIlV5W3YO2VjKXDOjDAR2RgEp5XiPTmjBkHZsv4/5wlk5TPwNvpKKCFaMIRbAY0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from BY5PR11MB3861.namprd11.prod.outlook.com (2603:10b6:a03:18d::13) by SA1PR11MB6919.namprd11.prod.outlook.com (2603:10b6:806:2bc::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.26; Wed, 16 Aug 2023 07:08:59 +0000 X-Received: from BY5PR11MB3861.namprd11.prod.outlook.com ([fe80::1cbb:35cf:6019:5aeb]) by BY5PR11MB3861.namprd11.prod.outlook.com ([fe80::1cbb:35cf:6019:5aeb%7]) with mapi id 15.20.6678.029; Wed, 16 Aug 2023 07:08:58 +0000 From: "Li, Yong" To: "devel@edk2.groups.io" , "2931013282@sjtu.edu.cn" <2931013282@sjtu.edu.cn> CC: Sunil V L , "Warkentin, Andrei" Subject: Re: [edk2-devel] [PATCH] OvmfPkg/RiscVVirt: Fix issues in VarStore Blockmap config Thread-Topic: [edk2-devel] [PATCH] OvmfPkg/RiscVVirt: Fix issues in VarStore Blockmap config Thread-Index: AQHZzU7Ei6bY9p2gRE+s3nI/JEjVOa/sg4Bw Date: Wed, 16 Aug 2023 07:08:58 +0000 Message-ID: References: <2c7b82749a9aff01393b230e216c5e5aee675dd1.1691750977.git.2931013282@sjtu.edu.cn> In-Reply-To: <2c7b82749a9aff01393b230e216c5e5aee675dd1.1691750977.git.2931013282@sjtu.edu.cn> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BY5PR11MB3861:EE_|SA1PR11MB6919:EE_ x-ms-office365-filtering-correlation-id: 52e9caa3-1376-4b94-007a-08db9e27a97d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: j13nCyT6TQiLzbXoPeNbi9zA12ccl5B/WaJrZO8cGFUxtv79Se31R9G3D79pzC92af4yJPUmf+maIsXUI26jce1jB7rXyboYSSdIOdM9799US6p8pn7jcH0u1HGuY4++dRBWQ5gRyNyX6mMtLS+c6J1v/YR7BeWAQbchrJyJfHKOgnyFsicjGHZs8wnV1lsEe+l63/uaunmf/+TY+KU6MG1fAUjDhxOydDiOpJUKvPdTrhO6sGOJaqoZ9Ww3+Tk06Idd6j1CwgVr7T4u3lFhA+B0x21cwv7yIMjXxC7fiZp+JD6R2T4Xk+oxK2wEMJOrm/yhm/cOiphx1vC+SdATFP73lBkhB50L57CbDQ40E9tpJAV2YCoXgufze75Y1qCQyMp/izE6oMRS3ogmp0HBfFDbYITq/FGpLTTcwu8ulA9JsBGbehDywLRvRRnrgDbPZa4qNh7fQBwJ3q57fO/cTxORPZNYeiZpdyDxze8kKrN0ldn51XOebY0qgXklNax7whOWe6DYZiW0Ot+mLKm9duBRWaUgd0keRT9O/jvP7PkHg0OMDho94NQP2GhggZ7CZUeA9nxFFvKfgnUtlK+UeZjVvIWLQ2Jn0PhFeV0VckPdYImvQgmcGNGXb7rTSNTCBxcPQNUdpzdQziEeYMPWRg== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xB/gEsCbP6WCWfM3A8JwYG9oeZWjrkEWZkkVij6gXjgCa1YsAS/SGtnFLLPv?= =?us-ascii?Q?3l4BesAGYVXIx6rUdQfDWoL8TpkgKg5oW+N/oPgSqQPupJMB2KIHnlAR+/on?= =?us-ascii?Q?rFmzJ0auTiCYdUcQcQOTtLaQDFbQGc2SCwrejWtV4Xe73LsCwC/TL5erEdAP?= =?us-ascii?Q?+BamMKiMejOgulBKc+eGsQKNeiiJBN5EuZYH6mioB4yAeI4np9ODEI+6Nt/s?= =?us-ascii?Q?PAvLNE6yQNM8JblLXUJjC+zOgOJ0YINa/HZgZAu31ecw4T4L/OB6R+NCWh5g?= =?us-ascii?Q?TJDwef6WT2eolHMzpqRjicTRcHcQHlnVOiz79/XS2GartxGNDOIJn72VOYsd?= =?us-ascii?Q?paqliE9Wc6YfDvwjg5oPPyc8uKEU64xmAyAoM+2Z2eh3GjUbPgbDf1weSwA7?= =?us-ascii?Q?GNjToPNXPDbnd8dojs4ZQ1eiyfkaF9341N+jcTxzq2fcjokip3eNNHlNKQ/I?= =?us-ascii?Q?nJPgyA+8Ch7qClfTvDAmjgdO3yfvMf9ORWXZ03qOP8/HxPILrTduu9p3imH4?= =?us-ascii?Q?oq8DvHXpKv3fb79xi8VvbvgEddPesTG2exr8lAoiLvoyM097mV2yZ+riy3wq?= =?us-ascii?Q?9AKFX/hc9qM+bI2dhCqe3deuSJoo06ubVUSb+GusmhspVVuzTUz9HqS8tPT5?= =?us-ascii?Q?YaBSIRqUCYijWM/AUKFuV/Cs4vC0cptpSnZYeekV/NLZm5rkc7dfWQ+lene9?= =?us-ascii?Q?O5D//q82up1cY4ErkM1tBTwJorIa81lWsTpEJuEEvkBeRpM8Ij0hvAYz82EZ?= =?us-ascii?Q?IkLPqvQWkJIweQnCyFyETYNcN2JAxv3olpkYoFDvR7TQJWdw7D9ZREHP3WHn?= =?us-ascii?Q?pk0+USGB1OkH6xM/uTaiCGCyJqmFlv5nXvsAFSyRcm0JHC0E/FrDmHz7nP9C?= =?us-ascii?Q?BwlouGqaSa+z8vC8jts8INBxADJqF34PiBqvTF2VlKKMmqJK5E/CSWH9IOp+?= =?us-ascii?Q?sR6WPQ9MlopOcHniK9HTL8uGnUxltbHP+D/Vg6N/kveFZl6o5yPgnQsMRrU4?= =?us-ascii?Q?B9mm6Ahp+vJbgmCDvcWOEJM3bbE7RXK94/ktSQl6evJ0p0ql6N4H5EfjXzA6?= =?us-ascii?Q?+fsmBUY3ureT3zT4sNfF65M+v5V1jmi9jPOR0Y9OG1qJT0xrM0CZ3tvkxuBP?= =?us-ascii?Q?dJJRD2rueHiYavT5DxKFVLL2O2Cw4FJTrM6rTE8NRVNfmduoLxOJuca72ERC?= =?us-ascii?Q?9MKBAzddw54ijsBgJc99lrE3NhEcQ/74U8GkTjlLqFQWtv+x+Ku62ahL1R7v?= =?us-ascii?Q?df0W5TMJiuAaB8eq0M/XHNWUNOPz3zbXoa/TBwwCGxmgqZfy5MNhUJf0E0S1?= =?us-ascii?Q?kBTmZg8wT4A9EsofLRdOpBlFshnf+YeDuCUmiALCck/yiDhaVJ5wW4+hhLZ9?= =?us-ascii?Q?nn9w32VhOJXgpbiBQwfS25FCg6n3zi7kLsPkriL8ZKDGU+v3yyBkzlCffdD+?= =?us-ascii?Q?yQApaybNDqAITlH84YLfRBTEeBaIYx49bd4lHa9HgZeqiZEZCuL1k07DblJI?= =?us-ascii?Q?xgDG7Vjqqplu7NJbneqlZstRHKtj3qBxd0AcP9Jg1bL0Bza4BkeX4CQhoigd?= =?us-ascii?Q?VtTbU/M2IsUR3F9pVJo=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB3861.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52e9caa3-1376-4b94-007a-08db9e27a97d X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Aug 2023 07:08:58.7463 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 51maTWJRSFwiaMx7LeaTvGKLEmhF2USiDv6UqzwsqhjZtNdTg7CsSMF9s3TAOODc44MFKt9aceejTVP+cyhksw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB6919 X-OriginatorOrg: intel.com Precedence: Bulk 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,yong.li@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 9ENjHwBakuBE5LIbfgrS3swFx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=Qxl8SU9V; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Hi Sunil, Qingyu is from Penglai team, when we were working together in enabling Stan= daloneMm variable service,=20 we found an issue in OvmfPkg/RiscVVirt/VarStore.fdf.inc, in which the bloc= kmap config is not aligned with the value in OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c, = which is SIZE_256KB That mis-alignment won't cause any issue if the variable size is small and = less than 0x1000, but if store more data in the flash device then it will c= ause data loss issue during reboot. Once reboot if any FV header data is corrupted it will result the whole var= iable system be re-initialized. Please help review the patch and give the comments, thanks=20 Thanks, Yong Li -----Original Message----- From: devel@edk2.groups.io On Behalf Of Qingyu Shang Sent: Friday, August 11, 2023 7:05 PM To: devel@edk2.groups.io Cc: Qingyu Shang <2931013282@sjtu.edu.cn> Subject: [edk2-devel] [PATCH] OvmfPkg/RiscVVirt: Fix issues in VarStore Blo= ckmap config The block size configuration of Blockmap does not match that in Qemu VirtNo= rFlash, which causes variable data to be written into FtwWorkBlock by mista= ke, resulting in data loss during reboot. Fix it and update new checksum va= lue. Signed-off-by: Qingyu Shang <2931013282@sjtu.edu.cn> --- OvmfPkg/RiscVVirt/VarStore.fdf.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/RiscVVirt/VarStore.fdf.inc b/OvmfPkg/RiscVVirt/VarStor= e.fdf.inc index 6bc619e50c..aba32315cc 100644 --- a/OvmfPkg/RiscVVirt/VarStore.fdf.inc +++ b/OvmfPkg/RiscVVirt/VarStore.fdf.inc @@ -30,9 +30,9 @@ DATA =3D { # Signature "_FVH" # Attributes 0x5f, 0x46, 0x56, 0x48, 0xff, 0x= fe, 0x04, 0x00, # HeaderLength # CheckSum # ExtHeaderOffset #Reserved #Re= vision- 0x48, 0x00, 0x2F, 0xF1, 0x00, 0x00, 0x00, 0x02,- # Blockmap[0]: 0= x20 Blocks * 0x1000 Bytes / Block- 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x0= 0, 0x00,+ 0x48, 0x00, 0x28, 0x09, 0x00, 0x00, 0x00, 0x02,+ # Blockmap[0]:= 0x3 Blocks * 0x40000 Bytes / Block+ 0x3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x= 04, 0x00, # Blockmap[1]: End 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, = 0x00, ## This is the VARIABLE_STORE_HEADER--=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107708): https://edk2.groups.io/g/devel/message/107708 Mute This Topic: https://groups.io/mt/100684601/6998987 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [yong.li@intel.com] -=3D-= =3D-=3D-=3D-=3D-=3D -=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 (#107791): https://edk2.groups.io/g/devel/message/107791 Mute This Topic: https://groups.io/mt/100684601/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-