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.web11.4784.1685678155736823426 for ; Thu, 01 Jun 2023 20:55:56 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Lh6I8Ow0; spf=pass (domain: intel.com, ip: 192.55.52.93, 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=1685678155; x=1717214155; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=s51bzOa6SFYt7WNqfnO2nXdbQcPanbBuQQZXxzIfhRA=; b=Lh6I8Ow0kPfoW+sZY+NoNmRFAqpQOFjdcXQmIdLQJIWzHPhLAXPmcjzC aZ9Fcj2fgMljkmmBtocoqiC+1FH5sFuQt29XesNJ164JIfg2QnvTAn8EP WAsKRnWSMo2wuWcEluKwjrK4TSjwXGA/32H78OV0U0mfO1Uev2wmmuCPA FmW2jrM71g7rysZsK8ihT5wAanw38rL9K429U1oMg1rtswX+HZsd9ZFhT QBYEFgSAlv204/UKbduH85KUPAirc9sQbBGwBEBBLyIps01TJcht0F8Qw JWrtndazncWaw/23o19AcRnpTpf6ggyQ8BiiIwHybmYwbNHYHCmDZi0wI w==; X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="353253713" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="353253713" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2023 20:55:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10728"; a="831813430" X-IronPort-AV: E=Sophos;i="6.00,211,1681196400"; d="scan'208";a="831813430" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga004.jf.intel.com with ESMTP; 01 Jun 2023 20:55:54 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 1 Jun 2023 20:55:53 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 1 Jun 2023 20:55:52 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.2507.23 via Frontend Transport; Thu, 1 Jun 2023 20:55:52 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.46) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Thu, 1 Jun 2023 20:55:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IFBG75uv7coEweO5ZRaCwMrG3x18TJB7Inutb/QtrtbGR0kkHqwspFY1DOBWzbuo2O9TnbKFS0X9pJbsYswsszAClXz4Ka3YySBxqZe+1Ah9S5nV7W6v+iyIsOvBRXscdvU0ovMWXPHJRcmA4QdpnMtf72mO+aLY7MCucf5fQfxi7GQzdVPhwwW9VDfCaTTnwLMN5pnrUiQB47qBPG5xnlYjp4Namo9FxWZbpYqsm5nYmzLKfJqgATlKMkMLSPKxpD9L00HkXLRda0a/ncstiSvesRgQO3glqpHoXSDFBMDi2tXn/6dpP6cdo4loLbNwSvDCu1Zt/PxILt04mQh7nQ== 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=q+BQf/oGTPPJe+xD+ozQ28m51VFxJnm8SjSESj6p6rk=; b=MvieZCfmIygWmWmopflufLgA76LIWT87bBRpQkLC0QcjpNSzOTYMfhVEawlHChLHzDmfnBuV0kv3/O2Rsl8FJNtRcMNIqDDBHqWTqVIEKLi7oPubuW8haSF2CvIUlxlSkN4MuQr7vt1nRoypS6fqqThJqhuEbL7Hzak5NZ987lKcvaneGKIoPa7mh2sPZoq+Hw5Fjywxv/TVWnrF1/afsHJr4xcX0OeXl2Volzj0twapI75P30kaxQpCPcpFYu70cbtKc4hTM7UclAexk6hHLAf3wMDEGMoA2/hRw5l7ldC9/X63eoF4tDmNKt2jypYX2bFhY2fTuj2vhWtkaHKNgA== 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 MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by PH8PR11MB7096.namprd11.prod.outlook.com (2603:10b6:510:214::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22; Fri, 2 Jun 2023 03:55:44 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d%3]) with mapi id 15.20.6455.020; Fri, 2 Jun 2023 03:55:39 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann Subject: Re: [Patch V4 15/15] UefiCpuPkg/PiSmmCpuDxeSmm: Remove unnecessary function Thread-Topic: [Patch V4 15/15] UefiCpuPkg/PiSmmCpuDxeSmm: Remove unnecessary function Thread-Index: AQHZh91pkOyQqyzIqUWH05bFZqTHK692/GrQ Date: Fri, 2 Jun 2023 03:55:39 +0000 Message-ID: References: <20230516095932.1525-1-dun.tan@intel.com> <20230516095932.1525-16-dun.tan@intel.com> In-Reply-To: <20230516095932.1525-16-dun.tan@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-traffictypediagnostic: MN6PR11MB8244:EE_|PH8PR11MB7096:EE_ x-ms-office365-filtering-correlation-id: 995a1257-68bd-48aa-cdaf-08db631d3af9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Z5Z44tgvKIUzkxPTz4dyiqk6kJsEYsKk5l1s/YT5ce7/RQr+JzArQuwOTt/b4i96deNirnaiiICbQIXZ7Zkh+r+ZyNj6FlinG/bg00uPMdLM4vUuMLDfhfESvF0ZUV/AhG9AUL2oMmye8dhS7UcuvoI/ygKmxn/ONol3mr+ECJSXe1CMKG9cImnXa+ds92MUx5u/L0PpVWEw8DEDEpWUv7XuFKKbCUPv578Yp1urzQkiId/nPq2yxbSKcjZjIwyDEUztP5Q4njjYVEqofRquF+6hLguVDetoZAzeBASuoha5Jb4hHDI4/wBa6ojkfjQzhu+G/Yf4elFngx/RvT+UWQI5dQz973zj82DMwyNu9h1WnOyMSnexv3suQsPrB/3HlZuUrkpTXErleLoTRXzF4WEOtQmx8tJPGIoOkXAoA3ApwmuX1ADt1onabIJbzWvhGpl92GmiGZtUoK4CsN+gej1c01NpAOIHYIPboQ2payWHX+htlKfVU5Q1bAT+nPbi2JmJQqbWotHVTzkT07kgXXRoS81SZF5IWf/2eoYl0h1lnYYtWX2V2x8uKtYjS6qNJcrtSjXli0yqk6Q29nGyULAxU5akUrTBVbF0JO0WkN7X+2H61wT7n4eRtbWOleHD x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(6029001)(346002)(39860400002)(366004)(396003)(376002)(136003)(451199021)(122000001)(38100700002)(83380400001)(110136005)(86362001)(478600001)(4326008)(64756008)(76116006)(66946007)(66556008)(66476007)(66446008)(2906002)(54906003)(186003)(7696005)(53546011)(71200400001)(6506007)(9686003)(316002)(82960400001)(52536014)(5660300002)(26005)(8936002)(55016003)(8676002)(38070700005)(41300700001)(33656002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?7KuCrU7uG7PjK7ILE4fSUP7XDfKeFlCxIRukp5mhm0L1idVYfNUHK9/fk5gD?= =?us-ascii?Q?PRVxzEKLizn6xo8BMxv2CPupEEF8upr9vpvVxQvUsO+m43MwBnn3/VX+b1OR?= =?us-ascii?Q?+KP+yglIsz2JX6a8c2qUwiJSJaAcFskxU0pj55nT43Js1tNiD1xmS0H+LOPq?= =?us-ascii?Q?9cNaYTsbxRmnTdNc9bxX6RoOUkEnOVQUVhBr8BO5722Q2nLRpcXTAEhf6Czr?= =?us-ascii?Q?gUe7hm+iNUtRqXPZH997xWUWl2cc4iTyXMUqP6HCJEBqbshjGoZXTq5+bKNf?= =?us-ascii?Q?KFb9oht4AmEzzPGuRUPdZNDSjMdaIOBcIlAHZYiqIqHQ91NPeY7DlOPXza4P?= =?us-ascii?Q?33WQBTTSPM2CBWdrIZsDAe9K3++6E2NcWDVUGtku7O4hnajZZ+DCIY0IEKeY?= =?us-ascii?Q?y8ZZScu6pWcooz7pMW0aiFvdBO+NhcnaiSJXijPsAJNQEIRTKAJWoObfPGiG?= =?us-ascii?Q?DAi+oGv2SxCa9yMhBWPtz1S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-ascii?Q?Up5U/mU9x3Kank4eF4raErcfnC52QD9Uap7xAjZ4YN8/UGE/6ftUWVwk0dtZ?= =?us-ascii?Q?mXKClWnH5bwsdMUXN4O3sdzTRhaJ1ptMwuXw3eIQ6yRlKaTg3K/H/Wblsmnu?= =?us-ascii?Q?YLU99ZGzVcHkFm3cmdhp70iLnnZ2jEgYSQCanxp+T85bPWFz9y8UVt4GS5nO?= =?us-ascii?Q?XBSizHnuBc/NdTUnJiA=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: 995a1257-68bd-48aa-cdaf-08db631d3af9 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jun 2023 03:55:39.7631 (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: SrQ/A+3JZzywQDkVeXStc+e+YncdxIay1xGBEtLcxO0aL7jV/K9JA3qflxT5iNT6Ru4lfIZ/2wcALnSzhEFOEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR11MB7096 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: Tan, Dun > Sent: Tuesday, May 16, 2023 6:00 PM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Ni, Ray ; Kumar, = Rahul > R ; Gerd Hoffmann > Subject: [Patch V4 15/15] UefiCpuPkg/PiSmmCpuDxeSmm: Remove unnecessary > function >=20 > Remove unnecessary function SetNotPresentPage(). We can directly > use ConvertMemoryPageAttributes to set a range to non-present. >=20 > Signed-off-by: Dun Tan > Cc: Eric Dong > Cc: Ray Ni > Cc: Rahul Kumar > Cc: Gerd Hoffmann > --- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 8 ++++++-- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 16 ---------------- > UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 22 ------------ > ---------- > 3 files changed, 6 insertions(+), 40 deletions(-) >=20 > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c > b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c > index d69e976269..7fa1867b63 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c > @@ -1074,10 +1074,14 @@ PiCpuSmmEntry ( > mSmmShadowStackSize > ); > if (FeaturePcdGet (PcdCpuSmmStackGuard)) { > - SetNotPresentPage ( > + ConvertMemoryPageAttributes ( > Cr3, > + mPagingMode, > (EFI_PHYSICAL_ADDRESS)(UINTN)Stacks + mSmmStackSize + > EFI_PAGES_TO_SIZE (1) + (mSmmStackSize + mSmmShadowStackSize) * Index, > - EFI_PAGES_TO_SIZE (1) > + EFI_PAGES_TO_SIZE (1), > + EFI_MEMORY_RP, > + TRUE, > + NULL > ); > } > } > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h > b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h > index 12ad86028e..0dc4d758cc 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h > @@ -1247,22 +1247,6 @@ SetShadowStack ( > IN UINT64 Length > ); >=20 > -/** > - Set not present memory. > - > - @param[in] Cr3 The page table base address. > - @param[in] BaseAddress The physical address that is the start ad= dress of a > memory region. > - @param[in] Length The size in bytes of the memory region. > - > - @retval EFI_SUCCESS The not present memory is set. > -**/ > -EFI_STATUS > -SetNotPresentPage ( > - IN UINTN Cr3, > - IN EFI_PHYSICAL_ADDRESS BaseAddress, > - IN UINT64 Length > - ); > - > /** > Initialize the shadow stack related data structure. >=20 > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > index 138ff43c9d..95de472ebf 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > @@ -752,28 +752,6 @@ SetShadowStack ( > return Status; > } >=20 > -/** > - Set not present memory. > - > - @param[in] Cr3 The page table base address. > - @param[in] BaseAddress The physical address that is the start ad= dress of a > memory region. > - @param[in] Length The size in bytes of the memory region. > - > - @retval EFI_SUCCESS The not present memory is set. > -**/ > -EFI_STATUS > -SetNotPresentPage ( > - IN UINTN Cr3, > - IN EFI_PHYSICAL_ADDRESS BaseAddress, > - IN UINT64 Length > - ) > -{ > - EFI_STATUS Status; > - > - Status =3D SmmSetMemoryAttributesEx (Cr3, mPagingMode, BaseAddress, > Length, EFI_MEMORY_RP); > - return Status; > -} > - > /** > Retrieves a pointer to the system configuration table from the SMM Sys= tem > Table > based on a specified GUID. > -- > 2.31.1.windows.1