]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/IndustryStandard: define macros for QEMU's CPU hotplug registers
authorLaszlo Ersek <lersek@redhat.com>
Tue, 22 Oct 2019 10:12:41 +0000 (12:12 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 29 Jan 2020 17:28:22 +0000 (17:28 +0000)
In v1.5.0, QEMU's "pc" (i440fx) board gained a "CPU present bitmap"
register block. In v2.0.0, this was extended to the "q35" board.

In v2.7.0, a new (read/write) register interface was laid over the "CPU
present bitmap", with an option for the guest to switch the register block
to the new (a.k.a. modern) interface.

Both interfaces are documented in "docs/specs/acpi_cpu_hotplug.txt" in the
QEMU tree.

Add macros for a minimal subset of the modern interface, just so we can
count the possible CPUs (as opposed to boot CPUs) in a later patch in this
series.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1515
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20191022221554.14963-3-lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
OvmfPkg/Include/IndustryStandard/I440FxPiix4.h
OvmfPkg/Include/IndustryStandard/Q35MchIch9.h
OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h [new file with mode: 0644]

index e7d7fde14c65b6b412e7b86f6c940d1746417c12..3973ff0a95b48f1f4924dd397744313ad8c73aa7 100644 (file)
@@ -46,4 +46,9 @@
 #define PIIX4_PMREGMISC        0x80\r
 #define PIIX4_PMREGMISC_PMIOSE   BIT0\r
 \r
+//\r
+// IO ports\r
+//\r
+#define PIIX4_CPU_HOTPLUG_BASE 0xAF00\r
+\r
 #endif\r
index 391cb4622226beaa32efb4c2f562963720d62990..2ac16f19c62eca4a56473c1ccf6fdc5eef32da12 100644 (file)
 #define ICH9_APM_CNT 0xB2\r
 #define ICH9_APM_STS 0xB3\r
 \r
+#define ICH9_CPU_HOTPLUG_BASE 0x0CD8\r
+\r
 //\r
 // IO ports relative to PMBASE\r
 //\r
diff --git a/OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h b/OvmfPkg/Include/IndustryStandard/QemuCpuHotplug.h
new file mode 100644 (file)
index 0000000..cf07456
--- /dev/null
@@ -0,0 +1,43 @@
+/** @file\r
+  Macros for accessing QEMU's CPU hotplug register block.\r
+\r
+  Copyright (C) 2019, Red Hat, Inc.\r
+\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+  @par Specification Reference:\r
+\r
+  - "docs/specs/acpi_cpu_hotplug.txt" in the QEMU source tree.\r
+\r
+    The original (now "legacy") CPU hotplug interface appeared in QEMU v1.5.0.\r
+    The new ("modern") hotplug interface appeared in QEMU v2.7.0.\r
+\r
+    The macros in this header file map to the minimal subset of the modern\r
+    interface that OVMF needs.\r
+**/\r
+\r
+#ifndef QEMU_CPU_HOTPLUG_H_\r
+#define QEMU_CPU_HOTPLUG_H_\r
+\r
+#include <Base.h>\r
+\r
+//\r
+// Each register offset is:\r
+// - relative to the board-dependent IO base address of the register block,\r
+// - named QEMU_CPUHP_(R|W|RW)_*, according to the possible access modes of the\r
+//   register,\r
+// - followed by distinguished bitmasks or values in the register.\r
+//\r
+#define QEMU_CPUHP_R_CMD_DATA2               0x0\r
+\r
+#define QEMU_CPUHP_R_CPU_STAT                0x4\r
+#define QEMU_CPUHP_STAT_ENABLED                BIT0\r
+\r
+#define QEMU_CPUHP_RW_CMD_DATA               0x8\r
+\r
+#define QEMU_CPUHP_W_CPU_SEL                 0x0\r
+\r
+#define QEMU_CPUHP_W_CMD                     0x5\r
+#define QEMU_CPUHP_CMD_GET_PENDING             0x0\r
+\r
+#endif // QEMU_CPU_HOTPLUG_H_\r