From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (NAM02-CY1-obe.outbound.protection.outlook.com [40.107.76.81]) by mx.groups.io with SMTP id smtpd.web11.438.1600804785169900565 for ; Tue, 22 Sep 2020 12:59:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=s3cUn9Uu; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.76.81, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cywf/0diXWCZnlHvJsS16qOHBD+xfTNc9hiqJEakTRM3Uz2KDFD6EpZb85K1NtRa2vHDSdpipR9jWwamPzHxt2dafpSymTSs7E/wRSKkWPDPOUf6qiQinRoqxnYnAg/pu99dQbR8J0UdwpgFGtLqs+ZjdOzy3I3HQj2Tp3HrGvQwHIfwdjIgEWOUooTvA8gtpLrGMRNmszXGtMHtMPtGgrmw5TFnWku48ytsxyPI/usEmSxSgueu6JO/65G/jZyfBtQwucXBoIHwwKvn9j5YlRGwval1horm1MsaNAZ/T0IkXnzJl6bZu+qwVic+mBHjRSBNfMpGPesNPETkfbMbVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ycvfGqDjz+3eCInxqMpI9pz+PATdqpvmVw3Tr+IXAnE=; b=nyMy+M5aniOBDYHUclLJ29XOyd5nhnEJxozc/s4+l+yr00is2RgjNBya4lZDTgpbsY245SYIHIeXex/Og55zk8duNle2VkDlDMkHjMxFswXUcKQjM8rkP4qe84rK3U/Ym4BvXTdjYFaDNRGPaophGZrnnMR6DYyHxfCeuaWWZo1a6g2za4E/+I6o2f1u6ZmN6rhEmxG4jTznZPfhjQpVcTa0wkjUPp2MG7Sk49jR4rlutVXxOm9sDNTIOeGbfvkpwya95/S4H4IR9kALbsNs14oyJ0QE61+DORN+EDCpxFXdXY7t6KeP4oBTpmJSnZ49gy2TNQGInsnW0VkIPTxUTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ycvfGqDjz+3eCInxqMpI9pz+PATdqpvmVw3Tr+IXAnE=; b=s3cUn9UuRHvrbLp0HVBUbglkrfsVT+UkNiKz2C81S5ZYqT9ifT74KjsWpbk7L7uNa+r4jUgMffBI6RDajXujY7r3G+qjN3wzucJjts299IRyf/h5g9xbVmf1eo2oYE2XZ/58Xmyabacw4iTvkZN+CG8bmmSjUqQ3wOJxndV8Ouw= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; Received: from DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM6PR12MB2796.namprd12.prod.outlook.com (2603:10b6:5:50::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.14; Tue, 22 Sep 2020 19:59:36 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::299a:8ed2:23fc:6346]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::299a:8ed2:23fc:6346%3]) with mapi id 15.20.3391.024; Tue, 22 Sep 2020 19:59:36 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar , Brijesh Singh , Garrett Kirkendall Subject: [PATCH 1/1] UefiCpuPkg/MpInitLib: Reduce reset vector memory pressure Date: Tue, 22 Sep 2020 14:59:23 -0500 Message-ID: X-Mailer: git-send-email 2.28.0 X-ClientProxiedBy: DM5PR07CA0053.namprd07.prod.outlook.com (2603:10b6:4:ad::18) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by DM5PR07CA0053.namprd07.prod.outlook.com (2603:10b6:4:ad::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Tue, 22 Sep 2020 19:59:35 +0000 X-Mailer: git-send-email 2.28.0 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d354c6f8-798d-4abe-78db-08d85f3207e4 X-MS-TrafficTypeDiagnostic: DM6PR12MB2796: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QJsOkm5pYINGlnu+ytm5qAP3NtoZ5HamVsCBqf+RKYNR4rrHZQSzzGiebOAitke8Ocwc7b+6vNp1OrN0f7qaAur4+Caabiyxz6IROwTOMUU1V1MVcpk2wR1pZlG+qEA4OV/B36wqASLvcR4wFn0ZoIjs32cLQ4JH3Tug+9NNu76a32nz3/fj5Ho1P/9UMxj+bPrOapxDp2KRMllE6mN8yo4EOMqjMora5XHgf6Ui39icMXccvI51c3lTG7aNXjO9FgG1HGyTfwYPNHDQCxCVCoaWtAzpHAF0gHYhlPX8w/3hGLwIDkXklYfAEzv8Fo8Lntts8v3mrv5kyo/oRpC6Mw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(39860400002)(396003)(366004)(346002)(136003)(376002)(26005)(86362001)(66946007)(8676002)(8936002)(66476007)(6666004)(6916009)(2906002)(186003)(5660300002)(4326008)(66556008)(478600001)(6486002)(16526019)(52116002)(956004)(83380400001)(54906003)(2616005)(36756003)(7696005)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 07VvJInM3Cix4M/4l0euH5qbvh1JGMj8MYtB8dxv8LP92jhfw0KAMp8aGFJThEbsA166H1lI63OkdRIVLoJKnvhYUj4zMlyWJuoikxWD1kNPuNGcGW9fGq9vKwL81A2uPNorhtdGP3m+ze1Dxaxg21lLP/1j+qo2MadtNF4ZKGesNkzFoxbES4mXI8Vm8ZnDouDjYRQATWSc3qBvMwwHxsqXOhwm1/xd9ocP1w84D8fESsZZnXIPVb4PMhXMCQRSCp0bAZ9uSMeQPHHizRg4kThMarpd2ojHE1c9K35T/ldopYxaPAV0vL9+xa0ypICtTR9R2WyUrINS2eBOFQag4RuOvZ0WRAmjtSjtlykRU8BbS8AS8HcMlmZnJIirlzoy8f1PyZuzSxG6Z9bEbKiG0UAxcHUIHaKq7pTGOq8Ceryhs//tw1lo3jHe+CZDLvLkV4mhB85HiA2sYVaurtMuwFyUhEGZfprjiSzj3cbeo6sVZYQIQkvErYdbthgKek3WX0EvbSPTnUjisRFKme+uTOBut9a4ssmOmZj47fmdGV/l4oWCDhFNYtSTBtqPFCx5kjxTsj4crbfV6RODHBWKMqhdirpFl6GIlLjoeV0Jdu17tNMg9YiGuq4c3daFIBd7ejqgdz8KVeX/3sXi+TVazg== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d354c6f8-798d-4abe-78db-08d85f3207e4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2020 19:59:36.0841 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Mo60NWG9zSoTcr2aEk9+tAmoAogL6JN62VehkJMb77lp4PDZMsG0vL7YEMrAg2ENaEs5D6bPgQtOTEGtmv349Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2796 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable From: Tom Lendacky 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 Signed-off-by: Tom Lendacky --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/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) =3D=3D TRUE) { + return AP_RESET_STACK_SIZE * PcdGet32(PcdCpuMaxLogicalProcessorNumber)= ; + } else { + return 0; + } } =20 /** --=20 2.28.0