public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems.
@ 2017-10-04 19:02 Leo Duran
  2017-10-04 19:02 ` [PATCH v4 1/5] UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support Leo Duran
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Leo Duran @ 2017-10-04 19:02 UTC (permalink / raw)
  To: edk2-devel

This patch-set introduces a couple of FixedPCDs to replace
Intel-specific macros, and better support AMD-based x86 systems.
    
1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map Offset.
2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in SMRAM.

Changes since v3:
Correction on cover letter.

Changes since v2:
The intent of this revision is to maintain compatibility with existing
packages. To that end, changes to OvmgfPkg and QuarkSocPkg are reverted.
Moreover, pertinent macros are replaced in the C code, rather than on
header files that are shared globally.

Changes since v1:
Revision to Cc list for UefiCpuPkg.

Leo Duran (5):
  UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support
  UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance SMM support
  UefiCpuPkg/PiSmmCpuDxeSmm: Use FixedPCDs to enhance SMM support
  UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD to enhance SMM support
  UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library

 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c      |  4 +++-
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    |  5 +++++
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf |  5 +++++
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c                    |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S                     |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm                   |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm                  |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c                    | 10 +++++-----
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                    |  2 --
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf                  |  4 ++++
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c            |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c                    |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c                     |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S                      |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm                    |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm                   |  4 +++-
 UefiCpuPkg/UefiCpuPkg.dec                                     |  9 +++++++++
 17 files changed, 61 insertions(+), 18 deletions(-)

-- 
2.7.4



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

* [PATCH v4 1/5] UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support
  2017-10-04 19:02 [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Leo Duran
@ 2017-10-04 19:02 ` Leo Duran
  2017-10-04 19:02 ` [PATCH v4 2/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance " Leo Duran
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Leo Duran @ 2017-10-04 19:02 UTC (permalink / raw)
  To: edk2-devel
  Cc: Leo Duran, Jiewen Yao, Ruiyu Ni, Michael D Kinney, Jordan Justen,
	Liming Gao

Introduce a couple of FixedPCDs to replace Intel-specific macros.
The new PCDs will allow SMM support on AMD-based x86 systems.

1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map Offset.
2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in SMRAM.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran <leo.duran@amd.com>
---
 UefiCpuPkg/UefiCpuPkg.dec | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index 3bd8740..c92c56e 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -2,6 +2,7 @@
 # This Package provides UEFI compatible CPU modules and libraries.
 #
 # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017, AMD Incorporated. 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.
@@ -204,6 +205,14 @@
   # @Prompt If CPU features will be initialized during S3 resume.
   gUefiCpuPkgTokenSpaceGuid.PcdCpuFeaturesInitOnS3Resume|FALSE|BOOLEAN|0x0000001D
 
+  ## Specifies the Offset of SMRAM Save State Map from SMBASE.
+  # @Prompt SMRAM Save State Map Offset.
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSmramSaveStateMapOffset|0xFC00|UINT16|0x32132113
+
+  ## Specifies the PROCESSOR SMM DESCRIPTOR Offset in SMRAM.
+  # @Prompt SMRAM PSD Offset.
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmPSDOffset|0xFB00|UINT16|0x32132114
+
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   ## Specifies max supported number of Logical Processors.
   # @Prompt Configure max supported number of Logical Processors
-- 
2.7.4



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

* [PATCH v4 2/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance SMM support
  2017-10-04 19:02 [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Leo Duran
  2017-10-04 19:02 ` [PATCH v4 1/5] UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support Leo Duran
