pc-q35-4.2+ and pc-i440fx-4.2+ machine types report CPU topology info in
the "etc/x86-smp-topology" fw_cfg file. Add a structure type for parsing
this blob.

Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Igor Mammedov <imamm...@redhat.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1515
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---
 OvmfPkg/Include/IndustryStandard/QemuFwCfg.h | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h 
b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h
index 7969aba3ca61..fe410d4a3fc2 100644
--- a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h
+++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h
@@ -95,4 +95,26 @@ typedef struct {
 } FW_CFG_DMA_ACCESS;
 #pragma pack ()
 
+//
+// Structure describing the VCPU topology on IA32 and X64, in the fw_cfg file
+// named "etc/x86-smp-topology".
+//
+// All fields are little endian.
+//
+// The number of sockets (aka packages) can be calculated by dividing
+// MaxLogicalProcessors by (DiesPerSocket * CoresPerDie * ThreadsPerCore), and
+// rounding up the quotient.
+//
+// APIC ID field widths and offsets can be derived with the standard method
+// described in "Intel(R) 64 Architecture Processor Topology Enumeration"
+// 
<http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/>.
+//
+#pragma pack (1)
+typedef struct {
+  UINT32 DiesPerSocket;
+  UINT32 CoresPerDie;
+  UINT32 ThreadsPerCore;
+  UINT32 MaxLogicalProcessors;
+} FW_CFG_X86_TOPOLOGY;
+#pragma pack ()
 #endif
-- 
2.19.1.3.g30247aa5d201



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48565): https://edk2.groups.io/g/devel/message/48565
Mute This Topic: https://groups.io/mt/34441230/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to