From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.65]) by mx.groups.io with SMTP id smtpd.web11.32398.1635170248521338051 for ; Mon, 25 Oct 2021 06:57:28 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=LUN3QIEC; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.243.65, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JlR+lFKBqI+i05wobfM733rEIT4/cumaBw1htdZjnwwqnK8PIS7r49ntssK7oUCcYmZQsI2rC3M/sLbyBXLZYTN4TSCTiExIqV6Gt9fZFWwjX9gm5pBUSzwe/hvPgrmYWIxIfL/uyEd2SQVfX8rhCVeB5buPBViGkZP5iZblqhjY5x0Z/Z1ZKdwSldlATzR1Xb0yY8IM4Nz9MUbr+3WBdoqn8EpH+wAhzOjEea1ByWdlENhGBVmxM64DmHOqohWzZlNIEYsORU/0eibcEEMQiAYtmvILum0Wau2y4jEZJxPxnHGL7UHgsXVobmyQd6z5Jzx8vWn+/e2DRGugue3fzA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MAqJcI4hIaJ7lme1EglB6HrFrruiIzJX8TXKjGa41+A=; b=duCr7qFk2zqR2zTIfbQx9km3jlw4DyGBXGsDGyhKzyYwMOBxLJNa5+UhW89l1LnIZ4UxejejDME7bq8uYsoxDr6xzsFXH9Yc2/m0DlERz57KP0jc6yic3/68CfXiVl8CtS1xzW6glVavDRQ94Pp1wGkrw6qMGnuXjNA/JN8QvyIx05LX6OjciCfWcZ/m4GQ4yLrOVtctvMhbEQrht02zZp4We+i9JPO8z4EaWecQ1VADF1+jSqcKRL/j+Z7q62fyKC279gXHkPX9PP/V+BOAFItStzUPjNdpCo/yNClgzdq3F9WAjoJhfy7SCe/7NbbmPH7cbjEoaYhbadIImlqXoA== 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=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MAqJcI4hIaJ7lme1EglB6HrFrruiIzJX8TXKjGa41+A=; b=LUN3QIEC2TCRIfgZP3PKf1nC/VhdZTUOV4VQidI8N3b/eNAJPNFShzamiNwou7dHUV7/d9XtMq5EJqKks+Dz7RlG5gRpBgol29XvxlJGGekrk1C/XsGDIHwZ2eT0wNm8CpgEga0j1c3LszFvpVz8+ybKFXdmlPe/8wB3RTxhIDE= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SN6PR12MB2829.namprd12.prod.outlook.com (2603:10b6:805:e8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Mon, 25 Oct 2021 13:57:26 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::e4da:b3ea:a3ec:761c]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::e4da:b3ea:a3ec:761c%7]) with mapi id 15.20.4628.020; Mon, 25 Oct 2021 13:57:26 +0000 Message-ID: <0ed19973-d8fe-ef09-d5dc-a612ad84fc16@amd.com> Date: Mon, 25 Oct 2021 08:57:20 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 CC: brijesh.singh@amd.com, James Bottomley , "Yao, Jiewen" , Tom Lendacky , "Justen, Jordan L" , Ard Biesheuvel , Erdem Aktas , Michael Roth , Gerd Hoffmann , "Ni, Ray" , "Kumar, Rahul1" , "Dong, Eric" Subject: Re: [edk2-devel] [PATCH v11 20/32] UefiCpuPkg: Define ConfidentialComputingGuestAttr To: "Xu, Min M" , "devel@edk2.groups.io" References: <20211023041349.1263726-1-brijesh.singh@amd.com> <20211023041349.1263726-21-brijesh.singh@amd.com> From: "Brijesh Singh" In-Reply-To: X-ClientProxiedBy: MN2PR19CA0002.namprd19.prod.outlook.com (2603:10b6:208:178::15) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) Return-Path: brijesh.singh@amd.com MIME-Version: 1.0 Received: from [172.31.9.168] (165.204.77.11) by MN2PR19CA0002.namprd19.prod.outlook.com (2603:10b6:208:178::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Mon, 25 Oct 2021 13:57:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad070371-be8c-464b-6a70-08d997bf6040 X-MS-TrafficTypeDiagnostic: SN6PR12MB2829: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QQGaZOMVaPo0x5+P+vXfabQYbTNtTcY7uXu7OS9zvSBkv5euWPWmAPfREEVPpxqeYqiYyPqiM0oYNT0adPuJQ4wD13vnOfR2RWPLT99ISyRRenMTWXjNk9dI3iuflgTgNLq/1uvGfn66snhCFt5X3lA8hrvTl4HJaMe+T6vMcQI9CyUiBuu5fcZb/xfx6ODy3lwAqaUCjD9bnMclU2nX3wFSvVxQ4BA3ZkNwgYZ2ztVbdXvvoO+973T9NM8adEzJIdN6rPmzaYYhf8lJEVaIZsIBHX3oQrRj888nwzkB4aYkyxbKlsOieEQZwlZyzNTyqS/395N6WJ7cqt7jGdwQTjDET3J8qVlTHNQjlt9auSRQsHaHnveifEB4YbBmQ+WKkYJ5iW6AUIxUTXQ55sDa52cnDDuWNho24ywuCP+GhljjHVnHm3XDt9c6fB1k32B85d1j8lSfVDxo2F8eAkwTVNN3IkqrcwfkOPfZx2s+Abb729TuOD6ZrFsLnm4GWov48fk/UKwaigpBZUgFpnTDUwBt8cNFQi74uowIYtZaX07wXgKf+iYEDxnKdLYVXBG8Wqhk6kGiryazCSoiRQKorTINld0CiJJDHVjjLcW1Q8CRltBrxJ4mF5UEZoXE7Jx2m5Hb4tmouTXRu4iY0T8GhdjoiATlMj+AEBVHf3Hcin8tO2gdVid5SVoTECFogU+y32myPWDRgoAFDr9gdiEryrcl86DOXj4b59mJ9LidQZxpNbSV5hnCmRSYEo8z/70KCJjR4Hpt99PvPMMp05WrJg0SjvbTOprhGybT/r6Bo02C6PWa0MNlehqpXMXj0Ivc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(2906002)(110136005)(5660300002)(16576012)(66556008)(45080400002)(66946007)(31686004)(8936002)(44832011)(54906003)(186003)(83380400001)(956004)(38100700002)(31696002)(66476007)(36756003)(508600001)(8676002)(2616005)(53546011)(86362001)(7416002)(6486002)(26005)(966005)(316002)(4326008)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?R40djbZIlB5w+UwZbNG0RxRE1xQZ48C2+RHDz2AUYJgOReczf/CooQPpoWeL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DUttmtz0uzm3dz1G2okyJR?= =?us-ascii?Q?c60GA8Jl1yG0q9CWgHlhS6HhRhyUZR8qND8OGvpfFwD1GN0B3eFtbeYUmChv?= =?us-ascii?Q?Chh+m6/dYC2bfy+9mMSOg1T6X5vLqu9eBcLdfQ7kue4K0knjJu6EZdRXxLXM?= =?us-ascii?Q?55jAl2ecFGLEqfcuS8+IOUQjUARYD5DDhK+xrPNM71afMnhDflv6DQxJZ8A4?= =?us-ascii?Q?nO+H2nE9OA+zvfG2Al4loXJQ3G8QLjLlbnnevEVj8K6pzNkD69spWZlRPL5H?= =?us-ascii?Q?UuOVMnxQaPOuZ7/2h39+OOwlUWD2Y6xKN/TaFvchKVXoVk2rzOFgpJLRo0s7?= =?us-ascii?Q?T/oq96crtaNoFlOMAM79NZVQsNYkOul6AljujA/I3GTfSSKMB+sttXUv5/yT?= =?us-ascii?Q?sWNBd9K4mHiD0apI2gY0k4Cp6cDnsznhudzPqt/tmMocPJOJUuz/9A5E0Itd?= =?us-ascii?Q?wqePpqS4AYIxs3Yxjn3eg+TEyIBdTHezLw53yLH1RYuVqK+U1RJyuf2m0KKl?= =?us-ascii?Q?aqDjbJTkh4CaraHJz2hKovu286y+bhM1vR17dKQsGj3ZXvAPBoqicVhUcm7d?= =?us-ascii?Q?Ud+1TmLTdRKnJxfiw0xuLq+0/79VMXJQS39cBodk7Nm0IWnldoYz0C2evQQQ?= =?us-ascii?Q?msXxKNNcZHKpVdsoVnGyK/VArF59hfynR2+m09mqiTjF84sjRzgACG1K5/aF?= =?us-ascii?Q?b2wp7ITrsS0dN1j8wEBM8Fs=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad070371-be8c-464b-6a70-08d997bf6040 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 13:57:26.0556 (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: 6ffj6A9gduC5nTXG7uBgfRbA16gVK/4R4bmq+gYyLDFbmgRO9hiN8/PiRCAgbJISOxNf2jjhd807ScQswcCbJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2829 Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 10/25/21 2:22 AM, Xu, Min M wrote: > On October 23, 2021 12:14 PM, Brijesh Singh wrote: >> BZ: https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2F= bugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3275&data=3D04%7C01%7Cbrij= esh.singh%40amd.com%7C96cac3cfbb5b4eec64a808d997883593%7C3dd8961fe4884e608e= 11a82d994e183d%7C0%7C0%7C637707433532691196%7CUnknown%7CTWFpbGZsb3d8eyJWIjo= iMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdat= a=3DJuBNNapc9%2B9xbbiCXbWKy4rYSzO%2BnYeLZ6cmxF7FNwo%3D&reserved=3D0 >> >> While initializing APs, the MpInitLib may need to know whether the guest= is >> running with active AMD SEV or Intel TDX memory encryption. >> >> Add a new ConfidentialComputingGuestAttr PCD that can be used to query t= he >> memory encryption attribute. >> >> --- >> MdePkg/MdePkg.dec | 4 +++ >> .../Include/ConfidentialComputingGuestAttr.h | 25 +++++++++++++++++++ >> 2 files changed, 29 insertions(+) >> create mode 100644 MdePkg/Include/ConfidentialComputingGuestAttr.h >> >> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index >> 8b18415b107a..cd903c35d2ff 100644 >> --- a/MdePkg/MdePkg.dec >> +++ b/MdePkg/MdePkg.dec >> @@ -2396,5 +2396,9 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, >> PcdsDynamic, PcdsDynamicEx] >> # @Prompt FSB Clock. >> gEfiMdePkgTokenSpaceGuid.PcdFSBClock|200000000|UINT32|0x0000000c >> >> + ## This dynamic PCD indicates the memory encryption attribute of the = guest. >> + # @Prompt Memory encryption attribute >> + >> gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0|UINT64|0x >> + 0000002e >> + > This PCD is defined in MdePkg, but the title is " UefiCpuPkg: Define Conf= identialComputingGuestAttr". A typo ? Yes, initially I defined in UefiCpuPkg but later based on the feedback moved to MdePkg but missed updating the header. > > BTW, can you add below macro in the ConfidentialComputingGuestAttr.h, suc= h as: > #define CC_GUEST_IS_TDX(x) ((x) =3D=3D CCAttrIntelTdx) > #define CC_GUEST_IS_SEV(x) ((x) =3D=3D CCAttrAmdSev || (x) =3D=3D CCAtt= rAmdSevEs || (x) =3D=3D CCAttrAmdSevSnp) For SEV case, we need to distinguish between the ES and SNP, so above macro does not help. Patch#22 adds a ConfidentialComputingGuesthas() that does a comprehensive check for the SEV.=C2=A0=C2=A0 For TDX, if you fi= nd that other modules or libraries need to use this PCD check then you can move it to a common header or library. > > Thanks. > Min