[tip:tools/kvm] kvm tools: Fix alignment for mpf_intel table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  230b9bc57c8085d228fbd217373821f59ff38585
Gitweb:     http://git.kernel.org/tip/230b9bc57c8085d228fbd217373821f59ff38585
Author:     Cyrill Gorcunov <gorcunov@xxxxxxxxx>
AuthorDate: Wed, 18 May 2011 23:40:51 +0400
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Thu, 19 May 2011 22:11:20 +0300

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@xxxxxxxxxxxxxxxxxxxxxx>
Reported-by: Asias He <asias.hejun@xxxxxxxxx>
Tested-by: Thomas Heil <heil@xxxxxxxxxxxxxxxxxxxxxx>
Tested-by: Asias He <asias.hejun@xxxxxxxxx>
Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/mptable.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/kvm/mptable.c b/tools/kvm/mptable.c
index 7a705c6a..cfc7d79 100644
--- a/tools/kvm/mptable.c
+++ b/tools/kvm/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;
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux