All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: kvm-ppc@vger.kernel.org
Cc: "kvm@vger.kernel.org mailing list" <kvm@vger.kernel.org>,
	Gleb Natapov <gleb@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Bharat Bhushan <r65777@freescale.com>,
	Bharat Bhushan <bharat.bhushan@freescale.com>
Subject: [PATCH 1/7] KVM: PPC: move tsr update in a separate function
Date: Fri, 22 Mar 2013 14:25:57 +0000	[thread overview]
Message-ID: <1363962363-7968-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1363962363-7968-1-git-send-email-agraf@suse.de>

From: Bharat Bhushan <r65777@freescale.com>

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>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/booke.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index eb88fa6..f2fd47d 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1148,6 +1148,18 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
 	return r;
 }
 
+static 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);
+}
+
 /* Initial guest state: 16MB mapping 0 -> 0, PC = 0, MSR = 0, R1 = 16MB */
 int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 {
@@ -1287,16 +1299,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;
 }
-- 
1.6.0.2


WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: kvm-ppc@vger.kernel.org
Cc: "kvm@vger.kernel.org mailing list" <kvm@vger.kernel.org>,
	Gleb Natapov <gleb@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Bharat Bhushan <r65777@freescale.com>,
	Bharat Bhushan <bharat.bhushan@freescale.com>
Subject: [PATCH 1/7] KVM: PPC: move tsr update in a separate function
Date: Fri, 22 Mar 2013 15:25:57 +0100	[thread overview]
Message-ID: <1363962363-7968-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1363962363-7968-1-git-send-email-agraf@suse.de>

From: Bharat Bhushan <r65777@freescale.com>

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>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/booke.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index eb88fa6..f2fd47d 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1148,6 +1148,18 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
 	return r;
 }
 
+static 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);
+}
+
 /* Initial guest state: 16MB mapping 0 -> 0, PC = 0, MSR = 0, R1 = 16MB */
 int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 {
@@ -1287,16 +1299,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;
 }
-- 
1.6.0.2

  reply	other threads:[~2013-03-22 14:25 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 14:25 [PULL 0/7] ppc patch queue 2013-03-22 Alexander Graf
2013-03-22 14:25 ` Alexander Graf
2013-03-22 14:25 ` Alexander Graf [this message]
2013-03-22 14:25   ` [PATCH 1/7] KVM: PPC: move tsr update in a separate function Alexander Graf
2013-03-22 14:25 ` [PATCH 2/7] KVM: PPC: Added one_reg interface for timer registers Alexander Graf
2013-03-22 14:25   ` Alexander Graf
2013-03-22 14:25 ` [PATCH 3/7] KVM: PPC: booke: Added debug handler Alexander Graf
2013-03-22 14:25   ` Alexander Graf
2013-03-22 14:26 ` [PATCH 4/7] kvm/ppc/e500: h2g_tlb1_rmap: esel 0 is valid Alexander Graf
2013-03-22 14:26   ` Alexander Graf
2013-03-22 14:26 ` [PATCH 5/7] kvm/ppc/e500: g2h_tlb1_map: clear old bit before setting new bit Alexander Graf
2013-03-22 14:26   ` Alexander Graf
2013-03-22 14:26 ` [PATCH 6/7] kvm/ppc/e500: eliminate tlb_refs Alexander Graf
2013-03-22 14:26   ` Alexander Graf
2013-03-22 14:26 ` [PATCH 7/7] KVM: PPC: Remove unused argument to kvmppc_core_dequeue_external Alexander Graf
2013-03-22 14:26   ` Alexander Graf
2013-03-24  9:45 ` [PULL 0/7] ppc patch queue 2013-03-22 Gleb Natapov
2013-03-24  9:45   ` Gleb Natapov
2013-03-25 22:21 ` Scott Wood
2013-03-25 22:21   ` Scott Wood
2013-03-25 22:32   ` Alexander Graf
2013-03-25 22:32     ` Alexander Graf
2013-03-25 22:54     ` Scott Wood
2013-03-25 22:54       ` Scott Wood
2013-03-25 22:59       ` Alexander Graf
2013-03-25 22:59         ` Alexander Graf
2013-03-25 23:16         ` Scott Wood
2013-03-25 23:16           ` Scott Wood
2013-03-25 23:35           ` Alexander Graf
2013-03-25 23:35             ` Alexander Graf
2013-03-26  1:33             ` Gleb Natapov
2013-03-26  1:33               ` Gleb Natapov
2013-03-26  1:59               ` Paul Mackerras
2013-03-26  1:59                 ` Paul Mackerras
2013-04-11 13:45                 ` Marcelo Tosatti
2013-04-11 13:45                   ` Marcelo Tosatti
2013-04-11 13:50                   ` Alexander Graf
2013-04-11 13:50                     ` Alexander Graf
2013-04-12 20:54                     ` Marcelo Tosatti
2013-04-12 20:54                       ` Marcelo Tosatti
2013-04-12 20:56                       ` Alexander Graf
2013-04-12 20:56                         ` Alexander Graf
2013-04-16 17:26                         ` Alexander Graf
2013-04-16 17:26                           ` Alexander Graf
2013-04-16 21:28                           ` Marcelo Tosatti
2013-04-16 21:28                             ` Marcelo Tosatti
2013-03-26 16:37               ` Scott Wood
2013-03-26 16:37                 ` Scott Wood
2013-03-31 10:49                 ` Gleb Natapov
2013-03-31 10:49                   ` Gleb Natapov
2013-03-31 11:05                   ` Alexander Graf
2013-03-31 11:05                     ` Alexander Graf
2013-04-08 18:17                     ` Scott Wood
2013-04-08 18:17                       ` Scott Wood

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=1363962363-7968-2-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=bharat.bhushan@freescale.com \
    --cc=gleb@redhat.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 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.