From: "Michael S. Tsirkin" <mst@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: "Bernhard Beschow" <shentey@gmail.com>,
qemu-devel@nongnu.org,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
qemu-trivial@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Ani Sinha" <ani@anisinha.ca>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v2 2/3] hw/i386/acpi-build: Resolve redundant attribute
Date: Mon, 31 Oct 2022 13:41:59 -0400 [thread overview]
Message-ID: <20221031134045-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20221031134529.5f7250ce@fedora>
On Mon, Oct 31, 2022 at 01:45:29PM +0100, Igor Mammedov wrote:
> On Fri, 28 Oct 2022 12:34:18 +0200
> Bernhard Beschow <shentey@gmail.com> 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.
>
> we also test for piix4 in acpi_get_pm_info(),
> Perhaps we should move is_piix4 to AcpiPmInfo
> and reuse it in build_dsdt()?
> Also should use is_piix4 as argument to build_iqcr_method()
> to make its call places self documenting. But that's another patch.
Well I picked this up for pull req since i had to make
a decision before freeze. But sure, a cleanup like
this might even be acceptable before rc1 I think.
Bernhard?
>
> > Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > Message-Id: <20221026133110.91828-3-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 1ebf14b899..73d8a59737 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;
> > - }
>
> ack for this hunk
>
> > info->has_hpet = hpet_find();
> > #ifdef CONFIG_TPM
> > info->tpm_version = tpm_get_version(tpm_find());
> > @@ -1334,6 +1322,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 *lpc = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE);
> > CrsRangeEntry *entry;
> > Aml *dsdt, *sb_scope, *scope, *dev, *method, *field, *pkg, *crs;
> > CrsRangeSet crs_range_set;
> > @@ -1354,11 +1344,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 != !!lpc);
> > +
> > 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")));
> > @@ -1371,7 +1363,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 (lpc) {
> > sb_scope = aml_scope("_SB");
> > dev = aml_device("PCI0");
> > aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
next prev parent reply other threads:[~2022-10-31 17:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 10:34 [PATCH v2 0/3] hw/i386: Cleanup AML generation for north and south bridges Bernhard Beschow
2022-10-28 10:34 ` [PATCH v2 1/3] hw/i386/acpi-build: Remove unused struct Bernhard Beschow
2022-10-31 12:32 ` Igor Mammedov
2022-10-28 10:34 ` [PATCH v2 2/3] hw/i386/acpi-build: Resolve redundant attribute Bernhard Beschow
2022-10-31 12:45 ` Igor Mammedov
2022-10-31 17:41 ` Michael S. Tsirkin [this message]
2022-10-31 23:43 ` Bernhard Beschow
2022-10-28 10:34 ` [PATCH v2 3/3] hw/i386/acpi-build: Resolve north rather than south bridges Bernhard Beschow
2022-10-28 10:58 ` Ani Sinha
2022-10-28 16:15 ` B
2022-10-28 16:48 ` Ani Sinha
2022-10-29 8:38 ` Michael S. Tsirkin
2022-10-30 15:45 ` Ani Sinha
2022-10-30 16:12 ` Michael S. Tsirkin
2022-10-30 16:18 ` Ani Sinha
2022-10-30 16:30 ` Michael S. Tsirkin
2022-10-31 3:57 ` Ani Sinha
2022-10-31 12:52 ` Igor Mammedov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221031134045-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=ani@anisinha.ca \
--cc=eduardo@habkost.net \
--cc=imammedo@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).