From nobody Tue Nov 26 00:58:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+63870+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+63870+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 159682941474836.86580959384037; Fri, 7 Aug 2020 12:43:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 1JpgYY1788612xRDq7BR5sAT; Fri, 07 Aug 2020 12:43:34 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.59]) by mx.groups.io with SMTP id smtpd.web11.4273.1596829413417679354 for ; Fri, 07 Aug 2020 12:43:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kO/eoE2acnbCFEOyllrEifsVgSBxEIc44bKlJLM6HSA5WjlTLxd1SHTSSfwnKAmKs1z9qzTMJBiq8glaf+aONIlRpjldwxr9T7QQJP6T8iwBSsbfzsYgIEXcjaSPGbgDLAAEXNlT9zyHkBhKfyjc/0M4llhDoZbQ5ZEnpBA0tWh9saoUS44t8VlBXD/OFT7O+xKDMEN13u4G2QwZEToNthijyht4340bPcnAGz62eeRxnygvrfrvxV2AWTxeJMDf0PNzkHgb/6ZfVFipb0Yy+oNAPWioWdQg46hbkdD6q0lKzxpKh8ORWqTtQxd1k/BUdGSVsZMzEidew0CpumZu0w== 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=tpMCGKkJ/vd5g9S5fco/aQoufjhaVtd6vFQYZt6tvPo=; b=TI6g/eWY0jGBBNuTgFPmkbiX1GxAW3a1PW1IYRGge7q+u1x52JErFFHRYRHom01puho+4PGP27x//gvrgLuORYWNzgSllv1a1VsmkrrQoS3T+tFq3Vo8dwcVy4Wvg3S0dGdTCiGbzODg77PIDg6OEH78H1EXalE/0ApLIGFwOg+ZKRUFv+dvOajROsG5A518bftt8ljeMKglfLaNtq7hWZetaDl9QJIDwHq8FZRop7aJaVJUhnG5Pj89oYQd5tKp22IJMnWsBK3i2K3sJ+omtmOwYR771t1u2tgOgveiRDYi0minPMoKHUTFOhf8hezX2/4HzM4gE33XngXMA3Xurw== 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 X-Received: from CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) by CY4PR12MB1798.namprd12.prod.outlook.com (2603:10b6:903:11a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.19; Fri, 7 Aug 2020 19:43:32 +0000 X-Received: from CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b]) by CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b%5]) with mapi id 15.20.3239.024; Fri, 7 Aug 2020 19:43:32 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Ard Biesheuvel , Eric Dong , Jordan Justen , Laszlo Ersek , Liming Gao , Michael D Kinney , Ray Ni Subject: [edk2-devel] [PATCH v14 28/46] OvmfPkg: Add support to perform SEV-ES initialization Date: Fri, 7 Aug 2020 14:39:13 -0500 Message-ID: In-Reply-To: References: X-ClientProxiedBy: SN4PR0801CA0008.namprd08.prod.outlook.com (2603:10b6:803:29::18) To CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from tlendack-t1.amd.com (165.204.77.1) by SN4PR0801CA0008.namprd08.prod.outlook.com (2603:10b6:803:29::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.20 via Frontend Transport; Fri, 7 Aug 2020 19:43:30 +0000 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8137ddba-476b-4d0a-2a92-08d83b0a2a34 X-MS-TrafficTypeDiagnostic: CY4PR12MB1798: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: W4dvaDlOR36J3iU9gmFCgPNKlrDbvrIphQaMFeDwT1wsVXXkz6DaxTKFlKfIjE3GnK2S34I55ylirD7Y+sK8VMDCPg67G74TW7ILp0PQUwxAOANMI2mBZXdGZ5nzH7elIJFNA6yVLYqGGiwS4QxMvDXQxwYMYWSYlXR5J6z7Jez0OIeFDfD2m7Dmgj/yIseWYQ6qOCnrzbPASVDyac/c74Ox/MrRDRPVnMFYROneWZsdB6CULX6ySDrPuBZwfr5daK3hgpSfBKzsnCMD2HOudJHx22FiGm31JikkFiFJWOFo2RMKPm4lDcDnHdW1d/CpeyModvpALA2d3rOHR7yXbxh8ZMHXKAnWpE5zljdyobzRBRQgQp1xQmUnPa5sc1yuN5I04F7UZysN36D+zrxhEWTZazlwmwGPxIryI9Cxv/szlFxLeLRakQ7qhLh1ggHYS08E9r9+1T0M1Nm8enwoxw== X-MS-Exchange-AntiSpam-MessageData: p44qzkq650HbA3pG60ftY4GmRNevynUxA4oTghmfz/Z3LoYLAT6vCdKwMJ5kH10PyjhbS+YFbq0aPGC4KBsO7UXj0BaGVHI9ysVveVX4yy4bwEYY2FW822TgAqcmpXdamwiOcE5P1nCvoxknT4wVRUEm1YwEUKgEfX51XSqIU+GcE9RyvsC/Kqbxi1ECPfw4++dq3vF/MFiQokUVNsJzNxJSnx5gxoomdHPIt4OiQc74/9CA8l3R7MO2NxBfhFWYr1KzzKcbFuHRExVFzNHqDIN3dbbiY8h4x8sDH4af3+z80NAqjVrv8R505lhOi/AD113h4t6wbJJrsVvWSfX50c6biM1j0+GaXkiIO3H9POky4FPDWPIfwxpu1Jy4D9x2CQ2r7AoNKdOIuxZFimk/wUK2PpQE6sdou1GfjogRdwByLqHoy2ivSS2FIvY+9EYGmwjQdMaaWCVI534v+I+bsjmeX4thlGgpQn6Pn4eHkehIbUaiAQ8BWVTLKga4X1FLk6b2tA6SKPlQir0x/tXfDnkY8nz7YUCK6AdHLHeR7Dc0Lq/lv6Ky6pO0V84fHkJe1qDOtYLoUo4CFh9TFHpF25Up1fY2Vnk6y9IRBQWuklNqoqafaPD4ELBsFNfNq4i3qkIszvw5VfhvjuhqN2znPQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8137ddba-476b-4d0a-2a92-08d83b0a2a34 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1352.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 19:43:31.9207 (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: XQ2SdVob50zr4J+gAvfAn5XbI07frcl6fgeiPfsH8JjW1ySK6I3VjLwTli/hNdetcnRnL0+nUqCRsQyrCUx42g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1798 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com X-Gm-Message-State: CtpBIzqg2gq23X42aWpgQ3iSx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1596829414; bh=3LJPRAikNdfIzcQiHOU7bajKFjO8YrMHIK2K4cRtmrA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=F6t1IwwYsj4flofcoAdWGbCgXcQ9Ypr15jRR7FlcBHdi+u2pC1NnBgMxXjkUaXkSXLl Vs/bgWqo8GsC/p8shx1Hwz1woeA0AFvJTD1cZnr8WMEUIORrgMBqw0mjqwrh71ClRW2wu VpKKtqGNbX9F6Sw7YZA0JlEPvyk6WeFzsS8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 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 c57bba1ba197..f84f23f250ef 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -607,6 +607,9 @@ [PcdsDynamicDefault] # Set memory encryption mask gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 =20 + # Set SEV-ES defaults + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + !if $(SMM_REQUIRE) =3D=3D TRUE gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8 gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase|FALSE diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 22e930b12b9b..a66abccf8266 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -619,6 +619,9 @@ [PcdsDynamicDefault] # Set memory encryption mask gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 =20 + # Set SEV-ES defaults + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + !if $(SMM_REQUIRE) =3D=3D TRUE gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8 gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase|FALSE diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 60be5eae3d2b..2a8975fd3d29 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -617,6 +617,9 @@ [PcdsDynamicDefault] # Set memory encryption mask gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0 =20 + # Set SEV-ES defaults + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled|0 + !if $(SMM_REQUIRE) =3D=3D TRUE gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8 gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase|FALSE diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/Plat= formPei.inf index ff397b3ee9d7..00feb96c9308 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -103,6 +103,7 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber gUefiCpuPkgTokenSpaceGuid.PcdCpuBootLogicalProcessorNumber gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize + gUefiCpuPkgTokenSpaceGuid.PcdSevEsIsEnabled =20 [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 @@ =20 #include "Platform.h" =20 +/** + + Initialize SEV-ES support if running as an SEV-ES guest. + + **/ +STATIC +VOID +AmdSevEsInitialize ( + VOID + ) +{ + RETURN_STATUS PcdStatus; + + if (!MemEncryptSevEsIsEnabled ()) { + return; + } + + PcdStatus =3D PcdSetBoolS (PcdSevEsIsEnabled, TRUE); + ASSERT_RETURN_ERROR (PcdStatus); +} + /** =20 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 (); } --=20 2.27.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63870): https://edk2.groups.io/g/devel/message/63870 Mute This Topic: https://groups.io/mt/76056559/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-