public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ruiyu" <ruiyu.ni@intel.com>
To: "Dong, Eric" <eric.dong@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Subject: Re: [Patch v3 4/5] UefiCpuPkg/CpuS3DataDxe: Remove below 4G limitation.
Date: Mon, 13 Aug 2018 05:41:21 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BDD077D@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20180810041909.12776-5-eric.dong@intel.com>

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Dong, Eric
> Sent: Friday, August 10, 2018 12:19 PM
> To: edk2-devel@lists.01.org
> Cc: Laszlo Ersek <lersek@redhat.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: [Patch v3 4/5] UefiCpuPkg/CpuS3DataDxe: Remove below 4G
> limitation.
> 
> Because PrepareApStartupVector() stores StackAddress to "mExchangeInfo-
> >StackStart" (which has type (VOID*)), and because
> "UefiCpuPkg/PiSmmCpuDxeSmm/X64/MpFuncs.nasm" reads the latter with:
> 
>          add  edi, StackStartAddressLocation
>          add  rax, qword [edi]
>          mov  rsp, rax
>          mov  qword [edi], rax
> 
> in long-mode code. So code can remove below 4G limitation.
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
>  UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> index 5b99a6e759..d18f33a5b8 100644
> --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c
> @@ -46,9 +46,7 @@ typedef struct {
>  } ACPI_CPU_DATA_EX;
> 
>  /**
> -  Allocate EfiACPIMemoryNVS below 4G memory address.
> -
> -  This function allocates EfiACPIMemoryNVS below 4G memory address.
> +  Allocate EfiACPIMemoryNVS memory.
> 
>    @param[in] Size   Size of memory to allocate.
> 
> @@ -56,7 +54,7 @@ typedef struct {
> 
>  **/
>  VOID *
> -AllocateAcpiNvsMemoryBelow4G (
> +AllocateAcpiNvsMemory (
>    IN UINTN  Size
>    )
>  {
> @@ -64,9 +62,8 @@ AllocateAcpiNvsMemoryBelow4G (
>    EFI_STATUS            Status;
>    VOID                  *Buffer;
> 
> -  Address = BASE_4GB - 1;
>    Status  = gBS->AllocatePages (
> -                   AllocateMaxAddress,
> +                   AllocateAnyPages,
>                     EfiACPIMemoryNVS,
>                     EFI_SIZE_TO_PAGES (Size),
>                     &Address
> @@ -239,9 +236,13 @@ CpuS3DataInitialize (
>    AcpiCpuData->MtrrTable    =
> (EFI_PHYSICAL_ADDRESS)(UINTN)&AcpiCpuDataEx->MtrrTable;
> 
>    //
> -  // Allocate stack space for all CPUs
> +  // Allocate stack space for all CPUs.
> +  // Use ACPI NVS memory type because this data will be directly used
> + by APs  // in S3 resume phase in long mode. Also during S3 resume, the
> + stack buffer  // will only be used as scratch space. i.e. we won't
> + read anything from it  // before we write to it, in PiSmmCpuDxeSemm.
>    //
> -  Stack = AllocateAcpiNvsMemoryBelow4G (NumberOfCpus * AcpiCpuData-
> >StackSize);
> +  Stack = AllocateAcpiNvsMemory (NumberOfCpus *
> + AcpiCpuData->StackSize);
>    ASSERT (Stack != NULL);
>    AcpiCpuData->StackAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)Stack;
> 
> --
> 2.15.0.windows.1



  parent reply	other threads:[~2018-08-13  5:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10  4:19 [Patch v3 0/5] Change CpuS3Data memory type and address limitation Eric Dong
2018-08-10  4:19 ` [Patch v3 1/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use GDT/IDT saved in Smram Eric Dong
2018-08-10 15:40   ` Laszlo Ersek
2018-08-13  1:54     ` Dong, Eric
2018-08-14 12:51       ` Laszlo Ersek
2018-08-13  5:42     ` Ni, Ruiyu
2018-08-10  4:19 ` [Patch v3 2/5] UefiCpuPkg/AcpiCpuData.h: Remove AcpiNVS and Below 4G limitation Eric Dong
2018-08-10 15:58   ` Laszlo Ersek
2018-08-13  5:42   ` Ni, Ruiyu
2018-08-10  4:19 ` [Patch v3 3/5] UefiCpuPkg/CpuS3DataDxe: Change Memory Type and address limitation Eric Dong
2018-08-10 16:12   ` Laszlo Ersek
2018-08-10 16:15     ` Laszlo Ersek
2018-08-13  1:50       ` Dong, Eric
2018-08-13  5:38         ` Ni, Ruiyu
2018-08-13  5:52           ` Ni, Ruiyu
2018-08-14 12:49             ` Laszlo Ersek
2018-08-10  4:19 ` [Patch v3 4/5] UefiCpuPkg/CpuS3DataDxe: Remove below 4G limitation Eric Dong
2018-08-10 16:22   ` Laszlo Ersek
2018-08-13  5:41   ` Ni, Ruiyu [this message]
2018-08-10  4:19 ` [Patch v3 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Combine implementation Eric Dong
2018-08-10 16:34   ` Laszlo Ersek
2018-08-13  5:41   ` Ni, Ruiyu
2018-08-10 16:39 ` [Patch v3 0/5] Change CpuS3Data memory type and address limitation Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=734D49CCEBEEF84792F5B80ED585239D5BDD077D@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox