* [PATCH] KVM: PPC: e500: Emulate TMCFG0 TMRN register
@ 2015-09-24 6:56 Laurentiu Tudor
2015-09-24 22:17 ` Scott Wood
0 siblings, 1 reply; 2+ messages in thread
From: Laurentiu Tudor @ 2015-09-24 6:56 UTC (permalink / raw)
To: kvm-ppc
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]
Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
---
Needs this patch: https://patchwork.ozlabs.org/patch/521752/
arch/powerpc/include/asm/disassemble.h | 5 +++++
arch/powerpc/kvm/e500_emulate.c | 11 +++++++++++
2 files changed, 16 insertions(+)
diff --git a/arch/powerpc/include/asm/disassemble.h b/arch/powerpc/include/asm/disassemble.h
index 6330a61..4852e84 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)
return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
}
+static inline unsigned int get_tmrn(u32 inst)
+{
+ return ((inst >> 16) & 0x1f) | ((inst >> 6) & 0x3e0);
+}
+
static inline unsigned int get_rt(u32 inst)
{
return (inst >> 21) & 0x1f;
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index ce7291c..44ac54b 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -15,6 +15,7 @@
#include <asm/kvm_ppc.h>
#include <asm/disassemble.h>
#include <asm/dbell.h>
+#include <asm/reg_booke.h>
#include "booke.h"
#include "e500.h"
@@ -22,6 +23,7 @@
#define XOP_DCBTLS 166
#define XOP_MSGSND 206
#define XOP_MSGCLR 238
+#define XOP_MFTMR 366
#define XOP_TLBIVAX 786
#define XOP_TLBSX 914
#define XOP_TLBRE 946
@@ -165,6 +167,15 @@ int kvmppc_core_emulate_op_e500(struct kvm_run *run, struct kvm_vcpu *vcpu,
emulated = kvmppc_e500_emul_tlbivax(vcpu, ea);
break;
+ case XOP_MFTMR:
+ /* Expose one thread per vcpu */
+ if (get_tmrn(inst) = TMRN_TMCFG0)
+ kvmppc_set_gpr(vcpu, rt,
+ 1 | (1 << TMRN_TMCFG0_NATHRD_SHIFT));
+ else
+ emulated = EMULATE_FAIL;
+ break;
+
case XOP_EHPRIV:
emulated = kvmppc_e500_emul_ehpriv(run, vcpu, inst,
advance);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] KVM: PPC: e500: Emulate TMCFG0 TMRN register
2015-09-24 6:56 [PATCH] KVM: PPC: e500: Emulate TMCFG0 TMRN register Laurentiu Tudor
@ 2015-09-24 22:17 ` Scott Wood
0 siblings, 0 replies; 2+ messages in thread
From: Scott Wood @ 2015-09-24 22:17 UTC (permalink / raw)
To: kvm-ppc
On Thu, 2015-09-24 at 09:56 +0300, Laurentiu Tudor wrote:
> 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]
> Signed-off-by: Laurentiu Tudor <Laurentiu.Tudor@freescale.com>
> ---
> Needs this patch: https://patchwork.ozlabs.org/patch/521752/
>
> arch/powerpc/include/asm/disassemble.h | 5 +++++
> arch/powerpc/kvm/e500_emulate.c | 11 +++++++++++
> 2 files changed, 16 insertions(+)
KVM patches should be sent to kvm@vger.kernel.org in addition to kvm-
ppc@vger.kernel.org.
> @@ -165,6 +167,15 @@ int kvmppc_core_emulate_op_e500(struct kvm_run *run,
> struct kvm_vcpu *vcpu,
> emulated = kvmppc_e500_emul_tlbivax(vcpu, ea);
> break;
>
> + case XOP_MFTMR:
> + /* Expose one thread per vcpu */
> + if (get_tmrn(inst) = TMRN_TMCFG0)
> + kvmppc_set_gpr(vcpu, rt,
> + 1 | (1 << TMRN_TMCFG0_NATHRD_SHIFT));
> + else
> + emulated = EMULATE_FAIL;
> + break;
Line length. Please move the implementation into its own function like all
the others.
-Scott
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-24 22:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24 6:56 [PATCH] KVM: PPC: e500: Emulate TMCFG0 TMRN register Laurentiu Tudor
2015-09-24 22:17 ` Scott Wood
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.