From nobody Sun Dec 22 06:15:23 2024 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+101247+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 1678917566889959.1159628514845; Wed, 15 Mar 2023 14:59:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id OkTBYY1788612x28RozHoozI; Wed, 15 Mar 2023 14:59:26 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.62]) by mx.groups.io with SMTP id smtpd.web11.6822.1678917565627619330 for ; Wed, 15 Mar 2023 14:59:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IjQ3EsCpMz1k2ENZBX+JFMSr+7/jp0g2GclpDQbvHoRJ8JIXDqHZgQAwJuu/zVcDUVIcbuW7g9YytLBzsrPLTch6fkV1038cZGIF6N71zWUI0fHw0UT1/keMYCrdUtrRMiMtAblPQ6dKOI5P9XuCPMWdlMWVuuhsM+JcWDbN/5e/8sH+DzJiOmyaTr/q9wW2DO6YOcArLm5et02qg852ofUduzs3/ED52GUmA3R0OeeAPUbNvqb1G1y+EzZ+jFnT15QIw768ANZR6NipanXhIlB/fztZieivG7nHJXOTOeFK/XuuGwtRaFisvo+ljEc3a38jBmtTs9Vs8Jg25xhdaA== 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=b4ep7E86IGY5rBBOyiT/2dfBLHR2bhaof4monbShjXI=; b=E28xA8l75x2vyDRg+BRFhmxQzdjyygt/s9QgtrsyEdCWIBKlqDwavOKR8HwhOSOu891LVkbvz31u0wgWYwkKScwhICFo/kLaJ0mBpSA/VlXqLzXhM4Ff56Ilp0p3zE46vJhgGQAAmWUY1BARTkncrsaSi1y8W9YD+o7dWduDBhCUvleVs8bu3w1mmVfjFj3d/4Im9wtIdgZ3rzRlS54D5D1dkvSyMFxPNWx/vQ1lS013HCcyxdLjhAJ8nOXqNpV7gQ2w4xooA+sERXBcs8GSfebEuH4wlJ7NeEhpCW4ZjPo5e3pf16MaRqXS2Ti75rNJGZET4ERdGkr14OKR7DPBpg== 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 MW4PR04CA0216.namprd04.prod.outlook.com (2603:10b6:303:87::11) by DM4PR12MB6640.namprd12.prod.outlook.com (2603:10b6:8:8f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Wed, 15 Mar 2023 21:59:22 +0000 X-Received: from CO1NAM11FT110.eop-nam11.prod.protection.outlook.com (2603:10b6:303:87:cafe::f7) by MW4PR04CA0216.outlook.office365.com (2603:10b6:303:87::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Wed, 15 Mar 2023 21:59:22 +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+101247+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 CO1NAM11FT110.mail.protection.outlook.com (10.13.175.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6199.17 via Frontend Transport; Wed, 15 Mar 2023 21:59:21 +0000 X-Received: from localhost (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, 15 Mar 2023 16:59:20 -0500 From: "Roth, Michael via groups.io" To: CC: Tom Lendacky , Jiewen Yao , , Gerd Hoffmann , Erdem Aktas , James Bottomley , Min Xu , Pavan Kumar Paluri Subject: [edk2-devel] [PATCH RESEND 3/4] OvmfPkg/CcExitLib: Fix SEV-SNP XSave area size calculation Date: Wed, 15 Mar 2023 16:57:46 -0500 Message-ID: <20230315215747.1543837-4-michael.roth@amd.com> In-Reply-To: <20230315215747.1543837-1-michael.roth@amd.com> References: <20230315215747.1543837-1-michael.roth@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: CO1NAM11FT110:EE_|DM4PR12MB6640:EE_ X-MS-Office365-Filtering-Correlation-Id: fd4a4c56-5ff5-4795-aa73-08db25a088a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: jJOiwyGV7lI2DB/isKxZ/bFSujFTJs1ctGgh3NZLFkKZiPTV84YLKiT+57W5ct+SLTxYSXsow+7jKiIPk747HJ7YrZwAW7PlEPcMsPhYWTs8Od7EpoKjTnJOa2pLnhx6rWdaYbbiMicEolm0dz/pKlE8R+K15ineJRZMmsxKEFbun8aS+0P3iOreJuYiwHnLJ++gYoCrLrOyLVDrpRUgm8gokNHKUqgKeLUL7Am+Byp89INQsMBQyckW8gVlOO9oQBSxiYJvW7zJoispk9uwYB4TM4Bkp8YtX4KAw0GCsQSThc4DluOBTszujmsW8nqZHraRgt2fgwLQ3zFsHupyjSeVTSxSouBrriMN2iSgh7FTWmL0wwdy+SBqNmLWaf9gWAdqYK/QYMV5hQWVx6URq44tfxObasc78Ycd7hTN9/Jcx3VNT8gh+toSOn1YHL2+WPd7EZolvjynGGGVQtPLGHtEYt3C2bA4+2ti1GA+9C+l906qz1OR3Kd7sXfkYldsLDqIsQwVZbLNZkAR8xvAdZQBKKTVfK6paX+kh2XdtMqYsOJK5NeARnkrPrYZS3wOK0X8cvMG458T5tgcffAT9MYh5gx3vBoABax9SBb27g1pg5huAX3ZKd/nWub45B5W/K+31S88JzCc2vJXEfonaXpiCHz8boT9J1Y7VnZCzXOHOOwSVvQtB3qtZDLfKhGdc3btuBBB9s3hJyZ2GwvLYimB5oXT5y5+WuPjff2LjyY= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2023 21:59:21.7379 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd4a4c56-5ff5-4795-aa73-08db25a088a1 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: CO1NAM11FT110.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6640 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,Michael.Roth@amd.com X-Gm-Message-State: a6TSEPjRBLOZ3EoyEdOuzrwzx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1678917566; bh=uWdKsUTWnDyjdvcajjVVmuWGg/vb+mk5MEctClS2kV0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=rNWZOvoOs+Bh3E7svBJSljYUWy78ryUvdnyIAi/y7nxf0/gl71FTnkF7v8zsXkS3Mjg AHtNHAFa3Thb2MLSn3AikAJc147vpDc13fbl3bAazI4VaB8CUhERwE2/NewqckHVTaTFI 6zmzyc2P9zhpzpeg9rAjiiXf09+GP+aY4z4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1678917568132100002 Content-Type: text/plain; charset="utf-8" CPUID leaf 0xD sub-leafs 0x0 and 0x1 contain cumulative sizes for the enabled XSave areas. Those sizes are calculated by tallying up all the other sub-leafs that contain per-area size information for XSave areas that are currently enabled in XCr0/XSS. The current check has the logic inverted. Fix that. This doesn't seem to cause problems currently, but could in the future if OVMF made more extensive use of XSave areas. It was noticed while implementing SNP-related tests for KVM Unit Tests, which re-uses the OVMF #VC handler in some cases. Reported-by: Pavan Kumar Paluri Cc: Pavan Kumar Paluri Reviewed-by: Tom Lendacky Acked-by: Jiewen Yao Signed-off-by: Michael Roth Acked-by: Gerd Hoffmann --- OvmfPkg/Library/CcExitLib/CcExitVcHandler.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c b/OvmfPkg/Library/= CcExitLib/CcExitVcHandler.c index 7fe11c5324..94f0c4872c 100644 --- a/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c +++ b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c @@ -1145,9 +1145,7 @@ GetCpuidXSaveSize ( for (Idx =3D 0; Idx < CpuidInfo->Count; Idx++) { SEV_SNP_CPUID_FUNCTION *CpuidFn =3D &CpuidInfo->function[Idx]; =20 - if (!((CpuidFn->EaxIn =3D=3D 0xD) && - ((CpuidFn->EcxIn =3D=3D 0) || (CpuidFn->EcxIn =3D=3D 1)))) - { + if (!((CpuidFn->EaxIn =3D=3D 0xD) && (CpuidFn->EcxIn > 1))) { continue; } =20 --=20 2.25.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 (#101247): https://edk2.groups.io/g/devel/message/101247 Mute This Topic: https://groups.io/mt/97638507/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-