From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web08.2190.1660105940204309423 for ; Tue, 09 Aug 2022 21:32:20 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=K0BVXJhe; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: jackx.lin@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660105940; x=1691641940; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version; bh=vBMela6RhPZoYwgQDpvq3GYCvCCgYu9Saa9l1k8uDFA=; b=K0BVXJheuhVzJCeo40oxPOY5KouPF5ybnaMbdLb28ZAI368a9HD1U3WH 4arNd754HwLbN/1B0uz+yQK9iBo15wPZcFGEu6GlNgJaPz1WUOv9c0fYF 9m5iveE48dGF/WxQydsCCcDcy6Ibt30T/iDmYgVafw9/rW7E7McXqSMHF Yy+1DV+G5XegFsEg30g6HyCXkinjCmVqGc1RfMvquLitOnQwJFUTqbIgG /b9lZwQvIJ8H1aHAovxQIg85efZx5itg/zEEowdfnayUTjSynd+KKzwsA xZUDSkDl2JXhIGqttFULElZSrWhNojTrsZ9WNhAbMPvtlN+c4l2st4piK g==; X-IronPort-AV: E=McAfee;i="6400,9594,10434"; a="288559564" X-IronPort-AV: E=Sophos;i="5.93,226,1654585200"; d="scan'208,223";a="288559564" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2022 21:32:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,226,1654585200"; d="scan'208,223";a="673152334" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga004.fm.intel.com with ESMTP; 09 Aug 2022 21:32:12 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 9 Aug 2022 21:32:11 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 9 Aug 2022 21:32:08 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Tue, 9 Aug 2022 21:32:08 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.172) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.28; Tue, 9 Aug 2022 21:32:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hglsWzxGt+p6f9HeYtnmFIxSbRJcGE4KwMxvMbBCwF2H4evCN6GFQNxhbJ/DzSGzcs6oBdcxTAgd79r4XestkHu0tQSh5hF6n652s3JnZvGjumY+xWJGgQaEMGoYMKPCOxKuiIgntcNfJVVbHhih8jPf3fXks9DJwanMlsakB+2XePTkRdwlDzKdw+H+fvaOA6d+i5U1alcFWZksWVpu8KoZvM0JDg4AS9kbQwYa8Mclbhsht42W0Y2+LFurEpB7O9D7WXeDnAfnVeaihGPtnkDJjIs1BAL7Bl+yhdstBCm6OAFE9bmt3Xrb+vX/dO3d4BvB0fTOPs4v/lCBzbnIFA== 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=8b/03S0hUUdZfqXcgrW7HygzojHh2oHEKXBucVkzvbo=; b=WM1Uhjuav2iiZwh+qGkMO/J62j81OAHx6d8/TC5CHdwkTAENnUqkF88Nj9/9HeELsZhCn4jNOgBcR3N4FBuWBf5m6d9Ookv14SIenxtHo3zV2lrdixIl6xc2MojqANiaZ1sl8SFpnlkBmoGQ2VIb7NfwqexNKqIbLUBs+jcETZK+sbvxjGMrPsFjR1jHBvpI/zL1LovxTVm+WbrZA9qVxPWj57VRzrZf6pgCae5HAyTN2riwx5oSXsrJL3VoekGvydiqI1Uc6gjgOjJCvb1Jq5Ah5oEfrDa01Z4TF6B1hZ4vVW6HYOFjoSWI8aFIov+UpnuifMH3REgxiBXbyXMMKQ== 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 Received: from DM6PR11MB3738.namprd11.prod.outlook.com (2603:10b6:5:139::25) by BN6PR11MB1331.namprd11.prod.outlook.com (2603:10b6:404:49::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.10; Wed, 10 Aug 2022 04:32:03 +0000 Received: from DM6PR11MB3738.namprd11.prod.outlook.com ([fe80::6022:45c7:8a7f:5a33]) by DM6PR11MB3738.namprd11.prod.outlook.com ([fe80::6022:45c7:8a7f:5a33%6]) with mapi id 15.20.5504.021; Wed, 10 Aug 2022 04:32:03 +0000 From: "JackX Lin" To: "Ni, Ray" , "Sinha, Ankit" CC: "Chiu, Chasel" , "Dong, Eric" , "Yao, Jiewen" , "Chaganty, Rangasai V" , "devel@edk2.groups.io" , "Kuo, Donald" , "Kumar, Chandana C" , "Palakshareddy, Lavanya C" , "Palakshareddy, Lavanya C" Subject: Re: [edk2-platforms: PATCH] Modify processor _UID ordering by CPU default fused in MADT Thread-Topic: [edk2-platforms: PATCH] Modify processor _UID ordering by CPU default fused in MADT Thread-Index: AQHYqv/r2ZAcYLKNOUeflJTgsLaFe62nge8AgAAAPwCAAAuMQA== Date: Wed, 10 Aug 2022 04:32:02 +0000 Message-ID: References: <20220808082123.1999-1-jackx.lin@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.500.17 dlp-product: dlpe-windows authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d0659e5a-4e0b-4ecf-385d-08da7a8945da x-ms-traffictypediagnostic: BN6PR11MB1331:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: m78AS3RPp3l0Ox/SXmiTMTLRkp++NEfJ/3L71xohtgUnJtVBCtiVOne/VewfyWsuxeKZuMI0d3ragdzzjN5qQRfEOJ/hMzSLKsNouR59SPIv8PUxGlZ8TnSQMyvgY+GHO/6iBCAvJzkxqOnkxX7Wpwy8nCBp7+6jHP4MNXzegefLNMhA/N6sO/M4+HU6b9D/G28x3Dl9e/2H5J/Z2aBGj7ZnY/Ubp4ZpYk5iX6wiro2D4xjX73Shg/YWa7fMtB8tPR66VrcrUt0urmwwnJpd9Anj+xRrjD/6rmmI+1ZXFeOs1+3tFMsBi8o4clgZBhXPe61fJl9YDn+u68ZceVW15/cuwwN1srRtmtl07fDTyL0I691uyuObGsfZyJ+oFuppW3oJEnvP6DywGS3SXdVNtgcfWjcFbkhj19KhNh3tos5Ypuz3a2Fn/xrpaA+nCPIB7CMbfqE/YxH3DyKObrzFmarFgVZdtrb3g2uoNEekHU8jg9+yjf0ScETMYkyoUi6g/h4Jr1M8Cj3ii7JoveqeF+m3jW2HtLqxVj4ZWblGE36VnXSWnxgI2q0rn25pULn+zRc48Irpbg4Gqt9VYfEVZf+2rLKcaWSNLtK6WVCIQZy/yM68J0a4VeeJRUJdp3cAKmqNDKa6aZwxxCskFTYZjnZYRS9w8tMXuTm/0RXy/MIJdFi/aTEiLk8PZ0+Q1VKm816bUvy9/LRTxi8OXd61muQig0uRnftvrT8rStCzv+ggGMDLd5JKt0/QCIA8UwvUqRRKBuoCCJj8bSmsHT7bZVgTNeqvtSDRFep2C9NWVCov3xoT6NWqSh1hXXb6y2/W x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB3738.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(396003)(346002)(366004)(136003)(376002)(39860400002)(66476007)(66556008)(66946007)(76116006)(107886003)(30864003)(478600001)(122000001)(5660300002)(8936002)(55016003)(86362001)(52536014)(83380400001)(66446008)(6636002)(33656002)(54906003)(71200400001)(110136005)(186003)(19627235002)(82960400001)(316002)(7696005)(6506007)(53546011)(26005)(99936003)(64756008)(41300700001)(2906002)(38070700005)(2940100002)(4326008)(8676002)(38100700002)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ygb/t2NiiRo8LwhQtGX3G7AytyrUaZil286FXAsRILUME6FkJvPFsOdG4lt6?= =?us-ascii?Q?PZOQgbVbW6xgb7Zhaz9Qpfbjkv6/pkfezf0je1JrrE3yX3TdjHCnp3VErnRV?= =?us-ascii?Q?7BR7v4fzME9MHyHsNlm7rnIiGxF7ffqEUcpEEcbLgVe4sJgy4yQTOZJNni4B?= =?us-ascii?Q?bniiWbQNlYw0oZzhP6y6IOGb6bs53bibUm+eR/o5dBwZ4KrVRQzOhei+mxJk?= =?us-ascii?Q?0uMyQQiLcvzLkxSBIM+cR0hRXCIBg8eZc2NjxI0dIlGpoacAUdMztIlP0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AGyHcY4Ml8dggRMJSgg78N/TVF5XcdSA?= =?us-ascii?Q?HBLmt9ewYD4F6E662KeJxvBdFXprkv1HX9mV5nTVLXbQ5IMCFToSM9uzGkbW?= =?us-ascii?Q?ZlZ7j8RM+tkkj9PEU8mG5fX3jZRJur6sHT/Szrr/lshrbskOz2u28RWW7Dje?= =?us-ascii?Q?UCuw6RGnfI5+jnvzt3K1mUy3wDpNGg8vOBfF44yse1/tJB+Diw3IU4q3Ec0F?= =?us-ascii?Q?30aVNs2oanYgqE1AEPCL+9JnE+IRozkIjmwC/RvcmDIgj1LlAkWI5yeVdofN?= =?us-ascii?Q?yTtpAMSR21iVJ3jAIVRH1Haju7OB41kuKpAv+wvrryl6YQtwsMoie5ltKxJR?= =?us-ascii?Q?RMLfGViCcqz7A48sCOz6OjqmvfPU7E2LkQxeWhRGaQGaVq03aueDhVp/4BMW?= =?us-ascii?Q?SCrk9GPo7DfAErmJmk0JFHvfAt6dokAPWDYMEqks?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3738.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0659e5a-4e0b-4ecf-385d-08da7a8945da X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Aug 2022 04:32:02.6915 (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: 6lJ29f8H92KUp1osQviPMV7VR3UOFzNKs3zsfyh71Cysm7k3L+DyOyhpAN5CzWbTTiQCR/nr/9lNjiJDYRzAtQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1331 Return-Path: jackx.lin@intel.com X-OriginatorOrg: intel.com X-Groupsio-MsgNum: 92279 Content-Language: en-US Content-Type: multipart/mixed; boundary="_002_DM6PR11MB373822C178375A56F7982928F1659DM6PR11MB3738namp_" --_002_DM6PR11MB373822C178375A56F7982928F1659DM6PR11MB3738namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ray, The latest patch is sent in the code review mail, and I also attach one her= e, thank you. Best regards Jack -----Original Message----- From: Lin, JackX=20 Sent: Wednesday, August 10, 2022 11:51 AM To: Ni, Ray ; Sinha, Ankit Cc: Chiu, Chasel ; Dong, Eric ;= Yao, Jiewen ; Chaganty, Rangasai V ; devel@edk2.groups.io; Kuo, Donald ; K= umar, Chandana C ; Palakshareddy, Lavanya C ; Palakshareddy, Lavanya C Subject: RE: [edk2-platforms: PATCH] Modify processor _UID ordering by CPU = default fused in MADT Hi Ray, I know this patch, and the thread 2 and 3 are added by my request for a rea= son on that time. I will re-sent the code patch. Thank you. Jack -----Original Message----- From: Ni, Ray Sent: Wednesday, August 10, 2022 11:48 AM To: Lin, JackX ; Sinha, Ankit Cc: Chiu, Chasel ; Dong, Eric ;= Yao, Jiewen ; Chaganty, Rangasai V ; devel@edk2.groups.io; Kuo, Donald ; K= umar, Chandana C ; Palakshareddy, Lavanya C ; Palakshareddy, Lavanya C Subject: RE: [edk2-platforms: PATCH] Modify processor _UID ordering by CPU = default fused in MADT Jack, Your patch cannot be merged to trunk because Ankit just did some change in = the same C file, in below commit. * MinPlatformPkg/AcpiTables: Add additional thread mapping in MADT Ankit, It seems your patch is to add support for thread #2 and #3. Jack's patch is= to remove the additional sorting that put secondary threads after first th= reads. Do you see an issue that we remove the thread sorting logic? Thanks, Ray > -----Original Message----- > From: Lin, JackX > Sent: Monday, August 8, 2022 4:21 PM > To: devel@edk2.groups.io > Cc: Lin, JackX ; Lin, JackX=20 > ; Chiu, Chasel ; Dong,=20 > Eric ; Yao, Jiewen ; Ni,=20 > Ray ; Chaganty, Rangasai V=20 > ; Kuo, Donald ;=20 > Kumar, Chandana C ; Palakshareddy;=20 > Palakshareddy, Lavanya C > Subject: [edk2-platforms: PATCH] Modify processor _UID ordering by CPU=20 > default fused in MADT >=20 > BIOS should not reordering cpu processor_uid >=20 > Signed-off-by: JackX Lin > Cc: Chasel Chiu > Cc: Dong Eric > Cc: Jiewen Yao > Cc: Ray Ni > Cc: Rangasai V Chaganty > Cc: Donald Kuo > Cc: Chandana C Kumar > Cc: Palakshareddy, Lavanya C > Cc: JackX Lin > --- > Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 174 > +++++++++++++++++++++++++++++++++++++++------------------------------- > ---------------------------------------------------------------------- > ------------------------ > ---------- > 1 file changed, 39 insertions(+), 135 deletions(-) >=20 > diff --git > a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > index c7e87cbd7d..176e422e81 100644 > --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c > @@ -57,38 +57,9 @@ BOOLEAN mForceX2ApicId; > BOOLEAN mX2ApicEnabled; >=20 > EFI_MP_SERVICES_PROTOCOL *mMpService; > -BOOLEAN mCpuOrderSorted; > -EFI_CPU_ID_ORDER_MAP *mCpuApicIdOrderTable =3D NULL; > UINTN mNumberOfCpus =3D 0; > UINTN mNumberOfEnabledCPUs =3D 0; >=20 > - > -/** > - The function is called by PerformQuickSort to compare int values. > - > - @param[in] Left The pointer to first buffer. > - @param[in] Right The pointer to second buffer. > - > - @return -1 Buffer1 is less than Buffer2. > - @return 1 Buffer1 is greater than Buffer2. > - > -**/ > -INTN > -EFIAPI > -ApicIdCompareFunction ( > - IN CONST VOID *Left, > - IN CONST VOID *Right > - ) > -{ > - UINT32 LeftApicId; > - UINT32 RightApicId; > - > - LeftApicId =3D ((EFI_CPU_ID_ORDER_MAP *) Left)->ApicId; > - RightApicId =3D ((EFI_CPU_ID_ORDER_MAP *) Right)->ApicId; > - > - return (LeftApicId > RightApicId)? 1 : (-1); -} > - > /** > Print Cpu Apic ID Table >=20 > @@ -116,7 +87,8 @@ DebugDisplayReOrderTable ( EFI_STATUS=20 > AppendCpuMapTableEntry ( > IN VOID *ApicPtr, > - IN UINT32 LocalApicCounter > + IN UINT32 LocalApicCounter, > + IN EFI_CPU_ID_ORDER_MAP *CpuApicIdOrderTable > ) > { > EFI_STATUS Status; > @@ -131,9 +103,9 @@ AppendCpuMapTableEntry ( >=20 > if(Type =3D=3D EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC) { > if(!mX2ApicEnabled) { > - LocalApicPtr->Flags =3D > (UINT8)mCpuApicIdOrderTable[LocalApicCounter].Flags; > - LocalApicPtr->ApicId =3D > (UINT8)mCpuApicIdOrderTable[LocalApicCounter].ApicId; > - LocalApicPtr->AcpiProcessorUid =3D > (UINT8)mCpuApicIdOrderTable[LocalApicCounter].AcpiProcessorUid; > + LocalApicPtr->Flags =3D > (UINT8)CpuApicIdOrderTable[LocalApicCounter].Flags; > + LocalApicPtr->ApicId =3D > (UINT8)CpuApicIdOrderTable[LocalApicCounter].ApicId; > + LocalApicPtr->AcpiProcessorUid =3D > (UINT8)CpuApicIdOrderTable[LocalApicCounter].AcpiProcessorUid; > } else { > LocalApicPtr->Flags =3D 0; > LocalApicPtr->ApicId =3D 0xFF; > @@ -142,9 +114,9 @@ AppendCpuMapTableEntry ( > } > } else if(Type =3D=3D EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC) { > if(mX2ApicEnabled) { > - LocalX2ApicPtr->Flags =3D > (UINT8)mCpuApicIdOrderTable[LocalApicCounter].Flags; > - LocalX2ApicPtr->X2ApicId =3D > mCpuApicIdOrderTable[LocalApicCounter].ApicId; > - LocalX2ApicPtr->AcpiProcessorUid =3D > mCpuApicIdOrderTable[LocalApicCounter].AcpiProcessorUid; > + LocalX2ApicPtr->Flags =3D > (UINT8)CpuApicIdOrderTable[LocalApicCounter].Flags; > + LocalX2ApicPtr->X2ApicId =3D > CpuApicIdOrderTable[LocalApicCounter].ApicId; > + LocalX2ApicPtr->AcpiProcessorUid =3D > CpuApicIdOrderTable[LocalApicCounter].AcpiProcessorUid; > } else { > LocalX2ApicPtr->Flags =3D 0; > LocalX2ApicPtr->X2ApicId =3D (UINT32)-1; > @@ -159,32 +131,25 @@ AppendCpuMapTableEntry ( >=20 > } >=20 > +/** > + Collect all processors information and create a Cpu Apic Id table. > + > + @param[in] CpuApicIdOrderTable Buffer to store information of C= pu. > +**/ > EFI_STATUS > -SortCpuLocalApicInTable ( > - VOID > +CreateCpuLocalApicInTable ( > + IN EFI_CPU_ID_ORDER_MAP *CpuApicIdOrderTable > ) > { > EFI_STATUS Status; > EFI_PROCESSOR_INFORMATION ProcessorInfoBuffer; > UINT32 Index; > UINT32 CurrProcessor; > - UINT32 BspApicId; > - EFI_CPU_ID_ORDER_MAP TempVal; > EFI_CPU_ID_ORDER_MAP *CpuIdMapPtr; > - UINT32 CoreThreadMask; > - EFI_CPU_ID_ORDER_MAP *TempCpuApicIdOrderTable; > UINT32 Socket; >=20 > - Index =3D 0; > Status =3D EFI_SUCCESS; >=20 > - if (mCpuOrderSorted) { > - return Status; > - } > - > - TempCpuApicIdOrderTable =3D AllocateZeroPool (mNumberOfCpus * sizeof=20 > (EFI_CPU_ID_ORDER_MAP)); > - CoreThreadMask =3D (UINT32) ((1 << mNumOfBitShift) - 1); > - > for (CurrProcessor =3D 0, Index =3D 0; CurrProcessor < mNumberOfCpus; > CurrProcessor++, Index++) { > Status =3D mMpService->GetProcessorInfo ( > mMpService, @@ -192,7 +157,7 @@=20 > SortCpuLocalApicInTable ( > &ProcessorInfoBuffer > ); >=20 > - CpuIdMapPtr =3D (EFI_CPU_ID_ORDER_MAP *) > &TempCpuApicIdOrderTable[Index]; > + CpuIdMapPtr =3D (EFI_CPU_ID_ORDER_MAP *) > &CpuApicIdOrderTable[Index]; > if ((ProcessorInfoBuffer.StatusFlag & PROCESSOR_ENABLED_BIT) !=3D 0)= { > CpuIdMapPtr->ApicId =3D (UINT32)ProcessorInfoBuffer.ProcessorId; > CpuIdMapPtr->Thread =3D ProcessorInfoBuffer.Location.Thread; > @@ -214,89 +179,26 @@ SortCpuLocalApicInTable ( > } //end if PROC ENABLE > } //end for CurrentProcessor >=20 > - //keep for debug purpose > - DEBUG ((DEBUG_INFO, "::ACPI:: APIC ID Order Table Init. > CoreThreadMask =3D %x, mNumOfBitShift =3D %x\n", CoreThreadMask,=20 > mNumOfBitShift)); > - DebugDisplayReOrderTable (TempCpuApicIdOrderTable); > - > // > // Get Bsp Apic Id > // > - BspApicId =3D GetApicId (); > - DEBUG ((DEBUG_INFO, "BspApicId - 0x%x\n", BspApicId)); > - > - // > - //check to see if 1st entry is BSP, if not swap it > - // > - if (TempCpuApicIdOrderTable[0].ApicId !=3D BspApicId) { > - for (Index =3D 0; Index < mNumberOfCpus; Index++) { > - if ((TempCpuApicIdOrderTable[Index].Flags =3D=3D 1) && > (TempCpuApicIdOrderTable[Index].ApicId =3D=3D BspApicId)) { > - CopyMem (&TempVal, &TempCpuApicIdOrderTable[Index], sizeof > (EFI_CPU_ID_ORDER_MAP)); > - CopyMem (&TempCpuApicIdOrderTable[Index], > &TempCpuApicIdOrderTable[0], sizeof (EFI_CPU_ID_ORDER_MAP)); > - CopyMem (&TempCpuApicIdOrderTable[0], &TempVal, sizeof > (EFI_CPU_ID_ORDER_MAP)); > - break; > - } > - } > - > - if (mNumberOfCpus <=3D Index) { > - DEBUG ((DEBUG_ERROR, "Asserting the SortCpuLocalApicInTable Index > Bufferflow\n")); > - return EFI_INVALID_PARAMETER; > - } > - } > - > - // > - // 1. Sort TempCpuApicIdOrderTable, > - // sort it by using ApicId from minimum to maximum (Socket0 to Sock= etN), > and the BSP must in the fist location of the table. > - // So, start sorting the table from the second element and total el= ements > are mNumberOfCpus-1. > - // > - PerformQuickSort ((TempCpuApicIdOrderTable + 1), (mNumberOfCpus -=20 > 1), sizeof (EFI_CPU_ID_ORDER_MAP), (SORT_COMPARE)=20 > ApicIdCompareFunction); > - > - // > - // 2. Sort and map the primary threads to the front of the=20 > CpuApicIdOrderTable > - // > - for (CurrProcessor =3D 0, Index =3D 0; Index < mNumberOfCpus; Index++)= { > - if ((TempCpuApicIdOrderTable[Index].Thread) =3D=3D 0) { // primary t= hread > - CopyMem (&mCpuApicIdOrderTable[CurrProcessor], > &TempCpuApicIdOrderTable[Index], sizeof (EFI_CPU_ID_ORDER_MAP)); > - CurrProcessor++; > - } > - } > + DEBUG ((DEBUG_INFO, "BspApicId - 0x%x\n", GetApicId ())); >=20 > - // > - // 3. Sort and map the second threads to the middle of the=20 > CpuApicIdOrderTable > - // > - for (Index =3D 0; Index < mNumberOfCpus; Index++) { > - if ((TempCpuApicIdOrderTable[Index].Thread) =3D=3D 1) { //second thr= ead > - CopyMem (&mCpuApicIdOrderTable[CurrProcessor], > &TempCpuApicIdOrderTable[Index], sizeof (EFI_CPU_ID_ORDER_MAP)); > - CurrProcessor++; > - } > - } >=20 > // > - // 4. Sort and map the not enabled threads to the bottom of the=20 > CpuApicIdOrderTable > - // > - for (Index =3D 0; Index < mNumberOfCpus; Index++) { > - if (TempCpuApicIdOrderTable[Index].Flags =3D=3D 0) { // not enabled > - CopyMem (&mCpuApicIdOrderTable[CurrProcessor], > &TempCpuApicIdOrderTable[Index], sizeof (EFI_CPU_ID_ORDER_MAP)); > - CurrProcessor++; > - } > - } > - > - // > - // 5. Re-assign AcpiProcessorId for AcpiProcessorUid uses purpose. > + // Fill in AcpiProcessorUid. > // > for (Socket =3D 0; Socket < FixedPcdGet32 (PcdMaxCpuSocketCount); > Socket++) { > for (CurrProcessor =3D 0, Index =3D 0; CurrProcessor < mNumberOfCpus= ; > CurrProcessor++) { > - if (mCpuApicIdOrderTable[CurrProcessor].Flags && > (mCpuApicIdOrderTable[CurrProcessor].SocketNum =3D=3D Socket)) { > - mCpuApicIdOrderTable[CurrProcessor].AcpiProcessorUid =3D > (mCpuApicIdOrderTable[CurrProcessor].SocketNum << mNumOfBitShift) +=20 > Index; > + if (CpuApicIdOrderTable[CurrProcessor].Flags && > (CpuApicIdOrderTable[CurrProcessor].SocketNum =3D=3D Socket)) { > + CpuApicIdOrderTable[CurrProcessor].AcpiProcessorUid =3D > (CpuApicIdOrderTable[CurrProcessor].SocketNum << mNumOfBitShift) +=20 > Index; > Index++; > } > } > } >=20 > - //keep for debug purpose > - DEBUG ((DEBUG_INFO, "APIC ID Order Table ReOrdered\n")); > - DebugDisplayReOrderTable (mCpuApicIdOrderTable); > - > - mCpuOrderSorted =3D TRUE; > + DEBUG ((DEBUG_INFO, "::ACPI:: APIC ID Order Table Init. > mNumOfBitShift =3D %x\n", mNumOfBitShift)); > + DebugDisplayReOrderTable (CpuApicIdOrderTable); >=20 > return Status; > } > @@ -750,6 +652,7 @@ InstallMadtFromScratch ( > EFI_ACPI_6_3_LOCAL_APIC_NMI_STRUCTURE LocalApciNmiStruct= ; > EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE > ProcLocalX2ApicStruct; > EFI_ACPI_6_3_LOCAL_X2APIC_NMI_STRUCTURE > LocalX2ApicNmiStruct; > + EFI_CPU_ID_ORDER_MAP *CpuApicIdOrderTab= le; > STRUCTURE_HEADER **MadtStructs; > UINTN MaxMadtStructCount= ; > UINTN MadtStructsIndex; > @@ -760,18 +663,19 @@ InstallMadtFromScratch ( >=20 > MadtStructs =3D NULL; > NewMadtTable =3D NULL; > + CpuApicIdOrderTable =3D NULL; > MaxMadtStructCount =3D 0; >=20 > - mCpuApicIdOrderTable =3D AllocateZeroPool (mNumberOfCpus * sizeof=20 > (EFI_CPU_ID_ORDER_MAP)); > - if (mCpuApicIdOrderTable =3D=3D NULL) { > - DEBUG ((DEBUG_ERROR, "Could not allocate mCpuApicIdOrderTable > structure pointer array\n")); > + CpuApicIdOrderTable =3D AllocateZeroPool (mNumberOfCpus * sizeof > (EFI_CPU_ID_ORDER_MAP)); > + if (CpuApicIdOrderTable =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "Could not allocate CpuApicIdOrderTable > structure pointer array\n")); > return EFI_OUT_OF_RESOURCES; > } >=20 > // Call for Local APIC ID Reorder > - Status =3D SortCpuLocalApicInTable (); > + Status =3D CreateCpuLocalApicInTable (CpuApicIdOrderTable); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "SortCpuLocalApicInTable failed: %r\n", Status)= ); > + DEBUG ((DEBUG_ERROR, "CreateCpuLocalApicInTable failed: %r\n", > Status)); > goto Done; > } >=20 > @@ -824,10 +728,10 @@ InstallMadtFromScratch ( > // APIC ID as a UINT8, use a processor local APIC structure. Otherwi= se, > // use a processor local x2APIC structure. > // > - if (!mX2ApicEnabled && mCpuApicIdOrderTable[Index].ApicId < > MAX_UINT8) { > - ProcLocalApicStruct.Flags =3D (UINT8) > mCpuApicIdOrderTable[Index].Flags; > - ProcLocalApicStruct.ApicId =3D (UINT8) > mCpuApicIdOrderTable[Index].ApicId; > - ProcLocalApicStruct.AcpiProcessorUid =3D (UINT8) > mCpuApicIdOrderTable[Index].AcpiProcessorUid; > + if (!mX2ApicEnabled && CpuApicIdOrderTable[Index].ApicId < > MAX_UINT8) { > + ProcLocalApicStruct.Flags =3D (UINT8) > CpuApicIdOrderTable[Index].Flags; > + ProcLocalApicStruct.ApicId =3D (UINT8) > CpuApicIdOrderTable[Index].ApicId; > + ProcLocalApicStruct.AcpiProcessorUid =3D (UINT8) > CpuApicIdOrderTable[Index].AcpiProcessorUid; >=20 > ASSERT (MadtStructsIndex < MaxMadtStructCount); > Status =3D CopyStructure ( > @@ -835,10 +739,10 @@ InstallMadtFromScratch ( > (STRUCTURE_HEADER *) &ProcLocalApicStruct, > &MadtStructs[MadtStructsIndex++] > ); > - } else if (mCpuApicIdOrderTable[Index].ApicId !=3D 0xFFFFFFFF) { > - ProcLocalX2ApicStruct.Flags =3D (UINT8) > mCpuApicIdOrderTable[Index].Flags; > - ProcLocalX2ApicStruct.X2ApicId =3D > mCpuApicIdOrderTable[Index].ApicId; > - ProcLocalX2ApicStruct.AcpiProcessorUid =3D > mCpuApicIdOrderTable[Index].AcpiProcessorUid; > + } else if (CpuApicIdOrderTable[Index].ApicId !=3D 0xFFFFFFFF) { > + ProcLocalX2ApicStruct.Flags =3D (UINT8) > CpuApicIdOrderTable[Index].Flags; > + ProcLocalX2ApicStruct.X2ApicId =3D > CpuApicIdOrderTable[Index].ApicId; > + ProcLocalX2ApicStruct.AcpiProcessorUid =3D > CpuApicIdOrderTable[Index].AcpiProcessorUid; >=20 > ASSERT (MadtStructsIndex < MaxMadtStructCount); > Status =3D CopyStructure ( > @@ -1033,8 +937,8 @@ Done: > FreePool (NewMadtTable); > } >=20 > - if (mCpuApicIdOrderTable !=3D NULL) { > - FreePool (mCpuApicIdOrderTable); > + if (CpuApicIdOrderTable !=3D NULL) { > + FreePool (CpuApicIdOrderTable); > } >=20 > return Status; > -- > 2.32.0.windows.2 --_002_DM6PR11MB373822C178375A56F7982928F1659DM6PR11MB3738namp_ Content-Type: application/octet-stream; name="0001-Modify-processor-_UID-ordering-by-CPU-default-fused-.patch" Content-Description: 0001-Modify-processor-_UID-ordering-by-CPU-default-fused-.patch Content-Disposition: attachment; filename="0001-Modify-processor-_UID-ordering-by-CPU-default-fused-.patch"; size=14520; creation-date="Wed, 10 Aug 2022 04:31:00 GMT"; modification-date="Wed, 10 Aug 2022 04:32:01 GMT" Content-Transfer-Encoding: base64 RnJvbSA0ZGU0OTczNTA0Yzg2OWU0MGNjYmNkMGJlYzc0NmJjZjYwNDdhMmRkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKYWNrWCBMaW4gPGphY2t4LmxpbkBpbnRlbC5jb20+CkRhdGU6 IFdlZCwgMTAgQXVnIDIwMjIgMTI6MjQ6MDkgKzA4MDAKU3ViamVjdDogW2VkazItcGxhdGZvcm1z OiBQQVRDSF0gTW9kaWZ5IHByb2Nlc3NvciBfVUlEIG9yZGVyaW5nIGJ5IENQVSBkZWZhd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gTG9jYWxYMkFwaWNQdHItPkZsYWdzICAgICAgICAgICAgPSAwOw0KICAgICAgIExv Y2FsWDJBcGljUHRyLT5YMkFwaWNJZCAgICAgICAgID0gKFVJTlQzMiktMTsNCkBAIC0xNTksMzIg KzEzMSwyNSBAQCBBcHBlbmRDcHVNYXBUYWJsZUVudHJ5ICgKIA0KIH0NCiANCisvKioNCisgIENv bGxlY3QgYWxsIHByb2Nlc3NvcnMgaW5mb3JtYXRpb24gYW5kIGNyZWF0ZSBhIENwdSBBcGljIElk IHRhYmxlLg0KKw0KKyAgQHBhcmFtW2luXSAgQ3B1QXBpY0lkT3JkZXJUYWJsZSAgICAgICBCdWZm ZXIgdG8gc3RvcmUgaW5mb3JtYXRpb24gb2YgQ3B1Lg0KKyoqLw0KIEVGSV9TVEFUVVMNCi1Tb3J0 Q3B1TG9jYWxBcGljSW5UYWJsZSAoDQotICBWT0lEDQorQ3JlYXRlQ3B1TG9jYWxBcGljSW5UYWJs ZSAoDQorICBJTiBFRklfQ1BVX0lEX09SREVSX01BUCAqQ3B1QXBpY0lkT3JkZXJUYWJsZQ0KICAg KQ0KIHsNCiAgIEVGSV9TVEFUVVMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0YXR1 czsNCiAgIEVGSV9QUk9DRVNTT1JfSU5GT1JNQVRJT04gICAgICAgICAgICAgICAgIFByb2Nlc3Nv ckluZm9CdWZmZXI7DQogICBVSU5UMzIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBJbmRleDsNCiAgIFVJTlQzMiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEN1 cnJQcm9jZXNzb3I7DQotICBVSU5UMzIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICBCc3BBcGljSWQ7DQotICBFRklfQ1BVX0lEX09SREVSX01BUCAgICAgICAgICAgICAgICAgICAg ICBUZW1wVmFsOw0KICAgRUZJX0NQVV9JRF9PUkRFUl9NQVAgICAgICAgICAgICAgICAgICAgICAg KkNwdUlkTWFwUHRyOw0KLSAgVUlOVDMyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgQ29yZVRocmVhZE1hc2s7DQotICBFRklfQ1BVX0lEX09SREVSX01BUCAgICAgICAgICAgICAg ICAgICAgICAqVGVtcENwdUFwaWNJZE9yZGVyVGFibGU7DQogICBVSU5UMzIgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBTb2NrZXQ7DQogDQotICBJbmRleCAgICAgID0gMDsNCiAg IFN0YXR1cyAgICAgPSBFRklfU1VDQ0VTUzsNCiANCi0gIGlmIChtQ3B1T3JkZXJTb3J0ZWQpIHsN Ci0gICAgcmV0dXJuIFN0YXR1czsNCi0gIH0NCi0NCi0gIFRlbXBDcHVBcGljSWRPcmRlclRhYmxl ID0gQWxsb2NhdGVaZXJvUG9vbCAobU51bWJlck9mQ3B1cyAqIHNpemVvZiAoRUZJX0NQVV9JRF9P UkRFUl9NQVApKTsNCi0gIENvcmVUaHJlYWRNYXNrID0gKFVJTlQzMikgKCgxIDw8IG1OdW1PZkJp dFNoaWZ0KSAtIDEpOw0KLQ0KICAgZm9yIChDdXJyUHJvY2Vzc29yID0gMCwgSW5kZXggPSAwOyBD dXJyUHJvY2Vzc29yIDwgbU51bWJlck9mQ3B1czsgQ3VyclByb2Nlc3NvcisrLCBJbmRleCsrKSB7 DQogICAgIFN0YXR1cyA9IG1NcFNlcnZpY2UtPkdldFByb2Nlc3NvckluZm8gKA0KICAgICAgICAg ICAgICAgICAgICAgICAgICAgIG1NcFNlcnZpY2UsDQpAQCAtMTkyLDcgKzE1Nyw3IEBAIFNvcnRD cHVMb2NhbEFwaWNJblRhYmxlICgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICZQcm9jZXNz b3JJbmZvQnVmZmVyDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgKTsNCiANCi0gICAgQ3B1 SWRNYXBQdHIgPSAoRUZJX0NQVV9JRF9PUkRFUl9NQVA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