public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Jiaxin" <jiaxin.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"lersek@redhat.com" <lersek@redhat.com>
Subject: Re: [edk2-devel] [PATCH 00/16] OvmfPkg: support VCPU hotplug with -D SMM_REQUIRE
Date: Fri, 24 Jul 2020 06:26:54 +0000	[thread overview]
Message-ID: <DM5PR11MB1372A9D151062EC43A72233CFE770@DM5PR11MB1372.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200223172537.28464-1-lersek@redhat.com>

Hi Laszlo,

Looks OVMF supports the CPU hotplug with those series patches. 

Could you provide some guide how to enable the OVMF CPU hotplug verification? Is there any general work flow introduction how it works? For example, how to do the hot add CPU initialization (e.g. Register setting / Microcode update, etc.)? I'm very interested in this feature on OVMF.

Thank you very much.
Jiaxin






> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Laszlo
> Ersek
> Sent: Monday, February 24, 2020 1:25 AM
> To: edk2-devel-groups-io <devel@edk2.groups.io>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Dong, Eric
> <eric.dong@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Igor Mammedov
> <imammedo@redhat.com>; Wang, Jian J <jian.j.wang@intel.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Justen, Jordan L
> <jordan.l.justen@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Philippe Mathieu-Daudé
> <philmd@redhat.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [edk2-devel] [PATCH 00/16] OvmfPkg: support VCPU hotplug with -
> D SMM_REQUIRE
> 
> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1512
> Repo:     https://github.com/lersek/edk2.git
> Branch:   vcpu_hotplug_smm_bz_1512
> 
> This series implements VCPU hotplug with SMM for OVMF, i.e., when OVMF
> is built with "-D SMM_REQUIRE".
> 
> SEV support and hot-unplug support are out of scope for now.
> 
> Patch#13 ("OvmfPkg/CpuHotplugSmm: complete root MMI handler for CPU
> hotplug") describes tests and results in the Notes section.
> 
> Obviously this is not being proposed for the edk2-stable202002 tag
> (which is in hard feature freeze).
> 
> QEMU needs patches for this feature, too. I've done the development
> against a QEMU patch that Igor hacked up quickly at my request. It was
> never posted (it needs some polish for upstreaming), but it has allowed
> me to write and test this feature.
> 
> The key parts of the QEMU commit message are:
> 
> > x68:acpi: trigger SMI before scanning for added/removed CPUs
> >
> > Firmware should only scan for new CPUs and not modify events in CPU
> > hotplug registers.
> 
> Igor's patch is based on upstream QEMU commit 418fa86dd465. Until he
> decides to post or otherwise share the patch, its effect can be
> expressed with a diff, taken in the Linux guest, between decompiled
> before/after versions of the QEMU-generated DSDT:
> 
> > @@ -81,6 +81,27 @@
> >                  Return (Arg3)
> >              }
> >          }
> > +
> > +        Device (SMI0)
> > +        {
> > +            Name (_HID, "PNP0A06" /* Generic Container Device */)  // _HID:
> Hardware ID
> > +            Name (_UID, "SMI resources")  // _UID: Unique ID
> > +            Name (_STA, 0x0B)  // _STA: Status
> > +            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource
> Settings
> > +            {
> > +                IO (Decode16,
> > +                    0x00B2,             // Range Minimum
> > +                    0x00B2,             // Range Maximum
> > +                    0x01,               // Alignment
> > +                    0x01,               // Length
> > +                    )
> > +            })
> > +            OperationRegion (SMIR, SystemIO, 0xB2, One)
> > +            Field (SMIR, ByteAcc, NoLock, WriteAsZeros)
> > +            {
> > +                SMIC,   8
> > +            }
> > +        }
> >      }
> >
> >      Scope (_SB)
> > @@ -3016,6 +3037,7 @@
> >              Method (CSCN, 0, Serialized)
> >              {
> >                  Acquire (\_SB.PCI0.PRES.CPLK, 0xFFFF)
> > +                \_SB.SMI0.SMIC = 0x04
> >                  Local0 = One
> >                  While ((Local0 == One))
> >                  {
> 
> where the CSCN ("CPU scan") method is the _E02 GPE ("CPU hotplug") event
> handler:
> 
> >      Method (\_GPE._E02, 0, NotSerialized)  // _Exx: Edge-Triggered GPE,
> xx=0x00-0xFF
> >      {
> >          \_SB.CPUS.CSCN ()
> >      }
> 
> If you'd like to test this series, please ask Igor for the QEMU patch.
> :)
> 
> The series has been formatted for review with the following options:
> 
>   --stat=1000 --stat-graph-width=20 \
>   --unified=22 \
>   --find-copies=43 --find-copies-harder \
>   --base=master \
> 
> At every stage in the series:
> - the tree builds,
> - "PatchCheck.py" is happy,
> - and OVMF works without regressions.
> 
> (Hotplug is made functional at patch#13, and "S3 after hotplug" is
> completed at patch#16. So those actions should not be attempted before
> said respective patches.)
> 
> Thanks,
> Laszlo
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Michael Kinney <michael.d.kinney@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Ray Ni <ray.ni@intel.com>
> 
> Thanks
> Laszlo
> 
> Laszlo Ersek (16):
>   MdeModulePkg/PiSmmCore: log SMM image start failure
>   UefiCpuPkg/PiSmmCpuDxeSmm: fix S3 Resume for CPU hotplug
>   OvmfPkg: clone SmmCpuPlatformHookLib from UefiCpuPkg
>   OvmfPkg: enable SMM Monarch Election in PiSmmCpuDxeSmm
>   OvmfPkg: enable CPU hotplug support in PiSmmCpuDxeSmm
>   OvmfPkg/CpuHotplugSmm: introduce skeleton for CPU Hotplug SMM driver
>   OvmfPkg/CpuHotplugSmm: add hotplug register block helper functions
>   OvmfPkg/CpuHotplugSmm: define the QEMU_CPUHP_CMD_GET_ARCH_ID
> macro
>   OvmfPkg/CpuHotplugSmm: add function for collecting CPUs with events
>   OvmfPkg/CpuHotplugSmm: collect CPUs with events
>   OvmfPkg/CpuHotplugSmm: introduce Post-SMM Pen for hot-added CPUs
>   OvmfPkg/CpuHotplugSmm: introduce First SMI Handler for hot-added CPUs
>   OvmfPkg/CpuHotplugSmm: complete root MMI handler for CPU hotplug
>   OvmfPkg: clone CpuS3DataDxe from UefiCpuPkg
>   OvmfPkg/CpuS3DataDxe: superficial cleanups
>   OvmfPkg/CpuS3DataDxe: enable S3 resume after CPU hotplug
> 
>  MdeModulePkg/Core/PiSmmCore/Dispatcher.c
> |   6 +
>  OvmfPkg/CpuHotplugSmm/ApicId.h
> |  23 ++
>  OvmfPkg/CpuHotplugSmm/CpuHotplug.c
> | 426 ++++++++++++++++++++
>  OvmfPkg/CpuHotplugSmm/CpuHotplugSmm.inf
> |  64 +++
>  OvmfPkg/CpuHotplugSmm/FirstSmiHandler.nasm
> | 149 +++++++
>  OvmfPkg/CpuHotplugSmm/FirstSmiHandlerContext.h
> |  41 ++
>  OvmfPkg/CpuHotplugSmm/PostSmmPen.nasm
> | 137 +++++++
>  OvmfPkg/CpuHotplugSmm/QemuCpuhp.c
> | 301 ++++++++++++++
>  OvmfPkg/CpuHotplugSmm/QemuCpuhp.h
> |  61 +++
>  OvmfPkg/CpuHotplugSmm/Smbase.c
> | 252 ++++++++++++
>  OvmfPkg/CpuHotplugSmm/Smbase.h
> |  46 +++
>  OvmfPkg/Include/IndustryStandard/Q35MchIch9.h
> |   5 +-
>  OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h
> |   3 +
>  OvmfPkg/OvmfPkgIa32.dsc
> |   7 +-
>  OvmfPkg/OvmfPkgIa32.fdf
> |   3 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc
> |   7 +-
>  OvmfPkg/OvmfPkgIa32X64.fdf
> |   3 +-
>  OvmfPkg/OvmfPkgX64.dsc
> |   7 +-
>  OvmfPkg/OvmfPkgX64.fdf
> |   3 +-
> 
> UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLib
> Null.c =>
> OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLib
> Qemu.c     |  45 ++-
> 
> UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLib
> Null.inf =>
> OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLib
> Qemu.inf |  24 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> |  14 +-
>  {UefiCpuPkg => OvmfPkg}/CpuS3DataDxe/CpuS3Data.c
> |  99 +++--
>  {UefiCpuPkg => OvmfPkg}/CpuS3DataDxe/CpuS3DataDxe.inf
> |  30 +-
>  24 files changed, 1667 insertions(+), 89 deletions(-)
>  copy
> UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLib
> Null.c =>
> OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLib
> Qemu.c (61%)
>  copy
> UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLib
> Null.inf =>
> OvmfPkg/Library/SmmCpuPlatformHookLibQemu/SmmCpuPlatformHookLib
> Qemu.inf (43%)
>  copy {UefiCpuPkg => OvmfPkg}/CpuS3DataDxe/CpuS3Data.c (77%)
>  copy {UefiCpuPkg => OvmfPkg}/CpuS3DataDxe/CpuS3DataDxe.inf (69%)
>  create mode 100644 OvmfPkg/CpuHotplugSmm/ApicId.h
>  create mode 100644 OvmfPkg/CpuHotplugSmm/CpuHotplug.c
>  create mode 100644 OvmfPkg/CpuHotplugSmm/CpuHotplugSmm.inf
>  create mode 100644 OvmfPkg/CpuHotplugSmm/FirstSmiHandler.nasm
>  create mode 100644 OvmfPkg/CpuHotplugSmm/FirstSmiHandlerContext.h
>  create mode 100644 OvmfPkg/CpuHotplugSmm/PostSmmPen.nasm
>  create mode 100644 OvmfPkg/CpuHotplugSmm/QemuCpuhp.c
>  create mode 100644 OvmfPkg/CpuHotplugSmm/QemuCpuhp.h
>  create mode 100644 OvmfPkg/CpuHotplugSmm/Smbase.c
>  create mode 100644 OvmfPkg/CpuHotplugSmm/Smbase.h
> 
> 
> base-commit: 1d3215fd24f47eaa4877542a59b4bbf5afc0cfe8
> --
> 2.19.1.3.g30247aa5d201
> 
> 
> 


  parent reply	other threads:[~2020-07-24  6:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-23 17:25 [PATCH 00/16] OvmfPkg: support VCPU hotplug with -D SMM_REQUIRE Laszlo Ersek
2020-02-23 17:25 ` [PATCH 01/16] MdeModulePkg/PiSmmCore: log SMM image start failure Laszlo Ersek
2020-02-23 17:25 ` [PATCH 02/16] UefiCpuPkg/PiSmmCpuDxeSmm: fix S3 Resume for CPU hotplug Laszlo Ersek
2020-02-23 17:25 ` [PATCH 03/16] OvmfPkg: clone SmmCpuPlatformHookLib from UefiCpuPkg Laszlo Ersek
2020-02-23 17:25 ` [PATCH 04/16] OvmfPkg: enable SMM Monarch Election in PiSmmCpuDxeSmm Laszlo Ersek
2020-02-23 17:25 ` [PATCH 05/16] OvmfPkg: enable CPU hotplug support " Laszlo Ersek
2020-02-23 17:25 ` [PATCH 06/16] OvmfPkg/CpuHotplugSmm: introduce skeleton for CPU Hotplug SMM driver Laszlo Ersek
2020-02-23 17:25 ` [PATCH 07/16] OvmfPkg/CpuHotplugSmm: add hotplug register block helper functions Laszlo Ersek
2020-02-23 17:25 ` [PATCH 08/16] OvmfPkg/CpuHotplugSmm: define the QEMU_CPUHP_CMD_GET_ARCH_ID macro Laszlo Ersek
2020-02-23 17:25 ` [PATCH 09/16] OvmfPkg/CpuHotplugSmm: add function for collecting CPUs with events Laszlo Ersek
2020-02-23 17:25 ` [PATCH 10/16] OvmfPkg/CpuHotplugSmm: collect " Laszlo Ersek
2020-02-23 17:25 ` [PATCH 11/16] OvmfPkg/CpuHotplugSmm: introduce Post-SMM Pen for hot-added CPUs Laszlo Ersek
2020-02-23 17:25 ` [PATCH 12/16] OvmfPkg/CpuHotplugSmm: introduce First SMI Handler " Laszlo Ersek
2020-02-24  9:10   ` [edk2-devel] " Laszlo Ersek
2020-02-26 21:22     ` Laszlo Ersek
2020-02-23 17:25 ` [PATCH 13/16] OvmfPkg/CpuHotplugSmm: complete root MMI handler for CPU hotplug Laszlo Ersek
2020-02-23 17:25 ` [PATCH 14/16] OvmfPkg: clone CpuS3DataDxe from UefiCpuPkg Laszlo Ersek
2020-02-23 17:25 ` [PATCH 15/16] OvmfPkg/CpuS3DataDxe: superficial cleanups Laszlo Ersek
2020-02-23 17:25 ` [PATCH 16/16] OvmfPkg/CpuS3DataDxe: enable S3 resume after CPU hotplug Laszlo Ersek
2020-02-24 16:31 ` [PATCH 00/16] OvmfPkg: support VCPU hotplug with -D SMM_REQUIRE Ard Biesheuvel
2020-07-24  6:26 ` Wu, Jiaxin [this message]
2020-07-24 16:01   ` [edk2-devel] " Laszlo Ersek
2020-07-29  8:37     ` Wu, Jiaxin
2020-10-01  9:59       ` [ann] " 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=DM5PR11MB1372A9D151062EC43A72233CFE770@DM5PR11MB1372.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