All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup
@ 2023-09-08  8:42 Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 1/8] hw/i386/acpi-build: Use pc_madt_cpu_entry() directly Bernhard Beschow
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-08  8:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé,
	Bernhard Beschow

This series contains changes from my effort to bring the VIA south bridges to
the PC machine [1]. The first part of the series resolves the
AcpiCpuAmlIfClass::madt_cpu virtual method which frees ACPI controllers from
worrying about CPU AML generation. The second part minimizes an Intel-specific
assumption in AML generation to just one place. The third part contains two
ACPI tracing patches which have been reviewed a long time ago but weren't merged
yet.

The removal of AcpiCpuAmlIfClass::madt_cpu is essentially a respin of [2] with
a different approach. Igor wasn't generally against it but wasn't convinced
either [3]. The new approach causes much less churn and instead allows to
remove code. So I think it's worth to be reconsidered.

The motivation for removing this virtual method didn't change: It frees the ACPI
controllers in general and PIIX4 PM in particular from generating X86 CPU AML.
The latter is also used in MPIS context where X86 CPU AML generation is
stubbed out. This indicates a design issue where a problem was solved at the
wrong place. Moreover, it turned out that TYPE_ACPI_GED_X86 could be removed as
well, further supporting this claim.

The second part of this series limits SMI command port determination during AML
generation to just one place. Currently the ACPI_PORT_SMI_CMD constant is used
multiple times which has an Intel-specific value. In order to make the code a
microscopic bit more compatible with our VIA south bridge models its usage gets
limited to one place, allowing the constant to be turned into a device model
property in the future.

The third part improves the tracing experience for ACPI general purpose events.
It originates from an old series: [4].

Testing done:
* `make check`
* `make check-avocado`

v2:
* Trace ACPI GPE values with "0x%02" (Phil)

[1] https://github.com/shentok/qemu/tree/pc-via
[2] https://lore.kernel.org/qemu-devel/20230121151941.24120-1-shentey@gmail.com/
[3] https://lore.kernel.org/qemu-devel/20230125174842.395fda5d@imammedo.users.ipa.redhat.com/
[4] https://patchew.org/QEMU/20230122170724.21868-1-shentey@gmail.com/

Bernhard Beschow (8):
  hw/i386/acpi-build: Use pc_madt_cpu_entry() directly
  hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback
  hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method
  hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h"
  hw/i386: Remove now redundant TYPE_ACPI_GED_X86
  hw/i386/acpi-build: Determine SMI command port just once
  hw/acpi: Trace GPE access in all device models, not just PIIX4
  hw/acpi/core: Trace enable and status registers of GPE separately

 hw/acpi/hmat.h                         |  3 ++-
 hw/i386/acpi-common.h                  |  3 +--
 include/hw/acpi/acpi_dev_interface.h   |  3 ---
 include/hw/acpi/cpu.h                  |  6 ++++-
 include/hw/acpi/generic_event_device.h |  2 --
 hw/acpi/acpi-x86-stub.c                |  6 -----
 hw/acpi/core.c                         |  9 +++++++
 hw/acpi/cpu.c                          |  9 +++----
 hw/acpi/hmat.c                         |  1 +
 hw/acpi/memory_hotplug.c               |  1 +
 hw/acpi/piix4.c                        |  5 ----
 hw/i386/acpi-build.c                   | 13 +++++-----
 hw/i386/acpi-common.c                  |  5 ++--
 hw/i386/acpi-microvm.c                 |  3 +--
 hw/i386/generic_event_device_x86.c     | 36 --------------------------
 hw/i386/microvm.c                      |  2 +-
 hw/isa/lpc_ich9.c                      |  1 -
 hw/acpi/trace-events                   | 10 ++++---
 hw/i386/meson.build                    |  1 -
 19 files changed, 38 insertions(+), 81 deletions(-)
 delete mode 100644 hw/i386/generic_event_device_x86.c

-- 
2.42.0



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/8] hw/i386/acpi-build: Use pc_madt_cpu_entry() directly
  2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
