diff options
-rw-r--r-- | arch/powerpc/include/asm/disassemble.h | 5 | ||||
-rw-r--r-- | arch/powerpc/kvm/e500_emulate.c | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/disassemble.h b/arch/powerpc/include/asm/disassemble.h index 6330a61b875a..4852e849128b 100644 --- a/arch/powerpc/include/asm/disassemble.h +++ b/arch/powerpc/include/asm/disassemble.h | |||
@@ -42,6 +42,11 @@ static inline unsigned int get_dcrn(u32 inst) | |||
42 | return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0); | 42 | return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0); |
43 | } | 43 | } |
44 | 44 | ||
45 | static inline unsigned int get_tmrn(u32 inst) | ||
46 | { | ||
47 | return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0); | ||
48 | } | ||
49 | |||
45 | static inline unsigned int get_rt(u32 inst) | 50 | static inline unsigned int get_rt(u32 inst) |
46 | { | 51 | { |
47 | return (inst >> 21) & 0x1f; | 52 | return (inst >> 21) & 0x1f; |
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c index ce7291c79f6c..990db69a1d0b 100644 --- a/arch/powerpc/kvm/e500_emulate.c +++ b/arch/powerpc/kvm/e500_emulate.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/kvm_ppc.h> | 15 | #include <asm/kvm_ppc.h> |
16 | #include <asm/disassemble.h> | 16 | #include <asm/disassemble.h> |
17 | #include <asm/dbell.h> | 17 | #include <asm/dbell.h> |
18 | #include <asm/reg_booke.h> | ||
18 | 19 | ||
19 | #include "booke.h" | 20 | #include "booke.h" |
20 | #include "e500.h" | 21 | #include "e500.h" |
@@ -22,6 +23,7 @@ | |||
22 | #define XOP_DCBTLS 166 | 23 | #define XOP_DCBTLS 166 |
23 | #define XOP_MSGSND 206 | 24 | #define XOP_MSGSND 206 |
24 | #define XOP_MSGCLR 238 | 25 | #define XOP_MSGCLR 238 |
26 | #define XOP_MFTMR 366 | ||
25 | #define XOP_TLBIVAX 786 | 27 | #define XOP_TLBIVAX 786 |
26 | #define XOP_TLBSX 914 | 28 | #define XOP_TLBSX 914 |
27 | #define XOP_TLBRE 946 | 29 | #define XOP_TLBRE 946 |
@@ -113,6 +115,19 @@ static int kvmppc_e500_emul_dcbtls(struct kvm_vcpu *vcpu) | |||
113 | return EMULATE_DONE; | 115 | return EMULATE_DONE; |
114 | } | 116 | } |
115 | 117 | ||
118 | static int kvmppc_e500_emul_mftmr(struct kvm_vcpu *vcpu, unsigned int inst, | ||
119 | int rt) | ||
120 | { | ||
121 | /* Expose one thread per vcpu */ | ||
122 | if (get_tmrn(inst) == TMRN_TMCFG0) { | ||
123 | kvmppc_set_gpr(vcpu, rt, | ||
124 | 1 | (1 << TMRN_TMCFG0_NATHRD_SHIFT)); | ||
125 | return EMULATE_DONE; | ||
126 | } | ||
127 | |||
128 | return EMULATE_FAIL; | ||
129 | } | ||
130 | |||
116 | int kvmppc_core_emulate_op_e500(struct kvm_run *run, struct kvm_vcpu *vcpu, | 131 | int kvmppc_core_emulate_op_e500(struct kvm_run *run, struct kvm_vcpu *vcpu, |
117 | unsigned int inst, int *advance) | 132 | unsigned int inst, int *advance) |
118 | { | 133 | { |
@@ -165,6 +180,10 @@ int kvmppc_core_emulate_op_e500(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
165 | emulated = kvmppc_e500_emul_tlbivax(vcpu, ea); | 180 | emulated = kvmppc_e500_emul_tlbivax(vcpu, ea); |
166 | break; | 181 | break; |
167 | 182 | ||
183 | case XOP_MFTMR: | ||
184 | emulated = kvmppc_e500_emul_mftmr(vcpu, inst, rt); | ||
185 | break; | ||
186 | |||
168 | case XOP_EHPRIV: | 187 | case XOP_EHPRIV: |
169 | emulated = kvmppc_e500_emul_ehpriv(run, vcpu, inst, | 188 | emulated = kvmppc_e500_emul_ehpriv(run, vcpu, inst, |
170 | advance); | 189 | advance); |