xref: /openbmc/linux/arch/s390/include/uapi/asm/uvdevice.h (revision 2f164822)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *  Copyright IBM Corp. 2022
4  *  Author(s): Steffen Eiden <seiden@linux.ibm.com>
5  */
6 #ifndef __S390_ASM_UVDEVICE_H
7 #define __S390_ASM_UVDEVICE_H
8 
9 #include <linux/types.h>
10 
11 struct uvio_ioctl_cb {
12 	__u32 flags;
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 */
16 	__u32 argument_len;
17 	__u8  reserved14[0x40 - 0x14];	/* must be zero */
18 };
19 
20 #define UVIO_ATT_USER_DATA_LEN		0x100
21 #define UVIO_ATT_UID_LEN		0x10
22 struct uvio_attest {
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 */
33 };
34 
35 /*
36  * The following max values define an upper length for the IOCTL in/out buffers.
37  * However, they do not represent the maximum the Ultravisor allows which is
38  * often way smaller. By allowing larger buffer sizes we hopefully do not need
39  * to update the code with every machine update. It is therefore possible for
40  * userspace to request more memory than actually used by kernel/UV.
41  */
42 #define UVIO_ATT_ARCB_MAX_LEN		0x100000
43 #define UVIO_ATT_MEASUREMENT_MAX_LEN	0x8000
44 #define UVIO_ATT_ADDITIONAL_MAX_LEN	0x8000
45 
46 #define UVIO_DEVICE_NAME "uv"
47 #define UVIO_TYPE_UVC 'u'
48 
49 #define UVIO_IOCTL_ATT _IOWR(UVIO_TYPE_UVC, 0x01, struct uvio_ioctl_cb)
50 
51 #endif /* __S390_ASM_UVDEVICE_H */
52