[edk2-devel] [PATCH 3/3] UefiCpuPkg: Disable MTC packet by default

duntan posted 3 patches 2 years, 9 months ago
There is a newer version of this series
[edk2-devel] [PATCH 3/3] UefiCpuPkg: Disable MTC packet by default
Posted by duntan 2 years, 9 months ago
MTC packet is not needed and disable MTC packet by default.

Bugzila: https://bugzilla.tianocore.org/show_bug.cgi?id=4423
Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Xiao X Chen <xiao.x.chen@intel.com>
---
 UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
index 1a101b7288..3f109bf29c 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
@@ -538,6 +538,14 @@ ProcTraceInitialize (
     CtrlReg.Bits.TSCEn = 0;
   }
 
+  //
+  // MTC packet is not needed. Turn it off by default.
+  //
+  if (Ebx.Bits.Mtc == 1) {
+    CtrlReg.Bits.MTCEn   = 0;
+    CtrlReg.Bits.MTCFreq = 0;
+  }
+
   CPU_REGISTER_TABLE_WRITE64 (
     ProcessorNumber,
     Msr,
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103512): https://edk2.groups.io/g/devel/message/103512
Mute This Topic: https://groups.io/mt/98487623/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 3/3] UefiCpuPkg: Disable MTC packet by default
Posted by Ni, Ray 2 years, 9 months ago
Why do you need to explicitly disable MTC bit?

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of duntan
> Sent: Tuesday, April 25, 2023 1:48 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar,
> Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>;
> Chen, Xiao X <xiao.x.chen@intel.com>
> Subject: [edk2-devel] [PATCH 3/3] UefiCpuPkg: Disable MTC packet by
> default
> 
> MTC packet is not needed and disable MTC packet by default.
> 
> Bugzila: https://bugzilla.tianocore.org/show_bug.cgi?id=4423
> Signed-off-by: Dun Tan <dun.tan@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Xiao X Chen <xiao.x.chen@intel.com>
> ---
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
> b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
> index 1a101b7288..3f109bf29c 100644
> --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
> +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
> @@ -538,6 +538,14 @@ ProcTraceInitialize (
>      CtrlReg.Bits.TSCEn = 0;
>    }
> 
> +  //
> +  // MTC packet is not needed. Turn it off by default.
> +  //
> +  if (Ebx.Bits.Mtc == 1) {
> +    CtrlReg.Bits.MTCEn   = 0;
> +    CtrlReg.Bits.MTCFreq = 0;
> +  }
> +
>    CPU_REGISTER_TABLE_WRITE64 (
>      ProcessorNumber,
>      Msr,
> --
> 2.39.1.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103516): https://edk2.groups.io/g/devel/message/103516
Mute This Topic: https://groups.io/mt/98487623/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 3/3] UefiCpuPkg: Disable MTC packet by default
Posted by duntan 2 years, 9 months ago
Because  we mentioned before that MTC packet is not needed by default. So I added code to disable MTC bit.

-----Original Message-----
From: Ni, Ray <ray.ni@intel.com> 
Sent: Tuesday, April 25, 2023 2:14 PM
To: devel@edk2.groups.io; Tan, Dun <dun.tan@intel.com>
Cc: Dong, Eric <eric.dong@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Chen, Xiao X <xiao.x.chen@intel.com>
Subject: RE: [edk2-devel] [PATCH 3/3] UefiCpuPkg: Disable MTC packet by default

Why do you need to explicitly disable MTC bit?

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of duntan
> Sent: Tuesday, April 25, 2023 1:48 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; 
> Kumar, Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann 
> <kraxel@redhat.com>; Chen, Xiao X <xiao.x.chen@intel.com>
> Subject: [edk2-devel] [PATCH 3/3] UefiCpuPkg: Disable MTC packet by 
> default
> 
> MTC packet is not needed and disable MTC packet by default.
> 
> Bugzila: https://bugzilla.tianocore.org/show_bug.cgi?id=4423
> Signed-off-by: Dun Tan <dun.tan@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Xiao X Chen <xiao.x.chen@intel.com>
> ---
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
> b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
> index 1a101b7288..3f109bf29c 100644
> --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
> +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/ProcTrace.c
> @@ -538,6 +538,14 @@ ProcTraceInitialize (
>      CtrlReg.Bits.TSCEn = 0;
>    }
> 
> +  //
> +  // MTC packet is not needed. Turn it off by default.
> +  //
> +  if (Ebx.Bits.Mtc == 1) {
> +    CtrlReg.Bits.MTCEn   = 0;
> +    CtrlReg.Bits.MTCFreq = 0;
> +  }
> +
>    CPU_REGISTER_TABLE_WRITE64 (
>      ProcessorNumber,
>      Msr,
> --
> 2.39.1.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103524): https://edk2.groups.io/g/devel/message/103524
Mute This Topic: https://groups.io/mt/98487623/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-