KVM: s390: add deflate conversion facilty to cpu model
authorChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 28 Dec 2018 09:46:04 +0000 (10:46 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Thu, 25 Apr 2019 06:24:17 +0000 (02:24 -0400)
This enables stfle.151 and adds the subfunctions for DFLTCC. Bit 151 is
added to the list of facilities that will be enabled when there is no
cpu model involved as DFLTCC requires no additional handling from
userspace, e.g. for migration.

Please note that a cpu model enabled user space can and will have the
final decision on the facility bits for a guests.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
arch/s390/include/uapi/asm/kvm.h
arch/s390/kvm/kvm-s390.c
arch/s390/tools/gen_facilities.c

index eba5bac08348998571e6134f8aae3be282ccad62..47104e5b47fd47b7941e3631e8e8eea4798e3d21 100644 (file)
@@ -154,7 +154,8 @@ struct kvm_s390_vm_cpu_subfunc {
        __u8 kma[16];           /* with MSA8 */
        __u8 kdsa[16];          /* with MSA9 */
        __u8 sortl[32];         /* with STFLE.150 */
-       __u8 reserved[1760];
+       __u8 dfltcc[32];        /* with STFLE.151 */
+       __u8 reserved[1728];
 };
 
 /* kvm attributes for crypto */
index 757f76bba9ea69028c61fdb4f72ae566f90098e8..38ca8324a91adf5cde4b4f594eafed01dee9b147 100644 (file)
@@ -335,6 +335,7 @@ static inline void __insn32_query(unsigned int opcode, u8 query[32])
 }
 
 #define INSN_SORTL 0xb938
+#define INSN_DFLTCC 0xb939
 
 static void kvm_s390_cpu_feat_init(void)
 {
@@ -390,6 +391,9 @@ static void kvm_s390_cpu_feat_init(void)
        if (test_facility(150)) /* SORTL */
                __insn32_query(INSN_SORTL, kvm_s390_available_subfunc.sortl);
 
+       if (test_facility(151)) /* DFLTCC */
+               __insn32_query(INSN_DFLTCC, kvm_s390_available_subfunc.dfltcc);
+
        if (MACHINE_HAS_ESOP)
                allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP);
        /*
@@ -1361,6 +1365,11 @@ static int kvm_s390_set_processor_subfunc(struct kvm *kvm,
                 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1],
                 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2],
                 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]);
+       VM_EVENT(kvm, 3, "SET: guest DFLTCC subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[0],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]);
 
        return 0;
 }
@@ -1537,6 +1546,11 @@ static int kvm_s390_get_processor_subfunc(struct kvm *kvm,
                 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1],
                 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2],
                 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]);
+       VM_EVENT(kvm, 3, "GET: guest DFLTCC subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[0],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2],
+                ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]);
 
        return 0;
 }
@@ -1600,6 +1614,11 @@ static int kvm_s390_get_machine_subfunc(struct kvm *kvm,
                 ((unsigned long *) &kvm_s390_available_subfunc.sortl)[1],
                 ((unsigned long *) &kvm_s390_available_subfunc.sortl)[2],
                 ((unsigned long *) &kvm_s390_available_subfunc.sortl)[3]);
+       VM_EVENT(kvm, 3, "GET: host  DFLTCC subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
+                ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[0],
+                ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[1],
+                ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[2],
+                ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[3]);
 
        return 0;
 }
index 1ec6bed785e8c59b17c0ce545b81e06ce0550a26..cead9e0dcffbf3df05c7f6673c61e8b367dc780d 100644 (file)
@@ -94,6 +94,7 @@ static struct facility_def facility_defs[] = {
                        139, /* multiple epoch facility */
                        146, /* msa extension 8 */
                        150, /* enhanced sort */
+                       151, /* deflate conversion */
                        155, /* msa extension 9 */
                        -1  /* END */
                }