Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'kvm-s390-next-6.8-1' of https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD

- uvdevice fixed additional data return length
- stfle (feature indication) vsie fixes and minor cleanup

+49 -4
+6
arch/s390/include/asm/facility.h
··· 111 111 preempt_enable(); 112 112 } 113 113 114 + /** 115 + * stfle_size - Actual size of the facility list as specified by stfle 116 + * (number of double words) 117 + */ 118 + unsigned int stfle_size(void); 119 + 114 120 #endif /* __ASM_FACILITY_H */
+1 -1
arch/s390/include/asm/kvm_host.h
··· 818 818 819 819 struct kvm_s390_cpu_model { 820 820 /* facility mask supported by kvm & hosting machine */ 821 - __u64 fac_mask[S390_ARCH_FAC_LIST_SIZE_U64]; 821 + __u64 fac_mask[S390_ARCH_FAC_MASK_SIZE_U64]; 822 822 struct kvm_s390_vm_cpu_subfunc subfuncs; 823 823 /* facility list requested by guest (in dma page) */ 824 824 __u64 *fac_list;
+1 -1
arch/s390/kernel/Makefile
··· 41 41 obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o 42 42 obj-y += entry.o reipl.o kdebugfs.o alternative.o 43 43 obj-y += nospec-branch.o ipl_vmparm.o machine_kexec_reloc.o unwind_bc.o 44 - obj-y += smp.o text_amode31.o stacktrace.o abs_lowcore.o 44 + obj-y += smp.o text_amode31.o stacktrace.o abs_lowcore.o facility.o 45 45 46 46 extra-y += vmlinux.lds 47 47
+21
arch/s390/kernel/facility.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright IBM Corp. 2023 4 + */ 5 + 6 + #include <asm/facility.h> 7 + 8 + unsigned int stfle_size(void) 9 + { 10 + static unsigned int size; 11 + unsigned int r; 12 + u64 dummy; 13 + 14 + r = READ_ONCE(size); 15 + if (!r) { 16 + r = __stfle_asm(&dummy, 1) + 1; 17 + WRITE_ONCE(size, r); 18 + } 19 + return r; 20 + } 21 + EXPORT_SYMBOL(stfle_size);
+17 -2
arch/s390/kvm/vsie.c
··· 19 19 #include <asm/nmi.h> 20 20 #include <asm/dis.h> 21 21 #include <asm/fpu/api.h> 22 + #include <asm/facility.h> 22 23 #include "kvm-s390.h" 23 24 #include "gaccess.h" 24 25 ··· 985 984 static int handle_stfle(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) 986 985 { 987 986 struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s; 988 - __u32 fac = READ_ONCE(vsie_page->scb_o->fac) & 0x7ffffff8U; 987 + __u32 fac = READ_ONCE(vsie_page->scb_o->fac); 989 988 989 + /* 990 + * Alternate-STFLE-Interpretive-Execution facilities are not supported 991 + * -> format-0 flcb 992 + */ 990 993 if (fac && test_kvm_facility(vcpu->kvm, 7)) { 991 994 retry_vsie_icpt(vsie_page); 995 + /* 996 + * The facility list origin (FLO) is in bits 1 - 28 of the FLD 997 + * so we need to mask here before reading. 998 + */ 999 + fac = fac & 0x7ffffff8U; 1000 + /* 1001 + * format-0 -> size of nested guest's facility list == guest's size 1002 + * guest's size == host's size, since STFLE is interpretatively executed 1003 + * using a format-0 for the guest, too. 1004 + */ 992 1005 if (read_guest_real(vcpu, fac, &vsie_page->fac, 993 - sizeof(vsie_page->fac))) 1006 + stfle_size() * sizeof(u64))) 994 1007 return set_validity_icpt(scb_s, 0x1090U); 995 1008 scb_s->fac = (__u32)(__u64) &vsie_page->fac; 996 1009 }
+3
drivers/s390/char/uvdevice.c
··· 109 109 struct uvio_attest *uvio_attest) 110 110 { 111 111 struct uvio_attest __user *user_uvio_attest = (void __user *)uv_ioctl->argument_addr; 112 + u32 __user *user_buf_add_len = (u32 __user *)&user_uvio_attest->add_data_len; 112 113 void __user *user_buf_add = (void __user *)uvio_attest->add_data_addr; 113 114 void __user *user_buf_meas = (void __user *)uvio_attest->meas_addr; 114 115 void __user *user_buf_uid = &user_uvio_attest->config_uid; ··· 117 116 if (copy_to_user(user_buf_meas, measurement, uvio_attest->meas_len)) 118 117 return -EFAULT; 119 118 if (add_data && copy_to_user(user_buf_add, add_data, uvio_attest->add_data_len)) 119 + return -EFAULT; 120 + if (put_user(uvio_attest->add_data_len, user_buf_add_len)) 120 121 return -EFAULT; 121 122 if (copy_to_user(user_buf_uid, uvcb_attest->config_uid, sizeof(uvcb_attest->config_uid))) 122 123 return -EFAULT;