MIPS: KVM: Move KVM_{GET,SET}_ONE_REG definitions into kvm_host.h
authorJames Hogan <james.hogan@imgtec.com>
Thu, 29 May 2014 09:16:28 +0000 (10:16 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 30 May 2014 11:00:35 +0000 (13:00 +0200)
Move the KVM_{GET,SET}_ONE_REG MIPS register id definitions out of
kvm_mips.c to kvm_host.h so that they can be shared between multiple
source files. This allows register access to be indirected depending on
the underlying implementation (trap & emulate or VZ).

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/include/asm/kvm_host.h
arch/mips/kvm/kvm_mips.c

index f0e25c6..9f6bfc9 100644 (file)
 #include <linux/threads.h>
 #include <linux/spinlock.h>
 
+/* MIPS KVM register ids */
+#define MIPS_CP0_32(_R, _S)                                    \
+       (KVM_REG_MIPS | KVM_REG_SIZE_U32 | 0x10000 | (8 * (_R) + (_S)))
+
+#define MIPS_CP0_64(_R, _S)                                    \
+       (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0x10000 | (8 * (_R) + (_S)))
+
+#define KVM_REG_MIPS_CP0_INDEX         MIPS_CP0_32(0, 0)
+#define KVM_REG_MIPS_CP0_ENTRYLO0      MIPS_CP0_64(2, 0)
+#define KVM_REG_MIPS_CP0_ENTRYLO1      MIPS_CP0_64(3, 0)
+#define KVM_REG_MIPS_CP0_CONTEXT       MIPS_CP0_64(4, 0)
+#define KVM_REG_MIPS_CP0_USERLOCAL     MIPS_CP0_64(4, 2)
+#define KVM_REG_MIPS_CP0_PAGEMASK      MIPS_CP0_32(5, 0)
+#define KVM_REG_MIPS_CP0_PAGEGRAIN     MIPS_CP0_32(5, 1)
+#define KVM_REG_MIPS_CP0_WIRED         MIPS_CP0_32(6, 0)
+#define KVM_REG_MIPS_CP0_HWRENA                MIPS_CP0_32(7, 0)
+#define KVM_REG_MIPS_CP0_BADVADDR      MIPS_CP0_64(8, 0)
+#define KVM_REG_MIPS_CP0_COUNT         MIPS_CP0_32(9, 0)
+#define KVM_REG_MIPS_CP0_ENTRYHI       MIPS_CP0_64(10, 0)
+#define KVM_REG_MIPS_CP0_COMPARE       MIPS_CP0_32(11, 0)
+#define KVM_REG_MIPS_CP0_STATUS                MIPS_CP0_32(12, 0)
+#define KVM_REG_MIPS_CP0_CAUSE         MIPS_CP0_32(13, 0)
+#define KVM_REG_MIPS_CP0_EPC           MIPS_CP0_64(14, 0)
+#define KVM_REG_MIPS_CP0_EBASE         MIPS_CP0_64(15, 1)
+#define KVM_REG_MIPS_CP0_CONFIG                MIPS_CP0_32(16, 0)
+#define KVM_REG_MIPS_CP0_CONFIG1       MIPS_CP0_32(16, 1)
+#define KVM_REG_MIPS_CP0_CONFIG2       MIPS_CP0_32(16, 2)
+#define KVM_REG_MIPS_CP0_CONFIG3       MIPS_CP0_32(16, 3)
+#define KVM_REG_MIPS_CP0_CONFIG7       MIPS_CP0_32(16, 7)
+#define KVM_REG_MIPS_CP0_XCONTEXT      MIPS_CP0_64(20, 0)
+#define KVM_REG_MIPS_CP0_ERROREPC      MIPS_CP0_64(30, 0)
+
 
 #define KVM_MAX_VCPUS          1
 #define KVM_USER_MEM_SLOTS     8
index 6b890eb..3f52d72 100644 (file)
@@ -486,37 +486,6 @@ kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
        return -ENOIOCTLCMD;
 }
 
-#define MIPS_CP0_32(_R, _S)                                    \
-       (KVM_REG_MIPS | KVM_REG_SIZE_U32 | 0x10000 | (8 * (_R) + (_S)))
-
-#define MIPS_CP0_64(_R, _S)                                    \
-       (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0x10000 | (8 * (_R) + (_S)))
-
-#define KVM_REG_MIPS_CP0_INDEX         MIPS_CP0_32(0, 0)
-#define KVM_REG_MIPS_CP0_ENTRYLO0      MIPS_CP0_64(2, 0)
-#define KVM_REG_MIPS_CP0_ENTRYLO1      MIPS_CP0_64(3, 0)
-#define KVM_REG_MIPS_CP0_CONTEXT       MIPS_CP0_64(4, 0)
-#define KVM_REG_MIPS_CP0_USERLOCAL     MIPS_CP0_64(4, 2)
-#define KVM_REG_MIPS_CP0_PAGEMASK      MIPS_CP0_32(5, 0)
-#define KVM_REG_MIPS_CP0_PAGEGRAIN     MIPS_CP0_32(5, 1)
-#define KVM_REG_MIPS_CP0_WIRED         MIPS_CP0_32(6, 0)
-#define KVM_REG_MIPS_CP0_HWRENA                MIPS_CP0_32(7, 0)
-#define KVM_REG_MIPS_CP0_BADVADDR      MIPS_CP0_64(8, 0)
-#define KVM_REG_MIPS_CP0_COUNT         MIPS_CP0_32(9, 0)
-#define KVM_REG_MIPS_CP0_ENTRYHI       MIPS_CP0_64(10, 0)
-#define KVM_REG_MIPS_CP0_COMPARE       MIPS_CP0_32(11, 0)
-#define KVM_REG_MIPS_CP0_STATUS                MIPS_CP0_32(12, 0)
-#define KVM_REG_MIPS_CP0_CAUSE         MIPS_CP0_32(13, 0)
-#define KVM_REG_MIPS_CP0_EPC           MIPS_CP0_64(14, 0)
-#define KVM_REG_MIPS_CP0_EBASE         MIPS_CP0_64(15, 1)
-#define KVM_REG_MIPS_CP0_CONFIG                MIPS_CP0_32(16, 0)
-#define KVM_REG_MIPS_CP0_CONFIG1       MIPS_CP0_32(16, 1)
-#define KVM_REG_MIPS_CP0_CONFIG2       MIPS_CP0_32(16, 2)
-#define KVM_REG_MIPS_CP0_CONFIG3       MIPS_CP0_32(16, 3)
-#define KVM_REG_MIPS_CP0_CONFIG7       MIPS_CP0_32(16, 7)
-#define KVM_REG_MIPS_CP0_XCONTEXT      MIPS_CP0_64(20, 0)
-#define KVM_REG_MIPS_CP0_ERROREPC      MIPS_CP0_64(30, 0)
-
 static u64 kvm_mips_get_one_regs[] = {
        KVM_REG_MIPS_R0,
        KVM_REG_MIPS_R1,