public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Jiaxin" <jiaxin.wu@intel.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Dong, Eric" <eric.dong@intel.com>, "Ni, Ray" <ray.ni@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>,
	Laszlo Ersek <lersek@redhat.com>,
	"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [PATCH v7 3/6] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data
Date: Wed, 15 Feb 2023 08:41:06 +0000	[thread overview]
Message-ID: <MN0PR11MB6158926E354CC1FC65495A8BFEA39@MN0PR11MB6158.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230214101939.io45xksnuaxqvjmt@sirius.home.kraxel.org>

Thanks Gerd, I will add more info to explain the reversed mem info. but I don't want add the size info because it depends on the producer. Just indicate it should cover what contents for each cpu.




> -----Original Message-----
> From: Gerd Hoffmann <kraxel@redhat.com>
> Sent: Tuesday, February 14, 2023 6:20 PM
> To: Wu, Jiaxin <jiaxin.wu@intel.com>
> Cc: devel@edk2.groups.io; Dong, Eric <eric.dong@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Laszlo Ersek
> <lersek@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>
> Subject: Re: [PATCH v7 3/6] UefiCpuPkg/SmmBaseHob.h: Add SMM Base
> HOB Data
> 
> On Tue, Feb 14, 2023 at 04:33:11PM +0800, Jiaxin Wu wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4337
> >
> > The default SMBASE for the x86 processor is 0x30000. When
> > SMI happens, CPU runs the SMI handler at SMBASE+0x8000.
> > Also, the SMM save state area is within SMBASE+0x10000.
> >
> > One of the SMM initialization from CPU perspective is to relocate
> > and program the new SMBASE (in TSEG range) for each CPU thread. When
> > the SMBASE relocation happens in a PEI module, the PEI module shall
> > produce the SMM_BASE_HOB in HOB database which tells the
> > PiSmmCpuDxeSmm driver (runs at a later phase) about the new SMBASE
> > for each CPU thread. PiSmmCpuDxeSmm driver installs the SMI handler
> > at the SMM_BASE_HOB.SmBase[Index]+0x8000 for CPU thread Index.
> When
> > the HOB doesn't exist, PiSmmCpuDxeSmm driver shall relocate and
> > program the new SMBASE itself.
> >
> > This patch adds the SMM Base HOB for any PEI module to do
> > the SmBase relocation ahead of PiSmmCpuDxeSmm driver and
> > store the relocated SmBase address in array for reach
> > Processors.
> >
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Zeng Star <star.zeng@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > Cc: Rahul Kumar <rahul1.kumar@intel.com>
> > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
> > ---
> >  UefiCpuPkg/Include/Guid/SmmBaseHob.h | 64
> ++++++++++++++++++++++++++++++++++++
> >  UefiCpuPkg/UefiCpuPkg.dec            |  5 ++-
> >  2 files changed, 68 insertions(+), 1 deletion(-)
> >  create mode 100644 UefiCpuPkg/Include/Guid/SmmBaseHob.h
> >
> > diff --git a/UefiCpuPkg/Include/Guid/SmmBaseHob.h
> b/UefiCpuPkg/Include/Guid/SmmBaseHob.h
> > new file mode 100644
> > index 0000000000..4aae0d23ff
> > --- /dev/null
> > +++ b/UefiCpuPkg/Include/Guid/SmmBaseHob.h
> > @@ -0,0 +1,64 @@
> > +/** @file
> > +  The Smm Base HOB is used to store the information of:
> > +  * The relocated SmBase address in array for each Processors.
> > +
> > +  The default SMBASE for the x86 processor is 0x30000. When SMI
> happens, CPU
> > +  runs the SMI handler at SMBASE+0x8000. Also, the SMM save state area
> is within
> > +  SMBASE+0x10000.
> > +
> > +  One of the SMM initialization from CPU perspective is to relocate and
> program
> > +  the new SMBASE (in TSEG range) for each CPU thread. When the
> SMBASE relocation
> > +  happens in a PEI module, the PEI module shall produce the
> SMM_BASE_HOB in HOB
> > +  database which tells the PiSmmCpuDxeSmm driver (which runs at a later
> phase)
> > +  about the new SMBASE for each CPU thread. PiSmmCpuDxeSmm driver
> installs the
> > +  SMI handler at the SMM_BASE_HOB.SmBase[Index]+0x8000 for CPU
> thread Index.
> > +  When the HOB doesn't exist, PiSmmCpuDxeSmm driver shall relocate
> and program
> > +  the new SMBASE itself.
> 
> This should also explain the consequences of the tiling allocation, i.e.
> each cpu has one page at SMBASE+0x8000 for the SMI handler and one page
> at SMBASE+0xF000 for the CPU state.
> 
> take care,
>   Gerd


  reply	other threads:[~2023-02-15  8:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  8:33 [PATCH v7 0/6] Simplify SMM Relocation Process Wu, Jiaxin
2023-02-14  8:33 ` [PATCH v7 1/6] UefiCpuPkg/PiSmmCpuDxeSmm: Fix invalid InitializeMpSyncData call Wu, Jiaxin
2023-02-14 10:19   ` Gerd Hoffmann
2023-02-14  8:33 ` [PATCH v7 2/6] UefiCpuPkg/PiSmmCpuDxeSmm: Replace mIsBsp by mBspApicId check Wu, Jiaxin
2023-02-14 10:14   ` Gerd Hoffmann
2023-02-14  8:33 ` [PATCH v7 3/6] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data Wu, Jiaxin
2023-02-14 10:19   ` Gerd Hoffmann
2023-02-15  8:41     ` Wu, Jiaxin [this message]
2023-02-14  8:33 ` [PATCH v7 4/6] UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info Wu, Jiaxin
2023-02-14  8:33 ` [PATCH v7 5/6] UefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration Wu, Jiaxin
2023-02-14  8:33 ` [PATCH v7 6/6] OvmfPkg/SmmCpuFeaturesLib: Check SmBase relocation supported or not Wu, Jiaxin

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=MN0PR11MB6158926E354CC1FC65495A8BFEA39@MN0PR11MB6158.namprd11.prod.outlook.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