All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: will.deacon@arm.com
Cc: andre.przywara@arm.com, <kvm@vger.kernel.org>,
	<kvm-ppc@vger.kernel.org>,
	svaidy@linux.vnet.ibm.com, <matt@ozlabs.org>
Subject: [PATCH 2/2] powerpc: Enable 32-bit build
Date: Fri, 19 Jun 2015 17:21:01 +1000	[thread overview]
Message-ID: <1434698461-15539-2-git-send-email-mpe@ellerman.id.au> (raw)
In-Reply-To: <1434698461-15539-1-git-send-email-mpe@ellerman.id.au>

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 --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 {
-- 
2.1.0


WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: will.deacon@arm.com
Cc: andre.przywara@arm.com, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org, svaidy@linux.vnet.ibm.com,
	matt@ozlabs.org
Subject: [PATCH 2/2] powerpc: Enable 32-bit build
Date: Fri, 19 Jun 2015 07:21:01 +0000	[thread overview]
Message-ID: <1434698461-15539-2-git-send-email-mpe@ellerman.id.au> (raw)
In-Reply-To: <1434698461-15539-1-git-send-email-mpe@ellerman.id.au>

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 --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 {
-- 
2.1.0


  reply	other threads:[~2015-06-19  7:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19  7:21 [PATCH 1/2] powerpc: Define the hcall opcodes & return values we need Michael Ellerman
2015-06-19  7:21 ` Michael Ellerman
2015-06-19  7:21 ` Michael Ellerman [this message]
2015-06-19  7:21   ` [PATCH 2/2] powerpc: Enable 32-bit build Michael Ellerman
2015-06-19  7:40 ` [PATCH 1/2] powerpc: Define the hcall opcodes & return values we need Michael Ellerman
2015-06-19  7:40   ` Michael Ellerman
2015-06-19 10:35 ` Will Deacon
2015-06-19 10:35   ` Will Deacon
2015-06-23  9:33 ` Paolo Bonzini
2015-06-23  9:33   ` Paolo Bonzini
2015-06-23 10:05   ` Michael Ellerman
2015-06-23 10:05     ` Michael Ellerman
2015-06-23 10:31     ` Andre Przywara
2015-06-23 10:31       ` Andre Przywara
2015-06-23 10:33       ` Paolo Bonzini
2015-06-23 10:33         ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434698461-15539-2-git-send-email-mpe@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=andre.przywara@arm.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=matt@ozlabs.org \
    --cc=svaidy@linux.vnet.ibm.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.