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.79]) by mx.groups.io with SMTP id smtpd.web10.13523.1574280462098361175 for ; Wed, 20 Nov 2019 12:07:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=BxvRAphu; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.76.79, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=leLJyttS+DP8rl/pmyUk6L87eLNiO1v8KJh7JFeaoKX9sp5jkIyP8+PNFR5uPFOLLDt7zXc6RXAIOlvkUO+7nH9vzp0DMaem/9C97RV6/PViPe6ARutRjilhw92mYOCdrLOVOKIrJ1KTIdTfKKCC2vRF3mYMBdVXEZeOAdStQKBEj/Fw1G8FoqwBGV+ZxHLFOKGQGB2YBg5QNAX99ZVhy1IbmTrdkhjWz+jVpqAVNJY3d+urixm6UZ/rZZ5y2tIK7KZvuk2LNuYqaCYb7r6bpncLw278sAd8eY2s3fqJ0Z6IGAH8/1HqKw8go7toZ7ymUtjFE4w5GpnRemkLnw8/bg== 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=viBpfUpahyw6ZACH9KpFSTK6YCa/3BRikoztcRL0mmc=; b=bcdjd6qI+QulX0TUf0/8Ev16SEr8pRFiJmbTmjI8tVOv4FDMNCqMRZ1jm6FWEPBBKYyHjXZJO6rqf83HFyGT94PdGyFCZYbG+Pr2xw9U75tIL8G7fUWISMxD1gi09PyH7UY8ggPAJixNkdRDLH3o0NOH5mdmTlWDAthCGZduBQWo43Z2+/xS3X1XkeTF/YBMN1Re+eqhSpM+00EeEZR5nSg5qoGW3g2V1t/nRGLhJCGJECccLMwIgnQIJhNuvFldrj5sRPAoJ/gu+vOGI1/atnEfH9+otP0kHxpPEyguXAZnDhOUZ2Ar92xNy2Pb0yUmP2o9fx3PgHM+dNoZbVjvPA== 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=viBpfUpahyw6ZACH9KpFSTK6YCa/3BRikoztcRL0mmc=; b=BxvRAphuyJe4xviNoCtuAn5pz1+gzu1o9zCpUFof3WYmErCK6Nv7AxiGGiVq8Vn1OVLBrNKvL28hkb4ooyzwBVDhQknB30QhtBoPRCfh26XsWrkVlA3wJ86TBCqzdnZucILLKKGYRpblVacLuGRWatq4ngYFUgNnaZ0jTOpVbd4= 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 DM6PR12MB3675.namprd12.prod.outlook.com (10.255.76.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.28; Wed, 20 Nov 2019 20:07:41 +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 20:07:41 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , Brijesh Singh Subject: [RFC PATCH v3 24/43] OvmfPkg: Add support to perform SEV-ES initialization Date: Wed, 20 Nov 2019 14:06:46 -0600 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM3PR12CA0087.namprd12.prod.outlook.com (2603:10b6:0:57::31) 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: 69ad73e9-279c-4b18-bbfd-08d76df54c3d X-MS-TrafficTypeDiagnostic: DM6PR12MB3675: X-MS-Exchange-PUrlCount: 1 X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-Forefront-PRVS: 02272225C5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(1496009)(4636009)(376002)(346002)(396003)(39860400002)(366004)(136003)(189003)(199004)(2361001)(50226002)(81156014)(81166006)(8676002)(2906002)(6486002)(99286004)(66476007)(486006)(47776003)(66556008)(25786009)(2616005)(476003)(54906003)(11346002)(118296001)(8936002)(316002)(2351001)(7736002)(305945005)(66066001)(6916009)(86362001)(16586007)(3846002)(6116002)(48376002)(14454004)(478600001)(966005)(5660300002)(66946007)(446003)(76176011)(36756003)(51416003)(6506007)(386003)(50466002)(52116002)(4326008)(6436002)(6306002)(6512007)(19627235002)(26005)(186003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3675;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A: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: UgSSLdkTyLN38fnXS09d6hQIpULNnS9vJO+iqLXLxdBHbnOf5S+be+Og0QX1twR/JFx7VlH2jr4TjVFP5myZuMxV+9pZf7e0We+AZAiV1y/3dVOh+AFLk8+W7sNvaI5qoYxBE6GTRqK8vCFVfRMH8v9Mdyy4aNc2flOjm6HaVJC1Lumca9LS7uCucCdiPOi9VTuF/rp8j789yjWoQ1WBRPZqS+QKe2coJ5lyf11M29NLKtP6ntvfjFczzo0rUKW0Eju7zUBl2FovSeg2QaZQh+ADclDSFC260lezX9NuAX00PyURdu0QHVPggdCaAhAj7jhLHKdHjeYOBPn2sMruZhS44ciISaqLdtGEMTqw17xRrftXA1Ryy+K9STb8sN1zjynYM/nZTssSV80LWBC/o7RiSyc1dpwqg424xVLNc/GNs/d/tT14vWGOvnxyN6CptA1q2ee4hNcNJ4SRRCc1YCZKo3Lb9K2D4lAaFfWxSiw= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69ad73e9-279c-4b18-bbfd-08d76df54c3d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2019 20:07:41.1542 (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: ecMHs2B/nC120AjyArOykQILuxoyPqM4NyA7NG1Fiz4cBHuE89Q5Y1doCSUVuKEAtivuDasCLkZcTJbTKrj9sw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3675 Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 When SEV-ES is enabled, then SEV is also enabled. Add support to the SEV initialization function to also check for SEV-ES being enabled, and if enabled, set the SEV-ES enabled PCD (PcdSevEsIsEnabled). Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Reviewed-by: Laszlo Ersek Signed-off-by: Tom Lendacky --- OvmfPkg/OvmfPkgIa32.dsc | 3 +++ OvmfPkg/OvmfPkgIa32X64.dsc | 3 +++ OvmfPkg/OvmfPkgX64.dsc | 3 +++ OvmfPkg/PlatformPei/PlatformPei.inf | 1 + OvmfPkg/PlatformPei/AmdSev.c | 26 ++++++++++++++++++++++++++ 5 files changed, 36 insertions(+) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 0e17de188cd6..d9dd2db52ea6 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -568,6 +568,9 @@ [PcdsDynamicDefault] # Set memory encryption mask gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 + # Set SEV-ES defaults + gEfiMdeModulePkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + !if $(SMM_REQUIRE) == TRUE gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8 gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01 diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index c8708c90f695..291cb6d1f603 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -580,6 +580,9 @@ [PcdsDynamicDefault] # Set memory encryption mask gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 + # Set SEV-ES defaults + gEfiMdeModulePkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + !if $(SMM_REQUIRE) == TRUE gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8 gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01 diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 85f817b86130..5990dab4f65e 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -579,6 +579,9 @@ [PcdsDynamicDefault] # Set memory encryption mask gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 + # Set SEV-ES defaults + gEfiMdeModulePkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + !if $(SMM_REQUIRE) == TRUE gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8 gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01 diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index d9fd9c8f05b3..031154389426 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -95,6 +95,7 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask + gEfiMdeModulePkgTokenSpaceGuid.PcdSevEsIsEnabled gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c index 2ae8126ccf8a..c12aea46d94e 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -19,6 +19,27 @@ #include "Platform.h" +/** + + Initialize SEV-ES support if running as an SEV-ES guest. + + **/ +STATIC +VOID +AmdSevEsInitialize ( + VOID + ) +{ + RETURN_STATUS PcdStatus; + + if (!MemEncryptSevEsIsEnabled ()) { + return; + } + + PcdStatus = PcdSetBoolS (PcdSevEsIsEnabled, TRUE); + ASSERT_RETURN_ERROR (PcdStatus); +} + /** Function checks if SEV support is available, if present then it sets @@ -89,4 +110,9 @@ AmdSevInitialize ( EfiBootServicesData // MemoryType ); } + + // + // Check and perform SEV-ES initialization if required. + // + AmdSevEsInitialize (); } -- 2.17.1