From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.78]) by mx.groups.io with SMTP id smtpd.web11.1343.1632163597867422363 for ; Mon, 20 Sep 2021 11:46:38 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=4EHZY02O; 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.223.78, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kjOJkTcDd+WpnEhuUtdmtKx01WyWqSRYNlIsE2QLq0YKzdgRt+rU6CmwHpk6IPVnIzgqG/1KSHbwS3kxtwnA7LNfTXRYtTPjiynYroIPHDnJ1VRlIvlXZLUFGz5gYMGGpXO4uN73DahhNGfvZs7T2ESO4y0VqzQoLU7lRKKkrZ40OtTsg76ZejbUmPE0Kd9l/TClfI8kzFvtObOt95Xn74RpvuuMVlaftwBXhghVeyaDTE0GoReuXlP/TEbNXs3K9Mz3Ibpkz3qf9uEdG1r3suGHwquk+cq8S/xeFDFCnaeb2i3OW7GIFyk6j9nusug8u4belbs0I7MfekEwMANVZw== 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=wOJEl/2BnNTzs6M6n1+jEHciKBiEz+XWQjIAGNFslTk=; b=CIDaXDo8rO0m5HBFLGnDxDNnknMJOZ0gX0X8/Ys5ejl3IpBmYq45hlX4mHC2/ZrUXrmGPcpOsmHWFXUiRabglkNSgIzBxr/wTa17t9EHkPa07SeBtbgpD27HjU01qflptW03cqGAvYefuMuQOdb9WUk9duU9eD3OvZyudbINb5zI07msNDm7ukbJw7mWKDyWVMZufpf7p3fHPSBst0yM9vWvUyDNaOQWDgKofip3RhPSafJ3t90PgpvrFGRnofZbJW84p3ZfnpGyofGRmA32i/uYWW4RUY5W0C5ZOY4/cI0CInq2m7oGWkGzvR6NJx/hGikqqFuzXYy1OTHBJ5ogng== 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=wOJEl/2BnNTzs6M6n1+jEHciKBiEz+XWQjIAGNFslTk=; b=4EHZY02OpjUdUKSVzLm9qy1vuLmKc/eVfpJVioAZPibvj8INaQtK1cPyxsyaijxByx+NVnp9i6AP0ry33yAaW5RKB+epbhgiZ8m22ifA3w5iE9NaC0JzjUA2YrBE/f5HikPmfxTnC6ZqfTgbRDOZ44SjSmJgTofLIqh72u6cCts= 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 SA0PR12MB4575.namprd12.prod.outlook.com (2603:10b6:806:73::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Mon, 20 Sep 2021 18:46:36 +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.4523.018; Mon, 20 Sep 2021 18:46:36 +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 v8 21/32] OvmfPkg/PlatformPei: set PcdConfidentialComputingAttr when SEV is active Date: Mon, 20 Sep 2021 13:45:53 -0500 Message-ID: <20210920184604.31590-22-brijesh.singh@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210920184604.31590-1-brijesh.singh@amd.com> References: <20210920184604.31590-1-brijesh.singh@amd.com> X-ClientProxiedBy: SN4PR0201CA0034.namprd02.prod.outlook.com (2603:10b6:803:2e::20) 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 SN4PR0201CA0034.namprd02.prod.outlook.com (2603:10b6:803:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Mon, 20 Sep 2021 18:46:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6edeb799-18b4-4dc1-af5b-08d97c66f961 X-MS-TrafficTypeDiagnostic: SA0PR12MB4575: 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: 55UkUbkC+i5D/fAxK9jjavZjgfnpMOeLuNhQbzcyH3yUrSU+97WZN8SHeaPtjlX6GbMn2cQNtfT5rPtMET1WoVEN9+IwubPbxAh1M0z26uS2hPYMclo58JfRyMATm5VHJNtilJ3Qw+z+ovpUZixu/7zm5K+M0jKY/z7aazEGMEvswfpajSj1SNyhIDypnkJLXLnxSrF2iyFcRw0NFwRuInET5AogLhhKcFkBTNCTmZncuDWc6mi4RqC7gjM8LRx7Q8LuccFaZNZV1KNIQL9zskVITaTbC5DNMt2R6gLpELivrynyC/9/2O4NFJOdtwZXqc398RK0yZwyT8+QTi+cvw/kRNW4zTGWJBsQBcoJtx5R1OtQVZO3d8v77ROFIb6eXk1f6rIfNevTrpsYYomALtVH7MSaiXOkp0ZDnDMCD3qu2UU1jVNZBANHFu98WZKwfDVo/S8EYkgp9x44u0v7BAf6o+9f0pypChGQrMaafU/WLC664VqZ/8qXO2cym/257Ibkhz9Q44Yrs0uokSJWbXHZJFlvhNb6L8odf3U3UHoA8WOjPV1QVDx+ZiKtLv34DpWmeQ3pQp02C8axX+ShA6zpjY5ao8uUg0lzLhwmdKzj9Q/1WJHD10VKFv7RJy8d2GGRE7D6gBmixiwU5wsmDHJsZuGFKRx4a7Cdm/EHdXFytaDaOhedxveQy3CwaK22RbcKOZzHB1hQQl0strsDDKxJVo6TUeIknSMnHq7L7lVqTnictKuCPt9asFqAT2ynPKQNLOM+l68ppT6OtCoTEQ== 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)(366004)(38350700002)(44832011)(5660300002)(36756003)(38100700002)(8936002)(66946007)(508600001)(6916009)(7696005)(52116002)(1076003)(6666004)(956004)(8676002)(186003)(54906003)(2616005)(7416002)(2906002)(6486002)(26005)(316002)(66556008)(66476007)(966005)(86362001)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Ii2gcsgmkXtpc/Lqp4mI90iS01whjIIAUPs8/e+wyaPpowwJIx9ekW/FrLSz?= =?us-ascii?Q?sN9O99gM7KlYqTJRD0eN5YhKy+DMIqcA5xhtR1DB7mN6mKVFgqtRMPBMmbZu?= =?us-ascii?Q?8DeItba3LPq4kFcXhV2pgvcLoMl/ITMnUkqYfnyd0W5WW2xQOKNpB1ISjn3t?= =?us-ascii?Q?lqKw7JUlzt92lPYxVCDPEW9EoMCzE224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TYegoI7f8BfiVPVjt2NwjYbhSEMVZjxRbLDHTbCNLiy?= =?us-ascii?Q?5h94yqr0agTTDbzQlwPcYtCJhaai42AMSgKbe/C0M/gdappdSBGwNDpNKttE?= =?us-ascii?Q?QjMyr/WmGN+XKRe+qWdO2GuexGOnVHh6JF6CI6paYEPSHllppgK89TGRQ8pI?= =?us-ascii?Q?sn8IZ/YXup4260enHiHGHKoiWaBwhZTa/N0qFYccMwycAJLulabUeW0wNyBc?= =?us-ascii?Q?dGyqZywwHsH05RKksR4yLL1R?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6edeb799-18b4-4dc1-af5b-08d97c66f961 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2021 18:46:36.4561 (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: hjyVIPV4KInQ4ZSU5edvik/QCWOUHRTtdbsDnj1LRxfIqryWPrCMpdmEhOgzab2ZnvXGSpcg3YiNDUSnsBV35g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4575 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.25.1