From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 63D11940F84 for ; Mon, 13 May 2024 02:25:15 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=E3StUtcYCjOzbbDAe6IzK7kJ0GxEuXrZmmrQRq+dGRk=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type; s=20240206; t=1715567113; v=1; b=OuIKOgkK5XU/iQNIlFQ8WtncUp8sR/tuCxMkwC5+axzHd6ixuSMwBPS55PMg6Ik7V99PLe39 FPoHINzUn4ifwf91vnAOYXEs0bFd+5b7jZjc8h2sHscjY1oFgwrcL0KODrvWZlv+eC2qms8uNmr OGYwdTO24gZARBAxty3V4Y3YBeEM5Pg/nbjoXLxD8Ck0sTF7w+otNVQZGzT1gxAN6FKz2ctE2+D sA3YJlvxfEjCwFXa3FwlxGD2G9TkuxQoL0u9CXMNjc2tSf2vXZ04XElGoVgbXvZBC1mr6GBxUM9 xJ8O7v9nlPCVJIl/NewEUtI3rw9sZgacabqW6T51/aXCg== X-Received: by 127.0.0.2 with SMTP id bt8tYY7687511xORoiUf5F3i; Sun, 12 May 2024 19:25:13 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by mx.groups.io with SMTP id smtpd.web11.51318.1715567112658581181 for ; Sun, 12 May 2024 19:25:12 -0700 X-CSE-ConnectionGUID: 84uJcYi9TTWxpHNKCEMkPA== X-CSE-MsgGUID: 6WxRfKuHQBCfyGgVQvxVJg== X-IronPort-AV: E=McAfee;i="6600,9927,11071"; a="11423520" X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208,217";a="11423520" X-Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2024 19:25:12 -0700 X-CSE-ConnectionGUID: 2ynzpoctSiC4bUJZfWhTyg== X-CSE-MsgGUID: O0/tFOhST5qqc7aZlm+6Pg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,157,1712646000"; d="scan'208,217";a="34950940" X-Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orviesa005.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 12 May 2024 19:25:12 -0700 X-Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 12 May 2024 19:25:11 -0700 X-Received: from orsedg603.ED.cps.intel.com (10.7.248.4) 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.2507.35 via Frontend Transport; Sun, 12 May 2024 19:25:11 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.170) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sun, 12 May 2024 19:25:11 -0700 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by SJ2PR11MB8537.namprd11.prod.outlook.com (2603:10b6:a03:56f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 02:25:08 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8%4]) with mapi id 15.20.7544.052; Mon, 13 May 2024 02:25:07 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: Laszlo Ersek , "Kumar, Rahul R" , Gerd Hoffmann , "Wu, Jiaxin" Subject: Re: [edk2-devel] [PATCH 11/18] UefiCpuPkg: Disable PG in IA32 ApLoopCode Thread-Topic: [PATCH 11/18] UefiCpuPkg: Disable PG in IA32 ApLoopCode Thread-Index: AQHaosIlP/ziXrqQB0OfeTXOmALUsrGUc+66 Date: Mon, 13 May 2024 02:25:07 +0000 Message-ID: References: <20240510100827.1903-1-dun.tan@intel.com> <20240510100827.1903-12-dun.tan@intel.com> In-Reply-To: <20240510100827.1903-12-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|SJ2PR11MB8537:EE_ x-ms-office365-filtering-correlation-id: c4d12eaf-7a78-4a00-57d7-08dc72f3e7df x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?+u/1Oo70qUEih2MvR8fS93PX8Tee7l6YKrzseYHyrTL4I4AIyQ9+EOyYc/yP?= =?us-ascii?Q?HbEgAbLVHuE4NYuviaXdIh5pbIzqyG+vGcWBY3f15a6UWXR7UX6msmh/VmLL?= =?us-ascii?Q?Yq3XZ+hSot8PLanCK84KHX9cR7rEFMpm8gkDA5KQRl5Ncr7IYYZhueuzpY3g?= =?us-ascii?Q?NbO6MLYIi6aBZLas9Qs8leveIE6uESwqz7Rb9/Cg05MbPp18aNK11F5qVUmS?= =?us-ascii?Q?tPw9BH9QFL3ZsU7saoIMBX8mVJldylA+GWTIbywgv9sUGq7sv7CrRQEDHXCB?= =?us-ascii?Q?ARiS9SaAY+l8C1IjpyGWiG5o3zNhNz+liqiYmM4AlltXW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EDpifSViZH9uUt?= =?us-ascii?Q?EGwAzeH0TxeNXWqax5U=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: c4d12eaf-7a78-4a00-57d7-08dc72f3e7df X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2024 02:25:07.2018 (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: InXhIuiBcRCH30iMWVIYKQDanWlfy6K2Za7orwsUGiPvf+PgCdXitKNvfsspsMlQ5lQ2O3pWUlko4Z+TZgyGLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB8537 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 Resent-Date: Sun, 12 May 2024 19:25:12 -0700 Resent-From: ray.ni@intel.com Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: hm6u7eUAwfDD1dUcHrTtBY1qx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN6PR11MB8244CDF1323FF7D6DF7CDF628CE22MN6PR11MB8244namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=OuIKOgkK; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_MN6PR11MB8244CDF1323FF7D6DF7CDF628CE22MN6PR11MB8244namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni Thanks, Ray ________________________________ From: Tan, Dun Sent: Friday, May 10, 2024 18:08 To: devel@edk2.groups.io Cc: Ni, Ray ; Laszlo Ersek ; Kumar, Ra= hul R ; Gerd Hoffmann ; Wu, Jia= xin Subject: [PATCH 11/18] UefiCpuPkg: Disable PG in IA32 ApLoopCode Disable paging in IA32 RelocateApLoop assembly code to fix the issue that the AP page table is unavailiable after boot OS under IA32 execution mode. This issue exist in IA32 PEI + IA32 DXE normal boot (also S3 boot with IA32 PEI after previous three commits are accepted). In current MpLib code, the IA32 execution mode code did not create page table in reserved memory like what X64 code did. If PcdCpuStackGuard is TRUE, the PG is enabled for AP in current RelocateApLoop assembly code. And the page table for AP is unavailiable after boot OS. This might cause potential issue. So disable PG in IA32 RelocateApLoop. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm b/UefiCpuPkg/Li= brary/MpInitLib/Ia32/MpFuncs.nasm index d117f09ef5..75b18ce56f 100644 --- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm +++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm @@ -225,6 +225,10 @@ RendezvousFunnelProcEnd: ; specific to SEV-ES support and are not applicable on IA32. ;-------------------------------------------------------------------------= ------------ AsmRelocateApLoopGenericStart: + mov eax, cr0 + btr eax, 31 ; Clear CR0.PG + mov cr0, eax ; Disable paging since the page table m= ight be unavailiable + mov eax, esp mov esp, [eax + 12] ; TopOfApStack push dword [eax] ; push return address for stack trace -- 2.31.1.windows.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 (#118842): https://edk2.groups.io/g/devel/message/118842 Mute This Topic: https://groups.io/mt/106018136/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- --_000_MN6PR11MB8244CDF1323FF7D6DF7CDF628CE22MN6PR11MB8244namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Ray Ni <ray.ni@intel.com>

Thanks,
Ray

From: Tan, Dun <dun.tan@= intel.com>
Sent: Friday, May 10, 2024 18:08
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat= .com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <= ;kraxel@redhat.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [PATCH 11/18] UefiCpuPkg: Disable PG in IA32 ApLoopCode
 
Disable paging in IA32 RelocateApLoop assembly
code to fix the issue that the AP page table is
unavailiable after boot OS under IA32 execution mode.

This issue exist in IA32 PEI + IA32 DXE normal boot
(also S3 boot with IA32 PEI after previous three commits
are accepted). In current MpLib code, the IA32 execution
mode code did not create page table in reserved memory
like what X64 code did. If PcdCpuStackGuard is TRUE, the
PG is enabled for AP in current RelocateApLoop assembly
code. And the page table for AP is unavailiable after
boot OS. This might cause potential issue. So disable PG
in IA32 RelocateApLoop.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
---
 UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm b/UefiCpuPkg/Li= brary/MpInitLib/Ia32/MpFuncs.nasm
index d117f09ef5..75b18ce56f 100644
--- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
@@ -225,6 +225,10 @@ RendezvousFunnelProcEnd:
 ;  specific to SEV-ES support and are not applicable on IA32.  ;--------------------------------------------------------------------= -----------------
 AsmRelocateApLoopGenericStart:
+    mov        eax, cr0<= br> +    btr        eax, 31&n= bsp;            ; Cl= ear CR0.PG
+    mov        cr0, eax&= nbsp;           ; Disable= paging since the page table might be unavailiable
+
     mov        eax,= esp
     mov        esp,= [eax + 12]     ; TopOfApStack
     push       dword [ea= x]         ; push return address fo= r stack trace
--
2.31.1.windows.1

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#118842) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_MN6PR11MB8244CDF1323FF7D6DF7CDF628CE22MN6PR11MB8244namp_--