From nobody Mon Feb 9 05:41:51 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96811+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669872366569634.8673189881966; Wed, 30 Nov 2022 21:26:06 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id brH0YY1788612xtBAEpePFfF; Wed, 30 Nov 2022 21:26:06 -0800 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.41]) by mx.groups.io with SMTP id smtpd.web10.32758.1669862261957366035 for ; Wed, 30 Nov 2022 18:37:42 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NpHT2fnh8aS7A/h6TlNNTlXdj+qY6YrDmjAjbR4IKghjVYin/D3BP70MirTsyt0db/eOw4lsICJhL/vKa7IzwD13ra6gXbbt6N1iIMhQRDGNNlIJEEvA5wMuSKU1Ttxs6Xj/fsP7D6xw6YBh18CAOYDYxfdfzGu+n0Di9e4P3+sgpEf86CqCtH+rLnbrjQwZJ8CewzRNgMQ1JQR27Egqzc8KBZ+siL1wwHzGAaUCB1ODvRt3NMiDeh1v15SAQYwSIZI36mekH1q+IeV6GQhSysl05p7RapC+RSvKZrzCHo9fMhomltHmUp2LMIT9d1MJ6mNp0/RfihvrSAH2NodTcg== 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=2wMvV3HPcosDhd5B6YwZGnm4cSe3rp6k6XWFdYnX1/k=; b=FI+UKEQmR2ccloUhu4U/WpTUjmB0xZAjuO4JdNNHxnTjX/vrySjwuqISEs+8dQUBoA4yWD+AMLNMnKsColrRePhtne9gTcBIz34l9tar+pqighJ3IVdxjbJclHZv2lzoCmaZg9kSAXk1NEqFidoxuhyA7JFo/LRHLNh3kIJYEtnF43wTJp8IKcfs8DNvbYiW5xZjiCU2DFf/zXs3W9/sI9usokJkRPHOnTtiCJUYqgMPIREHqP/Iu8mimNkfoj/PBsCEOpf3zqxMsJ1msT2/dTXIc3xjsa6wY/8Xtxz8+XUXnZsHpq5/CEPoihBdLn/dNtASoAKEthmjwSf7bsmZ3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none X-Received: from DM6PR02CA0090.namprd02.prod.outlook.com (2603:10b6:5:1f4::31) by SJ0PR12MB6830.namprd12.prod.outlook.com (2603:10b6:a03:47c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Thu, 1 Dec 2022 02:37:39 +0000 X-Received: from DS1PEPF0000B073.namprd05.prod.outlook.com (2603:10b6:5:1f4:cafe::f) by DM6PR02CA0090.outlook.office365.com (2603:10b6:5:1f4::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23 via Frontend Transport; Thu, 1 Dec 2022 02:37:39 +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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96811+1787277+3901457@groups.io; helo=mail02.groups.io; 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 DS1PEPF0000B073.mail.protection.outlook.com (10.167.17.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5857.17 via Frontend Transport; Thu, 1 Dec 2022 02:37:39 +0000 X-Received: from aiemdeew.1.ozlabs.ru (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.2375.34; Wed, 30 Nov 2022 20:37:33 -0600 From: "Alexey Kardashevskiy via groups.io" To: CC: Ard Biesheuvel , Jiewen Yao , Jordan Justen , "Gerd Hoffmann" , Brijesh Singh , "Erdem Aktas" , James Bottomley , Min Xu , Tom Lendacky , "Alexey Kardashevskiy" Subject: [edk2-devel] [PATCH ovmf 4/5] UefiCpuPkg: Add AMD SEV-ES features support Date: Thu, 1 Dec 2022 13:35:20 +1100 Message-ID: <20221201023521.10028-5-aik@amd.com> In-Reply-To: <20221201023521.10028-1-aik@amd.com> References: <20221201023521.10028-1-aik@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000B073:EE_|SJ0PR12MB6830:EE_ X-MS-Office365-Filtering-Correlation-Id: 31f95b83-df6c-4c69-aa2e-08dad3450387 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: hqg9C6P5I6eJ3yD0ecA0EjTo6gOuGn/CbbqFEbF2uhqaOKtAgh2FlPHApDeJLGmB9N+aqc9vamzMjopdWGCh2RNNZUFcicK5SEbQSMhsoYikZSC8qT48BPHt6FMHU+kroav9vfJ29CReDi+2GZM3lLFGdYgbQ+4S+vkL7zB8b+DrATPdbAbxZjVogWQ7KA/hAkgPrTDb3GnlzcqODV/mAkuPsj3s5AuMPomnjNzavSDmjVm9jLTK+RrAGWVoT89bm6e/K+eEYQ8KXDOypDzT8GoZ6M2geBZ5MUx2F9G1X04mKDThuDKsuriNmJMwnMnzWUITQ91JgZwtRxwNDsOJX6ns7jROxIb30DpDd7ClY0Ly8uu+HSsrB2fQhhHh0qhxnPZsLdD3xR+mKKswbsOUE2ngzb8Jnbw0LbQ1gG5/14d2BW9Dc4IM9oHmGqk4IhxUSRvSauNEv56ibY5EhLEHPKHHXwNygU4qUAuxGvRtLqPaj/uKq65/pIQGi1KItLXivjqA1SHvF8JTdJMEojadIV2JUdyqLMF9yhXGwNvx89uxHKmRjz142U76puhyfMDiUBEhSDrPgj/xvgpJJ6KUrKC3j8lL09yLUc110vb+lyNQ/z3u1UHuzjUsbz1VNf33uJ5IcCLLCfunYLoS6/oPd/amj23Vhdt/hln9cUNZD+snKb+DT00Cz2sAr7t/JOyVySKVcveGhdHxjygCQCwQDleoqGSPV9bjUWemwQ5OY68= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2022 02:37:39.0991 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31f95b83-df6c-4c69-aa2e-08dad3450387 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: DS1PEPF0000B073.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6830 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,aik@amd.com X-Gm-Message-State: NwFckfK0HIAHwRdxEwbdyK7mx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669872366; bh=Xr04MuWeE4ChbBnWR45oIZufqgXsDTby9kGlQ7aoOK0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=uU7JLDbZj265EDg2P+QZwTk/bEZY7sYEQM5JdVzvGmPAuP3//DhwsuLb02QhPuQxstB X3abKnNkqP+h4amzakSDmnvSRuI3yBArlV5LsCADU7tcuzn/mZhQJj7gZL9WIsr40dPd8 ywyZjWIZs6tkTvRSjDcjsqaiwYwKbsg/MaY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669872367749100002 Content-Type: text/plain; charset="utf-8" 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 behavioral change. Signed-off-by: Alexey Kardashevskiy --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index e5dc852ed95f..26e763295a7e 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -2849,19 +2849,23 @@ AmdMemEncryptionAttrCheck ( IN CONFIDENTIAL_COMPUTING_GUEST_ATTR Attr ) { + UINT64 CurrentLevel =3D CurrentAttr & ~CCAttrAmdSevFeatureMask; + 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 CCAttrAmdSevFeatureDebugSwap: + return !!(CurrentAttr & CCAttrAmdSevFeatureDebugSwap); default: return FALSE; } --=20 2.38.1 -=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 (#96811): https://edk2.groups.io/g/devel/message/96811 Mute This Topic: https://groups.io/mt/95376261/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-