From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web12.5697.1649726755994732783 for ; Mon, 11 Apr 2022 18:25:56 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([101.224.116.119]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 12 Apr 2022 09:25:15 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 101.224.116.119 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , 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> In-Reply-To: <20220411174209.2804-1-mikuback@linux.microsoft.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUEFUQ0ggdjMgMC84XSBBZGQgVmFyaWFibGUgRmxhc2ggSW5mbyBIT0I=?= Date: Tue, 12 Apr 2022 09:25:16 +0800 Message-ID: <011b01d84e0c$2ae73840$80b5a8c0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQDAIxF3OCtE8X2tUSkSYUctx+2GCa8b0A4Q Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn 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? On VARIABLE_FLASH_INFO structure definition, the first field is = UINT32, 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 > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: mikuback@linux.microsoft.com = > =B7=A2=CB=CD=CA=B1=BC=E4: 2022=C4=EA4=D4=C212=C8=D5 1:42 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: 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 > ; Liming Gao ; > Maurice Ma ; Min Xu ; > Nickle Wang ; Peter Grehan ; > Ray Ni ; Rebecca Cran ; Sami > Mujawar ; Sean Rhodes ; > Sebastien Boeuf ; Tom Lendacky > > =D6=F7=CC=E2: [PATCH v3 0/8] Add Variable Flash Info HOB >=20 > From: Michael Kubacki >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3479 >=20 > 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. >=20 > For example: > [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase > gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 > gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize >=20 > 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. >=20 > 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. >=20 > 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. >=20 > 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. >=20 > 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. >=20 > 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". >=20 > 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. >=20 > 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 >=20 > 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 >=20 >=20 > = 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 ++++++++ >=20 > = MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.i > nf | 48 ++++++ >=20 > = 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.inf > | 10 +- >=20 > MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.inf > | 10 +- >=20 > MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandal > oneMm.inf | 10 +- > = MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf > | 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 >=20 > -- > 2.28.0.windows.1