MIPS: KVM: Add CP0_HWREna KVM register access
authorJames Hogan <james.hogan@imgtec.com>
Thu, 29 May 2014 09:16:31 +0000 (10:16 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 30 May 2014 11:01:03 +0000 (13:01 +0200)
Implement KVM_{GET,SET}_ONE_REG ioctl based access to the guest CP0
HWREna register. This is so that userland can save and restore its
value so that RDHWR instructions don't have to be emulated by the guest.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: David Daney <david.daney@cavium.com>
Cc: Sanjay Lal <sanjayl@kymasys.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/mips/kvm/kvm_mips.c

index 26f10fb8dcba9745bc65fe4386b05cf6b9e12d1f..e4cb7cff9a282d6d53fd08fb1b43d662b5ac7826 100644 (file)
@@ -529,6 +529,7 @@ static u64 kvm_mips_get_one_regs[] = {
        KVM_REG_MIPS_CP0_USERLOCAL,
        KVM_REG_MIPS_CP0_PAGEMASK,
        KVM_REG_MIPS_CP0_WIRED,
+       KVM_REG_MIPS_CP0_HWRENA,
        KVM_REG_MIPS_CP0_BADVADDR,
        KVM_REG_MIPS_CP0_COUNT,
        KVM_REG_MIPS_CP0_ENTRYHI,
@@ -580,6 +581,9 @@ static int kvm_mips_get_reg(struct kvm_vcpu *vcpu,
        case KVM_REG_MIPS_CP0_WIRED:
                v = (long)kvm_read_c0_guest_wired(cop0);
                break;
+       case KVM_REG_MIPS_CP0_HWRENA:
+               v = (long)kvm_read_c0_guest_hwrena(cop0);
+               break;
        case KVM_REG_MIPS_CP0_BADVADDR:
                v = (long)kvm_read_c0_guest_badvaddr(cop0);
                break;
@@ -691,6 +695,9 @@ static int kvm_mips_set_reg(struct kvm_vcpu *vcpu,
        case KVM_REG_MIPS_CP0_WIRED:
                kvm_write_c0_guest_wired(cop0, v);
                break;
+       case KVM_REG_MIPS_CP0_HWRENA:
+               kvm_write_c0_guest_hwrena(cop0, v);
+               break;
        case KVM_REG_MIPS_CP0_BADVADDR:
                kvm_write_c0_guest_badvaddr(cop0, v);
                break;