Skip to content

Commit 173aec2

Browse files
author
Christian Borntraeger
committed
KVM: s390: add enhanced sort facilty to cpu model
This enables stfle.150 and adds the subfunctions for SORTL. Bit 150 is added to the list of facilities that will be enabled when there is no cpu model involved as sortl 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 d668139 commit 173aec2

3 files changed

Lines changed: 23 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
@@ -153,7 +153,8 @@ struct kvm_s390_vm_cpu_subfunc {
153153
__u8 ppno[16]; /* with MSA5 */
154154
__u8 kma[16]; /* with MSA8 */
155155
__u8 kdsa[16]; /* with MSA9 */
156-
__u8 reserved[1792];
156+
__u8 sortl[32]; /* with STFLE.150 */
157+
__u8 reserved[1760];
157158
};
158159

159160
/* kvm attributes for crypto */

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ static inline void __insn32_query(unsigned int opcode, u8 query[32])
334334
: "cc");
335335
}
336336

337+
#define INSN_SORTL 0xb938
338+
337339
static void kvm_s390_cpu_feat_init(void)
338340
{
339341
int i;
@@ -385,6 +387,9 @@ static void kvm_s390_cpu_feat_init(void)
385387
__cpacf_query(CPACF_KDSA, (cpacf_mask_t *)
386388
kvm_s390_available_subfunc.kdsa);
387389

390+
if (test_facility(150)) /* SORTL */
391+
__insn32_query(INSN_SORTL, kvm_s390_available_subfunc.sortl);
392+
388393
if (MACHINE_HAS_ESOP)
389394
allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP);
390395
/*
@@ -1351,6 +1356,11 @@ static int kvm_s390_set_processor_subfunc(struct kvm *kvm,
13511356
VM_EVENT(kvm, 3, "SET: guest KDSA subfunc 0x%16.16lx.%16.16lx",
13521357
((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[0],
13531358
((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[1]);
1359+
VM_EVENT(kvm, 3, "SET: guest SORTL subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
1360+
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[0],
1361+
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1],
1362+
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2],
1363+
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]);
13541364

13551365
return 0;
13561366
}
@@ -1522,6 +1532,11 @@ static int kvm_s390_get_processor_subfunc(struct kvm *kvm,
15221532
VM_EVENT(kvm, 3, "GET: guest KDSA subfunc 0x%16.16lx.%16.16lx",
15231533
((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[0],
15241534
((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[1]);
1535+
VM_EVENT(kvm, 3, "GET: guest SORTL subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
1536+
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[0],
1537+
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1],
1538+
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2],
1539+
((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]);
15251540

15261541
return 0;
15271542
}
@@ -1580,6 +1595,11 @@ static int kvm_s390_get_machine_subfunc(struct kvm *kvm,
15801595
VM_EVENT(kvm, 3, "GET: host KDSA subfunc 0x%16.16lx.%16.16lx",
15811596
((unsigned long *) &kvm_s390_available_subfunc.kdsa)[0],
15821597
((unsigned long *) &kvm_s390_available_subfunc.kdsa)[1]);
1598+
VM_EVENT(kvm, 3, "GET: host SORTL subfunc 0x%16.16lx.%16.16lx.%16.16lx.%16.16lx",
1599+
((unsigned long *) &kvm_s390_available_subfunc.sortl)[0],
1600+
((unsigned long *) &kvm_s390_available_subfunc.sortl)[1],
1601+
((unsigned long *) &kvm_s390_available_subfunc.sortl)[2],
1602+
((unsigned long *) &kvm_s390_available_subfunc.sortl)[3]);
15831603

15841604
return 0;
15851605
}

‎arch/s390/tools/gen_facilities.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static struct facility_def facility_defs[] = {
9393
131, /* enhanced-SOP 2 and side-effect */
9494
139, /* multiple epoch facility */
9595
146, /* msa extension 8 */
96+
150, /* enhanced sort */
9697
155, /* msa extension 9 */
9798
-1 /* END */
9899
}

0 commit comments

Comments
 (0)