@ 2023-09-08  8:42 ` Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 2/8] hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback Bernhard Beschow
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-08  8:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé,
	Bernhard Beschow

This is x86-specific code, so there is no advantage in using
pc_madt_cpu_entry() behind an architecture-agnostic interface.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/acpi-common.h  | 3 +--
 hw/i386/acpi-build.c   | 3 +--
 hw/i386/acpi-common.c  | 5 ++---
 hw/i386/acpi-microvm.c | 3 +--
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/hw/i386/acpi-common.h b/hw/i386/acpi-common.h
index a68825acf5..b3c56ee014 100644
--- a/hw/i386/acpi-common.h
+++ b/hw/i386/acpi-common.h
@@ -1,7 +1,6 @@
 #ifndef HW_I386_ACPI_COMMON_H
 #define HW_I386_ACPI_COMMON_H
 
-#include "hw/acpi/acpi_dev_interface.h"
 #include "hw/acpi/bios-linker-loader.h"
 #include "hw/i386/x86.h"
 
@@ -9,7 +8,7 @@
 #define ACPI_BUILD_IOAPIC_ID 0x0
 
 void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
-                     X86MachineState *x86ms, AcpiDeviceIf *adev,
+                     X86MachineState *x86ms,
                      const char *oem_id, const char *oem_table_id);
 
 #endif
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index bb12b0ad43..09586b8d9b 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2547,8 +2547,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
 
     acpi_add_table(table_offsets, tables_blob);
     acpi_build_madt(tables_blob, tables->linker, x86ms,
-                    ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
-                    x86ms->oem_table_id);
+                    x86ms->oem_id, x86ms->oem_table_id);
 
 #ifdef CONFIG_ACPI_ERST
     {
diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c
index 8a0932fe84..43dc23f7e0 100644
--- a/hw/i386/acpi-common.c
+++ b/hw/i386/acpi-common.c
@@ -94,14 +94,13 @@ build_xrupt_override(GArray *entry, uint8_t src, uint32_t gsi, uint16_t flags)
  * 5.2.8 Multiple APIC Description Table
  */
 void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
-                     X86MachineState *x86ms, AcpiDeviceIf *adev,
+                     X86MachineState *x86ms,
                      const char *oem_id, const char *oem_table_id)
 {
     int i;
     bool x2apic_mode = false;
     MachineClass *mc = MACHINE_GET_CLASS(x86ms);
     const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(MACHINE(x86ms));
-    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(adev);
     AcpiTable table = { .sig = "APIC", .rev = 3, .oem_id = oem_id,
                         .oem_table_id = oem_table_id };
 
@@ -111,7 +110,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,
     build_append_int_noprefix(table_data, 1 /* PCAT_COMPAT */, 4); /* Flags */
 
     for (i = 0; i < apic_ids->len; i++) {
-        adevc->madt_cpu(i, apic_ids, table_data, false);
+        pc_madt_cpu_entry(i, apic_ids, table_data, false);
         if (apic_ids->cpus[i].arch_id > 254) {
             x2apic_mode = true;
         }
diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c
index a075360d85..fec22d85c1 100644
--- a/hw/i386/acpi-microvm.c
+++ b/hw/i386/acpi-microvm.c
@@ -214,8 +214,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
 
     acpi_add_table(table_offsets, tables_blob);
     acpi_build_madt(tables_blob, tables->linker, X86_MACHINE(machine),
-                    ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
-                    x86ms->oem_table_id);
+                    x86ms->oem_id, x86ms->oem_table_id);
 
 #ifdef CONFIG_ACPI_ERST
     {
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/8] hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback
  2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 1/8] hw/i386/acpi-build: Use pc_madt_cpu_entry() directly Bernhard Beschow
@ 2023-09-08  8:42 ` Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 3/8] hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method Bernhard Beschow
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-08  8:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé,
	Bernhard Beschow

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>
---
 include/hw/acpi/cpu.h | 6 +++++-
 hw/acpi/cpu.c         | 8 ++------
 hw/i386/acpi-build.c  | 4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
index 999caaf510..bc901660fb 100644
--- a/include/hw/acpi/cpu.h
+++ b/include/hw/acpi/cpu.h
@@ -15,6 +15,7 @@
 #include "hw/qdev-core.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/aml-build.h"
+#include "hw/boards.h"
 #include "hw/hotplug.h"
 
 typedef struct AcpiCpuStatus {
@@ -55,8 +56,11 @@ typedef struct CPUHotplugFeatures {
     const char *smi_path;
 } CPUHotplugFeatures;
 
+typedef void (*build_madt_cpu_fn)(int uid, const CPUArchIdList *apic_ids,
+                                  GArray *entry, bool force_enabled);
+
 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);
 
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 19c154d78f..65a3202d3f 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -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);
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 09586b8d9b..c8ac665d36 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1549,8 +1549,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
             .smi_path = pm->smi_on_cpuhp ? "\\_SB.PCI0.SMI0.SMIC" : NULL,
             .fw_unplugs_cpu = pm->smi_on_cpu_unplug,
         };
-        build_cpus_aml(dsdt, machine, opts, pm->cpu_hp_io_base,
-                       "\\_SB.PCI0", "\\_GPE._E02");
+        build_cpus_aml(dsdt, machine, opts, pc_madt_cpu_entry,
+                       pm->cpu_hp_io_base, "\\_SB.PCI0", "\\_GPE._E02");
     }
 
     if (pcms->memhp_io_base && nr_mem) {
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/8] hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method
  2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 1/8] hw/i386/acpi-build: Use pc_madt_cpu_entry() directly Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 2/8] hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback Bernhard Beschow
