Skip to contentSkip to conversation

KVM: PPC: Book3S HV: Enable on little endian hosts

PATCH Applied Alexander Graf 2 participants 12 messages Jun 17, 2014 – Jul 4, 2014

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

cover KVM: PPC: Book3S HV: Enable on little endian hosts

So far we've been able to successfully run HV KVM on big endian hosts, but once you dive into little endian land things start to fall apart.

This patch set enables HV KVM for little endian hosts. This should be the final piece left missing to get little endian systems fully en par with big endian ones in the KVM world - modulo bugs.

For now guest threading support is still slightly flaky, but I'm sure that's only a minor breakage somewhere that we'll find soon.

v1 -> v2:

- fix typo in STWX_BE
- Add __be hints
- Fix H_REMOVE
- Fix dtl_idx
- Make XICS code easier to follow and use memory for bswap

Alex

Alexander Graf (7):
PPC: Add asm helpers for BE 32bit load/store
KVM: PPC: Book3S HV: Make HTAB code LE host aware
KVM: PPC: Book3S HV: Access guest VPA in BE
KVM: PPC: Book3S HV: Access host lppaca and shadow slb in BE
KVM: PPC: Book3S HV: Access XICS in BE
KVM: PPC: Book3S HV: Fix ABIv2 on LE
KVM: PPC: Book3S HV: Enable for little endian hosts

 arch/powerpc/include/asm/asm-compat.h    |   4 +
 arch/powerpc/include/asm/kvm_book3s.h    |   4 +-
 arch/powerpc/include/asm/kvm_book3s_64.h |  15 +++-
 arch/powerpc/kvm/Kconfig                 |   1 -
 arch/powerpc/kvm/book3s_64_mmu_hv.c      | 128 ++++++++++++++-------------
 arch/powerpc/kvm/book3s_hv.c             |  22 ++---
 arch/powerpc/kvm/book3s_hv_ras.c         |   6 +-
 arch/powerpc/kvm/book3s_hv_rm_mmu.c      | 146 ++++++++++++++++++-------------
 arch/powerpc/kvm/book3s_hv_rmhandlers.S  |  60 ++++++++-----
 9 files changed, 220 insertions(+), 166 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/7 PPC: Add asm helpers for BE 32bit load/store

From assembly code we might not only have to explicitly BE access 64bit values, but sometimes also 32bit ones. Add helpers that allow for easy use of lwzx/stwx in their respective byte-reverse or native form.

CC Benjamin Herrenschmidt <[email protected]>

---

v1 -> v2:

- fix typo in STWX_BE

---
 arch/powerpc/include/asm/asm-compat.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/powerpc/include/asm/asm-compat.h +4 -0
index 4b237aa..21be8ae 100644
@@ -34,10 +34,14 @@
 #define PPC_MIN_STKFRM	112
 
 #ifdef __BIG_ENDIAN__
+#define LWZX_BE	stringify_in_c(lwzx)
 #define LDX_BE	stringify_in_c(ldx)
+#define STWX_BE	stringify_in_c(stwx)
 #define STDX_BE	stringify_in_c(stdx)
 #else
+#define LWZX_BE	stringify_in_c(lwbrx)
 #define LDX_BE	stringify_in_c(ldbrx)
+#define STWX_BE	stringify_in_c(stwbrx)
 #define STDX_BE	stringify_in_c(stdbrx)
 #endif
 
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 2/7 KVM: PPC: Book3S HV: Make HTAB code LE host aware

In reply to Alexander Graf

When running on an LE host all data structures are kept in little endian byte order. However, the HTAB still needs to be maintained in big endian.

So every time we access any HTAB we need to make sure we do so in the right byte order. Fix up all accesses to manually byte swap.

---

v1 -> v2:

- Add __be32 hints
- Fix H_REMOVE

