]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/s390/kvm/kvm-s390.c
KVM: s390: add etoken support for guests
[linux.git] / arch / s390 / kvm / kvm-s390.c
index b350ec14d8825e27c7c182f8b196dc25e778498a..0cc8a48fc732f3d6ce6b4960927bbe8aa0f4864a 100644 (file)
@@ -2355,6 +2355,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
                vcpu->run->kvm_valid_regs |= KVM_SYNC_BPBC;
        if (test_kvm_facility(vcpu->kvm, 133))
                vcpu->run->kvm_valid_regs |= KVM_SYNC_GSCB;
+       if (test_kvm_facility(vcpu->kvm, 156))
+               vcpu->run->kvm_valid_regs |= KVM_SYNC_ETOKEN;
        /* fprs can be synchronized via vrs, even if the guest has no vx. With
         * MACHINE_HAS_VX, (load|store)_fpu_regs() will work with vrs format.
         */
@@ -2604,7 +2606,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
        }
        if (test_kvm_facility(vcpu->kvm, 139))
                vcpu->arch.sie_block->ecd |= ECD_MEF;
-
+       if (test_kvm_facility(vcpu->kvm, 156))
+               vcpu->arch.sie_block->ecd |= ECD_ETOKENF;
        if (vcpu->arch.sie_block->gd) {
                vcpu->arch.sie_block->eca |= ECA_AIV;
                VCPU_EVENT(vcpu, 3, "AIV gisa format-%u enabled for cpu %03u",
@@ -3522,6 +3525,7 @@ static void sync_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
                }
                preempt_enable();
        }
+       /* SIE will load etoken directly from SDNX and therefore kvm_run */
 
        kvm_run->kvm_dirty_regs = 0;
 }
@@ -3561,7 +3565,7 @@ static void store_regs(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
                        __ctl_clear_bit(2, 4);
                vcpu->arch.host_gscb = NULL;
        }
-
+       /* SIE will save etoken directly into SDNX and therefore kvm_run */
 }
 
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)