@ 2023-09-08  8:42 ` Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 4/8] hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" Bernhard Beschow
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-08  8:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé,
	Bernhard Beschow

This virtual method was always set to the x86-specific pc_madt_cpu_entry(),
even in piix4 which is also used in MIPS. The previous changes use
pc_madt_cpu_entry() otherwise, so madt_cpu can be dropped.

Since pc_madt_cpu_entry() is now only used in x86-specific code, the stub
in hw/acpi/acpi-x86-stub can be removed as well.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/acpi/acpi_dev_interface.h | 2 --
 hw/acpi/acpi-x86-stub.c              | 6 ------
 hw/acpi/piix4.c                      | 2 --
 hw/i386/generic_event_device_x86.c   | 9 ---------
 hw/isa/lpc_ich9.c                    | 1 -
 5 files changed, 20 deletions(-)

diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_dev_interface.h
index a1648220ff..ca92928124 100644
--- a/include/hw/acpi/acpi_dev_interface.h
+++ b/include/hw/acpi/acpi_dev_interface.h
@@ -52,7 +52,5 @@ struct AcpiDeviceIfClass {
     /* <public> */
     void (*ospm_status)(AcpiDeviceIf *adev, ACPIOSTInfoList ***list);
     void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev);
-    void (*madt_cpu)(int uid, const CPUArchIdList *apic_ids, GArray *entry,
-                     bool force_enabled);
 };
 #endif
diff --git a/hw/acpi/acpi-x86-stub.c b/hw/acpi/acpi-x86-stub.c
index d0d399d26b..9662a594ad 100644
--- a/hw/acpi/acpi-x86-stub.c
+++ b/hw/acpi/acpi-x86-stub.c
@@ -1,12 +1,6 @@
 #include "qemu/osdep.h"
-#include "hw/i386/pc.h"
 #include "hw/i386/acpi-build.h"
 
-void pc_madt_cpu_entry(int uid, const CPUArchIdList *apic_ids,
-                       GArray *entry, bool force_enabled)
-{
-}
-
 Object *acpi_get_i386_pci_host(void)
 {
        return NULL;
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 63d2113b86..a7892c444c 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -20,7 +20,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/i386/pc.h"
 #include "hw/irq.h"
 #include "hw/isa/apm.h"
 #include "hw/i2c/pm_smbus.h"
@@ -654,7 +653,6 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
     hc->is_hotpluggable_bus = piix4_is_hotpluggable_bus;
     adevc->ospm_status = piix4_ospm_status;
     adevc->send_event = piix4_send_gpe;
-    adevc->madt_cpu = pc_madt_cpu_entry;
 }
 
 static const TypeInfo piix4_pm_info = {
diff --git a/hw/i386/generic_event_device_x86.c b/hw/i386/generic_event_device_x86.c
index e26fb02a2e..8fc233e1f1 100644
--- a/hw/i386/generic_event_device_x86.c
+++ b/hw/i386/generic_event_device_x86.c
@@ -8,19 +8,10 @@
 
 #include "qemu/osdep.h"
 #include "hw/acpi/generic_event_device.h"
-#include "hw/i386/pc.h"
-
-static void acpi_ged_x86_class_init(ObjectClass *class, void *data)
-{
-    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_CLASS(class);
-
-    adevc->madt_cpu = pc_madt_cpu_entry;
-}
 
 static const TypeInfo acpi_ged_x86_info = {
     .name          = TYPE_ACPI_GED_X86,
     .parent        = TYPE_ACPI_GED,
-    .class_init    = acpi_ged_x86_class_init,
     .interfaces = (InterfaceInfo[]) {
         { TYPE_HOTPLUG_HANDLER },
         { TYPE_ACPI_DEVICE_IF },
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 9c47a2f6c7..92527f3c75 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -876,7 +876,6 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data)
     hc->is_hotpluggable_bus = ich9_pm_is_hotpluggable_bus;
     adevc->ospm_status = ich9_pm_ospm_status;
     adevc->send_event = ich9_send_gpe;
-    adevc->madt_cpu = pc_madt_cpu_entry;
     amldevc->build_dev_aml = build_ich9_isa_aml;
 }
 
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 4/8] hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h"
  2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
                   ` (2 preceding siblings ...)
  2023-09-08  8:42 ` [PATCH v2 3/8] hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method Bernhard Beschow
@ 2023-09-08  8:42 ` Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 5/8] hw/i386: Remove now redundant TYPE_ACPI_GED_X86 Bernhard Beschow
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-08  8:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé,
	Bernhard Beschow

The "hw/boards.h" is unused since the previous commit. Since its removal
requires include fixes in various unrelated files to keep the code compiling it
has been split in a dedicated commit.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/acpi/hmat.h                       | 3 ++-
 include/hw/acpi/acpi_dev_interface.h | 1 -
 hw/acpi/cpu.c                        | 1 +
 hw/acpi/hmat.c                       | 1 +
 hw/acpi/memory_hotplug.c             | 1 +
 5 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/acpi/hmat.h b/hw/acpi/hmat.h
index b57f0e7e80..fd989cb661 100644
--- a/hw/acpi/hmat.h
+++ b/hw/acpi/hmat.h
@@ -27,7 +27,8 @@
 #ifndef HMAT_H
 #define HMAT_H
 
