diff mbox

[11/12] KVM: PPC: booke: Add EPCR support in sregs

Message ID 1349972009-23027-12-git-send-email-mihai.caraman@freescale.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Mihai Caraman Oct. 11, 2012, 4:13 p.m. UTC
Add KVM_SREGS_E_64 feature and EPCR spr support in get/set sregs for 64-bit
hosts.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
 arch/powerpc/kvm/booke.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comments

Alexander Graf Dec. 1, 2012, 2:02 p.m. UTC | #1
On 11.10.2012, at 18:13, Mihai Caraman wrote:

> Add KVM_SREGS_E_64 feature and EPCR spr support in get/set sregs for 64-bit
> hosts.

Why would we need this if we have a proper ONE_REG interface for EPCR?


Alex

> 
> Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
> ---
> arch/powerpc/kvm/booke.c |    7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index e6159f5..d396374 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -1215,6 +1215,9 @@ static void get_sregs_base(struct kvm_vcpu *vcpu,
> 	u64 tb = get_tb();
> 
> 	sregs->u.e.features |= KVM_SREGS_E_BASE;
> +#ifdef CONFIG_64BIT
> +	sregs->u.e.features |= KVM_SREGS_E_64;
> +#endif
> 
> 	sregs->u.e.csrr0 = vcpu->arch.csrr0;
> 	sregs->u.e.csrr1 = vcpu->arch.csrr1;
> @@ -1226,6 +1229,9 @@ static void get_sregs_base(struct kvm_vcpu *vcpu,
> 	sregs->u.e.dec = kvmppc_get_dec(vcpu, tb);
> 	sregs->u.e.tb = tb;
> 	sregs->u.e.vrsave = vcpu->arch.vrsave;
> +#if defined(CONFIG_64BIT) && defined(CONFIG_KVM_BOOKE_HV)
> +	sregs->u.e.epcr = vcpu->arch.epcr;
> +#endif
> }
> 
> static int set_sregs_base(struct kvm_vcpu *vcpu,
> @@ -1241,6 +1247,7 @@ static int set_sregs_base(struct kvm_vcpu *vcpu,
> 	set_guest_dear(vcpu, sregs->u.e.dear);
> 	vcpu->arch.vrsave = sregs->u.e.vrsave;
> 	kvmppc_set_tcr(vcpu, sregs->u.e.tcr);
> +	kvmppc_set_epcr(vcpu, sregs->u.e.epcr);
> 
> 	if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_DEC) {
> 		vcpu->arch.dec = sregs->u.e.dec;
> -- 
> 1.7.4.1
> 
> 
> --
> 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
diff mbox

Patch

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index e6159f5..d396374 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1215,6 +1215,9 @@  static void get_sregs_base(struct kvm_vcpu *vcpu,
 	u64 tb = get_tb();
 
 	sregs->u.e.features |= KVM_SREGS_E_BASE;
+#ifdef CONFIG_64BIT
+	sregs->u.e.features |= KVM_SREGS_E_64;
+#endif
 
 	sregs->u.e.csrr0 = vcpu->arch.csrr0;
 	sregs->u.e.csrr1 = vcpu->arch.csrr1;
@@ -1226,6 +1229,9 @@  static void get_sregs_base(struct kvm_vcpu *vcpu,
 	sregs->u.e.dec = kvmppc_get_dec(vcpu, tb);
 	sregs->u.e.tb = tb;
 	sregs->u.e.vrsave = vcpu->arch.vrsave;
+#if defined(CONFIG_64BIT) && defined(CONFIG_KVM_BOOKE_HV)
+	sregs->u.e.epcr = vcpu->arch.epcr;
+#endif
 }
 
 static int set_sregs_base(struct kvm_vcpu *vcpu,
@@ -1241,6 +1247,7 @@  static int set_sregs_base(struct kvm_vcpu *vcpu,
 	set_guest_dear(vcpu, sregs->u.e.dear);
 	vcpu->arch.vrsave = sregs->u.e.vrsave;
 	kvmppc_set_tcr(vcpu, sregs->u.e.tcr);
+	kvmppc_set_epcr(vcpu, sregs->u.e.epcr);
 
 	if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_DEC) {
 		vcpu->arch.dec = sregs->u.e.dec;