[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 27/42] acpi: add CPU devices AML to DSDT
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [RFC 27/42] acpi: add CPU devices AML to DSDT |
Date: |
Mon, 2 May 2016 14:33:36 +0200 |
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/acpi/cpu.c | 38 ++++++++++++++++++++++++++++++++++++++
hw/i386/acpi-build.c | 2 ++
include/hw/acpi/cpu.h | 3 +++
3 files changed, 43 insertions(+)
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 2b4feb0..6dab4d6 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -216,3 +216,41 @@ const VMStateDescription vmstate_cpu_hotplug = {
VMSTATE_END_OF_LIST()
}
};
+
+#define CPU_NAME_FMT "C%.03X"
+
+void build_cpus_aml(Aml *table, MachineState *machine, bool acpi1_compat)
+{
+ Aml *cpus_dev;
+ Aml *sb_scope = aml_scope("_SB");
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
+ CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids(machine);
+ cpus_dev = aml_device("\\_SB.CPUS");
+ {
+ int i;
+
+ aml_append(cpus_dev, aml_name_decl("_HID", aml_string("ACPI0010")));
+ aml_append(cpus_dev, aml_name_decl("_CID", aml_eisaid("PNP0A05")));
+
+ /* build Processor object for each processor */
+ for (i = 0; i < arch_ids->len; i++) {
+ Aml *dev;
+ Aml *uid = aml_int(i);
+ int arch_id = arch_ids->cpus[i].arch_id;
+
+ if (acpi1_compat && arch_id < 255) {
+ dev = aml_processor(i, 0, 0, CPU_NAME_FMT, i);
+ } else {
+ dev = aml_device(CPU_NAME_FMT, arch_id);
+ aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
+ aml_append(dev, aml_name_decl("_UID", uid));
+ }
+
+ aml_append(cpus_dev, dev);
+ }
+ }
+ aml_append(sb_scope, cpus_dev);
+ aml_append(table, sb_scope);
+
+ g_free(arch_ids);
+}
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f8c9a7c..466eebd 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1948,6 +1948,8 @@ build_dsdt(GArray *table_data, GArray *linker,
if (pm->legacy_cpu_hp) {
build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base);
+ } else {
+ build_cpus_aml(dsdt, machine, true);
}
build_memory_hotplug_aml(dsdt, nr_mem, pm->mem_hp_io_base,
pm->mem_hp_io_len);
diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
index c746292..da087bf 100644
--- a/include/hw/acpi/cpu.h
+++ b/include/hw/acpi/cpu.h
@@ -14,6 +14,7 @@
#include "hw/qdev-core.h"
#include "hw/acpi/acpi.h"
+#include "hw/acpi/aml-build.h"
#include "hw/hotplug.h"
typedef struct AcpiCpuStatus {
@@ -45,6 +46,8 @@ void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
CPUHotplugState *state, hwaddr base_addr);
+void build_cpus_aml(Aml *table, MachineState *machine, bool apci1_compat);
+
extern const VMStateDescription vmstate_cpu_hotplug;
#define VMSTATE_CPU_HOTPLUG(cpuhp, state) \
VMSTATE_STRUCT(cpuhp, state, 1, \
--
1.8.3.1
- Re: [Qemu-devel] [RFC 10/42] pc: piix4/ich9: add 'cpu-hotplug-legacy' property, (continued)
- [Qemu-devel] [RFC 19/42] pc: add generic CPU unplug callbacks, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 18/42] acpi: hardware side of CPU hotplug, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 22/42] pc: piix4: initialize new CPU hotplug hw, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 21/42] pc: q35: initialize new CPU hotplug hw, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 25/42] tests: acpi: update cphp_legacy case with new ProcessorID values, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 26/42] pc: acpi: introduce AcpiDeviceIfClass.madt_cpu hook, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 24/42] pc: acpi: cpuhp-legacy: switch ProcessorID to possible_cpus idx, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 31/42] pc: numa: replace node_cpu indexing by apic_id with possible_cpus index, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 27/42] acpi: add CPU devices AML to DSDT,
Igor Mammedov <=
- [Qemu-devel] [RFC 28/42] acpi: add CPU hotplug methods to DSDT, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 32/42] pc: set X86CPU.node property if QEMU starts with numa enabled, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 29/42] tests: acpi: update expected files with new CPU AML description, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 14/42] tests: acpi: check legacy CPU hotplug AML is present for 2.6 machine type, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 23/42] tests: pc-cpu-test: turn on cpu-hotplug explicily, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 30/42] qdev: hotplug: Introduce HotplugHandler.pre_plug() callback, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 34/42] acpi: cpuhp: add command and data registers, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 35/42] acpi: cpuhp: provide cpu._PXM method if running in numa mode, Igor Mammedov, 2016/05/02
- [Qemu-devel] [RFC 40/42] tests: acpi: extend CPU hotplug test with NUMA support, Igor Mammedov, 2016/05/02