From: Igor Mammedov <imammedo@redhat.com>
To: Marcel Apfelbaum <marcel@redhat.com>
Cc: qemu-devel@nongnu.org, marcandre.lureau@redhat.com,
"Michael S. Tsirkin" <mst@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] pc: pcihp: avoid adding ACPI_PCIHP_PROP_BSEL twice
Date: Wed, 3 Aug 2016 10:47:21 +0200 [thread overview]
Message-ID: <20160803104721.2e6d453c@nial.brq.redhat.com> (raw)
In-Reply-To: <49831bf2-565c-88ef-9ab2-ce6bf7974ac7@redhat.com>
On Wed, 3 Aug 2016 11:17:11 +0300
Marcel Apfelbaum <marcel@redhat.com> wrote:
> On 08/03/2016 11:04 AM, Igor Mammedov wrote:
> > PCI hotplug for bridges was introduced only since 2.0 however
> > acpi_set_bsel()->object_property_add_uint32_ptr(bus, ACPI_PCIHP_PROP_BSEL)
> > didn't take in account that for legacy mode (1.7) when
> > PCI hotplug for bridges is unavailable and ACPI_PCIHP_PROP_BSEL property
> > the only bus "PCI.0' has been created earlier at acpi_pcihp_init() time.
> >
> > We managed to live with it only because of error rised by adding
> > a duplicate property in acpi_set_bsel() has been ignored which
> > resulted in useless leaking of just allocated (int)bus_bsel.
> >
> > Issue affects only 1.7 machine type as ACPI tables supported by
> > QEMU were introduced at that time, but there wasn't PCI hotplug
> > for bridges till the next release (2.0).
> >
> > Fix it by removing duplicate ACPI_PCIHP_PROP_BSEL intialization
> > in acpi_pcihp_init() and doing it only in one place acpi_set_pci_info().
> >
> > PS:
> > do not ignore error returned by object_property_add_uint32_ptr()
> > and abort QEMU since it's programming error which should be fixed
> > instead of being ignored.
> >
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> > hw/acpi/pcihp.c | 10 ----------
> > hw/i386/acpi-build.c | 4 ++--
> > 2 files changed, 2 insertions(+), 12 deletions(-)
> >
> > diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
> > index d957d1e..3298d94 100644
> > --- a/hw/acpi/pcihp.c
> > +++ b/hw/acpi/pcihp.c
> > @@ -302,16 +302,6 @@ void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus,
> > s->root= root_bus;
> > s->legacy_piix = !bridges_enabled;
> >
> > - if (s->legacy_piix) {
> > - unsigned *bus_bsel = g_malloc(sizeof *bus_bsel);
> > -
> > - s->io_len = ACPI_PCIHP_LEGACY_SIZE;
> > -
> > - *bus_bsel = ACPI_PCIHP_BSEL_DEFAULT;
> > - object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL,
> > - bus_bsel, NULL);
> > - }
> > -
> > memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s,
> > "acpi-pci-hotplug", s->io_len);
> > memory_region_add_subregion(address_space_io, s->io_base, &s->io);
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index a26a4bb..7174933 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -438,7 +438,7 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque)
> >
> > *bus_bsel = (*bsel_alloc)++;
> > object_property_add_uint32_ptr(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,
> > - bus_bsel, NULL);
> > + bus_bsel, &error_abort);
>
> Hi Igor,
>
> I think the above hunk should be in a separate patch, but
> since the patch itself is small enough I am OK with it.
I've been conflicted whether to split or not but decided not to
as it exposes issue that the patch fixes and splitting could lead
to bisection issues in case this part comes first.
>
>
> > }
> >
> > return bsel_alloc;
> > @@ -447,7 +447,7 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque)
> > static void acpi_set_pci_info(void)
> > {
> > PCIBus *bus = find_i440fx(); /* TODO: Q35 support */
> > - unsigned bsel_alloc = 0;
> > + unsigned bsel_alloc = ACPI_PCIHP_BSEL_DEFAULT;
> >
> > if (bus) {
> > /* Scan all PCI buses. Set property to enable acpi based hotplug. */
> >
>
>
>
> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Thanks!
>
> Thanks,
> Marcel
next prev parent reply other threads:[~2016-08-03 8:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-03 8:04 [Qemu-devel] [PATCH] pc: pcihp: avoid adding ACPI_PCIHP_PROP_BSEL twice Igor Mammedov
2016-08-03 8:17 ` Marcel Apfelbaum
2016-08-03 8:47 ` Igor Mammedov [this message]
2016-08-03 12:06 ` Marc-André Lureau
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=20160803104721.2e6d453c@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).