diff mbox

[2/2] powerpc: Enable 32-bit build

Message ID 1434698461-15539-2-git-send-email-mpe@ellerman.id.au
State Not Applicable, archived
Headers show

Commit Message

Michael Ellerman June 19, 2015, 7:21 a.m. UTC
We have always built kvmtool as 64-bit on powerpc, but mainly just out
of habit. There's not AFAIK any reason we *can't* build 32-bit.

So fix up a few places where we were assuming 64-bit, and drop the
Makefile logic that forces 64-bit.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 Makefile                           |  2 --
 powerpc/include/kvm/kvm-cpu-arch.h | 36 ++++++++++++++++++------------------
 powerpc/kvm-cpu.c                  |  2 +-
 powerpc/kvm.c                      |  4 ++--
 4 files changed, 21 insertions(+), 23 deletions(-)
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 6110b8e11611..151fa9de07cb 100644
--- a/Makefile
+++ b/Makefile
@@ -148,8 +148,6 @@  ifeq ($(ARCH), powerpc)
 	OBJS	+= powerpc/spapr_pci.o
 	OBJS	+= powerpc/xics.o
 	ARCH_INCLUDE := powerpc/include
-	CFLAGS 	+= -m64
-	LDFLAGS += -m elf64ppc
 
 	ARCH_WANT_LIBFDT := y
 endif
diff --git a/powerpc/include/kvm/kvm-cpu-arch.h b/powerpc/include/kvm/kvm-cpu-arch.h
index e256f5d0733e..01eafdf09785 100644
--- a/powerpc/include/kvm/kvm-cpu-arch.h
+++ b/powerpc/include/kvm/kvm-cpu-arch.h
@@ -17,24 +17,24 @@ 
 #include <stdbool.h>
 #include <pthread.h>
 
-#define MSR_SF		(1UL<<63)
-#define MSR_HV		(1UL<<60)
-#define MSR_VEC		(1UL<<25)
-#define MSR_VSX		(1UL<<23)
-#define MSR_POW		(1UL<<18)
-#define MSR_EE		(1UL<<15)
-#define MSR_PR		(1UL<<14)
-#define MSR_FP		(1UL<<13)
-#define MSR_ME		(1UL<<12)
-#define MSR_FE0		(1UL<<11)
-#define MSR_SE		(1UL<<10)
-#define MSR_BE		(1UL<<9)
-#define MSR_FE1		(1UL<<8)
-#define MSR_IR		(1UL<<5)
-#define MSR_DR		(1UL<<4)
-#define MSR_PMM		(1UL<<2)
-#define MSR_RI		(1UL<<1)
-#define MSR_LE		(1UL<<0)
+#define MSR_SF		(1ULL<<63)
+#define MSR_HV		(1ULL<<60)
+#define MSR_VEC		(1ULL<<25)
+#define MSR_VSX		(1ULL<<23)
+#define MSR_POW		(1ULL<<18)
+#define MSR_EE		(1ULL<<15)
+#define MSR_PR		(1ULL<<14)
+#define MSR_FP		(1ULL<<13)
+#define MSR_ME		(1ULL<<12)
+#define MSR_FE0		(1ULL<<11)
+#define MSR_SE		(1ULL<<10)
+#define MSR_BE		(1ULL<<9)
+#define MSR_FE1		(1ULL<<8)
+#define MSR_IR		(1ULL<<5)
+#define MSR_DR		(1ULL<<4)
+#define MSR_PMM		(1ULL<<2)
+#define MSR_RI		(1ULL<<1)
+#define MSR_LE		(1ULL<<0)
 
 #define POWER7_EXT_IRQ	0
 
diff --git a/powerpc/kvm-cpu.c b/powerpc/kvm-cpu.c
index 2f5cfc691f42..461e0a907f6d 100644
--- a/powerpc/kvm-cpu.c
+++ b/powerpc/kvm-cpu.c
@@ -147,7 +147,7 @@  static void kvm_cpu__setup_sregs(struct kvm_cpu *vcpu)
 
 	reg.id = KVM_REG_PPC_HIOR;
 	value = 0;
-	reg.addr = (u64)&value;
+	reg.addr = (u64)(unsigned long)&value;
 	if (ioctl(vcpu->vcpu_fd, KVM_SET_ONE_REG, &reg) < 0)
 		die("KVM_SET_ONE_REG failed");
 }
diff --git a/powerpc/kvm.c b/powerpc/kvm.c
index 2b03a1213159..b4c331068374 100644
--- a/powerpc/kvm.c
+++ b/powerpc/kvm.c
@@ -172,7 +172,7 @@  int load_flat_binary(struct kvm *kvm, int fd_kernel, int fd_initrd, const char *
 	while ((nr = read(fd_kernel, p, 65536)) > 0)
 		p += nr;
 
-	pr_info("Loaded kernel to 0x%x (%ld bytes)", KERNEL_LOAD_ADDR, p-k_start);
+	pr_info("Loaded kernel to 0x%x (%ld bytes)", KERNEL_LOAD_ADDR, (long)(p-k_start));
 
 	if (fd_initrd != -1) {
 		if (lseek(fd_initrd, 0, SEEK_SET) < 0)
@@ -192,7 +192,7 @@  int load_flat_binary(struct kvm *kvm, int fd_kernel, int fd_initrd, const char *
 			die("initrd too big to contain in guest RAM.\n");
 
 		pr_info("Loaded initrd to 0x%x (%ld bytes)",
-			INITRD_LOAD_ADDR, p-i_start);
+			INITRD_LOAD_ADDR, (long)(p-i_start));
 		kvm->arch.initrd_gra = INITRD_LOAD_ADDR;
 		kvm->arch.initrd_size = p-i_start;
 	} else {