- uvdevice fixed additional data return length

- stfle (feature indication) vsie fixes and minor cleanup
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEwGNS88vfc9+v45Yq41TmuOI4ufgFAmWUBE8ACgkQ41TmuOI4
 ufg9jA//YjZ725t0nTIMa1SzmFRJRvuAI6JBSnKhJI0/Z+aXiuUZm5tyFOVrZNLB
 tLTlTbTNA5ZzpyrvdNPTVfRKzK5nA7XtHY50Id3leyjsmhSPMWyiOZOn46mlCSAS
 UB9Fxu54RqEu4qiEkFFq4OVhMq0nYldK7pTSfQZW0FfnU4bC0mwg/qQ+u1v0GTRN
 dGmzhpqf2CTT8x7YhzAvOViVgMxQghb34Pfhar/mf0n3LCP0Shx5qOqLyja/+M/+
 EXk4vGF4vHYUB0HJkuAEAiLeyqztE5kty5u/hSQ2bk2dImBdeCg9eN6JMTzZKn6t
 yAdMdaNUpR769MnckKKG1qVKxuggzaB4toY9EVPLTHk42ZiqZPHo8avPCEsxnz+n
 rJKtxy0EPm74TPGG9Z2/v8dIB1VOBQ3V9KLu+hnR6BDw5DZJc/1GylEW6NyuVhZq
 Ak8XjFcY2Zx2tFWNwppoPziTRpsnbgevhAomyDvVelAO2buU6SXR/Rv7AsY97dEj
 2YTCHaBY1j2TjioQJm/AjOvBy0JhWGx9Wdni+ZyAdNG2xX7/JUbp1jKHHXp7Eolj
 7/driKHsNeqw2pRulEoLGQeTlx6GoabXb8HVqwPX8fC69WzJ7YQi4giQTX7rZR4B
 Mg6AMGl24iNjaHSIXrNbg9JrYjgOS45sZ2BBRybdhTmKBwbNGSk=
 =IY7z
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Paolo Bonzini 2024-01-02 13:18:30 -05:00
commit 731859dde8
6 changed files with 49 additions and 4 deletions

View File

@ -111,4 +111,10 @@ static inline void stfle(u64 *stfle_fac_list, int size)
preempt_enable();
}
/**
* stfle_size - Actual size of the facility list as specified by stfle
* (number of double words)
*/
unsigned int stfle_size(void);
#endif /* __ASM_FACILITY_H */

View File

@ -818,7 +818,7 @@ struct s390_io_adapter {
struct kvm_s390_cpu_model {
/* facility mask supported by kvm & hosting machine */
__u64 fac_mask[S390_ARCH_FAC_LIST_SIZE_U64];
__u64 fac_mask[S390_ARCH_FAC_MASK_SIZE_U64];
struct kvm_s390_vm_cpu_subfunc subfuncs;
/* facility list requested by guest (in dma page) */
__u64 *fac_list;

View File

@ -41,7 +41,7 @@ obj-y += sysinfo.o lgr.o os_info.o ctlreg.o
obj-y += runtime_instr.o cache.o fpu.o dumpstack.o guarded_storage.o sthyi.o
obj-y += entry.o reipl.o kdebugfs.o alternative.o
obj-y += nospec-branch.o ipl_vmparm.o machine_kexec_reloc.o unwind_bc.o
obj-y += smp.o text_amode31.o stacktrace.o abs_lowcore.o
obj-y += smp.o text_amode31.o stacktrace.o abs_lowcore.o facility.o
extra-y += vmlinux.lds

View File

@ -0,0 +1,21 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright IBM Corp. 2023
*/
#include <asm/facility.h>
unsigned int stfle_size(void)
{
static unsigned int size;
unsigned int r;
u64 dummy;
r = READ_ONCE(size);
if (!r) {
r = __stfle_asm(&dummy, 1) + 1;
WRITE_ONCE(size, r);
}
return r;
}
EXPORT_SYMBOL(stfle_size);

View File

@ -19,6 +19,7 @@
#include <asm/nmi.h>
#include <asm/dis.h>
#include <asm/fpu/api.h>
#include <asm/facility.h>
#include "kvm-s390.h"
#include "gaccess.h"
@ -984,12 +985,26 @@ static void retry_vsie_icpt(struct vsie_page *vsie_page)
static int handle_stfle(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
{
struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
__u32 fac = READ_ONCE(vsie_page->scb_o->fac) & 0x7ffffff8U;
__u32 fac = READ_ONCE(vsie_page->scb_o->fac);
/*
* Alternate-STFLE-Interpretive-Execution facilities are not supported
* -> format-0 flcb
*/
if (fac && test_kvm_facility(vcpu->kvm, 7)) {
retry_vsie_icpt(vsie_page);
/*
* The facility list origin (FLO) is in bits 1 - 28 of the FLD
* so we need to mask here before reading.
*/
fac = fac & 0x7ffffff8U;
/*
* format-0 -> size of nested guest's facility list == guest's size
* guest's size == host's size, since STFLE is interpretatively executed
* using a format-0 for the guest, too.
*/
if (read_guest_real(vcpu, fac, &vsie_page->fac,
sizeof(vsie_page->fac)))
stfle_size() * sizeof(u64)))
return set_validity_icpt(scb_s, 0x1090U);
scb_s->fac = (__u32)(__u64) &vsie_page->fac;
}

View File

@ -109,6 +109,7 @@ static int uvio_copy_attest_result_to_user(struct uv_cb_attest *uvcb_attest,
struct uvio_attest *uvio_attest)
{
struct uvio_attest __user *user_uvio_attest = (void __user *)uv_ioctl->argument_addr;
u32 __user *user_buf_add_len = (u32 __user *)&user_uvio_attest->add_data_len;
void __user *user_buf_add = (void __user *)uvio_attest->add_data_addr;
void __user *user_buf_meas = (void __user *)uvio_attest->meas_addr;
void __user *user_buf_uid = &user_uvio_attest->config_uid;
@ -117,6 +118,8 @@ static int uvio_copy_attest_result_to_user(struct uv_cb_attest *uvcb_attest,
return -EFAULT;
if (add_data && copy_to_user(user_buf_add, add_data, uvio_attest->add_data_len))
return -EFAULT;
if (put_user(uvio_attest->add_data_len, user_buf_add_len))
return -EFAULT;
if (copy_to_user(user_buf_uid, uvcb_attest->config_uid, sizeof(uvcb_attest->config_uid)))
return -EFAULT;
return 0;