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 E379B740041 for ; Thu, 2 May 2024 14:36:29 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=j+/0gHHaGG9x06gMyBKT52azVCJrevuuLnGMmT3sUEE=; c=relaxed/simple; d=groups.io; h=Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: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-Transfer-Encoding:Content-Type; s=20240206; t=1714660588; v=1; b=xRaPW7+GDSbxQ9ZByZyc+jKZXjH722tCq+SvHJiX1SHu2hm28T/FA1qShTSZ4E0qs4smZ20K /L/2TKewBDwjuGp6Dd2b35mIh7+5y+Fxc28EDDID8sTMndQ+S28vzyNa6m/ba90W+xS2m64ao6Z OWc4QLU5KrMiATNpCbFdS3uHZ2p1HGp7S9WQk0QWyP2L/v4hXTAaNIOxmvyFJToqBcaGeRJmIvF 5bvXYKong70PHyUaC/fHK5KPdG9ELKKZTD5qnEM6VUsgI60heoVk8QyRbPD9qjMOagbzZyiGUBP 2kygC9Y46rIb0PH+enC1GXEqOs+AeIKSfn1FLI7yhgrvQ== X-Received: by 127.0.0.2 with SMTP id 3Mp9YY7687511xrcBPWjeYC2; Thu, 02 May 2024 07:36:28 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.79]) by mx.groups.io with SMTP id smtpd.web10.7096.1714660587804083890 for ; Thu, 02 May 2024 07:36:28 -0700 X-Received: from MN2PR15CA0041.namprd15.prod.outlook.com (2603:10b6:208:237::10) by PH7PR12MB6418.namprd12.prod.outlook.com (2603:10b6:510:1fe::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.25; Thu, 2 May 2024 14:36:19 +0000 X-Received: from MN1PEPF0000F0E5.namprd04.prod.outlook.com (2603:10b6:208:237:cafe::3d) by MN2PR15CA0041.outlook.office365.com (2603:10b6:208:237::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.35 via Frontend Transport; Thu, 2 May 2024 14:36:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C X-Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000F0E5.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Thu, 2 May 2024 14:36:19 +0000 X-Received: from aiemdee.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 2 May 2024 09:36:10 -0500 From: "Alexey Kardashevskiy via groups.io" To: CC: Tom Lendacky , Liming Gao , Michael D Kinney , Zhiguang Liu , Ard Biesheuvel , Erdem Aktas , "Gerd Hoffmann" , Jiewen Yao , Michael Roth , Min Xu , Alexey Kardashevskiy , Jiaxin Wu , Rahul Kumar , Ray Ni Subject: [edk2-devel] [PATCH ovmf v3 4/5] UefiCpuPkg: Add AMD SEV-ES features support Date: Fri, 3 May 2024 00:34:44 +1000 Message-ID: <20240502143445.526098-5-aik@amd.com> In-Reply-To: <20240502143445.526098-1-aik@amd.com> References: <20240502143445.526098-1-aik@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E5:EE_|PH7PR12MB6418:EE_ X-MS-Office365-Filtering-Correlation-Id: 6604ff23-8324-43be-25c6-08dc6ab53b27 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?usS8EwLEZLdj2PUcGsv/gqVfmui03nQ42LG8KKtvud8F7wkDNVjFsU8FPH8y?= =?us-ascii?Q?jxTZHy7SiyjHOyHQ6k93AJaneP6dHFdnncjQkZQbKlIKf1JvNuveHCoeopmr?= =?us-ascii?Q?+R5RMoTm+cj3cc0yb9tiZYmGQfHb657GUI1j99UJhODcdrPGcZaRI+PCrP5j?= =?us-ascii?Q?6POYMjkCAR5uGXSmzaJDEyzzf/rdwc8nJ00Nnw8dybY192DM3hsKGuLAJwWB?= =?us-ascii?Q?/FWEReIU/um0rerKLXGO71gOXLDQc+gYJC/iiPgC1PYElv0cvYhTWUWp14Nj?= =?us-ascii?Q?AsnGQeSgfCxP/Ctyasd2m9KFvwwtn4/d03SJyGsJZ/4Araq6ayxGyANDlyId?= =?us-ascii?Q?Ev5QTGH4oh41rBwMhDo7u4DzqfpTtMrTQW9btAsXVBT/a7Xq/mxShimUNmvp?= =?us-ascii?Q?4w5NRnU3rJV5oayBJg3phuN0i6CKjvzY1NFVR2RchqM+KztxtqBvBMTcBmfe?= =?us-ascii?Q?W+9bnnFvUJpyCu2rSxkjCZ85GlTAAaakzzviaNd6JjL+Mlhzo6m5OCMb9A7V?= =?us-ascii?Q?6xYny/+tBq3B3BXNy95E+FohIKeR6aOGihoirF4jQ6K+FEFBvm6nRrf1Qe2w?= =?us-ascii?Q?VOGNhkWISbG2ZuUqGXIxsFn/+4/QeukhTlaoXrpsQB+Os/bsLaFV+RDnyrT4?= =?us-ascii?Q?nR8AwUXG9mXMNeSxf7sFJOiPTKs+Jf5uWyNJwYqMovvrrW+AIK1S2nCp8UTj?= =?us-ascii?Q?bW/x3rHgliGnfiizD0JVSCIKd6MhWLHksOTxCQGsp4kQZ+6b+BpquEEBj2ax?= =?us-ascii?Q?tPEStfbEeMDnwq3rGwk6pYfRhI9U8cDpLTfsynNkWLciC7zj6rfSh+jMjAjE?= =?us-ascii?Q?Ah4vjwNW/d8rGeG/4oLN/iKY/5vmsag31DVlucxwMsvUoTBAV5A32oVg4Gfr?= =?us-ascii?Q?p3/vHrwYfGItBBBX0fgJlJhFZjGKN6q37yJCKXZcoJ3CsfRi8iRttLOtDXGv?= =?us-ascii?Q?yqo/cDj7RAhuAUVvBx8a22t/ZszoeaTWzzKhR4FIzhsinBtxiq70p0gHmBba?= =?us-ascii?Q?rPHZq1RL5VioXv83uGmKebskpIK3QTwKEcFl4YGOOUN9bEnYFabTrgUqRK5M?= =?us-ascii?Q?mANLBns6oip257l/kefJMlpY8gs85vtiNDvexbovPZ+0Ti6IeDo54RyZagzj?= =?us-ascii?Q?CRJRCrowhypmLfXaqWu739oyUL3qcLyDW5WKGHONfm+gqWpIcgUViGjQu3/X?= =?us-ascii?Q?gOGYa89ByMU40p+yrE6lZlEBdZJ7g/WUSvQTvq/yC/xXOVUqtJ3rx6EW3lo5?= =?us-ascii?Q?B4eLH20UtWGERGGtjDFJnKGo+pSJhrS5j0jLsTY89pBs56HOpLq2Ze5uYC/N?= =?us-ascii?Q?k1W4Q3qnxBCHvEYLKe2/Z8yUvocx+kCHUilntaqClyau6A8JclLUV0d6ChMn?= =?us-ascii?Q?UGF8GwY=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2024 14:36:19.2095 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6604ff23-8324-43be-25c6-08dc6ab53b27 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E5.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6418 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: Thu, 02 May 2024 07:36:28 -0700 Resent-From: aik@amd.com Reply-To: devel@edk2.groups.io,aik@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 0puUr788g0OUTtoDM6IQ76Nix7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=xRaPW7+G; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io CONFIDENTIAL_COMPUTING_GUEST_ATTR is not a simple SEV level anymore and includes a feature mask since a previous commit. This fixes AmdMemEncryptionAttrCheck to check the level and feature correctly and adds DebugSwap support. Since the actual feature flag is not set yet, this should cause no behavioural change. Cc: Gerd Hoffmann Cc: Jiaxin Wu Cc: Rahul Kumar Cc: Ray Ni Cc: Tom Lendacky Signed-off-by: Alexey Kardashevskiy --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index d7244565029d..52fddfb7e571 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -3178,19 +3178,25 @@ AmdMemEncryptionAttrCheck ( IN CONFIDENTIAL_COMPUTING_GUEST_ATTR Attr ) { + UINT64 CurrentLevel; + + CurrentLevel =3D CurrentAttr & CCAttrTypeMask; + switch (Attr) { case CCAttrAmdSev: // // SEV is automatically enabled if SEV-ES or SEV-SNP is active. // - return CurrentAttr >=3D CCAttrAmdSev; + return CurrentLevel >=3D CCAttrAmdSev; case CCAttrAmdSevEs: // // SEV-ES is automatically enabled if SEV-SNP is active. // - return CurrentAttr >=3D CCAttrAmdSevEs; + return CurrentLevel >=3D CCAttrAmdSevEs; case CCAttrAmdSevSnp: - return CurrentAttr =3D=3D CCAttrAmdSevSnp; + return CurrentLevel =3D=3D CCAttrAmdSevSnp; + case CCAttrFeatureAmdSevDebugSwap: + return !!(CurrentAttr & CCAttrFeatureAmdSevDebugSwap); default: return FALSE; } --=20 2.44.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 (#118517): https://edk2.groups.io/g/devel/message/118517 Mute This Topic: https://groups.io/mt/105863831/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-