Merge tag 's390-6.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull more s390 updates from Vasily Gorbik:

- Clean up and improve vdso code: use SYM_* macros for function and
data annotations, add CFI annotations to fix GDB unwinding, optimize
the chacha20 implementation

- Add vfio-ap driver feature advertisement for use by libvirt and
mdevctl

* tag 's390-6.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
s390/vfio-ap: Driver feature advertisement
s390/vdso: Use one large alternative instead of an alternative branch
s390/vdso: Use SYM_DATA_START_LOCAL()/SYM_DATA_END() for data objects
tools: Add additional SYM_*() stubs to linkage.h
s390/vdso: Use macros for annotation of asm functions
s390/vdso: Add CFI annotations to __arch_chacha20_blocks_nostack()
s390/vdso: Fix comment within __arch_chacha20_blocks_nostack()
s390/vdso: Get rid of permutation constants

+86 -51
+30
Documentation/arch/s390/vfio-ap.rst
··· 999 resulting from plugging it in references a queue device bound to the vfio_ap 1000 device driver. 1001 1002 Limitations 1003 =========== 1004 Live guest migration is not supported for guests using AP devices without
··· 999 resulting from plugging it in references a queue device bound to the vfio_ap 1000 device driver. 1001 1002 + Driver Features 1003 + =============== 1004 + The vfio_ap driver exposes a sysfs file containing supported features. 1005 + This exists so third party tools (like Libvirt and mdevctl) can query the 1006 + availability of specific features. 1007 + 1008 + The features list can be found here: /sys/bus/matrix/devices/matrix/features 1009 + 1010 + Entries are space delimited. Each entry consists of a combination of 1011 + alphanumeric and underscore characters. 1012 + 1013 + Example: 1014 + cat /sys/bus/matrix/devices/matrix/features 1015 + guest_matrix dyn ap_config 1016 + 1017 + the following features are advertised: 1018 + 1019 + ---------------+---------------------------------------------------------------+ 1020 + | Flag | Description | 1021 + +==============+===============================================================+ 1022 + | guest_matrix | guest_matrix attribute exists. It reports the matrix of | 1023 + | | adapters and domains that are or will be passed through to a | 1024 + | | guest when the mdev is attached to it. | 1025 + +--------------+---------------------------------------------------------------+ 1026 + | dyn | Indicates hot plug/unplug of AP adapters, domains and control | 1027 + | | domains for a guest to which the mdev is attached. | 1028 + +------------+-----------------------------------------------------------------+ 1029 + | ap_config | ap_config interface for one-shot modifications to mdev config | 1030 + +--------------+---------------------------------------------------------------+ 1031 + 1032 Limitations 1033 =========== 1034 Live guest migration is not supported for guests using AP devices without
+4 -10
arch/s390/kernel/vdso64/vdso_user_wrapper.S
··· 13 * for details. 14 */ 15 .macro vdso_func func 16 - .globl __kernel_\func 17 - .type __kernel_\func,@function 18 - __ALIGN 19 - __kernel_\func: 20 CFI_STARTPROC 21 aghi %r15,-STACK_FRAME_VDSO_OVERHEAD 22 CFI_DEF_CFA_OFFSET (STACK_FRAME_USER_OVERHEAD + STACK_FRAME_VDSO_OVERHEAD) ··· 29 CFI_RESTORE 15 30 br %r14 31 CFI_ENDPROC 32 - .size __kernel_\func,.-__kernel_\func 33 .endm 34 35 vdso_func gettimeofday ··· 38 vdso_func getcpu 39 40 .macro vdso_syscall func,syscall 41 - .globl __kernel_\func 42 - .type __kernel_\func,@function 43 - __ALIGN 44 - __kernel_\func: 45 CFI_STARTPROC 46 svc \syscall 47 /* Make sure we notice when a syscall returns, which shouldn't happen */ 48 .word 0 49 CFI_ENDPROC 50 - .size __kernel_\func,.-__kernel_\func 51 .endm 52 53 vdso_syscall restart_syscall,__NR_restart_syscall
··· 13 * for details. 14 */ 15 .macro vdso_func func 16 + SYM_FUNC_START(__kernel_\func) 17 CFI_STARTPROC 18 aghi %r15,-STACK_FRAME_VDSO_OVERHEAD 19 CFI_DEF_CFA_OFFSET (STACK_FRAME_USER_OVERHEAD + STACK_FRAME_VDSO_OVERHEAD) ··· 32 CFI_RESTORE 15 33 br %r14 34 CFI_ENDPROC 35 + SYM_FUNC_END(__kernel_\func) 36 .endm 37 38 vdso_func gettimeofday ··· 41 vdso_func getcpu 42 43 .macro vdso_syscall func,syscall 44 + SYM_FUNC_START(__kernel_\func) 45 CFI_STARTPROC 46 svc \syscall 47 /* Make sure we notice when a syscall returns, which shouldn't happen */ 48 .word 0 49 CFI_ENDPROC 50 + SYM_FUNC_END(__kernel_\func) 51 .endm 52 53 vdso_syscall restart_syscall,__NR_restart_syscall
+36 -40
arch/s390/kernel/vdso64/vgetrandom-chacha.S
··· 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 #include <linux/linkage.h> 4 #include <asm/alternative.h> 5 #include <asm/fpu-insn.h> 6 7 #define STATE0 %v0 ··· 14 #define COPY1 %v5 15 #define COPY2 %v6 16 #define COPY3 %v7 17 - #define PERM4 %v16 18 - #define PERM8 %v17 19 - #define PERM12 %v18 20 #define BEPERM %v19 21 #define TMP0 %v20 22 #define TMP1 %v21 ··· 22 23 .section .rodata 24 25 - .balign 128 26 - .Lconstants: 27 .long 0x61707865,0x3320646e,0x79622d32,0x6b206574 # endian-neutral 28 - .long 0x04050607,0x08090a0b,0x0c0d0e0f,0x00010203 # rotl 4 bytes 29 - .long 0x08090a0b,0x0c0d0e0f,0x00010203,0x04050607 # rotl 8 bytes 30 - .long 0x0c0d0e0f,0x00010203,0x04050607,0x08090a0b # rotl 12 bytes 31 .long 0x03020100,0x07060504,0x0b0a0908,0x0f0e0d0c # byte swap 32 33 .text 34 /* ··· 40 * size_t nblocks) 41 */ 42 SYM_FUNC_START(__arch_chacha20_blocks_nostack) 43 - larl %r1,.Lconstants 44 45 /* COPY0 = "expand 32-byte k" */ 46 VL COPY0,0,,%r1 47 48 - /* PERM4-PERM12,BEPERM = byte selectors for VPERM */ 49 - VLM PERM4,BEPERM,16,%r1 50 51 /* COPY1,COPY2 = key */ 52 VLM COPY1,COPY2,0,%r3 ··· 87 VERLLF STATE1,STATE1,7 88 89 /* STATE1[0,1,2,3] = STATE1[1,2,3,0] */ 90 - VPERM STATE1,STATE1,STATE1,PERM4 91 /* STATE2[0,1,2,3] = STATE2[2,3,0,1] */ 92 - VPERM STATE2,STATE2,STATE2,PERM8 93 /* STATE3[0,1,2,3] = STATE3[3,0,1,2] */ 94 - VPERM STATE3,STATE3,STATE3,PERM12 95 96 /* STATE0 += STATE1, STATE3 = rotl32(STATE3 ^ STATE0, 16) */ 97 VAF STATE0,STATE0,STATE1 ··· 114 VERLLF STATE1,STATE1,7 115 116 /* STATE1[0,1,2,3] = STATE1[3,0,1,2] */ 117 - VPERM STATE1,STATE1,STATE1,PERM12 118 /* STATE2[0,1,2,3] = STATE2[2,3,0,1] */ 119 - VPERM STATE2,STATE2,STATE2,PERM8 120 /* STATE3[0,1,2,3] = STATE3[1,2,3,0] */ 121 - VPERM STATE3,STATE3,STATE3,PERM4 122 brctg %r0,.Ldoubleround 123 124 - /* OUTPUT0 = STATE0 + STATE0 */ 125 VAF STATE0,STATE0,COPY0 126 - /* OUTPUT1 = STATE1 + STATE1 */ 127 VAF STATE1,STATE1,COPY1 128 - /* OUTPUT2 = STATE2 + STATE2 */ 129 VAF STATE2,STATE2,COPY2 130 - /* OUTPUT2 = STATE3 + STATE3 */ 131 VAF STATE3,STATE3,COPY3 132 133 - /* 134 - * 32 bit wise little endian store to OUTPUT. If the vector 135 - * enhancement facility 2 is not installed use the slow path. 136 - */ 137 - ALTERNATIVE "brc 0xf,.Lstoreslow", "nop", ALT_FACILITY(148) 138 - VSTBRF STATE0,0,,%r2 139 - VSTBRF STATE1,16,,%r2 140 - VSTBRF STATE2,32,,%r2 141 - VSTBRF STATE3,48,,%r2 142 - .Lstoredone: 143 144 /* ++COPY3.COUNTER */ 145 /* alsih %r3,1 */ ··· 177 VZERO TMP3 178 179 br %r14 180 - 181 - .Lstoreslow: 182 - /* Convert STATE to little endian format and store to OUTPUT */ 183 - VPERM TMP0,STATE0,STATE0,BEPERM 184 - VPERM TMP1,STATE1,STATE1,BEPERM 185 - VPERM TMP2,STATE2,STATE2,BEPERM 186 - VPERM TMP3,STATE3,STATE3,BEPERM 187 - VSTM TMP0,TMP3,0,%r2 188 - j .Lstoredone 189 SYM_FUNC_END(__arch_chacha20_blocks_nostack)
··· 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 + #include <linux/stringify.h> 4 #include <linux/linkage.h> 5 #include <asm/alternative.h> 6 + #include <asm/dwarf.h> 7 #include <asm/fpu-insn.h> 8 9 #define STATE0 %v0 ··· 12 #define COPY1 %v5 13 #define COPY2 %v6 14 #define COPY3 %v7 15 #define BEPERM %v19 16 #define TMP0 %v20 17 #define TMP1 %v21 ··· 23 24 .section .rodata 25 26 + .balign 32 27 + SYM_DATA_START_LOCAL(chacha20_constants) 28 .long 0x61707865,0x3320646e,0x79622d32,0x6b206574 # endian-neutral 29 .long 0x03020100,0x07060504,0x0b0a0908,0x0f0e0d0c # byte swap 30 + SYM_DATA_END(chacha20_constants) 31 32 .text 33 /* ··· 43 * size_t nblocks) 44 */ 45 SYM_FUNC_START(__arch_chacha20_blocks_nostack) 46 + CFI_STARTPROC 47 + larl %r1,chacha20_constants 48 49 /* COPY0 = "expand 32-byte k" */ 50 VL COPY0,0,,%r1 51 52 + /* BEPERM = byte selectors for VPERM */ 53 + ALTERNATIVE __stringify(VL BEPERM,16,,%r1), "brcl 0,0", ALT_FACILITY(148) 54 55 /* COPY1,COPY2 = key */ 56 VLM COPY1,COPY2,0,%r3 ··· 89 VERLLF STATE1,STATE1,7 90 91 /* STATE1[0,1,2,3] = STATE1[1,2,3,0] */ 92 + VSLDB STATE1,STATE1,STATE1,4 93 /* STATE2[0,1,2,3] = STATE2[2,3,0,1] */ 94 + VSLDB STATE2,STATE2,STATE2,8 95 /* STATE3[0,1,2,3] = STATE3[3,0,1,2] */ 96 + VSLDB STATE3,STATE3,STATE3,12 97 98 /* STATE0 += STATE1, STATE3 = rotl32(STATE3 ^ STATE0, 16) */ 99 VAF STATE0,STATE0,STATE1 ··· 116 VERLLF STATE1,STATE1,7 117 118 /* STATE1[0,1,2,3] = STATE1[3,0,1,2] */ 119 + VSLDB STATE1,STATE1,STATE1,12 120 /* STATE2[0,1,2,3] = STATE2[2,3,0,1] */ 121 + VSLDB STATE2,STATE2,STATE2,8 122 /* STATE3[0,1,2,3] = STATE3[1,2,3,0] */ 123 + VSLDB STATE3,STATE3,STATE3,4 124 brctg %r0,.Ldoubleround 125 126 + /* OUTPUT0 = STATE0 + COPY0 */ 127 VAF STATE0,STATE0,COPY0 128 + /* OUTPUT1 = STATE1 + COPY1 */ 129 VAF STATE1,STATE1,COPY1 130 + /* OUTPUT2 = STATE2 + COPY2 */ 131 VAF STATE2,STATE2,COPY2 132 + /* OUTPUT3 = STATE3 + COPY3 */ 133 VAF STATE3,STATE3,COPY3 134 135 + ALTERNATIVE \ 136 + __stringify( \ 137 + /* Convert STATE to little endian and store to OUTPUT */\ 138 + VPERM TMP0,STATE0,STATE0,BEPERM; \ 139 + VPERM TMP1,STATE1,STATE1,BEPERM; \ 140 + VPERM TMP2,STATE2,STATE2,BEPERM; \ 141 + VPERM TMP3,STATE3,STATE3,BEPERM; \ 142 + VSTM TMP0,TMP3,0,%r2), \ 143 + __stringify( \ 144 + /* 32 bit wise little endian store to OUTPUT */ \ 145 + VSTBRF STATE0,0,,%r2; \ 146 + VSTBRF STATE1,16,,%r2; \ 147 + VSTBRF STATE2,32,,%r2; \ 148 + VSTBRF STATE3,48,,%r2; \ 149 + brcl 0,0), \ 150 + ALT_FACILITY(148) 151 152 /* ++COPY3.COUNTER */ 153 /* alsih %r3,1 */ ··· 173 VZERO TMP3 174 175 br %r14 176 + CFI_ENDPROC 177 SYM_FUNC_END(__arch_chacha20_blocks_nostack)
+13
drivers/s390/crypto/vfio_ap_drv.c
··· 26 struct ap_matrix_dev *matrix_dev; 27 debug_info_t *vfio_ap_dbf_info; 28 29 /* Only type 10 adapters (CEX4 and later) are supported 30 * by the AP matrix device driver 31 */ ··· 80 .name = "vfio_ap", 81 .bus = &matrix_bus, 82 .suppress_bind_attrs = true, 83 }; 84 85 static int vfio_ap_matrix_dev_create(void)
··· 26 struct ap_matrix_dev *matrix_dev; 27 debug_info_t *vfio_ap_dbf_info; 28 29 + static ssize_t features_show(struct device *dev, struct device_attribute *attr, char *buf) 30 + { 31 + return sysfs_emit(buf, "guest_matrix hotplug ap_config\n"); 32 + } 33 + static DEVICE_ATTR_RO(features); 34 + 35 + static struct attribute *matrix_dev_attrs[] = { 36 + &dev_attr_features.attr, 37 + NULL, 38 + }; 39 + ATTRIBUTE_GROUPS(matrix_dev); 40 + 41 /* Only type 10 adapters (CEX4 and later) are supported 42 * by the AP matrix device driver 43 */ ··· 68 .name = "vfio_ap", 69 .bus = &matrix_bus, 70 .suppress_bind_attrs = true, 71 + .dev_groups = matrix_dev_groups, 72 }; 73 74 static int vfio_ap_matrix_dev_create(void)
+3 -1
tools/include/linux/linkage.h
··· 4 #include <linux/export.h> 5 6 #define SYM_FUNC_START(x) .globl x; x: 7 - 8 #define SYM_FUNC_END(x) 9 10 #endif /* _TOOLS_INCLUDE_LINUX_LINKAGE_H */
··· 4 #include <linux/export.h> 5 6 #define SYM_FUNC_START(x) .globl x; x: 7 #define SYM_FUNC_END(x) 8 + #define SYM_DATA_START(x) .globl x; x: 9 + #define SYM_DATA_START_LOCAL(x) x: 10 + #define SYM_DATA_END(x) 11 12 #endif /* _TOOLS_INCLUDE_LINUX_LINKAGE_H */