public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/2] UefiCpuPkg/CpuCommonFeaturesLib: Set SMXE bit of CR4 when SMX is enabled.
@ 2019-12-23  6:55 Liming Gao
  2019-12-23  6:55 ` [Patch 1/2] MdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields Liming Gao
  2019-12-23  6:55 ` [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set Liming Gao
  0 siblings, 2 replies; 5+ messages in thread
From: Liming Gao @ 2019-12-23  6:55 UTC (permalink / raw)
  To: devel; +Cc: Jason Voelz

From: Jason Voelz <jason.voelz@intel.com>

Jason Voelz (2):
  MdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields
  UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set

 UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c |  9 +++++++++
 MdePkg/Include/Library/BaseLib.h                         | 15 ++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

-- 
2.13.0.windows.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Patch 1/2] MdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields
  2019-12-23  6:55 [Patch 0/2] UefiCpuPkg/CpuCommonFeaturesLib: Set SMXE bit of CR4 when SMX is enabled Liming Gao
@ 2019-12-23  6:55 ` Liming Gao
  2020-01-08 14:12   ` Ni, Ray
  2019-12-23  6:55 ` [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set Liming Gao
  1 sibling, 1 reply; 5+ messages in thread
From: Liming Gao @ 2019-12-23  6:55 UTC (permalink / raw)
  To: devel; +Cc: Jason Voelz, Ray Ni

From: Jason Voelz <jason.voelz@intel.com>

Based on Intel Software Develeper's Manual, add all fields in IA32_CR4.

Signed-off-by: Jason Voelz <jason.voelz@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
---
 MdePkg/Include/Library/BaseLib.h | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 2a75bc023f..ecadff8b23 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -5387,10 +5387,19 @@ typedef union {
     UINT32  OSXMMEXCPT:1;   ///< Operating System Support for
                             ///< Unmasked SIMD Floating Point
                             ///< Exceptions.
-    UINT32  Reserved_2:1;   ///< Reserved.
+    UINT32  UMIP:1;         ///< User-Mode Instruction Prevention.
     UINT32  LA57:1;         ///< Linear Address 57bit.
-    UINT32  VMXE:1;         ///< VMX Enable
-    UINT32  Reserved_1:18;  ///< Reserved.
+    UINT32  VMXE:1;         ///< VMX Enable.
+    UINT32  SMXE:1;         ///< SMX Enable.
+    UINT32  Reserved_3:1;   ///< Reserved.
+    UINT32  FSGSBASE:1;     ///< FSGSBASE Enable.
+    UINT32  PCIDE:1;        ///< PCID Enable.
+    UINT32  OSXSAVE:1;      ///< XSAVE and Processor Extended States Enable.
+    UINT32  Reserved_4:1;   ///< Reserved.
+    UINT32  SMEP:1;         ///< SMEP Enable.
+    UINT32  SMAP:1;         ///< SMAP Enable.
+    UINT32  PKE:1;          ///< Protection-Key Enable.
+    UINT32  Reserved_5:9;   ///< Reserved.
   } Bits;
   UINTN     UintN;
 } IA32_CR4;
-- 
2.13.0.windows.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set
  2019-12-23  6:55 [Patch 0/2] UefiCpuPkg/CpuCommonFeaturesLib: Set SMXE bit of CR4 when SMX is enabled Liming Gao
  2019-12-23  6:55 ` [Patch 1/2] MdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields Liming Gao
@ 2019-12-23  6:55 ` Liming Gao
  2020-01-08 14:12   ` Ni, Ray
  1 sibling, 1 reply; 5+ messages in thread
From: Liming Gao @ 2019-12-23  6:55 UTC (permalink / raw)
  To: devel; +Cc: Jason Voelz, Ray Ni

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Patch 1/2] MdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields
  2019-12-23  6:55 ` [Patch 1/2] MdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields Liming Gao
@ 2020-01-08 14:12   ` Ni, Ray
  0 siblings, 0 replies; 5+ messages in thread
From: Ni, Ray @ 2020-01-08 14:12 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io; +Cc: Voelz, Jason

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 1/2] MdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields
> 
> From: Jason Voelz <jason.voelz@intel.com>
> 
> Based on Intel Software Develeper's Manual, add all fields in IA32_CR4.
> 
> Signed-off-by: Jason Voelz <jason.voelz@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> ---
>  MdePkg/Include/Library/BaseLib.h | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
> index 2a75bc023f..ecadff8b23 100644
> --- a/MdePkg/Include/Library/BaseLib.h
> +++ b/MdePkg/Include/Library/BaseLib.h
> @@ -5387,10 +5387,19 @@ typedef union {
>      UINT32  OSXMMEXCPT:1;   ///< Operating System Support for
>                              ///< Unmasked SIMD Floating Point
>                              ///< Exceptions.
> -    UINT32  Reserved_2:1;   ///< Reserved.
> +    UINT32  UMIP:1;         ///< User-Mode Instruction Prevention.
>      UINT32  LA57:1;         ///< Linear Address 57bit.
> -    UINT32  VMXE:1;         ///< VMX Enable
> -    UINT32  Reserved_1:18;  ///< Reserved.
> +    UINT32  VMXE:1;         ///< VMX Enable.
> +    UINT32  SMXE:1;         ///< SMX Enable.
> +    UINT32  Reserved_3:1;   ///< Reserved.
> +    UINT32  FSGSBASE:1;     ///< FSGSBASE Enable.
> +    UINT32  PCIDE:1;        ///< PCID Enable.
> +    UINT32  OSXSAVE:1;      ///< XSAVE and Processor Extended States Enable.
> +    UINT32  Reserved_4:1;   ///< Reserved.
> +    UINT32  SMEP:1;         ///< SMEP Enable.
> +    UINT32  SMAP:1;         ///< SMAP Enable.
> +    UINT32  PKE:1;          ///< Protection-Key Enable.
> +    UINT32  Reserved_5:9;   ///< Reserved.
>    } Bits;
>    UINTN     UintN;
>  } IA32_CR4;
> --
> 2.13.0.windows.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set
  2019-12-23  6:55 ` [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set Liming Gao
@ 2020-01-08 14:12   ` Ni, Ray
  0 siblings, 0 replies; 5+ messages in thread
From: Ni, Ray @ 2020-01-08 14:12 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io; +Cc: Voelz, Jason

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-08 14:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-23  6:55 [Patch 0/2] UefiCpuPkg/CpuCommonFeaturesLib: Set SMXE bit of CR4 when SMX is enabled Liming Gao
2019-12-23  6:55 ` [Patch 1/2] MdePkg BaseLib.h: Update IA32_CR4 strut to include all public fields Liming Gao
2020-01-08 14:12   ` Ni, Ray
2019-12-23  6:55 ` [Patch 2/2] UefiCpuPkg/CpuCommonFeaturesLib: SMXE bit of CR4 should set Liming Gao
2020-01-08 14:12   ` Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox