powerpc: book3s: PR: Enable Little Endian PR guest
Subsystems (3)
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
---
Changes from V1:
* Use LPCR bit to find whether to enable LE on interrupt. We do it more or less same as HV now. We keep it separate at this point because HV H_SETMODE does a lot more than what we do here.
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
3) [PATCH 11/15] KVM: PPC: Book3S HV: Add little-endian guest support
http://mid.gmane.org/[email protected]
With further changes to make it apply to latest upstream.
arch/powerpc/include/asm/kvm_host.h | 4 +-- arch/powerpc/kernel/asm-offsets.c | 4 +-- arch/powerpc/kvm/book3s_64_mmu.c | 2 +- arch/powerpc/kvm/book3s_pr.c | 3 +- arch/powerpc/kvm/book3s_pr_papr.c | 57 +++++++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/kvm_host.h +2 -2
@@ -240,7 +240,6 @@ struct kvm_arch {unsigned long sdr1;unsigned long host_sdr1;int tlbie_lock; -unsigned long lpcr;unsigned long rmor;struct kvm_rma_info *rma;unsigned long vrma_slb_v;
@@ -261,6 +260,7 @@ struct kvm_arch {struct mutex hpt_mutex;#endif #ifdef CONFIG_PPC_BOOK3S_64 +unsigned long lpcr;struct list_head spapr_tce_tables;struct list_head rtas_tokens;#endif
@@ -524,6 +524,7 @@ struct kvm_vcpu_arch {#ifdef CONFIG_PPC_BOOK3S ulong fault_dar;u32 fault_dsisr; +unsigned long intr_msr;#endif #ifdef CONFIG_BOOKE
@@ -616,7 +617,6 @@ struct kvm_vcpu_arch {spinlock_t tbacct_lock;u64 busy_stolen;u64 busy_preempt; -unsigned long intr_msr;#endif };
arch/powerpc/kernel/asm-offsets.c +2 -2
@@ -473,7 +473,6 @@ int main(void)#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE DEFINE(KVM_SDR1, offsetof(struct kvm, arch.sdr1)); DEFINE(KVM_HOST_LPID, offsetof(struct kvm, arch.host_lpid)); - DEFINE(KVM_HOST_LPCR, offsetof(struct kvm, arch.host_lpcr)); DEFINE(KVM_HOST_SDR1, offsetof(struct kvm, arch.host_sdr1)); DEFINE(KVM_TLBIE_LOCK, offsetof(struct kvm, arch.tlbie_lock)); DEFINE(KVM_NEED_FLUSH, offsetof(struct kvm, arch.need_tlb_flush.bits));
@@ -484,9 +483,9 @@ int main(void) DEFINE(VCPU_DAR, offsetof(struct kvm_vcpu, arch.shregs.dar)); DEFINE(VCPU_VPA, offsetof(struct kvm_vcpu, arch.vpa.pinned_addr)); DEFINE(VCPU_VPA_DIRTY, offsetof(struct kvm_vcpu, arch.vpa.dirty)); - DEFINE(VCPU_INTR_MSR, offsetof(struct kvm_vcpu, arch.intr_msr));#endif #ifdef CONFIG_PPC_BOOK3S + DEFINE(KVM_HOST_LPCR, offsetof(struct kvm, arch.host_lpcr));DEFINE (VCPU_VCPUID , offsetof(struct kvm_vcpu , vcpu_id)); DEFINE(VCPU_PURR, offsetof(struct kvm_vcpu, arch.purr)); DEFINE(VCPU_SPURR, offsetof(struct kvm_vcpu, arch.spurr));
@@ -510,6 +509,7 @@ int main(void) DEFINE(VCPU_SLB_NR, offsetof(struct kvm_vcpu, arch.slb_nr)); DEFINE(VCPU_FAULT_DSISR, offsetof(struct kvm_vcpu, arch.fault_dsisr)); DEFINE(VCPU_FAULT_DAR, offsetof(struct kvm_vcpu, arch.fault_dar)); + DEFINE(VCPU_INTR_MSR, offsetof(struct kvm_vcpu, arch.intr_msr)); DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); DEFINE(VCPU_TRAP, offsetof(struct kvm_vcpu, arch.trap)); DEFINE(VCPU_PTID, offsetof(struct kvm_vcpu, arch.ptid));
arch/powerpc/kvm/book3s_64_mmu.c +1 -1
@@ -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, vcpu->arch.intr_msr); } static struct kvmppc_slb *kvmppc_mmu_book3s_64_find_slbe(
arch/powerpc/kvm/book3s_pr.c +2 -1
@@ -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 */
@@ -1207,6 +1207,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_pr(struct kvm *kvm, vcpu->arch.pvr =0x3C0301 ;if (mmu_has_feature (MMU_FTR_1T_SEGMENT )) vcpu->arch.pvr =mfspr (SPRN_PVR ); + vcpu->arch.intr_msr =MSR_SF ;#else /* default to book3s_32 (750) */ vcpu->arch.pvr =0x84202 ;
arch/powerpc/kvm/book3s_pr_papr.c +57 -0
69 lines not on this page · raw message
Signature · 1 line
1.8.3.2
Quoted 4 lines · Aneesh Kumar K.V
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
IMHO H_SET_MODE should be handled in user space for most cases. We probably want an interface similar to the RTAS hypercall where user space can then tell the kernel to handle individual sub-commands inside the kernel after all for performance counters and other performance critical operations.
But the normal mode of operation should be to bounce this into user space and have that one set LPCR then.
Alex