KVM: s390: fix setting of fpc register
[linux-block.git] / arch / s390 / kvm / kvm-s390.c
index b3f17e014cab5d3d912c5393eac5498f3e135591..16e32174807f727f521102b11bce111c8fa54003 100644 (file)
@@ -66,7 +66,14 @@ const struct _kvm_stats_desc kvm_vm_stats_desc[] = {
        STATS_DESC_COUNTER(VM, inject_pfault_done),
        STATS_DESC_COUNTER(VM, inject_service_signal),
        STATS_DESC_COUNTER(VM, inject_virtio),
-       STATS_DESC_COUNTER(VM, aen_forward)
+       STATS_DESC_COUNTER(VM, aen_forward),
+       STATS_DESC_COUNTER(VM, gmap_shadow_reuse),
+       STATS_DESC_COUNTER(VM, gmap_shadow_create),
+       STATS_DESC_COUNTER(VM, gmap_shadow_r1_entry),
+       STATS_DESC_COUNTER(VM, gmap_shadow_r2_entry),
+       STATS_DESC_COUNTER(VM, gmap_shadow_r3_entry),
+       STATS_DESC_COUNTER(VM, gmap_shadow_sg_entry),
+       STATS_DESC_COUNTER(VM, gmap_shadow_pg_entry),
 };
 
 const struct kvm_stats_header kvm_vm_stats_header = {
@@ -4053,6 +4060,8 @@ static void kvm_gmap_notifier(struct gmap *gmap, unsigned long start,
        unsigned long prefix;
        unsigned long i;
 
+       trace_kvm_s390_gmap_notifier(start, end, gmap_is_shadow(gmap));
+
        if (gmap_is_shadow(gmap))
                return;
        if (start >= 1UL << 31)
@@ -4307,10 +4316,6 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 
        vcpu_load(vcpu);
 
-       if (test_fp_ctl(fpu->fpc)) {
-               ret = -EINVAL;
-               goto out;
-       }
        vcpu->run->s.regs.fpc = fpu->fpc;
        if (MACHINE_HAS_VX)
                convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs,
@@ -4318,7 +4323,6 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
        else
                memcpy(vcpu->run->s.regs.fprs, &fpu->fprs, sizeof(fpu->fprs));
 
-out:
        vcpu_put(vcpu);
        return ret;
 }
@@ -4918,7 +4922,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
        }
        if (MACHINE_HAS_GS) {
                preempt_disable();
-               __ctl_set_bit(2, 4);
+               local_ctl_set_bit(2, CR2_GUARDED_STORAGE_BIT);
                if (current->thread.gs_cb) {
                        vcpu->arch.host_gscb = current->thread.gs_cb;
                        save_gs_cb(vcpu->arch.host_gscb);
@@ -4995,13 +4999,13 @@ static void store_regs_fmt2(struct kvm_vcpu *vcpu)
        kvm_run->s.regs.diag318 = vcpu->arch.diag318_info.val;
        if (MACHINE_HAS_GS) {
                preempt_disable();
-               __ctl_set_bit(2, 4);
+               local_ctl_set_bit(2, CR2_GUARDED_STORAGE_BIT);
                if (vcpu->arch.gs_enabled)
                        save_gs_cb(current->thread.gs_cb);
                current->thread.gs_cb = vcpu->arch.host_gscb;
                restore_gs_cb(vcpu->arch.host_gscb);
                if (!vcpu->arch.host_gscb)
-                       __ctl_clear_bit(2, 4);
+                       local_ctl_clear_bit(2, CR2_GUARDED_STORAGE_BIT);
                vcpu->arch.host_gscb = NULL;
                preempt_enable();
        }