Commit 30b229bdd88445c550efbeb076ffaa251eb05364

Authored by Linus Torvalds

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

Showing 2 changed files Side-by-side Diff

arch/s390/kvm/kvm-s390.c
... ... @@ -702,14 +702,25 @@
702 702 return rc;
703 703  
704 704 vcpu->arch.sie_block->icptcode = 0;
705   - preempt_disable();
706   - kvm_guest_enter();
707   - preempt_enable();
708 705 VCPU_EVENT(vcpu, 6, "entering sie flags %x",
709 706 atomic_read(&vcpu->arch.sie_block->cpuflags));
710 707 trace_kvm_s390_sie_enter(vcpu,
711 708 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();
712 717 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 +
713 724 if (rc > 0)
714 725 rc = 0;
715 726 if (rc < 0) {
... ... @@ -721,10 +732,6 @@
721 732 rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
722 733 }
723 734 }
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();
728 735  
729 736 memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16);
730 737 return rc;
arch/s390/kvm/priv.c
... ... @@ -16,6 +16,7 @@
16 16 #include <linux/errno.h>
17 17 #include <linux/compat.h>
18 18 #include <asm/asm-offsets.h>
  19 +#include <asm/facility.h>
19 20 #include <asm/current.h>
20 21 #include <asm/debug.h>
21 22 #include <asm/ebcdic.h>
... ... @@ -532,8 +533,7 @@
532 533 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
533 534  
534 535 /* 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))
537 537 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
538 538  
539 539 /* No support for conditional-SSKE */