diff options
author | Tudor Laurentiu <b10716@freescale.com> | 2015-09-25 11:02:23 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2015-10-15 00:58:16 -0400 |
commit | 2daab50e17997424af57d1ab14042a51e9a368ab (patch) | |
tree | ea73f9fc71fda941d4ac6f1861abd00859967157 | |
parent | d4cd4f9586f87a5fc828b4c4698aa4faf56c96fc (diff) |
KVM: PPC: e500: Emulate TMCFG0 TMRN register
Emulate TMCFG0 TMRN register exposing one HW thread per vcpu.
Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
[Laurentiu.Tudor@freescale.com: rebased on latest kernel, use
define instead of hardcoded value, moved code in own function]
Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
Acked-by: Scott Wood <scotttwood@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-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); |