From: "Michael S. Tsirkin" <mst@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, marcel.a@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] pc: acpi-build: make linker & RSDP tables dynamic
Date: Wed, 10 Dec 2014 19:13:59 +0200 [thread overview]
Message-ID: <20141210171359.GA3301@redhat.com> (raw)
In-Reply-To: <20141210174558.4097ae85@nial.usersys.redhat.com>
On Wed, Dec 10, 2014 at 05:45:58PM +0100, Igor Mammedov wrote:
> On Wed, 10 Dec 2014 18:24:24 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > On Wed, Dec 10, 2014 at 04:06:56PM +0000, Igor Mammedov wrote:
> > > linker and RSDP tables are build only once, so if later
> > > during rebuild sizes of other ACPI tables change
> > > pointers will be patched incorrectly due to wrong
> > > offsets.
> > >
> > > To fix it rebuild linker and RSDP tables along with
> > > the rest of ACPI tables so that they would have correct
> > > offsets.
> > >
> > > Here is a simple reproducer:
> > > 1: hotplug bridge using command:
> > > device_add pci-bridge,chassis_nr=1
> > > 2: reset system from monitor:
> > > system_reset
> > >
> > > As result pointers to ACPI tables are not correct
> > > and guest can't read/parse ACPI tables.
> > > Windows guests just refuse to boot and
> > > Linux guests are more resilient and try to boot without
> > > ACPI, sometimes successfully.
> > >
> > > PS:
> > > keep brokenness in 2.2 and older machine types for the sake
> > > of migration
> > >
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> >
> > I'd like to fix 2.2 as well.
> that's easy,
> has_imutable_rsdp = true
> should be moved into
> pc_compat_2_1()
>
> >
> > Why does adding bridge in this way cause tables to
> > be resized?
> > I think this is a root-cause that should be fixed.
> That's because there wasn't any bridge described in tables
> on startup, but after hotplug and reset tables are rebuild
> which pickups hotplugged bridge and its secondary PCI bus.
>
> This behavior seems sane, I'd expect bare-metal behave
> the same way.
For a simple fix, we can skip bridges added by hotplug -
treat them as regular devices.
It defintely seems nicer - at least for old machine types -
than "keep brokenness".
I think the following should do the trcik, but it's completely
untested.
Could you pls try?
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index b37a397..039776d 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -844,7 +844,8 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
* Skip bridge subtree creation if bridge hotplug is disabled
* to make acpi tables compatible with legacy machine types.
*/
- if (!child->pcihp_bridge_en && bus->parent_dev) {
+ if (bus->parent_dev && (!child->pcihp_bridge_en ||
+ !DEVICE(bus->parent_dev)->hotplugged)) {
return;
}
next prev parent reply other threads:[~2014-12-10 17:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 16:06 [Qemu-devel] [PATCH 0/2] pc: fix ACPI tables corruption after bridge hotplug Igor Mammedov
2014-12-10 16:06 ` [Qemu-devel] [PATCH 1/2] pc: Add pc-[i440fx|q35]-2.3 machine type and pc_compat_2_2() function Igor Mammedov
2014-12-10 16:06 ` [Qemu-devel] [PATCH 2/2] pc: acpi-build: make linker & RSDP tables dynamic Igor Mammedov
2014-12-10 16:24 ` Michael S. Tsirkin
2014-12-10 16:45 ` Igor Mammedov
2014-12-10 17:13 ` Michael S. Tsirkin [this message]
2014-12-10 17:39 ` Igor Mammedov
2014-12-10 18:28 ` Michael S. Tsirkin
2014-12-10 19:43 ` Igor Mammedov
2014-12-10 20:18 ` Michael S. Tsirkin
2014-12-11 8:36 ` 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=20141210171359.GA3301@redhat.com \
--to=mst@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel.a@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 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.