]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Fix alignment for mpf_intel table
authorCyrill Gorcunov <gorcunov@gmail.com>
Wed, 18 May 2011 19:40:51 +0000 (23:40 +0400)
committerPekka Enberg <penberg@kernel.org>
Thu, 19 May 2011 19:11:20 +0000 (22:11 +0300)
Thomas and Asias reported that kernel doesn't find MP
tables on 32 bit host. This is because previously the
alignment was done on address obtained from calloc
missing the fact that MP tables are put into guest
memory *with* offset and MP signature should be
calculated keeping this offset in midn as well and
then aligned.

Reported-by: Thomas Heil <heil@terminal-consulting.de>
Reported-by: Asias He <asias.hejun@gmail.com>
Tested-by: Thomas Heil <heil@terminal-consulting.de>
Tested-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/mptable.c

index 7a705c6a9df4b8cef4bbd4561c9987cdf5bbdb1d..cfc7d7954ed314d116676f567382cce0d986d424 100644 (file)
@@ -81,7 +81,7 @@ static void mptable_add_irq_src(struct mpc_intsrc *mpc_intsrc,
  */
 void mptable_setup(struct kvm *kvm, unsigned int ncpus)
 {
-       unsigned long real_mpc_table, size;
+       unsigned long real_mpc_table, real_mpf_intel, size;
        struct mpf_intel *mpf_intel;
        struct mpc_table *mpc_table;
        struct mpc_cpu *mpc_cpu;
@@ -237,7 +237,8 @@ void mptable_setup(struct kvm *kvm, unsigned int ncpus)
        /*
         * Floating MP table finally.
         */
-       mpf_intel = (void *)ALIGN((unsigned long)last_addr, 16);
+       real_mpf_intel  = ALIGN((unsigned long)last_addr - (unsigned long)mpc_table, 16);
+       mpf_intel       = (void *)((unsigned long)mpc_table + real_mpf_intel);
 
        MPTABLE_STRNCPY(mpf_intel->signature, MPTABLE_SIG_FLOATING);
        mpf_intel->length       = 1;