public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: "Yao, Jiewen" <jiewen.yao@intel.com>,
	Leo Duran <leo.duran@amd.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [PATCH v2 0/9] Enhanced SMM support to AMD-based x86 systems.
Date: Wed, 4 Oct 2017 01:22:41 +0000	[thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F5A7DAEE07@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <74D8A39837DF1E4DA445A8C0B3885C503A9CE1F2@shsmsx102.ccr.corp.intel.com>

Leo,

The general design issue here is that a PCD and PCD macro were
added to a UefiCpuPkg include file Include/Register/SmramSaveStateMap.h.
This means any library or module that includes this package include
file will break the build until the PCD is added to the INF file for
that library or module.

The INF file for a module is supposed to express the PCDs that the
library or module sources access.  We do not expect #include
statements from package include files to require adding additional
PCDs.

Updating the code for these values to be detected or configurable
is a good idea.

One option is to update the C code that currently uses the #define
names to use the PCD access function directly, instead of adding
the PcdGetxxx() to the Include/Register/SmramSaveStateMap.h file.

Jiewen's idea to remove the PCD and detect the offset from CPUID
also looks like a reasonable approach.

Thanks,

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On
> Behalf Of Yao, Jiewen
> Sent: Tuesday, October 3, 2017 5:50 PM
> To: Leo Duran <leo.duran@amd.com>; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH v2 0/9] Enhanced SMM support to AMD-
> based x86 systems.
> 
> Thanks Leo.
> I agree we should support AMD-based X86, since the most code is
> sharable.
> 
> [1] Comment for PcdCpuSmmSmramSaveStateMapOffset.
> 
> I am a little concerned about the patch 6/9, because it is an
> incompatible change.
> This change will cause all existing intel platform code change,
> to add PCD in INF, such as OvmfPkg (patch 4/9) and QuarkPkg
> (patch 5/9).
> 
> I am thinking an compatible way, to prevent existing intel
> platform code change.
> 
> 1) We can define below according to Intel SDM and AMD SDM.
> 
> #define INTEL_SMRAM_SAVE_STATE_MAP_OFFSET  0xfc00
> #define AMD_SMRAM_SAVE_STATE_MAP_OFFSET  0xfe00
> // This is to provide compatibility.
> #define SMRAM_SAVE_STATE_MAP_OFFSET
> INTEL_SMRAM_SAVE_STATE_MAP_OFFSET
> 
> 2) Because the system has capability to *detect* the CPU, there
> is no need to let user to *configure*.
> I do not suggest we use PCD. IMHO, it is more a system
> attribute, instead of a user configurable data. For example, a
> user cannot configure it to 0xFE00 for Intel CPU, or 0xFC00 for
> AMD CPU.
> 
> 3) I think we can have a CPUID check in the entrypoint, and
> patch the OFFSET at anywhere.
> 
> 
> [2] Comment for PcdCpuSmmPSDOffset.
> I do not mind, since it is driver internal configuration and it
> won't break the compatibility.
> 
> Thank you
> Yao Jiewen
> 
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On
> Behalf Of Leo
> > Duran
> > Sent: Wednesday, October 4, 2017 6:38 AM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] [PATCH v2 0/9] Enhanced SMM support to AMD-
> based x86
> > systems.
> >
> > UefiCpuPkg:
> > This patch-set introduces a couple of FixedPCDs to replace
> > Intel-specific macros, for SMM support on AMD-based x86
> systems.
> >
> > 1) PcdCpuSmmSmramSaveStateMapOffset - SMRAM Save State Map
> Offset.
> > 2) PcdCpuSmmPSDOffset - Processor SMM Descriptor Offset in
> SMRAM.
> >
> > OvmfPkg and QuarkSocPkg:
> > The PcdCpuSmmSmramSaveStateMapOffset PCD is declared just to
> resolve
> > the macro replaced by the shared Library/SmmCpuFeaturesLib.h
> file.
> >
> > Changes since v1:
> > Revision to Cc list for UefiCpuPkg.
> >
> > Leo Duran (9):
> >   UefiCpuPkg: UefiCpuPkg.dec
> >   UefiCpuPkg: PiSmmCpuDxeSmm driver.
> >   UefiCpuPkg: SmmCpuFeaturesLib library.
> >   OvmfPkg: SmmCpuFeaturesLib library.
> >   QuarkSocPkg: SmmCpuFeaturesLib library.
> >   UefiCpuPkg: Register/SmramSaveStateMap.h
> >   UefiCpuPkg: PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> >   UefiCpuPkg: PiSmmCpuDxeSmm driver.
> >   UefiCpuPkg: SmmCpuFeaturesLib library.
> >
> >  OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
> | 5
> > +++++
> >  .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
> | 4
> > ++++
> >  UefiCpuPkg/Include/Register/SmramSaveStateMap.h
> | 4
> > +++-
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
> | 4
> > +++-
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.asm
> | 4
> > +++-
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.nasm
> | 4
> > +++-
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
> | 5
> > +++++
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
> | 6
> > ++++++
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.S
> | 4
> > +++-
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.asm
> | 4
> > +++-
> >  UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.nasm
> | 4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.S
> | 4
> > +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.asm
> |
> > 4 +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm
> |
> > 4 +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> > | 2 +-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
> > | 4 ++++
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.S
> |
> > 4 +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.asm
> |
> > 4 +++-
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm
> |
> > 4 +++-
> >  UefiCpuPkg/UefiCpuPkg.dec
> | 9
> > +++++++++
> >  20 files changed, 73 insertions(+), 14 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


  reply	other threads:[~2017-10-04  1:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 22:38 [PATCH v2 0/9] Enhanced SMM support to AMD-based x86 systems Leo Duran
2017-10-03 22:38 ` [PATCH v2 1/9] UefiCpuPkg: UefiCpuPkg.dec Leo Duran
2017-10-03 22:38 ` [PATCH v2 2/9] UefiCpuPkg: PiSmmCpuDxeSmm driver Leo Duran
2017-10-03 22:38 ` [PATCH v2 3/9] UefiCpuPkg: SmmCpuFeaturesLib library Leo Duran
2017-10-03 22:38 ` [PATCH v2 4/9] OvmfPkg: " Leo Duran
2017-10-03 22:38 ` [PATCH v2 5/9] QuarkSocPkg: " Leo Duran
2017-10-03 22:38 ` [PATCH v2 6/9] UefiCpuPkg: Register/SmramSaveStateMap.h Leo Duran
2017-10-03 22:38 ` [PATCH v2 7/9] UefiCpuPkg: PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h Leo Duran
2017-10-03 22:38 ` [PATCH v2 8/9] UefiCpuPkg: PiSmmCpuDxeSmm driver Leo Duran
2017-10-03 22:38 ` [PATCH v2 9/9] UefiCpuPkg: SmmCpuFeaturesLib library Leo Duran
2017-10-04  0:50 ` [PATCH v2 0/9] Enhanced SMM support to AMD-based x86 systems Yao, Jiewen
2017-10-04  1:22   ` Kinney, Michael D [this message]
2017-10-04 10:46     ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E92EE9817A31E24EB0585FDF735412F5A7DAEE07@ORSMSX113.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox