Skip to content

Commit 30b229b

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull s390 kvm fixes from Paolo Bonzini: "Two fixes for s390" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: KVM: s390: fix pfmf non-quiescing control handling KVM: s390: move kvm_guest_enter,exit closer to sie
2 parents 9e6bdaa + e769ece commit 30b229b

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

arch/s390/kvm/kvm-s390.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -702,14 +702,25 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
702702
return rc;
703703

704704
vcpu->arch.sie_block->icptcode = 0;
705-
preempt_disable();
706-
kvm_guest_enter();
707-
preempt_enable();
708705
VCPU_EVENT(vcpu, 6, "entering sie flags %x",
709706
atomic_read(&vcpu->arch.sie_block->cpuflags));
710707
trace_kvm_s390_sie_enter(vcpu,
711708
atomic_read(&vcpu->arch.sie_block->cpuflags));
709+
710+
/*
711+
* As PF_VCPU will be used in fault handler, between guest_enter
712+
* and guest_exit should be no uaccess.
713+
*/
714+
preempt_disable();
715+
kvm_guest_enter();
716+
preempt_enable();
712717
rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs);
718+
kvm_guest_exit();
719+
720+
VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
721+
vcpu->arch.sie_block->icptcode);
722+
trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);
723+
713724
if (rc > 0)
714725
rc = 0;
715726
if (rc < 0) {
@@ -721,10 +732,6 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
721732
rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
722733
}
723734
}
724-
VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
725-
vcpu->arch.sie_block->icptcode);
726-
trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode);
727-
kvm_guest_exit();
728735

729736
memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16);
730737
return rc;

arch/s390/kvm/priv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/errno.h>
1717
#include <linux/compat.h>
1818
#include <asm/asm-offsets.h>
19+
#include <asm/facility.h>
1920
#include <asm/current.h>
2021
#include <asm/debug.h>
2122
#include <asm/ebcdic.h>
@@ -532,8 +533,7 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
532533
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
533534

534535
/* Only provide non-quiescing support if the host supports it */
535-
if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ &&
536-
S390_lowcore.stfl_fac_list & 0x00020000)
536+
if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && !test_facility(14))
537537
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
538538

539539
/* No support for conditional-SSKE */

0 commit comments

Comments
 (0)