public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: devel@edk2.groups.io
Cc: Hao A Wu <hao.a.wu@intel.com>, Eric Dong <eric.dong@intel.com>,
	Ray Ni <ray.ni@intel.com>, Laszlo Ersek <lersek@redhat.com>,
	Star Zeng <star.zeng@intel.com>, Siyuan Fu <siyuan.fu@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>
Subject: [PATCH v5 3/6] UefiCpuPkg: Add definitions for EDKII microcode patch HOB
Date: Tue, 31 Dec 2019 08:49:11 +0800	[thread overview]
Message-ID: <20191231004914.8520-4-hao.a.wu@intel.com> (raw)
In-Reply-To: <20191231004914.8520-1-hao.a.wu@intel.com>

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2430

This commit will add the definitions for EDKII microcode patch HOB.

The intention of adding this HOB is to provide a scheme to store the below
information:

A. The base address and size of the microcode patches that are being
   loaded (from flash) into memory;
B. The information of detected microcode patch for each processor within
   the system.

The producer of the HOB will be the UefiCpuPkg/MpInitLib (where the load,
detect and apply of the microcode happen). The consumer of the HOB can be
modules that want to detect/apply the microcode patch by themselves again
later during the boot flow.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
---
 UefiCpuPkg/UefiCpuPkg.dec                   |  3 ++
 UefiCpuPkg/Include/Guid/MicrocodePatchHob.h | 44 ++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index 797f948631..45b267ac61 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -63,6 +63,9 @@ [Guids]
   ## Include/Guid/CpuFeaturesInitDone.h
   gEdkiiCpuFeaturesInitDoneGuid  = { 0xc77c3a41, 0x61ab, 0x4143, { 0x98, 0x3e, 0x33, 0x39, 0x28, 0x6, 0x28, 0xe5 }}
 
+  ## Include/Guid/MicrocodePatchHob.h
+  gEdkiiMicrocodePatchHobGuid    = { 0xd178f11d, 0x8716, 0x418e, { 0xa1, 0x31, 0x96, 0x7d, 0x2a, 0xc4, 0x28, 0x43 }}
+
 [Protocols]
   ## Include/Protocol/SmmCpuService.h
   gEfiSmmCpuServiceProtocolGuid  = { 0x1d202cab, 0xc8ab, 0x4d5c, { 0x94, 0xf7, 0x3c, 0xfc, 0xc0, 0xd3, 0xd3, 0x35 }}
diff --git a/UefiCpuPkg/Include/Guid/MicrocodePatchHob.h b/UefiCpuPkg/Include/Guid/MicrocodePatchHob.h
new file mode 100644
index 0000000000..2d307fbffb
--- /dev/null
+++ b/UefiCpuPkg/Include/Guid/MicrocodePatchHob.h
@@ -0,0 +1,44 @@
+/** @file
+  The microcode patch HOB is used to store the information of:
+    A. Base address and size of the loaded microcode patches data;
+    B. Detected microcode patch for each processor within system.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _MICROCODE_PATCH_HOB_H_
+#define _MICROCODE_PATCH_HOB_H_
+
+extern EFI_GUID gEdkiiMicrocodePatchHobGuid;
+
+//
+// The EDKII microcode patch HOB will be produced by MpInitLib and it can be
+// consumed by modules that want to detect/apply microcode patches.
+//
+typedef struct {
+  //
+  // The base address of the microcode patches data after being loaded into
+  // memory.
+  //
+  UINT64    MicrocodePatchAddress;
+  //
+  // The total size of the loaded microcode patches.
+  //
+  UINT64    MicrocodePatchRegionSize;
+  //
+  // The number of processors within the system.
+  //
+  UINT32    ProcessorCount;
+  //
+  // An array with 'ProcessorCount' elements that stores the offset (with
+  // regard to 'MicrocodePatchAddress') of the detected microcode patch
+  // (including the CPU_MICROCODE_HEADER data structure) for each processor.
+  // If no microcode patch is detected for certain processor, the relating
+  // element will be set to MAX_UINT64.
+  //
+  UINT64    ProcessorSpecificPatchOffset[0];
+} EDKII_MICROCODE_PATCH_HOB;
+
+#endif
-- 
2.12.0.windows.1


  parent reply	other threads:[~2019-12-31  0:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-31  0:49 [PATCH v5 0/6] Microcode related optimizations Wu, Hao A
2019-12-31  0:49 ` [PATCH v5 1/6] UefiCpuPkg/MpInitLib: Collect processors' CPUID & Platform ID info Wu, Hao A
2019-12-31  0:49 ` [PATCH v5 2/6] UefiCpuPkg/MpInitLib: Reduce the size when loading microcode patches Wu, Hao A
2019-12-31  1:17   ` Dong, Eric
2019-12-31  0:49 ` Wu, Hao A [this message]
2019-12-31  0:49 ` [PATCH v5 4/6] UefiCpuPkg/MpInitLib: Produce EDKII microcode patch HOB Wu, Hao A
2019-12-31  1:17   ` [edk2-devel] " Dong, Eric
2019-12-31  0:49 ` [PATCH v5 5/6] UefiCpuPkg/MpInitLib: Relocate microcode patch fields in CPU_MP_DATA Wu, Hao A
2019-12-31  0:49 ` [PATCH v5 6/6] UefiCpuPkg/MpInitLib: Remove redundant microcode " Wu, Hao A
2020-01-02  2:39 ` [edk2-devel] [PATCH v5 0/6] Microcode related optimizations Ni, Ray
2020-01-02  3:12   ` Wu, Hao A
2020-01-02 15:07     ` Laszlo Ersek
2020-01-03 20:09       ` Laszlo Ersek
2020-01-06  1:36         ` Wu, Hao A

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=20191231004914.8520-4-hao.a.wu@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