This capability may only be set before any vCPUs are created.
 
+8.39 KVM_CAP_S390_CPU_TOPOLOGY
+------------------------------
+
+:Capability: KVM_CAP_S390_CPU_TOPOLOGY
+:Architectures: s390
+:Type: vm
+
+This capability indicates that KVM will provide the S390 CPU Topology
+facility which consist of the interpretation of the PTF instruction for
+the function code 2 along with interception and forwarding of both the
+PTF instruction with function codes 0 or 1 and the STSI(15,1,x)
+instruction to the userland hypervisor.
+
+The stfle facility 11, CPU Topology facility, should not be indicated
+to the guest without this capability.
+
+When this capability is present, KVM provides a new attribute group
+on vm fd, KVM_S390_VM_CPU_TOPOLOGY.
+This new attribute allows to get, set or clear the Modified Change
+Topology Report (MTCR) bit of the SCA through the kvm_device_attr
+structure.
+
+When getting the Modified Change Topology Report value, the attr->addr
+must point to a byte where the value will be stored or retrieved from.
+
 9. Known KVM API problems
 =========================
 
 
        case KVM_CAP_S390_ZPCI_OP:
                r = kvm_s390_pci_interp_allowed();
                break;
+       case KVM_CAP_S390_CPU_TOPOLOGY:
+               r = test_facility(11);
+               break;
        default:
                r = 0;
        }
                icpt_operexc_on_all_vcpus(kvm);
                r = 0;
                break;
+       case KVM_CAP_S390_CPU_TOPOLOGY:
+               r = -EINVAL;
+               mutex_lock(&kvm->lock);
+               if (kvm->created_vcpus) {
+                       r = -EBUSY;
+               } else if (test_facility(11)) {
+                       set_kvm_facility(kvm->arch.model.fac_mask, 11);
+                       set_kvm_facility(kvm->arch.model.fac_list, 11);
+                       r = 0;
+               }
+               mutex_unlock(&kvm->lock);
+               VM_EVENT(kvm, 3, "ENABLE: CAP_S390_CPU_TOPOLOGY %s",
+                        r ? "(not available)" : "(success)");
+               break;
        default:
                r = -EINVAL;
                break;
        read_unlock(&kvm->arch.sca_lock);
 }
 
+static int kvm_s390_set_topo_change_indication(struct kvm *kvm,
+                                              struct kvm_device_attr *attr)
+{
+       if (!test_kvm_facility(kvm, 11))
+               return -ENXIO;
+
+       kvm_s390_update_topology_change_report(kvm, !!attr->attr);
+       return 0;
+}
+
+static int kvm_s390_get_topo_change_indication(struct kvm *kvm,
+                                              struct kvm_device_attr *attr)
+{
+       u8 topo;
+
+       if (!test_kvm_facility(kvm, 11))
+               return -ENXIO;
+
+       read_lock(&kvm->arch.sca_lock);
+       topo = ((struct bsca_block *)kvm->arch.sca)->utility.mtcr;
+       read_unlock(&kvm->arch.sca_lock);
+
+       return put_user(topo, (u8 __user *)attr->addr);
+}
+
 static int kvm_s390_vm_set_attr(struct kvm *kvm, struct kvm_device_attr *attr)
 {
        int ret;
        case KVM_S390_VM_MIGRATION:
                ret = kvm_s390_vm_set_migration(kvm, attr);
                break;
+       case KVM_S390_VM_CPU_TOPOLOGY:
+               ret = kvm_s390_set_topo_change_indication(kvm, attr);
+               break;
        default:
                ret = -ENXIO;
                break;
        case KVM_S390_VM_MIGRATION:
                ret = kvm_s390_vm_get_migration(kvm, attr);
                break;
+       case KVM_S390_VM_CPU_TOPOLOGY:
+               ret = kvm_s390_get_topo_change_indication(kvm, attr);
+               break;
        default:
                ret = -ENXIO;
                break;
        case KVM_S390_VM_MIGRATION:
                ret = 0;
                break;
+       case KVM_S390_VM_CPU_TOPOLOGY:
+               ret = test_kvm_facility(kvm, 11) ? 0 : -ENXIO;
+               break;
        default:
                ret = -ENXIO;
                break;