-#include "hw/acpi/aml-build.h"
+#include "hw/acpi/bios-linker-loader.h"
+#include "sysemu/numa.h"
 
 /*
  * ACPI 6.3: 5.2.27.3 Memory Proximity Domain Attributes Structure,
diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_dev_interface.h
index ca92928124..68d9d15f50 100644
--- a/include/hw/acpi/acpi_dev_interface.h
+++ b/include/hw/acpi/acpi_dev_interface.h
@@ -3,7 +3,6 @@
 
 #include "qapi/qapi-types-acpi.h"
 #include "qom/object.h"
-#include "hw/boards.h"
 #include "hw/qdev-core.h"
 
 /* These values are part of guest ABI, and can not be changed */
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 65a3202d3f..011d2c6c2d 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -1,6 +1,7 @@
 #include "qemu/osdep.h"
 #include "migration/vmstate.h"
 #include "hw/acpi/cpu.h"
+#include "hw/core/cpu.h"
 #include "qapi/error.h"
 #include "qapi/qapi-events-acpi.h"
 #include "trace.h"
diff --git a/hw/acpi/hmat.c b/hw/acpi/hmat.c
index 3a6d51282a..d9de0daf89 100644
--- a/hw/acpi/hmat.c
+++ b/hw/acpi/hmat.c
@@ -27,6 +27,7 @@
 #include "qemu/osdep.h"
 #include "qemu/units.h"
 #include "sysemu/numa.h"
+#include "hw/acpi/aml-build.h"
 #include "hw/acpi/hmat.h"
 
 /*
diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c
index d926f4f77d..0b883df813 100644
--- a/hw/acpi/memory_hotplug.c
+++ b/hw/acpi/memory_hotplug.c
@@ -1,6 +1,7 @@
 #include "qemu/osdep.h"
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/mem/pc-dimm.h"
+#include "hw/boards.h"
 #include "hw/qdev-core.h"
 #include "migration/vmstate.h"
 #include "trace.h"
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 5/8] hw/i386: Remove now redundant TYPE_ACPI_GED_X86
  2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
                   ` (3 preceding siblings ...)
  2023-09-08  8:42 ` [PATCH v2 4/8] hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" Bernhard Beschow
@ 2023-09-08  8:42 ` Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 6/8] hw/i386/acpi-build: Determine SMI command port just once Bernhard Beschow
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-08  8:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé,
	Bernhard Beschow

Now that TYPE_ACPI_GED_X86 doesn't assign AcpiDeviceIfClass::madt_cpu any more
it is the same as TYPE_ACPI_GED.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/acpi/generic_event_device.h |  2 --
 hw/i386/generic_event_device_x86.c     | 27 --------------------------
 hw/i386/microvm.c                      |  2 +-
 hw/i386/meson.build                    |  1 -
 4 files changed, 1 insertion(+), 31 deletions(-)
 delete mode 100644 hw/i386/generic_event_device_x86.c

diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h
index d831bbd889..ba84ce0214 100644
--- a/include/hw/acpi/generic_event_device.h
+++ b/include/hw/acpi/generic_event_device.h
@@ -69,8 +69,6 @@
 #define TYPE_ACPI_GED "acpi-ged"
 OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED)
 
-#define TYPE_ACPI_GED_X86 "acpi-ged-x86"
-
 #define ACPI_GED_EVT_SEL_OFFSET    0x0
 #define ACPI_GED_EVT_SEL_LEN       0x4
 
diff --git a/hw/i386/generic_event_device_x86.c b/hw/i386/generic_event_device_x86.c
deleted file mode 100644
index 8fc233e1f1..0000000000
--- a/hw/i386/generic_event_device_x86.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * x86 variant of the generic event device for hw reduced acpi
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2 or later, as published by the Free Software Foundation.
- */
-
-#include "qemu/osdep.h"
-#include "hw/acpi/generic_event_device.h"
-
-static const TypeInfo acpi_ged_x86_info = {
-    .name          = TYPE_ACPI_GED_X86,
-    .parent        = TYPE_ACPI_GED,
-    .interfaces = (InterfaceInfo[]) {
-        { TYPE_HOTPLUG_HANDLER },
-        { TYPE_ACPI_DEVICE_IF },
-        { }
-    }
-};
-
-static void acpi_ged_x86_register_types(void)
-{
-    type_register_static(&acpi_ged_x86_info);
-}
-
-type_init(acpi_ged_x86_register_types)
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 8deeb62774..b9c93039e2 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -204,7 +204,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)
 
     /* Optional and legacy devices */
     if (x86_machine_is_acpi_enabled(x86ms)) {
-        DeviceState *dev = qdev_new(TYPE_ACPI_GED_X86);
+        DeviceState *dev = qdev_new(TYPE_ACPI_GED);
         qdev_prop_set_uint32(dev, "ged-event", ACPI_GED_PWR_DOWN_EVT);
         sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, GED_MMIO_BASE);
         /* sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, GED_MMIO_BASE_MEMHP); */
diff --git a/hw/i386/meson.build b/hw/i386/meson.build
index cfdbfdcbcb..ff879069c9 100644
--- a/hw/i386/meson.build
+++ b/hw/i386/meson.build
@@ -20,7 +20,6 @@ i386_ss.add(when: 'CONFIG_SGX', if_true: files('sgx-epc.c','sgx.c'),
                                 if_false: files('sgx-stub.c'))
 
 i386_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-common.c'))
