From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web08.21959.1661419998662144620 for ; Thu, 25 Aug 2022 02:33:18 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=LtBslWzu; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661419998; x=1692955998; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Rv38U9UKdJM4YK8bWeScJ4oLUZvzQYDx1665TqQPcx8=; b=LtBslWzuGhvRw0kUfQUSbG2LOmXw5qvD6Hv9/BOuYNCENVF0U+kGOK5u CtBsnLS4VTiY0h4aNw8xvyyXYg7jqDlt4afuhobggFJ6Vbn+Wj43XfFV6 +pphlGogEmesWGByR1S2nLE+tDXPX+S0kGqz5SDfYYS2Yg2mm+84AIaC+ 9OsJjEhyh/ZZGaMaleqj0mP/+vzRmnUPKTZGDmPeeMRmhlKWyB6MI4RUE ztQqqd76WTe0U5OeZVvS2pqQoCGVFUY5MSTxkDMG0vOZovCBA7ExEI1tL te/1EUwS2KTsx85kmjIhzEB62hDJC/th4wjhxu+qcixo8tA2AQg5kI4Nv Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10449"; a="294974365" X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="294974365" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 02:33:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,262,1654585200"; d="scan'208";a="670907933" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga008.fm.intel.com with ESMTP; 25 Aug 2022 02:33:02 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 25 Aug 2022 02:33:01 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 25 Aug 2022 02:33:01 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Thu, 25 Aug 2022 02:33:01 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.47) 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.2375.31; Thu, 25 Aug 2022 02:33:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HS9bhZHXGVknRLIxEZ0NzPBHWjesln/E8nW7lnhiaYiAVod6xipIzu5vkGW2Fz6aP4pFu96Yqy6uKB2ogjB+Ay9RAnRJGTBVz+4kOQ/5XQCO7YOA0cTWjFJVXgCRg3mvS7u30TJuzBQyGO3sSjum/4uXwZDUV5FrHOA6sm/8OkHBH+eqO3hD2TBkkgzwuweItKo/ALTGAMCVdAvz38iy+ScVK0uu6vA1VmCMZGSYlg3VCq2JoP8Jb7xU6E/HOs5/iQKmU5L638sn/G9WfT5AG1x/JKtaN+cHtouDxqfagVy1smeGu1bxbixkHySFXRVbiRmd/Kgtn1XFt0lX0DwRdQ== 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=U0GQfEm0htxGet3X6B1ydm2x1P2QhCbkQnF564EwxQY=; b=YFIFn/4MSOUqxhCiZmnqMNJMD2RxsfEs3xadMv5n9tCiwewLe1ULH96uLPNw0/VCYBkjegsOX3tPvykHTHb86FAj1H5Q6EK7J714wRqkrLOhjVhP7pBXHaCWtCjZkomQ4fmz57kdIRrQXmj0I3B0TOPEnKY38gOk6EM+ywVlFP+/cZiv8mLG4TN4mVDRUDFO3idmb6Kh8aDkLnkPRf8X//3ykiedu83J++z0TFAtUWBcWd97CoAeW2G6HUYpXXSEej5oGT9f9l4XmNqmiiRH/sDA05xQ8MvrX9JXtmGLVXuGmNq4HiY7Gnj2DPk7Gdvix31CPEG8HjeOzNtat70xyg== 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 MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by DM5PR11MB1625.namprd11.prod.outlook.com (2603:10b6:4:b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 09:32:59 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::958b:cc9d:ac3:288a]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::958b:cc9d:ac3:288a%10]) with mapi id 15.20.5566.015; Thu, 25 Aug 2022 09:32:59 +0000 From: "Ni, Ray" To: "Liu, Zhiguang" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" Subject: Re: [PATCH] UefiCpuPkg/MpInitLib: Fix potential issue when IDT table is at above 4G Thread-Topic: [PATCH] UefiCpuPkg/MpInitLib: Fix potential issue when IDT table is at above 4G Thread-Index: AQHYuC4pYf4UcDBipUu9dpdcCgvJTq2/Wojg Date: Thu, 25 Aug 2022 09:32:59 +0000 Message-ID: References: <20220825025506.2323-1-zhiguang.liu@intel.com> <20220825025506.2323-2-zhiguang.liu@intel.com> In-Reply-To: <20220825025506.2323-2-zhiguang.liu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: c1b853e7-9523-46ee-56ac-08da867ccceb x-ms-traffictypediagnostic: DM5PR11MB1625:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tmrtLoB5t612+q7rLA/l9hOmig2Yd5X/wx2TyQl66j1SUBhK+0hz9P8jnF78KjAtCpBIppXsvP07I42U6wVuSQrR2k++PKtP1jXOBSCfJ12c7jl1y1gfJBfJil0EXjmslvDuwLiFbb4c76duR8nMkonQXaWQXTOQCPBLqZfrTbhg07JQOGhQnSyLGeTkvPTUiYlWb/inAfNmJ4E0E+hRnDpegsesG7Po5ryM+smYqDUW02qwEficvwh388vHLKhUfc02J+AwNVnpgzb6FDJ9/loIJmtNEWq/79QphEXrp5gAjwFdTOqFScICNNYZC1v9dMfdPNTF9mhER4dFRDIBDLdGRk/JelyHac//CCFy1DwCC143uIQXpiAihCniGPObtSWgYP3s7FQsq85GEgPqU7xn0sV15lSlz3gOHufhpM42KTQB/ENNPElcfYOiAGzVoHcTQB3dfss3LVM0NrNYLliJ7AAyMDJvfRPsXoqqVLr918R0vYoXyMDjayz3R6jXv5Ey8hgM0PA9luJodRcpr2JRQ0RwCwIH51uBwH1Vc2SpmmUjFXYQuvEivMTJLedwwRTAWP0IQxt618t2g3N64YlDKv2fol0yF8SXjcjMNxrF6LvvO7Ijdw5pLsLB9NlRXpjn/sYx6ojhwc8DqrKVY34/MkT2Zgk8iOMwaSNJvKjgufwTKBlkwupgT8qBQHVKNG79RUrYZ9tktafZTOqiQ/IxdmxkiKAZqcncT5OYtso9NfNk1MkcnV9kcfSHkxL+HF/murdZww8tk2Pu00ChSQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(6029001)(346002)(136003)(376002)(39860400002)(396003)(366004)(4326008)(316002)(8676002)(76116006)(66446008)(19627235002)(54906003)(110136005)(55016003)(66946007)(66476007)(38100700002)(64756008)(122000001)(2906002)(5660300002)(8936002)(52536014)(33656002)(82960400001)(41300700001)(66556008)(6506007)(26005)(86362001)(7696005)(53546011)(107886003)(38070700005)(71200400001)(9686003)(478600001)(83380400001)(186003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?6zBf3lw55xZAsdLsWZPIEYHqLeL9HT7Tu3q+21cXKmwJdIlSllQCAMmIzKAg?= =?us-ascii?Q?cc7Mvdo20nfYbwJiywS5iA7oNoVpex3s1JjthdSwYutKsFqFVWtPs9oqVo00?= =?us-ascii?Q?pS+okigjvYmifdD5OP5RSjs7dU5cnR4uHwEEl2ULdL06yKKDgBcLRvPT1Grl?= =?us-ascii?Q?p7gMvi7oDRpaR3BLLiErK9eJSPEr4GZcu12TrtJ8wFpYIQkromyzmi5FJKcz?= =?us-ascii?Q?58kPGMPnOK5DC6VSme1gm44hBigKmk9QTB/tFPxCxfGsp/6X6SLaz0ekNaPA?= =?us-ascii?Q?/p3wI3cbffDwgi3L47eNlW4fgBSEt3gUum8tZnpENCTlNHMs5AA3XfemndDF?= =?us-ascii?Q?FQaZcAqIRKEdO2tfBef9Xz8JFrF9jS2nqVXJej5fMY7b/kPAE9QwGzLDf+/z?= =?us-ascii?Q?2UOhNabG3ilrDnD5HsfHbClH68K/IxRQINLWdmKqfIC6zxQLzLapHw0svhAu?= =?us-ascii?Q?dsTgTzo5r/MYlgM+R3UnAZjy/ji3q1MmOQAFaniiya36Avbli4WAQorIxRjP?= =?us-ascii?Q?1t/PHz+q/P2fNVP5AYWLqOapJk698uNNXADIoM8evoa7YmgMUOdw9v4B85bz?= =?us-ascii?Q?R0cMbQe1V90LPAENgBrDR2I1GpRB01DX2g1e3UVHYogpm9XzYctf/Q1rTb0u?= =?us-ascii?Q?saHooYs2Eqs6juJ4OlcLXvw80ESx61yZTpIWQvQ25gtt750VzfYVT/sqkvib?= =?us-ascii?Q?y6yAPTmXujQa7gQpu/wUrV7J03TtPgDAyzx/HRpZBKCaph46ypz+xs/+kUci?= =?us-ascii?Q?t57Kpftl93MOU1shjrIlh1PC5R8Uq+36J9Y1mN5GncSRECI9xZjEbFE+E6Cp?= =?us-ascii?Q?XKpexFGBFufY6pa3OppOPdE4sYID0bmtptDhTsYvg7LlEdxa+Yscy5kA1N2X?= =?us-ascii?Q?XA9A2TByf/iZypo5znx+OEixBPa7C4/teiwsgWeUDhU1AMj5FmE/+E20HiPr?= =?us-ascii?Q?xZcxonlVKR2QjbcROj1Vfumb3YRwcVTo9l3W+Z/IVCLNANLC82F5i/vFTmQO?= =?us-ascii?Q?qZcNf/slvnG1o28TEoqjstvJiYWJQtOL6+XQtXhNF3XEofc1D7QAzD41mrA/?= =?us-ascii?Q?EcHWgNxw4K8gZYPffhC3qTmb1HU5ZND4bEw9FeKYTqcgtJUVWLTUIVaVbyNK?= =?us-ascii?Q?cCJ6jmjRkPSbwbIw1/38A3eklmVxTWQGXxqfifaf4+1qX+va2DW+kr9/izqP?= =?us-ascii?Q?zIypI15nkIYaDtX+fb3fYnolwy1QfX/cVQjpcA0KE+LjDB4s7NHg4C61huOi?= =?us-ascii?Q?4o2A/B9E9Hg2aRsJBUawB8WvfNPhTTxQwxTVUQB7HTJKue603gdBSVNWkNr4?= =?us-ascii?Q?IYNYJUExOdCzhh+SEv6W06/HUBJkQS6NEGuVlmK4X53u4PvsIKdYuTAfdPyn?= =?us-ascii?Q?Tgbl0g14qooir727OVlFo7LfiPrXcMlVPenttBGGsa8xmB0dCNKrL7gk/1Cm?= =?us-ascii?Q?NGAIlPbjuGjcngdhfu1lvD8DX0kAtLnLtVcyMnTbEg08/kBDuF+MaD2KrgMP?= =?us-ascii?Q?veJmfqTsP3Am4ZDorPekq/C2ahME7vZab0wjshlMGxfXuE7GKZkkKf1OiywI?= =?us-ascii?Q?Pm/H6v3byxmMtLMqMltp4rRByylg6FDaM/M1D9mY?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1b853e7-9523-46ee-56ac-08da867ccceb X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Aug 2022 09:32:59.8075 (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: zUw9PtS4ypZmTgL06f43VOA89iVqPAfYbFYgjuor5lNVMchFIrV4EJdD4GAdDfIMV7zzvxmgz5IOoLT4Bsk4yw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1625 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Liu, Zhiguang > Sent: Thursday, August 25, 2022 10:55 AM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang ; Dong, Eric > ; Ni, Ray ; Kumar, Rahul R > > Subject: [PATCH] UefiCpuPkg/MpInitLib: Fix potential issue when IDT table= is > at above 4G >=20 > Currently, when waking up AP, IDT table of AP will be set in 16 bit code, > and assume the IDT table base is 32 bit. However, the IDT table is create= d > by BSP. Issue will happen if the BSP allocates memory above 4G for BSP's > IDT table. Moreover, even the IDT table location is below 4G, the handler > function inside the IDT table is 64 bit, and it won't take effect until > CPU transfers to 64 bit long mode. There is no benefit to set IDT table i= n > such an early phase. > To avoid such issue, this patch moves the LIDT instruction into 64 bit > code. >=20 > Cc: Eric Dong > Cc: Ray Ni > Cc: Rahul Kumar > Signed-off-by: Zhiguang Liu > --- > UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm > b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm > index 1daaa72b1e..cd95b03da8 100644 > --- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm > +++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm > @@ -64,9 +64,6 @@ BITS 16 > mov si, MP_CPU_EXCHANGE_INFO_FIELD (GdtrProfile) > o32 lgdt [cs:si] >=20 > - mov si, MP_CPU_EXCHANGE_INFO_FIELD (IdtrProfile) > -o32 lidt [cs:si] > - > ; > ; Switch to protected mode > ; > @@ -154,6 +151,11 @@ BITS 64 >=20 > LongModeStart: > mov esi, ebx > + > + ; Set IDT table at the start of 64 bit code > + lea edi, [esi + MP_CPU_EXCHANGE_INFO_FIELD (IdtrProfile)] > + lidt [edi] > + > lea edi, [esi + MP_CPU_EXCHANGE_INFO_FIELD (InitFlag)] > cmp qword [edi], 1 ; ApInitConfig > jnz GetApicId > -- > 2.31.1.windows.1