public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/2] Update CPUID related definition.
@ 2018-12-03  6:30 Eric Dong
  2018-12-03  6:30 ` [Patch 1/2] UefiCpuPkg/Cpuid.h: Sync CPUID definition to latest SDM Eric Dong
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eric Dong @ 2018-12-03  6:30 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni, Laszlo Ersek

Update CPUID definition to follow SDM 2018'11 version, changes Include:
1. Add new fields to the existed data structure, impact CPUIDs include:
  1. CPUID_THERMAL_POWER_MANAGEMENT                                 0x06
       CPUID_THERMAL_POWER_MANAGEMENT_EAX
  2. CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS                        0x07
       CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX
       CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_ECX
  3. CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING  0x0A
       CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING_EDX
  4. CPUID_EXTENDED_STATE                                           0x0D
       CPUID_EXTENDED_STATE_MAIN_LEAF_EAX
       CPUID_EXTENDED_STATE_SUB_LEAF_ECX
  5. CPUID_INTEL_RDT_ALLOCATION                                     0x10
       CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF_EBX
  6. CPUID_INTEL_SGX                                                0x12
       CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF_EAX

2. Add new data structures which not existed before, impact CPUID includes:
  1. CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS                        0x07
       CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EDX

3. Remove fields which defined before, impact CPUID includes:
  1. CPUID_INTEL_RDT_ALLOCATION                                     0x10
       CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF                        0x01
         CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_ECX

4. Add new sub leaf which not existed before, impact CPUID includes:
  1. CPUID_INTEL_RDT_ALLOCATION                                     0x10
       CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF                0x03

5. Add new CPUIDs which not exist before, new CPUIDs include:
  1. CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS             0x18
  2. CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION                         0x1F

Also update Cpuid application in UefiCpuPkg/Application folder.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>

Eric Dong (2):
  UefiCpuPkg/Cpuid.h: Sync CPUID definition to latest SDM.
  UefiCpuPkg/Cpuid: Add code to support new definition.

 UefiCpuPkg/Application/Cpuid/Cpuid.c | 147 ++++++++-
 UefiCpuPkg/Include/Register/Cpuid.h  | 620 +++++++++++++++++++++++++++++++++--
 2 files changed, 739 insertions(+), 28 deletions(-)

-- 
2.15.0.windows.1



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

* [Patch 1/2] UefiCpuPkg/Cpuid.h: Sync CPUID definition to latest SDM.
  2018-12-03  6:30 [Patch 0/2] Update CPUID related definition Eric Dong
@ 2018-12-03  6:30 ` Eric Dong
  2018-12-03  6:30 ` [Patch 2/2] UefiCpuPkg/Cpuid: Add code to support new definition Eric Dong
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Dong @ 2018-12-03  6:30 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni, Laszlo Ersek

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 27781 bytes --]

Update CPUID definition to follow SDM 2018'11 version, changes Include:
1. Add new fields to the existed data structure, impact CPUIDs include:
  1. CPUID_THERMAL_POWER_MANAGEMENT                                 0x06
       CPUID_THERMAL_POWER_MANAGEMENT_EAX
  2. CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS                        0x07
       CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX
       CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_ECX
  3. CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING  0x0A
       CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING_EDX
  4. CPUID_EXTENDED_STATE                                           0x0D
       CPUID_EXTENDED_STATE_MAIN_LEAF_EAX
       CPUID_EXTENDED_STATE_SUB_LEAF_ECX
  5. CPUID_INTEL_RDT_ALLOCATION                                     0x10
       CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF_EBX
  6. CPUID_INTEL_SGX                                                0x12
       CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF_EAX

2. Add new data structures which not existed before, impact CPUID includes:
  1. CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS                        0x07
       CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EDX

3. Remove fields which defined before, impact CPUID includes:
  1. CPUID_INTEL_RDT_ALLOCATION                                     0x10
       CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF                        0x01
         CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_ECX

4. Add new sub leaf which not existed before, impact CPUID includes:
  1. CPUID_INTEL_RDT_ALLOCATION                                     0x10
       CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF                0x03

5. Add new CPUIDs which not exist before, new CPUIDs include:
  1. CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS             0x18
  2. CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION                         0x1F

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 UefiCpuPkg/Include/Register/Cpuid.h | 620 ++++++++++++++++++++++++++++++++++--
 1 file changed, 597 insertions(+), 23 deletions(-)

diff --git a/UefiCpuPkg/Include/Register/Cpuid.h b/UefiCpuPkg/Include/Register/Cpuid.h
index 5eb9650553..81ae5afd17 100644
--- a/UefiCpuPkg/Include/Register/Cpuid.h
+++ b/UefiCpuPkg/Include/Register/Cpuid.h
@@ -6,7 +6,7 @@
   If a register returned is a single 32-bit value, then a data structure is
   not provided for that register.
 
-  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials are licensed and made available under
   the terms and conditions of the BSD License which accompanies this distribution.
   The full text of the license may be found at
@@ -17,7 +17,7 @@
 
   @par Specification Reference:
   Intel(R) 64 and IA-32 Architectures Software Developer's Manual, Volume 2A,
-  September 2016, CPUID instruction.
+  November 2018, CPUID instruction.
 
 **/
 
@@ -707,6 +707,8 @@ typedef union {
   <tr><td> 0xEC </td><td> Cache   </td><td> 3rd-level cache: 24MByte, 24-way set associative, 64 byte line size</td></tr>
   <tr><td> 0xF0 </td><td> Prefetch</td><td> 64-Byte prefetching</td></tr>
   <tr><td> 0xF1 </td><td> Prefetch</td><td> 128-Byte prefetching</td></tr>
+  <tr><td> 0xFE </td><td> General </td><td> CPUID leaf 2 does not report TLB descriptor information; use CPUID
+                                            leaf 18H to query TLB and other address translation parameters.</td></tr>
   <tr><td> 0xFF </td><td> General </td><td> CPUID leaf 2 does not report cache descriptor information,
                                             use CPUID leaf 4 to query cache parameters</td></tr>
   </table>
@@ -1182,7 +1184,33 @@ typedef union {
     /// IA32_THREAD_STALL MSRs are supported if set.
     ///
     UINT32  HDC:1;
-    UINT32  Reserved3:18;
+    ///
+    /// [Bit 14] Intel Turbo Boost Max Technology 3.0 available.
+    ///
+    UINT32  TurboBoostMaxTechnology30:1;
+    ///
+    /// [Bit 15] HWP Capabilities.
+    /// Highest Performance change is supported if set.
+    ///
+    UINT32  HWPCapabilities:1;
+    ///
+    /// [Bit 16] HWP PECI override is supported if set.
+    ///
+    UINT32  HWPPECIOverride:1;
+    ///
+    /// [Bit 17] Flexible HWP is supported if set.
+    ///
+    UINT32  FlexibleHWP:1;
+    ///
+    /// [Bit 18] Fast access mode for the IA32_HWP_REQUEST MSR is supported if set.
+    ///
+    UINT32  FastAccessMode:1;
+    UINT32  Reserved4:1;
+    ///
+    /// [Bit 20] Ignoring Idle Logical Processor HWP request is supported if set.
+    ///
+    UINT32  IgnoringIdleLogicalProcessorHWPRequest:1;
+    UINT32  Reserved5:11;
   } Bits;
   ///
   /// All bit fields as a 32-bit value
@@ -1369,7 +1397,14 @@ typedef union {
     /// Allocation capability if 1.
     ///
     UINT32  RDT_A:1;
-    UINT32  Reserved2:2;
+    ///
+    /// [Bit 16] AVX512F.
+    ///
+    UINT32  AVX512F:1;
+    ///
+    /// [Bit 17] AVX512DQ.
+    ///
+    UINT32  AVX512DQ:1;
     ///
     /// [Bit 18] If 1 indicates the processor supports the RDSEED instruction.
     ///
@@ -1384,7 +1419,11 @@ typedef union {
     /// instructions) if 1.
     ///
     UINT32  SMAP:1;
-    UINT32  Reserved3:2;
+    ///
+    /// [Bit 21] AVX512_IFMA.
+    ///
+    UINT32  AVX512_IFMA:1;
+    UINT32  Reserved6:1;
     ///
     /// [Bit 23] If 1 indicates the processor supports the CLFLUSHOPT instruction.
     ///
@@ -1398,13 +1437,31 @@ typedef union {
     /// extensions.
     ///
     UINT32  IntelProcessorTrace:1;
-    UINT32  Reserved4:3;
+    ///
+    /// [Bit 26] AVX512PF. (Intel Xeon Phi only.).
+    ///
+    UINT32  AVX512PF:1;
+    ///
+    /// [Bit 27] AVX512ER. (Intel Xeon Phi only.).
+    ///
+    UINT32  AVX512ER:1;
+    ///
+    /// [Bit 28] AVX512CD.
+    ///
+    UINT32  AVX512CD:1;
     ///
     /// [Bit 29] Supports Intel(R) Secure Hash Algorithm Extensions (Intel(R)
     /// SHA Extensions) if 1.
     ///
     UINT32  SHA:1;
-    UINT32  Reserved5:2;
+    ///
+    /// [Bit 30] AVX512BW.
+    ///
+    UINT32  AVX512BW:1;
+    ///
+    /// [Bit 31] AVX512VL.
+    ///
+    UINT32  AVX512VL:1;
   } Bits;
   ///
   /// All bit fields as a 32-bit value
@@ -1424,9 +1481,13 @@ typedef union {
   struct {
     ///
     /// [Bit 0] If 1 indicates the processor supports the PREFETCHWT1 instruction.
+    /// (Intel Xeon Phi only.)
     ///
     UINT32  PREFETCHWT1:1;
-    UINT32  Reserved1:1;
+    ///
+    /// [Bit 1] AVX512_VBMI.
+    ///
+    UINT32  AVX512_VBMI:1;
     ///
     /// [Bit 2] Supports user-mode instruction prevention if 1.
     ///
@@ -1440,14 +1501,20 @@ typedef union {
     /// RDPKRU/WRPKRU instructions).
     ///
     UINT32  OSPKE:1;
-    UINT32  Reserved2:12;
+    UINT32  Reserved5:9;
+    ///
+    /// [Bits 14] AVX512_VPOPCNTDQ. (Intel Xeon Phi only.).
+    ///
+    UINT32  AVX512_VPOPCNTDQ:1;
+    UINT32  Reserved6:2;
+
     ///
     /// [Bits 21:17] The value of MAWAU used by the BNDLDX and BNDSTX instructions
     /// in 64-bit mode.
     ///
     UINT32  MAWAU:5;
     ///
-    /// [Bit 22] Supports Read Processor ID if 1.
+    /// [Bit 22] RDPID and IA32_TSC_AUX are available if 1.
     ///
     UINT32  RDPID:1;
     UINT32  Reserved3:7;
@@ -1463,6 +1530,73 @@ typedef union {
   UINT32  Uint32;
 } CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_ECX;
 
+/**
+  CPUID Structured Extended Feature Flags Enumeration in EDX for CPUID leaf
+  #CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS sub leaf
+  #CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO.
+**/
+typedef union {
+  ///
+  /// Individual bit fields
+  ///
+  struct {
+    ///
+    /// [Bit 1:0] Reserved.
+    ///
+    UINT32  Reserved1:2;
+    ///
+    /// [Bit 2] AVX512_4VNNIW. (Intel Xeon Phi only.)
+    ///
+    UINT32  AVX512_4VNNIW:1;
+    ///
+    /// [Bit 3] AVX512_4FMAPS. (Intel Xeon Phi only.)
+    ///
+    UINT32  AVX512_4FMAPS:1;
+    ///
+    /// [Bit 25:4] Reserved.
+    ///
+    UINT32  Reserved2:22;
+    ///
+    /// [Bit 26] Enumerates support for indirect branch restricted speculation
+    /// (IBRS) and the indirect branch pre-dictor barrier (IBPB). Processors
+    /// that set this bit support the IA32_SPEC_CTRL MSR and the IA32_PRED_CMD
+    /// MSR. They allow software to set IA32_SPEC_CTRL[0] (IBRS) and 
+    /// IA32_PRED_CMD[0] (IBPB).
+    ///
+    UINT32  EnumeratesSupportForIBRSAndIBPB:1;
+    ///
+    /// [Bit 27] Enumerates support for single thread indirect branch
+    /// predictors (STIBP). Processors that set this bit support the
+    /// IA32_SPEC_CTRL MSR. They allow software to set IA32_SPEC_CTRL[1]
+    /// (STIBP).
+    ///
+    UINT32  EnumeratesSupportForSTIBP:1;
+    ///
+    /// [Bit 28] Enumerates support for L1D_FLUSH. Processors that set this bit
+    /// support the IA32_FLUSH_CMD MSR. They allow software to set
+    /// IA32_FLUSH_CMD[0] (L1D_FLUSH).
+    ///
+    UINT32  EnumeratesSupportForL1D_FLUSH:1;
+    ///
+    /// [Bit 29] Enumerates support for the IA32_ARCH_CAPABILITIES MSR.
+    ///
+    UINT32  EnumeratesSupportForCapability:1;
+    ///
+    /// [Bit 30] Reserved.
+    ///
+    UINT32  Reserved3:1;
+    ///
+    /// [Bit 31] Enumerates support for Speculative Store Bypass Disable (SSBD).
+    /// Processors that set this bit sup-port the IA32_SPEC_CTRL MSR. They allow
+    /// software to set IA32_SPEC_CTRL[2] (SSBD).
+    ///
+    UINT32  EnumeratesSupportForSSBD:1;
+  } Bits;
+  ///
+  /// All bit fields as a 32-bit value
+  ///
+  UINT32  Uint32;
+} CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EDX;
 
 /**
   CPUID Direct Cache Access Information
@@ -1616,7 +1750,12 @@ typedef union {
     /// (if Version ID > 1).
     ///
     UINT32  FixedFunctionPerformanceCounterWidth:8;
-    UINT32  Reserved:19;
+    UINT32  Reserved1:2;
+    ///
+    /// [Bits 15] AnyThread deprecation.
+    ///
+    UINT32  AnyThreadDeprecation:1;
+    UINT32  Reserved2:16;
   } Bits;
   ///
   /// All bit fields as a 32-bit value
@@ -1629,11 +1768,16 @@ typedef union {
   CPUID Extended Topology Information
 
   @note
+  CPUID leaf 1FH is a preferred superset to leaf 0BH. Intel recommends first
+  checking for the existence of Leaf 1FH before using leaf 0BH.
   Most of Leaf 0BH output depends on the initial value in ECX.  The EDX output
   of leaf 0BH is always valid and does not vary with input value in ECX.  Output
-  value in ECX[7:0] always equals input value in ECX[7:0].  For sub-leaves that
-  return an invalid level-type of 0 in ECX[15:8]; EAX and EBX will return 0.  If
-  an input value n in ECX returns the invalid level-type of 0 in ECX[15:8],
+  value in ECX[7:0] always equals input value in ECX[7:0].
+  Sub-leaf index 0 enumerates SMT level. Each subsequent higher sub-leaf index
+  enumerates a higher-level topological entity in hierarchical order.
+  For sub-leaves that return an invalid level-type of 0 in ECX[15:8]; EAX and
+  EBX will return 0.
+  If an input value n in ECX returns the invalid level-type of 0 in ECX[15:8],
   other input values with ECX > n also return 0 in ECX[15:8].
 
   @param   EAX  CPUID_EXTENDED_TOPOLOGY (0x0B)
@@ -1843,7 +1987,12 @@ typedef union {
     /// [Bit 9] PKRU state.
     ///
     UINT32  PKRU:1;
-    UINT32  Reserved:22;
+    UINT32  Reserved1:3;
+    ///
+    /// [Bit 13] Used for IA32_XSS, part 2.
+    ///
+    UINT32  IA32_XSS_2:1;
+    UINT32  Reserved2:18;
   } Bits;
   ///
   /// All bit fields as a 32-bit value
@@ -1935,7 +2084,12 @@ typedef union {
     /// [Bit 9] Used for XCR0.
     ///
     UINT32  XCR0_1:1;
-    UINT32  Reserved:22;
+    UINT32  Reserved1:3;
+    ///
+    /// [Bit 13] HWP state.
+    ///
+    UINT32  HWPState:1;
+    UINT32  Reserved8:18;
   } Bits;
   ///
   /// All bit fields as a 32-bit value
@@ -2191,7 +2345,11 @@ typedef union {
     /// [Bit 2] Supports L2 Cache Allocation Technology if 1.
     ///
     UINT32  L2CacheAllocation:1;
-    UINT32  Reserved2:29;
+    ///
+    /// [Bit 3] Supports Memory Bandwidth Allocation if 1.
+    ///
+    UINT32  MemoryBandwidth:1;
+    UINT32  Reserved3:28;
   } Bits;
   ///
   /// All bit fields as a 32-bit value
@@ -2262,11 +2420,7 @@ typedef union {
   /// Individual bit fields
   ///
   struct {
-    UINT32  Reserved1:1;
-    ///
-    /// [Bit 1] Updates of COS should be infrequent if 1.
-    ///
-    UINT32  CosUpdatesInfrequent:1;
+    UINT32  Reserved3:2;
     ///
     /// [Bit 2] Code and Data Prioritization Technology supported if 1.
     ///
@@ -2373,6 +2527,109 @@ typedef union {
   UINT32  Uint32;
 } CPUID_INTEL_RDT_ALLOCATION_L2_CACHE_SUB_LEAF_EDX;
 
+/**
+  Memory Bandwidth Allocation Enumeration Sub-leaf
+
+  @param   EAX  CPUID_INTEL_RDT_ALLOCATION (0x10)
+  @param   ECX  CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF (0x03)
+
+  @retval  EAX  RESID memory bandwidth Allocation Technology information
+                described by the type
+                CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EAX.
+  @retval  EBX  Reserved.
+  @retval  ECX  RESID memory bandwidth Allocation Technology information
+                described by the type
+                CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_ECX.
+  @retval  EDX  RESID memory bandwidth Allocation Technology information
+                described by the type
+                CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EDX.
+
+  <b>Example usage</b>
+  @code
+  CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EAX  Eax;
+  UINT32                                                    Ebx;
+  CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_ECX  Ecx;
+  CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EDX  Edx;
+
+
+  AsmCpuidEx (
+    CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF,
+    &Eax.Uint32, &Ebx, NULL, &Edx.Uint32
+    );
+  @endcode
+**/
+#define CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF        0x03
+
+/**
+  CPUID memory bandwidth Allocation Technology Information EAX for CPUID leaf
+  #CPUID_INTEL_RDT_ALLOCATION, sub-leaf
+  #CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF.
+**/
+typedef union {
+  ///
+  /// Individual bit fields
+  ///
+  struct {
+    ///
+    /// [Bits 11:0] Reports the maximum MBA throttling value supported for
+    /// the corresponding ResID using minus-one notation.
+    ///
+    UINT32  MaximumMBAThrottling:12;
+    UINT32  Reserved:20;
+  } Bits;
+  ///
+  /// All bit fields as a 32-bit value
+  ///
+  UINT32  Uint32;
+} CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EAX;
+
+/**
+  CPUID memory bandwidth Allocation Technology Information ECX for CPUID leaf
+  #CPUID_INTEL_RDT_ALLOCATION, sub-leaf
+  #CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF.
+**/
+typedef union {
+  ///
+  /// Individual bit fields
+  ///
+  struct {
+    ///
+    /// [Bits 1:0] Reserved.
+    ///
+    UINT32  Reserved1:2;
+    ///
+    /// [Bits 3] Reports whether the response of the delay values is linear.
+    ///
+    UINT32  Liner:1;
+    UINT32  Reserved2:29;
+  } Bits;
+  ///
+  /// All bit fields as a 32-bit value
+  ///
+  UINT32  Uint32;
+} CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_ECX;
+
+/**
+  CPUID memory bandwidth Allocation Technology Information EDX for CPUID leaf
+  #CPUID_INTEL_RDT_ALLOCATION, sub-leaf
+  #CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF.
+**/
+typedef union {
+  ///
+  /// Individual bit fields
+  ///
+  struct {
+    ///
+    /// [Bits 15:0] Highest COS number supported for this ResID.
+    ///
+    UINT32  HighestCosNumber:16;
+    UINT32  Reserved:16;
+  } Bits;
+  ///
+  /// All bit fields as a 32-bit value
+  ///
+  UINT32  Uint32;
+} CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EDX;
 
 /**
   Intel SGX resource capability and configuration.
@@ -2437,7 +2694,18 @@ typedef union {
     /// [Bit 1] If 1, indicates leaf functions of SGX2 instruction are supported.
     ///
     UINT32  SGX2:1;
-    UINT32  Reserved:30;
+    UINT32  Reserved1:3;
+    ///
+    /// [Bit 5] If 1, indicates Intel SGX supports ENCLV instruction leaves
+    /// EINCVIRTCHILD, EDECVIRTCHILD, and ESETCONTEXT.
+    ///
+    UINT32  ENCLV:1;
+    ///
+    /// [Bit 6] If 1, indicates Intel SGX supports ENCLS instruction leaves ETRACKC,
+    /// ERDINFO, ELDBC, and ELDUC.
+    ///
+    UINT32  ENCLS:1;
+    UINT32  Reserved2:25;
   } Bits;
   ///
   /// All bit fields as a 32-bit value
@@ -3178,6 +3446,307 @@ typedef union {
 **/
 #define CPUID_SOC_VENDOR_BRAND_STRING3                      0x03
 
+/**
+  CPUID Deterministic Address Translation Parameters
+
+  @note
+  Each sub-leaf enumerates a different address translation structure.
+  If ECX contains an invalid sub-leaf index, EAX/EBX/ECX/EDX return 0. Sub-leaf
+  index n is invalid if n exceeds the value that sub-leaf 0 returns in EAX. A
+  sub-leaf index is also invalid if EDX[4:0] returns 0.
+  Valid sub-leaves do not need to be contiguous or in any particular order. A
+  valid sub-leaf may be in a higher input ECX value than an invalid sub-leaf or
+  than a valid sub-leaf of a higher or lower-level structure.
+  * Some unified TLBs will allow a single TLB entry to satisfy data read/write
+  and instruction fetches. Others will require separate entries (e.g., one
+  loaded on data read/write and another loaded on an instruction fetch).
+  Please see the Intel® 64 and IA-32 Architectures Optimization Reference Manual
+  for details of a particular product.
+  ** Add one to the return value to get the result.
+
+  @param   EAX  CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS (0x18)
+  @param   ECX  CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_MAIN_LEAF (0x00)
+                CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_SUB_LEAF  (0x*)
+
+**/
+#define CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS             0x18
+
+/**
+  CPUID Deterministic Address Translation Parameters
+
+  @param   EAX  CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS (0x18)
+  @param   ECX  CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_MAIN_LEAF (0x00)
+
+  @retval  EAX  Reports the maximum input value of supported sub-leaf in leaf 18H.
+  @retval  EBX  Returns Deterministic Address Translation Parameters described by
+                the type CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EBX.
+  @retval  ECX  Number of Sets.
+  @retval  EDX  Returns Deterministic Address Translation Parameters described by
+                the type CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EDX.
+
+  <b>Example usage</b>
+  @code
+  UINT32                                                  Eax;
+  CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EBX  Ebx;
+  UINT32                                                  Ecx;
+  CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EDX  Edx;
+
+  AsmCpuidEx (
+    CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS, 
+    CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_MAIN_LEAF,
+    &Eax, &Ebx.Uint32, &Ecx, &Edx.Uint32
+    );
+  @endcode
+**/
+#define CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_MAIN_LEAF   0x00
+
+/**
+  CPUID Deterministic Address Translation Parameters EBX for CPUID leafs.
+**/
+typedef union {
+  ///
+  /// Individual bit fields
+  ///
+  struct {
+    ///
+    /// [Bits 0] 4K page size entries supported by this structure.
+    ///
+    UINT32  Page4K:1;
+    ///
+    /// [Bits 1] 2MB page size entries supported by this structure.
+    ///
+    UINT32  Page2M:1;
+    ///
+    /// [Bits 2] 4MB page size entries supported by this structure.
+    ///
+    UINT32  Page4M:1;
+    ///
+    /// [Bits 3] 1 GB page size entries supported by this structure.
+    ///
+    UINT32  Page1G:1;
+    ///
+    /// [Bits 7:4] Reserved.
+    ///
+    UINT32  Reserved1:4;
+    ///
+    /// [Bits 10:8] Partitioning (0: Soft partitioning between the logical
+    /// processors sharing this structure)
+    ///
+    UINT32  Partitioning:3;
+    ///
+    /// [Bits 15:11] Reserved.
+    ///
+    UINT32  Reserved2:5;
+    ///
+    /// [Bits 31:16] W = Ways of associativity.
+    ///
+    UINT32  Way:16;
+  } Bits;
+  ///
+  /// All bit fields as a 32-bit value
+  ///
+  UINT32  Uint32;
+} CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EBX;
+
+/**
+  CPUID Deterministic Address Translation Parameters EDX for CPUID leafs.
+**/
+typedef union {
+  ///
+  /// Individual bit fields
+  ///
+  struct {
+    ///
+    /// [Bits 4:0] Translation cache type field.
+    ///
+    UINT32  TranslationCacheType:5;
+    ///
+    /// [Bits 7:5] Translation cache level (starts at 1).
+    ///
+    UINT32  TranslationCacheLevel:3;
+    ///
+    /// [Bits 8] Fully associative structure.
+    ///
+    UINT32  FullyAssociative:1;
+    ///
+    /// [Bits 13:9] Reserved.
+    ///
+    UINT32  Reserved1:5;
+    ///
+    /// [Bits 25:14] Maximum number of addressable IDs for logical
+    /// processors sharing this translation cache.
+    ///
+    UINT32  MaximumNum:12;
+    ///
+    /// [Bits 31:26] Reserved.
+    ///
+    UINT32  Reserved2:6;
+  } Bits;
+  ///
+  /// All bit fields as a 32-bit value
+  ///
+  UINT32  Uint32;
+} CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EDX;
+
+///
+/// @{ Define value for CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EDX.TranslationCacheType
+///
+#define   CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_TRANSLATION_CACHE_TYPE_INVALID          0x00
+#define   CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_TRANSLATION_CACHE_TYPE_DATA_TLB         0x01
+#define   CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_TRANSLATION_CACHE_TYPE_INSTRUCTION_TLB  0x02
+#define   CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_TRANSLATION_CACHE_TYPE_UNIFIED_TLB      0x03
+///
+/// @}
+///
+
+
+/**
+  CPUID V2 Extended Topology Enumeration Leaf
+
+  @note
+  CPUID leaf 1FH is a preferred superset to leaf 0BH. Intel recommends first checking
+  for the existence of Leaf 1FH and using this if available.
+  Most of Leaf 1FH output depends on the initial value in ECX. The EDX output of leaf
+  1FH is always valid and does not vary with input value in ECX. Output value in ECX[7:0]
+  always equals input value in ECX[7:0]. Sub-leaf index 0 enumerates SMT level. Each
+  subsequent higher sub-leaf index enumerates a higher-level topological entity in
+  hierarchical order. For sub-leaves that return an invalid level-type of 0 in ECX[15:8];
+  EAX and EBX will return 0. If an input value n in ECX returns the invalid level-type of
+  0 in ECX[15:8], other input values with ECX > n also return 0 in ECX[15:8].
+
+  Software should use this field (EAX[4:0]) to enumerate processor topology of the system.
+  Software must not use EBX[15:0] to enumerate processor topology of the system. This value
+  in this field (EBX[15:0]) is only intended for display/diagnostic purposes. The actual
+  number of logical processors available to BIOS/OS/Applications may be different from the
+  value of EBX[15:0], depending on software and platform hardware configurations.
+
+  @param   EAX  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION            (0x1F)
+  @param   ECX  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF  (0x0)
+
+**/
+#define CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION                         0x1F
+
+/**
+  CPUID V2 Extended Topology Enumeration Leaf
+
+  @param   EAX  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION           (0x1F)
+  @param   ECX  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF (0x00)
+
+  @retval  EAX  Returns V2 Extended Topology Enumeration Leaf described by
+                the type CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EAX.
+  @retval  EBX  Returns V2 Extended Topology Enumeration Leaf described by
+                the type CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EBX.
+  @retval  ECX  Returns V2 Extended Topology Enumeration Leaf described by
+                the type CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX.
+  @retval  EDX  Returns x2APIC ID the current logical processor.
+
+  <b>Example usage</b>
+  @code
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EAX         Eax;
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EBX         Ebx;
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX         Ecx;
+  UINT32                                             Edx;
+
+  AsmCpuidEx (
+    CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION, 
+    CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF,
+    &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx
+    );
+  @endcode
+**/
+#define CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF               0x00
+
+/**
+  CPUID V2 Extended Topology Enumeration Leaf EAX for CPUID leafs.
+**/
+typedef union {
+  ///
+  /// Individual bit fields
+  ///
+  struct {
+    ///
+    /// [Bits 4:0] Number of bits to shift right on x2APIC ID to get a unique
+    /// topology ID of the next level type. All logical processors with the
+    /// same next level ID share current level.
+    ///
+    UINT32  BitsNum:5;
+    ///
+    /// [Bits 31:5] Reserved.
+    ///
+    UINT32  Reserved:27;
+  } Bits;
+  ///
+  /// All bit fields as a 32-bit value
+  ///
+  UINT32  Uint32;
+} CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EAX;
+
+/**
+  CPUID V2 Extended Topology Enumeration Leaf EBX for CPUID leafs.
+**/
+typedef union {
+  ///
+  /// Individual bit fields
+  ///
+  struct {
+    ///
+    /// [Bits 15:0] Number of logical processors at this level type. The number
+    /// reflects configuration as shipped by Intel.
+    ///
+    UINT32  ProcessorsNum:16;
+    ///
+    /// [Bits 31:5] Reserved.
+    ///
+    UINT32  Reserved:16;
+  } Bits;
+  ///
+  /// All bit fields as a 32-bit value
+  ///
+  UINT32  Uint32;
+} CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EBX;
+
+/**
+  CPUID V2 Extended Topology Enumeration Leaf ECX for CPUID leafs.
+**/
+typedef union {
+  ///
+  /// Individual bit fields
+  ///
+  struct {
+    ///
+    /// [Bits 7:0] Level number. Same value in ECX input.
+    ///
+    UINT32  LevelNum:8;
+    ///
+    /// [Bits 7:0] Level type.
+    ///
+    UINT32  LevelType:8;
+
+    ///
+    /// [Bits 31:5] Reserved.
+    ///
+    UINT32  Reserved:16;
+  } Bits;
+  ///
+  /// All bit fields as a 32-bit value
+  ///
+  UINT32  Uint32;
+} CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX;
+
+///
+/// @{ Define value for CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX.LevelType
+/// The value of the “level type” field is not related to level numbers in
+/// any way, higher “level type” values do not mean higher levels.
+///
+#define   CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_INVALID     0x00
+#define   CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_SMT         0x01
+#define   CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_CORE        0x02
+#define   CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_MODULE      0x03
+#define   CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_TILE        0x04
+#define   CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_DIE         0x05
+///
+/// @}
+///
 
 /**
   CPUID Extended Function
@@ -3436,6 +4005,11 @@ typedef union {
 #define CPUID_EXTENDED_CACHE_INFO_ECX_L2_ASSOCIATIVITY_4_WAY          0x04
 #define CPUID_EXTENDED_CACHE_INFO_ECX_L2_ASSOCIATIVITY_8_WAY          0x06
 #define CPUID_EXTENDED_CACHE_INFO_ECX_L2_ASSOCIATIVITY_16_WAY         0x08
+#define CPUID_EXTENDED_CACHE_INFO_ECX_L2_ASSOCIATIVITY_32_WAY         0x0A
+#define CPUID_EXTENDED_CACHE_INFO_ECX_L2_ASSOCIATIVITY_48_WAY         0x0B
+#define CPUID_EXTENDED_CACHE_INFO_ECX_L2_ASSOCIATIVITY_64_WAY         0x0C
+#define CPUID_EXTENDED_CACHE_INFO_ECX_L2_ASSOCIATIVITY_96_WAY         0x0D
+#define CPUID_EXTENDED_CACHE_INFO_ECX_L2_ASSOCIATIVITY_128_WAY        0x0E
 #define CPUID_EXTENDED_CACHE_INFO_ECX_L2_ASSOCIATIVITY_FULL           0x0F
 ///
 /// @}
-- 
2.15.0.windows.1



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

* [Patch 2/2] UefiCpuPkg/Cpuid: Add code to support new definition.
  2018-12-03  6:30 [Patch 0/2] Update CPUID related definition Eric Dong
  2018-12-03  6:30 ` [Patch 1/2] UefiCpuPkg/Cpuid.h: Sync CPUID definition to latest SDM Eric Dong
