From: Alexander Graf <agraf@suse.de>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: booke: Added DECAR support
Date: Wed, 16 May 2012 09:06:21 +0000 [thread overview]
Message-ID: <4FB36E0D.20006@suse.de> (raw)
In-Reply-To: <1337067209-26435-1-git-send-email-bharat.bhushan@freescale.com>
On 05/16/2012 08:57 AM, Bhushan Bharat-R65777 wrote:
>
>> -----Original Message-----
>> From: Alexander Graf [mailto:agraf@suse.de]
>> Sent: Tuesday, May 15, 2012 7:59 PM
>> To: Bhushan Bharat-R65777
>> Cc: kvm-ppc@vger.kernel.org; Bhushan Bharat-R65777
>> Subject: Re: [PATCH] KVM: PPC: booke: Added DECAR support
>>
>> On 05/15/2012 09:33 AM, Bharat Bhushan wrote:
>>> Added the decrementer auto-reload support.
>>>
>>> Signed-off-by: Bharat Bhushan<bharat.bhushan@freescale.com>
>>> ---
>>> arch/powerpc/include/asm/kvm_host.h | 2 ++
>>> arch/powerpc/kvm/booke.c | 5 +++++
>>> arch/powerpc/kvm/booke_emulate.c | 7 ++++++-
>>> 3 files changed, 13 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/powerpc/include/asm/kvm_host.h
>>> b/arch/powerpc/include/asm/kvm_host.h
>>> index d848cdc..1d6f89e 100644
>>> --- a/arch/powerpc/include/asm/kvm_host.h
>>> +++ b/arch/powerpc/include/asm/kvm_host.h
>>> @@ -414,7 +414,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..83c3796 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 @@
>>> -244,7 +247,9 @@ int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int
>> sprn, ulong *spr_val)
>>> case SPRN_TCR:
>>> *spr_val = vcpu->arch.tcr;
>>> break;
>>> -
>>> + case SPRN_DECAR:
>>> + *spr_val = vcpu->arch.decar;
>>> + break;
>> DECAR can't be read. Otherwise looks good to me.
> DECAR can be read on e500mc cores. So I will make this under CONFIG_KVM_E500MC.
>
> What happens if DECAR is read on non e500mc? Is it treated as NOP or illegal instruction exception?
I would assume the latter. NOPs usually don't happen. If anything, it
would return 0.
See section 9.4 in the PowerISA:
The contents of the Decrementer Auto-Reload Register
cannot be read. The contents of bits 32:63 of register
RS can be written to the Decrementer Auto-Reload
Register using the mtspr instruction.
Could you please paste the respective passage of the e500mc manual that
declares DECAR as readable?
Alex
next prev parent reply other threads:[~2012-05-16 9:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-15 7:45 [PATCH] KVM: PPC: booke: Added DECAR support Bharat Bhushan
2012-05-15 14:28 ` Alexander Graf
2012-05-16 6:57 ` Bhushan Bharat-R65777
2012-05-16 9:06 ` Alexander Graf [this message]
2012-05-16 9:21 ` Bhushan Bharat-R65777
2012-05-16 9:23 ` Alexander Graf
2012-05-21 4:28 ` Bhushan Bharat-R65777
2012-05-21 6:18 ` Alexander Graf
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=4FB36E0D.20006@suse.de \
--to=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
/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 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.