Skip to contentSkip to conversation

avi patch queue 2011-12-25

GIT PULL New Alexander Graf 2 participants 14 messages Dec 25, 2011 – Jan 9, 2012

Subsystems (4)
lore
Share & tools
lore
#3 lore raw

PATCH 3/7 powerpc/kvm: annotate kvm_rma_init as __init

In reply to Alexander Graf

From: Nishanth Aravamudan <[email protected]>

kvm_rma_init() is only called at boot-time, by setup_arch, which is also __init.

---
 arch/powerpc/kvm/book3s_hv_builtin.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kvm/book3s_hv_builtin.c +1 -1
index 286f13d..a795a13 100644
@@ -86,7 +86,7 @@ static inline int lpcr_rmls(unsigned long rma_size)
  * to allocate contiguous physical memory for the real memory
  * areas for guests.
  */
-void kvm_rma_init(void)
+void __init kvm_rma_init(void)
 {
 	unsigned long i;
 	unsigned long j, npages;
Signature · 1 line
1.6.0.2
#0 lore raw

Hi Avi,

Here are a couple compile/trivial fixes for PPC KVM. Please make sure they all get to 3.2, worst case through -stable.

I left out all the other fine commits that would be great to have in upstream due to limited testing on my side still. But they definitely are not forgotten!

Alex

The following changes since commit 08a95a511af91a2a6c42f2a8f13b99402a39e84b:
Alex Williamson (1):
kvm: Device assignment permission checks

are available in the git repository at:

git://github.com/agraf/linux-2.6.git for-avi

Alexander Graf (2):
KVM: PPC: Whitespace fix for kvm.h
KVM: Fix whitespace in kvm_para.h

Andreas Schwab (2):
KVM: PPC: move compute_tlbie_rb to book3s_64 common header
KVM: PPC: protect use of kvmppc_h_pr

Michael Neuling (1):
powerpc kvm: fix kvmppc_start_thread() for CONFIG_SMP=N

Nishanth Aravamudan (1):
powerpc/kvm: annotate kvm_rma_init as __init

Scott Wood (1):
KVM: PPC: e500: include linux/export.h

 arch/powerpc/include/asm/kvm.h           |    4 +-
 arch/powerpc/include/asm/kvm_book3s.h    |   33 ------------------------------
 arch/powerpc/include/asm/kvm_book3s_64.h |   33 ++++++++++++++++++++++++++++++
 arch/powerpc/kvm/book3s_hv.c             |    2 +-
 arch/powerpc/kvm/book3s_hv_builtin.c     |    2 +-
 arch/powerpc/kvm/book3s_pr.c             |    2 +
 arch/powerpc/kvm/e500.c                  |    1 +
 include/linux/kvm_para.h                 |    1 -
 8 files changed, 40 insertions(+), 38 deletions(-)
#1 lore raw

PATCH 1/7 KVM: PPC: Whitespace fix for kvm.h

kvm.h had sparse whitespace at the end of the line. Clean it up so syncing with QEMU gets easier.

---
 arch/powerpc/include/asm/kvm.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/kvm.h +2 -2
index 0ad432b..f7727d9 100644
@@ -170,8 +170,8 @@ struct kvm_sregs {
 			} ppc64;
 			struct {
 				__u32 sr[16];
-				__u64 ibat[8]; 
-				__u64 dbat[8]; 
+				__u64 ibat[8];
+				__u64 dbat[8];
 			} ppc32;
 		} s;
 		struct {
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH 2/7 KVM: Fix whitespace in kvm_para.h

In reply to Alexander Graf

When syncing KVM headers with QEMU I (or whoever applies the diff) end up automatically fixing whitespaces. One of them is in kvm_para.h.

It's a lot more consistent for people who don't do the whitespace fixups automatically to already have fixed headers in Linux. So remove the sparse empty line at the end of kvm_para.h and everyone's happy.

---
 include/linux/kvm_para.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/kvm_para.h +0 -1
index 47a070b..ff476dd 100644
@@ -35,4 +35,3 @@ static inline int kvm_para_has_feature(unsigned int feature)
 }
 #endif /* __KERNEL__ */
 #endif /* __LINUX_KVM_PARA_H */
-
Signature · 1 line
1.6.0.2
#4 lore raw

PATCH 4/7 KVM: PPC: move compute_tlbie_rb to book3s_64 common header

In reply to Alexander Graf

From: Andreas Schwab <[email protected]>

compute_tlbie_rb is only used on ppc64 and cannot be compiled on ppc32.

---
 arch/powerpc/include/asm/kvm_book3s.h    |   33 ------------------------------
 arch/powerpc/include/asm/kvm_book3s_64.h |   33 ++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 33 deletions(-)
arch/powerpc/include/asm/kvm_book3s.h +0 -33
index d4df013..69c7377 100644
@@ -381,39 +381,6 @@ static inline bool kvmppc_critical_section(struct kvm_vcpu *vcpu)
 }
 #endif
 
