@@ -106,6 +106,7 @@ struct kvmppc_vcpu_book3s {
#endif
int hpte_cache_count;
spinlock_t mmu_lock;
+ ulong lpcr;
};
#define CONTEXT_HOST 0
@@ -38,7 +38,13 @@
static void kvmppc_mmu_book3s_64_reset_msr(struct kvm_vcpu *vcpu)
{
- kvmppc_set_msr(vcpu, MSR_SF);
+ struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
+ ulong new_msr = MSR_SF;
+
+ if (vcpu_book3s->lpcr & LPCR_ILE)
+ new_msr |= MSR_LE;
+
+ kvmppc_set_msr(vcpu, new_msr);
}
static struct kvmppc_slb *kvmppc_mmu_book3s_64_find_slbe(
@@ -1110,6 +1110,9 @@ static int kvmppc_get_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
case KVM_REG_PPC_HIOR:
*val = get_reg_val(id, to_book3s(vcpu)->hior);
break;
+ case KVM_REG_PPC_LPCR:
+ *val = get_reg_val(id, to_book3s(vcpu)->lpcr);
+ break;
default:
r = -EINVAL;
break;
@@ -1128,6 +1131,9 @@ static int kvmppc_set_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
to_book3s(vcpu)->hior = set_reg_val(id, *val);
to_book3s(vcpu)->hior_explicit = true;
break;
+ case KVM_REG_PPC_LPCR:
+ to_book3s(vcpu)->lpcr = set_reg_val(id, *val) & LPCR_ILE;
+ break;
default:
r = -EINVAL;
break;
To control whether we should inject interrupts in little or big endian mode, user space sets the LPCR.ILE bit accordingly via ONE_REG. Let's implement it, so we are able to trigger interrupts in LE mode. Signed-off-by: Alexander Graf <agraf@suse.de> --- arch/powerpc/include/asm/kvm_book3s.h | 1 + arch/powerpc/kvm/book3s_64_mmu.c | 8 +++++++- arch/powerpc/kvm/book3s_pr.c | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-)