Re: [PATCH v3 2/3] s390x: KVM: Implementation of Multiprocessor Topology-Change-Report

From: Pierre Morel
Date: Wed Sep 01 2021 - 05:46:14 EST




On 8/31/21 4:03 PM, David Hildenbrand wrote:
On 03.08.21 10:26, Pierre Morel wrote:

...snip...


@@ -819,6 +820,23 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
          icpt_operexc_on_all_vcpus(kvm);
          r = 0;
          break;
+    case KVM_CAP_S390_CPU_TOPOLOGY:
+        mutex_lock(&kvm->lock);
+        if (kvm->created_vcpus) {
+            r = -EBUSY;
+        } else {
+            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: CPU TOPOLOGY %s",
+             r ? "(not available)" : "(success)");
+        break;
+
+        r = -EINVAL;
+        break;
+
      default:
          r = -EINVAL;
          break;

This above enables the facility 11.

...snip...

@@ -3198,6 +3239,11 @@ static int kvm_s390_vcpu_setup(struct kvm_vcpu *vcpu)
          vcpu->arch.sie_block->ecb |= ECB_HOSTPROTINT;
      if (test_kvm_facility(vcpu->kvm, 9))
          vcpu->arch.sie_block->ecb |= ECB_SRSI;
+
+    /* PTF needs both host and guest facilities to enable interpretation */
+    if (test_kvm_facility(vcpu->kvm, 11) && test_facility(11))
+        vcpu->arch.sie_block->ecb |= ECB_PTF;


Again, doesn't test_kvm_facility(vcpu->kvm, 11) imply that we have host support by checking fac_mask?


--
Pierre Morel
IBM Lab Boeblingen