From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.2989.1676855683407691080 for ; Sun, 19 Feb 2023 17:14:43 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=CQuGFLkA; spf=pass (domain: intel.com, ip: 192.55.52.136, 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=1676855683; x=1708391683; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=GLTGvLQ13Ou/RC1I4y2azeFU3UUaaoBCAkFVRkdYLn4=; b=CQuGFLkAe0PMNMEefUaEMGrmc8xYxhBMK/hzrniBhu1M6aFj6oL4c1GB tODn2JrGAOH/hGs23cg1z/W37qLJhbypKBElqUe6m/XZLluf5AVatnQzQ Tu4Id4nup7IW2YbC38HIuFaT5r5XkCt5H2huBSdF7mPsUzPkUSTkLwWlL 3+bKtwwNrZ9XFAlxMZ90pV+WM+/IdGk0+iZZpBJrhsAF//yLFhra/GE/Y NQDu9RAQeDo3uxG2rY8O21V92jwp9sjJF8rcLyFJYrkVEQC8YI/vnDuCK KdYHv8g0L3nd+S8xrY7meXq22NJkBZjUKVB8yb9LyCUwZ/29WGPt+NMab A==; X-IronPort-AV: E=McAfee;i="6500,9779,10626"; a="311933711" X-IronPort-AV: E=Sophos;i="5.97,311,1669104000"; d="scan'208";a="311933711" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2023 17:14:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10626"; a="845157078" X-IronPort-AV: E=Sophos;i="5.97,311,1669104000"; d="scan'208";a="845157078" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga005.jf.intel.com with ESMTP; 19 Feb 2023 17:14:42 -0800 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.16; Sun, 19 Feb 2023 17:14:42 -0800 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.16; Sun, 19 Feb 2023 17:14:41 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.16 via Frontend Transport; Sun, 19 Feb 2023 17:14:41 -0800 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.49) 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.16; Sun, 19 Feb 2023 17:14:41 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ErPqIZhgEtk7ZtOcw+KLzD24jGJeMkhGlKYvkZuyFPNCCnAHdrzQkw88WDx0OPGRYA7GaQvzGbjC1cPBPpXcuV2B/1R/wE49RpmtVi41Xzau0BfhV3lmuolIBsrtW7kyAYy6MOOylGcA1ugYqKzh2fGTZjUQt7juNxAagZr+9V4DK88miMy/Yt6/kKCeCiPJRSMztHF2Ui7UrfeqUJMiVjnvcMvvbsNMqvou6Qpwflu/Q6fwBUgaJlAHbqgxO0OyY3btdhe4aGvSl3Ttb1tmd1vudk7Hc/hXTSIzx4KFC+COOpveucUQZAbar7/0ZhwS2x0QIcqsqOXOcdol6+17hg== 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=JQYeWN0q9IXyPKuoQXEKdHOp5uII8KjVQs50/S3drUA=; b=CYFVLnrpRPy3vjfqQ9Fvqg8yu6nblRjRQqqFJis5mK88s0TU2e5jjEkVrZYNv71RaJ9r2J6DKMJNldTW8IbagnSaVn1YK+zq+nZM5XCvDogWDDCP2WJOE/wDLENtUFjd7U2MRbxmce/AFlFZDmwBolgSyENH7PAi9l5AE860f5KFOrzRq4q5cqEmHUQrnluvbhClNBqMvDs4ySEIg861q8mqQWYZg+T4A/rFIKKPswT8aRkuy1alESWgODKevYIcglb1HHdzlIZkT9FnLTBjPvtMeXddM8reR0f5LdQSbpMqB5x2bCS9e0XWPCh231eK3MTseHIsHETYwL6/MAtZ1w== 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 BN9PR11MB5403.namprd11.prod.outlook.com (2603:10b6:408:11c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.19; Mon, 20 Feb 2023 01:14:33 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::e342:cbf5:6c57:e8d6]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::e342:cbf5:6c57:e8d6%8]) with mapi id 15.20.6111.019; Mon, 20 Feb 2023 01:14:33 +0000 From: "Ni, Ray" To: "Wu, Jiaxin" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Zeng, Star" , Laszlo Ersek , Gerd Hoffmann , "Kumar, Rahul R" Subject: Re: [edk2-devel] [PATCH v9 0/6] Simplify SMM Relocation Process Thread-Topic: [edk2-devel] [PATCH v9 0/6] Simplify SMM Relocation Process Thread-Index: AQHZQc5EcXLoCsJN4UeWtoW8JeFW+q7XCm8AgAACvWA= Date: Mon, 20 Feb 2023 01:14:33 +0000 Message-ID: References: <17443983D6ED8995.20300@groups.io> In-Reply-To: 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_|BN9PR11MB5403:EE_ x-ms-office365-filtering-correlation-id: c240db11-cf99-4f9f-8659-08db12dfd333 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dcdNhEUO36XEAoWZ+evyy20mQknn1zFgqh7PODfiGOY2rRKjje9NnwqDr1VL/3q7OpF2k5rVL27NYZt144N0odW+f4D1lWslXza/CmTHTYU/pgEvOgr9agmsGmjTMJhovfaI8sX6t6TvhQBlJjlTgO978T/Jh8wq915mlu35UlwpHcNjTHyjgdp47YswCgUaZ0XVBWIlUlTacfCUD5BIhZT37r7N/9iikKbd0Ho+cf+nDrr7kj9BHWF83+f5oX/wPk/AQg8qqtX9h/xfkrnXsCiW0Tw5Tht0uNhpA3LTSivDpM0YvCUh08hH+d8klJwbB6Opdu5t4m4dnsJDarhlWHH+l94nLJ0ohWWzdQBGqj8y5Y7umoOLcnuD/8ACMS9tMdKwlrL4ETtJ4e7iCiQAQHSloclEiTaTephJaaszuyIKf+2amJQSMHgGOWMb7JJkVM397wgFhwofVGMZO6QWMGvzpSfXiDE0v9nJFD/CelDTHvurdXzhisMPBwJR2vw9Xk0ER8+R1jpQtssIklv57Y2q58TdtDlb3UgEuX2Qwu5tFaAT/JuO+OPiEiMBr4b0M3i8KybEqkJxVx9u+f2FDjOoW8kTRgFRnEX/WVf/XZjRLItj1v96ssJZibr/dDmDsKx4bjrt6BqyEkd4mJuffQ4PZKmsZ483SrMXCAyLoy2S9AWJGdnFfR1O2Lmmj50Ukotmcf2+/2BhMM8hdSNbX7lV6ZX2xE6L/aJzADCC6VY= 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:(13230025)(136003)(346002)(396003)(376002)(39850400004)(366004)(451199018)(66899018)(55016003)(966005)(83380400001)(7696005)(33656002)(38070700005)(5660300002)(8936002)(38100700002)(110136005)(54906003)(82960400001)(86362001)(122000001)(19627235002)(316002)(478600001)(9686003)(26005)(53546011)(71200400001)(6506007)(186003)(66556008)(64756008)(66476007)(66946007)(76116006)(2906002)(4326008)(66446008)(52536014)(8676002)(107886003)(41300700001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?MGQQgD1kkIOtDBBwuu7evJrT+RscDnygM8T5l+l1Srw3BJNDUcIdTEcaFRkP?= =?us-ascii?Q?1dH7BITv70TtH1e4ZHI8O9qsXmEAZnYIpq4qlzy6K/sM8NsKvU1tqcd5n+QC?= =?us-ascii?Q?EEv6cw+ASuFaHTc5o3fzNkZ7159fH8s0Js4doKMuBr7PQmm+DEiyRtkvgtZH?= =?us-ascii?Q?iiIuNXREc06R3DVozAozsAI9PC6T12wb3iPea94N6bDJT4ehiZditcvYf/X1?= =?us-ascii?Q?UyjtX7Uu9eORxDvKl4lqDhJtRDS+taBu/7tYo6lvNvpZ6HsokC8QDfv4n9hr?= =?us-ascii?Q?88uV72fcJOwBhx+Rzkej7Rk7qXxccyLY7kdiIzkhbx49gM3TkNc6If+SAHqF?= =?us-ascii?Q?WxzBQJXTMrniQXKQjQaF4yQj6g0FUg48Z0piPhblvfpx5SHpWc1RhaJDeXe5?= =?us-ascii?Q?N5ch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oUbAm?= =?us-ascii?Q?MAyxFUOS7jk+4EI+BhHeHDNTnah9pY3Y592ayg3HP72u/hXou+CsYhfJa4Pu?= =?us-ascii?Q?6w3UK6nP+lcGNCBwbiO9u+omrCKwKbpNsZFAO3OYljE4UyKexGZS9T+3J+s7?= =?us-ascii?Q?7n4/K4gmLuTAmcPNMcDQ++8M41ICpegcR3+toAkjh+UkU5lSSqg99+RUXtUy?= =?us-ascii?Q?gamzLyLABq5sSoylcoHCFkf2ILuonDZPdorHR+fTeZg3zogiqXTDrqjbJyhz?= =?us-ascii?Q?yjzOFjb4r1gQB14LsuQ=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: c240db11-cf99-4f9f-8659-08db12dfd333 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Feb 2023 01:14:33.2808 (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: G9/Xynb7ImoMYQwymflk+gdKScHX0RajcM1sSS3OIxkh9aZmxKMZ0MIZiv4tNCQi5KixRzRXQpniGHnScmPGDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5403 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 I expect Gerd at least acknowledges all patches for UefiCpuPkg. Following t= hree haven't got: * [PATCH v9 3/6] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data * [PATCH v9 4/6] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBas= e info * [PATCH v9 5/6] UefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration Thanks, Ray > -----Original Message----- > From: Wu, Jiaxin > Sent: Monday, February 20, 2023 9:07 AM > To: devel@edk2.groups.io; Wu, Jiaxin > Cc: Dong, Eric ; Ni, Ray ; Zeng, S= tar > ; Laszlo Ersek ; Gerd Hoffmann > ; Kumar, Rahul R > Subject: RE: [edk2-devel] [PATCH v9 0/6] Simplify SMM Relocation Process >=20 > Any more comments to patch series? If no objection, Ray, please help merg= e > the patches. >=20 > Thanks, > Jiaxin >=20 >=20 >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Wu, > Jiaxin > > Sent: Thursday, February 16, 2023 2:16 PM > > To: devel@edk2.groups.io > > Cc: Dong, Eric ; Ni, Ray ; Zeng, > Star > > ; Laszlo Ersek ; Gerd > Hoffmann > > ; Kumar, Rahul R > > Subject: [edk2-devel] [PATCH v9 0/6] Simplify SMM Relocation Process > > > > Existing SMBASE Relocation is in the PiSmmCpuDxeSmm driver, which > > will relocate the SMBASE of each processor by setting the SMBASE > > field in the saved state map (at offset 7EF8h) to a new value. > > The RSM instruction reloads the internal SMBASE register with the > > value in SMBASE field when each time it exits SMM. All subsequent > > SMI requests will use the new SMBASE to find the starting address > > for the SMI handler (at SMBASE + 8000h). > > > > Due to the default SMBASE for all x86 processors is 0x30000, the > > APs' 1st SMI for rebase has to be executed one by one to avoid > > the processors over-writing each other's SMM Save State Area (see > > existing SmmRelocateBases() function), which means the next AP has > > to wait for the previous AP to finish its 1st SMI, then it can call > > into its 1st SMI for rebase via Smi Ipi command, thus leading the > > existing SMBASE Relocation has to be running in series. Besides, it > > needs very complex code to handle the AP exit semaphore > > (mRebased[Index]), which will hook return address of SMM Save State > > so that semaphore code can be executed immediately after AP exits > > SMM for SMBASE relocation (see existing SemaphoreHook() function). > > > > This series is to add the new SMM Base HOB for any PEI module to do > > the SmBase relocation ahead of PiSmmCpuDxeSmm driver and store the > > relocated SmBase address in array for each Processors. When the > > SMBASE relocation happens in a PEI module, the PEI module shall > > produce the SMM_BASE_HOB in HOB database which tells the > > PiSmmCpuDxeSmm driver (runs at a later phase) about the new SMBASE > > for each CPU thread. PiSmmCpuDxeSmm driver installs the SMI handler > > at the SMM_BASE_HOB.SmBase[Index]+0x8000 for processor Index. When > > the HOB doesn't exist, PiSmmCpuDxeSmm driver shall relocate and > > program the new SMBASE itself (keep existing SMBASE Relocation way). > > > > With SMM Base Hob support, PiSmmCpuDxeSmm does not need the RSM > > instruction to do the SMBASE Relocation. SMBASE Register for each > > processors have already been programmed and all SMBASE address have > > recorded in SMM Base Hob. So the same default SMBASE Address > > (0x30000) will not be used, thus the processors over-writing each > > other's SMM Save State Area will not happen in PiSmmCpuDxeSmm driver. > > This way makes the first SMI init can be executed in parallel and save > > boot time on multi-core system. Besides, Semaphore Hook code logic > > is also not required, which will greatly simplify the SMBASE > > Relocation flow. > > > > Note: > > This is the new way that firmware can program the SMBASE > > independently of the RSM instruction. The PEI code performing > > this logic will not be open sourced, similarly to other things > > that are kept binary-only in the FSP. Due to the register > > difference in different vender, and it has not been documented > > in the Intel SDM yet, we need a new binary-only interface for > > SMM Base HOB. > > > > Cc: Eric Dong > > Cc: Ray Ni > > Cc: Zeng Star > > Cc: Laszlo Ersek > > Cc: Gerd Hoffmann > > Cc: Rahul Kumar > > Signed-off-by: Jiaxin Wu > > > > Jiaxin Wu (6): > > UefiCpuPkg/PiSmmCpuDxeSmm: Fix invalid InitializeMpSyncData call > > UefiCpuPkg/PiSmmCpuDxeSmm: Replace mIsBsp by mBspApicId check > > UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data > > UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase > info > > UefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration > > OvmfPkg/SmmCpuFeaturesLib: Check SmBase relocation supported or > not > > > > .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 10 +- > > .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 6 +- > > UefiCpuPkg/Include/Guid/SmmBaseHob.h | 75 ++++++++ > > .../Library/SmmCpuFeaturesLib/CpuFeaturesLib.h | 2 + > > .../SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c | 25 ++- > > .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 6 +- > > .../SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf | 3 +- > > UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c | 3 +- > > .../StandaloneMmCpuFeaturesLib.inf | 6 +- > > UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 31 +++- > > UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 25 ++- > > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 193 > > ++++++++++++++++----- > > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 26 ++- > > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 3 +- > > UefiCpuPkg/UefiCpuPkg.dec | 5 +- > > 15 files changed, 356 insertions(+), 63 deletions(-) > > create mode 100644 UefiCpuPkg/Include/Guid/SmmBaseHob.h > > > > -- > > 2.16.2.windows.1 > > > > > > > >=20 > >