-static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
-					     unsigned long pte_index)
-{
-	unsigned long rb, va_low;
-
-	rb = (v & ~0x7fUL) << 16;		/* AVA field */
-	va_low = pte_index >> 3;
-	if (v & HPTE_V_SECONDARY)
-		va_low = ~va_low;
-	/* xor vsid from AVA */
-	if (!(v & HPTE_V_1TB_SEG))
-		va_low ^= v >> 12;
-	else
-		va_low ^= v >> 24;
-	va_low &= 0x7ff;
-	if (v & HPTE_V_LARGE) {
-		rb |= 1;			/* L field */
-		if (cpu_has_feature(CPU_FTR_ARCH_206) &&
-		    (r & 0xff000)) {
-			/* non-16MB large page, must be 64k */
-			/* (masks depend on page size) */
-			rb |= 0x1000;		/* page encoding in LP field */
-			rb |= (va_low & 0x7f) << 16; /* 7b of VA in AVA/LP field */
-			rb |= (va_low & 0xfe);	/* AVAL field (P7 doesn't seem to care) */
-		}
-	} else {
-		/* 4kB page */
-		rb |= (va_low & 0x7ff) << 12;	/* remaining 11b of VA */
-	}
-	rb |= (v >> 54) & 0x300;		/* B field */
-	return rb;
-}
-
 /* Magic register values loaded into r3 and r4 before the 'sc' assembly
  * instruction for the OSI hypercalls */
 #define OSI_SC_MAGIC_R3			0x113724FA
arch/powerpc/include/asm/kvm_book3s_64.h +33 -0
index e43fe42..d0ac94f 100644
@@ -29,4 +29,37 @@ static inline struct kvmppc_book3s_shadow_vcpu *to_svcpu(struct kvm_vcpu *vcpu)
 
 #define SPAPR_TCE_SHIFT		12
 
+static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
+					     unsigned long pte_index)
+{
+	unsigned long rb, va_low;
+
+	rb = (v & ~0x7fUL) << 16;		/* AVA field */
+	va_low = pte_index >> 3;
+	if (v & HPTE_V_SECONDARY)
+		va_low = ~va_low;
+	/* xor vsid from AVA */
+	if (!(v & HPTE_V_1TB_SEG))
+		va_low ^= v >> 12;
+	else
+		va_low ^= v >> 24;
+	va_low &= 0x7ff;
+	if (v & HPTE_V_LARGE) {
+		rb |= 1;			/* L field */
+		if (cpu_has_feature(CPU_FTR_ARCH_206) &&
+		    (r & 0xff000)) {
+			/* non-16MB large page, must be 64k */
+			/* (masks depend on page size) */
+			rb |= 0x1000;		/* page encoding in LP field */
+			rb |= (va_low & 0x7f) << 16; /* 7b of VA in AVA/LP field */
+			rb |= (va_low & 0xfe);	/* AVAL field (P7 doesn't seem to care) */
+		}
+	} else {
+		/* 4kB page */
+		rb |= (va_low & 0x7ff) << 12;	/* remaining 11b of VA */
+	}
+	rb |= (v >> 54) & 0x300;		/* B field */
+	return rb;
+}
+
 #endif /* __ASM_KVM_BOOK3S_64_H__ */
Signature · 1 line
1.6.0.2
#5 lore raw

PATCH 5/7 KVM: PPC: protect use of kvmppc_h_pr

In reply to Alexander Graf

From: Andreas Schwab <[email protected]>

kvmppc_h_pr is only available if CONFIG_KVM_BOOK3S_64_PR.

---
 arch/powerpc/kvm/book3s_pr.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/powerpc/kvm/book3s_pr.c +2 -0
index 3c791e1..e2cfb9e 100644
@@ -658,10 +658,12 @@ program_interrupt:
 			ulong cmd = kvmppc_get_gpr(vcpu, 3);
 			int i;
 
+#ifdef CONFIG_KVM_BOOK3S_64_PR
 			if (kvmppc_h_pr(vcpu, cmd) == EMULATE_DONE) {
 				r = RESUME_GUEST;
 				break;
 			}