@ 2018-12-03  6:30 ` Eric Dong
  2018-12-03 11:34 ` [Patch 0/2] Update CPUID related definition Laszlo Ersek
  2018-12-10  3:15 ` Ni, Ruiyu
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Dong @ 2018-12-03  6:30 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni, Laszlo Ersek

Add code to support new definitions added for SDM 2018'11
version.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 UefiCpuPkg/Application/Cpuid/Cpuid.c | 147 +++++++++++++++++++++++++++++++++--
 1 file changed, 142 insertions(+), 5 deletions(-)

diff --git a/UefiCpuPkg/Application/Cpuid/Cpuid.c b/UefiCpuPkg/Application/Cpuid/Cpuid.c
index b44266e538..da87f0aef4 100644
--- a/UefiCpuPkg/Application/Cpuid/Cpuid.c
+++ b/UefiCpuPkg/Application/Cpuid/Cpuid.c
@@ -153,6 +153,7 @@ CPUID_CACHE_INFO_DESCRIPTION  mCpuidCacheInfoDescription[] = {
   { 0xEC , "Cache"    , "3rd-level cache: 24MByte, 24-way set associative, 64 byte line size" },
   { 0xF0 , "Prefetch" , "64-Byte prefetching" },
   { 0xF1 , "Prefetch" , "128-Byte prefetching" },
+  { 0xFE , "General"  , "CPUID leaf 2 does not report TLB descriptor information; use CPUID leaf 18H to query TLB and other address translation parameters." },
   { 0xFF , "General"  , "CPUID leaf 2 does not report cache descriptor information, use CPUID leaf 4 to query cache parameters" }
 };
 
@@ -557,6 +558,12 @@ CpuidThermalPowerManagement (
   PRINT_BIT_FIELD (Eax, HWP_Energy_Performance_Preference);
   PRINT_BIT_FIELD (Eax, HWP_Package_Level_Request);
   PRINT_BIT_FIELD (Eax, HDC);
+  PRINT_BIT_FIELD (Eax, TurboBoostMaxTechnology30);
+  PRINT_BIT_FIELD (Eax, HWPCapabilities);
+  PRINT_BIT_FIELD (Eax, HWPPECIOverride);
+  PRINT_BIT_FIELD (Eax, FlexibleHWP);
+  PRINT_BIT_FIELD (Eax, FastAccessMode);
+  PRINT_BIT_FIELD (Eax, IgnoringIdleLogicalProcessorHWPRequest);
   PRINT_BIT_FIELD (Ebx, InterruptThresholds);
   PRINT_BIT_FIELD (Ecx, HardwareCoordinationFeedback);
   PRINT_BIT_FIELD (Ecx, PerformanceEnergyBias);
@@ -574,6 +581,8 @@ CpuidStructuredExtendedFeatureFlags (
   UINT32                                       Eax;
   CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX  Ebx;
   CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_ECX  Ecx;
+  CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EDX  Edx;
+
   UINT32                                       SubLeaf;
 
   if (CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS > gMaximumBasicFunction) {
@@ -589,11 +598,11 @@ CpuidStructuredExtendedFeatureFlags (
     AsmCpuidEx (
       CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS,
       SubLeaf,
-      NULL, &Ebx.Uint32, &Ecx.Uint32, NULL
+      NULL, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32
       );
-    if (Ebx.Uint32 != 0 || Ecx.Uint32 != 0) {
+    if (Ebx.Uint32 != 0 || Ecx.Uint32 != 0 || Edx.Uint32 != 0) {
       Print (L"CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS (Leaf %08x, Sub-Leaf %08x)\n", CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, SubLeaf);
-      Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax, Ebx.Uint32, Ecx.Uint32, 0);
+      Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);
       PRINT_BIT_FIELD (Ebx, FSGSBASE);
       PRINT_BIT_FIELD (Ebx, IA32_TSC_ADJUST);
       PRINT_BIT_FIELD (Ebx, SGX);
@@ -610,20 +619,39 @@ CpuidStructuredExtendedFeatureFlags (
       PRINT_BIT_FIELD (Ebx, DeprecateFpuCsDs);
       PRINT_BIT_FIELD (Ebx, MPX);
       PRINT_BIT_FIELD (Ebx, RDT_A);
+      PRINT_BIT_FIELD (Ebx, AVX512F);
+      PRINT_BIT_FIELD (Ebx, AVX512DQ);
       PRINT_BIT_FIELD (Ebx, RDSEED);
       PRINT_BIT_FIELD (Ebx, ADX);
       PRINT_BIT_FIELD (Ebx, SMAP);
+      PRINT_BIT_FIELD (Ebx, AVX512_IFMA);
       PRINT_BIT_FIELD (Ebx, CLFLUSHOPT);
       PRINT_BIT_FIELD (Ebx, CLWB);
       PRINT_BIT_FIELD (Ebx, IntelProcessorTrace);
+      PRINT_BIT_FIELD (Ebx, AVX512PF);
+      PRINT_BIT_FIELD (Ebx, AVX512ER);
+      PRINT_BIT_FIELD (Ebx, AVX512CD);
       PRINT_BIT_FIELD (Ebx, SHA);
+      PRINT_BIT_FIELD (Ebx, AVX512BW);
+      PRINT_BIT_FIELD (Ebx, AVX512VL);
+
       PRINT_BIT_FIELD (Ecx, PREFETCHWT1);
+      PRINT_BIT_FIELD (Ecx, AVX512_VBMI);
       PRINT_BIT_FIELD (Ecx, UMIP);
       PRINT_BIT_FIELD (Ecx, PKU);
       PRINT_BIT_FIELD (Ecx, OSPKE);
+      PRINT_BIT_FIELD (Ecx, AVX512_VPOPCNTDQ);
       PRINT_BIT_FIELD (Ecx, MAWAU);
       PRINT_BIT_FIELD (Ecx, RDPID);
       PRINT_BIT_FIELD (Ecx, SGX_LC);
+
+      PRINT_BIT_FIELD (Edx, AVX512_4VNNIW);
+      PRINT_BIT_FIELD (Edx, AVX512_4FMAPS);
+      PRINT_BIT_FIELD (Edx, EnumeratesSupportForIBRSAndIBPB);
+      PRINT_BIT_FIELD (Edx, EnumeratesSupportForSTIBP);
+      PRINT_BIT_FIELD (Edx, EnumeratesSupportForL1D_FLUSH);
+      PRINT_BIT_FIELD (Edx, EnumeratesSupportForCapability);
+      PRINT_BIT_FIELD (Edx, EnumeratesSupportForSSBD);
     }
   }
 }
@@ -681,6 +709,7 @@ CpuidArchitecturalPerformanceMonitoring (
   PRINT_BIT_FIELD (Ebx, AllBranchMispredictRetired);
   PRINT_BIT_FIELD (Edx, FixedFunctionPerformanceCounters);
   PRINT_BIT_FIELD (Edx, FixedFunctionPerformanceCounterWidth);
+  PRINT_BIT_FIELD (Edx, AnyThreadDeprecation);
 }
 
 /**
@@ -747,6 +776,7 @@ CpuidExtendedStateSubLeaf (
   PRINT_BIT_FIELD (Eax, XSAVES);
   PRINT_VALUE     (Ebx, EnabledSaveStateSize_XCR0_IA32_XSS);
   PRINT_BIT_FIELD (Ecx, XCR0);
+  PRINT_BIT_FIELD (Ecx, HWPState);
   PRINT_BIT_FIELD (Ecx, PT);
   PRINT_BIT_FIELD (Ecx, XCR0_1);
   PRINT_VALUE     (Edx, IA32_XSS_Supported_32_63);
@@ -814,6 +844,7 @@ CpuidExtendedStateMainLeaf (
   PRINT_BIT_FIELD (Eax, AVX_512);
   PRINT_BIT_FIELD (Eax, IA32_XSS);
   PRINT_BIT_FIELD (Eax, PKRU);
+  PRINT_BIT_FIELD (Eax, IA32_XSS_2);
   PRINT_VALUE     (Ebx, EnabledSaveStateSize);
   PRINT_VALUE     (Ecx, SupportedSaveStateSize);
   PRINT_VALUE     (Edx, XCR0_Supported_32_63);
@@ -878,6 +909,33 @@ CpuidIntelRdtMonitoringL3CacheCapabilitySubLeaf (
   PRINT_BIT_FIELD (Edx, L3CacheLocalBandwidthMonitoring);
 }
 
+/**
+  Display CPUID_INTEL_RDT_ALLOCATION memory bandwidth allocation technology enumeration
+  sub-leaf.
+
+**/
+VOID
+CpuidIntelRdtAllocationMemoryBandwidthSubLeaf (
+  VOID
+  )
+{
+  CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EAX  Eax;
+  UINT32                                                    Ebx;
+  CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_ECX  Ecx;
+  CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EDX  Edx;
+
+  AsmCpuidEx (
+    CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF,
+    &Eax.Uint32, &Ebx, &Ecx.Uint32, &Edx.Uint32
+    );
+  Print (L"CPUID_INTEL_RDT_ALLOCATION (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF);
+  Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax.Uint32, Ebx, Ecx.Uint32, Edx.Uint32);
+  PRINT_BIT_FIELD (Eax, MaximumMBAThrottling);
+  PRINT_VALUE     (Ebx, AllocationUnitBitMap);
+  PRINT_BIT_FIELD (Ecx, Liner);
+  PRINT_BIT_FIELD (Edx, HighestCosNumber);
+}
+
 /**
   Display CPUID_INTEL_RDT_ALLOCATION L3 cache allocation technology enumeration
   sub-leaf.
@@ -901,7 +959,6 @@ CpuidIntelRdtAllocationL3CacheSubLeaf (
   Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax.Uint32, Ebx, Ecx.Uint32, Edx.Uint32);
   PRINT_BIT_FIELD (Eax, CapacityLength);
   PRINT_VALUE     (Ebx, AllocationUnitBitMap);
-  PRINT_BIT_FIELD (Ecx, CosUpdatesInfrequent);
   PRINT_BIT_FIELD (Ecx, CodeDataPrioritization);
   PRINT_BIT_FIELD (Edx, HighestCosNumber);
 }
@@ -954,7 +1011,8 @@ CpuidIntelRdtAllocationMainLeaf (
   Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", 0, Ebx.Uint32, 0, 0);
   PRINT_BIT_FIELD (Ebx, L3CacheAllocation);
   PRINT_BIT_FIELD (Ebx, L2CacheAllocation);
-
+  PRINT_BIT_FIELD (Ebx, MemoryBandwidth);
+  CpuidIntelRdtAllocationMemoryBandwidthSubLeaf ();
   CpuidIntelRdtAllocationL3CacheSubLeaf ();
   CpuidIntelRdtAllocationL2CacheSubLeaf ();
 }
@@ -980,6 +1038,8 @@ CpuidEnumerationOfIntelSgxCapabilities0SubLeaf (
   Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax.Uint32, Ebx, 0, Edx.Uint32);
   PRINT_BIT_FIELD (Eax, SGX1);
   PRINT_BIT_FIELD (Eax, SGX2);
+  PRINT_BIT_FIELD (Eax, ENCLV);
+  PRINT_BIT_FIELD (Eax, ENCLS);
   PRINT_BIT_FIELD (Edx, MaxEnclaveSize_Not64);
   PRINT_BIT_FIELD (Edx, MaxEnclaveSize_64);
 }
@@ -1284,6 +1344,81 @@ CpuidSocVendor (
   CpuidSocVendorBrandString ();
 }
 
+/**
+  Display CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS main leaf and sub-leafs.
+
+**/
+VOID
+CpuidDeterministicAddressTranslationParameters (
+  VOID
+  )
+{
+  UINT32                                                  Eax;
+  CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EBX  Ebx;
+  UINT32                                                  Ecx;
+  CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EDX  Edx;
+
+  if (CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS > gMaximumBasicFunction) {
+    return;
+  }
+
+  AsmCpuidEx (
+    CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS,
+    CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_MAIN_LEAF,
+    &Eax, &Ebx.Uint32, &Ecx, &Edx.Uint32
+    );
+  Print (L"CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS (Leaf %08x, Sub-Leaf %08x)\n", CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS, CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_MAIN_LEAF);
+  Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax, Ebx.Uint32, Ecx, Edx.Uint32);
+
+  PRINT_VALUE     (Eax, MaxID_Index);
+  PRINT_BIT_FIELD (Ebx, Page4K);
+  PRINT_BIT_FIELD (Ebx, Page2M);
+  PRINT_BIT_FIELD (Ebx, Page4M);
+  PRINT_BIT_FIELD (Ebx, Page1G);
+  PRINT_BIT_FIELD (Ebx, Partitioning);
+  PRINT_BIT_FIELD (Ebx, Way);
+
+  PRINT_VALUE     (Ecx, NumberOfSets);
+
+  PRINT_BIT_FIELD (Edx, TranslationCacheType);
+  PRINT_BIT_FIELD (Edx, TranslationCacheLevel);
+  PRINT_BIT_FIELD (Edx, FullyAssociative);
+  PRINT_BIT_FIELD (Edx, MaximumNum);
+}
+
+/**
+  Display CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION main leaf and sub-leafs.
+
+**/
+VOID
+CpuidV2ExtendedTopologyEnumeration (
+  VOID
+  )
+{
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EAX  Eax;
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EBX  Ebx;
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX  Ecx;
+  UINT32                                      Edx;
+
+  if (CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION > gMaximumBasicFunction) {
+    return;
+  }
+
+  AsmCpuidEx (
+    CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION,
+    CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF,
+    &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx
+    );
+  Print (L"CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION (Leaf %08x, Sub-Leaf %08x)\n", CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION, CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF);
+  Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx);
+
+  PRINT_BIT_FIELD (Eax, BitsNum);
+  PRINT_BIT_FIELD (Ebx, ProcessorsNum);
+  PRINT_BIT_FIELD (Ecx, LevelNum);
+  PRINT_BIT_FIELD (Ecx, LevelType);
+  PRINT_VALUE     (Edx, x2APICID);
+}
+
 /**
   Display CPUID_EXTENDED_FUNCTION leaf.
 
@@ -1495,6 +1630,8 @@ UefiMain (
   CpuidTimeStampCounter ();
   CpuidProcessorFrequency ();
   CpuidSocVendor ();
+  CpuidDeterministicAddressTranslationParameters ();
+  CpuidV2ExtendedTopologyEnumeration ();
   CpuidExtendedFunction ();
   CpuidExtendedCpuSig ();
   CpuidProcessorBrandString ();
-- 
2.15.0.windows.1



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

* Re: [Patch 0/2] Update CPUID related definition.
  2018-12-03  6:30 [Patch 0/2] Update CPUID related definition Eric Dong
  2018-12-03  6:30 ` [Patch 1/2] UefiCpuPkg/Cpuid.h: Sync CPUID definition to latest SDM Eric Dong
  2018-12-03  6:30 ` [Patch 2/2] UefiCpuPkg/Cpuid: Add code to support new definition Eric Dong
@ 2018-12-03 11:34 ` Laszlo Ersek
  2018-12-10  3:15 ` Ni, Ruiyu
  3 siblings, 0 replies; 5+ messages in thread
From: Laszlo Ersek @ 2018-12-03 11:34 UTC (permalink / raw)
  To: Eric Dong, edk2-devel; +Cc: Ruiyu Ni

On 12/03/18 07:30, Eric Dong wrote:
> Update CPUID definition to follow SDM 2018'11 version, changes Include:
> 1. Add new fields to the existed data structure, impact CPUIDs include:
>   1. CPUID_THERMAL_POWER_MANAGEMENT                                 0x06
>        CPUID_THERMAL_POWER_MANAGEMENT_EAX
>   2. CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS                        0x07
>        CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX
>        CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_ECX
>   3. CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING  0x0A
>        CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING_EDX
>   4. CPUID_EXTENDED_STATE                                           0x0D
>        CPUID_EXTENDED_STATE_MAIN_LEAF_EAX
>        CPUID_EXTENDED_STATE_SUB_LEAF_ECX
>   5. CPUID_INTEL_RDT_ALLOCATION                                     0x10
>        CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF_EBX
>   6. CPUID_INTEL_SGX                                                0x12
>        CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF_EAX
> 
> 2. Add new data structures which not existed before, impact CPUID includes:
>   1. CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS                        0x07
>        CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EDX
> 
> 3. Remove fields which defined before, impact CPUID includes:
>   1. CPUID_INTEL_RDT_ALLOCATION                                     0x10
>        CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF                        0x01
>          CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_ECX
> 
> 4. Add new sub leaf which not existed before, impact CPUID includes:
>   1. CPUID_INTEL_RDT_ALLOCATION                                     0x10
>        CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF                0x03
> 
> 5. Add new CPUIDs which not exist before, new CPUIDs include:
>   1. CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS             0x18
>   2. CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION                         0x1F
> 
> Also update Cpuid application in UefiCpuPkg/Application folder.
> 
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> 
> Eric Dong (2):
>   UefiCpuPkg/Cpuid.h: Sync CPUID definition to latest SDM.
>   UefiCpuPkg/Cpuid: Add code to support new definition.
> 
>  UefiCpuPkg/Application/Cpuid/Cpuid.c | 147 ++++++++-
>  UefiCpuPkg/Include/Register/Cpuid.h  | 620 +++++++++++++++++++++++++++++++++--
>  2 files changed, 739 insertions(+), 28 deletions(-)
> 

Acked-by: Laszlo Ersek <lersek@redhat.com>



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

* Re: [Patch 0/2] Update CPUID related definition.
  2018-12-03  6:30 [Patch 0/2] Update CPUID related definition Eric Dong
                   ` (2 preceding siblings ...)
  2018-12-03 11:34 ` [Patch 0/2] Update CPUID related definition Laszlo Ersek
@ 2018-12-10  3:15 ` Ni, Ruiyu
  3 siblings, 0 replies; 5+ messages in thread
