From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.11843.1687943494310854176 for ; Wed, 28 Jun 2023 02:11:34 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Tr7+GfUS; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: yuanhao.xie@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687943494; x=1719479494; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Sp9LyIY1eCePHIhzUligY9/93dErMAStAMDcpr9v8cU=; b=Tr7+GfUShED6AhEXwyzvS8Ebh/8dKeNsHOcvTvNbJ4HVxkNFO0BYbBNf SrqilOTRVbw4WF+YfRLhbBMSj+BcqsECM5yQjkeCGvNB7X1fpk8pNYwpu Ln5f1CxVsChKcFQEej0V8xU6bWSJbIxzSSB0r1QDXpKXUk6pF1Mgfr6Gl AM6MeEQnbyM5R47AyiK/raNkY66teoynyylU/jhAUJoJZgK7kvhzpeONW kJNHfXMfQruG5jo/UhgmsonMtT1IsYa1auwh0s0ftnFpXRXRUqePz64dz ea/iVBmSHvFTTjnGs1h0ZXYaI9NsNbcJQF9MrwHyFYUoltpRHa6NGAtsl A==; X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="361832981" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="361832981" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 01:57:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="1047312785" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="1047312785" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 28 Jun 2023 01:57:26 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 28 Jun 2023 01:57:25 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.27; Wed, 28 Jun 2023 01:57:25 -0700 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.27 via Frontend Transport; Wed, 28 Jun 2023 01:57:25 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.108) 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.27; Wed, 28 Jun 2023 01:57:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KjG3utfzGihGun4QNcACVdF+EuVxBr/hXaE0OAsroDpaLNYjjjd3ofM8phsDnn2FLr1P6UCCjqrPm9+ozZeHOWEAMSN+HJ0jZo+WDnITAJbdPAHL1rnoGBBUSmJFxPAv9OrLXSiKSivE9ltOJk6YeHez9tRIs9tlB1j47DlzqEOS/4RmCXCjXVax27diUpFZhKY64mkvrNo810Lg1IdeJU7IqGwwz0YvywQ6xaCnHq6llLU0P26pDemcaBHptMB93kIiSBNwo+PLTLHBF4+8s83BEZd7Fi8qfTE7NiRMJGfYwxCSA+6dAX41vEvoYbWWjJxQNGi6iUiqgM6B+LK9dw== 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=f0pYwzAl1497eWZDCcmnG/uap2UIWpRFfNt4yx812rw=; b=TZ3ZiKl436B0uVd8I1hls4v98fRbweTpOxyY2aOGq8X/RCsbXBOBYLrguCWZgfyNqjpukpZfMns16/SyGPa6MpmN2DQZx69EwAT5PH/t6ThoCgMcf58u4HN6uUgQnJQzdeb+Vt2hXuwjzJueB5+5j4SYdnNr5JtVk+xnZRMw/b9wsQgDdkKK/61wg92iWdVTTAFjTn1KP9ItW0DruGcP+4WhyGIzTPz7W/H46pi3I5GSQVhLSgqcWCC8NeTBRqlaxXWZFfgcDVpj0vfj+qkOlFf89ToYSquBO5XJgPmn4aq6zkNSzTuHuvnQoN+rFKnuk9VJDIpNL/QMp+JC4UTALw== 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 CO1PR11MB5026.namprd11.prod.outlook.com (2603:10b6:303:9c::13) by CY5PR11MB6258.namprd11.prod.outlook.com (2603:10b6:930:25::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 08:57:22 +0000 Received: from CO1PR11MB5026.namprd11.prod.outlook.com ([fe80::95dc:1690:6fc8:790c]) by CO1PR11MB5026.namprd11.prod.outlook.com ([fe80::95dc:1690:6fc8:790c%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 08:57:22 +0000 From: "Yuanhao Xie" To: "Ni, Ray" CC: Gerd Hoffmann , "Dong, Eric" , "Kumar, Rahul R" , Tom Lendacky , "devel@edk2.groups.io" Subject: Re: [Patch V3 3/5] UefiCpuPkg: Create MpHandOff. Thread-Topic: [Patch V3 3/5] UefiCpuPkg: Create MpHandOff. Thread-Index: AQHZp/MeJ/Pts2dZ+0iiIIp5+FT1oq+c0TeAgAMarfA= Date: Wed, 28 Jun 2023 08:57:22 +0000 Message-ID: References: <20230626055705.57145-1-yuanhao.xie@intel.com> <20230626055705.57145-4-yuanhao.xie@intel.com> 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: CO1PR11MB5026:EE_|CY5PR11MB6258:EE_ x-ms-office365-filtering-correlation-id: 59367a24-7e8f-4da2-e076-08db77b5afdb x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: HxaU4qw4xKuS23KBK0yClgmpRYHNMz6ITEiRmnBNnEmnVlrw2fmLK2ZBTjI3uYz6LpsXGbpEJT4FCHOOtRExwtDH2gkH52SWJTfYMtxTWbuV7YD+QixQyJE2TRnj1t7Bu5OMSEjW5MqiPDPgos/s6+L1aVeDM+FZUCT31uBZpA4zKynMshQwuHE6NR3wc8wOzvrB1QjOhItT/LdBSzj1zRcs7sawpuEfPKd/yaCxfTyy/UYP5RbLwA6u/3dUwyDN/zhwQY/k/+Yrik1WMDOPkR2zBLhv06kiIG41ivRhH3X1tuFBOBbwc44fHfk42HNAdxuhAwYk5r8EENhuZl6HjTDIZsGkXWWWx+Enl57hd3pJDVjJdJNPtQXBW6+7JgfFApTn0SoRTvpn+bfdJRgGwGUCBjfIvLM+icBATdbqojpr6cBkwmpzhF/7zWgpqpKTJ+JtTJCD0ovNRACQD0tOujfxQXMSrFaPKIEjahzgHqpubRQ2tEFKyCKC87J0e7Efl82Y9YBUZPiru7ZeI/ZlBx4PcSgmCx6etVA0De0Bq6ATtfr1YBm2eD+vu8JQch7wuNbUI58u1RCYiCCCr3wuu+Kt5vhhOkY396/Rb0G6LfmNDLAxmdsFndfvMdUh93MJ x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB5026.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(6029001)(136003)(366004)(39860400002)(396003)(346002)(376002)(451199021)(66446008)(38070700005)(26005)(66556008)(66476007)(33656002)(122000001)(5660300002)(52536014)(6862004)(86362001)(8936002)(41300700001)(4326008)(316002)(8676002)(6636002)(82960400001)(66946007)(55016003)(64756008)(76116006)(38100700002)(6506007)(9686003)(186003)(2906002)(71200400001)(83380400001)(54906003)(7696005)(478600001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?RZ+f2+eTjdGOx7K7YtWyVso0sHeRmPp3mYjrZ+i70tibhOxc6d84chyV5b99?= =?us-ascii?Q?yJR+Aki1xBuNNFPs6WRgEC06yTE71LlB0aipIhkLHm5ybTPYy7GuSvY3JSm7?= =?us-ascii?Q?x1U4PNotguPfmp58fTNcX5I6FpAIDD9duEn5uNBgIM8M8luPcddqGPhTBwF6?= =?us-ascii?Q?XIxGikgeMijxOUMDAnkaufn0e/3bttmCR5uYnBIQubn4YNVmbO5xh/4ke4xH?= =?us-ascii?Q?/Bgc+ydWz9kXOryWvLSDtS0WYqWhiJA+xt4T1yQo1/CWyGR8n9Dj0ESk6GVq?= =?us-ascii?Q?uo+Q3UMO96G1F+e/LuIfH++zBN2lFnk2KvHFoqCfw53r/E0u8QM4U0wdtdPK?= =?us-ascii?Q?0NAh2WCYT5XpOO8UYAJXl7l2z4L8x64iZqfocK/jSUU3zKXBeOmDiIFoqfUi?= =?us-ascii?Q?zvY/hvIXtArjNHaP6ImViUCj7IKirQW5mORBH6pAM1IXpUnveXalIcBId1wP?= =?us-ascii?Q?LX1sVWXUP3fcZKlyG3EIulHM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ii?Q?YFi2m0s6z/E0xpsNWE5eXb3yQsMbVwzBYONlmuWzOj3rRpp30R7UbyxldVwJ?= =?us-ascii?Q?E9zXCs3wyCobUxqwopPHMkeaGkEbv2F6aTHAQfb89j4rW6xSiiVw2sJygTo+?= =?us-ascii?Q?RZSieKuAeNCZ9sIj6WayQcMXnVbNPbJzVFwHxuRuqEF8vNumiunBTRmQHgTC?= =?us-ascii?Q?3xa/N5obdz4RI+M0oicAJ5JJo80xtKxCOX0NZc4y?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB5026.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59367a24-7e8f-4da2-e076-08db77b5afdb X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2023 08:57:22.5978 (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: AM957YVNnAypjlK6FlFSLZnuPWJnirsMfvniW5WpZpR9aIDCH7LOgMwSNlZZ0hYwTw3ArU3GOzGciWuqMxvGoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6258 Return-Path: yuanhao.xie@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ray, Please check V4 patch series. Thanks for the feedbacks. Yuanhao >=20 > The SaveCpuMpData() function was updated to construct the MP_HAND_OFF=20 > Hob. Additionally, the function introduced the MP_HAND_OFF_SIGNAL,=20 > which solely served the purpose of awakening the APs and transitioning=20 > their context from PEI to DXE. The WaitLoopExecutionMode field=20 > indicated whether the bit mode of PEI matched that of DXE. Both of=20 > them were filled only if the ApLoopMode was not ApInHltLoop. In the=20 > case of ApLoopMode, it remained necessary 1. "ApLoopMode" -> "ApInHltMode"? 2. can you update commit message to highlight that this patch still sends I= NIT-SIPI-SIPI even AP is wait in run-loop or mwait loop? A: I updated commit message in patch V4. > + > +/** > + 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= ? A: This function is added in AmdSev.c > +// > +// To trigger the start-up signal, BSP writes the specified //=20 > +StartupSignalValue to the StartupSignalAddress of each processor. > +// This address is monitored by the APs, and as soon as they receive=20 > +// the value that matches the MP_HAND_OFF_SIGNAL, they will wake up=20 > +// 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,=20 > +0x7a, 0x60 } > \ > + } 5. can you please move this GUID definition to MpInitLib/MpHandOff.h? A: MP_HANDOFF_GUID and 2 structure definitions in below are put in MpInitL= ib/MpHandOff in patch V4. > +// > +// The information required to transfer from the PEI phase to the //=20 > +DXE phase is contained within the MP_HAND_OFF and > PROCESSOR_HAND_OFF. > +// If the SizeOfPointer (WaitLoopExecutionMode) of both phases are=20 > +equal, // and the APs is not in halt mode, // then the APs can be=20 > +awakened by triggering the start-up // signal, rather than using=20 > +INIT-SIPI-SIPI. > +// To trigger the start-up signal, BSP writes the specified //=20 > +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=20 > +set to 0, it > signifies > + // processors from 0 to CpuCount - 1. Multiple instances in the HOB=20 > + list > 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=20 > +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? A: I agree. GetBspNumber is removed in patch V4. > + > /** > 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? A: I agree. GetMpHandOffHob is removed in patch V4.