KVM: s390: Feature and fix for 4.5

- allow the runtime instrumentation support inside the guests
 - remove a useless memory barrier
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJWjstnAAoJEBF7vIC1phx8iKEQAI9j2Y+BqXbeS0rSJtalCh9k
 f4Z3LX5GK46YzspKQcFQH++Rrowhf6bQWnArrYFXjvhkBOsIWadNEMc5nmk3odxw
 uOfPUxj/LlmaJFi3flf91aQQEcRKOHOUlzu4x+JGquYDGMkZbgpFSwnJViRj0g/a
 iLnQLAmKPGQsIPc8Ja9W4OSx3Xfg4szqa481HYQzDIjeLvkqiDdoIaQcUgXQjVMx
 E+GC10xvBiycRXViMqcNbVBggTjxi9U+0WoNI051OUut8S10i6WQmuTPEmZz5Oep
 hRkIsPncIrQC2t0nGep5xIDcvX9/56rmQHYG+4jutdPQAWuUzLxxb1JEfhhX1dvG
 h9+n0FCL+3wIvL4WO+enjKtqBFjqAWiktuG5MQBBG7nYfcjaSi1ATWhZm8I++L6N
 dRTxV4axZoJ88SmBpM8wIUQwUfBKqD7D6IPwU1OGj0bg9L4JnIo1c3GT0f5I0Gw0
 vp8dH5HmhJEWtRDprdnm/49emzZ+2wtlVs2jDXmrIy8hN31+dBiVC8T50kEy1350
 LY0aPSAOvg+DeGcw1aZ2OKxKj+XIKEIA+Huq7rAJRELMvxzfOhSUDbOdUr8R9eWR
 5wBbZKMgK7Eqg2lu2bfL/Clsj4YlSAuvKuLMXfXV6/sZo88BUJj8yFSqOADggHKn
 NcbVMcxn2XWDkUA5ol+F
 =Quu/
 -----END PGP SIGNATURE-----

Merge tag 'kvm-s390-next-4.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD

KVM: s390: Feature and fix for 4.5

- allow the runtime instrumentation support inside the guests
- remove a useless memory barrier
This commit is contained in:
Paolo Bonzini 2016-01-08 19:03:03 +01:00
commit d0ecb44dd4
4 changed files with 28 additions and 2 deletions

View File

@ -217,7 +217,8 @@ struct kvm_s390_sie_block {
__u64 pp; /* 0x01de */
__u8 reserved1e6[2]; /* 0x01e6 */
__u64 itdba; /* 0x01e8 */
__u8 reserved1f0[16]; /* 0x01f0 */
__u64 riccbd; /* 0x01f0 */
__u8 reserved1f8[8]; /* 0x01f8 */
} __attribute__((packed));
struct kvm_s390_itdb {

View File

@ -153,6 +153,7 @@ struct kvm_guest_debug_arch {
#define KVM_SYNC_ARCH0 (1UL << 4)
#define KVM_SYNC_PFAULT (1UL << 5)
#define KVM_SYNC_VRS (1UL << 6)
#define KVM_SYNC_RICCB (1UL << 7)
/* definition of registers in kvm_run */
struct kvm_sync_regs {
__u64 prefix; /* prefix register */
@ -170,6 +171,8 @@ struct kvm_sync_regs {
__u64 vrs[32][2]; /* vector registers */
__u8 reserved[512]; /* for future vector expansion */
__u32 fpc; /* only valid with vector registers */
__u8 padding[52]; /* riccb needs to be 64byte aligned */
__u8 riccb[64]; /* runtime instrumentation controls block */
};
#define KVM_REG_S390_TODPR (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)

View File

@ -258,6 +258,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
case KVM_CAP_S390_VECTOR_REGISTERS:
r = MACHINE_HAS_VX;
break;
case KVM_CAP_S390_RI:
r = test_facility(64);
break;
default:
r = 0;
}
@ -358,6 +361,20 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
VM_EVENT(kvm, 3, "ENABLE: CAP_S390_VECTOR_REGISTERS %s",
r ? "(not available)" : "(success)");
break;
case KVM_CAP_S390_RI:
r = -EINVAL;
mutex_lock(&kvm->lock);
if (atomic_read(&kvm->online_vcpus)) {
r = -EBUSY;
} else if (test_facility(64)) {
set_kvm_facility(kvm->arch.model.fac->mask, 64);
set_kvm_facility(kvm->arch.model.fac->list, 64);
r = 0;
}
mutex_unlock(&kvm->lock);
VM_EVENT(kvm, 3, "ENABLE: CAP_S390_RI %s",
r ? "(not available)" : "(success)");
break;
case KVM_CAP_S390_USER_STSI:
VM_EVENT(kvm, 3, "%s", "ENABLE: CAP_S390_USER_STSI");
kvm->arch.user_stsi = 1;
@ -1221,7 +1238,6 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
kvm_clear_async_pf_completion_queue(vcpu);
if (!kvm_is_ucontrol(vcpu->kvm))
sca_del_vcpu(vcpu);
smp_mb();
if (kvm_is_ucontrol(vcpu->kvm))
gmap_free(vcpu->arch.gmap);
@ -1396,6 +1412,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
KVM_SYNC_CRS |
KVM_SYNC_ARCH0 |
KVM_SYNC_PFAULT;
if (test_kvm_facility(vcpu->kvm, 64))
vcpu->run->kvm_valid_regs |= KVM_SYNC_RICCB;
if (test_kvm_facility(vcpu->kvm, 129))
vcpu->run->kvm_valid_regs |= KVM_SYNC_VRS;
@ -1579,10 +1597,13 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
vcpu->arch.sie_block->eca |= 1;
if (sclp.has_sigpif)
vcpu->arch.sie_block->eca |= 0x10000000U;
if (test_kvm_facility(vcpu->kvm, 64))
vcpu->arch.sie_block->ecb3 |= 0x01;
if (test_kvm_facility(vcpu->kvm, 129)) {
vcpu->arch.sie_block->eca |= 0x00020000;
vcpu->arch.sie_block->ecd |= 0x20000000;
}
vcpu->arch.sie_block->riccbd = (unsigned long) &vcpu->run->s.regs.riccb;
vcpu->arch.sie_block->ictl |= ICTL_ISKE | ICTL_SSKE | ICTL_RRBE;
if (vcpu->kvm->arch.use_cmma) {

View File

@ -849,6 +849,7 @@ struct kvm_ppc_smmu_info {
#define KVM_CAP_SPLIT_IRQCHIP 121
#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122
#define KVM_CAP_HYPERV_SYNIC 123
#define KVM_CAP_S390_RI 124
#ifdef KVM_CAP_IRQ_ROUTING