1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * Copyright IBM Corp. 2022, 2024
6 #ifndef __S390_ASM_UVDEVICE_H
7 #define __S390_ASM_UVDEVICE_H
9 #include <linux/types.h>
11 struct uvio_ioctl_cb {
13 __u16 uv_rc; /* UV header rc value */
14 __u16 uv_rrc; /* UV header rrc value */
15 __u64 argument_addr; /* Userspace address of uvio argument */
17 __u8 reserved14[0x40 - 0x14]; /* must be zero */
20 #define UVIO_ATT_USER_DATA_LEN 0x100
21 #define UVIO_ATT_UID_LEN 0x10
23 __u64 arcb_addr; /* 0x0000 */
24 __u64 meas_addr; /* 0x0008 */
25 __u64 add_data_addr; /* 0x0010 */
26 __u8 user_data[UVIO_ATT_USER_DATA_LEN]; /* 0x0018 */
27 __u8 config_uid[UVIO_ATT_UID_LEN]; /* 0x0118 */
28 __u32 arcb_len; /* 0x0128 */
29 __u32 meas_len; /* 0x012c */
30 __u32 add_data_len; /* 0x0130 */
31 __u16 user_data_len; /* 0x0134 */
32 __u16 reserved136; /* 0x0136 */
36 * uvio_uvdev_info - Information of supported functions
37 * @supp_uvio_cmds - supported IOCTLs by this device
38 * @supp_uv_cmds - supported UVCs corresponding to the IOCTL
40 * UVIO request to get information about supported request types by this
41 * uvdevice and the Ultravisor. Everything is output. Bits are in LSB0
42 * ordering. If the bit is set in both, @supp_uvio_cmds and @supp_uv_cmds, the
43 * uvdevice and the Ultravisor support that call.
45 * Note that bit 0 (UVIO_IOCTL_UVDEV_INFO_NR) is always zero for `supp_uv_cmds`
46 * as there is no corresponding UV-call.
48 struct uvio_uvdev_info {
50 * If bit `n` is set, this device supports the IOCTL with nr `n`.
54 * If bit `n` is set, the Ultravisor(UV) supports the UV-call
55 * corresponding to the IOCTL with nr `n` in the calling context (host
56 * or guest). The value is only valid if the corresponding bit in
57 * @supp_uvio_cmds is set as well.
63 * The following max values define an upper length for the IOCTL in/out buffers.
64 * However, they do not represent the maximum the Ultravisor allows which is
65 * often way smaller. By allowing larger buffer sizes we hopefully do not need
66 * to update the code with every machine update. It is therefore possible for
67 * userspace to request more memory than actually used by kernel/UV.
69 #define UVIO_ATT_ARCB_MAX_LEN 0x100000
70 #define UVIO_ATT_MEASUREMENT_MAX_LEN 0x8000
71 #define UVIO_ATT_ADDITIONAL_MAX_LEN 0x8000
72 #define UVIO_ADD_SECRET_MAX_LEN 0x100000
73 #define UVIO_LIST_SECRETS_LEN 0x1000
74 #define UVIO_RETR_SECRET_MAX_LEN 0x2000
76 #define UVIO_DEVICE_NAME "uv"
77 #define UVIO_TYPE_UVC 'u'
80 UVIO_IOCTL_UVDEV_INFO_NR = 0x00,
82 UVIO_IOCTL_ADD_SECRET_NR,
83 UVIO_IOCTL_LIST_SECRETS_NR,
84 UVIO_IOCTL_LOCK_SECRETS_NR,
85 UVIO_IOCTL_RETR_SECRET_NR,
86 /* must be the last entry */
90 #define UVIO_IOCTL(nr) _IOWR(UVIO_TYPE_UVC, nr, struct uvio_ioctl_cb)
91 #define UVIO_IOCTL_UVDEV_INFO UVIO_IOCTL(UVIO_IOCTL_UVDEV_INFO_NR)
92 #define UVIO_IOCTL_ATT UVIO_IOCTL(UVIO_IOCTL_ATT_NR)
93 #define UVIO_IOCTL_ADD_SECRET UVIO_IOCTL(UVIO_IOCTL_ADD_SECRET_NR)
94 #define UVIO_IOCTL_LIST_SECRETS UVIO_IOCTL(UVIO_IOCTL_LIST_SECRETS_NR)
95 #define UVIO_IOCTL_LOCK_SECRETS UVIO_IOCTL(UVIO_IOCTL_LOCK_SECRETS_NR)
96 #define UVIO_IOCTL_RETR_SECRET UVIO_IOCTL(UVIO_IOCTL_RETR_SECRET_NR)
98 #define UVIO_SUPP_CALL(nr) (1ULL << (nr))
99 #define UVIO_SUPP_UDEV_INFO UVIO_SUPP_CALL(UVIO_IOCTL_UDEV_INFO_NR)
100 #define UVIO_SUPP_ATT UVIO_SUPP_CALL(UVIO_IOCTL_ATT_NR)
101 #define UVIO_SUPP_ADD_SECRET UVIO_SUPP_CALL(UVIO_IOCTL_ADD_SECRET_NR)
102 #define UVIO_SUPP_LIST_SECRETS UVIO_SUPP_CALL(UVIO_IOCTL_LIST_SECRETS_NR)
103 #define UVIO_SUPP_LOCK_SECRETS UVIO_SUPP_CALL(UVIO_IOCTL_LOCK_SECRETS_NR)
104 #define UVIO_SUPP_RETR_SECRET UVIO_SUPP_CALL(UVIO_IOCTL_RETR_SECRET_NR)
106 #endif /* __S390_ASM_UVDEVICE_H */