From nobody Sat Apr 20 07:58:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1533874776550250.22799114285124; Thu, 9 Aug 2018 21:19:36 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9CAAC210EB119; Thu, 9 Aug 2018 21:19:28 -0700 (PDT) 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 AF40D21BADAB2 for ; Thu, 9 Aug 2018 21:19:26 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2018 21:19:24 -0700 Received: from ydong10-win10.ccr.corp.intel.com ([10.239.9.125]) by orsmga003.jf.intel.com with ESMTP; 09 Aug 2018 21:19:19 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,218,1531810800"; d="scan'208";a="74234301" From: Eric Dong To: edk2-devel@lists.01.org Date: Fri, 10 Aug 2018 12:19:08 +0800 Message-Id: <20180810041909.12776-5-eric.dong@intel.com> X-Mailer: git-send-email 2.15.0.windows.1 In-Reply-To: <20180810041909.12776-1-eric.dong@intel.com> References: <20180810041909.12776-1-eric.dong@intel.com> Subject: [edk2] [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: , Cc: Ruiyu Ni , Laszlo Ersek MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RDMRC_1 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong Reviewed-by: Laszlo Ersek Reviewed-by: Ruiyu Ni --- 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; =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)&AcpiCpuDataE= x->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 A= Ps + // in S3 resume phase in long mode. Also during S3 resume, the stack buf= fer + // 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->Stac= kSize); + Stack =3D AllocateAcpiNvsMemory (NumberOfCpus * AcpiCpuData->StackSize); ASSERT (Stack !=3D NULL); AcpiCpuData->StackAddress =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Stack; =20 --=20 2.15.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel