public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Lendacky, Thomas" <thomas.lendacky@amd.com>
To: devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Rahul Kumar <rahul1.kumar@intel.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	Garrett Kirkendall <garrett.kirkendall@amd.com>
Subject: [PATCH 1/1] UefiCpuPkg/MpInitLib: Reduce reset vector memory pressure
Date: Tue, 22 Sep 2020 14:59:23 -0500	[thread overview]
Message-ID: <bd614905f63d2e0af1300bb2d67277babe3abd5b.1600804763.git.thomas.lendacky@amd.com> (raw)

From: Tom Lendacky <thomas.lendacky@amd.com>

The AP reset vector stack allocation is only required if running as an
SEV-ES guest. Since the reset vector allocation is below 1MB in memory,
eliminate the requirement for bare-metal systems and non SEV-ES guests
to allocate the extra stack area, which can be large if the
PcdCpuMaxLogicalProcessorNumber value is large.

Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 07426274f639..39af2f9fba7d 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1152,7 +1152,15 @@ GetApResetStackSize (
   VOID
   )
 {
-  return AP_RESET_STACK_SIZE * PcdGet32(PcdCpuMaxLogicalProcessorNumber);
+  //
+  // The AP reset stack is only used by SEV-ES guests. Don't add to the
+  // allocation if not necessary.
+  //
+  if (PcdGetBool (PcdSevEsIsEnabled) == TRUE) {
+    return AP_RESET_STACK_SIZE * PcdGet32(PcdCpuMaxLogicalProcessorNumber);
+  } else {
+    return 0;
+  }
 }
 
 /**
-- 
2.28.0


             reply	other threads:[~2020-09-22 19:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 19:59 Lendacky, Thomas [this message]
2020-09-23  3:08 ` [PATCH 1/1] UefiCpuPkg/MpInitLib: Reduce reset vector memory pressure Ni, Ray
2020-09-23  8:14 ` Laszlo Ersek
2020-09-23  8:28   ` Laszlo Ersek
2020-09-23  8:31   ` Laszlo Ersek
2020-09-23 13:58     ` Lendacky, Thomas
2020-09-23 15:50       ` Lendacky, Thomas

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=bd614905f63d2e0af1300bb2d67277babe3abd5b.1600804763.git.thomas.lendacky@amd.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