* [PATCH 0/4] Cleanup AML generation for north and south bridges
@ 2022-10-26 13:31 Bernhard Beschow
2022-10-26 13:31 ` [PATCH 1/4] hw/i386/acpi-build: Remove unused struct Bernhard Beschow
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Bernhard Beschow @ 2022-10-26 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-trivial, Ani Sinha,
Igor Mammedov, Richard Henderson, Eduardo Habkost, Paolo Bonzini,
Bernhard Beschow
While refactoring of PCI AML generation seems to be still ongoing, this series
attempts to be an intermediate, short-term step to improve comprehensibility of
the code. It also simplifies experimentation with different south bridges (PIIX4
and VT82xx) in the pc machine.
Testing done:
* `mache check`
* Start a live CD using "pc" and "q35" machine types
Bernhard Beschow (4):
hw/i386/acpi-build: Remove unused struct
hw/i386/acpi-build: Resolve redundant attribute
hw/i386/acpi-build: Resolve PIIX ISA bridge rather than ACPI
controller
hw/i386/acpi-build: Generate AML for north and south bridges
separately
hw/i386/acpi-build.c | 45 ++++++++++++++++++--------------------------
1 file changed, 18 insertions(+), 27 deletions(-)
--
2.38.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] hw/i386/acpi-build: Remove unused struct
2022-10-26 13:31 [PATCH 0/4] Cleanup AML generation for north and south bridges Bernhard Beschow
@ 2022-10-26 13:31 ` Bernhard Beschow
2022-10-26 15:27 ` Philippe Mathieu-Daudé
2022-10-26 13:31 ` [PATCH 2/4] hw/i386/acpi-build: Resolve redundant attribute Bernhard Beschow
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Bernhard Beschow @ 2022-10-26 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-trivial, Ani Sinha,
Igor Mammedov, Richard Henderson, Eduardo Habkost, Paolo Bonzini,
Bernhard Beschow
Ammends commit b23046abe78f48498a423b802d6d86ba0172d57f 'pc: acpi-build:
simplify PCI bus tree generation'.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/i386/acpi-build.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4f54b61904..b4d9a05760 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -121,13 +121,6 @@ typedef struct AcpiMiscInfo {
unsigned dsdt_size;
} AcpiMiscInfo;
-typedef struct AcpiBuildPciBusHotplugState {
- GArray *device_table;
- GArray *notify_table;
- struct AcpiBuildPciBusHotplugState *parent;
- bool pcihp_bridge_en;
-} AcpiBuildPciBusHotplugState;
-
typedef struct FwCfgTPMConfig {
uint32_t tpmppi_address;
uint8_t tpm_version;
--
2.38.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] hw/i386/acpi-build: Resolve redundant attribute
2022-10-26 13:31 [PATCH 0/4] Cleanup AML generation for north and south bridges Bernhard Beschow
2022-10-26 13:31 ` [PATCH 1/4] hw/i386/acpi-build: Remove unused struct Bernhard Beschow
@ 2022-10-26 13:31 ` Bernhard Beschow
2022-10-27 21:53 ` Philippe Mathieu-Daudé
2022-10-26 13:31 ` [PATCH 3/4] hw/i386/acpi-build: Resolve PIIX ISA bridge rather than ACPI controller Bernhard Beschow
2022-10-26 13:31 ` [PATCH 4/4] hw/i386/acpi-build: Generate AML for north and south bridges separately Bernhard Beschow
3 siblings, 1 reply; 9+ messages in thread
From: Bernhard Beschow @ 2022-10-26 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-trivial, Ani Sinha,
Igor Mammedov, Richard Henderson, Eduardo Habkost, Paolo Bonzini,
Bernhard Beschow
The is_piix4 attribute is set once in one location and read once in
another. Doing both in one location allows for removing the attribute
altogether.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/i386/acpi-build.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index b4d9a05760..f3131fee60 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -112,7 +112,6 @@ typedef struct AcpiPmInfo {
} AcpiPmInfo;
typedef struct AcpiMiscInfo {
- bool is_piix4;
bool has_hpet;
#ifdef CONFIG_TPM
TPMVersion tpm_version;
@@ -281,17 +280,6 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)
static void acpi_get_misc_info(AcpiMiscInfo *info)
{
- Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM);
- Object *lpc = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
- assert(!!piix != !!lpc);
-
- if (piix) {
- info->is_piix4 = true;
- }
- if (lpc) {
- info->is_piix4 = false;
- }
-
info->has_hpet = hpet_find();
#ifdef CONFIG_TPM
info->tpm_version = tpm_get_version(tpm_find());
@@ -1449,6 +1437,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
AcpiPmInfo *pm, AcpiMiscInfo *misc,
Range *pci_hole, Range *pci_hole64, MachineState *machine)
{
+ Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM);
+ Object *ich9 = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
CrsRangeEntry *entry;
Aml *dsdt, *sb_scope, *scope, *dev, *method, *field, *pkg, *crs;
CrsRangeSet crs_range_set;
@@ -1469,11 +1459,13 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
AcpiTable table = { .sig = "DSDT", .rev = 1, .oem_id = x86ms->oem_id,
.oem_table_id = x86ms->oem_table_id };
+ assert(!!piix != !!ich9);
+
acpi_table_begin(&table, table_data);
dsdt = init_aml_allocator();
build_dbg_aml(dsdt);
- if (misc->is_piix4) {
+ if (piix) {
sb_scope = aml_scope("_SB");
dev = aml_device("PCI0");
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
@@ -1487,7 +1479,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
}
build_piix4_pci0_int(dsdt);
- } else {
+ } else if (ich9) {
sb_scope = aml_scope("_SB");
dev = aml_device("PCI0");
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
--
2.38.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] hw/i386/acpi-build: Resolve PIIX ISA bridge rather than ACPI controller
2022-10-26 13:31 [PATCH 0/4] Cleanup AML generation for north and south bridges Bernhard Beschow
2022-10-26 13:31 ` [PATCH 1/4] hw/i386/acpi-build: Remove unused struct Bernhard Beschow
2022-10-26 13:31 ` [PATCH 2/4] hw/i386/acpi-build: Resolve redundant attribute Bernhard Beschow
@ 2022-10-26 13:31 ` Bernhard Beschow
2022-10-27 21:56 ` Philippe Mathieu-Daudé
2022-10-26 13:31 ` [PATCH 4/4] hw/i386/acpi-build: Generate AML for north and south bridges separately Bernhard Beschow
3 siblings, 1 reply; 9+ messages in thread
From: Bernhard Beschow @ 2022-10-26 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-trivial, Ani Sinha,
Igor Mammedov, Richard Henderson, Eduardo Habkost, Paolo Bonzini,
Bernhard Beschow
Resolving the PIIX ISA bridge rather than the PIIX ACPI controller mirrors
the ICH9 code one line below.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/i386/acpi-build.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f3131fee60..f0a20c8b21 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1437,7 +1437,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
AcpiPmInfo *pm, AcpiMiscInfo *misc,
Range *pci_hole, Range *pci_hole64, MachineState *machine)
{
- Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM);
+ Object *piix = object_resolve_type_unambiguous(TYPE_PIIX3_PCI_DEVICE);
Object *ich9 = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
CrsRangeEntry *entry;
Aml *dsdt, *sb_scope, *scope, *dev, *method, *field, *pkg, *crs;
--
2.38.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] hw/i386/acpi-build: Generate AML for north and south bridges separately
2022-10-26 13:31 [PATCH 0/4] Cleanup AML generation for north and south bridges Bernhard Beschow
` (2 preceding siblings ...)
2022-10-26 13:31 ` [PATCH 3/4] hw/i386/acpi-build: Resolve PIIX ISA bridge rather than ACPI controller Bernhard Beschow
@ 2022-10-26 13:31 ` Bernhard Beschow
2022-10-27 21:56 ` Philippe Mathieu-Daudé
3 siblings, 1 reply; 9+ messages in thread
From: Bernhard Beschow @ 2022-10-26 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-trivial, Ani Sinha,
Igor Mammedov, Richard Henderson, Eduardo Habkost, Paolo Bonzini,
Bernhard Beschow
The code currently assumes Q35 iff ICH9 and i440fx iff PIIX. This is
slightly confusing when trying to understand the code. Split north and
south bridge code to communicate which piece of code assumes which type
of bridge.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/i386/acpi-build.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f0a20c8b21..8fbe223d08 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -60,6 +60,7 @@
#include "hw/i386/fw_cfg.h"
#include "hw/i386/ich9.h"
#include "hw/pci/pci_bus.h"
+#include "hw/pci-host/i440fx.h"
#include "hw/pci-host/q35.h"
#include "hw/i386/x86-iommu.h"
@@ -1437,6 +1438,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
AcpiPmInfo *pm, AcpiMiscInfo *misc,
Range *pci_hole, Range *pci_hole64, MachineState *machine)
{
+ Object *i440fx = object_resolve_type_unambiguous(TYPE_I440FX_PCI_HOST_BRIDGE);
+ Object *q35 = object_resolve_type_unambiguous(TYPE_Q35_HOST_DEVICE);
Object *piix = object_resolve_type_unambiguous(TYPE_PIIX3_PCI_DEVICE);
Object *ich9 = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
CrsRangeEntry *entry;
@@ -1459,13 +1462,14 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
AcpiTable table = { .sig = "DSDT", .rev = 1, .oem_id = x86ms->oem_id,
.oem_table_id = x86ms->oem_table_id };
+ assert(!!i440fx != !!q35);
assert(!!piix != !!ich9);
acpi_table_begin(&table, table_data);
dsdt = init_aml_allocator();
build_dbg_aml(dsdt);
- if (piix) {
+ if (i440fx) {
sb_scope = aml_scope("_SB");
dev = aml_device("PCI0");
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
@@ -1473,13 +1477,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid)));
aml_append(sb_scope, dev);
aml_append(dsdt, sb_scope);
-
- build_piix4_isa_bridge(dsdt);
- if (pm->pcihp_bridge_en || pm->pcihp_root_en) {
- build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
- }
- build_piix4_pci0_int(dsdt);
- } else if (ich9) {
+ } else if (q35) {
sb_scope = aml_scope("_SB");
dev = aml_device("PCI0");
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
@@ -1518,7 +1516,15 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
}
aml_append(dsdt, sb_scope);
+ }
+ if (piix) {
+ build_piix4_isa_bridge(dsdt);
+ if (pm->pcihp_bridge_en || pm->pcihp_root_en) {
+ build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
+ }
+ build_piix4_pci0_int(dsdt);
+ } else if (ich9) {
build_q35_isa_bridge(dsdt);
if (pm->pcihp_bridge_en) {
build_x86_acpi_pci_hotplug(dsdt, pm->pcihp_io_base);
--
2.38.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] hw/i386/acpi-build: Remove unused struct
2022-10-26 13:31 ` [PATCH 1/4] hw/i386/acpi-build: Remove unused struct Bernhard Beschow
@ 2022-10-26 15:27 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-10-26 15:27 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel
Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-trivial, Ani Sinha,
Igor Mammedov, Richard Henderson, Eduardo Habkost, Paolo Bonzini
On 26/10/22 15:31, Bernhard Beschow wrote:
> Ammends commit b23046abe78f48498a423b802d6d86ba0172d57f 'pc: acpi-build:
> simplify PCI bus tree generation'.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/i386/acpi-build.c | 7 -------
> 1 file changed, 7 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] hw/i386/acpi-build: Resolve redundant attribute
2022-10-26 13:31 ` [PATCH 2/4] hw/i386/acpi-build: Resolve redundant attribute Bernhard Beschow
@ 2022-10-27 21:53 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-10-27 21:53 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel
Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-trivial, Ani Sinha,
Igor Mammedov, Richard Henderson, Eduardo Habkost, Paolo Bonzini
On 26/10/22 15:31, Bernhard Beschow wrote:
> The is_piix4 attribute is set once in one location and read once in
> another. Doing both in one location allows for removing the attribute
> altogether.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/i386/acpi-build.c | 20 ++++++--------------
> 1 file changed, 6 insertions(+), 14 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] hw/i386/acpi-build: Generate AML for north and south bridges separately
2022-10-26 13:31 ` [PATCH 4/4] hw/i386/acpi-build: Generate AML for north and south bridges separately Bernhard Beschow
@ 2022-10-27 21:56 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-10-27 21:56 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel
Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-trivial, Ani Sinha,
Igor Mammedov, Richard Henderson, Eduardo Habkost, Paolo Bonzini
On 26/10/22 15:31, Bernhard Beschow wrote:
> The code currently assumes Q35 iff ICH9 and i440fx iff PIIX. This is
> slightly confusing when trying to understand the code. Split north and
> south bridge code to communicate which piece of code assumes which type
> of bridge.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/i386/acpi-build.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] hw/i386/acpi-build: Resolve PIIX ISA bridge rather than ACPI controller
2022-10-26 13:31 ` [PATCH 3/4] hw/i386/acpi-build: Resolve PIIX ISA bridge rather than ACPI controller Bernhard Beschow
@ 2022-10-27 21:56 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-10-27 21:56 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel
Cc: Michael S. Tsirkin, Marcel Apfelbaum, qemu-trivial, Ani Sinha,
Igor Mammedov, Richard Henderson, Eduardo Habkost, Paolo Bonzini
On 26/10/22 15:31, Bernhard Beschow wrote:
> Resolving the PIIX ISA bridge rather than the PIIX ACPI controller mirrors
> the ICH9 code one line below.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/i386/acpi-build.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-10-27 22:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-26 13:31 [PATCH 0/4] Cleanup AML generation for north and south bridges Bernhard Beschow
2022-10-26 13:31 ` [PATCH 1/4] hw/i386/acpi-build: Remove unused struct Bernhard Beschow
2022-10-26 15:27 ` Philippe Mathieu-Daudé
2022-10-26 13:31 ` [PATCH 2/4] hw/i386/acpi-build: Resolve redundant attribute Bernhard Beschow
2022-10-27 21:53 ` Philippe Mathieu-Daudé
2022-10-26 13:31 ` [PATCH 3/4] hw/i386/acpi-build: Resolve PIIX ISA bridge rather than ACPI controller Bernhard Beschow
2022-10-27 21:56 ` Philippe Mathieu-Daudé
2022-10-26 13:31 ` [PATCH 4/4] hw/i386/acpi-build: Generate AML for north and south bridges separately Bernhard Beschow
2022-10-27 21:56 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).