提交 8d26cf7b 编写于 作者: C Christian Borntraeger 提交者: Avi Kivity

KVM: s390: rework code that sets the prefix

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: NChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 2b036c6b
...@@ -236,8 +236,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, ...@@ -236,8 +236,7 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
VCPU_EVENT(vcpu, 4, "interrupt: set prefix to %x", VCPU_EVENT(vcpu, 4, "interrupt: set prefix to %x",
inti->prefix.address); inti->prefix.address);
vcpu->stat.deliver_prefix_signal++; vcpu->stat.deliver_prefix_signal++;
vcpu->arch.sie_block->prefix = inti->prefix.address; kvm_s390_set_prefix(vcpu, inti->prefix.address);
vcpu->arch.sie_block->ihcpu = 0xffff;
break; break;
case KVM_S390_RESTART: case KVM_S390_RESTART:
......
...@@ -322,8 +322,7 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu) ...@@ -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 */ /* 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.mask = 0UL;
vcpu->arch.sie_block->gpsw.addr = 0UL; vcpu->arch.sie_block->gpsw.addr = 0UL;
vcpu->arch.sie_block->prefix = 0UL; kvm_s390_set_prefix(vcpu, 0);
vcpu->arch.sie_block->ihcpu = 0xffff;
vcpu->arch.sie_block->cputm = 0UL; vcpu->arch.sie_block->cputm = 0UL;
vcpu->arch.sie_block->ckc = 0UL; vcpu->arch.sie_block->ckc = 0UL;
vcpu->arch.sie_block->todpr = 0; vcpu->arch.sie_block->todpr = 0;
......
...@@ -58,6 +58,13 @@ static inline int kvm_is_ucontrol(struct kvm *kvm) ...@@ -58,6 +58,13 @@ static inline int kvm_is_ucontrol(struct kvm *kvm)
return 0; return 0;
#endif #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); int kvm_s390_handle_wait(struct kvm_vcpu *vcpu);
enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer); enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer);
void kvm_s390_tasklet(unsigned long parm); void kvm_s390_tasklet(unsigned long parm);
......
...@@ -56,8 +56,7 @@ static int handle_set_prefix(struct kvm_vcpu *vcpu) ...@@ -56,8 +56,7 @@ static int handle_set_prefix(struct kvm_vcpu *vcpu)
goto out; goto out;
} }
vcpu->arch.sie_block->prefix = address; kvm_s390_set_prefix(vcpu, address);
vcpu->arch.sie_block->ihcpu = 0xffff;
VCPU_EVENT(vcpu, 5, "setting prefix to %x", address); VCPU_EVENT(vcpu, 5, "setting prefix to %x", address);
out: out:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册