-i386_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device_x86.c'))
 i386_ss.add(when: 'CONFIG_PC', if_true: files(
   'pc.c',
   'pc_sysfw.c',
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 6/8] hw/i386/acpi-build: Determine SMI command port just once
  2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
                   ` (4 preceding siblings ...)
  2023-09-08  8:42 ` [PATCH v2 5/8] hw/i386: Remove now redundant TYPE_ACPI_GED_X86 Bernhard Beschow
@ 2023-09-08  8:42 ` Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 7/8] hw/acpi: Trace GPE access in all device models, not just PIIX4 Bernhard Beschow
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-08  8:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé,
	Bernhard Beschow

The SMI command port is currently hardcoded by means of the ACPI_PORT_SMI_CMD
macro. This hardcoding is Intel specific and doesn't match VIA, for example.
There is already the AcpiFadtData::smi_cmd attribute which is used when building
the FADT. Let's also use it when building the DSDT which confines SMI command
port determination to just one place. This allows it to become a property later,
thus resolving the Intel assumption.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/acpi-build.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index c8ac665d36..f9e7291150 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1495,14 +1495,14 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
             aml_append(crs,
                 aml_io(
                        AML_DECODE16,
-                       ACPI_PORT_SMI_CMD,
-                       ACPI_PORT_SMI_CMD,
+                       pm->fadt.smi_cmd,
+                       pm->fadt.smi_cmd,
                        1,
                        2)
             );
             aml_append(dev, aml_name_decl("_CRS", crs));
             aml_append(dev, aml_operation_region("SMIR", AML_SYSTEM_IO,
-                aml_int(ACPI_PORT_SMI_CMD), 2));
+                aml_int(pm->fadt.smi_cmd), 2));
             field = aml_field("SMIR", AML_BYTE_ACC, AML_NOLOCK,
                               AML_WRITE_AS_ZEROS);
             aml_append(field, aml_named_field("SMIC", 8));
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 7/8] hw/acpi: Trace GPE access in all device models, not just PIIX4
  2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
                   ` (5 preceding siblings ...)
  2023-09-08  8:42 ` [PATCH v2 6/8] hw/i386/acpi-build: Determine SMI command port just once Bernhard Beschow
@ 2023-09-08  8:42 ` Bernhard Beschow
  2023-09-08  8:42 ` [PATCH v2 8/8] hw/acpi/core: Trace enable and status registers of GPE separately Bernhard Beschow
  2023-09-19 19:47 ` [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
  8 siblings, 0 replies; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-08  8:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé,
	Bernhard Beschow

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/acpi/core.c       | 5 +++++
 hw/acpi/piix4.c      | 3 ---
 hw/acpi/trace-events | 8 ++++----
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 00b1e79a30..c561845a4a 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -32,6 +32,7 @@
 #include "qemu/module.h"
 #include "qemu/option.h"
 #include "sysemu/runstate.h"
+#include "trace.h"
 
 struct acpi_table_header {
     uint16_t _length;         /* our length, not actual part of the hdr */
@@ -686,6 +687,8 @@ void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val)
 {
     uint8_t *cur;
 
+    trace_acpi_gpe_ioport_writeb(addr, val);
+
     cur = acpi_gpe_ioport_get_ptr(ar, addr);
     if (addr < ar->gpe.len / 2) {
         /* GPE_STS */
@@ -709,6 +712,8 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr)
         val = *cur;
     }
 
+    trace_acpi_gpe_ioport_readb(addr, val);
+
     return val;
 }
 
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index a7892c444c..dd523d2e4c 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -42,7 +42,6 @@
 #include "hw/acpi/acpi_dev_interface.h"
 #include "migration/vmstate.h"
 #include "hw/core/cpu.h"
-#include "trace.h"
 #include "qom/object.h"
 
 #define GPE_BASE 0xafe0
@@ -517,7 +516,6 @@ static uint64_t gpe_readb(void *opaque, hwaddr addr, unsigned width)
     PIIX4PMState *s = opaque;
     uint32_t val = acpi_gpe_ioport_readb(&s->ar, addr);
 
-    trace_piix4_gpe_readb(addr, width, val);
     return val;
 }
 