@ 2017-10-04 19:02 ` Leo Duran
  2017-10-04 19:02 ` [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use " Leo Duran
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Leo Duran @ 2017-10-04 19:02 UTC (permalink / raw)
  To: edk2-devel
  Cc: Leo Duran, Jiewen Yao, Ruiyu Ni, Michael D Kinney, Jordan Justen,
	Liming Gao

Consume a couple of FixedPCDs to replace Intel-specific macros.
The new PCDs will allow SMM support on AMD-based x86 systems.

1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map Offset.
2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in SMRAM.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran <leo.duran@amd.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
index 099792e..bf237f7 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
@@ -147,6 +147,10 @@
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileRingBuffer             ## CONSUMES
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmFeatureControlMsrLock         ## CONSUMES
 
+[FixedPcd]
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSmramSaveStateMapOffset       ## CONSUMES
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmPSDOffset                     ## CONSUMES
+
 [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber        ## SOMETIMES_CONSUMES
   gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileSize                   ## SOMETIMES_CONSUMES
-- 
2.7.4



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

* [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use FixedPCDs to enhance SMM support
  2017-10-04 19:02 [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Leo Duran
  2017-10-04 19:02 ` [PATCH v4 1/5] UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support Leo Duran
  2017-10-04 19:02 ` [PATCH v4 2/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance " Leo Duran
@ 2017-10-04 19:02 ` Leo Duran
  2017-10-04 19:02 ` [PATCH v4 4/5] UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD " Leo Duran
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Leo Duran @ 2017-10-04 19:02 UTC (permalink / raw)
  To: edk2-devel
  Cc: Leo Duran, Jiewen Yao, Ruiyu Ni, Michael D Kinney, Jordan Justen,
	Liming Gao

Consume a couple of FixedPCDs to replace Intel-specific macros.
The new PCDs will allow SMM support on AMD-based x86 systems.

1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map Offset.
2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in SMRAM.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran <leo.duran@amd.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c         |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S          |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm        |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm       |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c         | 10 +++++-----
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h         |  2 --
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c         |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c          |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S           |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm         |  4 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm        |  4 +++-
 12 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c
index 02a866b..cc2624e 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c
@@ -3,6 +3,8 @@ Semaphore mechanism to indicate to the BSP that an AP has exited SMM
 after SMBASE relocation.
 
 Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017, AMD Incorporated. 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
@@ -38,7 +40,7 @@ SemaphoreHook (
 
   mRebasedFlag = RebasedFlag;
 
-  CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);
+  CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + FixedPcdGet16 (PcdCpuSmmSmramSaveStateMapOffset));
   mSmmRelocationOriginalAddress = (UINTN)HookReturnFromSmm (
                                            CpuIndex,
                                            CpuState,
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S
index 3243a91..25af6e7 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S
@@ -1,6 +1,8 @@
 #------------------------------------------------------------------------------
 #
 # Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017, AMD Incorporated. 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
@@ -35,7 +37,7 @@ ASM_GLOBAL  ASM_PFX(gSmiHandlerIdtr)
 #
 # Constants relating to PROCESSOR_SMM_DESCRIPTOR
 #
-.equ            DSC_OFFSET, 0xfb00
+.equ            DSC_OFFSET, (FixedPcdGet16 (PcdCpuSmmPSDOffset))
 .equ            DSC_GDTPTR, 0x30
 .equ            DSC_GDTSIZ, 0x38
 .equ            DSC_CS, 14
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm
index 8296f36..f526778 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm
@@ -1,5 +1,7 @@
 ;------------------------------------------------------------------------------ ;
 ; Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2017, AMD Incorporated. 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
@@ -29,7 +31,7 @@ MSR_EFER_XD   EQU     0800h
 ;
 ; Constants relating to PROCESSOR_SMM_DESCRIPTOR
 ;
-DSC_OFFSET    EQU     0fb00h
+DSC_OFFSET    EQU     (FixedPcdGet16 (PcdCpuSmmPSDOffset))
 DSC_GDTPTR    EQU     30h
 DSC_GDTSIZ    EQU     38h
 DSC_CS        EQU     14
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
index 4d2383f..9092dcc 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
@@ -1,5 +1,7 @@
 ;------------------------------------------------------------------------------ ;
 ; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2017, AMD Incorporated. 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
@@ -25,7 +27,7 @@
 ;
 ; Constants relating to PROCESSOR_SMM_DESCRIPTOR
 ;
-%define DSC_OFFSET 0xfb00
+%define DSC_OFFSET (FixedPcdGet16 (PcdCpuSmmPSDOffset))
 %define DSC_GDTPTR 0x30
 %define DSC_GDTSIZ 0x38
 %define DSC_CS 14
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
index 282d2e6..b2a941e 100755
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
@@ -407,7 +407,7 @@ SmmRelocateBases (
   gcSmiInitGdtr.Limit = gcSmiGdtr.Limit;
 
   U8Ptr = (UINT8*)(UINTN)(SMM_DEFAULT_SMBASE + SMM_HANDLER_OFFSET);
-  CpuStatePtr = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);
+  CpuStatePtr = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + FixedPcdGet16 (PcdCpuSmmSmramSaveStateMapOffset));
 
   //
   // Backup original contents at address 0x38000
@@ -707,12 +707,12 @@ PiCpuSmmEntry (
 
   //
   // Compute tile size of buffer required to hold the CPU SMRAM Save State Map, extra CPU
-  // specific context start starts at SMBASE + SMM_PSD_OFFSET, and the SMI entry point.
+  // specific context start starts at SMBASE + PcdCpuSmmPSDOffset, and the SMI entry point.
   // This size is rounded up to nearest power of 2.
   //
   TileCodeSize = GetSmiHandlerSize ();
   TileCodeSize = ALIGN_VALUE(TileCodeSize, SIZE_4KB);
-  TileDataSize = (SMRAM_SAVE_STATE_MAP_OFFSET - SMM_PSD_OFFSET) + sizeof (SMRAM_SAVE_STATE_MAP);
+  TileDataSize = (FixedPcdGet16 (PcdCpuSmmSmramSaveStateMapOffset) - FixedPcdGet16 (PcdCpuSmmPSDOffset)) + sizeof (SMRAM_SAVE_STATE_MAP);
   TileDataSize = ALIGN_VALUE(TileDataSize, SIZE_4KB);
   TileSize = TileDataSize + TileCodeSize - 1;
   TileSize = 2 * GetPowerOfTwo32 ((UINT32)TileSize);
@@ -725,7 +725,7 @@ PiCpuSmmEntry (
   // the SMI Handler size must be reduced or the size of the extra CPU specific
   // context must be reduced.
   //
-  ASSERT (TileSize <= (SMRAM_SAVE_STATE_MAP_OFFSET + sizeof (SMRAM_SAVE_STATE_MAP) - SMM_HANDLER_OFFSET));
+  ASSERT (TileSize <= (FixedPcdGet16 (PcdCpuSmmSmramSaveStateMapOffset) + sizeof (SMRAM_SAVE_STATE_MAP) - SMM_HANDLER_OFFSET));
 
   //
   // Allocate buffer for all of the tiles.
@@ -783,7 +783,7 @@ PiCpuSmmEntry (
   for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
     mCpuHotPlugData.SmBase[Index]          = (UINTN)Buffer + Index * TileSize - SMM_HANDLER_OFFSET;
     gSmmCpuPrivate->CpuSaveStateSize[Index] = sizeof(SMRAM_SAVE_STATE_MAP);
-    gSmmCpuPrivate->CpuSaveState[Index]     = (VOID *)(mCpuHotPlugData.SmBase[Index] + SMRAM_SAVE_STATE_MAP_OFFSET);
+    gSmmCpuPrivate->CpuSaveState[Index]     = (VOID *)(mCpuHotPlugData.SmBase[Index] + FixedPcdGet16 (PcdCpuSmmSmramSaveStateMapOffset));
     gSmmCpuPrivate->Operation[Index] = SmmCpuNone;
 
     if (Index < mNumberOfCpus) {
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index 1cf85c1..31e4f53 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -360,8 +360,6 @@ typedef struct {
   UINT32       MsrIndex;
 } MP_MSR_LOCK;
 
-#define SMM_PSD_OFFSET              0xfb00
-
 ///
 /// All global semaphores' pointer
 ///
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
index 3ad5256..147b694 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
@@ -1,6 +1,8 @@
 /** @file
 
 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017, AMD Incorporated. 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
@@ -703,7 +705,7 @@ PatchSmmSaveStateMap (
 
   TileCodeSize = GetSmiHandlerSize ();
   TileCodeSize = ALIGN_VALUE(TileCodeSize, SIZE_4KB);
-  TileDataSize = (SMRAM_SAVE_STATE_MAP_OFFSET - SMM_PSD_OFFSET) + sizeof (SMRAM_SAVE_STATE_MAP);
+  TileDataSize = (FixedPcdGet16 (PcdCpuSmmSmramSaveStateMapOffset) - FixedPcdGet16 (PcdCpuSmmPSDOffset)) + sizeof (SMRAM_SAVE_STATE_MAP);
   TileDataSize = ALIGN_VALUE(TileDataSize, SIZE_4KB);
   TileSize = TileDataSize + TileCodeSize - 1;
   TileSize = 2 * GetPowerOfTwo32 ((UINT32)TileSize);
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
index 3188d43..d59b9a0 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c
@@ -2,6 +2,8 @@
 Provides services to access SMRAM Save State Map
 
 Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017, AMD Incorporated. 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
@@ -690,7 +692,7 @@ InstallSmiHandler (
   //
   // Initialize PROCESSOR_SMM_DESCRIPTOR
   //
-  Psd = (PROCESSOR_SMM_DESCRIPTOR *)(VOID *)((UINTN)SmBase + SMM_PSD_OFFSET);
+  Psd = (PROCESSOR_SMM_DESCRIPTOR *)(VOID *)((UINTN)SmBase + FixedPcdGet16 (PcdCpuSmmPSDOffset));
   CopyMem (Psd, &gcPsd, sizeof (gcPsd));
   Psd->SmmGdtPtr = (UINT64)GdtBase;
   Psd->SmmGdtSize = (UINT32)GdtSize;
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c
index 6dbcb08..e74bb69 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c
@@ -3,6 +3,8 @@ Semaphore mechanism to indicate to the BSP that an AP has exited SMM
 after SMBASE relocation.
 
 Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017, AMD Incorporated. 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
@@ -51,7 +53,7 @@ SemaphoreHook (
   mRebasedFlag       = RebasedFlag;
   mRebasedFlagAddr32 = (UINT32)(UINTN)mRebasedFlag;
 
-  CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);
+  CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + FixedPcdGet16 (PcdCpuSmmSmramSaveStateMapOffset));
   mSmmRelocationOriginalAddress = HookReturnFromSmm (
                                     CpuIndex,
                                     CpuState,
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S
index 600d862..ebea477 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S
@@ -1,6 +1,8 @@
 #------------------------------------------------------------------------------
 #
 # Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017, AMD Incorporated. 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
@@ -34,7 +36,7 @@ ASM_GLOBAL  ASM_PFX(gSmiHandlerIdtr)
 #
 # Constants relating to PROCESSOR_SMM_DESCRIPTOR
 #
-.equ            DSC_OFFSET, 0xfb00
+.equ            DSC_OFFSET, (FixedPcdGet16 (PcdCpuSmmPSDOffset))
 .equ            DSC_GDTPTR, 0x30
 .equ            DSC_GDTSIZ, 0x38
 .equ            DSC_CS, 14
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm
index c74f82a..ff46838 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm
@@ -1,5 +1,7 @@
 ;------------------------------------------------------------------------------ ;
 ; Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2017, AMD Incorporated. 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
@@ -39,7 +41,7 @@ MSR_EFER_XD   EQU     0800h
 ;
 ; Constants relating to PROCESSOR_SMM_DESCRIPTOR
 ;
-DSC_OFFSET    EQU     0fb00h
+DSC_OFFSET    EQU     (FixedPcdGet16 (PcdCpuSmmPSDOffset))
 DSC_GDTPTR    EQU     30h
 DSC_GDTSIZ    EQU     38h
 DSC_CS        EQU     14
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm
index c3c094f..f55da9b 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm
@@ -1,5 +1,7 @@
 ;------------------------------------------------------------------------------ ;
 ; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2017, AMD Incorporated. 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
@@ -29,7 +31,7 @@
 ;
 ; Constants relating to PROCESSOR_SMM_DESCRIPTOR
 ;
-%define DSC_OFFSET 0xfb00
+%define DSC_OFFSET (FixedPcdGet16 (PcdCpuSmmPSDOffset))
 %define DSC_GDTPTR 0x30
 %define DSC_GDTSIZ 0x38
 %define DSC_CS 14
-- 
2.7.4



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

* [PATCH v4 4/5] UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD to enhance SMM support
  2017-10-04 19:02 [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Leo Duran
                   ` (2 preceding siblings ...)
  2017-10-04 19:02 ` [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use " Leo Duran
@ 2017-10-04 19:02 ` Leo Duran
  2017-10-04 19:02 ` [PATCH v4 5/5] UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library Leo Duran
  2017-10-05  0:49 ` [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Yao, Jiewen
  5 siblings, 0 replies; 12+ messages in thread
From: Leo Duran @ 2017-10-04 19:02 UTC (permalink / raw)
  To: edk2-devel
  Cc: Leo Duran, Jiewen Yao, Ruiyu Ni, Michael D Kinney, Jordan Justen,
	Liming Gao

Consume a FixedPCD to replace Intel-specific macro.
The new PCD will allow SMM support on AMD-based x86 systems.

PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map Offset.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran <leo.duran@amd.com>
---
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    | 5 +++++
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
index 77908b0..1be2671 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
@@ -2,6 +2,8 @@
 #  The CPU specific programming for PiSmmCpuDxeSmm module.
 #
 #  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2017, AMD Incorporated. 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
@@ -36,5 +38,8 @@
   MemoryAllocationLib
   DebugLib
 
+[FixedPcd]
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSmramSaveStateMapOffset       ## CONSUMES
+
 [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber        ## SOMETIMES_CONSUMES
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
index db8dcdc..a91e9ed 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
@@ -3,6 +3,8 @@
 #  is included.
 #
 #  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2017, AMD Incorporated. 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
@@ -78,6 +80,9 @@
   gEfiAcpi20TableGuid                      ## SOMETIMES_CONSUMES ## SystemTable
   gEfiAcpi10TableGuid                      ## SOMETIMES_CONSUMES ## SystemTable
 
+[FixedPcd]
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSmramSaveStateMapOffset       ## CONSUMES
+
 [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber        ## SOMETIMES_CONSUMES
   gUefiCpuPkgTokenSpaceGuid.PcdCpuMsegSize                         ## SOMETIMES_CONSUMES
-- 
2.7.4



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

* [PATCH v4 5/5] UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library
  2017-10-04 19:02 [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Leo Duran
                   ` (3 preceding siblings ...)
  2017-10-04 19:02 ` [PATCH v4 4/5] UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD " Leo Duran
@ 2017-10-04 19:02 ` Leo Duran
  2017-10-05  0:49 ` [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Yao, Jiewen
  5 siblings, 0 replies; 12+ messages in thread
From: Leo Duran @ 2017-10-04 19:02 UTC (permalink / raw)
  To: edk2-devel
  Cc: Leo Duran, Jiewen Yao, Ruiyu Ni, Michael D Kinney, Jordan Justen,
	Liming Gao

Consume a FixedPCD to replace Intel-specific macro.
The new PCD will allow SMM support on AMD-based x86 systems.

PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map Offset.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran <leo.duran@amd.com>
---
 UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
index 2d2bc6d..88f43b4 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
@@ -2,6 +2,8 @@
 The CPU specific programming for PiSmmCpuDxeSmm module.
 
 Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017, AMD Incorporated. 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
@@ -224,7 +226,7 @@ SmmCpuFeaturesInitializeProcessor (
   //
   // Configure SMBASE.
   //
-  CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);
+  CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + FixedPcdGet16 (PcdCpuSmmSmramSaveStateMapOffset));
   CpuState->x86.SMBASE = (UINT32)CpuHotPlugData->SmBase[CpuIndex];
 
   //
-- 
2.7.4



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

* Re: [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems.
  2017-10-04 19:02 [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Leo Duran
                   ` (4 preceding siblings ...)
  2017-10-04 19:02 ` [PATCH v4 5/5] UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library Leo Duran
@ 2017-10-05  0:49 ` Yao, Jiewen
  2017-10-05  1:18   ` Marvin H?user
  2017-10-06 15:27   ` Duran, Leo
  5 siblings, 2 replies; 12+ messages in thread
From: Yao, Jiewen @ 2017-10-05  0:49 UTC (permalink / raw)
  To: Leo Duran, edk2-devel@lists.01.org

Hi Leo
I do not suggest we introduce PcdCpuSmmSmramSaveStateMapOffset.

This is unnecessary, because it is CPU attribute but not some end user configurable data.

I think we can use CPUID to distinguish AMD from INTEL. Is that technically possible?

I found we already have code at 
  C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicX2ApicLib\BaseXApicX2ApicLib.c(1206):    if (StandardSignatureIsAuthenticAMD()) {
  C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicLib\BaseXApicLib.c(1111):    if (StandardSignatureIsAuthenticAMD()) {



Thank you
Yao Jiewen


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Leo
> Duran
> Sent: Thursday, October 5, 2017 3:02 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based x86
> systems.
> 
> This patch-set introduces a couple of FixedPCDs to replace
> Intel-specific macros, and better support AMD-based x86 systems.
> 
> 1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map Offset.
> 2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in SMRAM.
> 
> Changes since v3:
> Correction on cover letter.
> 
> Changes since v2:
> The intent of this revision is to maintain compatibility with existing
> packages. To that end, changes to OvmgfPkg and QuarkSocPkg are reverted.
> Moreover, pertinent macros are replaced in the C code, rather than on
> header files that are shared globally.
> 
> Changes since v1:
> Revision to Cc list for UefiCpuPkg.
> 
> Leo Duran (5):
>   UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support
>   UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance SMM
> support
>   UefiCpuPkg/PiSmmCpuDxeSmm: Use FixedPCDs to enhance SMM support
>   UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD to enhance SMM
> support
>   UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library
> 
>  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c      |  4
> +++-
>  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    |  5
> +++++
>  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf |  5
> +++++
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c                    |  4
> +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S                     |  4
> +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm                   |  4
> +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm                  |  4
> +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c                    |
> 10 +++++-----
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                    |
> 2 --
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf                  |
> 4 ++++
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> |  4 +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c                    |  4
> +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c                     |
> 4 +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S                      |  4
> +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm                    |  4
> +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm                   |  4
> +++-
>  UefiCpuPkg/UefiCpuPkg.dec                                     |  9
> +++++++++
>  17 files changed, 61 insertions(+), 18 deletions(-)
> 
> --
> 2.7.4
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


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

* Re: [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems.
  2017-10-05  0:49 ` [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Yao, Jiewen
@ 2017-10-05  1:18   ` Marvin H?user
  2017-10-05  3:19     ` Yao, Jiewen
  2017-10-05 14:57     ` Duran, Leo
  2017-10-06 15:27   ` Duran, Leo
  1 sibling, 2 replies; 12+ messages in thread
From: Marvin H?user @ 2017-10-05  1:18 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: Yao, Jiewen, leo.duran@amd.com

Hey Jiewen,
Hey Leo,

May I suggest replacing "StandardSignatureIsAuthenticAMD()" and the PCDs introduced by the series with a Fixed "PcdCpuVendor" enum or alike?
The contra of "StandardSignatureIsAuthenticAMD()" is that it's a runtime action. From my point of view, this has no notable advantage as boards use either an Intel or an AMD chipset and hence the EDK2 Firmware Package has compilation-time knowledge of the target platform.
On the other hand, the PCDs introduced by this patch cause the contra that the platform DSC must set the correct vendor-specific (intel, AMD) value.
If the code checked for the CPU Vendor PCD and used the correct values based on that, the values for the other vendors would get optimized away (no unnecessary runtime actions) and the platform package owner does not need to worry about setting PCDs to AMD-specific values except for the CPU Vendor PCD.
Backwards-compatibility could be ensured by defaulting to some reserved value for the PCD and handling detection via StandardSignatureIsAuthenticAMD() if the platform DSC does not change it.

Thanks,
Marvin.

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Yao, Jiewen
> Sent: Thursday, October 5, 2017 2:49 AM
> To: Leo Duran <leo.duran@amd.com>; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based
> x86 systems.
> 
> Hi Leo
> I do not suggest we introduce PcdCpuSmmSmramSaveStateMapOffset.
> 
> This is unnecessary, because it is CPU attribute but not some end user
> configurable data.
> 
> I think we can use CPUID to distinguish AMD from INTEL. Is that technically
> possible?
> 
> I found we already have code at
> 
> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicX2ApicLib\BaseXApic
> X2ApicLib.c(1206):    if (StandardSignatureIsAuthenticAMD()) {
> 
> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicLib\BaseXApicLib.c(11
> 11):    if (StandardSignatureIsAuthenticAMD()) {
> 
> 
> 
> Thank you
> Yao Jiewen
> 
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> > Leo Duran
> > Sent: Thursday, October 5, 2017 3:02 AM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based x86
> > systems.
> >
> > This patch-set introduces a couple of FixedPCDs to replace
> > Intel-specific macros, and better support AMD-based x86 systems.
> >
> > 1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map
> Offset.
> > 2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in SMRAM.
> >
> > Changes since v3:
> > Correction on cover letter.
> >
> > Changes since v2:
> > The intent of this revision is to maintain compatibility with existing
> > packages. To that end, changes to OvmgfPkg and QuarkSocPkg are
> reverted.
> > Moreover, pertinent macros are replaced in the C code, rather than on
> > header files that are shared globally.
> >
> > Changes since v1:
> > Revision to Cc list for UefiCpuPkg.
> >
> > Leo Duran (5):
> >   UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support
> >   UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance SMM
> support
> >   UefiCpuPkg/PiSmmCpuDxeSmm: Use FixedPCDs to enhance SMM
> support
> >   UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD to enhance SMM
> > support
> >   UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library
> >
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c      |  4
> > +++-
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    |  5
> > +++++
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf |  5
> > +++++
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c                    |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S                     |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm                   |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm                  |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c                    |
> > 10 +++++-----
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                    |
> > 2 --
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf                  |
> > 4 ++++
> >  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> > |  4 +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c                    |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c                     |
> > 4 +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S                      |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm                    |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm                   |  4
> > +++-
> >  UefiCpuPkg/UefiCpuPkg.dec                                     |  9
> > +++++++++
> >  17 files changed, 61 insertions(+), 18 deletions(-)
> >
> > --
> > 2.7.4
> >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


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

* Re: [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems.
  2017-10-05  1:18   ` Marvin H?user
@ 2017-10-05  3:19     ` Yao, Jiewen
  2017-10-05 14:57     ` Duran, Leo
  1 sibling, 0 replies; 12+ messages in thread
From: Yao, Jiewen @ 2017-10-05  3:19 UTC (permalink / raw)
  To: Marvin H?user; +Cc: edk2-devel@lists.01.org

interesting idea!
I think it is an option.
I would prefer an all-or-none approach.

If we use vender-pcd, we remove all check.
Vise versa, if we use check, we use check in all places.

Mixing runtime check and pcd may bring unnecessary confusing.

thank you!
Yao, Jiewen


> 在 2017年10月5日,上午9:19,Marvin H?user <Marvin.Haeuser@outlook.com> 写道:
> 
> Hey Jiewen,
> Hey Leo,
> 
> May I suggest replacing "StandardSignatureIsAuthenticAMD()" and the PCDs introduced by the series with a Fixed "PcdCpuVendor" enum or alike?
> The contra of "StandardSignatureIsAuthenticAMD()" is that it's a runtime action. From my point of view, this has no notable advantage as boards use either an Intel or an AMD chipset and hence the EDK2 Firmware Package has compilation-time knowledge of the target platform.
> On the other hand, the PCDs introduced by this patch cause the contra that the platform DSC must set the correct vendor-specific (intel, AMD) value.
> If the code checked for the CPU Vendor PCD and used the correct values based on that, the values for the other vendors would get optimized away (no unnecessary runtime actions) and the platform package owner does not need to worry about setting PCDs to AMD-specific values except for the CPU Vendor PCD.
> Backwards-compatibility could be ensured by defaulting to some reserved value for the PCD and handling detection via StandardSignatureIsAuthenticAMD() if the platform DSC does not change it.
> 
> Thanks,
> Marvin.
> 
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Yao, Jiewen
>> Sent: Thursday, October 5, 2017 2:49 AM
>> To: Leo Duran <leo.duran@amd.com>; edk2-devel@lists.01.org
>> Subject: Re: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based
>> x86 systems.
>> 
>> Hi Leo
>> I do not suggest we introduce PcdCpuSmmSmramSaveStateMapOffset.
>> 
>> This is unnecessary, because it is CPU attribute but not some end user
>> configurable data.
>> 
>> I think we can use CPUID to distinguish AMD from INTEL. Is that technically
>> possible?
>> 
>> I found we already have code at
>> 
>> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicX2ApicLib\BaseXApic
>> X2ApicLib.c(1206):    if (StandardSignatureIsAuthenticAMD()) {
>> 
>> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicLib\BaseXApicLib.c(11
>> 11):    if (StandardSignatureIsAuthenticAMD()) {
>> 
>> 
>> 
>> Thank you
>> Yao Jiewen
>> 
>> 
>>> -----Original Message-----
>>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>>> Leo Duran
>>> Sent: Thursday, October 5, 2017 3:02 AM
>>> To: edk2-devel@lists.01.org
>>> Subject: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based x86
>>> systems.
>>> 
>>> This patch-set introduces a couple of FixedPCDs to replace
>>> Intel-specific macros, and better support AMD-based x86 systems.
>>> 
>>> 1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map
>> Offset.
>>> 2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in SMRAM.
>>> 
>>> Changes since v3:
>>> Correction on cover letter.
>>> 
>>> Changes since v2:
>>> The intent of this revision is to maintain compatibility with existing
>>> packages. To that end, changes to OvmgfPkg and QuarkSocPkg are
>> reverted.
>>> Moreover, pertinent macros are replaced in the C code, rather than on
>>> header files that are shared globally.
>>> 
>>> Changes since v1:
>>> Revision to Cc list for UefiCpuPkg.
>>> 
>>> Leo Duran (5):
>>>  UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support
>>>  UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance SMM
>> support
>>>  UefiCpuPkg/PiSmmCpuDxeSmm: Use FixedPCDs to enhance SMM
>> support
>>>  UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD to enhance SMM
>>> support
>>>  UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library
>>> 
>>> UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c      |  4
>>> +++-
>>> UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    |  5
>>> +++++
>>> UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf |  5
>>> +++++
>>> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c                    |  4
>>> +++-
>>> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S                     |  4
>>> +++-
>>> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm                   |  4
>>> +++-
>>> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm                  |  4
>>> +++-
>>> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c                    |
>>> 10 +++++-----
>>> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                    |
>>> 2 --
>>> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf                  |
>>> 4 ++++
>>> UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
>>> |  4 +++-
>>> UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c                    |  4
>>> +++-
>>> UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c                     |
>>> 4 +++-
>>> UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S                      |  4
>>> +++-
>>> UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm                    |  4
>>> +++-
>>> UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm                   |  4
>>> +++-
>>> UefiCpuPkg/UefiCpuPkg.dec                                     |  9
>>> +++++++++
>>> 17 files changed, 61 insertions(+), 18 deletions(-)
>>> 
>>> --
>>> 2.7.4
>>> 
>>> _______________________________________________
>>> edk2-devel mailing list
>>> edk2-devel@lists.01.org
>>> https://lists.01.org/mailman/listinfo/edk2-devel
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

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

* Re: [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems.
  2017-10-05  1:18   ` Marvin H?user
  2017-10-05  3:19     ` Yao, Jiewen
@ 2017-10-05 14:57     ` Duran, Leo
  2017-10-05 19:09       ` Marvin H?user
  1 sibling, 1 reply; 12+ messages in thread
From: Duran, Leo @ 2017-10-05 14:57 UTC (permalink / raw)
  To: 'Marvin H?user', edk2-devel@lists.01.org; +Cc: Yao, Jiewen



> -----Original Message-----
> From: Marvin H?user [mailto:Marvin.Haeuser@outlook.com]
> Sent: Wednesday, October 04, 2017 8:19 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Duran, Leo
> <leo.duran@amd.com>
> Subject: RE: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based
> x86 systems.
> 
> Hey Jiewen,
> Hey Leo,
> 
> May I suggest replacing "StandardSignatureIsAuthenticAMD()" and the PCDs
> introduced by the series with a Fixed "PcdCpuVendor" enum or alike?

Hi Marvin,
I'm not sure I follow your suggestion.
It seems like the platform .DSC would then need to set PcdCpuVendor to an appropriate value at build-time... No?
Leo.

> The contra of "StandardSignatureIsAuthenticAMD()" is that it's a runtime
> action. From my point of view, this has no notable advantage as boards use
> either an Intel or an AMD chipset and hence the EDK2 Firmware Package has
> compilation-time knowledge of the target platform.
> On the other hand, the PCDs introduced by this patch cause the contra that
> the platform DSC must set the correct vendor-specific (intel, AMD) value.
> If the code checked for the CPU Vendor PCD and used the correct values
> based on that, the values for the other vendors would get optimized away
> (no unnecessary runtime actions) and the platform package owner does not
> need to worry about setting PCDs to AMD-specific values except for the CPU
> Vendor PCD.
> Backwards-compatibility could be ensured by defaulting to some reserved
> value for the PCD and handling detection via
> StandardSignatureIsAuthenticAMD() if the platform DSC does not change it.
> 
> Thanks,
> Marvin.
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> > Yao, Jiewen
> > Sent: Thursday, October 5, 2017 2:49 AM
> > To: Leo Duran <leo.duran@amd.com>; edk2-devel@lists.01.org
> > Subject: Re: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based
> > x86 systems.
> >
> > Hi Leo
> > I do not suggest we introduce PcdCpuSmmSmramSaveStateMapOffset.
> >
> > This is unnecessary, because it is CPU attribute but not some end user
> > configurable data.
> >
> > I think we can use CPUID to distinguish AMD from INTEL. Is that
> > technically possible?
> >
> > I found we already have code at
> >
> >
> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicX2ApicLib\BaseXApic
> > X2ApicLib.c(1206):    if (StandardSignatureIsAuthenticAMD()) {
> >
> >
> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicLib\BaseXApicLib.c(11
> > 11):    if (StandardSignatureIsAuthenticAMD()) {
> >
> >
> >
> > Thank you
> > Yao Jiewen
> >
> >
> > > -----Original Message-----
> > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf
> > > Of Leo Duran
> > > Sent: Thursday, October 5, 2017 3:02 AM
> > > To: edk2-devel@lists.01.org
> > > Subject: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based
> > > x86 systems.
> > >
> > > This patch-set introduces a couple of FixedPCDs to replace
> > > Intel-specific macros, and better support AMD-based x86 systems.
> > >
> > > 1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map
> > Offset.
> > > 2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in SMRAM.
> > >
> > > Changes since v3:
> > > Correction on cover letter.
> > >
> > > Changes since v2:
> > > The intent of this revision is to maintain compatibility with
> > > existing packages. To that end, changes to OvmgfPkg and QuarkSocPkg
> > > are
> > reverted.
> > > Moreover, pertinent macros are replaced in the C code, rather than
> > > on header files that are shared globally.
> > >
> > > Changes since v1:
> > > Revision to Cc list for UefiCpuPkg.
> > >
> > > Leo Duran (5):
> > >   UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support
> > >   UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance SMM
> > support
> > >   UefiCpuPkg/PiSmmCpuDxeSmm: Use FixedPCDs to enhance SMM
> > support
> > >   UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD to enhance SMM
> > > support
> > >   UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library
> > >
> > >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c      |  4
> > > +++-
> > >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    |  5
> > > +++++
> > >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf |
> 5
> > > +++++
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c                    |  4
> > > +++-
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S                     |  4
> > > +++-
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm                   |  4
> > > +++-
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm                  |  4
> > > +++-
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c                    |
> > > 10 +++++-----
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                    |
> > > 2 --
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf                  |
> > > 4 ++++
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> > > |  4 +++-
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c                    |  4
> > > +++-
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c                     |
> > > 4 +++-
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S                      |  4
> > > +++-
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm                    |  4
> > > +++-
> > >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm                   |  4
> > > +++-
> > >  UefiCpuPkg/UefiCpuPkg.dec                                     |  9
> > > +++++++++
> > >  17 files changed, 61 insertions(+), 18 deletions(-)
> > >
> > > --
> > > 2.7.4
> > >
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel


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

* Re: [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems.
  2017-10-05 14:57     ` Duran, Leo
@ 2017-10-05 19:09       ` Marvin H?user
  0 siblings, 0 replies; 12+ messages in thread
From: Marvin H?user @ 2017-10-05 19:09 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Hi Leo,

Yes, that's right. That PCD would be the only needed to be set by the platform DSC.

Thanks,
Marvin

> -----Original Message-----
> From: Duran, Leo [mailto:leo.duran@amd.com]
> Sent: Thursday, October 5, 2017 4:57 PM
> To: 'Marvin H?user' <Marvin.Haeuser@outlook.com>; edk2-
> devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>
> Subject: RE: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based
> x86 systems.
> 
> 
> 
> > -----Original Message-----
> > From: Marvin H?user [mailto:Marvin.Haeuser@outlook.com]
> > Sent: Wednesday, October 04, 2017 8:19 PM
> > To: edk2-devel@lists.01.org
> > Cc: Yao, Jiewen <jiewen.yao@intel.com>; Duran, Leo
> <leo.duran@amd.com>
> > Subject: RE: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based
> > x86 systems.
> >
> > Hey Jiewen,
> > Hey Leo,
> >
> > May I suggest replacing "StandardSignatureIsAuthenticAMD()" and the
> > PCDs introduced by the series with a Fixed "PcdCpuVendor" enum or alike?
> 
> Hi Marvin,
> I'm not sure I follow your suggestion.
> It seems like the platform .DSC would then need to set PcdCpuVendor to an
> appropriate value at build-time... No?
> Leo.
> 
> > The contra of "StandardSignatureIsAuthenticAMD()" is that it's a
> > runtime action. From my point of view, this has no notable advantage
> > as boards use either an Intel or an AMD chipset and hence the EDK2
> > Firmware Package has compilation-time knowledge of the target platform.
> > On the other hand, the PCDs introduced by this patch cause the contra
> > that the platform DSC must set the correct vendor-specific (intel, AMD)
> value.
> > If the code checked for the CPU Vendor PCD and used the correct values
> > based on that, the values for the other vendors would get optimized
> > away (no unnecessary runtime actions) and the platform package owner
> > does not need to worry about setting PCDs to AMD-specific values
> > except for the CPU Vendor PCD.
> > Backwards-compatibility could be ensured by defaulting to some
> > reserved value for the PCD and handling detection via
> > StandardSignatureIsAuthenticAMD() if the platform DSC does not change
> it.
> >
> > Thanks,
> > Marvin.
> >
> > > -----Original Message-----
> > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf
> > > Of Yao, Jiewen
> > > Sent: Thursday, October 5, 2017 2:49 AM
> > > To: Leo Duran <leo.duran@amd.com>; edk2-devel@lists.01.org
> > > Subject: Re: [edk2] [PATCH v4 0/5] Enhanced SMM support for
> > > AMD-based
> > > x86 systems.
> > >
> > > Hi Leo
> > > I do not suggest we introduce PcdCpuSmmSmramSaveStateMapOffset.
> > >
> > > This is unnecessary, because it is CPU attribute but not some end
> > > user configurable data.
> > >
> > > I think we can use CPUID to distinguish AMD from INTEL. Is that
> > > technically possible?
> > >
> > > I found we already have code at
> > >
> > >
> >
> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicX2ApicLib\BaseXApic
> > > X2ApicLib.c(1206):    if (StandardSignatureIsAuthenticAMD()) {
> > >
> > >
> >
> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicLib\BaseXApicLib.c(1
> > 1
> > > 11):    if (StandardSignatureIsAuthenticAMD()) {
> > >
> > >
> > >
> > > Thank you
> > > Yao Jiewen
> > >
> > >
> > > > -----Original Message-----
> > > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On
> > > > Behalf Of Leo Duran
> > > > Sent: Thursday, October 5, 2017 3:02 AM
> > > > To: edk2-devel@lists.01.org
> > > > Subject: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based
> > > > x86 systems.
> > > >
> > > > This patch-set introduces a couple of FixedPCDs to replace
> > > > Intel-specific macros, and better support AMD-based x86 systems.
> > > >
> > > > 1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map
> > > Offset.
> > > > 2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in
> SMRAM.
> > > >
> > > > Changes since v3:
> > > > Correction on cover letter.
> > > >
> > > > Changes since v2:
> > > > The intent of this revision is to maintain compatibility with
> > > > existing packages. To that end, changes to OvmgfPkg and
> > > > QuarkSocPkg are
> > > reverted.
> > > > Moreover, pertinent macros are replaced in the C code, rather than
> > > > on header files that are shared globally.
> > > >
> > > > Changes since v1:
> > > > Revision to Cc list for UefiCpuPkg.
> > > >
> > > > Leo Duran (5):
> > > >   UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support
> > > >   UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance
> SMM
> > > support
> > > >   UefiCpuPkg/PiSmmCpuDxeSmm: Use FixedPCDs to enhance SMM
> > > support
> > > >   UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD to enhance
> SMM
> > > > support
> > > >   UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library
> > > >
> > > >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c      |  4
> > > > +++-
> > > >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    |
> 5
> > > > +++++
> > > >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
> |
> > 5
> > > > +++++
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c                    |  4
> > > > +++-
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S                     |  4
> > > > +++-
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm                   |  4
> > > > +++-
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm                  |  4
> > > > +++-
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c                    |
> > > > 10 +++++-----
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                    |
> > > > 2 --
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf                  |
> > > > 4 ++++
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> > > > |  4 +++-
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c                    |  4
> > > > +++-
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c                     |
> > > > 4 +++-
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S                      |  4
> > > > +++-
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm                    |  4
> > > > +++-
> > > >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm                   |  4
> > > > +++-
> > > >  UefiCpuPkg/UefiCpuPkg.dec                                     |  9
> > > > +++++++++
> > > >  17 files changed, 61 insertions(+), 18 deletions(-)
> > > >
> > > > --
> > > > 2.7.4
> > > >
> > > > _______________________________________________
> > > > edk2-devel mailing list
> > > > edk2-devel@lists.01.org
> > > > https://lists.01.org/mailman/listinfo/edk2-devel
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel


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

* Re: [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems.
  2017-10-05  0:49 ` [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Yao, Jiewen
  2017-10-05  1:18   ` Marvin H?user
@ 2017-10-06 15:27   ` Duran, Leo
  1 sibling, 0 replies; 12+ messages in thread
From: Duran, Leo @ 2017-10-06 15:27 UTC (permalink / raw)
  To: 'Yao, Jiewen', edk2-devel@lists.01.org



> -----Original Message-----
> From: Yao, Jiewen [mailto:jiewen.yao@intel.com]
> Sent: Wednesday, October 04, 2017 7:49 PM
> To: Duran, Leo <leo.duran@amd.com>; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based
> x86 systems.
> 
> Hi Leo
> I do not suggest we introduce PcdCpuSmmSmramSaveStateMapOffset.
> 
> This is unnecessary, because it is CPU attribute but not some end user
> configurable data.
> 
> I think we can use CPUID to distinguish AMD from INTEL. Is that technically
> possible?
> 

Hi Yao,
I see your point about the PCD usage model.
I plan to push v5 today. Thanks for the feedback.
Leo.

> I found we already have code at
> 
> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicX2ApicLib\BaseXApic
> X2ApicLib.c(1206):    if (StandardSignatureIsAuthenticAMD()) {
> 
> C:\home\EdkIIGit\edk2\UefiCpuPkg\Library\BaseXApicLib\BaseXApicLib.c(11
> 11):    if (StandardSignatureIsAuthenticAMD()) {
> 
> 
> 
> Thank you
> Yao Jiewen
> 
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> > Leo Duran
> > Sent: Thursday, October 5, 2017 3:02 AM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] [PATCH v4 0/5] Enhanced SMM support for AMD-based x86
> > systems.
> >
> > This patch-set introduces a couple of FixedPCDs to replace
> > Intel-specific macros, and better support AMD-based x86 systems.
> >
> > 1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map
> Offset.
> > 2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in SMRAM.
> >
> > Changes since v3:
> > Correction on cover letter.
> >
> > Changes since v2:
> > The intent of this revision is to maintain compatibility with existing
> > packages. To that end, changes to OvmgfPkg and QuarkSocPkg are
> reverted.
> > Moreover, pertinent macros are replaced in the C code, rather than on
> > header files that are shared globally.
> >
> > Changes since v1:
> > Revision to Cc list for UefiCpuPkg.
> >
> > Leo Duran (5):
> >   UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support
> >   UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance SMM
> support
> >   UefiCpuPkg/PiSmmCpuDxeSmm: Use FixedPCDs to enhance SMM
> support
> >   UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD to enhance SMM
> > support
> >   UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library
> >
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c      |  4
> > +++-
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf    |  5
> > +++++
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf |  5
> > +++++
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/Semaphore.c                    |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S                     |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm                   |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm                  |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c                    |
> > 10 +++++-----
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h                    |
> > 2 --
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf                  |
> > 4 ++++
> >  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> > |  4 +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c                    |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/Semaphore.c                     |
> > 4 +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S                      |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm                    |  4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm                   |  4
> > +++-
> >  UefiCpuPkg/UefiCpuPkg.dec                                     |  9
> > +++++++++
> >  17 files changed, 61 insertions(+), 18 deletions(-)
> >
> > --
> > 2.7.4
> >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2017-10-06 15:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-04 19:02 [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Leo Duran
2017-10-04 19:02 ` [PATCH v4 1/5] UefiCpuPkg/UefiCpuPkg.dec: Create FixedPCDs for SMM support Leo Duran
2017-10-04 19:02 ` [PATCH v4 2/5] UefiCpuPkg/PiSmmCpuDxeSmm: Consume FixedPCDs to enhance " Leo Duran
2017-10-04 19:02 ` [PATCH v4 3/5] UefiCpuPkg/PiSmmCpuDxeSmm: Use " Leo Duran
2017-10-04 19:02 ` [PATCH v4 4/5] UefiCpuPkg/SmmCpuFeaturesLib: Consume FixedPCD " Leo Duran
2017-10-04 19:02 ` [PATCH v4 5/5] UefiCpuPkg/SmmCpuFeaturesLib: Use FixedPCD on non-STM library Leo Duran
2017-10-05  0:49 ` [PATCH v4 0/5] Enhanced SMM support for AMD-based x86 systems Yao, Jiewen
2017-10-05  1:18   ` Marvin H?user
2017-10-05  3:19     ` Yao, Jiewen
2017-10-05 14:57     ` Duran, Leo
2017-10-05 19:09       ` Marvin H?user
2017-10-06 15:27   ` Duran, Leo

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