From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.12930.1649781153637950310 for ; Tue, 12 Apr 2022 09:32:33 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=YWFEtMca; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from [192.168.4.22] (unknown [47.201.46.36]) by linux.microsoft.com (Postfix) with ESMTPSA id 19ADE2034C46; Tue, 12 Apr 2022 09:32:29 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 19ADE2034C46 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1649781153; bh=CNFRcgMbhtkhup9rT6S10yUowPffw8YFNGc8Xf/VUEs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=YWFEtMcafNT2Dom6CjpMe3jrq5qYRP05uWY3x5/tAcvzKA2kFzXwPHEydm57lrczy vk0Pq59aqG267bu23xrM3uWYSKb/fon8WbGovbkOCDZPWTNgx7L6HSeKtdzF/GP/lg pZbP/BUr95wsMTmq5oxVoSkXgzanscogbYQBiA7s= Message-ID: <89e97b98-aa13-7c8c-2dd2-b4f1c5f0cfe8@linux.microsoft.com> Date: Tue, 12 Apr 2022 12:32:28 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: =?UTF-8?B?UmU6IOWbnuWkjTogW1BBVENIIHYzIDAvOF0gQWRkIFZhcmlhYmxlIEZsYXNoIEluZm8gSE9C?= To: gaoliming , devel@edk2.groups.io Cc: 'Abner Chang' , 'Andrew Fish' , 'Anthony Perard' , 'Ard Biesheuvel' , 'Benjamin You' , 'Brijesh Singh' , 'Erdem Aktas' , 'Gerd Hoffmann' , 'Guo Dong' , 'Hao A Wu' , 'James Bottomley' , 'Jian J Wang' , 'Jiewen Yao' , 'Jordan Justen' , 'Julien Grall' , 'Leif Lindholm' , 'Maurice Ma' , 'Min Xu' , 'Nickle Wang' , 'Peter Grehan' , 'Ray Ni' , 'Rebecca Cran' , 'Sami Mujawar' , 'Sean Rhodes' , 'Sebastien Boeuf' , 'Tom Lendacky' References: <20220411174209.2804-1-mikuback@linux.microsoft.com> <011b01d84e0c$2ae73840$80b5a8c0$@byosoft.com.cn> From: "Michael Kubacki" In-Reply-To: <011b01d84e0c$2ae73840$80b5a8c0$@byosoft.com.cn> Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Liming, To help move reviews along, I went ahead and sent a v4 patch series with=20 the following information: 1. More details about when the HOB is required. 2. More details about when the HOB should be installed in the boot flow. 3. A 4 byte reserved field after the "Version" field. The details are in MdeModulePkg/Include/Guid/VariableFlashInfo.h V4: https://edk2.groups.io/g/devel/message/88787 CI PR: https://github.com/tianocore/edk2/pull/2768 Regards, Michael On 4/11/2022 9:25 PM, gaoliming wrote: > Michael: > Can you give the suggestion about how to install this variable flash= info > hob when it is required? Because VariablePei is early PEIM, how to make= sure > the variable flash info hob is installed before GetVariable is called? >=20 > On VARIABLE_FLASH_INFO structure definition, the first field is UINT= 32, > other fields are all UINT64. How about reserve 4 bytes after the first > field? If so, all fields are at the nature alignment address. >=20 > Thanks > Liming >> -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- >> =E5=8F=91=E4=BB=B6=E4=BA=BA: mikuback@linux.microsoft.com >> =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2022=E5=B9=B44=E6=9C=8812=E6=97=A5= 1:42 >> =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io >> =E6=8A=84=E9=80=81: Abner Chang ; Andrew Fish >> ; Anthony Perard ; Ard >> Biesheuvel ; Benjamin You >> ; Brijesh Singh ; Erdem >> Aktas ; Gerd Hoffmann ; >> Guo Dong ; Hao A Wu ; James >> Bottomley ; Jian J Wang ; >> Jiewen Yao ; Jordan Justen >> ; Julien Grall ; Leif Lindh= olm >> ; Liming Gao ; >> Maurice Ma ; Min Xu ; >> Nickle Wang ; Peter Grehan ; >> Ray Ni ; Rebecca Cran ; Sami >> Mujawar ; Sean Rhodes ; >> Sebastien Boeuf ; Tom Lendacky >> >> =E4=B8=BB=E9=A2=98: [PATCH v3 0/8] Add Variable Flash Info HOB >> >> From: Michael Kubacki >> >> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 >> >> The UEFI variable drivers such as VariableRuntimeDxe, VariableSmm, >> VariableStandaloneMm, etc. (and their dependent protocol/library >> stack), typically acquire UEFI variable store flash information >> with PCDs declared in MdeModulePkg. >> >> For example: >> [Pcd] >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 >> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize >> >> These PCDs work as-is in the StandaloneMm driver if they are not >> dynamic such as Dynamic or DynamicEx because PCD services are not >> readily available in the Standalone MM environment. Platforms that >> use Standalone MM today, must define these PCDs as FixedAtBuild in >> their platform build. However, the PCDs do allow platforms to treat >> the PCDs as Dynamic/DynamicEx and being able to support that is >> currently a gap for Standalone MM. >> >> This patch series introduces a HOB that can be produced by the >> platform to provide the same information. The HOB list is >> available to Standalone MM. >> >> The PCD declarations are left as-is in MdeModulePkg for backward >> compatibility. This means unless a platform wants to use the HOB, >> their code will continue to work with no change (they do not need >> to produce the HOB). Only if the HOB is found, is its value used >> instead of the PCDs. >> >> Due to the large number of consumers of this information, access >> to the base address and size values is abstracted in a new library >> class (as requested in the v1 series) called VariableFlashInfoLib. >> >> The API of VariableFlashInfoLib does not bind the underlying data >> structure to the information returned to library users to allow >> flexibility in the library implementation in the future. >> >> V3 changes: >> 1. To better clarify usage, renamed the members >> "NvStorageBaseAddress" and "NvStorageLength" in >> "VARIABLE_FLASH_INFO" to "NvVariableBaseAddress" and >> "NvVariableLength". >> 2. Added description comments to the fields in "VARIABLE_FLASH_INFO". >> >> V2 changes: >> 1. Abstracted flash info data access with VariableFlashInfoLib. >> 2. Updated package builds in the repo that build the variable and >> FTW drivers to include VariableFlashInfoLib. >> 3. Removed a redundant variable assignment in VariableSmm.c. >> 4. Updated comments in FtwMisc.c and FaultTolerantWritePei.c to >> indicate driver assumption is UINTN (not UINT32) >> 5. Added a version field to the VARIABLE_FLASH_INFO structure. >> >> Cc: Abner Chang >> Cc: Andrew Fish >> Cc: Anthony Perard >> Cc: Ard Biesheuvel >> Cc: Benjamin You >> Cc: Brijesh Singh >> Cc: Erdem Aktas >> Cc: Gerd Hoffmann >> Cc: Guo Dong >> Cc: Hao A Wu >> Cc: James Bottomley >> Cc: Jian J Wang >> Cc: Jiewen Yao >> Cc: Jordan Justen >> Cc: Julien Grall >> Cc: Leif Lindholm >> Cc: Liming Gao >> Cc: Maurice Ma >> Cc: Min Xu >> Cc: Nickle Wang >> Cc: Peter Grehan >> Cc: Ray Ni >> Cc: Rebecca Cran >> Cc: Sami Mujawar >> Cc: Sean Rhodes >> Cc: Sebastien Boeuf >> Cc: Tom Lendacky >> Signed-off-by: Michael Kubacki >> >> Michael Kubacki (8): >> MdeModulePkg: Add Variable Flash Info HOB >> MdeModulePkg/VariableFlashInfoLib: Add initial library >> MdeModulePkg/Variable: Consume Variable Flash Info >> MdeModulePkg/FaultTolerantWrite: Consume Variable Flash Info >> ArmVirtPkg/ArmVirt.dsc.inc: Add VariableFlashInfoLib >> EmulatorPkg: Add VariableFlashInfoLib >> OvmfPkg: Add VariableFlashInfoLib >> UefiPayloadPkg: Add VariableFlashInfoLib >> >> >> MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib= .c >> | 178 ++++++++++++++++++++ >> MdeModulePkg/Universal/FaultTolerantWriteDxe/FtwMisc.c >> | 41 +++-- >> MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c >> | 7 +- >> MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.c >> | 28 +-- >> MdeModulePkg/Universal/Variable/Pei/Variable.c >> | 14 +- >> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c >> | 16 +- >> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableNonVolatile.c >> | 14 +- >> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c >> | 17 +- >> ArmVirtPkg/ArmVirt.dsc.inc >> | 1 + >> EmulatorPkg/EmulatorPkg.dsc >> | 1 + >> MdeModulePkg/Include/Guid/VariableFlashInfo.h >> | 78 +++++++++ >> MdeModulePkg/Include/Library/VariableFlashInfoLib.h >> | 68 ++++++++ >> >> MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib= .i >> nf | 48 ++++++ >> >> MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib= .u >> ni | 12 ++ >> MdeModulePkg/MdeModulePkg.dec >> | 8 + >> MdeModulePkg/MdeModulePkg.dsc >> | 2 + >> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.h >> | 7 +- >> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i= nf >> | 10 +- >> >> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf >> | 10 +- >> >> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandal >> oneMm.inf | 10 +- >> MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.i= nf >> | 10 +- >> MdeModulePkg/Universal/Variable/Pei/Variable.h >> | 2 + >> MdeModulePkg/Universal/Variable/Pei/VariablePei.inf >> | 5 +- >> MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h >> | 7 +- >> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf >> | 5 +- >> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf >> | 5 +- >> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf >> | 5 +- >> OvmfPkg/AmdSev/AmdSevX64.dsc >> | 1 + >> OvmfPkg/Bhyve/BhyveX64.dsc >> | 1 + >> OvmfPkg/CloudHv/CloudHvX64.dsc >> | 1 + >> OvmfPkg/IntelTdx/IntelTdxX64.dsc >> | 1 + >> OvmfPkg/Microvm/MicrovmX64.dsc >> | 1 + >> OvmfPkg/OvmfPkgIa32.dsc >> | 1 + >> OvmfPkg/OvmfPkgIa32X64.dsc >> | 1 + >> OvmfPkg/OvmfPkgX64.dsc >> | 1 + >> OvmfPkg/OvmfXen.dsc >> | 1 + >> UefiPayloadPkg/UefiPayloadPkg.dsc >> | 1 + >> 37 files changed, 525 insertions(+), 94 deletions(-) >> create mode 100644 >> MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib= .c >> create mode 100644 MdeModulePkg/Include/Guid/VariableFlashInfo.h >> create mode 100644 MdeModulePkg/Include/Library/VariableFlashInfoLib= .h >> create mode 100644 >> MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib= .i >> nf >> create mode 100644 >> MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib= .u >> ni >> >> -- >> 2.28.0.windows.1 >=20 >=20