xref: /linux/include/uapi/linux/vfio_zdev.h (revision a625b2a387628df94e385faf5c81bf252f304ed9)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * VFIO Region definitions for ZPCI devices
4  *
5  * Copyright IBM Corp. 2020
6  *
7  * Author(s): Pierre Morel <pmorel@linux.ibm.com>
8  *            Matthew Rosato <mjrosato@linux.ibm.com>
9  */
10 
11 #ifndef _VFIO_ZDEV_H_
12 #define _VFIO_ZDEV_H_
13 
14 #include <linux/types.h>
15 #include <linux/vfio.h>
16 
17 /**
18  * VFIO_DEVICE_INFO_CAP_ZPCI_BASE - Base PCI Function information
19  *
20  * This capability provides a set of descriptive information about the
21  * associated PCI function.
22  */
23 struct vfio_device_info_cap_zpci_base {
24 	struct vfio_info_cap_header header;
25 	__u64 start_dma;	/* Start of available DMA addresses */
26 	__u64 end_dma;		/* End of available DMA addresses */
27 	__u16 pchid;		/* Physical Channel ID */
28 	__u16 vfn;		/* Virtual function number */
29 	__u16 fmb_length;	/* Measurement Block Length (in bytes) */
30 	__u8 pft;		/* PCI Function Type */
31 	__u8 gid;		/* PCI function group ID */
32 	/* End of version 1 */
33 	__u32 fh;		/* PCI function handle */
34 	/* End of version 2 */
35 	__u32 ccdf_err_length;	/* PCI CCDF length */
36 	/* End of version 3 */
37 };
38 
39 /**
40  * VFIO_DEVICE_INFO_CAP_ZPCI_GROUP - Base PCI Function Group information
41  *
42  * This capability provides a set of descriptive information about the group of
43  * PCI functions that the associated device belongs to.
44  */
45 struct vfio_device_info_cap_zpci_group {
46 	struct vfio_info_cap_header header;
47 	__u64 dasm;		/* DMA Address space mask */
48 	__u64 msi_addr;		/* MSI address */
49 	__u64 flags;
50 #define VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH 1 /* Program-specified TLB refresh */
51 	__u16 mui;		/* Measurement Block Update Interval */
52 	__u16 noi;		/* Maximum number of MSIs */
53 	__u16 maxstbl;		/* Maximum Store Block Length */
54 	__u8 version;		/* Supported PCI Version */
55 	/* End of version 1 */
56 	__u8 reserved;
57 	__u16 imaxstbl;		/* Maximum Interpreted Store Block Length */
58 	/* End of version 2 */
59 };
60 
61 /**
62  * VFIO_DEVICE_INFO_CAP_ZPCI_UTIL - Utility String
63  *
64  * This capability provides the utility string for the associated device, which
65  * is a device identifier string made up of EBCDID characters.  'size' specifies
66  * the length of 'util_str'.
67  */
68 struct vfio_device_info_cap_zpci_util {
69 	struct vfio_info_cap_header header;
70 	__u32 size;
71 	__u8 util_str[];
72 };
73 
74 /**
75  * VFIO_DEVICE_INFO_CAP_ZPCI_PFIP - PCI Function Path
76  *
77  * This capability provides the PCI function path string, which is an identifier
78  * that describes the internal hardware path of the device. 'size' specifies
79  * the length of 'pfip'.
80  */
81 struct vfio_device_info_cap_zpci_pfip {
82 	struct vfio_info_cap_header header;
83 	__u32 size;
84 	__u8 pfip[];
85 };
86 
87 #endif
88