All of lore.kernel.org
 help / color / mirror / Atom feed
From: Beth Kon <eak@us.ibm.com>
To: avi@redhat.com
Cc: kvm@vger.kernel.org, Beth Kon <eak@us.ibm.com>
Subject: [PATCH 1/2] Clean up MADT Table Creation (v2)
Date: Tue,  9 Jun 2009 11:55:22 -0400	[thread overview]
Message-ID: <1244562923-4336-1-git-send-email-eak@us.ibm.com> (raw)

This patch is based on the recent patch from Vincent Minet. I split Vincent's
changes into 2 patches (to separate MADT and RSDT table cleanup, as suggested by
Marcelo) and added a bit to them.

There has been much ado over the acpi_bios_init function recently. I had actually 
done a rewrite very similar to Gleb's, but Avi argued that the rewrite has to be 
more incremental. This patch contains minimal changes without any rewrite because 
the changes are kvm-only. The rewrite would better be a separate step, submitted to 
qemu and then merged into kvm.  

I am submitting the RSDT fix to kvm because the kvm and qemu RSDT implementation differs.
Again, as a separate rewrite effort, the kvm and qemu RSDT manipulation could be merged 
into one base as a later, separate step.

This patch will get MADT into reasonable enough shape for me to resubmit hpet patches
on top of it. After that, I'd be willing to submit incremental rewrite patches for 
acpi_bios_init to qemu, starting with MADT and RSDT.  

Signed-off-by: Beth Kon <eak@us.ibm.com>

diff --git a/kvm/bios/rombios32.c b/kvm/bios/rombios32.c
index 369cbef..cdae363 100755
--- a/kvm/bios/rombios32.c
+++ b/kvm/bios/rombios32.c
@@ -86,6 +86,8 @@ typedef unsigned long long uint64_t;
 #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
 #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
 
+#define MAX_INT_OVERRIDES 16
+
 static inline void outl(int addr, int val)
 {
     asm volatile ("outl %1, %w0" : : "d" (addr), "a" (val));
@@ -1600,7 +1602,7 @@ void acpi_bios_init(void)
     uint32_t hpet_addr;
 #endif
     uint32_t base_addr, rsdt_addr, fadt_addr, addr, facs_addr, dsdt_addr, ssdt_addr;
-    uint32_t acpi_tables_size, madt_addr, madt_size, rsdt_size;
+    uint32_t acpi_tables_size, madt_addr, madt_size, rsdt_size, madt_end;
     uint32_t srat_addr,srat_size;
     uint16_t i, external_tables;
     int nb_numa_nodes;
@@ -1668,7 +1670,7 @@ void acpi_bios_init(void)
     madt_size = sizeof(*madt) +
         sizeof(struct madt_processor_apic) * MAX_CPUS +
 #ifdef BX_QEMU
-        sizeof(struct madt_io_apic) /* + sizeof(struct madt_int_override) */;
+        sizeof(struct madt_io_apic)  + sizeof(struct madt_int_override) * MAX_INT_OVERRIDES;
 #else
         sizeof(struct madt_io_apic);
 #endif
@@ -1786,8 +1788,9 @@ void acpi_bios_init(void)
                 continue;
             }
             int_override++;
-            madt_size += sizeof(struct madt_int_override);
         }
+        madt_end = (uint32_t)int_override;
+        madt_size = madt_end - madt_addr;
         acpi_build_table_header((struct acpi_table_header *)madt,
                                 "APIC", madt_size, 1);
     }

             reply	other threads:[~2009-06-09 15:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 15:55 Beth Kon [this message]
2009-06-09 15:55 ` [PATCH 2/2] Clean up RSDT Table Creation (v2) Beth Kon
2009-06-10 12:29 ` [PATCH 1/2] Clean up MADT " Avi Kivity

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=1244562923-4336-1-git-send-email-eak@us.ibm.com \
    --to=eak@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.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.