From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 22E49740038 for ; Mon, 6 Nov 2023 22:45:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=vIK9wxgaxTD/wP04f/Qs0epvHj44iUgFrWOStMaKwMw=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results: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:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1699310754; v=1; b=MKz7QgmcLXtC+fffgU2bPwJ0Leu67Hb1/eWr0k3goNvd9smPeF9T8tz+2pIsUQ7tarpQ3tSk GEpgNM8pMwptipbz1xIA/9gIwCMjgS0qd5LJxny37EnttXIpzrwZ4JYXAPDORBtv9nb0wMehSH7 wKsZ9IDHbW2c09yDKh8Wuqmw= X-Received: by 127.0.0.2 with SMTP id hsCjYY7687511xSpIyNtcWYY; Mon, 06 Nov 2023 14:45:54 -0800 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.42]) by mx.groups.io with SMTP id smtpd.web11.70907.1699310753923435597 for ; Mon, 06 Nov 2023 14:45:54 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CXlYtDX2+jJxgvEYBLrEvwk2dDVdFGgMUvJv88yt3NNkb3T7H16aEQ7uznDdA8Jkm/Ig6KbSxE5YREG8aRdtChfMmUdIBcVlnxbFv35AJf235mRkeVn2C4gth3qA7UMjf9k0BNR6oA6nJ+HjVDqUOOu5ePXd/8qzs4HR40dmMUxGm135yNXVI0pPKZQF2WFhGOAfrszJPdn1EOP2fU8YtfstRVhT5IPH6LmLHspQWIQ9Q6PBcW+8PJsXCvj4Go8ubuC5xIy5icBNz79v7eMVV92fblME+jNXRYIY6e3F6rfc4TQzq1QHiB1wPGJKXQBmUT5uTRlKkF9hDrfI1ns+0g== 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=RJIFKDvuFoaSS08zJHyLfkaxl/JECZISVLjenk3NoeA=; b=lbNS5dxcSSrhANwoCWmKypLrolX1fjh9/RqBlJDPb+cbvvI5MTxZIOjkWDXpLfI+Q1FUzoZCdZFTPvdnDAgAVuu40Z33Y4Hgu8Td+zVn1U4yaQ/N3tW0NT/cib4ifpRWM5MY2hwX1BlUAHgcuuELybclkFmrjPx7SDTb8YVMDz48iP0/YD7pZJqkQXcUByj/pQO90k8HIsYfKpqQQwTb9ELDPZQ48JGA92TnlrQvqRaaA1bJM3k/YWlCxn+TDe1XWQ3auTnRqhLOq9y+ANxgbuitVXTl6EVzGRDx5u9kf54FRk36YC20tkwPjFHdxRzOnaYYKbP1mkZMDVtD5edYzw== 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 (0) X-Received: from CY5PR15CA0216.namprd15.prod.outlook.com (2603:10b6:930:88::11) by SA1PR12MB7320.namprd12.prod.outlook.com (2603:10b6:806:2b7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Mon, 6 Nov 2023 22:45:50 +0000 X-Received: from CY4PEPF0000E9CE.namprd03.prod.outlook.com (2603:10b6:930:88:cafe::bc) by CY5PR15CA0216.outlook.office365.com (2603:10b6:930:88::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28 via Frontend Transport; Mon, 6 Nov 2023 22:45:50 +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 CY4PEPF0000E9CE.mail.protection.outlook.com (10.167.241.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6977.16 via Frontend Transport; Mon, 6 Nov 2023 22:45:50 +0000 X-Received: from tlendack-t1.amdoffice.net (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.32; Mon, 6 Nov 2023 16:45:49 -0600 From: "Lendacky, Thomas via groups.io" To: CC: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann , Ard Biesheuvel , Michael Roth Subject: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Use AsmCpuidEx() for CPUID_EXTENDED_TOPOLOGY leaf Date: Mon, 6 Nov 2023 16:45:30 -0600 Message-ID: <91d35526ba20ff73653128d78f2461876cd6dce2.1699310731.git.thomas.lendacky@amd.com> In-Reply-To: References: 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: CY4PEPF0000E9CE:EE_|SA1PR12MB7320:EE_ X-MS-Office365-Filtering-Correlation-Id: 943e3e03-5409-44a8-358c-08dbdf1a2012 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: WZjeLLZo239vdRbjXkutstKwXGzwN3oIHN+/+6+oMb8V0qzcewph/jwB7/I/rpX638NFrdXaXJFB3slYBTSusnDDFXfQlicyAHIm0mcNk4FZCc0MeO+fxVb+d9oDIJUfX49AmFo0YMRCJRLkbAeFVTqddFgOnqhIWos3pNVDKtI4j5eunS+9AYQjbjNe7sqHd7CEy3w2Qn0y1oVMbENRysm9r1Sr8pzAJZnpz158XEj5AJcbV5bczqRyFCFwrOwRBK0c3f4OlP9JUoaz53btKrIxnray0jOskGHWmYJ1p7aQGmWIZxKa1QI8Mg+NbpUpuoyvBFS1E6oy2abgfCoOXFiJKvlGqA+EaWCKTXsFbxoKh677/8miIPZZZs7apHqx7nNx7UEgRyvVpSZ00mnXsUaiDfj3oKf448Y8BzBZaljP06W36gwUQ1++Qgn2ahYnTw/YgvUt2EYW51+gsmne6nBQfL8v7QsN0nfJhFVb8sIDEety6IJ7+FBbI/2zjfpnJ8PM7aH68SdrqrFA2TUZeKRNn0JTynTXw8blfEru+i5tK6NeB/FF8XwUk/EyNL2dd+38xWFZLrPB4kv01pnyo1emS27lPPpCd7rO5xXISRgvTZW+qml/Kh6OAKn/jkFNwEqo9ygWN83CrNgdap7sUgdSGjaFe1LiKRhoa9uyVCrcmA2nb4GdvQj6yBfOrX3INXJNoI0t82IcroNZytx8FArIT8fOvezj/2iSNg6Dz/9pM1OH4wgahnEpEVi3r3Ri7+OQD7GHVc13OoWWj9EkIXM3dmfLoauSfbUsFYCaVco= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2023 22:45:50.2171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 943e3e03-5409-44a8-358c-08dbdf1a2012 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: CY4PEPF0000E9CE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7320 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 Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: UDh2fCsMvEiKMpBnyRg3NPP7x7686176AA= 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=20140610 header.b=MKz7Qgmc; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") The CPUID_EXTENDED_TOPOLOGY CPUID leaf takes a subleaf as input when returning CPUID information. However, the AsmCpuid() function does not zero out ECX before the CPUID instruction, so the input leaf is used as the sub-leaf for the CPUID request and returns erroneous/invalid CPUID data, since the intent of the request was to get data related to sub-leaf 0. Instead, use AsmCpuidEx() for the CPUID_EXTENDED_TOPOLOGY leaf. Fixes: d4d7c9ad5fe5 ("UefiCpuPkg/MpInitLib: use BSP to do extended ...") Signed-off-by: Tom Lendacky --- UefiCpuPkg/Library/MpInitLib/AmdSev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/MpInitLib/AmdSev.c b/UefiCpuPkg/Library/MpI= nitLib/AmdSev.c index bda4960f6fd3..d34f9513e002 100644 --- a/UefiCpuPkg/Library/MpInitLib/AmdSev.c +++ b/UefiCpuPkg/Library/MpInitLib/AmdSev.c @@ -256,7 +256,14 @@ FillExchangeInfoDataSevEs ( if (StdRangeMax >=3D CPUID_EXTENDED_TOPOLOGY) { CPUID_EXTENDED_TOPOLOGY_EBX ExtTopoEbx; =20 - AsmCpuid (CPUID_EXTENDED_TOPOLOGY, NULL, &ExtTopoEbx.Uint32, NULL, NUL= L); + AsmCpuidEx ( + CPUID_EXTENDED_TOPOLOGY, + 0, + NULL, + &ExtTopoEbx.Uint32, + NULL, + NULL + ); ExchangeInfo->ExtTopoAvail =3D !!ExtTopoEbx.Bits.LogicalProcessors; } } --=20 2.42.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 (#110767): https://edk2.groups.io/g/devel/message/110767 Mute This Topic: https://groups.io/mt/102432043/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-