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 <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>
This commit is contained in:
Cyrill Gorcunov
2011-05-18 23:40:51 +04:00
committed by Will Deacon
parent 32fccd4f7b
commit c13efdd600
+3 -2
View 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;