Skip to contentSkip to conversation

powerpc: book3s: PR: Enable Little Endian PR guest

PATCH In review Aneesh Kumar K.V 3 participants 3 messages Nov 11, 2013 – Nov 12, 2013

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

PATCH 1/1 powerpc: book3s: PR: Enable Little Endian PR guest

From: "Aneesh Kumar K.V" <[email protected]>

This patch make sure we inherit the LE bit correctly in different case so that we can run Little Endian distro in PR mode

---

This patch depends on the below two changes
1) [PATCH v5 0/6] KVM: PPC: Book3S: MMIO support for Little Endian guests (kvm-ppc)

        http://mid.gmane.org/[email protected]
2) [PATCH] powerpc: book3s: kvm: Use the saved dsisr and dar values
       http://mid.gmane.org/1384178577-23721-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
 arch/powerpc/kvm/book3s_64_mmu.c | 2 +-
 arch/powerpc/kvm/book3s_pr.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_64_mmu.c +1 -1
index 83da1f8..d339096 100644
@@ -38,7 +38,7 @@
 
 static void kvmppc_mmu_book3s_64_reset_msr(struct kvm_vcpu *vcpu)
 {
-	kvmppc_set_msr(vcpu, MSR_SF);
+	kvmppc_set_msr(vcpu, MSR_SF | (vcpu->arch.shared->msr & MSR_LE));
 }
 
 static struct kvmppc_slb *kvmppc_mmu_book3s_64_find_slbe(
arch/powerpc/kvm/book3s_pr.c +1 -1
index a7fe87a..cf9362c 100644
@@ -226,7 +226,7 @@ static void kvmppc_recalc_shadow_msr(struct kvm_vcpu *vcpu)
 	ulong smsr = vcpu->arch.shared->msr;
 
 	/* Guest MSR values */
-	smsr &= MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE;
+	smsr &= MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE | MSR_LE;
 	/* Process MSR values */
 	smsr |= MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_PR | MSR_EE;
 	/* External providers the guest reserved */
Signature · 1 line
1.8.3.2
#1 lore raw

Am 11.11.2013 um 09:08 schrieb "Aneesh Kumar K.V" <[email protected]>:

Quoted 6 lines

From: "Aneesh Kumar K.V" <[email protected]>

This patch make sure we inherit the LE bit correctly in different case so that we can run Little Endian distro in PR mode

This is not how real hardware works, is it? Could you please point me to the bits in the ISA that indicate that we should preserve the LE bit anywhere? :)

Alex

Quoted 45 lines

---

This patch depends on the below two changes
1) [PATCH v5 0/6] KVM: PPC: Book3S: MMIO support for Little Endian guests (kvm-ppc)

       http://mid.gmane.org/[email protected]
2) [PATCH] powerpc: book3s: kvm: Use the saved dsisr and dar values
      http://mid.gmane.org/1384178577-23721-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com

arch/powerpc/kvm/book3s_64_mmu.c | 2 +-
arch/powerpc/kvm/book3s_pr.c | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_64_mmu.c +1 -1
index 83da1f8..d339096 100644
@@ -38,7 +38,7 @@
 
 static void kvmppc_mmu_book3s_64_reset_msr(struct kvm_vcpu *vcpu)
 {
-    kvmppc_set_msr(vcpu, MSR_SF);
+    kvmppc_set_msr(vcpu, MSR_SF | (vcpu->arch.shared->msr & MSR_LE));
 }
 

static struct kvmppc_slb *kvmppc_mmu_book3s_64_find_slbe(

arch/powerpc/kvm/book3s_pr.c +1 -1
index a7fe87a..cf9362c 100644
@@ -226,7 +226,7 @@ static void kvmppc_recalc_shadow_msr(struct kvm_vcpu *vcpu)
   ulong smsr = vcpu->arch.shared->msr;
 
   /* Guest MSR values */
-    smsr &= MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE;
+    smsr &= MSR_FE0 | MSR_FE1 | MSR_SF | MSR_SE | MSR_BE | MSR_LE;
   /* Process MSR values */
   smsr |= MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_PR | MSR_EE;
   /* External providers the guest reserved */
Signature · 6 lines
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 4 lines · Alexander Graf

Am 11.11.2013 um 09:08 schrieb "Aneesh Kumar K.V" <[email protected]>:

Quoted 8 lines
Quoted 6 lines

From: "Aneesh Kumar K.V" <[email protected]>

This patch make sure we inherit the LE bit correctly in different case so that we can run Little Endian distro in PR mode

This is not how real hardware works, is it? Could you please point me to the bits in the ISA that indicate that we should preserve the LE bit anywhere? :)

No, it isn't. What we should really be doing depends a bit on what CPU we're emulating. Older CPUs had an ILE bit in the MSR that got copied to LE on interrupt. Recent POWER CPUs moved the ILE bit to the LPCR, so for them we should have an emulated LPCR (and implement H_SET_MODE for pseries guests so they can control LPCR[ILE]). Embedded CPUs of course don't have an LE bit, or an ILE bit, since they control endianness on a per-page basis.

Paul.