diff options
author | James Hogan <james.hogan@imgtec.com> | 2014-05-29 05:16:28 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-05-30 07:00:35 -0400 |
commit | 48a3c4e4cd6aa1a2270f3dd2a29e44206e4b2428 (patch) | |
tree | 77f5c42307af73b1347d6cfbe77762b6aac89ccf /arch/mips | |
parent | fb6df0cdf0fe6fcb28fe29b965d9141bceaf00a7 (diff) |
MIPS: KVM: Move KVM_{GET,SET}_ONE_REG definitions into kvm_host.h
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>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/include/asm/kvm_host.h | 32 | ||||
-rw-r--r-- | arch/mips/kvm/kvm_mips.c | 31 |
2 files changed, 32 insertions, 31 deletions
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h index f0e25c6d10b2..9f6bfc963a5b 100644 --- a/arch/mips/include/asm/kvm_host.h +++ b/arch/mips/include/asm/kvm_host.h | |||
@@ -19,6 +19,38 @@ | |||
19 | #include <linux/threads.h> | 19 | #include <linux/threads.h> |
20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | 21 | ||
22 | /* MIPS KVM register ids */ | ||
23 | #define MIPS_CP0_32(_R, _S) \ | ||
24 | (KVM_REG_MIPS | KVM_REG_SIZE_U32 | 0x10000 | (8 * (_R) + (_S))) | ||
25 | |||
26 | #define MIPS_CP0_64(_R, _S) \ | ||
27 | (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0x10000 | (8 * (_R) + (_S))) | ||
28 | |||
29 | #define KVM_REG_MIPS_CP0_INDEX MIPS_CP0_32(0, 0) | ||
30 | #define KVM_REG_MIPS_CP0_ENTRYLO0 MIPS_CP0_64(2, 0) | ||
31 | #define KVM_REG_MIPS_CP0_ENTRYLO1 MIPS_CP0_64(3, 0) | ||
32 | #define KVM_REG_MIPS_CP0_CONTEXT MIPS_CP0_64(4, 0) | ||
33 | #define KVM_REG_MIPS_CP0_USERLOCAL MIPS_CP0_64(4, 2) | ||
34 | #define KVM_REG_MIPS_CP0_PAGEMASK MIPS_CP0_32(5, 0) | ||
35 | #define KVM_REG_MIPS_CP0_PAGEGRAIN MIPS_CP0_32(5, 1) | ||
36 | #define KVM_REG_MIPS_CP0_WIRED MIPS_CP0_32(6, 0) | ||
37 | #define KVM_REG_MIPS_CP0_HWRENA MIPS_CP0_32(7, 0) | ||
38 | #define KVM_REG_MIPS_CP0_BADVADDR MIPS_CP0_64(8, 0) | ||
39 | #define KVM_REG_MIPS_CP0_COUNT MIPS_CP0_32(9, 0) | ||
40 | #define KVM_REG_MIPS_CP0_ENTRYHI MIPS_CP0_64(10, 0) | ||
41 | #define KVM_REG_MIPS_CP0_COMPARE MIPS_CP0_32(11, 0) | ||
42 | #define KVM_REG_MIPS_CP0_STATUS MIPS_CP0_32(12, 0) | ||
43 | #define KVM_REG_MIPS_CP0_CAUSE MIPS_CP0_32(13, 0) | ||
44 | #define KVM_REG_MIPS_CP0_EPC MIPS_CP0_64(14, 0) | ||
45 | #define KVM_REG_MIPS_CP0_EBASE MIPS_CP0_64(15, 1) | ||
46 | #define KVM_REG_MIPS_CP0_CONFIG MIPS_CP0_32(16, 0) | ||
47 | #define KVM_REG_MIPS_CP0_CONFIG1 MIPS_CP0_32(16, 1) | ||
48 | #define KVM_REG_MIPS_CP0_CONFIG2 MIPS_CP0_32(16, 2) | ||
49 | #define KVM_REG_MIPS_CP0_CONFIG3 MIPS_CP0_32(16, 3) | ||
50 | #define KVM_REG_MIPS_CP0_CONFIG7 MIPS_CP0_32(16, 7) | ||
51 | #define KVM_REG_MIPS_CP0_XCONTEXT MIPS_CP0_64(20, 0) | ||
52 | #define KVM_REG_MIPS_CP0_ERROREPC MIPS_CP0_64(30, 0) | ||
53 | |||
22 | 54 | ||
23 | #define KVM_MAX_VCPUS 1 | 55 | #define KVM_MAX_VCPUS 1 |
24 | #define KVM_USER_MEM_SLOTS 8 | 56 | #define KVM_USER_MEM_SLOTS 8 |
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index 6b890ebe0e04..3f52d72c19f1 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c | |||
@@ -486,37 +486,6 @@ kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, | |||
486 | return -ENOIOCTLCMD; | 486 | return -ENOIOCTLCMD; |
487 | } | 487 | } |
488 | 488 | ||
489 | #define MIPS_CP0_32(_R, _S) \ | ||
490 | (KVM_REG_MIPS | KVM_REG_SIZE_U32 | 0x10000 | (8 * (_R) + (_S))) | ||
491 | |||
492 | #define MIPS_CP0_64(_R, _S) \ | ||
493 | (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0x10000 | (8 * (_R) + (_S))) | ||
494 | |||
495 | #define KVM_REG_MIPS_CP0_INDEX MIPS_CP0_32(0, 0) | ||
496 | #define KVM_REG_MIPS_CP0_ENTRYLO0 MIPS_CP0_64(2, 0) | ||
497 | #define KVM_REG_MIPS_CP0_ENTRYLO1 MIPS_CP0_64(3, 0) | ||
498 | #define KVM_REG_MIPS_CP0_CONTEXT MIPS_CP0_64(4, 0) | ||
499 | #define KVM_REG_MIPS_CP0_USERLOCAL MIPS_CP0_64(4, 2) | ||
500 | #define KVM_REG_MIPS_CP0_PAGEMASK MIPS_CP0_32(5, 0) | ||
501 | #define KVM_REG_MIPS_CP0_PAGEGRAIN MIPS_CP0_32(5, 1) | ||
502 | #define KVM_REG_MIPS_CP0_WIRED MIPS_CP0_32(6, 0) | ||
503 | #define KVM_REG_MIPS_CP0_HWRENA MIPS_CP0_32(7, 0) | ||
504 | #define KVM_REG_MIPS_CP0_BADVADDR MIPS_CP0_64(8, 0) | ||
505 | #define KVM_REG_MIPS_CP0_COUNT MIPS_CP0_32(9, 0) | ||
506 | #define KVM_REG_MIPS_CP0_ENTRYHI MIPS_CP0_64(10, 0) | ||
507 | #define KVM_REG_MIPS_CP0_COMPARE MIPS_CP0_32(11, 0) | ||
508 | #define KVM_REG_MIPS_CP0_STATUS MIPS_CP0_32(12, 0) | ||
509 | #define KVM_REG_MIPS_CP0_CAUSE MIPS_CP0_32(13, 0) | ||
510 | #define KVM_REG_MIPS_CP0_EPC MIPS_CP0_64(14, 0) | ||
511 | #define KVM_REG_MIPS_CP0_EBASE MIPS_CP0_64(15, 1) | ||
512 | #define KVM_REG_MIPS_CP0_CONFIG MIPS_CP0_32(16, 0) | ||
513 | #define KVM_REG_MIPS_CP0_CONFIG1 MIPS_CP0_32(16, 1) | ||
514 | #define KVM_REG_MIPS_CP0_CONFIG2 MIPS_CP0_32(16, 2) | ||
515 | #define KVM_REG_MIPS_CP0_CONFIG3 MIPS_CP0_32(16, 3) | ||
516 | #define KVM_REG_MIPS_CP0_CONFIG7 MIPS_CP0_32(16, 7) | ||
517 | #define KVM_REG_MIPS_CP0_XCONTEXT MIPS_CP0_64(20, 0) | ||
518 | #define KVM_REG_MIPS_CP0_ERROREPC MIPS_CP0_64(30, 0) | ||
519 | |||
520 | static u64 kvm_mips_get_one_regs[] = { | 489 | static u64 kvm_mips_get_one_regs[] = { |
521 | KVM_REG_MIPS_R0, | 490 | KVM_REG_MIPS_R0, |
522 | KVM_REG_MIPS_R1, | 491 | KVM_REG_MIPS_R1, |