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 applied 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>
---
UefiCpuPkg/UefiCpuPkg.dec | 3 ++
UefiCpuPkg/Include/Guid/MicrocodePatchHob.h | 50 ++++++++++++++++++++
2 files changed, 53 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..3667fc3786
--- /dev/null
+++ b/UefiCpuPkg/Include/Guid/MicrocodePatchHob.h
@@ -0,0 +1,50 @@
+/** @file
+ The microcode patch HOB is used to store the information of:
+ A. Base address and size of the loaded microcode patches data;
+ B. Applied microcode patch for each processor within system.
+
+ Copyright (c) 2019, Intel Corporation. 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
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#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 ProcessorNumber;
+ //
+ // An array with 'ProcessorNumber' elements that stores the offset (with
+ // regard to 'MicrocodePatchAddress') of the applied microcode patch for each
+ // processor.
+ // If no microcode patch is applied for certain processor, the relating
+ // element will be set to MAX_UINT64.
+ //
+ UINT64 DetectedPatchOffset[0];
+} EDKII_MICROCODE_PATCH_HOB;
+
+#endif
--
2.12.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#52512): https://edk2.groups.io/g/devel/message/52512
Mute This Topic: https://groups.io/mt/69242655/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
> + // > + // The number of processors within the system. > + // > + UINT32 ProcessorNumber; 1. Number is a bit confusing here. I also provided comments to other patches. We could "ProcessorCount" here. Number can be either count of items, or an index to a specific item. > + // > + // An array with 'ProcessorNumber' elements that stores the offset (with > + // regard to 'MicrocodePatchAddress') of the applied microcode patch for > each > + // processor. > + // If no microcode patch is applied for certain processor, the relating > + // element will be set to MAX_UINT64. > + // > + UINT64 DetectedPatchOffset[0]; 2. "ProcessorSpecificPatchOffset"? -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52528): https://edk2.groups.io/g/devel/message/52528 Mute This Topic: https://groups.io/mt/69242655/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Agree with both 1 & 2. Will update patch to address them. Best Regards, Hao Wu > -----Original Message----- > From: Ni, Ray > Sent: Tuesday, December 24, 2019 11:48 AM > To: Wu, Hao A; devel@edk2.groups.io > Cc: Dong, Eric; Laszlo Ersek; Zeng, Star; Fu, Siyuan; Kinney, Michael D > Subject: RE: [PATCH v1 3/4] UefiCpuPkg: Add definitions for EDKII microcode > patch HOB > > > + // > > + // The number of processors within the system. > > + // > > + UINT32 ProcessorNumber; > 1. Number is a bit confusing here. I also provided comments to other patches. > We could "ProcessorCount" here. > Number can be either count of items, or an index to a specific item. > > > > + // > > + // An array with 'ProcessorNumber' elements that stores the offset (with > > + // regard to 'MicrocodePatchAddress') of the applied microcode patch for > > each > > + // processor. > > + // If no microcode patch is applied for certain processor, the relating > > + // element will be set to MAX_UINT64. > > + // > > + UINT64 DetectedPatchOffset[0]; > > 2. "ProcessorSpecificPatchOffset"? -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52538): https://edk2.groups.io/g/devel/message/52538 Mute This Topic: https://groups.io/mt/69242655/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
I suggest to let the DetectedPatchOffset points to the microcode header instead of microcode data.
Consumers can use the offset to get more information from header than just the microcode data.
> -----Original Message-----
> From: Wu, Hao A <hao.a.wu@intel.com>
> Sent: Tuesday, December 24, 2019 9:37 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni,
> Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Zeng, Star
> <star.zeng@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Kinney, Michael
> D <michael.d.kinney@intel.com>
> Subject: [PATCH v1 3/4] UefiCpuPkg: Add definitions for EDKII microcode
> patch HOB
>
> 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 applied 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>
> ---
> UefiCpuPkg/UefiCpuPkg.dec | 3 ++
> UefiCpuPkg/Include/Guid/MicrocodePatchHob.h | 50
> ++++++++++++++++++++
> 2 files changed, 53 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..3667fc3786
> --- /dev/null
> +++ b/UefiCpuPkg/Include/Guid/MicrocodePatchHob.h
> @@ -0,0 +1,50 @@
> +/** @file
> + The microcode patch HOB is used to store the information of:
> + A. Base address and size of the loaded microcode patches data;
> + B. Applied microcode patch for each processor within system.
> +
> + Copyright (c) 2019, Intel Corporation. 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
> + http://opensource.org/licenses/bsd-license.php.
> +
> + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +
> +#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 ProcessorNumber;
> + //
> + // An array with 'ProcessorNumber' elements that stores the offset (with
> + // regard to 'MicrocodePatchAddress') of the applied microcode patch for
> each
> + // processor.
> + // If no microcode patch is applied for certain processor, the relating
> + // element will be set to MAX_UINT64.
> + //
> + UINT64 DetectedPatchOffset[0];
> +} EDKII_MICROCODE_PATCH_HOB;
> +
> +#endif
> --
> 2.12.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#52543): https://edk2.groups.io/g/devel/message/52543
Mute This Topic: https://groups.io/mt/69242655/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
> -----Original Message-----
> From: Ni, Ray
> Sent: Tuesday, December 24, 2019 4:16 PM
> To: Wu, Hao A; devel@edk2.groups.io
> Cc: Dong, Eric; Laszlo Ersek; Zeng, Star; Fu, Siyuan; Kinney, Michael D
> Subject: RE: [PATCH v1 3/4] UefiCpuPkg: Add definitions for EDKII microcode
> patch HOB
>
> I suggest to let the DetectedPatchOffset points to the microcode header instead
> of microcode data.
> Consumers can use the offset to get more information from header than just
> the microcode data.
Yes.
I will handle this as well in the next version of the series.
Best Regards,
Hao Wu
>
> > -----Original Message-----
> > From: Wu, Hao A <hao.a.wu@intel.com>
> > Sent: Tuesday, December 24, 2019 9:37 AM
> > To: devel@edk2.groups.io
> > Cc: Wu, Hao A <hao.a.wu@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni,
> > Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Zeng, Star
> > <star.zeng@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Kinney, Michael
> > D <michael.d.kinney@intel.com>
> > Subject: [PATCH v1 3/4] UefiCpuPkg: Add definitions for EDKII microcode
> > patch HOB
> >
> > 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 applied 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>
> > ---
> > UefiCpuPkg/UefiCpuPkg.dec | 3 ++
> > UefiCpuPkg/Include/Guid/MicrocodePatchHob.h | 50
> > ++++++++++++++++++++
> > 2 files changed, 53 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..3667fc3786
> > --- /dev/null
> > +++ b/UefiCpuPkg/Include/Guid/MicrocodePatchHob.h
> > @@ -0,0 +1,50 @@
> > +/** @file
> > + The microcode patch HOB is used to store the information of:
> > + A. Base address and size of the loaded microcode patches data;
> > + B. Applied microcode patch for each processor within system.
> > +
> > + Copyright (c) 2019, Intel Corporation. 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
> > + http://opensource.org/licenses/bsd-license.php.
> > +
> > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > BASIS,
> > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> > EXPRESS OR IMPLIED.
> > +
> > +**/
> > +
> > +#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 ProcessorNumber;
> > + //
> > + // An array with 'ProcessorNumber' elements that stores the offset (with
> > + // regard to 'MicrocodePatchAddress') of the applied microcode patch for
> > each
> > + // processor.
> > + // If no microcode patch is applied for certain processor, the relating
> > + // element will be set to MAX_UINT64.
> > + //
> > + UINT64 DetectedPatchOffset[0];
> > +} EDKII_MICROCODE_PATCH_HOB;
> > +
> > +#endif
> > --
> > 2.12.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#52553): https://edk2.groups.io/g/devel/message/52553
Mute This Topic: https://groups.io/mt/69242655/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.