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 ACA247803CC for ; Thu, 28 Mar 2024 05:59:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=9pd5UMDhZMO8/358N39Ctck3JVCdHSaMaZE5klSQ8ks=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1711605560; v=1; b=1ejAGHCLNUAeL52ypiB7JZi5XtcVTVQ68iM8+ISRwBOdEziDNjJUg5HG3BxLJ6ZVIfVuNnMU KZKk0RRKl1wO7cbAivqHUH7QocxRm5XWXD5/+OO7L7W+AaSANNJ7p9syIbikvCybUIJLMOwkIbp Lo91DI9pdwr5zWmpPeRK+XNGtb6oyQQjVuPSdeLjp73Mn32qE4N5tNREQHLN8u1dOKD64jxAmIo a0/085viElcsuv8xlTghnTPyWfgP0yeIiOkg9XSWDxkhzja4BJWcxwGR7XvFvONfIWobpPql3ca 50LZ7ptL617t5t8Spqz18SKlFju7hlRzBjIGyyN5Cy2pg== X-Received: by 127.0.0.2 with SMTP id hsjTYY7687511xfVcwr77K4U; Wed, 27 Mar 2024 22:59:20 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.9228.1711605559475330242 for ; Wed, 27 Mar 2024 22:59:19 -0700 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B68F5616BE for ; Thu, 28 Mar 2024 05:59:18 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 510FDC43399 for ; Thu, 28 Mar 2024 05:59:18 +0000 (UTC) X-Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-513d247e3c4so587900e87.0 for ; Wed, 27 Mar 2024 22:59:18 -0700 (PDT) X-Gm-Message-State: PtRUM5QCv0oNzsGMO2X6GJfRx7686176AA= X-Google-Smtp-Source: AGHT+IFp6Jkg4dFoBskW8go00ZN0XYtCKt5RfrzsGnFKxXW9ZXybb79/d0CIGIc+v1XDUbjO2XFUghAW+vbamDqjE+8= X-Received: by 2002:ac2:5b47:0:b0:513:ea36:2f07 with SMTP id i7-20020ac25b47000000b00513ea362f07mr442243lfp.20.1711605556476; Wed, 27 Mar 2024 22:59:16 -0700 (PDT) MIME-Version: 1.0 References: <20240326075733.4223-1-aaron.li@intel.com> <062901da80ad$4cff2ca0$e6fd85e0$@byosoft.com.cn> In-Reply-To: From: "Ard Biesheuvel" Date: Thu, 28 Mar 2024 07:59:04 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory To: devel@edk2.groups.io, aaron.li@intel.com Cc: gaoliming , "Liu, Zhiguang" , "Bi, Dandan" , "Liu, Yun Y" , "Yao, Jiewen" , "Ni, Ray" , "Kinney, Michael D" 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 Resent-Date: Wed, 27 Mar 2024 22:59:19 -0700 Reply-To: devel@edk2.groups.io,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=1ejAGHCL; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Hello Aaron, Could you describe the problem that is being solved by the ability to use EfiAcpiMemoryNVS for ACPI tables? On Thu, 28 Mar 2024 at 05:59, Aaron Li wrote: > > Hi Liming, > > Currently this patch does not have a related Bugzilla. > > According to UEFI spec, the ACPI Tables at boot time can be contained in = memory of type EfiACPIReclaimMemory or EfiAcpiMemoryNVS. > Current implementation in AcpiTableDxe only allocate memory with type Efi= ACPIReclaimMemory by default. > This patch provides an option method to let ACPI Tables be allocated in m= emory with type EfiAcpiMemoryNVS controlled by PCD. > > > Best, > Aaron > > -----Original Message----- > From: gaoliming > Sent: Thursday, March 28, 2024 9:15 AM > To: Li, Aaron ; devel@edk2.groups.io > Cc: Liu, Zhiguang ; Bi, Dandan ; Liu, Yun Y ; Yao, Jiewen ; = Ni, Ray ; Kinney, Michael D > Subject: =E5=9B=9E=E5=A4=8D: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PC= D switch to avoid using ACPI reclaim memory > > Aaron: > Is there a Bugzilla for this issue? What problem will be resolved with t= his > change? > > Thanks > Liming > > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > > =E5=8F=91=E4=BB=B6=E4=BA=BA: Aaron Li > > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2024=E5=B9=B43=E6=9C=8826=E6=97= =A5 15:58 > > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > > =E6=8A=84=E9=80=81: Zhiguang Liu ; Dandan Bi > > ; Liming Gao ; Liu Yun > > ; Jiewen Yao ; Ray Ni > > ; Michael D Kinney > > =E4=B8=BB=E9=A2=98: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switc= h to avoid > > using ACPI reclaim memory > > > > UEFI spec defined ACPI Tables at boot time can be contained in memory o= f > > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although InstallAcpiTabl= e > > with AcpiTableProtocol will only allocate memory with type > > EfiACPIReclaimMemory (Except FACS). > > > > This patch provides an optional method controlled by PCD to avoid using > > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > > TRUE, > > all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > > > Cc: Zhiguang Liu > > Cc: Dandan Bi > > Cc: Liming Gao > > Cc: Liu Yun > > Cc: Jiewen Yao > > Cc: Ray Ni > > Cc: Michael D Kinney > > Signed-off-by: Aaron Li > > --- > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > > +++++++++++++++----- > > MdeModulePkg/MdeModulePkg.dec > > | 7 ++++ > > MdeModulePkg/MdeModulePkg.uni > > | 8 +++++ > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 + > > 4 files changed, 45 insertions(+), 8 deletions(-) > > > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol= .c > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > index e09bc9b704f5..080768033cfa 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > > EFI_STATUS Status; > > UINT64 CurrentData; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > > (EFI_ACPI_TABLE_INSTANCE)); > > // > > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > > NewMaxTableNumber * sizeof (UINT32); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType =3D EfiACPIMemoryNVS; > > + } else { > > + AcpiAllocateMemoryType =3D EfiACPIReclaimMemory; > > + } > > + > > if (mAcpiTableAllocType !=3D AllocateAnyPages) { > > // > > // Allocate memory in the lower 32 bit of address range for > > @@ -372,13 +379,13 @@ ReallocateAcpiTableBuffer ( > > PageAddress =3D 0xFFFFFFFF; > > Status =3D gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status =3D gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > @@ -512,6 +519,7 @@ AddTableToList ( > > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > > UINT64 Buffer64; > > BOOLEAN AddToRsdt; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters > > @@ -550,6 +558,12 @@ AddTableToList ( > > CurrentTableList->TableSize =3D CurrentTableSize; > > CurrentTableList->PoolAllocation =3D FALSE; > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType =3D EfiACPIMemoryNVS; > > + } else { > > + AcpiAllocateMemoryType =3D EfiACPIReclaimMemory; > > + } > > + > > // > > // Allocation memory type depends on the type of the table > > // > > @@ -585,7 +599,7 @@ AddTableToList ( > > // such as AArch64 that allocate multiples of 64 KB > > // > > Status =3D gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > CurrentTableList->TableSize, > > (VOID **)&CurrentTableList->Table > > ); > > @@ -596,7 +610,7 @@ AddTableToList ( > > // > > Status =3D gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), > > &AllocPhysAddress > > ); > > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > > UINTN RsdpTableSize; > > UINT8 *Pointer; > > EFI_PHYSICAL_ADDRESS PageAddress; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters > > @@ -1978,17 +1993,23 @@ AcpiTableAcpiTableConstructor ( > > RsdpTableSize +=3D sizeof > > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType =3D EfiACPIMemoryNVS; > > + } else { > > + AcpiAllocateMemoryType =3D EfiACPIReclaimMemory; > > + } > > + > > if (mAcpiTableAllocType !=3D AllocateAnyPages) { > > PageAddress =3D 0xFFFFFFFF; > > Status =3D gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (RsdpTableSize), > > &PageAddress > > ); > > } else { > > Status =3D gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > RsdpTableSize, > > (VOID **)&Pointer > > ); > > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > > PageAddress =3D 0xFFFFFFFF; > > Status =3D gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status =3D gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > diff --git a/MdeModulePkg/MdeModulePkg.dec > > b/MdeModulePkg/MdeModulePkg.dec > > index a82dedc070df..a91058e5b5df 100644 > > --- a/MdeModulePkg/MdeModulePkg.dec > > +++ b/MdeModulePkg/MdeModulePkg.dec > > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > > # @Prompt Exposed ACPI table versions. > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > > T32|0x0001004c > > > > + ## Indicates whether ACPI Reclaim memory is not available > > + # Default is FALSE that means ACPI Reclaim memory is available > > + # If it is set to TRUE that means ACPI Reclaim memory is not availab= le > > + # For example ACPI Table protocol will use ACPI NVS memory instead o= f > > ACPI Reclaim memory > > + # @Prompt ACPI Reclaim memory is not available. > > + > > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > > EAN|0x0001008b > > + > > ## This PCD defines the MAX repair count. > > # The default value is 0 that means infinite. > > # @Prompt MAX repair count > > diff --git a/MdeModulePkg/MdeModulePkg.uni > > b/MdeModulePkg/MdeModulePkg.uni > > index a17d34d60b21..6079285e3f8b 100644 > > --- a/MdeModulePkg/MdeModulePkg.uni > > +++ b/MdeModulePkg/MdeModulePkg.uni > > @@ -955,6 +955,14 @@ > > > > "BIT 4 - EFI_ACPI_TABLE_VERSION_4_0.
\n" > > > > "BIT 5 - EFI_ACPI_TABLE_VERSION_5_0.
" > > > > +#string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > > PT #language en-US "ACPI Reclaim memory is not available." > > + > > +#string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > > #language en-US "Indicates whether ACPI Reclaim memory is not available= \n" > > + > > "Default is FALSE that means ACPI Reclaim memory is available\n" > > + > > "If it is set to TRUE that means ACPI Reclaim memory is not available\n= " > > + > > "For example ACPI Table protocol will use ACPI NVS memory instead of AC= PI > > Reclaim memory" > > + > > + > > #string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > > #language en-US "Enable export HII data and configuration to be used in= OS > > runtime." > > > > #string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > > #language en-US "Indicates if HII data and configuration has been > > exported.

\n" > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > index 86dea43e27e4..be498a56cff0 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > @@ -68,6 +68,7 @@ [Pcd] > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions ## > > CONSUMES > > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory > > ## CONSUMES > > > > [Protocols] > > gEfiAcpiTableProtocolGuid ## PRODUCES > > -- > > 2.44.0.windows.1 > > > > > >=20 > > -=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 (#117191): https://edk2.groups.io/g/devel/message/117191 Mute This Topic: https://groups.io/mt/105191315/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-