From c13efdd600cfd6401fc27adb0c90cdf26df2849a Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Wed, 18 May 2011 23:40:51 +0400 Subject: [PATCH] kvm tools: Fix alignment for mpf_intel table 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 Reported-by: Asias He Tested-by: Thomas Heil Tested-by: Asias He Signed-off-by: Cyrill Gorcunov Signed-off-by: Pekka Enberg --- mptable.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mptable.c b/mptable.c index 7a705c6..cfc7d79 100644 --- a/mptable.c +++ b/mptable.c @@ -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;