From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.88]) by mx.groups.io with SMTP id smtpd.web09.833.1631557217593545132 for ; Mon, 13 Sep 2021 11:20:17 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=hWefR3IF; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.237.88, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HUF/fXpDdLxwzf6SRaLpilIaoztXKKkfBZZSPvMTmv/glMfPMsS9BcIpBcGNOx+Plv7wCsFSVTnvloodmixhGfcrl8LakgcMddGegVyk7IamHjrE+l2m3e6qnHeQa7+X39wvcZ1vahB1EkuMA2ajYhlVzj9om4A1lg6q3xRIiT4MyE8mLpJS2Rmb/SAOlD66ospffMy44VUcJ35/mYY+NltzK00/pXbMHJHHokBOwr9JH1tf7qPNWfvG0XEYOt3BQVr7/jSDsKNmcMxxhrxBItg9AsTHmJpcPvL6dTUqYEbzdGn6zm3mnxiGE/s+1na8x7bcqbnt8Xj2wdT5w4PO1w== 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; bh=OChYuEDf26fK5IeW1bsh1FZtsc/ccg3XdCOlQPftk+8=; b=GrcwaYFYQo1kKzxjFabUXVuNBoz4ME+kXjSsKlB1omD7iStg/KNfuNWQ9N3zyGmZas4qQAmMcPMrw8hjSH2Gh/kwI/8tRlTeUGJd2q+S0oXfh5qpZpMl2tjb93bE/mda8DUdRr+7XjiTvjlsKxaqZSlXoAhDz+4SSl/hSihiPpo2OkpY3ti0RPqCKyqZXGVnSaM05wMPlPM64sDY8VlcxjhxOBtJYGuyErstQpAiH10XEA+inEuxWF9Hmd4Csx+LuhyZdJRWR4syI2fYVTxL/0ngdONYrBW69HF+2xLtV+cXQR9s9SSZyz61r2QdA1ylG/7tqU5US6VI5DSL0mKmLQ== 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=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OChYuEDf26fK5IeW1bsh1FZtsc/ccg3XdCOlQPftk+8=; b=hWefR3IFpy5zaud3RTY+UnXb+qQE2/x5DdC90qGQSIu8DiQFT143mp/QHW2cLhw4wDe8l2B5RTar277nKOJLXxsUBTMoaptZw2TW29Z8scBBefvI7xIQ1PH9OneZVq1FUwuIucBC3pVm/63rGBQTckvNgQFhzfh0eihJyLry5sI= 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 SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SN1PR12MB2512.namprd12.prod.outlook.com (2603:10b6:802:31::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Mon, 13 Sep 2021 18:20:14 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::78b7:7336:d363:9be3%6]) with mapi id 15.20.4500.019; Mon, 13 Sep 2021 18:20:14 +0000 From: "Brijesh Singh" To: devel@edk2.groups.io CC: James Bottomley , Min Xu , Jiewen Yao , Tom Lendacky , Jordan Justen , Ard Biesheuvel , Erdem Aktas , Michael Roth , Gerd Hoffmann , Brijesh Singh , Michael Roth , Ray Ni , Rahul Kumar , Eric Dong Subject: [PATCH v7 20/31] OvmfPkg/PlatformPei: set PcdConfidentialComputingAttr when SEV is active Date: Mon, 13 Sep 2021 13:19:30 -0500 Message-ID: <20210913181941.23405-21-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210913181941.23405-1-brijesh.singh@amd.com> References: <20210913181941.23405-1-brijesh.singh@amd.com> X-ClientProxiedBy: SA9P221CA0012.NAMP221.PROD.OUTLOOK.COM (2603:10b6:806:25::17) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) Return-Path: brijesh.singh@amd.com MIME-Version: 1.0 Received: from sbrijesh-desktop.amd.com (165.204.77.1) by SA9P221CA0012.NAMP221.PROD.OUTLOOK.COM (2603:10b6:806:25::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Mon, 13 Sep 2021 18:20:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0dcbb983-63ed-46ad-0b43-08d976e321bc X-MS-TrafficTypeDiagnostic: SN1PR12MB2512: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0fjN4hw63qNVxhpP4FlaSNhhbhUWA283zxMYKJS1LNYDkMozI2RBAJv1WlOlQWFX22Kk2M0+of78ltoBYgmWCcUyXDtSCIUgM5Ag2akjimabA2YQWnvAI+pYd/YBa3kr9SmKKApLiVQNz/l0tNIf058Sxg4d5sU/1tmYrFgqR2378PHKplDozGu1DM2XeGr0mV0gmKHUgrF2Y1LvZn/+ZJ7k2+yvUukTvwNkUU2kIO9EhGwudnRk0GCFwyFurEdM0ILr5SI50WdaQ3EJCpSujY+C2oIT7qAYIaF+5BwyvRGbYVRTnFNL2+14UacpeOWU4aLVLC0TGpaE1E/ED0Y7ei1I6IEKyniEarp1p9Mop4cSNfkLI1jrEgtEGmP0wRxIGP3FnxhZIhRjs2v30RpKejxKYsqy3p6KOPvx0x+m0xlrW0jV/af3RAxC6bJdtBlkBdJi7ClBmB2jjLS2x/3Q9bA9mQXlIAE8Vp+zh01u4pJ1yfilRRGCF2Bs737lb1XXrxMwDdE5L5LKWmUbjdfV0x6CK6v3z+1zR+se7NIGR6Zb7RjuggWcrwlRSEQu8Uqe8u81xCfw1fR0od986k1WCbD8Qjyl1MNEjGeMtXpr0CMa9oKugq/55uBTaXRQ1dkpCD/R03T3cfFQiTrkUYVHy2gPNWnVVHHUz2GySxPacN+TFbPR7KSwJ33m2IQP1RtwEsqM0edyCQcqWlJuv4wmJgp8eD65Ir8JoG0O+zDUszEQxxQAVOlV8v/zW2JafbkNWVbGdJRPKH1lJx7f91Cd+f9Ps+cDz8eyzdFxuqxTCdc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(346002)(39860400002)(366004)(376002)(136003)(478600001)(86362001)(8936002)(966005)(6486002)(8676002)(186003)(6916009)(2906002)(38350700002)(38100700002)(26005)(36756003)(956004)(2616005)(66946007)(6666004)(66556008)(54906003)(5660300002)(52116002)(44832011)(66476007)(316002)(4326008)(1076003)(7416002)(7696005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CjGujctrlBtFCC6n0EIGMNUagXjpx0Heczn6tH9GbpVKh02NsDHen5ZjhSjW?= =?us-ascii?Q?PSIKeFAAEonpnLPu8fMFCyOMivPrZYOtv0+scL5zf+b4P8cIl56HHrE6Gk3T?= =?us-ascii?Q?NaHbXY0aTnicjg8X8odc1VIfuNINBmBpE3NZ1bWyQ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yT9b87LoWdSGC2rra7hf2HvrSFtjLCTWYgRFznEMWeDoLkN?= =?us-ascii?Q?4YEZp0bP2nzRUfeR6B8cDruzhF3JfAM3WHQUzLTnOTc+fZ+rZOAxf/+FiuxI?= =?us-ascii?Q?EYji6EgvZc6yxTY6nQavUVph8CGPzC2v8g4ZzSkY3Xm+Y1+cGbt6qo6GGdAl?= =?us-ascii?Q?JfitzRDMQNz9nl6774O8atDtr4p+eO8XMIMM5KIJtYoAAiELeXGqA24vfqAE?= =?us-ascii?Q?NZtfYVXOREv0exwy8YjphUGxsdO3WeTSSZdeCB2PxYprTD8Ybw2A3YIAV2wI?= =?us-ascii?Q?nhR+wPpdAyKoQySpK/JZYb4b?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0dcbb983-63ed-46ad-0b43-08d976e321bc X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 18:20:14.7370 (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: GPVxUCmcmxVw9ytWxFmX17T3STqIjs7J572qC7i4mKa6f/jNFL71ZlnazB8vsltrHdb2PkGy/nVnianEY5LJWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2512 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3275 The MpInitLib uses the ConfidentialComputingAttr PCD to determine whether AMD SEV is active so that it can use the VMGEXITs defined in the GHCB specification to create APs. Cc: Michael Roth Cc: Ray Ni Cc: Rahul Kumar Cc: Eric Dong Cc: James Bottomley Cc: Min Xu Cc: Jiewen Yao Cc: Tom Lendacky Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Erdem Aktas Cc: Gerd Hoffmann Suggested-by: Jiewen Yao Signed-off-by: Brijesh Singh --- OvmfPkg/PlatformPei/PlatformPei.inf | 1 + OvmfPkg/PlatformPei/AmdSev.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/Plat= formPei.inf index 67eb7aa7166b..233b9494f64b 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -106,6 +106,7 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuBootLogicalProcessorNumber gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled + gUefiCpuPkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr =20 [FixedPcd] gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c index 391e7bbb7dbd..5e2c891309d4 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -20,6 +20,7 @@ #include #include #include +#include =20 #include "Platform.h" =20 @@ -342,4 +343,18 @@ AmdSevInitialize ( // Check and perform SEV-ES initialization if required. // AmdSevEsInitialize (); + + // + // Set the Confidential computing attr PCD to communicate which SEV + // technology is active. + // + if (MemEncryptSevSnpIsEnabled ()) { + PcdStatus =3D PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrAmdS= evSnp); + } else if (MemEncryptSevEsIsEnabled ()) { + PcdStatus =3D PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrAmdS= evEs); + } else { + PcdStatus =3D PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrAmdS= ev); + } + ASSERT_RETURN_ERROR (PcdStatus); + } --=20 2.17.1