]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
KVM: PPC: Booke-hv: Add one reg interface for SPRG9
authorBharat Bhushan <Bharat.Bhushan@freescale.com>
Fri, 25 Jul 2014 05:51:08 +0000 (11:21 +0530)
committerAlexander Graf <agraf@suse.de>
Mon, 28 Jul 2014 13:23:15 +0000 (15:23 +0200)
We now support SPRG9 for guest, so also add a one reg interface for same
Note: Changes are in bookehv code only as we do not have SPRG9 on booke-pr.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/include/uapi/asm/kvm.h
arch/powerpc/kvm/e500mc.c

index 2bc4a9409a934e4e7416e5a058191eca9dfe2e72..0e56d9e7b2d6f38ccf16d708a016a904fc5e315b 100644 (file)
@@ -555,6 +555,7 @@ struct kvm_get_htab_header {
 
 #define KVM_REG_PPC_DABRX      (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xb8)
 #define KVM_REG_PPC_WORT       (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb9)
+#define KVM_REG_PPC_SPRG9      (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xba)
 
 /* Transactional Memory checkpointed state:
  * This is all GPRs, all VSX regs and a subset of SPRs
index 690499d7669d64827637ce785d628adfc6fa5cc8..164bad2a19bf6c715f771d76ac1f8289a2daa3e5 100644 (file)
@@ -267,14 +267,32 @@ static int kvmppc_core_set_sregs_e500mc(struct kvm_vcpu *vcpu,
 static int kvmppc_get_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id,
                              union kvmppc_one_reg *val)
 {
-       int r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val);
+       int r = 0;
+
+       switch (id) {
+       case KVM_REG_PPC_SPRG9:
+               *val = get_reg_val(id, vcpu->arch.sprg9);
+               break;
+       default:
+               r = kvmppc_get_one_reg_e500_tlb(vcpu, id, val);
+       }
+
        return r;
 }
 
 static int kvmppc_set_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id,
                              union kvmppc_one_reg *val)
 {
-       int r = kvmppc_set_one_reg_e500_tlb(vcpu, id, val);
+       int r = 0;
+
+       switch (id) {
+       case KVM_REG_PPC_SPRG9:
+               vcpu->arch.sprg9 = set_reg_val(id, *val);
+               break;
+       default:
+               r = kvmppc_set_one_reg_e500_tlb(vcpu, id, val);
+       }
+
        return r;
 }