From: Alexander Graf <agraf@suse.de>
To: "kvm@vger.kernel.org list" <kvm@vger.kernel.org>
Cc: Avi Kivity <avi@redhat.com>, kvm-ppc <kvm-ppc@vger.kernel.org>,
Marcelo Tossati <mtosatti@redhat.com>,
Bharat Bhushan <r65777@freescale.com>,
Bharat Bhushan <bharat.bhushan@freescale.com>
Subject: [PATCH 3/4] KVM: PPC: booke: Added DECAR support
Date: Wed, 30 May 2012 09:54:45 +0000 [thread overview]
Message-ID: <1338371686-8194-4-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1338371686-8194-1-git-send-email-agraf@suse.de>
From: Bharat Bhushan <r65777@freescale.com>
Added the decrementer auto-reload support. DECAR is readable
on e500v2/e500mc and later cpus.
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/include/asm/kvm_host.h | 2 ++
arch/powerpc/kvm/booke.c | 5 +++++
arch/powerpc/kvm/booke_emulate.c | 3 +++
arch/powerpc/kvm/e500_emulate.c | 3 +++
4 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index dd783be..50ea12f 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -418,7 +418,9 @@ struct kvm_vcpu_arch {
ulong mcsrr1;
ulong mcsr;
u32 dec;
+#ifdef CONFIG_BOOKE
u32 decar;
+#endif
u32 tbl;
u32 tbu;
u32 tcr;
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 72f13f4..86681ee 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1267,6 +1267,11 @@ void kvmppc_decrementer_func(unsigned long data)
{
struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
+ if (vcpu->arch.tcr & TCR_ARE) {
+ vcpu->arch.dec = vcpu->arch.decar;
+ kvmppc_emulate_dec(vcpu);
+ }
+
kvmppc_set_tsr_bits(vcpu, TSR_DIS);
}
diff --git a/arch/powerpc/kvm/booke_emulate.c b/arch/powerpc/kvm/booke_emulate.c
index 6c76397..9eb9809 100644
--- a/arch/powerpc/kvm/booke_emulate.c
+++ b/arch/powerpc/kvm/booke_emulate.c
@@ -129,6 +129,9 @@ int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)
kvmppc_set_tcr(vcpu, spr_val);
break;
+ case SPRN_DECAR:
+ vcpu->arch.decar = spr_val;
+ break;
/*
* Note: SPRG4-7 are user-readable.
* These values are loaded into the real SPRGs when resuming the
diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
index 8b99e07..e04b0ef 100644
--- a/arch/powerpc/kvm/e500_emulate.c
+++ b/arch/powerpc/kvm/e500_emulate.c
@@ -269,6 +269,9 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
*spr_val = vcpu->arch.shared->mas7_3 >> 32;
break;
#endif
+ case SPRN_DECAR:
+ *spr_val = vcpu->arch.decar;
+ break;
case SPRN_TLB0CFG:
*spr_val = vcpu->arch.tlbcfg[0];
break;
--
1.6.0.2
next prev parent reply other threads:[~2012-05-30 9:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-30 9:54 [PULL 0/4] ppc patch queue 2012-05-30 Alexander Graf
2012-05-30 9:54 ` [PATCH 1/4] KVM: PPC: Factor out guest epapr initialization Alexander Graf
2012-05-30 9:54 ` [PATCH 2/4] KVM: PPC: Book3S HV: Make the guest hash table size configurable Alexander Graf
2012-05-30 9:54 ` Alexander Graf [this message]
2012-05-30 9:54 ` [PATCH 4/4] KVM: PPC: Not optimizing MSR_CE and MSR_ME with paravirt Alexander Graf
2012-06-06 12:32 ` [PULL 0/4] ppc patch queue 2012-05-30 Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1338371686-8194-4-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=avi@redhat.com \
--cc=bharat.bhushan@freescale.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=r65777@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox