From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=UvtNL7CC; spf=none, err=SPF record not found (domain: amd.com, ip: , mailfrom: thomas.lendacky@amd.com) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (NAM01-BY2-obe.outbound.protection.outlook.com []) by groups.io with SMTP; Fri, 20 Sep 2019 06:16:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GGJr650l5PDB8NthoyRAqmXfSPQQ21ekpcvS4vrJHRGZIFhZbcDOPU9w56ugO5HOs/P+HLDDdV9UodiaiqynwYwANw5q3ZW0iTLZou7UthYyIVm3NDpzsF7PBiTEbC+UhbqBNDSpAK1wWU+riCKGbrbbDi7/q7b3tPokznmYhI0CVRDlY0tZYryfPPQQe05eOSSIK2JRqsjqMMw5qizpDcXTadTUbUmxgCoPX3/BtbBlj9ikYF5qxVzepihyrFSIN5pCAEMIs6F9efBYAh9uhHYBx7otEHGk7t3Gfgnf76rq+XjlodkvwNeyDaiBquQTJN666nOBAMVuEpaAi9knIg== 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=bHsLHVP9ebNzt4dIuNhV++1/qNFC6yhguXMea4Do5LU=; b=lwy8TaoOLHXv8AmNSoUitp0MrFS8Wyx40RJ5C3CzyzpygCmp4ROIDONXQI/yvbob11ILThmnbyCi1tK/4/btpoXEOTGGPG1SkFyhW5zoJTZBzINk+uSbBKxGLTDmwxuNmggxzmK0ll3pS7uPCP852DFKfZfrS++/d6hcld5uvmFSrV92xCy/DGI4Rq8mmbjLrLCYjNoexOTKpqx4ah+BANANoR4zdCw/qwytyhS1M/NwELbwgEY8yeRQPcOeUf5XZBdoFFafhdwQsCySe6aVAjppJw2abBYDilDMaTBqg0LWQm6N0RbOId57vWK/zLMXtA4KvKZ0jU2Yv3+APDylYw== 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=bHsLHVP9ebNzt4dIuNhV++1/qNFC6yhguXMea4Do5LU=; b=UvtNL7CCuaupHnVHWAIKByZYIV9axWq7AcnPY7mTC3kpubQJTtrpCMuXQ2YQhfw3u+GPNuYdXE+we6rs4KB8md23JX0urgVml0SSJS9qpABA0m57iwjrkTL0EqoEg1mNlbu44/U+4kQVlnn9mMfpznvKiped2Vb4EbVBt+GfTwM= Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.104.150) by DM6PR12MB3995.namprd12.prod.outlook.com (10.255.175.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.23; Fri, 20 Sep 2019 13:16:46 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::400e:f0c3:7ca:2fcc]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::400e:f0c3:7ca:2fcc%6]) with mapi id 15.20.2284.009; Fri, 20 Sep 2019 13:16:46 +0000 From: "Lendacky, Thomas" To: "devel@edk2.groups.io" Subject: [RFC PATCH v2 41/44] UefiCpuPkg/MpInitLib: Add MP finalization interface to MpInitLib Thread-Topic: [RFC PATCH v2 41/44] UefiCpuPkg/MpInitLib: Add MP finalization interface to MpInitLib Thread-Index: AQHVb7Wn9ZEoBT4h0UmeDqAaEgE3yA== Date: Fri, 20 Sep 2019 13:16:46 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-clientproxiedby: SN6PR06CA0023.namprd06.prod.outlook.com (2603:10b6:805:8e::36) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:182::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.78.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 12d10ca7-60b0-4e31-c4d2-08d73dccc99f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:DM6PR12MB3995; x-ms-traffictypediagnostic: DM6PR12MB3995: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0166B75B74 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6029001)(4636009)(39860400002)(366004)(396003)(376002)(136003)(346002)(199004)(189003)(118296001)(186003)(36756003)(99286004)(6512007)(966005)(2906002)(25786009)(66556008)(66476007)(66946007)(50226002)(2501003)(26005)(52116002)(76176011)(64756008)(446003)(11346002)(5640700003)(305945005)(6436002)(5660300002)(7736002)(316002)(6486002)(66066001)(8676002)(71200400001)(102836004)(66446008)(6116002)(256004)(3846002)(2616005)(476003)(478600001)(6916009)(1730700003)(81156014)(71190400001)(81166006)(14454004)(6306002)(8936002)(6506007)(386003)(486006)(86362001)(2351001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3995;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-message-info: 24laHUf47o50yA+7MpCDiAKT1UcPGGmIR64f/V1tbHTqt1tT76LTrgtB5zMpq4ShEazmXpwlT3yCw7SyHH78ppLuOfExS9MekHkGQIgYt++gbYqpNQ1jPk9KQfpVRTAxKDvhGUyVCsMhXarFC7WG0qAnAwaJhtCfitoesMRNYJSBqoDKRtPhBrdcOB3iU3Bfb9G+p+0M81EUtKLZx8D7VQ/sia3JbmD6ZLXpzVnCinBnOYeKv6DaaUzyeLv7pQYd7Fyr/yrzJDzJUCVkcTwwgmoRnqat+buba/Nr61znzsT5ocMB372P4cGGPtKHXh3DXrBqZcZ9eOoHwhN4+jURGmdtT93U34gjn6kKkW51hwMCt/9i4/hJC6RsMb4D1GeLP6u/FBRGExWGV5Wu7mW/t5aF77m1AbGUVIy6L5zThxI= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12d10ca7-60b0-4e31-c4d2-08d73dccc99f X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2019 13:16:46.3397 (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: /dhTM61U7Lo9XkqGULVplltBHipFwh98OoBuFBVbn8wlmDpO1A7cVq1no2xf39KmJLA27Gx3Qud7RunspXP3Gw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3995 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 Provide an MP finalization function that can be called from the CPU protocol finalization function. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Tom Lendacky --- UefiCpuPkg/Include/Library/MpInitLib.h | 14 ++++++++++++++ UefiCpuPkg/Library/MpInitLib/MpLib.h | 11 +++++++++++ UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 18 ++++++++++++++++++ UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 +++++++++++++++++++++++ UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 16 ++++++++++++++++ 5 files changed, 82 insertions(+) diff --git a/UefiCpuPkg/Include/Library/MpInitLib.h b/UefiCpuPkg/Include/Li= brary/MpInitLib.h index 31eb227f1209..f9beeefca78e 100644 --- a/UefiCpuPkg/Include/Library/MpInitLib.h +++ b/UefiCpuPkg/Include/Library/MpInitLib.h @@ -378,4 +378,18 @@ MpInitLibStartupAllCPUs ( IN VOID *ProcedureArgument OPTIONAL ); =20 +/** + This service allows users of MpLib to make any finalization changes + before transferring control out of UEFI + + @retval EFI_SUCCESS MP initialization succeeds. + @retval Others MP initialization fails. + +**/ +EFI_STATUS +EFIAPI +MpLibFinalize ( + VOID + ); + #endif diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpIn= itLib/MpLib.h index 4cfb93ee4f77..5966510d4a1b 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -654,5 +654,16 @@ EnableDebugAgent ( VOID ); =20 +/** + Perform MpLib finalization before transferring control out of UEFI + + @param[in] CpuMpData The pointer to CPU MP Data structure. + +**/ +EFI_STATUS +MpFinalize ( + IN CPU_MP_DATA *CpuMpData + ); + #endif =20 diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/M= pInitLib/DxeMpLib.c index 8df5b6d919e6..16603ef3f20e 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -884,3 +884,21 @@ MpInitLibEnableDisableAP ( =20 return Status; } + +/** + MP finalization + + @param[in] CpuMpData The pointer to CPU MP Data structure. +**/ +EFI_STATUS +MpFinalize ( + IN CPU_MP_DATA *CpuMpData + ) +{ + // + // DXE phase will do this transition, but just return EFI_SUCCESS for no= w. + // + return EFI_SUCCESS; +} + + diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 43aa9c0a4950..7fd478f735fb 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1728,6 +1728,29 @@ CheckAllAPs ( return EFI_NOT_READY; } =20 +/** + MP finalization + + This service allows users of MpLib to make any finalization changes + before transferring control out of UEFI. + + This service must be invoked before exiting boot services. + + @retval EFI_SUCCESS MP finalization succeeds. + +**/ +EFI_STATUS +EFIAPI +MpLibFinalize ( + VOID + ) +{ + CPU_MP_DATA *CpuMpData; + + CpuMpData =3D GetCpuMpData (); + return MpFinalize (CpuMpData); +} + /** MP Initialize Library initialization. =20 diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/M= pInitLib/PeiMpLib.c index 56956a615b6b..793d26b1bf12 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c @@ -604,4 +604,20 @@ MpInitLibEnableDisableAP ( return EnableDisableApWorker (ProcessorNumber, EnableAP, HealthFlag); } =20 +/** + MP finalization + + @param[in] CpuMpData The pointer to CPU MP Data structure. +**/ +EFI_STATUS +MpFinalize ( + IN CPU_MP_DATA *CpuMpData + ) +{ + // + // PEI phase shouldn't do such a transition. So simply return EFI_SUCCES= S. + // + return EFI_SUCCESS; +} + =20 --=20 2.17.1