---
 arch/powerpc/include/asm/kvm_book3s.h    |   4 +-
 arch/powerpc/include/asm/kvm_book3s_64.h |  15 +++-
 arch/powerpc/kvm/book3s_64_mmu_hv.c      | 128 ++++++++++++++-------------
 arch/powerpc/kvm/book3s_hv_rm_mmu.c      | 146 ++++++++++++++++++-------------
 4 files changed, 164 insertions(+), 129 deletions(-)
arch/powerpc/include/asm/kvm_book3s.h +2 -2
index a20cc0b..028f4b1 100644
@@ -161,9 +161,9 @@ extern pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, bool writing,
 			bool *writable);
 extern void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev,
 			unsigned long *rmap, long pte_index, int realmode);
-extern void kvmppc_invalidate_hpte(struct kvm *kvm, unsigned long *hptep,
+extern void kvmppc_invalidate_hpte(struct kvm *kvm, __be64 *hptep,
 			unsigned long pte_index);
-void kvmppc_clear_ref_hpte(struct kvm *kvm, unsigned long *hptep,
+void kvmppc_clear_ref_hpte(struct kvm *kvm, __be64 *hptep,
 			unsigned long pte_index);
 extern void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long addr,
 			unsigned long *nb_ret);
arch/powerpc/include/asm/kvm_book3s_64.h +12 -3
index c7871f3..e504f88 100644
@@ -59,20 +59,29 @@ extern unsigned long kvm_rma_pages;
 /* These bits are reserved in the guest view of the HPTE */
 #define HPTE_GR_RESERVED	HPTE_GR_MODIFIED
 
-static inline long try_lock_hpte(unsigned long *hpte, unsigned long bits)
+static inline long try_lock_hpte(__be64 *hpte, unsigned long bits)
 {
 	unsigned long tmp, old;
+	__be64 be_lockbit, be_bits;
+
+	/*
+	 * We load/store in native endian, but the HTAB is in big endian. If
+	 * we byte swap all data we apply on the PTE we're implicitly correct
+	 * again.
+	 */
+	be_lockbit = cpu_to_be64(HPTE_V_HVLOCK);
+	be_bits = cpu_to_be64(bits);
 
 	asm volatile("	ldarx	%0,0,%2\n"
 		     "	and.	%1,%0,%3\n"
 		     "	bne	2f\n"
-		     "	ori	%0,%0,%4\n"
+		     "	or	%0,%0,%4\n"
 		     "  stdcx.	%0,0,%2\n"
 		     "	beq+	2f\n"
 		     "	mr	%1,%3\n"
 		     "2:	isync"
 		     : "=&r" (tmp), "=&r" (old)
-		     : "r" (hpte), "r" (bits), "i" (HPTE_V_HVLOCK)
+		     : "r" (hpte), "r" (be_bits), "r" (be_lockbit)
 		     : "cc", "memory");
 	return old = 0;
 }
arch/powerpc/kvm/book3s_64_mmu_hv.c +67 -61

379 lines not on this page · raw message

arch/powerpc/kvm/book3s_hv_rm_mmu.c +83 -63

374 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#3 lore raw

PATCH 3/7 KVM: PPC: Book3S HV: Access guest VPA in BE

In reply to Alexander Graf

There are a few shared data structures between the host and the guest. Most of them get registered through the VPA interface.

These data structures are defined to always be in big endian byte order, so let's make sure we always access them in big endian.

---

v1 -> v2:

- Add __be hints
- Fix dtl_idx

---
 arch/powerpc/kvm/book3s_hv.c     | 22 +++++++++++-----------
 arch/powerpc/kvm/book3s_hv_ras.c |  6 +++---
 2 files changed, 14 insertions(+), 14 deletions(-)
arch/powerpc/kvm/book3s_hv.c +11 -11
index 1562acf..f7bcc72 100644
@@ -270,7 +270,7 @@ struct kvm_vcpu *kvmppc_find_vcpu(struct kvm *kvm, int id)
 static void init_vpa(struct kvm_vcpu *vcpu, struct lppaca *vpa)
 {
 	vpa->__old_status |= LPPACA_OLD_SHARED_PROC;
-	vpa->yield_count = 1;
+	vpa->yield_count = cpu_to_be32(1);
 }
 
 static int set_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *v,
@@ -293,8 +293,8 @@ static int set_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *v,
 struct reg_vpa {
 	u32 dummy;
 	union {
-		u16 hword;
-		u32 word;
+		__be16 hword;
+		__be32 word;
 	} length;
 };
 
@@ -333,9 +333,9 @@ static unsigned long do_h_register_vpa(struct kvm_vcpu *vcpu,
 		if (va = NULL)
 			return H_PARAMETER;
 		if (subfunc = H_VPA_REG_VPA)
-			len = ((struct reg_vpa *)va)->length.hword;
+			len = be16_to_cpu(((struct reg_vpa *)va)->length.hword);
 		else
-			len = ((struct reg_vpa *)va)->length.word;
+			len = be32_to_cpu(((struct reg_vpa *)va)->length.word);
 		kvmppc_unpin_guest_page(kvm, va, vpa, false);
 
 		/* Check length */
@@ -540,18 +540,18 @@ static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu,
 		return;
 	memset(dt, 0, sizeof(struct dtl_entry));
 	dt->dispatch_reason = 7;
-	dt->processor_id = vc->pcpu + vcpu->arch.ptid;
-	dt->timebase = now + vc->tb_offset;
-	dt->enqueue_to_dispatch_time = stolen;
-	dt->srr0 = kvmppc_get_pc(vcpu);
-	dt->srr1 = vcpu->arch.shregs.msr;
+	dt->processor_id = cpu_to_be16(vc->pcpu + vcpu->arch.ptid);
+	dt->timebase = cpu_to_be64(now + vc->tb_offset);
+	dt->enqueue_to_dispatch_time = cpu_to_be32(stolen);
+	dt->srr0 = cpu_to_be64(kvmppc_get_pc(vcpu));
+	dt->srr1 = cpu_to_be64(vcpu->arch.shregs.msr);
 	++dt;
 	if (dt = vcpu->arch.dtl.pinned_end)
 		dt = vcpu->arch.dtl.pinned_addr;
 	vcpu->arch.dtl_ptr = dt;
 	/* order writing *dt vs. writing vpa->dtl_idx */
 	smp_wmb();
-	vpa->dtl_idx = ++vcpu->arch.dtl_index;
+	vpa->dtl_idx = cpu_to_be64(++vcpu->arch.dtl_index);
 	vcpu->arch.dtl.dirty = true;
 }
 
arch/powerpc/kvm/book3s_hv_ras.c +3 -3
index 768a9f9..6a3ba8a 100644
@@ -45,14 +45,14 @@ static void reload_slb(struct kvm_vcpu *vcpu)
 		return;
 
 	/* Sanity check */
-	n = min_t(u32, slb->persistent, SLB_MIN_SIZE);
+	n = min_t(u32, be32_to_cpu(slb->persistent), SLB_MIN_SIZE);
 	if ((void *) &slb->save_area[n] > vcpu->arch.slb_shadow.pinned_end)
 		return;
 
 	/* Load up the SLB from that */
 	for (i = 0; i < n; ++i) {
-		unsigned long rb = slb->save_area[i].esid;
-		unsigned long rs = slb->save_area[i].vsid;
+		unsigned long rb = be64_to_cpu(slb->save_area[i].esid);
+		unsigned long rs = be64_to_cpu(slb->save_area[i].vsid);
 
 		rb = (rb & ~0xFFFul) | i;	/* insert entry number */
 		asm volatile("slbmte %0,%1" : : "r" (rs), "r" (rb));
Signature · 1 line
1.8.1.4
#4 lore raw

PATCH 4/7 KVM: PPC: Book3S HV: Access host lppaca and shadow slb in BE

In reply to Alexander Graf

Some data structures are always stored in big endian. Among those are the LPPACA fields as well as the shadow slb. These structures might be shared with a hypervisor.

So whenever we access those fields, make sure we do so in big endian byte order.

---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +10 -10
index 7e7fa01..75c7e22 100644
@@ -32,10 +32,6 @@
 
 #define VCPU_GPRS_TM(reg) (((reg) * ULONG_SIZE) + VCPU_GPR_TM)
 
-#ifdef __LITTLE_ENDIAN__
-#error Need to fix lppaca and SLB shadow accesses in little endian mode
-#endif
-
 /* Values in HSTATE_NAPPING(r13) */
 #define NAPPING_CEDE	1
 #define NAPPING_NOVCPU	2
@@ -595,9 +591,10 @@ kvmppc_got_guest:
 	ld	r3, VCPU_VPA(r4)
 	cmpdi	r3, 0
 	beq	25f
-	lwz	r5, LPPACA_YIELDCOUNT(r3)
+	li	r6, LPPACA_YIELDCOUNT
+	LWZX_BE	r5, r3, r6
 	addi	r5, r5, 1
-	stw	r5, LPPACA_YIELDCOUNT(r3)
+	STWX_BE	r5, r3, r6
 	li	r6, 1
 	stb	r6, VCPU_VPA_DIRTY(r4)
 25:
@@ -1442,9 +1439,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
 	ld	r8, VCPU_VPA(r9)	/* do they have a VPA? */
 	cmpdi	r8, 0
 	beq	25f
-	lwz	r3, LPPACA_YIELDCOUNT(r8)
+	li	r4, LPPACA_YIELDCOUNT
+	LWZX_BE	r3, r8, r4
 	addi	r3, r3, 1
-	stw	r3, LPPACA_YIELDCOUNT(r8)
+	STWX_BE	r3, r8, r4
 	li	r3, 1
 	stb	r3, VCPU_VPA_DIRTY(r9)
 25:
@@ -1757,8 +1755,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
 33:	ld	r8,PACA_SLBSHADOWPTR(r13)
 
 	.rept	SLB_NUM_BOLTED
-	ld	r5,SLBSHADOW_SAVEAREA(r8)
-	ld	r6,SLBSHADOW_SAVEAREA+8(r8)
+	li	r3, SLBSHADOW_SAVEAREA
+	LDX_BE	r5, r8, r3
+	addi	r3, r3, 8
+	LDX_BE	r6, r8, r3
 	andis.	r7,r5,SLB_ESID_V@h
 	beq	1f
 	slbmte	r6,r5
Signature · 1 line
1.8.1.4
#5 lore raw

PATCH 5/7 KVM: PPC: Book3S HV: Access XICS in BE

In reply to Alexander Graf

On the exit path from the guest we check what type of interrupt we received if we received one. This means we're doing hardware access to the XICS interrupt controller.

However, when running on a little endian system, this access is byte reversed.

So let's make sure to swizzle the bytes back again and virtually make XICS accesses big endian.

---

v1 -> v2:

- Make code easier to follow and use hardware for bswap

---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +14 -4
index 75c7e22..1a71f60 100644
@@ -2325,7 +2325,18 @@ kvmppc_read_intr:
 	cmpdi	r6, 0
 	beq-	1f
 	lwzcix	r0, r6, r7
-	rlwinm.	r3, r0, 0, 0xffffff
+	/*
+	 * Save XIRR for later. Since we get in in reverse endian on LE
+	 * systems, save it byte reversed and fetch it back in host endian.
+	 */
+	li	r3, HSTATE_SAVED_XIRR
+	STWX_BE	r0, r3, r13
+#ifdef __LITTLE_ENDIAN__
+	lwz	r3, HSTATE_SAVED_XIRR(r13)
+#else
+	mr	r3, r0
+#endif
+	rlwinm.	r3, r3, 0, 0xffffff
 	sync
 	beq	1f			/* if nothing pending in the ICP */
 
@@ -2357,10 +2368,9 @@ kvmppc_read_intr:
 	li	r3, -1
 1:	blr
 
-42:	/* It's not an IPI and it's for the host, stash it in the PACA
-	 * before exit, it will be picked up by the host ICP driver
+42:	/* It's not an IPI and it's for the host. We saved a copy of XIRR in
+	 * the PACA earlier, it will be picked up by the host ICP driver
 	 */
-	stw	r0, HSTATE_SAVED_XIRR(r13)
 	li	r3, 1
 	b	1b
 
Signature · 1 line
1.8.1.4
#6 lore raw

PATCH 6/7 KVM: PPC: Book3S HV: Fix ABIv2 on LE

In reply to Alexander Graf

We use ABIv2 on Little Endian systems which gets rid of the dotted function names. Branch to the actual functions when we see such a system.

---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +14 -8
index 1a71f60..1ff3ebd 100644
@@ -36,6 +36,12 @@
 #define NAPPING_CEDE	1
 #define NAPPING_NOVCPU	2
 
+#if defined(_CALL_ELF) && _CALL_ELF = 2
+#define FUNC(name) 		name
+#else
+#define FUNC(name) 		GLUE(.,name)
+#endif
+
 /*
  * Call kvmppc_hv_entry in real mode.
  * Must be called with interrupts hard-disabled.
@@ -668,9 +674,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
 
 	mr	r31, r4
 	addi	r3, r31, VCPU_FPRS_TM
-	bl	.load_fp_state
+	bl	FUNC(load_fp_state)
 	addi	r3, r31, VCPU_VRS_TM
-	bl	.load_vr_state
+	bl	FUNC(load_vr_state)
 	mr	r4, r31
 	lwz	r7, VCPU_VRSAVE_TM(r4)
 	mtspr	SPRN_VRSAVE, r7
@@ -1414,9 +1420,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
 
 	/* Save FP/VSX. */
 	addi	r3, r9, VCPU_FPRS_TM
-	bl	.store_fp_state
+	bl	FUNC(store_fp_state)
 	addi	r3, r9, VCPU_VRS_TM
-	bl	.store_vr_state
+	bl	FUNC(store_vr_state)
 	mfspr	r6, SPRN_VRSAVE
 	stw	r6, VCPU_VRSAVE_TM(r9)
 1:
@@ -2405,11 +2411,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
 	mtmsrd	r8
 	isync
 	addi	r3,r3,VCPU_FPRS
-	bl	.store_fp_state
+	bl	FUNC(store_fp_state)
 #ifdef CONFIG_ALTIVEC
 BEGIN_FTR_SECTION
 	addi	r3,r31,VCPU_VRS
-	bl	.store_vr_state
+	bl	FUNC(store_vr_state)
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 #endif
 	mfspr	r6,SPRN_VRSAVE
@@ -2441,11 +2447,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
 	mtmsrd	r8
 	isync
 	addi	r3,r4,VCPU_FPRS
-	bl	.load_fp_state
+	bl	FUNC(load_fp_state)
 #ifdef CONFIG_ALTIVEC
 BEGIN_FTR_SECTION
 	addi	r3,r31,VCPU_VRS
-	bl	.load_vr_state
+	bl	FUNC(load_vr_state)
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 #endif
 	lwz	r7,VCPU_VRSAVE(r31)
Signature · 1 line
1.8.1.4
#10 lore raw

PATCH 7/7 KVM: PPC: Book3S HV: Enable for little endian hosts

In reply to Alexander Graf

Now that we've fixed all the issues that HV KVM code had on little endian hosts, we can enable it in the kernel configuration for users to play with.

---
 arch/powerpc/kvm/Kconfig | 1 -
 1 file changed, 1 deletion(-)
arch/powerpc/kvm/Kconfig +0 -1
index d6a53b9..8aeeda1 100644
@@ -75,7 +75,6 @@ config KVM_BOOK3S_64
 config KVM_BOOK3S_64_HV
 	tristate "KVM support for POWER7 and PPC970 using hypervisor mode in host"
 	depends on KVM_BOOK3S_64
-	depends on !CPU_LITTLE_ENDIAN
 	select KVM_BOOK3S_HV_POSSIBLE
 	select MMU_NOTIFIER
 	select CMA
Signature · 1 line
1.8.1.4
#7 lore raw

Re: [PATCH 6/7] KVM: PPC: Book3S HV: Fix ABIv2 on LE

In reply to Alexander Graf
Quoted 4 lines · Alexander Graf

We use ABIv2 on Little Endian systems which gets rid of the dotted function names. Branch to the actual functions when we see such a system.

As per patches sent by anton we don't need this. We can branch to the function rathen than the dot symbol

http://article.gmane.org/gmane.linux.ports.ppc.embedded/68925
http://article.gmane.org/gmane.linux.ports.ppc.embedded/71005

-aneesh

Quoted 63 lines
---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +12 -6
index 1a71f60..1ff3ebd 100644
@@ -36,6 +36,12 @@
 #define NAPPING_CEDE	1
 #define NAPPING_NOVCPU	2
 
+#if defined(_CALL_ELF) && _CALL_ELF == 2
+#define FUNC(name) 		name
+#else
+#define FUNC(name) 		GLUE(.,name)
+#endif
+
 /*
  * Call kvmppc_hv_entry in real mode.
  * Must be called with interrupts hard-disabled.
@@ -668,9 +674,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
 
 	mr	r31, r4
 	addi	r3, r31, VCPU_FPRS_TM
-	bl	.load_fp_state
+	bl	FUNC(load_fp_state)
 	addi	r3, r31, VCPU_VRS_TM
-	bl	.load_vr_state
+	bl	FUNC(load_vr_state)
 	mr	r4, r31
 	lwz	r7, VCPU_VRSAVE_TM(r4)
 	mtspr	SPRN_VRSAVE, r7
@@ -1414,9 +1420,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
 
 	/* Save FP/VSX. */
 	addi	r3, r9, VCPU_FPRS_TM
-	bl	.store_fp_state
+	bl	FUNC(store_fp_state)
 	addi	r3, r9, VCPU_VRS_TM
-	bl	.store_vr_state
+	bl	FUNC(store_vr_state)
 	mfspr	r6, SPRN_VRSAVE
 	stw	r6, VCPU_VRSAVE_TM(r9)
 1:
@@ -2405,11 +2411,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
 	mtmsrd	r8
 	isync
 	addi	r3,r3,VCPU_FPRS
-	bl	.store_fp_state
+	bl	FUNC(store_fp_state)
 #ifdef CONFIG_ALTIVEC
 BEGIN_FTR_SECTION
 	addi	r3,r31,VCPU_VRS
-	bl	.store_vr_state
+	bl	FUNC(store_vr_state)
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 #endif
 	mfspr	r6,SPRN_VRSAVE
@@ -2441,11 +2447,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
 	mtmsrd	r8
 	isync
 	addi	r3,r4,VCPU_FPRS

arch/powerpc/kvm/book3s_hv_rmhandlers.S END_FTR_SECTION_IFSET(CPU_FTR_VSX) · line 2457

Quoted 10 lines
arch/powerpc/kvm/book3s_hv_rmhandlers.S +2 -2
-	bl	.load_fp_state
+	bl	FUNC(load_fp_state)
 #ifdef CONFIG_ALTIVEC
 BEGIN_FTR_SECTION
 	addi	r3,r31,VCPU_VRS
-	bl	.load_vr_state
+	bl	FUNC(load_vr_state)
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 #endif
 	lwz	r7,VCPU_VRSAVE(r31)

-aneesh

#8 lore raw

Re: [PATCH 6/7] KVM: PPC: Book3S HV: Fix ABIv2 on LE

Quoted 11 lines · Aneesh Kumar K.V
Quoted 4 lines · Alexander Graf

We use ABIv2 on Little Endian systems which gets rid of the dotted function names. Branch to the actual functions when we see such a system.

As per patches sent by anton we don't need this. We can branch to the function rathen than the dot symbol

http://article.gmane.org/gmane.linux.ports.ppc.embedded/68925
http://article.gmane.org/gmane.linux.ports.ppc.embedded/71005

Ah, true in this case, because the file never gets compiled as a module.

Alex

#9 lore raw

PATCH v3 6/7 KVM: PPC: Book3S HV: Fix ABIv2 on LE

For code that doesn't live in modules we can just branch to the real function names, giving us compatibility with ABIv1 and ABIv2.

Do this for the compiled-in code of HV KVM.

---
 arch/powerpc/kvm/book3s_hv_rmhandlers.S | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +8 -8
index 1a71f60..a9de981 100644
@@ -668,9 +668,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
 
 	mr	r31, r4
 	addi	r3, r31, VCPU_FPRS_TM
-	bl	.load_fp_state
+	bl	load_fp_state
 	addi	r3, r31, VCPU_VRS_TM
-	bl	.load_vr_state
+	bl	load_vr_state
 	mr	r4, r31
 	lwz	r7, VCPU_VRSAVE_TM(r4)
 	mtspr	SPRN_VRSAVE, r7
@@ -1414,9 +1414,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_TM)
 
 	/* Save FP/VSX. */
 	addi	r3, r9, VCPU_FPRS_TM
-	bl	.store_fp_state
+	bl	store_fp_state
 	addi	r3, r9, VCPU_VRS_TM
-	bl	.store_vr_state
+	bl	store_vr_state
 	mfspr	r6, SPRN_VRSAVE
 	stw	r6, VCPU_VRSAVE_TM(r9)
 1:
@@ -2405,11 +2405,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
 	mtmsrd	r8
 	isync
 	addi	r3,r3,VCPU_FPRS
-	bl	.store_fp_state
+	bl	store_fp_state
 #ifdef CONFIG_ALTIVEC
 BEGIN_FTR_SECTION
 	addi	r3,r31,VCPU_VRS
-	bl	.store_vr_state
+	bl	store_vr_state
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 #endif
 	mfspr	r6,SPRN_VRSAVE
@@ -2441,11 +2441,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
 	mtmsrd	r8
 	isync
 	addi	r3,r4,VCPU_FPRS
-	bl	.load_fp_state
+	bl	load_fp_state
 #ifdef CONFIG_ALTIVEC
 BEGIN_FTR_SECTION
 	addi	r3,r31,VCPU_VRS
-	bl	.load_vr_state
+	bl	load_vr_state
 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
 #endif
 	lwz	r7,VCPU_VRSAVE(r31)
Signature · 1 line
1.8.1.4
author Applied
#11 lore raw
In reply to Alexander Graf
Quoted 10 lines · Alexander Graf

So far we've been able to successfully run HV KVM on big endian hosts, but once you dive into little endian land things start to fall apart.

This patch set enables HV KVM for little endian hosts. This should be the final piece left missing to get little endian systems fully en par with big endian ones in the KVM world - modulo bugs.

For now guest threading support is still slightly flaky, but I'm sure that's only a minor breakage somewhere that we'll find soon.

Quoted 7 lines

v1 -> v2:

- fix typo in STWX_BE
- Add __be hints
- Fix H_REMOVE
- Fix dtl_idx
- Make XICS code easier to follow and use memory for bswap

Applied to kvm-ppc-queue.

Alex