qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PULL 7/7] acpi: Use apic_id_limit when calculating legacy ACPI table size
Date: Fri, 18 Nov 2016 17:54:04 +0200	[thread overview]
Message-ID: <1479484366-7977-8-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1479484366-7977-1-git-send-email-mst@redhat.com>

From: Eduardo Habkost <ehabkost@redhat.com>

The code that calculates the legacy ACPI table size for migration
compatibility uses max_cpus when calculating legacy_aml_len (the size of
the DSDT and SSDT tables). However, the SSDT grows according to APIC ID
limit, not max_cpus.

The bug is not triggered very often because of the 4k alignment on the
table size. But it can be triggered if you are unlucky enough to cross a
4k boundary.

Change the legacy_aml_len calculation to use apic_id_limit, to calculate
the right size.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.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 a155857..45a2ccf 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2860,7 +2860,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
          */
         int legacy_aml_len =
             pcmc->legacy_acpi_table_size +
-            ACPI_BUILD_LEGACY_CPU_AML_SIZE * max_cpus;
+            ACPI_BUILD_LEGACY_CPU_AML_SIZE * pcms->apic_id_limit;
         int legacy_table_size =
             ROUND_UP(tables_blob->len - aml_len + legacy_aml_len,
                      ACPI_BUILD_ALIGN_SIZE);
-- 
MST

  parent reply	other threads:[~2016-11-18 15:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18 15:53 [Qemu-devel] [PULL 0/7] virtio, vhost, pc: fixes Michael S. Tsirkin
2016-11-18 15:53 ` [Qemu-devel] [PULL 1/7] virtio-crypto: fix virtio_queue_set_notification() race Michael S. Tsirkin
2016-11-18 15:53 ` [Qemu-devel] [PULL 2/7] virtio: introduce grab/release_ioeventfd to fix vhost Michael S. Tsirkin
2016-11-18 15:53 ` [Qemu-devel] [PULL 3/7] virtio: access ISR atomically Michael S. Tsirkin
2016-11-18 15:53 ` [Qemu-devel] [PULL 4/7] virtio: set ISR on dataplane notifications Michael S. Tsirkin
2016-11-18 15:53 ` [Qemu-devel] [PULL 5/7] ivshmem: Fix 64 bit memory bar configuration Michael S. Tsirkin
2016-11-18 15:53 ` [Qemu-devel] [PULL 6/7] ipmi: fix qemu crash while migrating with ipmi Michael S. Tsirkin
2016-11-18 15:54 ` Michael S. Tsirkin [this message]
2016-11-21 11:10 ` [Qemu-devel] [PULL 0/7] virtio, vhost, pc: fixes Stefan Hajnoczi

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=1479484366-7977-8-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).