public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* kvm-s390: prep cleanup for sync registers patch series
@ 2012-01-11 10:19 Christian Borntraeger
  2012-01-11 10:19 ` [PATCH] kvm-s390: rework code that sets the prefix Christian Borntraeger
  2012-01-12 11:30 ` kvm-s390: prep cleanup for sync registers patch series Marcelo Tosatti
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Borntraeger @ 2012-01-11 10:19 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tossati
  Cc: Carsten Otte, Alexander Graf, Jens Freimann, Cornelia Huck,
	Heiko Carstens, Martin Schwidefsky, KVM

Avi, Marcelo,

here is a patch that reworks the setting of the prefix register.
It is a prereq for the prefix patch in the following patch series
about the sync registers in kvm_run.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] kvm-s390: rework code that sets the prefix
  2012-01-11 10:19 kvm-s390: prep cleanup for sync registers patch series Christian Borntraeger
@ 2012-01-11 10:19 ` Christian Borntraeger
  2012-01-12 11:30 ` kvm-s390: prep cleanup for sync registers patch series Marcelo Tosatti
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Borntraeger @ 2012-01-11 10:19 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tossati
  Cc: Carsten Otte, Alexander Graf, Jens Freimann, Cornelia Huck,
	Heiko Carstens, Martin Schwidefsky, KVM, Christian Borntraeger

From: Christian Borntraeger <borntraeger@de.ibm.com>

There are several places in the kvm module, which set the prefix register.
Since we need to flush the cpu, lets combine this operation into a helper
function. This helper will also explicitely mask out the unused bits.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/interrupt.c |    3 +--
 arch/s390/kvm/kvm-s390.c  |    3 +--
 arch/s390/kvm/kvm-s390.h  |    7 +++++++
 arch/s390/kvm/priv.c      |    3 +--
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 278ee00..c6366cf 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -236,8 +236,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
 		VCPU_EVENT(vcpu, 4, "interrupt: set prefix to %x",
 			   inti->prefix.address);
 		vcpu->stat.deliver_prefix_signal++;
-		vcpu->arch.sie_block->prefix = inti->prefix.address;
-		vcpu->arch.sie_block->ihcpu = 0xffff;
+		kvm_s390_set_prefix(vcpu, inti->prefix.address);
 		break;
 
 	case KVM_S390_RESTART:
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index a33b444..1868b89 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -322,8 +322,7 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
 	/* this equals initial cpu reset in pop, but we don't switch to ESA */
 	vcpu->arch.sie_block->gpsw.mask = 0UL;
 	vcpu->arch.sie_block->gpsw.addr = 0UL;
-	vcpu->arch.sie_block->prefix    = 0UL;
-	vcpu->arch.sie_block->ihcpu     = 0xffff;
+	kvm_s390_set_prefix(vcpu, 0);
 	vcpu->arch.sie_block->cputm     = 0UL;
 	vcpu->arch.sie_block->ckc       = 0UL;
 	vcpu->arch.sie_block->todpr     = 0;
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 62aa5f1..ff28f9d 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -58,6 +58,13 @@ static inline int kvm_is_ucontrol(struct kvm *kvm)
 	return 0;
 #endif
 }
+
+static inline void kvm_s390_set_prefix(struct kvm_vcpu *vcpu, u32 prefix)
+{
+	vcpu->arch.sie_block->prefix = prefix & 0x7fffe000u;
+	vcpu->arch.sie_block->ihcpu  = 0xffff;
+}
+
 int kvm_s390_handle_wait(struct kvm_vcpu *vcpu);
 enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer);
 void kvm_s390_tasklet(unsigned long parm);
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index d026389..9c83b8a 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -56,8 +56,7 @@ static int handle_set_prefix(struct kvm_vcpu *vcpu)
 		goto out;
 	}
 
-	vcpu->arch.sie_block->prefix = address;
-	vcpu->arch.sie_block->ihcpu = 0xffff;
+	kvm_s390_set_prefix(vcpu, address);
 
 	VCPU_EVENT(vcpu, 5, "setting prefix to %x", address);
 out:
-- 
1.7.8.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: kvm-s390: prep cleanup for sync registers patch series
  2012-01-11 10:19 kvm-s390: prep cleanup for sync registers patch series Christian Borntraeger
  2012-01-11 10:19 ` [PATCH] kvm-s390: rework code that sets the prefix Christian Borntraeger
@ 2012-01-12 11:30 ` Marcelo Tosatti
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2012-01-12 11:30 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Avi Kivity, Carsten Otte, Alexander Graf, Jens Freimann,
	Cornelia Huck, Heiko Carstens, Martin Schwidefsky, KVM

On Wed, Jan 11, 2012 at 11:19:31AM +0100, Christian Borntraeger wrote:
> Avi, Marcelo,
> 
> here is a patch that reworks the setting of the prefix register.
> It is a prereq for the prefix patch in the following patch series
> about the sync registers in kvm_run.

Applied, thanks. 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-12 11:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 10:19 kvm-s390: prep cleanup for sync registers patch series Christian Borntraeger
2012-01-11 10:19 ` [PATCH] kvm-s390: rework code that sets the prefix Christian Borntraeger
2012-01-12 11:30 ` kvm-s390: prep cleanup for sync registers patch series Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox