From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 447C5D80442 for ; Wed, 5 Jun 2024 18:55:09 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=yr8EaGwGYcXElNdRHjJf0HLN2Phvp1MgZZ/pAivG9bk=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From:In-Reply-To:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1717613709; v=1; b=44YxgmxWT7oNaLFYl7sP9zxs7fu21YpYGEvQxpNKmeV4qAp/hVoswYv/n7Yew48YMBGJSUT/ iT/pk/B1s49dMjVmkXQzwGREx3zvZ52XA8nKdN4W1dNgaU444EdiLRb0hszR/Y3ZpHhB1pgkTwE AbETVnBD3fJq7WJuN82RzIBChiAfROdT2VRGdBVgdowyt0/Tl/Ky12gjuw2lhrAUkj/be8Vs8k3 IPw4OZQeUTSrIkWeyImQatBuFb7cAbi7xmqMdsRv/weFYiRL2UDGyt9fD6hF+l6hkef+XZIazCt SjAWk4WTVPVJl73LUHTZCuiA2mmqhSP4Dc/NZz0zyC4WQ== X-Received: by 127.0.0.2 with SMTP id nZDRYY7687511xHP38UtDCUW; Wed, 05 Jun 2024 11:55:07 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.47]) by mx.groups.io with SMTP id smtpd.web11.2299.1717613701924993973 for ; Wed, 05 Jun 2024 11:55:02 -0700 X-Received: from BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) by LV2PR12MB5944.namprd12.prod.outlook.com (2603:10b6:408:14f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.31; Wed, 5 Jun 2024 18:54:59 +0000 X-Received: from BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::bf0:d462:345b:dc52]) by BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::bf0:d462:345b:dc52%7]) with mapi id 15.20.7633.021; Wed, 5 Jun 2024 18:54:59 +0000 Message-ID: Date: Wed, 5 Jun 2024 13:54:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [edk2-devel] [PATCH ovmf v4 5/5] OvmfPkf: Enable AMD SEV-ES DebugVirtualization To: Alexey Kardashevskiy , devel@edk2.groups.io Cc: Liming Gao , Michael D Kinney , Zhiguang Liu , Ard Biesheuvel , Erdem Aktas , Gerd Hoffmann , Jiewen Yao , Michael Roth , Min Xu References: <20240605020946.1224515-1-aik@amd.com> <20240605020946.1224515-6-aik@amd.com> From: "Lendacky, Thomas via groups.io" In-Reply-To: <20240605020946.1224515-6-aik@amd.com> X-ClientProxiedBy: SA1PR02CA0009.namprd02.prod.outlook.com (2603:10b6:806:2cf::14) To BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5732:EE_|LV2PR12MB5944:EE_ X-MS-Office365-Filtering-Correlation-Id: 17f4d76f-aa5c-4f3c-eb98-08dc8590ff6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?utf-8?B?R3liSldwUGtDUlZhVGw3NDNGcTVSRUZNRXQ1ZXFxZTBOcHcvUklTTUlDdXd2?= =?utf-8?B?UStxVkZvRXFad0FnUVZWcUp1OFhTRlV2dmE3amRwTUxnSUNSS2xWNjJyRTJh?= =?utf-8?B?NTVNM1R0V2dWSHp6bTROUm5KYTlOL3ErZCtvMktiNFJCVHZEU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TkJYNVJ2aVpsbHdWN3hnOWRhOU0vU1Q3QWc4Lzhs?= =?utf-8?B?U2ZJZ2g5dkl2c0JNR1BJWFlzcU5mR0pLdTdIUHh2aElsd0dkYnBNc01NbHBZ?= =?utf-8?B?Vld6SkEzelJ2TUF2WS9DdVF3VGEwU0RsLzF3aXNlYyt1N1NKNFdGaUI5UWhi?= =?utf-8?B?ekpHR0xVd2wwcENlYVJYcm9zT1FMamxiZEIzaEdDSlVTQUJBT0MrbVd2UlZ3?= =?utf-8?Q?GREg8UYh1lQdQ6ELIL0KbFpXA?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17f4d76f-aa5c-4f3c-eb98-08dc8590ff6d X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5732.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2024 18:54:58.9507 (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: T1J5rTwfE4J1GtvnMSqatMLFQ1+Y1IRGn9lXzjD16KG+3jEXiwnN4PzvUDJhw+AI4R+cmmdRq8xH66q7qLq4Ew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5944 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 05 Jun 2024 11:55:02 -0700 Resent-From: thomas.lendacky@amd.com Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Ho7ulmG0fnURr2OlZDWiBSG3x7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=44YxgmxW; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=pass (policy=none) header.from=groups.io On 6/4/24 21:09, Alexey Kardashevskiy wrote: > Write the feature bit into PcdConfidentialComputingGuestAttr > and enable DebugVirtualization in PEI, SEC, DXE. >=20 > Cc: Ard Biesheuvel > Cc: Erdem Aktas > Cc: Gerd Hoffmann > Cc: Jiewen Yao > Cc: Michael Roth > Cc: Min Xu > Cc: Tom Lendacky > Signed-off-by: Alexey Kardashevskiy Reviewed-by: Tom Lendacky > --- > Changes: > v4: > * s/DebugSwap/DebugVirtualization/g > * the feature is enabled here for all modes > --- > OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c | 6= +++++- > OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLibInternal.c | 6= +++++- > OvmfPkg/PlatformPei/AmdSev.c | 13= ++++++++++--- > 3 files changed, 20 insertions(+), 5 deletions(-) >=20 > diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInte= rnal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c > index 7d823ad639f4..f381b9255bb7 100644 > --- a/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c > +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c > @@ -154,5 +154,9 @@ MemEncryptSevEsDebugVirtualizationIsEnabled ( > VOID > ) > { > - return FALSE; > + MSR_SEV_STATUS_REGISTER Msr; > + > + Msr.Uint32 =3D InternalMemEncryptSevStatus (); > + > + return Msr.Bits.DebugVirtualization ? TRUE : FALSE; > } > diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLibInte= rnal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLibInternal.c > index 33a326ac1571..946bed2ada13 100644 > --- a/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLibInternal.c > +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLibInternal.c > @@ -154,7 +154,11 @@ MemEncryptSevEsDebugVirtualizationIsEnabled ( > VOID > ) > { > - return FALSE; > + MSR_SEV_STATUS_REGISTER Msr; > + > + Msr.Uint32 =3D InternalMemEncryptSevStatus (); > + > + return Msr.Bits.DebugVirtualization ? TRUE : FALSE; > } > =20 > /** > diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c > index 88ca14507f5e..8562787035db 100644 > --- a/OvmfPkg/PlatformPei/AmdSev.c > +++ b/OvmfPkg/PlatformPei/AmdSev.c > @@ -434,6 +434,7 @@ AmdSevInitialize ( > ) > { > UINT64 EncryptionMask; > + UINT64 CCGuestAttr; > RETURN_STATUS PcdStatus; > =20 > // > @@ -517,13 +518,19 @@ AmdSevInitialize ( > // technology is active. > // > if (MemEncryptSevSnpIsEnabled ()) { > - PcdStatus =3D PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrAm= dSevSnp); > + CCGuestAttr =3D CCAttrAmdSevSnp; > } else if (MemEncryptSevEsIsEnabled ()) { > - PcdStatus =3D PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrAm= dSevEs); > + CCGuestAttr =3D CCAttrAmdSevEs; > } else { > - PcdStatus =3D PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrAm= dSev); > + CCGuestAttr =3D CCAttrAmdSev; > } > =20 > + if (MemEncryptSevEsDebugVirtualizationIsEnabled ()) { > + CCGuestAttr |=3D CCAttrFeatureAmdSevEsDebugVirtualization; > + } > + > + PcdStatus =3D PcdSet64S (PcdConfidentialComputingGuestAttr, CCGuestAtt= r); > + > ASSERT_RETURN_ERROR (PcdStatus); > } > =20 -=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 (#119484): https://edk2.groups.io/g/devel/message/119484 Mute This Topic: https://groups.io/mt/106496092/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-