118 lines
4.7 KiB
Diff
118 lines
4.7 KiB
Diff
|
|
From 1ab75151c0a486ebdbe50d29c9677c7bc1f05929 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Keqian Zhu <zhukeqian1@huawei.com>
|
||
|
|
Date: Wed, 22 Apr 2020 16:11:13 +0800
|
||
|
|
Subject: [PATCH] acpi/cpu: Prepare build_cpus_aml for arm virt
|
||
|
|
|
||
|
|
We will reuse build_cpus_aml to build DSDT cpus aml in arm/virt
|
||
|
|
ACPI to realize cpu hotplug. Three points are added.
|
||
|
|
|
||
|
|
1. Make ACPI IO address space configurable, because ARM64 platforms
|
||
|
|
don't use port IO for ACPI IO space.
|
||
|
|
2. Add GICC struct building support in _MAT of cpu aml.
|
||
|
|
3. Let the hotplug method parameter can be NULL, because ACPI GED
|
||
|
|
will realize it.
|
||
|
|
|
||
|
|
Besides, CPU CPPC building is injected.
|
||
|
|
|
||
|
|
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
|
||
|
|
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
|
||
|
|
---
|
||
|
|
hw/acpi/cpu.c | 27 ++++++++++++++++++++-------
|
||
|
|
hw/i386/acpi-build.c | 2 +-
|
||
|
|
include/hw/acpi/cpu.h | 3 ++-
|
||
|
|
3 files changed, 23 insertions(+), 9 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
|
||
|
|
index b20903ea30..a9c2ee952a 100644
|
||
|
|
--- a/hw/acpi/cpu.c
|
||
|
|
+++ b/hw/acpi/cpu.c
|
||
|
|
@@ -343,7 +343,8 @@ const VMStateDescription vmstate_cpu_hotplug = {
|
||
|
|
void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
|
||
|
|
hwaddr io_base,
|
||
|
|
const char *res_root,
|
||
|
|
- const char *event_handler_method)
|
||
|
|
+ const char *event_handler_method,
|
||
|
|
+ AmlRegionSpace rs)
|
||
|
|
{
|
||
|
|
Aml *ifctx;
|
||
|
|
Aml *field;
|
||
|
|
@@ -371,13 +372,18 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
|
||
|
|
aml_append(cpu_ctrl_dev, aml_mutex(CPU_LOCK, 0));
|
||
|
|
|
||
|
|
crs = aml_resource_template();
|
||
|
|
- aml_append(crs, aml_io(AML_DECODE16, io_base, io_base, 1,
|
||
|
|
- ACPI_CPU_HOTPLUG_REG_LEN));
|
||
|
|
+ if (rs == AML_SYSTEM_IO) {
|
||
|
|
+ aml_append(crs, aml_io(AML_DECODE16, io_base, io_base, 1,
|
||
|
|
+ ACPI_CPU_HOTPLUG_REG_LEN));
|
||
|
|
+ } else {
|
||
|
|
+ aml_append(crs, aml_memory32_fixed(io_base,
|
||
|
|
+ ACPI_CPU_HOTPLUG_REG_LEN, AML_READ_WRITE));
|
||
|
|
+ }
|
||
|
|
aml_append(cpu_ctrl_dev, aml_name_decl("_CRS", crs));
|
||
|
|
|
||
|
|
/* declare CPU hotplug MMIO region with related access fields */
|
||
|
|
aml_append(cpu_ctrl_dev,
|
||
|
|
- aml_operation_region("PRST", AML_SYSTEM_IO, aml_int(io_base),
|
||
|
|
+ aml_operation_region("PRST", rs, aml_int(io_base),
|
||
|
|
ACPI_CPU_HOTPLUG_REG_LEN));
|
||
|
|
|
||
|
|
field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK,
|
||
|
|
@@ -663,6 +669,11 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
|
||
|
|
aml_append(dev, aml_name_decl("_UID", uid));
|
||
|
|
}
|
||
|
|
|
||
|
|
+ assert(adevc);
|
||
|
|
+ if (adevc->cpu_cppc) {
|
||
|
|
+ adevc->cpu_cppc(adev, i, arch_ids->len, dev);
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
method = aml_method("_STA", 0, AML_SERIALIZED);
|
||
|
|
aml_append(method, aml_return(aml_call1(CPU_STS_METHOD, uid)));
|
||
|
|
aml_append(dev, method);
|
||
|
|
@@ -703,9 +714,11 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
|
||
|
|
aml_append(sb_scope, cpus_dev);
|
||
|
|
aml_append(table, sb_scope);
|
||
|
|
|
||
|
|
- method = aml_method(event_handler_method, 0, AML_NOTSERIALIZED);
|
||
|
|
- aml_append(method, aml_call0("\\_SB.CPUS." CPU_SCAN_METHOD));
|
||
|
|
- aml_append(table, method);
|
||
|
|
+ if (event_handler_method) {
|
||
|
|
+ method = aml_method(event_handler_method, 0, AML_NOTSERIALIZED);
|
||
|
|
+ aml_append(method, aml_call0("\\_SB.CPUS." CPU_SCAN_METHOD));
|
||
|
|
+ aml_append(table, method);
|
||
|
|
+ }
|
||
|
|
|
||
|
|
g_free(cphp_res_path);
|
||
|
|
}
|
||
|
|
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
|
||
|
|
index a99c6e4fe3..1ce2d67c2e 100644
|
||
|
|
--- a/hw/i386/acpi-build.c
|
||
|
|
+++ b/hw/i386/acpi-build.c
|
||
|
|
@@ -1513,7 +1513,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
||
|
|
.fw_unplugs_cpu = pm->smi_on_cpu_unplug,
|
||
|
|
};
|
||
|
|
build_cpus_aml(dsdt, machine, opts, pm->cpu_hp_io_base,
|
||
|
|
- "\\_SB.PCI0", "\\_GPE._E02");
|
||
|
|
+ "\\_SB.PCI0", "\\_GPE._E02", AML_SYSTEM_IO);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (pcms->memhp_io_base && nr_mem) {
|
||
|
|
diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
|
||
|
|
index 999caaf510..a0fdc44bdd 100644
|
||
|
|
--- a/include/hw/acpi/cpu.h
|
||
|
|
+++ b/include/hw/acpi/cpu.h
|
||
|
|
@@ -58,7 +58,8 @@ typedef struct CPUHotplugFeatures {
|
||
|
|
void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
|
||
|
|
hwaddr io_base,
|
||
|
|
const char *res_root,
|
||
|
|
- const char *event_handler_method);
|
||
|
|
+ const char *event_handler_method,
|
||
|
|
+ AmlRegionSpace rs);
|
||
|
|
|
||
|
|
void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list);
|
||
|
|
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|