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.52]) by mx.groups.io with SMTP id smtpd.web12.14624.1574285583311790426 for ; Wed, 20 Nov 2019 13:33:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=jYOMS5UK; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.76.52, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W1pz0AH/5CkY+kx9IWAW30BKGkOSTEb+ciT0NFxnuWBmLfBNNkxw3xYFfL6f/LWZGrdY0ffIl6Q8azGBQCJAp/T3DAyly7DHAc9l7ebNyuD8Sf49FM+dtzRUnLAlaPSk4xz3yFQ31/py36lXNf7XZU6632nZNrsGioqE5Mj7QNhKpCQywZqLS57YJx5dY8KzLfN6rxSyLZ3wCDL7KoLjZ2Y/Gqvisj/HRS5GmO6VSFOqyCIk4V6hVh+HHrIeXLGqIJIWePvAVoPwrz+8lSTnZBpenWcrYMV9j8bdXXaSxOdD1Xv9unCRxvM2dqyeA3dhaE+mukC3gbblPb8d0HYnSA== 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=5Ey0fmmWyziG4ToneEe4fiIOyFlPc21ZIIQgbAl9Ydg=; b=EVhSKEoM/xZjJs0Q2Oq0+FZ+KJBvczbahPzA+yRvouLTa95psUvhi2e4UED+X0g01tfv6R9Pz9RBjcmhM9f9drVMBU1uD+LcgTGe0tO7x44xuq9HxvlH59ZdKXiSTZwJxieeBY6WDLtdmgMkLBaL76aY29TDGJ1MnLgW+gVECjKAwAr2sUVSDCgbQSunck3M0pIumg4XzaisAsmQgRZjojR3+6WAVDu2ze0C664eqftynzAO8pKztcFgplWiMZJM2cT1laBfGC6hZOIT4Mni67iYu/NF/MZgMhkbjxNWGxPfSkO+YNbQU+CvO7QbG6xtljsELqpXyGxlYZgD2Glo5A== 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=5Ey0fmmWyziG4ToneEe4fiIOyFlPc21ZIIQgbAl9Ydg=; b=jYOMS5UKQzCyHiszT7ktE91GEFYUgK74WAEv6GRuQYo4yHBfQUNTPEsAddMUNhP+GUO+UWmQgYccdFGaTlx9lDwgZ1ni+zanS7rcs9uU8objEHpPKE/SLjFL/gPgxOo9N4PWEVaq0b/WjOY6EdpXdo3Oa0DakJa2J3/WPiO1T5o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.71.154) by DM6PR12MB3514.namprd12.prod.outlook.com (20.179.104.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.16; Wed, 20 Nov 2019 21:33:02 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::dd0c:8e53:4913:8ef4]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::dd0c:8e53:4913:8ef4%5]) with mapi id 15.20.2451.031; Wed, 20 Nov 2019 21:33:02 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [RFC PATCH v3 42/43] UefiCpuPkg/CpuDxe: Provide an DXE MP finalization routine to support SEV-ES Date: Wed, 20 Nov 2019 15:32:48 -0600 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN1PR12CA0065.namprd12.prod.outlook.com (2603:10b6:802:20::36) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 49c2d37e-458d-4c12-46ee-08d76e013881 X-MS-TrafficTypeDiagnostic: DM6PR12MB3514: X-MS-Exchange-PUrlCount: 1 X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 02272225C5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(376002)(39860400002)(199004)(189003)(50466002)(66476007)(66556008)(966005)(8936002)(14454004)(66946007)(48376002)(86362001)(25786009)(52116002)(50226002)(51416003)(316002)(16586007)(76176011)(6512007)(386003)(99286004)(6306002)(2906002)(26005)(81166006)(81156014)(186003)(6506007)(8676002)(478600001)(6486002)(6116002)(3846002)(66066001)(47776003)(5660300002)(2361001)(486006)(14444005)(2351001)(6916009)(36756003)(6666004)(2616005)(305945005)(6436002)(11346002)(446003)(7736002)(118296001)(476003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3514;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: byNvT4RC5Y7vAS3GJDLcTL87UrRa+UN7TZof5zjSr++t2fqapgFKNWnuXXxbShnJjEQXr95LTNG1Gvzcok64usrYSBJ+Kf7HatsUcNj7ACFMW7HYINRqhTvdhsJs1LkkxsvoGxhunk7acmVF3W5ink9vu5naZE7s1dhFO84jOdA9YIo3/a5rKlCoajaKk87CM9B0Ij5rGkTYasqAeUgAtnNxrpCd2OhrNKpe0h4phPjTAyqysnDAcKRYPRRpwjGTP0/xz2iHRbOVACpFMEFskK7sGgCEhrycFvLG03xZIeZIeITQfp/XQbEUI6TgI7/fD8h2liwa/3fWBse4d76nWdX7Utt5Da1iBhhPuCAP+tdsZyUaYJ9C2lU+Crj6DlOEo79yGuGNIDhCpfkKSE2EirktH/tT53s2WyVMgipEQKnAY/tQ652wglCg+LL6scGvv683qwwNtKF0mBCuC8IUVBCe7+Q5/N9qo5+Ymi9K71Y= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49c2d37e-458d-4c12-46ee-08d76e013881 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2019 21:33:02.0192 (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: 4A5i0UPfljN22ptzgZ401G2yJNAA3IPeb43b0vvhVaMWjOJ06wb8gIwGY6V0HAAmzkMxI3nSEzy+Yja1BNLqNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3514 Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 Provide support for the MP finalization routine within DXE. This finalization function will invoke the MpInitLib MpLibFinalize() function to perform the steps necessary to park an AP and be able to successfully boot it under an OS. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Tom Lendacky --- UefiCpuPkg/CpuDxe/CpuDxe.h | 12 ++++++++++++ UefiCpuPkg/CpuDxe/CpuDxe.c | 21 ++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.h b/UefiCpuPkg/CpuDxe/CpuDxe.h index a6762f1a0b78..d071a32135b2 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.h +++ b/UefiCpuPkg/CpuDxe/CpuDxe.h @@ -232,6 +232,18 @@ CpuSetMemoryAttributes ( IN UINT64 Attributes ); +/** + Perform any MpLib final actions before transitioning out of UEFI. + + @param This Protocol instance structure + +**/ +VOID +EFIAPI +CpuFinalize ( + IN EFI_CPU_ARCH_PROTOCOL *This + ); + /** Initialize Global Descriptor Table. diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c index 7d7270e10b4a..bee44c0dd488 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.c +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c @@ -93,7 +93,8 @@ EFI_CPU_ARCH_PROTOCOL gCpu = { CpuGetTimerValue, CpuSetMemoryAttributes, 1, // NumberOfTimers - 4 // DmaBufferAlignment + 4, // DmaBufferAlignment + CpuFinalize }; // @@ -499,6 +500,24 @@ CpuSetMemoryAttributes ( return AssignMemoryPageAttributes (NULL, BaseAddress, Length, MemoryAttributes, NULL); } +/** + Implementation of CpuFinalize() service of CPU Architecture Protocol. + + This function performs any MpLib library finalization to perform required + actions before exiting boot services. + + @param This The EFI_CPU_ARCH_PROTOCOL instance. + +**/ +VOID +EFIAPI +CpuFinalize ( + IN EFI_CPU_ARCH_PROTOCOL *This + ) +{ + MpLibFinalize (); +} + /** Initializes the valid bits mask and valid address mask for MTRRs. -- 2.17.1