diff mbox

[1/2,v2] KVM: PPC: move tsr update in a separate function

Message ID 1360665344-19032-2-git-send-email-bharat.bhushan@freescale.com
State New, archived
Headers show

Commit Message

Bharat Bhushan Feb. 12, 2013, 10:35 a.m. UTC
This is done so that same function can be called from SREGS and
ONE_REG interface (follow up patch).

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
v2:
 No Change

 arch/powerpc/kvm/booke.c |   24 ++++++++++++++----------
 arch/powerpc/kvm/booke.h |    1 +
 2 files changed, 15 insertions(+), 10 deletions(-)

Comments

Alexander Graf Feb. 21, 2013, 1:48 p.m. UTC | #1
On 12.02.2013, at 11:35, Bharat Bhushan wrote:

> This is done so that same function can be called from SREGS and
> ONE_REG interface (follow up patch).
> 
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> ---
> v2:
> No Change
> 
> arch/powerpc/kvm/booke.c |   24 ++++++++++++++----------
> arch/powerpc/kvm/booke.h |    1 +
> 2 files changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 020923e..7bf62f8 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -1287,16 +1287,8 @@ static int set_sregs_base(struct kvm_vcpu *vcpu,
> 		kvmppc_emulate_dec(vcpu);
> 	}
> 
> -	if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_TSR) {
> -		u32 old_tsr = vcpu->arch.tsr;
> -
> -		vcpu->arch.tsr = sregs->u.e.tsr;
> -
> -		if ((old_tsr ^ vcpu->arch.tsr) & (TSR_ENW | TSR_WIS))
> -			arm_next_watchdog(vcpu);
> -
> -		update_timer_ints(vcpu);
> -	}
> +	if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_TSR)
> +		kvmppc_set_tsr(vcpu, sregs->u.e.tsr);
> 
> 	return 0;
> }
> @@ -1558,6 +1550,18 @@ void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr)
> 	update_timer_ints(vcpu);
> }
> 
> +void kvmppc_set_tsr(struct kvm_vcpu *vcpu, u32 new_tsr)

static, no? This only gets called from booke.c.

> +{
> +	u32 old_tsr = vcpu->arch.tsr;
> +
> +	vcpu->arch.tsr = new_tsr;
> +
> +	if ((old_tsr ^ vcpu->arch.tsr) & (TSR_ENW | TSR_WIS))
> +		arm_next_watchdog(vcpu);
> +
> +	update_timer_ints(vcpu);
> +}
> +
> void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits)
> {
> 	set_bits(tsr_bits, &vcpu->arch.tsr);
> diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
> index 5fd1ba6..71ed392 100644
> --- a/arch/powerpc/kvm/booke.h
> +++ b/arch/powerpc/kvm/booke.h
> @@ -72,6 +72,7 @@ void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr);
> 
> void kvmppc_set_epcr(struct kvm_vcpu *vcpu, u32 new_epcr);
> void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr);
> +void kvmppc_set_tsr(struct kvm_vcpu *vcpu, u32 new_tcr);

No need for this :)


Alex

> void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);
> void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);
> 
> -- 
> 1.7.0.4
> 
> 
> --
> 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

--
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 020923e..7bf62f8 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1287,16 +1287,8 @@  static int set_sregs_base(struct kvm_vcpu *vcpu,
 		kvmppc_emulate_dec(vcpu);
 	}
 
-	if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_TSR) {
-		u32 old_tsr = vcpu->arch.tsr;
-
-		vcpu->arch.tsr = sregs->u.e.tsr;
-
-		if ((old_tsr ^ vcpu->arch.tsr) & (TSR_ENW | TSR_WIS))
-			arm_next_watchdog(vcpu);
-
-		update_timer_ints(vcpu);
-	}
+	if (sregs->u.e.update_special & KVM_SREGS_E_UPDATE_TSR)
+		kvmppc_set_tsr(vcpu, sregs->u.e.tsr);
 
 	return 0;
 }
@@ -1558,6 +1550,18 @@  void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr)
 	update_timer_ints(vcpu);
 }
 
+void kvmppc_set_tsr(struct kvm_vcpu *vcpu, u32 new_tsr)
+{
+	u32 old_tsr = vcpu->arch.tsr;
+
+	vcpu->arch.tsr = new_tsr;
+
+	if ((old_tsr ^ vcpu->arch.tsr) & (TSR_ENW | TSR_WIS))
+		arm_next_watchdog(vcpu);
+
+	update_timer_ints(vcpu);
+}
+
 void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits)
 {
 	set_bits(tsr_bits, &vcpu->arch.tsr);
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
index 5fd1ba6..71ed392 100644
--- a/arch/powerpc/kvm/booke.h
+++ b/arch/powerpc/kvm/booke.h
@@ -72,6 +72,7 @@  void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr);
 
 void kvmppc_set_epcr(struct kvm_vcpu *vcpu, u32 new_epcr);
 void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr);
+void kvmppc_set_tsr(struct kvm_vcpu *vcpu, u32 new_tcr);
 void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);
 void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);