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 32E28D8114C for ; Tue, 28 Nov 2023 10:31:14 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=tn3kzP1Dj1Qu002WJIzQ2WCUguovHNG6AI8/bpbhedg=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1701167473; v=1; b=GWFztkECq0wzwnA3Nn5o3fxOLONvqLcnU+D7SLoox9vZHUBA3UI93If8/43IL5A1ZERscjXg sp7niYaekyOLsh4Rk5DZ1nrpOTUrt8cH45pT4HYuEdU8tBdU7/zh8Opgh2/Am1utkFZkCKm5tiV l0qbCHf4PgBdikPQAN697YQk= X-Received: by 127.0.0.2 with SMTP id Un05YY7687511xyHeUVpIaJ9; Tue, 28 Nov 2023 02:31:13 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.29666.1701167472840922022 for ; Tue, 28 Nov 2023 02:31:13 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10907"; a="424047480" X-IronPort-AV: E=Sophos;i="6.04,233,1695711600"; d="scan'208";a="424047480" X-Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 02:31:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,233,1695711600"; d="scan'208";a="16896982" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 28 Nov 2023 02:31:12 -0800 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 28 Nov 2023 02:31:12 -0800 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Tue, 28 Nov 2023 02:31:12 -0800 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.40) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Tue, 28 Nov 2023 02:31:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IgYyfHew5vrPGglS6MChfHe+OQ0RLiMKJariNv7r7f1GHDNvSwqtYtAE9Qr7RHg+MzxNYd/qqA2C4MNYt08lUKvxyYgK/xz8dvTaBIOQRahvTDxozTCP3wLVNlUaBowXSvECQbB6viTObmoPIRXVli44fbet9OtOe1go07Rig59Qm7+t0W0Jx1M/PN6QkFV9cKkSMpOWotoWvEg589n527Z20uE+NZ7MUiD7VOve97C0ppiA9/y3BFqk4hhfJxHP28eWPiObp4xgn04FuXRyPBvQ/EiNHSXmL9Ng8tAlAZEJvCUPu8s9GQGRt71s14COv98hycVXFtw8G8zzLEyzrg== 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=Fv+NBsyB+PUfTM545bjRg3ivMbVssgD5ng3qUYbmXro=; b=lHt1ZH5OwdGNiLcKFGUiKwBnAwm0CxPcrtj/uNMeAGqw7nJRWesv/BovMo5UmH+T/E/vKnrpFeEGvUwHpRGZkQa+nqTauv+7pZImUftB2cWzZXLd1xUu8wodTshrlT+j912tZJn0ZHqRHdOvpJV6hCNctiIn7WbqfX8CEntKJfJMpf6FIflgeJxw+xXcyDcbDmgFUQ6QfQUon2uE30yMCwbQWA+e+iZO4yevG0gfMx509Y8VKcYnKmRiUJIyC3D8OO1hfnscSCVIizWvK+A/nkJ4ekbnqN+WGww4CLfg/GVAe711M8wr1K6BoiKhAINobIjhTtKyBYW/A/HP9f+BzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by SJ0PR11MB7155.namprd11.prod.outlook.com (2603:10b6:a03:48d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Tue, 28 Nov 2023 10:31:09 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::b614:1f5e:8b0c:9858]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::b614:1f5e:8b0c:9858%4]) with mapi id 15.20.7025.022; Tue, 28 Nov 2023 10:31:09 +0000 From: "Ni, Ray" To: Tom Lendacky , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann , Ard Biesheuvel , Michael Roth Subject: Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Use AsmCpuidEx() for CPUID_EXTENDED_TOPOLOGY leaf Thread-Topic: [PATCH 1/2] UefiCpuPkg/MpInitLib: Use AsmCpuidEx() for CPUID_EXTENDED_TOPOLOGY leaf Thread-Index: AQHaEQMEDvv94dLyj0OtMo51NRASj7CPqb1g Date: Tue, 28 Nov 2023 10:31:09 +0000 Message-ID: References: <91d35526ba20ff73653128d78f2461876cd6dce2.1699310731.git.thomas.lendacky@amd.com> In-Reply-To: <91d35526ba20ff73653128d78f2461876cd6dce2.1699310731.git.thomas.lendacky@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|SJ0PR11MB7155:EE_ x-ms-office365-filtering-correlation-id: 7ee0c189-9108-4f1a-f101-08dbeffd22e7 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: wO2vHh3VQkTsTGxWlRpVsykj3DLP7Z3MBSWX1Vi0lZELzne9FJv9wnyFK9fNZ1+/U2SpzCQZQps378UVsY7RgCFSSv7RgZUFeCa0YeZgdruSJ6xG96WYdWyWGo50W/6cfgmT+YV0eFgjVAzhjeaEUn6xjyGauNNLwpbn5peiPhLSps7E7noEqZ4FeHNE6eQfwOL2fQ05yeY8e1hml2zuC5yODluWhco+rCOAhexe9kMhvBPL3JApgzTN74VXMaD5tRxFQ3hxSn4Xmh4B58Od9tde8so0od6QP4hA9lC+WHq8IMpWxmTWimTe1/I9Q1Jw6eAgeW/IBkYdg3buM417gbqYUkQnLYh2FsoGGMZLjL91DQ8IzdSQUhYb8cC4gXrJYWx89UixMnGalKGjJckRVxVyZtB2wyrjLjE4PRVqybf6nl2orWvq1jxTOCh/Wavn23vw2oVoU6aAlNk97C5e4wrKwwVwOXBFEH/DAs/oHFdrF1fD9PW8mPVbODxfzVkKcVKiovYP7IkqUmrAda9/bEcH8M2VDuoA//mHaF22BMIJIU2DapWKZqKLU41Fxg1pw8UwCRkPXgPF9lzktLck2rtErlJiyqeQ9EZnxUzHgrtuySXEt9ORfRcybulUmELcjnqaXmLoHB0uiYtISHoELw== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pp27eq0lQwmBCebW1I+z4KwEN+tIZBdV9BcRsYw5LeJvhu0Zo6gqGl7vHlfr?= =?us-ascii?Q?CDa7QJOOtfIoL5EDuUFA/JVraR1JTtcMcp+fCk+lIHmJSiabLFP67vjNQrKd?= =?us-ascii?Q?Z3Djt+WWrczONjHP79Lz5csEE9yaTSaWi7KzFDIYVPFTpqPvVNuG6CsFpaio?= =?us-ascii?Q?AC9iacZpiJYQQCE+T++a5RCmOwLe691r+MjSFmMyLz+iSpMqW9Y4/izO2D7J?= =?us-ascii?Q?uyYtFgcJEAdU6EjZYbh03nRHtPcp3ZBD6Lgw2V4inMauqlYhej7dCYfZ9EKz?= =?us-ascii?Q?kyRwdoNqxmdeOcizDiwg//W6XFAJJCM8IrU3mmqzwZ51EbAe591Ef5i7mf76?= =?us-ascii?Q?nrLXflmSPJoSXnL031RaF3fCEJ6N7PVRlDz67Y+N5Z0wJB0PaEPOE1u7l1PU?= =?us-ascii?Q?tkw+13dcw/IX03IpK1aVw/dcem2RYdVpeyTksvyptbojCQOKFlgntqdops6d?= =?us-ascii?Q?7OryhPD1V3CaunFawPtyn9XrunGIXMySpD+IVu8tThEuPPQBMEht5VpgNK8b?= =?us-ascii?Q?taC061bdo5S2SdbSxhA2sAf+OxwDrfRrlinBFlk5tttXbLtsuic1ftiN4Sku?= =?us-ascii?Q?eX38vR7b2QHMiiw5vpwMTBfjRPoWriLaB0PLEAeSsL6aqn5q0jz7jJJkOSXB?= =?us-ascii?Q?3fcU2x5p+4uoGd0OahM3JYFSx2hj1mgs9F3MWiO8RJILrDBaQp2iJkqnFegY?= =?us-ascii?Q?hhv7XTVu527VA82pRKXsxTsMW5JeGe5hQFkh5XKLDbchom8p+ZwzYJ4aeoXM?= =?us-ascii?Q?YO0lg3AAAOxXBqyQWBsu6KR545AXPWBfTA18/3dY3Hd8PEyNoZdf2TGkzha1?= =?us-ascii?Q?/ncsOisd3RJC1QVBu+AcD057NzVzLys+kdwMvbEjq+p81nQIEGuWQaTABGqL?= =?us-ascii?Q?Y9BBETPmagP8oXFcjvk+b7zUYzqtqKu7t4uGlwnk3KcHs9izZgNmh3lIeC8w?= =?us-ascii?Q?neyRSUSjy7E+eCL918bbvU87/AfRNrt6Kj1WuDj4ZSIeu1M/YZOGG5rGoe59?= =?us-ascii?Q?QoA0W/gluJSx+JtjNvaxyJzjjltXLE37GRfvn+iNozXGRE4XvS69nXzWu8En?= =?us-ascii?Q?FekJw8wLEh4nXVr3ZS+2G5CSh8MLkWj5iqbBjE2hwKFXSPKRqAxu5hLOA/gT?= =?us-ascii?Q?znXHjNQzchotswbIKIR/PijCUr8f1s2ZRu350mIpJ8GRwFxXY8HMTYFOsCZt?= =?us-ascii?Q?CARCTjT/tJvsaEUyjTR8Ce6w3ja7PVLTb4woRY1MYeiS7johdSnHZTUkqQzH?= =?us-ascii?Q?Rtj2aFAPVU1rb1XzjzwY4mFGJvChT8bz/lQO64crycXp2CaS947gzNRXartw?= =?us-ascii?Q?ercpon+xA6UBm51cTEqbZR/ZsWaxRJjAA5fD+jGRVmCvMYqntFOYJFNRDoUa?= =?us-ascii?Q?S8wgKiBS9SCM5268Ff1ZAMt2Xsb5fLwUWdJ8MR6j/ettWIOxT7NjYsX7QA7/?= =?us-ascii?Q?Y9j6laMpDq6zwYWQddetrdVsXcRubV6iRbHGydbhC5iu4gj4zbhdnNqD0LII?= =?us-ascii?Q?rM1wv/y52IAxAg5/PMwGQ4tPgwf5lNZthcxO5e/6BxxB5h5GMmJd8yc0UiVV?= =?us-ascii?Q?sMmNZ7lBPkd7kBJBVSs=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ee0c189-9108-4f1a-f101-08dbeffd22e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Nov 2023 10:31:09.4416 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lv6VGg1+QjRzNRefwO6dpLCw5YHOhiPrnJ/5cGWLXnBuJhRUeeXIOU0RsCV7GHYtoMKcHvgycMPEgksEl/U/og== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB7155 X-OriginatorOrg: intel.com 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,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 5B602gxNSKXPZkbc0dIzSTDwx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=GWFztkEC; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Reviewed-by: Ray Ni Thanks, Ray > -----Original Message----- > From: Tom Lendacky > Sent: Tuesday, November 7, 2023 6:46 AM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Ni, Ray ; Kumar, > Rahul R ; Gerd Hoffmann ; > Ard Biesheuvel ; Michael Roth > > Subject: [PATCH 1/2] UefiCpuPkg/MpInitLib: Use AsmCpuidEx() for > CPUID_EXTENDED_TOPOLOGY leaf >=20 > 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. >=20 > 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(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/AmdSev.c > b/UefiCpuPkg/Library/MpInitLib/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, NULL); > + AsmCpuidEx ( > + CPUID_EXTENDED_TOPOLOGY, > + 0, > + NULL, > + &ExtTopoEbx.Uint32, > + NULL, > + NULL > + ); > ExchangeInfo->ExtTopoAvail =3D !!ExtTopoEbx.Bits.LogicalProcessors; > } > } > -- > 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 (#111805): https://edk2.groups.io/g/devel/message/111805 Mute This Topic: https://groups.io/mt/102432043/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-