KVM: s390: rework code that sets the prefix
authorChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 11 Jan 2012 10:19:32 +0000 (11:19 +0100)
committerAvi Kivity <avi@redhat.com>
Mon, 5 Mar 2012 12:52:21 +0000 (14:52 +0200)
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>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/s390/kvm/interrupt.c
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/kvm-s390.h
arch/s390/kvm/priv.c

index 278ee009ce6570a9d4049a095def51b17fb164d5..c6366cfb3bf072305724d0548d0fc683533a4e7d 100644 (file)
@@ -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:
index a33b444875402a8baf81553fbdacd17643497311..1868b89a840fc0a68879d10b9b464a9e7d6609a3 100644 (file)
@@ -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;
index 62aa5f19bb98807597f37b8d15119fcb6b51e603..ff28f9d1c9eb94a2f50c2775ddf35cfbd3573a54 100644 (file)
@@ -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);
index d02638959922aba41712d16d6dfb20f86f87ec8b..9c83b8a538431163430398f52f8dc8269f78ba99 100644 (file)
@@ -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: