mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback
build_cpus_aml() is architecture independent but needs to create architecture- specific CPU AML. So far this was achieved by using a virtual method from TYPE_ACPI_DEVICE_IF. However, build_cpus_aml() would resolve this interface from global (!) state. This makes it quite incomprehensible where this interface comes from (TYPE_PIIX4_PM?, TYPE_ICH9_LPC_DEVICE?, TYPE_ACPI_GED_X86?) an can lead to crashes when the generic code is ported to new architectures. So far, build_cpus_aml() is only called in architecture-specific code -- and only in x86. We can therefore simply pass pc_madt_cpu_entry() as callback to build_cpus_aml(). This is the same callback that would be used through TYPE_ACPI_DEVICE_IF. Signed-off-by: Bernhard Beschow <shentey@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230908084234.17642-3-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
f4a06e5921
commit
9a4fedcf12
3 changed files with 9 additions and 9 deletions
|
@ -338,7 +338,7 @@ const VMStateDescription vmstate_cpu_hotplug = {
|
|||
#define CPU_FW_EJECT_EVENT "CEJF"
|
||||
|
||||
void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
|
||||
hwaddr io_base,
|
||||
build_madt_cpu_fn build_madt_cpu, hwaddr io_base,
|
||||
const char *res_root,
|
||||
const char *event_handler_method)
|
||||
{
|
||||
|
@ -353,8 +353,6 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
|
|||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
const CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids(machine);
|
||||
char *cphp_res_path = g_strdup_printf("%s." CPUHP_RES_DEVICE, res_root);
|
||||
Object *obj = object_resolve_path_type("", TYPE_ACPI_DEVICE_IF, NULL);
|
||||
AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(obj);
|
||||
|
||||
cpu_ctrl_dev = aml_device("%s", cphp_res_path);
|
||||
{
|
||||
|
@ -664,9 +662,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
|
|||
aml_append(dev, method);
|
||||
|
||||
/* build _MAT object */
|
||||
assert(adevc && adevc->madt_cpu);
|
||||
adevc->madt_cpu(i, arch_ids, madt_buf,
|
||||
true); /* set enabled flag */
|
||||
build_madt_cpu(i, arch_ids, madt_buf, true); /* set enabled flag */
|
||||
aml_append(dev, aml_name_decl("_MAT",
|
||||
aml_buffer(madt_buf->len, (uint8_t *)madt_buf->data)));
|
||||
g_array_free(madt_buf, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue