From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A4A1321BADAB2 for ; Sun, 12 Aug 2018 22:42:04 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2018 22:42:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,232,1531810800"; d="scan'208";a="65665925" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 12 Aug 2018 22:42:03 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 12 Aug 2018 22:42:03 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 12 Aug 2018 22:42:03 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.143]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.240]) with mapi id 14.03.0319.002; Mon, 13 Aug 2018 13:42:01 +0800 From: "Ni, Ruiyu" To: "Dong, Eric" , "edk2-devel@lists.01.org" CC: Laszlo Ersek Thread-Topic: [Patch v3 4/5] UefiCpuPkg/CpuS3DataDxe: Remove below 4G limitation. Thread-Index: AQHUMGFazNGLcBKUG0ezfSDOd2yQAKS9L+KQ Date: Mon, 13 Aug 2018 05:41:21 +0000 Deferred-Delivery: Mon, 13 Aug 2018 05:42:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BDD077D@SHSMSX104.ccr.corp.intel.com> References: <20180810041909.12776-1-eric.dong@intel.com> <20180810041909.12776-5-eric.dong@intel.com> In-Reply-To: <20180810041909.12776-5-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch v3 4/5] UefiCpuPkg/CpuS3DataDxe: Remove below 4G limitation. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Aug 2018 05:42:04 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----Original Message----- > From: Dong, Eric > Sent: Friday, August 10, 2018 12:19 PM > To: edk2-devel@lists.01.org > Cc: Laszlo Ersek ; Ni, Ruiyu > Subject: [Patch v3 4/5] UefiCpuPkg/CpuS3DataDxe: Remove below 4G > limitation. >=20 > Because PrepareApStartupVector() stores StackAddress to "mExchangeInfo- > >StackStart" (which has type (VOID*)), and because > "UefiCpuPkg/PiSmmCpuDxeSmm/X64/MpFuncs.nasm" reads the latter with: >=20 > add edi, StackStartAddressLocation > add rax, qword [edi] > mov rsp, rax > mov qword [edi], rax >=20 > in long-mode code. So code can remove below 4G limitation. >=20 > Cc: Laszlo Ersek > Cc: Ruiyu Ni > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Dong > --- > UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) >=20 > 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; >=20 > /** > - Allocate EfiACPIMemoryNVS below 4G memory address. > - > - This function allocates EfiACPIMemoryNVS below 4G memory address. > + Allocate EfiACPIMemoryNVS memory. >=20 > @param[in] Size Size of memory to allocate. >=20 > @@ -56,7 +54,7 @@ typedef struct { >=20 > **/ > VOID * > -AllocateAcpiNvsMemoryBelow4G ( > +AllocateAcpiNvsMemory ( > IN UINTN Size > ) > { > @@ -64,9 +62,8 @@ AllocateAcpiNvsMemoryBelow4G ( > EFI_STATUS Status; > VOID *Buffer; >=20 > - Address =3D BASE_4GB - 1; > Status =3D gBS->AllocatePages ( > - AllocateMaxAddress, > + AllocateAnyPages, > EfiACPIMemoryNVS, > EFI_SIZE_TO_PAGES (Size), > &Address > @@ -239,9 +236,13 @@ CpuS3DataInitialize ( > AcpiCpuData->MtrrTable =3D > (EFI_PHYSICAL_ADDRESS)(UINTN)&AcpiCpuDataEx->MtrrTable; >=20 > // > - // 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 =3D AllocateAcpiNvsMemoryBelow4G (NumberOfCpus * AcpiCpuData- > >StackSize); > + Stack =3D AllocateAcpiNvsMemory (NumberOfCpus * > + AcpiCpuData->StackSize); > ASSERT (Stack !=3D NULL); > AcpiCpuData->StackAddress =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Stack; >=20 > -- > 2.15.0.windows.1