From: Ni, Ruiyu @ 2018-12-10  3:15 UTC (permalink / raw)
  To: Dong, Eric, edk2-devel@lists.01.org; +Cc: Laszlo Ersek

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Dong, Eric <eric.dong@intel.com>
> Sent: Monday, December 3, 2018 2:30 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [Patch 0/2] Update CPUID related definition.
> 
> Update CPUID definition to follow SDM 2018'11 version, changes Include:
> 1. Add new fields to the existed data structure, impact CPUIDs include:
>   1. CPUID_THERMAL_POWER_MANAGEMENT                                 0x06
>        CPUID_THERMAL_POWER_MANAGEMENT_EAX
>   2. CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS                        0x07
>        CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX
>        CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_ECX
>   3. CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING  0x0A
>        CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING_EDX
>   4. CPUID_EXTENDED_STATE                                           0x0D
>        CPUID_EXTENDED_STATE_MAIN_LEAF_EAX
>        CPUID_EXTENDED_STATE_SUB_LEAF_ECX
>   5. CPUID_INTEL_RDT_ALLOCATION                                     0x10
>        CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF_EBX
>   6. CPUID_INTEL_SGX                                                0x12
>        CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF_EAX
> 
> 2. Add new data structures which not existed before, impact CPUID includes:
>   1. CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS                        0x07
>        CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EDX
> 
> 3. Remove fields which defined before, impact CPUID includes:
>   1. CPUID_INTEL_RDT_ALLOCATION                                     0x10
>        CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF                        0x01
>          CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_ECX
> 
> 4. Add new sub leaf which not existed before, impact CPUID includes:
>   1. CPUID_INTEL_RDT_ALLOCATION                                     0x10
>        CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF
> 0x03
> 
> 5. Add new CPUIDs which not exist before, new CPUIDs include:
>   1. CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS
> 0x18
>   2. CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION                         0x1F
> 
> Also update Cpuid application in UefiCpuPkg/Application folder.
> 
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> 
> Eric Dong (2):
>   UefiCpuPkg/Cpuid.h: Sync CPUID definition to latest SDM.
>   UefiCpuPkg/Cpuid: Add code to support new definition.
> 
>  UefiCpuPkg/Application/Cpuid/Cpuid.c | 147 ++++++++-
> UefiCpuPkg/Include/Register/Cpuid.h  | 620
> +++++++++++++++++++++++++++++++++--
>  2 files changed, 739 insertions(+), 28 deletions(-)
> 
> --
> 2.15.0.windows.1



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

end of thread, other threads:[~2018-12-10  3:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-03  6:30 [Patch 0/2] Update CPUID related definition Eric Dong
2018-12-03  6:30 ` [Patch 1/2] UefiCpuPkg/Cpuid.h: Sync CPUID definition to latest SDM Eric Dong
2018-12-03  6:30 ` [Patch 2/2] UefiCpuPkg/Cpuid: Add code to support new definition Eric Dong
2018-12-03 11:34 ` [Patch 0/2] Update CPUID related definition Laszlo Ersek
2018-12-10  3:15 ` Ni, Ruiyu

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