On 28/8/23 09:36, Bernhard Beschow wrote:
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 <shen...@gmail.com>
---
  include/hw/acpi/cpu.h | 6 +++++-
  hw/acpi/cpu.c         | 8 ++------
  hw/i386/acpi-build.c  | 4 ++--
  3 files changed, 9 insertions(+), 9 deletions(-)

Nice cleanup.

Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>


Reply via email to