From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web11.482.1587577364342410896 for ; Wed, 22 Apr 2020 10:42:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=zGo4LrVx; spf=none, err=SPF record not found (domain: amd.com, ip: , mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WIvzemQYlsVCemAPj2Hrdb2aAwvAs8UQjqn/chlR0IGcofYef6SqWlFFkZ0N+bXab6EKVS7Hl1tgYQQBZ8MjPXBl8hVU5PbKUt8PjzhS6neQxbz4CiuGrnvOEMSZzFaAWjoktaZJkwImo/54u6GfckV/P47/t+ePtJOOgJGm8T4dCra0CTv6jKJ+tWavoL9T7aELnkLWvPvNJku0+xRqnwupG3EVs+kBxrzWiKvRAUecWsZJILPBBgKu6Umc11BTGgZq8YmCrkmBWeR0UQEJ+/8Sb2VSZuD4gGDAU68rolD7/mElWTEdjs3/9oCD7ugG0+0wj5Ol5KOi+xDVC9Op9A== 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=/wS9scjZPoqMGGwdw6KykXvXaS2dhk2mR/4Gsa0Xt3w=; b=AdaJwJWathCMPkuIgx+LjjMq/Vsfh6h0NjNhJQP3bwdRhvgn4wKNmXvUmkMISJ0lK5M7shH3iIt3aU2Qoz2s6Y8xm7TTHjOggmdWIlsla2P2yig9JZTTiv1Q06rU+5rvOObsByc4g+oHL/T3FR7gtB+a+EDaQ9l0jrW6ktyDTuFgA4hD8OfV8ZK6dcoF041z3xki9kGeZuQpzdL3jCwKUXsOV7VlWdxp1V0nhIrZDlUIwsCMc0S2LcT4dOpCLJdFQm69V7OckJDIPqtdPSmzFEHyObwXKdcgtPDAlgwCI+wfCCYoP0XLj05AU22I+R8VCIE3gbBbBt8zkCTnckHlSA== 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=/wS9scjZPoqMGGwdw6KykXvXaS2dhk2mR/4Gsa0Xt3w=; b=zGo4LrVxY7ulRsUEh554Q5hoUOxFAq+0JS26BZqyFx+b4r0tg0ab/7seuRvRUV9kI7lrcw9Ly8e6u4Hw8Q7A0DsjPfLS7nhytf9+P7j0QY+X+1/eu1oYEiHsRW5rS1diTneGGDHQjMyiRMAAhPTdMFSuQz2H7tXxr+NHbZ6vk8c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) by DM6PR12MB3673.namprd12.prod.outlook.com (2603:10b6:5:1c5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Wed, 22 Apr 2020 17:42:43 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::9ae:cb95:c925:d5bf]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::9ae:cb95:c925:d5bf%4]) with mapi id 15.20.2921.030; Wed, 22 Apr 2020 17:42:43 +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: [PATCH v7 27/43] OvmfPkg: Add support to perform SEV-ES initialization Date: Wed, 22 Apr 2020 12:41:42 -0500 Message-Id: <552f6ae16398e57b81a3e1e81ed362dcceca5b23.1587577317.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM5PR04CA0060.namprd04.prod.outlook.com (2603:10b6:3:ef::22) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by DM5PR04CA0060.namprd04.prod.outlook.com (2603:10b6:3:ef::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Wed, 22 Apr 2020 17:42:42 +0000 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: 2fc94df7-a074-4c8e-6892-08d7e6e48fbc X-MS-TrafficTypeDiagnostic: DM6PR12MB3673:|DM6PR12MB3673: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-Forefront-PRVS: 03818C953D X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10009020)(4636009)(346002)(136003)(396003)(366004)(39860400002)(376002)(16526019)(186003)(8936002)(8676002)(956004)(4326008)(316002)(6916009)(86362001)(2616005)(36756003)(26005)(52116002)(7696005)(5660300002)(19627235002)(2906002)(478600001)(81156014)(966005)(66556008)(66946007)(66476007)(6486002)(54906003)(136400200001);DIR:OUT;SFP:1101; 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: KNK/uYz2IX3lmBIODyVa/DZLJCma1aWupJ9GpV6rJHxpOfyzMnqcYhokDJGarxn3nhGUCjSsLSfpVWP4MGFznynK3qpYJhHVvuzMHG/iUhAdbgpzJP5zdu+ctFDHBd/1ZWGbrpPpCXTCnL4PdsA+662LCZtQzlR8/fYp32dJ2B9ygNNMH6ba5EkE9TJ3Datfj9AYKawv45Y4j/p1VIGFHfTgr7hA4/GlGOfgRpcfJItN/jeWYR9pELgWbRwEABPDTmIa0o7PX7/yHgj21EiHL27NxtfeHzLKnGNabZExe8nU2PwqJhtaOjqsuWYWTOwKYZQJ5LYUruEURoEPpAk1WG+e6t82HmhiaAgGfM2WfYtJck9HFxEL7acNYjEizCRVOJ7eeep5bUGpxeX8zNQxK26qBpuSf7NQZDn1NGaEb3DR1cuvvopidte3zMTZh7ZIiaUiRK6vqj1F03m0ihbFTee7039a+uaHHQJSH21mPg5oqNAitVlmmS9GNog4T/UEVgAzH9ftorXg8yCbQW3pS3z39zxh201VlyTeAystTpVLOSDJCltMDVDo3ABM1Oli8G79Qo6nGdLymQL1dJ9VnA== X-MS-Exchange-AntiSpam-MessageData: Cl3BXHNhsOm0FQ+ZXnDIGXSZMqo1lMGPqfj41tucWe2rzBstDyYSXhyUCBfcFpqqoSHoDo14qiTL+D6Pan4gZH6PUWqn6Yteb5DJn/QUYeO2KCQTXz5XUf8Vf43blSXpDOsgKqrMTgKk+pa8bjn4VA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fc94df7-a074-4c8e-6892-08d7e6e48fbc X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2020 17:42:43.6165 (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: x00lcS0+Dvy5leUdg/6+Sr3TWiPiAlHudMFYGXW9PMa7l+3/6yn9MJiPqqE4WpiNzAj8bA6nrpWN8yTxRM84Qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3673 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 65d87d4482eb..95423942101f 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -586,6 +586,9 @@ [PcdsDynamicDefault] # Set memory encryption mask gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 + # Set SEV-ES defaults + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + !if $(SMM_REQUIRE) == TRUE gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8 gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase|FALSE diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 683f8c578741..37bbf2073494 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -597,6 +597,9 @@ [PcdsDynamicDefault] # Set memory encryption mask gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 + # Set SEV-ES defaults + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + !if $(SMM_REQUIRE) == TRUE gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8 gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase|FALSE diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 802caea63a8c..5248e6fd92a8 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -596,6 +596,9 @@ [PcdsDynamicDefault] # Set memory encryption mask gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 + # Set SEV-ES defaults + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + !if $(SMM_REQUIRE) == TRUE gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8 gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase|FALSE diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index 19f2424981bc..c90b5f7ae200 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -101,6 +101,7 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber gUefiCpuPkgTokenSpaceGuid.PcdCpuBootLogicalProcessorNumber gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled [FixedPcd] gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c index e484f4b311fe..4dc5340caa7a 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -21,6 +21,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 @@ -103,4 +124,9 @@ AmdSevInitialize ( ); } } + + // + // Check and perform SEV-ES initialization if required. + // + AmdSevEsInitialize (); } -- 2.17.1