@@ -526,7 +524,6 @@ static void gpe_writeb(void *opaque, hwaddr addr, uint64_t val,
 {
     PIIX4PMState *s = opaque;
 
-    trace_piix4_gpe_writeb(addr, width, val);
     acpi_gpe_ioport_writeb(&s->ar, addr, val);
     acpi_update_sci(&s->ar, s->irq);
 }
diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events
index 78e0a8670e..159937ddb9 100644
--- a/hw/acpi/trace-events
+++ b/hw/acpi/trace-events
@@ -17,6 +17,10 @@ mhp_acpi_clear_remove_evt(uint32_t slot) "slot[0x%"PRIx32"] clear remove event"
 mhp_acpi_pc_dimm_deleted(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm deleted"
 mhp_acpi_pc_dimm_delete_failed(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm delete failed"
 
+# core.c
+acpi_gpe_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%" PRIx8
+acpi_gpe_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%" PRIx8
+
 # cpu.c
 cpuhp_acpi_invalid_idx_selected(uint32_t idx) "0x%"PRIx32
 cpuhp_acpi_read_flags(uint32_t idx, uint8_t flags) "idx[0x%"PRIx32"] flags: 0x%"PRIx8
@@ -48,10 +52,6 @@ acpi_pci_sel_read(uint32_t val) "%" PRIu32
 acpi_pci_ej_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64
 acpi_pci_sel_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64
 
-# piix4.c
-piix4_gpe_readb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d ==> 0x%" PRIx64
-piix4_gpe_writeb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d <== 0x%" PRIx64
-
 # tco.c
 tco_timer_reload(int ticks, int msec) "ticks=%d (%d ms)"
 tco_timer_expired(int timeouts_no, bool strap, bool no_reboot) "timeouts_no=%d no_reboot=%d/%d"
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 8/8] hw/acpi/core: Trace enable and status registers of GPE separately
  2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
                   ` (6 preceding siblings ...)
  2023-09-08  8:42 ` [PATCH v2 7/8] hw/acpi: Trace GPE access in all device models, not just PIIX4 Bernhard Beschow
@ 2023-09-08  8:42 ` Bernhard Beschow
  2023-09-19 19:47 ` [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
  8 siblings, 0 replies; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-08  8:42 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé,
	Bernhard Beschow

The bit positions of both registers are related. Tracing the registers
independently results in the same offsets across these registers which
eases debugging.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/acpi/core.c       | 10 +++++++---
 hw/acpi/trace-events |  6 ++++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index c561845a4a..ec5e127d17 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -687,13 +687,13 @@ void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val)
 {
     uint8_t *cur;
 
-    trace_acpi_gpe_ioport_writeb(addr, val);
-
     cur = acpi_gpe_ioport_get_ptr(ar, addr);
     if (addr < ar->gpe.len / 2) {
+        trace_acpi_gpe_sts_ioport_writeb(addr, val);
         /* GPE_STS */
         *cur = (*cur) & ~val;
     } else if (addr < ar->gpe.len) {
+        trace_acpi_gpe_en_ioport_writeb(addr - (ar->gpe.len / 2), val);
         /* GPE_EN */
         *cur = val;
     } else {
@@ -712,7 +712,11 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr)
         val = *cur;
     }
 
-    trace_acpi_gpe_ioport_readb(addr, val);
+    if (addr < ar->gpe.len / 2) {
+        trace_acpi_gpe_sts_ioport_readb(addr, val);
+    } else {
+        trace_acpi_gpe_en_ioport_readb(addr - (ar->gpe.len / 2), val);
+    }
 
     return val;
 }
diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events
index 159937ddb9..edc93e703c 100644
--- a/hw/acpi/trace-events
+++ b/hw/acpi/trace-events
@@ -18,8 +18,10 @@ mhp_acpi_pc_dimm_deleted(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm deleted"
 mhp_acpi_pc_dimm_delete_failed(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm delete failed"
 
 # core.c
-acpi_gpe_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%" PRIx8
-acpi_gpe_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%" PRIx8
+acpi_gpe_en_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%02" PRIx8
+acpi_gpe_en_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%02" PRIx8
+acpi_gpe_sts_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%02" PRIx8
+acpi_gpe_sts_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%02" PRIx8
 
 # cpu.c
 cpuhp_acpi_invalid_idx_selected(uint32_t idx) "0x%"PRIx32
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup
  2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
                   ` (7 preceding siblings ...)
  2023-09-08  8:42 ` [PATCH v2 8/8] hw/acpi/core: Trace enable and status registers of GPE separately Bernhard Beschow
@ 2023-09-19 19:47 ` Bernhard Beschow
  2023-09-20  2:42   ` Michael S. Tsirkin
  8 siblings, 1 reply; 11+ messages in thread
From: Bernhard Beschow @ 2023-09-19 19:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Eduardo Habkost, Aurelien Jarno,
	Paolo Bonzini, Marcel Apfelbaum, Sergio Lopez, Richard Henderson,
	Igor Mammedov, Ani Sinha, Philippe Mathieu-Daudé



Am 8. September 2023 08:42:26 UTC schrieb Bernhard Beschow <shentey@gmail.com>:
>This series contains changes from my effort to bring the VIA south bridges to
>
>the PC machine [1]. The first part of the series resolves the
>
>AcpiCpuAmlIfClass::madt_cpu virtual method which frees ACPI controllers from
>
>worrying about CPU AML generation. The second part minimizes an Intel-specific
>
>assumption in AML generation to just one place. The third part contains two
>
>ACPI tracing patches which have been reviewed a long time ago but weren't merged
>
>yet.
>
>
>
>The removal of AcpiCpuAmlIfClass::madt_cpu is essentially a respin of [2] with
>
>a different approach. Igor wasn't generally against it but wasn't convinced
>
>either [3]. The new approach causes much less churn and instead allows to
>
>remove code. So I think it's worth to be reconsidered.
>
>
>
>The motivation for removing this virtual method didn't change: It frees the ACPI
>
>controllers in general and PIIX4 PM in particular from generating X86 CPU AML.
>
>The latter is also used in MPIS context where X86 CPU AML generation is
>
>stubbed out. This indicates a design issue where a problem was solved at the
>
>wrong place. Moreover, it turned out that TYPE_ACPI_GED_X86 could be removed as
>
>well, further supporting this claim.
>
>
>
>The second part of this series limits SMI command port determination during AML
>
>generation to just one place. Currently the ACPI_PORT_SMI_CMD constant is used
>
>multiple times which has an Intel-specific value. In order to make the code a
>
>microscopic bit more compatible with our VIA south bridge models its usage gets
>
>limited to one place, allowing the constant to be turned into a device model
>
>property in the future.
>
>
>
>The third part improves the tracing experience for ACPI general purpose events.
>
>It originates from an old series: [4].
>
>
>
>Testing done:
>
>* `make check`
>
>* `make check-avocado`
>
>
>
>v2:
>
>* Trace ACPI GPE values with "0x%02" (Phil)
>

Ping

All patches reviewed. Michael, are you the one going to queue it?

Thanks,
Bernhard

>
>
>[1] https://github.com/shentok/qemu/tree/pc-via
>
>[2] https://lore.kernel.org/qemu-devel/20230121151941.24120-1-shentey@gmail.com/
>
>[3] https://lore.kernel.org/qemu-devel/20230125174842.395fda5d@imammedo.users.ipa.redhat.com/
>
>[4] https://patchew.org/QEMU/20230122170724.21868-1-shentey@gmail.com/
>
>
>
>Bernhard Beschow (8):
>
>  hw/i386/acpi-build: Use pc_madt_cpu_entry() directly
>
>  hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback
>
>  hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method
>
>  hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h"
>
>  hw/i386: Remove now redundant TYPE_ACPI_GED_X86
>
>  hw/i386/acpi-build: Determine SMI command port just once
>
>  hw/acpi: Trace GPE access in all device models, not just PIIX4
>
>  hw/acpi/core: Trace enable and status registers of GPE separately
>
>
>
> hw/acpi/hmat.h                         |  3 ++-
>
> hw/i386/acpi-common.h                  |  3 +--
>
> include/hw/acpi/acpi_dev_interface.h   |  3 ---
>
> include/hw/acpi/cpu.h                  |  6 ++++-
>
> include/hw/acpi/generic_event_device.h |  2 --
>
> hw/acpi/acpi-x86-stub.c                |  6 -----
>
> hw/acpi/core.c                         |  9 +++++++
>
> hw/acpi/cpu.c                          |  9 +++----
>
> hw/acpi/hmat.c                         |  1 +
>
> hw/acpi/memory_hotplug.c               |  1 +
>
> hw/acpi/piix4.c                        |  5 ----
>
> hw/i386/acpi-build.c                   | 13 +++++-----
>
> hw/i386/acpi-common.c                  |  5 ++--
>
> hw/i386/acpi-microvm.c                 |  3 +--
>
> hw/i386/generic_event_device_x86.c     | 36 --------------------------
>
> hw/i386/microvm.c                      |  2 +-
>
> hw/isa/lpc_ich9.c                      |  1 -
>
> hw/acpi/trace-events                   | 10 ++++---
>
> hw/i386/meson.build                    |  1 -
>
> 19 files changed, 38 insertions(+), 81 deletions(-)
>
> delete mode 100644 hw/i386/generic_event_device_x86.c
>
>
>
>-- >
>2.42.0
>
>
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup
  2023-09-19 19:47 ` [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
@ 2023-09-20  2:42   ` Michael S. Tsirkin
  0 siblings, 0 replies; 11+ messages in thread
From: Michael S. Tsirkin @ 2023-09-20  2:42 UTC (permalink / raw)
  To: Bernhard Beschow
  Cc: qemu-devel, Eduardo Habkost, Aurelien Jarno, Paolo Bonzini,
	Marcel Apfelbaum, Sergio Lopez, Richard Henderson, Igor Mammedov,
	Ani Sinha, Philippe Mathieu-Daudé

On Tue, Sep 19, 2023 at 07:47:09PM +0000, Bernhard Beschow wrote:
> 
> 
> Am 8. September 2023 08:42:26 UTC schrieb Bernhard Beschow <shentey@gmail.com>:
> >This series contains changes from my effort to bring the VIA south bridges to
> >
> >the PC machine [1]. The first part of the series resolves the
> >
> >AcpiCpuAmlIfClass::madt_cpu virtual method which frees ACPI controllers from
> >
> >worrying about CPU AML generation. The second part minimizes an Intel-specific
> >
> >assumption in AML generation to just one place. The third part contains two
> >
> >ACPI tracing patches which have been reviewed a long time ago but weren't merged
> >
> >yet.
> >
> >
> >
> >The removal of AcpiCpuAmlIfClass::madt_cpu is essentially a respin of [2] with
> >
> >a different approach. Igor wasn't generally against it but wasn't convinced
> >
> >either [3]. The new approach causes much less churn and instead allows to
> >
> >remove code. So I think it's worth to be reconsidered.
> >
> >
> >
> >The motivation for removing this virtual method didn't change: It frees the ACPI
> >
> >controllers in general and PIIX4 PM in particular from generating X86 CPU AML.
> >
> >The latter is also used in MPIS context where X86 CPU AML generation is
> >
> >stubbed out. This indicates a design issue where a problem was solved at the
> >
> >wrong place. Moreover, it turned out that TYPE_ACPI_GED_X86 could be removed as
> >
> >well, further supporting this claim.
> >
> >
> >
> >The second part of this series limits SMI command port determination during AML
> >
> >generation to just one place. Currently the ACPI_PORT_SMI_CMD constant is used
> >
> >multiple times which has an Intel-specific value. In order to make the code a
> >
> >microscopic bit more compatible with our VIA south bridge models its usage gets
> >
> >limited to one place, allowing the constant to be turned into a device model
> >
> >property in the future.
> >
> >
> >
> >The third part improves the tracing experience for ACPI general purpose events.
> >
> >It originates from an old series: [4].
> >
> >
> >
> >Testing done:
> >
> >* `make check`
> >
> >* `make check-avocado`
> >
> >
> >
> >v2:
> >
> >* Trace ACPI GPE values with "0x%02" (Phil)
> >
> 
> Ping
> 
> All patches reviewed. Michael, are you the one going to queue it?
> 
> Thanks,
> Bernhard

yes, thanks!

> >
> >
> >[1] https://github.com/shentok/qemu/tree/pc-via
> >
> >[2] https://lore.kernel.org/qemu-devel/20230121151941.24120-1-shentey@gmail.com/
> >
> >[3] https://lore.kernel.org/qemu-devel/20230125174842.395fda5d@imammedo.users.ipa.redhat.com/
> >
> >[4] https://patchew.org/QEMU/20230122170724.21868-1-shentey@gmail.com/
> >
> >
> >
> >Bernhard Beschow (8):
> >
> >  hw/i386/acpi-build: Use pc_madt_cpu_entry() directly
> >
> >  hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback
> >
> >  hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method
> >
> >  hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h"
> >
> >  hw/i386: Remove now redundant TYPE_ACPI_GED_X86
> >
> >  hw/i386/acpi-build: Determine SMI command port just once
> >
> >  hw/acpi: Trace GPE access in all device models, not just PIIX4
> >
> >  hw/acpi/core: Trace enable and status registers of GPE separately
> >
> >
> >
> > hw/acpi/hmat.h                         |  3 ++-
> >
> > hw/i386/acpi-common.h                  |  3 +--
> >
> > include/hw/acpi/acpi_dev_interface.h   |  3 ---
> >
> > include/hw/acpi/cpu.h                  |  6 ++++-
> >
> > include/hw/acpi/generic_event_device.h |  2 --
> >
> > hw/acpi/acpi-x86-stub.c                |  6 -----
> >
> > hw/acpi/core.c                         |  9 +++++++
> >
> > hw/acpi/cpu.c                          |  9 +++----
> >
> > hw/acpi/hmat.c                         |  1 +
> >
> > hw/acpi/memory_hotplug.c               |  1 +
> >
> > hw/acpi/piix4.c                        |  5 ----
> >
> > hw/i386/acpi-build.c                   | 13 +++++-----
> >
> > hw/i386/acpi-common.c                  |  5 ++--
> >
> > hw/i386/acpi-microvm.c                 |  3 +--
> >
> > hw/i386/generic_event_device_x86.c     | 36 --------------------------
> >
> > hw/i386/microvm.c                      |  2 +-
> >
> > hw/isa/lpc_ich9.c                      |  1 -
> >
> > hw/acpi/trace-events                   | 10 ++++---
> >
> > hw/i386/meson.build                    |  1 -
> >
> > 19 files changed, 38 insertions(+), 81 deletions(-)
> >
> > delete mode 100644 hw/i386/generic_event_device_x86.c
> >
> >
> >
> >-- >
> >2.42.0
> >
> >
> >



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-09-20  2:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08  8:42 [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
2023-09-08  8:42 ` [PATCH v2 1/8] hw/i386/acpi-build: Use pc_madt_cpu_entry() directly Bernhard Beschow
2023-09-08  8:42 ` [PATCH v2 2/8] hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback Bernhard Beschow
2023-09-08  8:42 ` [PATCH v2 3/8] hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method Bernhard Beschow
2023-09-08  8:42 ` [PATCH v2 4/8] hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" Bernhard Beschow
2023-09-08  8:42 ` [PATCH v2 5/8] hw/i386: Remove now redundant TYPE_ACPI_GED_X86 Bernhard Beschow
2023-09-08  8:42 ` [PATCH v2 6/8] hw/i386/acpi-build: Determine SMI command port just once Bernhard Beschow
2023-09-08  8:42 ` [PATCH v2 7/8] hw/acpi: Trace GPE access in all device models, not just PIIX4 Bernhard Beschow
2023-09-08  8:42 ` [PATCH v2 8/8] hw/acpi/core: Trace enable and status registers of GPE separately Bernhard Beschow
2023-09-19 19:47 ` [PATCH v2 0/8] ACPI: X86 AML generation and GPE tracing cleanup Bernhard Beschow
2023-09-20  2:42   ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.