[2/4] KVM: PPC: BookE: Emulate mfspr on EPR

Submitted by Alexander Graf on Jan. 4, 2013, 5:36 p.m.

Details

Message ID 1357321000-31008-3-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf Jan. 4, 2013, 5:36 p.m.
The EPR register is potentially valid for PR KVM as well, so we need
to emulate accesses to it. It's only defined for reading, so only
handle the mfspr case.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/booke_emulate.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Scott Wood Jan. 4, 2013, 7:50 p.m.
On 01/04/2013 11:36:38 AM, Alexander Graf wrote:
> The EPR register is potentially valid for PR KVM as well, so we need
> to emulate accesses to it. It's only defined for reading, so only
> handle the mfspr case.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  arch/powerpc/kvm/booke_emulate.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/booke_emulate.c  
> b/arch/powerpc/kvm/booke_emulate.c
> index 4685b8c..27a4b28 100644
> --- a/arch/powerpc/kvm/booke_emulate.c
> +++ b/arch/powerpc/kvm/booke_emulate.c
> @@ -269,6 +269,9 @@ int kvmppc_booke_emulate_mfspr(struct kvm_vcpu  
> *vcpu, int sprn, ulong *spr_val)
>  	case SPRN_ESR:
>  		*spr_val = vcpu->arch.shared->esr;
>  		break;
> +	case SPRN_EPR:
> +		*spr_val = vcpu->arch.epr;
> +		break;

It's not just potentially valid -- in our internal tree we do paravirt  
EPR on e500v2 even though the hardware doesn't implement it.

-Scott
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Graf Jan. 4, 2013, 11:11 p.m.
On 04.01.2013, at 20:50, Scott Wood wrote:

> On 01/04/2013 11:36:38 AM, Alexander Graf wrote:
>> The EPR register is potentially valid for PR KVM as well, so we need
>> to emulate accesses to it. It's only defined for reading, so only
>> handle the mfspr case.
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> arch/powerpc/kvm/booke_emulate.c |    3 +++
>> 1 files changed, 3 insertions(+), 0 deletions(-)
>> diff --git a/arch/powerpc/kvm/booke_emulate.c b/arch/powerpc/kvm/booke_emulate.c
>> index 4685b8c..27a4b28 100644
>> --- a/arch/powerpc/kvm/booke_emulate.c
>> +++ b/arch/powerpc/kvm/booke_emulate.c
>> @@ -269,6 +269,9 @@ int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
>> 	case SPRN_ESR:
>> 		*spr_val = vcpu->arch.shared->esr;
>> 		break;
>> +	case SPRN_EPR:
>> +		*spr_val = vcpu->arch.epr;
>> +		break;
> 
> It's not just potentially valid -- in our internal tree we do paravirt EPR on e500v2 even though the hardware doesn't implement it.

I want to later add a flag to the QEMU e500 pv machine indicating that we support EPR. Once we get that, any e500 target cpu can use EPR.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch hide | download patch | download mbox

diff --git a/arch/powerpc/kvm/booke_emulate.c b/arch/powerpc/kvm/booke_emulate.c
index 4685b8c..27a4b28 100644
--- a/arch/powerpc/kvm/booke_emulate.c
+++ b/arch/powerpc/kvm/booke_emulate.c
@@ -269,6 +269,9 @@  int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val)
 	case SPRN_ESR:
 		*spr_val = vcpu->arch.shared->esr;
 		break;
+	case SPRN_EPR:
+		*spr_val = vcpu->arch.epr;
+		break;
 	case SPRN_CSRR0:
 		*spr_val = vcpu->arch.csrr0;
 		break;