From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.3860.1687771710610640749 for ; Mon, 26 Jun 2023 02:28:30 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=fUkO4iwr; spf=pass (domain: intel.com, ip: 134.134.136.65, 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=1687771710; x=1719307710; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=sobQF2HAIz5NAzeNLuu2nHfW1TKZyD+B5RsR8bI52Ec=; b=fUkO4iwrRKYCdb5q5sTdBa1zI1E/yz76vfvv195T/ELXHTXIrqWSbFRT 3lKyJ+GJE07u/VJXO1GQEXoUm5w36Js+/s54DG+5sWGliV8xgX9yLtPPq EleGq8mqdxw5XO4opez1zdAdZmJj15fP2KWKsIIDmF1FprWV2Q20MyySD ReaQfBwiWGB+unm3ztzSZd7CjdeRYsj8scr7Py9P9P6N8uA9NstnY59Xc vqP7bGVefGyqFgnSkGo3UuNQOlK9fkBJD2kUk818+bGvc+OmbQTmppu/6 UYg8Ul/5TLRQGR27bgwrcyrEgYHU6+zYpat4t95hmZlFOHN809FXB9o/B A==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="364673558" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="364673558" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 02:28:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="890224215" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="890224215" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga005.jf.intel.com with ESMTP; 26 Jun 2023 02:28:29 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) 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.27; Mon, 26 Jun 2023 02:28:28 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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.27; Mon, 26 Jun 2023 02:28:28 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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.27 via Frontend Transport; Mon, 26 Jun 2023 02:28:28 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.174) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Mon, 26 Jun 2023 02:28:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CN/wl4vRy5tjJP+eduKDeDypnQEGQkG04AIdryM1Q8rKzjM4QY9UZ+n34FJgrTrl7vSjA9h75c8NnWzfMveX+yJXYOLwNXeI/HXw4y3Yf0D00kl6MwP289EPZE5QVklR2U0P+4/zzuyRdTjtWpLKuH1CigjpAXQSE7p4RfhxFR8atTFtOfcf21jvRL+IQFlNMw9L1KHfNXUUCZRo9APNfBIl+lXUtQxM/lKCVzqazf2wKz5Z4UBzYFa6zqOlUniRoUSz5ei3Efq3WuRmSQfT3mI1NH9oqJNxdfJix90enS4AMEEYg6mlD1ZkAzsnFjOqIG5UeIfAn+J+UBGzQc365w== 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=9BOKNWfT2gPcE78m/68kmuBd+FPMpoe4CPgZwdXU6wc=; b=KA0/Y7wpBrC9XNx9pZwgHJsbEXOf9GsNzK29oR03YVol7C3xEmjyEl0XtUdpFDFsB5E18f8itg06fL6nFXZ4feBEfewPelVJFjMuJMw85h1AqCJWd8CK4Q36d1q4kDEl8QsurxCP0TR8iogEcMUaEBiBkt5NPLqXcW2VsC7WIBOMDY1z+Nz3+AI66NTNPb3xxxrUJyNEj65389t/xJCj3+vEm46faL76+RVgRS0vf3FjXx85X8PfxXMUkWjiuh+KrzCRsIGah7E61zKRJ8ks8qLNW0zHzdrDlb75OjsrxKyVTQqJ2DMc/z7LIxJrXPxkGpUHYFr8qza1pAbB5Cefhg== 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 MW3PR11MB4731.namprd11.prod.outlook.com (2603:10b6:303:2f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 09:28:26 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d%2]) with mapi id 15.20.6521.023; Mon, 26 Jun 2023 09:28:26 +0000 From: "Ni, Ray" To: "Xie, Yuanhao" , "devel@edk2.groups.io" CC: Gerd Hoffmann , "Dong, Eric" , "Kumar, Rahul R" , Tom Lendacky Subject: Re: [Patch V3 3/5] UefiCpuPkg: Create MpHandOff. Thread-Topic: [Patch V3 3/5] UefiCpuPkg: Create MpHandOff. Thread-Index: AQHZp/MePGhENerATEaO9njKEDBXL6+czDFA Date: Mon, 26 Jun 2023 09:28:25 +0000 Message-ID: References: <20230626055705.57145-1-yuanhao.xie@intel.com> <20230626055705.57145-4-yuanhao.xie@intel.com> In-Reply-To: <20230626055705.57145-4-yuanhao.xie@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_|MW3PR11MB4731:EE_ x-ms-office365-filtering-correlation-id: 36c63e35-2178-4435-b6b9-08db7627b173 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VBHYyVXPaCcF4KdmAokN9ox75+XNDuDh7OOIbQlV46zZpqO9Cjsgvl9NP0C+dOOX7xQ/fIZTKIskRSYPdrU6Eue3lvK1+XoBWbELNbbKc0EeAJEf6EG/SgQLsgoC/immjP08vldBmaA2+/R5ayNd6+ylrOMXroxFbM2eRrSOUJUQUuKe47MdPrOFL+j+if3ezdEnvMfW2J/mrCo2wQGVDCaLRPBYwd/WvKeJAHtiUGbWqtoFosHdDkXDxa1PelxomgKK5Ynx0Mvtt5zAGIb8LzC9+6sQFE4ngPWXBfXYdVWY1JpTbYuNx6LpsLg56PrMcraAYl93UFYbJDxRLgJN9sgQAm3p+VFEFM4CQuSrefdPvOGzbl3iHYd/v2Uu4ID1VG6EsxVPsAFmpCmrCOQBnmgtwIuA7r352EHADMULKi6Uf3Pl4NIol6s4SE6LnUgGHh6AT1B1ipSsc2PiFO1PByMIHj7LBUnhTb1LUApJQS4CigjBTmlvzkx17yf37zRDkaUS25bXKWFyzsn1xyPXhlqs5Iz+XQj+goGo/yBJZnN/hi2R8SmxLey/Xy3XEmrH8VRW/IqTDYtmmoXt+G1MYSJUCqg31UzqbnCcNlP5NuIae7lOWrBEsMG3LsyEgJjh 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)(136003)(39860400002)(396003)(376002)(366004)(451199021)(66446008)(71200400001)(7696005)(83380400001)(54906003)(110136005)(26005)(6506007)(9686003)(186003)(2906002)(478600001)(5660300002)(52536014)(33656002)(55016003)(38100700002)(122000001)(66946007)(82960400001)(4326008)(316002)(8936002)(8676002)(41300700001)(86362001)(38070700005)(76116006)(64756008)(66556008)(66476007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?daqaOVdn2iepmKasF7pV+JOw+hhG59MG2S3x+CGhf/p/p963tS0uieTw2ZUt?= =?us-ascii?Q?o49t29e/rxp8MUr5e2PLTXLW97GHuiX4xp4UG1zS7NRwB+jCXiicTbDh2AiU?= =?us-ascii?Q?S/yVUeNJlJ7+ko/fxs+7xysn4aPE/HEGB6xYdJTWpMJiB3bdDvoE9+zMXD0Q?= =?us-ascii?Q?zqd6K4HwYhf60nMhv1DqtAwR/YvRtHiJSLHOyyjISYv8UguEM5HPeApEH3UV?= =?us-ascii?Q?TYb/uEL4dwg1kzRM8EqC1H/lQZpOKVoGjcsByK4ceISo1gdHxPJEgcykeboW?= =?us-ascii?Q?t3IO0ToWoHb1+5Woxh7kvIMngBstoBwEhNOxuNrrBES/ffcwozB7tAV2TIX6?= =?us-ascii?Q?GWky/+mac/XrKeBxuoQOQP20cSaPw/VWaFSh4IWjPxs/3wbxXs4n2dGIqePJ?= =?us-ascii?Q?1b2uS/PrGhVQTc+WFJo/jlAXQRl/qLGUnR9jQY5y3sEu1xFs/Y6wSVl984IT?= =?us-ascii?Q?Sdoqiu6lmcfPUR9FRbzSxffo7tTQ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261SaWMJsrxX1dRCsM9/NsoxSmJJ2D2B8YBRPyWBs8Ya53Gki?= =?us-ascii?Q?BozZq+y2b8l5j/5VR2aJUjVNTaUsrI31wzg6NaUunCK5Q+S1K6JgABOPMiPW?= =?us-ascii?Q?pNWW5ZglZccA+8prqqm9y93obpqXcGGH2X6d+yQC0uvWxcD/XMe931IEGE/3?= =?us-ascii?Q?cZ2y+NqG+tVS3EjLneE=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: 36c63e35-2178-4435-b6b9-08db7627b173 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jun 2023 09:28:25.5459 (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: Cnb8R4c2ZVAvpFGbGl87njJXe6djSenGsjgVqEsftAAFbvaXcCAwEUY/S8O+N9X9k602rAIDuaKG+6QriL2piQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4731 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 Several comments below: >=20 > The SaveCpuMpData() function was updated to construct the MP_HAND_OFF > Hob. Additionally, the function introduced the MP_HAND_OFF_SIGNAL, > which solely served the purpose of awakening the APs > and transitioning their context from PEI to DXE. The > WaitLoopExecutionMode field indicated whether the bit mode of PEI > matched that of DXE. Both of them were filled only if the ApLoopMode > was not ApInHltLoop. In the case of ApLoopMode, it remained necessary 1. "ApLoopMode" -> "ApInHltMode"? 2. can you update commit message to highlight that this patch still sends INIT-SIPI-SIPI even AP is wait in run-loop or mwait loop? > + > +/** > + Get pointer to CPU MP Data structure from GUIDed HOB. > + > + @param[in] CpuMpData The pointer to CPU MP Data structure. > +**/ > +VOID > +AmdSevUpdateCpuMpData ( > + IN CPU_MP_DATA *CpuMpData > + ) > +{ > + CPU_MP_DATA *OldCpuMpData; > + > + OldCpuMpData =3D GetCpuMpDataFromGuidedHob (); > + > + OldCpuMpData->NewCpuMpData =3D CpuMpData; > +} 3. Can you please move this function implementation into MpInitLib/AmdSev.c= ? > +// > +// To trigger the start-up signal, BSP writes the specified > +// StartupSignalValue to the StartupSignalAddress of each processor. > +// This address is monitored by the APs, and as soon as they receive > +// the value that matches the MP_HAND_OFF_SIGNAL, they will wake up > +// and switch the context from PEI to DXE phase. > +// > +#define MP_HAND_OFF_SIGNAL SIGNATURE_32 ('M', 'P', 'H', 'O') 4. It's ok to define the signal signature here. > +#define MP_HANDOFF_GUID \ > + { \ > + 0x11e2bd88, 0xed38, 0x4abd, {0xa3, 0x99, 0x21, 0xf2, 0x5f, 0xd0, 0x7= a, 0x60 } > \ > + } 5. can you please move this GUID definition to MpInitLib/MpHandOff.h? > +// > +// The information required to transfer from the PEI phase to the > +// DXE phase is contained within the MP_HAND_OFF and > PROCESSOR_HAND_OFF. > +// If the SizeOfPointer (WaitLoopExecutionMode) of both phases are equal= , > +// and the APs is not in halt mode, > +// then the APs can be awakened by triggering the start-up > +// signal, rather than using INIT-SIPI-SIPI. > +// To trigger the start-up signal, BSP writes the specified > +// StartupSignalValue to the StartupSignalAddress of each processor. > +// This address is monitored by the APs. > +// > +typedef struct { > + UINT32 ApicId; > + UINT32 Health; > + UINT64 StartupSignalAddress; > + UINT64 StartupProcedureAddress; > +} PROCESSOR_HAND_OFF; > + > +typedef struct { > + // > + // The ProcessorIndex indicates the range of processors. If it is set = to 0, it > signifies > + // processors from 0 to CpuCount - 1. Multiple instances in the HOB li= st > describe > + // processors from ProcessorIndex to ProcessorIndex + CpuCount - 1. > + // > + UINT32 ProcessorIndex; > + UINT32 CpuCount; > + UINT32 WaitLoopExecutionMode; > + UINT32 StartupSignalValue; > + PROCESSOR_HAND_OFF Info[]; > +} MP_HAND_OFF; 6. can you please move the above 2 structure definitions to MpInitLib/MpHan= dOff.h? > + > // > // Data structure for microcode patch information > // > @@ -347,6 +391,7 @@ typedef > ); >=20 > extern EFI_GUID mCpuInitMpLibHobGuid; > +extern EFI_GUID mMpHandOffGuid; >=20 > /** > Assembly code to place AP into safe loop mode. > @@ -452,6 +497,17 @@ SaveCpuMpData ( > IN CPU_MP_DATA *CpuMpData > ); >=20 > +/** > + This function Get BspNumber. > + > + @param[in] MpHandOff Pointer to MpHandOff > + @return BspNumber > +**/ > +UINT32 > +GetBspNumber ( > + IN CONST MP_HAND_OFF *MpHandOff > + ); 7. It seems above "GetBspNumber" prototype declaration can be removed. Can = you confirm? > + > /** > Get available system memory below 1MB by specified size. >=20 > @@ -652,6 +708,16 @@ EnableDisableApWorker ( > IN UINT32 *HealthFlag OPTIONAL > ); >=20 > +/** > + Get pointer to MP_HAND_OFF GUIDed HOB. > + > + @return The pointer to MP_HAND_OFF structure. > +**/ > +MP_HAND_OFF * > +GetMpHandOffHob ( > + VOID > + ); > + 8. It seems above "GetMpHandOffHob" prototype declaration can be removed if= you implement it in front of MpInitLibInitialize() in MpLib.c. can you confirm?