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