From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.62]) by mx.groups.io with SMTP id smtpd.web12.1299.1585071697580759417 for ; Tue, 24 Mar 2020 10:41:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=DaoiIPb/; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.244.62, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=asXsBzmx+Bjy7nc49WOVnAzGhqkCwIVdoYGinLAxjKpoZF+mvtD/IGobKkfdd3vzwmIJJ2CiDAahdz/4iRuyiPmcqOiipd+kvV0mGYyx/6FnFhY3k5LryM3FPD/2r/vf7APJQ0XCOujGC44eZhnJy1KFatXs/3bhPCAkwUZlV6pfYpFEh+NB/5XXU4bVY6rcotqUr7uABHBKod+QTNuqWjjO18WeguCIVOQQa4IUZYycV9Zn8d7pEyQFM+p70sZdoiU6CThHy7u/sSJ/1z9sY0o0cz0VpEbLWTTdIXvmG5SSeoltxA5p7yNu9OeoXVNrmtYYkgMaeFV/q9i7vGQm0g== 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=/UzEP04DDoN0R+SM/jWFJxRConPuy9k1JHU4kNsVv1s=; b=ae486hvdIcJBuvbMu7rtjmx9ZVNqePj6z/5tjhJARkXe5btJjnV7UCrJxXDv8bzYZ075UdZHGdcAe77W91yLRw8X44NC8dveiAgEUT41UqiVUeJ4tDXw4PDxDnlKgmCfE8nuNbX2rh9LlpFN16owIoZ4PPOe7ruv65hZ76LY7tjw1/XDtm1L9jPZZIHFCWxMmbc6W3cufvpdrXxfwB+hpnzeR9wfrrFcdNEdM65+N8juoQMaAvp/A395H/7Ndpb7nNxoGLsO2V303XmIsARkijrUP0HeXWHbdBbGSXmAxUgpTParJe/oBLYQqQ8/oyEK2TF7oVv6Glh+mu1D5x6Cbg== 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=/UzEP04DDoN0R+SM/jWFJxRConPuy9k1JHU4kNsVv1s=; b=DaoiIPb/Zm1FMa4Y0/8aJMilwl8fZdXBEHmTvyV/UsdKYeYjK9lWQIeboVrwVExl6HAKDkY0MPM60zvPP3FBXLHlTtiZzc+k9ham0U+1q6tCk50WlnULr9WEQdd5geoxd+teKTw4hX/c5VKA8IQNlLtYMZF1VmcFePIcph1xrsc= 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 DM6PR12MB4027.namprd12.prod.outlook.com (2603:10b6:5:148::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.20; Tue, 24 Mar 2020 17:41:35 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733%7]) with mapi id 15.20.2835.023; Tue, 24 Mar 2020 17:41:35 +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 v6 26/42] OvmfPkg: Add support to perform SEV-ES initialization Date: Tue, 24 Mar 2020 12:40:40 -0500 Message-Id: <704c01ad1d3dc778963695257518c2be60b7724e.1585071656.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM5PR06CA0025.namprd06.prod.outlook.com (2603:10b6:3:5d::11) 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 DM5PR06CA0025.namprd06.prod.outlook.com (2603:10b6:3:5d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.19 via Frontend Transport; Tue, 24 Mar 2020 17:41:34 +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: 16b48f88-0c03-46ee-ed2b-08d7d01a98e9 X-MS-TrafficTypeDiagnostic: DM6PR12MB4027:|DM6PR12MB4027: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-Forefront-PRVS: 03524FBD26 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(376002)(396003)(346002)(136003)(39860400002)(2906002)(956004)(6666004)(2616005)(5660300002)(8676002)(19627235002)(6916009)(8936002)(966005)(81156014)(478600001)(81166006)(316002)(36756003)(86362001)(54906003)(52116002)(186003)(6486002)(16526019)(66556008)(66946007)(4326008)(26005)(66476007)(7696005)(136400200001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB4027;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords; 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: pUH8l96awWXO89vIj1sikUHbsv1knCg9/xfhdQVX3ARATNZolkcCmxb4OGYYb96LB0fm0yc8GPH+ot0N7ZXbJPlGp49d2jtfIVGXh4Xl1Pk46QZRKM4RWyq3IL0xa+IZE1tdQoo2LEcTq1obsT+snTrG42AzM185b7/gmY+wBmFDBcAT/n+/oIuM9Ioa5DkhuZ2Sf6ZssHmJMSNg+dCuaiP+5dWYL+xdqKcJ+SdO6SLMQo5rvWZ9DGlOpHrVq2I6V/2F5dvFImGXatzdERctwP14RPxQG52GM6/LTrDafjjZlVltBKhkXrLUUR0xOO/ZP/cYMt+v87wt5ssatVp+z6aEq86EUHR/BFC8F/7soxqhLgleqDy2iAV/WdvwI0NYoTN1eMOQj/bpmy3toc2Qfp1/ajwUsLD47REGSkLtuX2mKQprmTeqzJL//mQv/lNZkMAluXYvWrWPcHN6iQ6wyuXwz/V2LHWXn9rIwYVF1zRDHrWrtLQ/UzzMNvmnDlOiGUHmojA/R2OxcnG37Ag0WBg8l2pH5Zwn6/WZL4kRXHuv6O++WCGgUv31qqujZYzlUgwDBdTdwFmC3T47+CW2+g== X-MS-Exchange-AntiSpam-MessageData: 3Ql9CI1jSA0C7UCyBNB7cIsthkIIk7MSW3z7XuxTmaTcsOKysvlpkAQrF84Rp0LvInF4s59ySvHdNWa7U1e2LSq9monMmilxGqBJx3Y44Ya4gfrtwTLS7c4mQPiscQZvtRnnpV6qW+J6emUC64nlWw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16b48f88-0c03-46ee-ed2b-08d7d01a98e9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2020 17:41:35.1687 (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: 6i+JBuI+9JFK3Lezgvn0afv2MG+wO0ejQfGW+l/T102zctCXvhGlLpWYlzEIMSkmiHjPv4YgjXt3hEADcwLx6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4027 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 2701630be8f0..d6bb1f6e795c 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -580,6 +580,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 671fdfbbd47d..78d2107846a0 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -591,6 +591,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 5abf83e05480..65dd4c612073 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -590,6 +590,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 8531c63995c1..19fc6002cadb 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -102,6 +102,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