[edk2-devel] [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set

Liming Gao posted 2 patches 4 years, 11 months ago
[edk2-devel] [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set
Posted by Liming Gao 4 years, 11 months ago
From: Jason Voelz <jason.voelz@intel.com>

Add code to set SMXE in CR4 in the SmxInitialize flow when SMX is enabled.

Signed-off-by: Jason Voelz <jason.voelz@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
---
 UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
index 38d3f53f56..b4474d2fab 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
@@ -240,6 +240,15 @@ SmxInitialize (
     Status = RETURN_UNSUPPORTED;
   }
 
+  CPU_REGISTER_TABLE_WRITE_FIELD (
+    ProcessorNumber,
+    ControlRegister,
+    4,
+    IA32_CR4,
+    Bits.SMXE,
+    (State) ? 1 : 0
+  )
+
   CPU_REGISTER_TABLE_TEST_THEN_WRITE_FIELD (
     ProcessorNumber,
     Msr,
-- 
2.13.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52495): https://edk2.groups.io/g/devel/message/52495
Mute This Topic: https://groups.io/mt/69226211/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set
Posted by Ni, Ray 4 years, 10 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Gao, Liming <liming.gao@intel.com>
> Sent: Monday, December 23, 2019 2:56 PM
> To: devel@edk2.groups.io
> Cc: Voelz, Jason <jason.voelz@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set
> 
> From: Jason Voelz <jason.voelz@intel.com>
> 
> Add code to set SMXE in CR4 in the SmxInitialize flow when SMX is enabled.
> 
> Signed-off-by: Jason Voelz <jason.voelz@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> ---
>  UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
> b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
> index 38d3f53f56..b4474d2fab 100644
> --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
> +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c
> @@ -240,6 +240,15 @@ SmxInitialize (
>      Status = RETURN_UNSUPPORTED;
>    }
> 
> +  CPU_REGISTER_TABLE_WRITE_FIELD (
> +    ProcessorNumber,
> +    ControlRegister,
> +    4,
> +    IA32_CR4,
> +    Bits.SMXE,
> +    (State) ? 1 : 0
> +  )
> +
>    CPU_REGISTER_TABLE_TEST_THEN_WRITE_FIELD (
>      ProcessorNumber,
>      Msr,
> --
> 2.13.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#53017): https://edk2.groups.io/g/devel/message/53017
Mute This Topic: https://groups.io/mt/69226211/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-