+#endif
 
 			run->papr_hcall.nr = cmd;
 			for (i = 0; i < 9; ++i) {
Signature · 1 line
1.6.0.2
#6 lore raw

PATCH 6/7 powerpc kvm: fix kvmppc_start_thread() for CONFIG_SMP=N

In reply to Alexander Graf

From: Michael Neuling <[email protected]>

Currently kvmppc_start_thread() tries to wake other SMT threads via xics_wake_cpu(). Unfortunately xics_wake_cpu only exists when CONFIG_SMP=Y so when compiling with CONFIG_SMP=N we get:

arch/powerpc/kvm/built-in.o: In function `.kvmppc_start_thread':
book3s_hv.c:(.text+0xa1e0): undefined reference to `.xics_wake_cpu'

The following should be fine since kvmppc_start_thread() shouldn't called to start non-zero threads when SMP=N since threads_per_core=1.

---
 arch/powerpc/kvm/book3s_hv.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kvm/book3s_hv.c +1 -1
index 0cb137a..336983d 100644
@@ -538,7 +538,7 @@ static void kvmppc_start_thread(struct kvm_vcpu *vcpu)
 	tpaca->kvm_hstate.napping = 0;
 	vcpu->cpu = vc->pcpu;
 	smp_wmb();
-#ifdef CONFIG_PPC_ICP_NATIVE
+#if defined(CONFIG_PPC_ICP_NATIVE) && defined(CONFIG_SMP)
 	if (vcpu->arch.ptid) {
 		tpaca->cpu_start = 0x80;
 		wmb();
Signature · 1 line
1.6.0.2
#7 lore raw

PATCH 7/7 KVM: PPC: e500: include linux/export.h

In reply to Alexander Graf

From: Scott Wood <[email protected]>

This is required for THIS_MODULE. We recently stopped acquiring it via some other header.

---
 arch/powerpc/kvm/e500.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/powerpc/kvm/e500.c +1 -0
index 26d2090..8c0d45a 100644
@@ -15,6 +15,7 @@
 #include <linux/kvm_host.h>
 #include <linux/slab.h>
 #include <linux/err.h>
+#include <linux/export.h>
 
 #include <asm/reg.h>
 #include <asm/cputable.h>
Signature · 1 line
1.6.0.2
#8 lore raw
In reply to Alexander Graf
Quoted 9 lines · Alexander Graf

Hi Avi,

Here are a couple compile/trivial fixes for PPC KVM. Please make sure they all get to 3.2, worst case through -stable.

I left out all the other fine commits that would be great to have in upstream due to limited testing on my side still. But they definitely are not forgotten!

Whitespace fixes for 3.2-rc7? Are they critical?

Which of these patches are really needed, as in, breaks the build, oopses the kernel, corrupts data?

Signature · 1 line
error compiling committee.c: too many arguments to function
#9 lore raw
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Alexander Graf

Hi Avi,

Here are a couple compile/trivial fixes for PPC KVM. Please make sure they all get to 3.2, worst case through -stable.

I left out all the other fine commits that would be great to have in upstream due to limited testing on my side still. But they definitely are not forgotten!

Quoted 4 lines

Whitespace fixes for 3.2-rc7? Are they critical?

Which of these patches are really needed, as in, breaks the build, oopses the kernel, corrupts data?

Good point.

powerpc/kvm: annotate kvm_rma_init as __init

and the whitespace fixes are non-critical. The rest are compile fixes.

Alex

#10 lore raw
Quoted 16 lines · Alexander Graf
Quoted 13 lines · Avi Kivity
Quoted 9 lines · Alexander Graf

Hi Avi,

Here are a couple compile/trivial fixes for PPC KVM. Please make sure they all get to 3.2, worst case through -stable.

I left out all the other fine commits that would be great to have in upstream due to limited testing on my side still. But they definitely are not forgotten!

Whitespace fixes for 3.2-rc7? Are they critical?

Quoted 9 lines
Quoted 2 lines

Which of these patches are really needed, as in, breaks the build, oopses the kernel, corrupts data?

Good point.

powerpc/kvm: annotate kvm_rma_init as __init

and the whitespace fixes are non-critical. The rest are compile fixes.

Ok. I'll apply those, hopefully no conflicts.

Signature · 1 line
error compiling committee.c: too many arguments to function
#11 lore raw
Quoted 20 lines · Avi Kivity
Quoted 19 lines · Alexander Graf
Quoted 15 lines · Avi Kivity
Quoted 9 lines · Alexander Graf

Hi Avi,

Here are a couple compile/trivial fixes for PPC KVM. Please make sure they all get to 3.2, worst case through -stable.

I left out all the other fine commits that would be great to have in upstream due to limited testing on my side still. But they definitely are not forgotten!

Whitespace fixes for 3.2-rc7? Are they critical?

Which of these patches are really needed, as in, breaks the build, oopses the kernel, corrupts data?

Quoted 9 lines
Quoted 6 lines

Good point.

powerpc/kvm: annotate kvm_rma_init as __init

and the whitespace fixes are non-critical. The rest are compile fixes.

Ok. I'll apply those, hopefully no conflicts.

I mean, I'll pick those for 3.2; will merge it all.

Signature · 1 line
error compiling committee.c: too many arguments to function
#12 lore raw
In reply to Alexander Graf
Quoted 10 lines · Alexander Graf

Hi Avi,

Here are a couple compile/trivial fixes for PPC KVM. Please make sure they all get to 3.2, worst case through -stable.

I left out all the other fine commits that would be great to have in upstream due to limited testing on my side still. But they definitely are not forgotten!

Which of these are needed for 3.1, 3.0?

Signature · 1 line
error compiling committee.c: too many arguments to function
#13 lore raw
Quoted 6 lines · Avi Kivity
Quoted 5 lines · Alexander Graf

Hi Avi,

Here are a couple compile/trivial fixes for PPC KVM. Please make sure they all get to 3.2, worst case through -stable.

Quoted 7 lines
Quoted 5 lines

I left out all the other fine commits that would be great to have in upstream due to limited testing on my side still. But they definitely are not forgotten!

Which of these are needed for 3.1, 3.0?

I don't think any.

Alex