From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.10958.1676281376976930734 for ; Mon, 13 Feb 2023 01:42:57 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=EynlR/n4; spf=pass (domain: intel.com, ip: 192.55.52.88, 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=1676281377; x=1707817377; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=9EWdkNfPLgDIVhj78nRL3Oy3G3u5yP+2dJZ6vtVK3oQ=; b=EynlR/n4fKGekhpnxvSsN+xxJAnt6zPctHY+nj1cSfEEQ52JsLLr31tX DqLcATpJoKCmfo+FC3nPmCj7vQSFAd76OX4Kc9AupARbnlyGFMjZDFqqU NAjfzafyvjR4ceC7CcouCDZR0/b5QwiB2AKuWu+a5DvxpPgKTd6vbDhTy qFYkVD12RV8ume4sVpftDm85lCfTubopyrrCpvFzlq+7WocCqi2rj2S1y c48zl++pi0be52FOX+CewLhoL5CmnysCytnDFites5A2ihEFn7Lx3JnJr VCDL1xvMY7SgM7tq/RScd1FBt835OVY7gl5+pxp7g+vJW4bD56LCIekpA Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="358261626" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="358261626" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2023 01:42:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="699129964" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="699129964" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP; 13 Feb 2023 01:42:50 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 13 Feb 2023 01:42:50 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 13 Feb 2023 01:42:50 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.108) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Mon, 13 Feb 2023 01:42:50 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bgm9IfnXD0w1HzKQ8gds92keTL7ZWYOATgIQ/1FTkXkiM/EWDJP37EF27kn76v01WWqAGu0ZKuCgV6/0PUev9j0L73ageKE9me5NCgbFp3wVwIoAvCXOXDO6iKg+U2+E/wg+wtbA61AmzkjYoTKt2/fE1swdxVdzJ2dl1DI2jB3R69Tl3gyBodSzneIXDKrVeQUIRlPhZMs73ksuFG1OZShEIJnBvdCE1tL5oMfsxVil30weplsBjdKD/9ndT8k/Ipvdx0h7UwCKTaqmNpyzv6M6+r2t9oWjv0+p+Pz7sSyPLC0BM5R14kp8A/rdUzc/p+dPshDcvC2+yy/erl7hdQ== 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=quYDAPJjbp2YTOYh8Y7e8onLfK3Nd7R21HdXMaHsR2w=; b=oBjn+7eqz/1Xa1YYxNoFNjzSjzjybj9wzrPxx1K/KVg3Vw9Bs/vA0jMUVVN6E4Ur9vnbK6OKFjbNvH1HGSy/P5i22atsDBGQ9yLtX16OuEwULsiIokd+XVjrpIccLUCXoU+DUIA3tnSUkrarozDbdPmmgpleiZF2KdPWt4KS/UslT490lxU5Y40fwmmyLBrw1I0ViVc6Y6h4vLrVUA/nKwRstL9Pg0ljyc6iyCmaMd4Cuqgwb0rSsWfJwDorEgfl6ijgLF/huADGxKQFtcb+losdV5Z0IkGynasL6jLUwh0WkgnH6OqcvQ9qpNQGyZi5QjjrzSnnxKoNKCc6f/xBjw== 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 CY5PR11MB6390.namprd11.prod.outlook.com (2603:10b6:930:39::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.24; Mon, 13 Feb 2023 09:42:48 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::f890:e4ec:e2d8:5831]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::f890:e4ec:e2d8:5831%4]) with mapi id 15.20.6086.024; Mon, 13 Feb 2023 09:42:48 +0000 From: "Ni, Ray" To: "Wu, Jiaxin" , "kraxel@redhat.com" CC: "devel@edk2.groups.io" , "Dong, Eric" , "Zeng, Star" , Laszlo Ersek , "Kumar, Rahul R" Subject: Re: [edk2-devel] [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info Thread-Topic: [edk2-devel] [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info Thread-Index: AQHZPRXvUunGC8Xwak2WQ/WGAugRZK7ICvIAgAATB5CAAAeeAIAEI9gAgABbacA= Date: Mon, 13 Feb 2023 09:42:48 +0000 Message-ID: References: <20230210060519.11100-1-jiaxin.wu@intel.com> <20230210060519.11100-4-jiaxin.wu@intel.com> <20230210112646.g6yz6put3mtarqtd@sirius.home.kraxel.org> <20230210130208.lbswcn3jnxs5inhb@sirius.home.kraxel.org> 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_|CY5PR11MB6390:EE_ x-ms-office365-filtering-correlation-id: afdb4764-c2d7-411b-7296-08db0da6aa9e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LVSid+4ApErnfBVLjm6o1TksxYqJX3cxb94WBNXHq9JRapdwJsA8MIYw4yPdewbomq2L0vIe5/6t7RuYaZgUrtIMJUMleKStp6vP0AyWo0Cu69/XEwCCspptJnaLt1PfsNQa4PE3WxyBdM8Ki4jmToDrqiFo3zdmaA3Fj5Jiu5to1BIQ9lhJH65L4RBmTwYduL92ceYMIWdtvQOSKNHaUZomQgfL9semz4jqJ0E6R4V5Xi3SBE4kxJ5hlloZMXTKAGuqDQNl8UaK7IoDxZ5ss0uMXa47WIIEg8M6Q3VPnrR6QU7efEiTp5tFulvOzq9Pd/g+BKxblP9ekUvmaJCkedLaq14/S+aNa10eyfHd68I84IMC0fOfw4cOd2Uq1yvGB8IBqfMKfekYJeWY4B3/SoaG64/eWUhqLKz286xz00udj3WFjxhZfZ8cZgoXHT0cODR+6fLOnuZfQSzXSF4LlT8VWQSsF9wBo1r+YphO6RbcJXUY2jB3IuSO3i3u+rvhYsDbqycFKMZZ3cOiqTO4XEqzTjBQr3ly7YUZwXeEehCOY8DKpVBEv4/4XAQX2Sx89x6fqp3zx/VoqXUt87+xElJNytZ9Af3VgFUqmKh2DRokzEZSI4jUUNfvU6RsFJ6Lea3gW+1POsEvr83WrgMeRB2bchITvmbZx1beyQAS+PZln0QLhGs/w73JF1F11i7cHlD7abNRt08OOrIiD5SvUQ== 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)(6029001)(376002)(396003)(346002)(366004)(136003)(39860400002)(451199018)(2906002)(5660300002)(83380400001)(55016003)(26005)(186003)(38070700005)(9686003)(122000001)(82960400001)(66946007)(38100700002)(76116006)(4326008)(8676002)(64756008)(54906003)(316002)(66446008)(66556008)(8936002)(66476007)(33656002)(41300700001)(478600001)(107886003)(53546011)(86362001)(52536014)(6506007)(110136005)(71200400001)(7696005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?4NU0MKXWoKvSO8t2Yc/pqihVOfRtlw+cxITBswxq9HI8QQLz1FMUpFru0YHS?= =?us-ascii?Q?3EFJ7KYU/vk0RaTLWoc5cb4lccJzjPz02CxagLV3VmqcZhngvzIPqQohJurh?= =?us-ascii?Q?xtCGBhbEOXkAK2kdDE1awVl/xTMPmVqfbS+nRCfipO8wB2SmN6gwb+jJec63?= =?us-ascii?Q?Dv/xww2h9ppmY+VTdLy6pELeYLqERVGnOMiYn/efJu7usRoWLXH38BOEE6jh?= =?us-ascii?Q?uLqjDpCupbRR1ZTP5NwbcR+a+m3SHwdr8q301zRpJSVX+TyaGVwL0rJZ+6aj?= =?us-ascii?Q?f56kbA1eRQk7a6HZ7xLVTCpGtBHVF0YJTLZmIuWST3aSLcgkWjgknZQkFICv?= =?us-ascii?Q?391m8WAFukJdgFS0Qo9LfjQPFhdeVlcL56mSgWOFVx/IjQ4jFd4tPeDxmtS9?= =?us-ascii?Q?PemZ6qcf0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zyj+5/ec?= =?us-ascii?Q?3nB51uVVb0c0kBE0KiYf6l80eNGfYKBY2xDOu8hZc9J6gsm+EyGwGA7otpUD?= =?us-ascii?Q?xoy3oa5QljuXqfWK7PSdBg4S8bSKGwp0EFIOeAShC3RcmJcbaCVWmcN4bDE2?= =?us-ascii?Q?gbKBLR33ECgeyoiMUzUpkQ00Gyd9ns1+AzbJdTw+FBxMN4NNw+D8i0B/Wt6G?= =?us-ascii?Q?ZnzOOKXZrMl3ypYfJDWRSI1tpr35h86T8F3AGBo3wZ83SIxBvkotBmMAfeBT?= =?us-ascii?Q?sdjjHpdg+cEsK7YrufdLR382iBDn5MwD+8vHOJvH?= 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: afdb4764-c2d7-411b-7296-08db0da6aa9e X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2023 09:42:48.0987 (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: dtUgYbrv4X9byDR7KTxjbsgHM+169uGT4TYPVWIb/eSXGNxHGUvMJFeogPlNoWLJiW9DKG9h7w71c5AMgT2SjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6390 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 Will review v6 of PiSmmCpu driver change after you two are aligned. > -----Original Message----- > From: Wu, Jiaxin > Sent: Monday, February 13, 2023 12:15 PM > To: kraxel@redhat.com; Ni, Ray > Cc: devel@edk2.groups.io; Dong, Eric ; Zeng, Star > ; Laszlo Ersek ; Kumar, Rahul R > > Subject: RE: [edk2-devel] [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: > Consume SMM Base Hob for SmBase info >=20 > Hi Gerd, >=20 > The change impact the old way of handling SMM init is only: refine the > SmmInitHandler() to handle the code for the different execution branches > (actually, it's also related to the patch purpose as I explained why remo= ving > the mIsBsp). It's fine to do this separating work. I will do that in the= next > version patch. >=20 > But for below items, they all belong to the new smbase relocation flow: >=20 > >* Assume the biggest possibility of tile size is 8k. >=20 > --- for title size, I evaluated this according your comments before, I > updated/moved it into the if condition check to avoid the old smm init im= pact. > Because the old smm init should have no such assumption. So, it has to > combine with new way handling. >=20 > GuidHob =3D GetFirstGuidHob (&gSmmBaseHobGuid); > if (GuidHob !=3D NULL) { > // > // Check whether the Required TileSize is enough. > // > if (TileSize > SIZE_8KB) { > DEBUG ((DEBUG_ERROR, "The Range of Smbase in SMRAM is not enough > -- Required TileSize =3D 0x%08x, Actual TileSize =3D 0x%08x\n", TileSize, > SIZE_8KB)); > CpuDeadLoop (); > return RETURN_BUFFER_TOO_SMALL; > } > .... > } >=20 > >* Combine 2 SMIs (gcSmmInitTemplate & gcSmiHandlerTemplate) into one > >(gcSmiHandlerTemplate), the new SMI handler needs to run to 2 paths: > >one to SmmCpuFeaturesInitializeProcessor(), the other to SMM Core > >Entry Point. >=20 > This is about the SMI handling logic with new way. Once SMI happen, there= is > only one copy of code in smbase+8000 to handling both smm relocation & > normal smi. Instead of original 2 copies of code in smbase+8000. We don't > change original smi template code. >=20 >=20 > >* Issue SMI IPI (All Excluding Self SMM IPI + BSP SMM IPI) for first > >SMI init before normal SMI sources happen. > >* Call SmmCpuFeaturesInitializeProcessor() in parallel. >=20 > Above 2 are the same for the new way to issue the smi init process within= if > condition happen. All Excluding Self SMM IPI will achieve the parallel > execution (SmmCpuFeaturesInitializeProcessor). >=20 >=20 > // > // For relocated SMBASE, some MSRs & CSRs are still required to be > configured in SMM Mode for SMM Initialization. > // Those MSRs & CSRs must be configured before normal SMI sources > happen. > // So, here is to issue SMI IPI (All Excluding Self SMM IPI + BSP SMM = IPI) to > execute first SMI init. > // > if (mSmmRelocated) { > ExecuteFirstSmiInit (); >=20 > // > // Call hook for BSP to perform extra actions in normal mode after al= l > // SMM base addresses have been relocated on all CPUs > // > SmmCpuFeaturesSmmRelocationComplete (); > } >=20 > Thanks, > Jiaxin >=20 >=20 >=20 > > -----Original Message----- > > From: kraxel@redhat.com > > Sent: Friday, February 10, 2023 9:02 PM > > To: Ni, Ray > > Cc: devel@edk2.groups.io; Wu, Jiaxin ; Dong, Eric > > ; Zeng, Star ; Laszlo Ersek > > ; Kumar, Rahul R > > Subject: Re: [edk2-devel] [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: > > Consume SMM Base Hob for SmBase info > > > > On Fri, Feb 10, 2023 at 12:37:23PM +0000, Ni, Ray wrote: > > > Gerd, > > > All the 4 are needed to make sure SMM still works. > > > > The new way (HOB present) of handling SMM init will surely require the > > whole patch series being applied. > > > > For the old way (HOB not present) of handling SMM init should be > > possible to split up into smaller pieces, which each step being > > individually testable. Specifically the SMI handler reorganization > > should be possible to split out, and I think the tiling changes too. > > > > These are preparing changes reorganizing the code, once they are in > > place the final patch adding the new code paths to handle the new SMM > > init should be relatively small. > > > > take care, > > Gerd