From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.3480.1576134065758765546 for ; Wed, 11 Dec 2019 23:01:05 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: ray.ni@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2019 23:01:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,304,1571727600"; d="scan'208";a="415139678" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 11 Dec 2019 23:01:05 -0800 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 11 Dec 2019 23:01:04 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 11 Dec 2019 23:01:04 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.164]) with mapi id 14.03.0439.000; Thu, 12 Dec 2019 15:01:03 +0800 From: "Ni, Ray" To: Tom Lendacky , "devel@edk2.groups.io" CC: "Justen, Jordan L" , Laszlo Ersek , Ard Biesheuvel , "Kinney, Michael D" , "Gao, Liming" , "Dong, Eric" , Brijesh Singh Subject: Re: [RFC PATCH v3 35/43] UefiCpuPkg/MpInitLib: Add a CPU MP data flag to indicate if SEV-ES is enabled Thread-Topic: [RFC PATCH v3 35/43] UefiCpuPkg/MpInitLib: Add a CPU MP data flag to indicate if SEV-ES is enabled Thread-Index: AQHVn95PAGOFRu7FbE6xnPOMKdDHJae2M4kQ Date: Thu, 12 Dec 2019 07:01:02 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C399A9D@SHSMSX104.ccr.corp.intel.com> References: <195851106387c3b63780c6c1b04e14438d6032a5.1574280425.git.thomas.lendacky@amd.com> In-Reply-To: <195851106387c3b63780c6c1b04e14438d6032a5.1574280425.git.thomas.lendacky@amd.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWVkNzdlYmYtZDY1NC00YTFlLTg5YTUtYzEwYjBmOGIyMTgzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZ0VWc1Z5aExQYlhHbnZ4Um9ybnJ5RnBJN08zUWVOUitDT2szQ1pXVmdWVFJ4Y3FcLzJHaFlnM2QwYjdHV3RSZmkifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable OK I see now the Enable PCD is defined in MdeModulePkg, produced in platfor= m and consumed in MpInitLib. Is there a way to easily detect whether SEV-ES is enabled? (without trigger= ing CPUID as what SEC does) If no, can you define the PCD in UefiCpuPkg? > -----Original Message----- > From: Tom Lendacky > Sent: Thursday, November 21, 2019 4:07 AM > To: devel@edk2.groups.io > Cc: Justen, Jordan L ; Laszlo Ersek ; Ard Biesheuvel > ; Kinney, Michael D ; Gao, Liming ; Dong, > Eric ; Ni, Ray ; Brijesh Singh > Subject: [RFC PATCH v3 35/43] UefiCpuPkg/MpInitLib: Add a CPU MP data fla= g to indicate if SEV-ES is enabled >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 >=20 > When starting APs in an SMP configuration, the AP needs to know if it is > running as an SEV-ES guest in order to assign a GHCB page. >=20 > Add a field to the CPU_MP_DATA structure that will indicate if SEV-ES is > enabled. This new field is set during MP library initialization with the > PCD value PcdSevEsIsEnabled. This flag can then be used to determine if > SEV-ES is enabled. >=20 > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Signed-off-by: Tom Lendacky > --- > UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 1 + > UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 + > UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 ++ > UefiCpuPkg/Library/MpInitLib/MpLib.c | 1 + > 4 files changed, 5 insertions(+) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/L= ibrary/MpInitLib/DxeMpInitLib.inf > index cd912ab0c5ee..f84dbb09ae49 100644 > --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf > +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf > @@ -69,4 +69,5 @@ [Pcd] > gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CO= NSUMES > gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SO= METIMES_CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CO= NSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdSevEsIsEnabled ## CO= NSUMES >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/L= ibrary/MpInitLib/PeiMpInitLib.inf > index 1538185ef99a..9c1215ec75d0 100644 > --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf > +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf > @@ -60,6 +60,7 @@ [Pcd] > gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## CO= NSUMES > gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CO= NSUMES > gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SO= METIMES_CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdSevEsIsEnabled ## CO= NSUMES >=20 > [Guids] > gEdkiiS3SmmInitDoneGuid > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/Mp= InitLib/MpLib.h > index 8fa07b12c5e1..c10fe894cf9b 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h > @@ -259,6 +259,8 @@ struct _CPU_MP_DATA { > // driver. > // > BOOLEAN WakeUpByInitSipiSipi; > + > + BOOLEAN SevEsIsEnabled; > }; >=20 > extern EFI_GUID mCpuInitMpLibHobGuid; > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/Mp= InitLib/MpLib.c > index 49be5d5385d9..aa25bf9b3671 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -1708,6 +1708,7 @@ MpInitLibInitialize ( > CpuMpData->MicrocodePatchAddress =3D OldCpuMpData->MicrocodePatch= Address; > } > InitializeSpinLock(&CpuMpData->MpLock); > + CpuMpData->SevEsIsEnabled =3D PcdGetBool (PcdSevEsIsEnabled); >=20 > // > // Make sure no memory usage outside of the allocated buffer. > -- > 2.17.1