Skip to content

Commit 4f45b90

Browse files
author
Christian Borntraeger
committed
KVM: s390: add deflate conversion facilty to cpu model
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>
1 parent 173aec2 commit 4f45b90

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎arch/s390/include/uapi/asm/kvm.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ struct kvm_s390_vm_cpu_subfunc {
154154
__u8 kma[16]; /* with MSA8 */
155155
__u8 kdsa[16]; /* with MSA9 */
156156
__u8 sortl[32]; /* with STFLE.150 */
157-
__u8 reserved[1760];
157+
__u8 dfltcc[32]; /* with STFLE.151 */
158+
__u8 reserved[1728];
158159
};
159160

160161
/* kvm attributes for crypto */

‎arch/s390/kvm/kvm-s390.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ static inline void __insn32_query(unsigned int opcode, u8 query[32])
335335
}
336336

337337
#define INSN_SORTL 0xb938
338+
#define INSN_DFLTCC 0xb939
338339

339340
static void kvm_s390_cpu_feat_init(void)
340341
{
@@ -390,6 +391,9 @@ static void kvm_s390_cpu_feat_init(void)
390391
if (test_facility(150)) /* SORTL */
391392
__insn32_query(INSN_SORTL, kvm_s390_available_subfunc.sortl);
392393

394+
if (test_facility(151)) /* DFLTCC */
395+
__insn32_query(INSN_DFLTCC, kvm_s390_available_subfunc.dfltcc);
396+
393397
if (MACHINE_HAS_ESOP)
394398
allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP);
395399
/*
@@ -1361,6 +1365,11 @@ static int kvm_s390_set_processor_subfunc(struct kvm *kvm,
13611365
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1],
13621366
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2],
13631367
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]);
1368+
VM_EVENT(kvm, 3, "SET: guest DFLTCC subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
1369+
((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[0],
1370+
((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1],
1371+
((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2],
1372+
((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]);
13641373

13651374
return 0;
13661375
}
@@ -1537,6 +1546,11 @@ static int kvm_s390_get_processor_subfunc(struct kvm *kvm,
15371546
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1],
15381547
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2],
15391548
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]);
1549+
VM_EVENT(kvm, 3, "GET: guest DFLTCC subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
1550+
((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[0],
1551+
((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1],
1552+
((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2],
1553+
((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]);
15401554

15411555
return 0;
15421556
}
@@ -1600,6 +1614,11 @@ static int kvm_s390_get_machine_subfunc(struct kvm *kvm,
16001614
((unsigned long *) &kvm_s390_available_subfunc.sortl)[1],
16011615
((unsigned long *) &kvm_s390_available_subfunc.sortl)[2],
16021616
((unsigned long *) &kvm_s390_available_subfunc.sortl)[3]);
1617+
VM_EVENT(kvm, 3, "GET: host DFLTCC subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
1618+
((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[0],
1619+
((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[1],
1620+
((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[2],
1621+
((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[3]);
16031622

16041623
return 0;
16051624
}

‎arch/s390/tools/gen_facilities.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ static struct facility_def facility_defs[] = {
9494
139, /* multiple epoch facility */
9595
146, /* msa extension 8 */
9696
150, /* enhanced sort */
97+
151, /* deflate conversion */
9798
155, /* msa extension 9 */
9899
-1 /* END */
99100
}

0 commit comments

Comments
 (0)