153ba2eeeSMatthew Rosato /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
253ba2eeeSMatthew Rosato /*
353ba2eeeSMatthew Rosato  * VFIO Region definitions for ZPCI devices
453ba2eeeSMatthew Rosato  *
553ba2eeeSMatthew Rosato  * Copyright IBM Corp. 2020
653ba2eeeSMatthew Rosato  *
753ba2eeeSMatthew Rosato  * Author(s): Pierre Morel <pmorel@linux.ibm.com>
853ba2eeeSMatthew Rosato  *            Matthew Rosato <mjrosato@linux.ibm.com>
953ba2eeeSMatthew Rosato  */
1053ba2eeeSMatthew Rosato 
1153ba2eeeSMatthew Rosato #ifndef _VFIO_ZDEV_H_
1253ba2eeeSMatthew Rosato #define _VFIO_ZDEV_H_
1353ba2eeeSMatthew Rosato 
1453ba2eeeSMatthew Rosato #include <linux/types.h>
1553ba2eeeSMatthew Rosato #include <linux/vfio.h>
1653ba2eeeSMatthew Rosato 
1753ba2eeeSMatthew Rosato /**
1853ba2eeeSMatthew Rosato  * VFIO_DEVICE_INFO_CAP_ZPCI_BASE - Base PCI Function information
1953ba2eeeSMatthew Rosato  *
2053ba2eeeSMatthew Rosato  * This capability provides a set of descriptive information about the
2153ba2eeeSMatthew Rosato  * associated PCI function.
2253ba2eeeSMatthew Rosato  */
2353ba2eeeSMatthew Rosato struct vfio_device_info_cap_zpci_base {
2453ba2eeeSMatthew Rosato 	struct vfio_info_cap_header header;
2553ba2eeeSMatthew Rosato 	__u64 start_dma;	/* Start of available DMA addresses */
2653ba2eeeSMatthew Rosato 	__u64 end_dma;		/* End of available DMA addresses */
2753ba2eeeSMatthew Rosato 	__u16 pchid;		/* Physical Channel ID */
2853ba2eeeSMatthew Rosato 	__u16 vfn;		/* Virtual function number */
2953ba2eeeSMatthew Rosato 	__u16 fmb_length;	/* Measurement Block Length (in bytes) */
3053ba2eeeSMatthew Rosato 	__u8 pft;		/* PCI Function Type */
3153ba2eeeSMatthew Rosato 	__u8 gid;		/* PCI function group ID */
32*d525f73fSChenyi Qiang 	/* End of version 1 */
33*d525f73fSChenyi Qiang 	__u32 fh;		/* PCI function handle */
34*d525f73fSChenyi Qiang 	/* End of version 2 */
3553ba2eeeSMatthew Rosato };
3653ba2eeeSMatthew Rosato 
3753ba2eeeSMatthew Rosato /**
3853ba2eeeSMatthew Rosato  * VFIO_DEVICE_INFO_CAP_ZPCI_GROUP - Base PCI Function Group information
3953ba2eeeSMatthew Rosato  *
4053ba2eeeSMatthew Rosato  * This capability provides a set of descriptive information about the group of
4153ba2eeeSMatthew Rosato  * PCI functions that the associated device belongs to.
4253ba2eeeSMatthew Rosato  */
4353ba2eeeSMatthew Rosato struct vfio_device_info_cap_zpci_group {
4453ba2eeeSMatthew Rosato 	struct vfio_info_cap_header header;
4553ba2eeeSMatthew Rosato 	__u64 dasm;		/* DMA Address space mask */
4653ba2eeeSMatthew Rosato 	__u64 msi_addr;		/* MSI address */
4753ba2eeeSMatthew Rosato 	__u64 flags;
4853ba2eeeSMatthew Rosato #define VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH 1 /* Program-specified TLB refresh */
4953ba2eeeSMatthew Rosato 	__u16 mui;		/* Measurement Block Update Interval */
5053ba2eeeSMatthew Rosato 	__u16 noi;		/* Maximum number of MSIs */
5153ba2eeeSMatthew Rosato 	__u16 maxstbl;		/* Maximum Store Block Length */
5253ba2eeeSMatthew Rosato 	__u8 version;		/* Supported PCI Version */
53*d525f73fSChenyi Qiang 	/* End of version 1 */
54*d525f73fSChenyi Qiang 	__u8 reserved;
55*d525f73fSChenyi Qiang 	__u16 imaxstbl;		/* Maximum Interpreted Store Block Length */
56*d525f73fSChenyi Qiang 	/* End of version 2 */
5753ba2eeeSMatthew Rosato };
5853ba2eeeSMatthew Rosato 
5953ba2eeeSMatthew Rosato /**
6053ba2eeeSMatthew Rosato  * VFIO_DEVICE_INFO_CAP_ZPCI_UTIL - Utility String
6153ba2eeeSMatthew Rosato  *
6253ba2eeeSMatthew Rosato  * This capability provides the utility string for the associated device, which
6353ba2eeeSMatthew Rosato  * is a device identifier string made up of EBCDID characters.  'size' specifies
6453ba2eeeSMatthew Rosato  * the length of 'util_str'.
6553ba2eeeSMatthew Rosato  */
6653ba2eeeSMatthew Rosato struct vfio_device_info_cap_zpci_util {
6753ba2eeeSMatthew Rosato 	struct vfio_info_cap_header header;
6853ba2eeeSMatthew Rosato 	__u32 size;
6953ba2eeeSMatthew Rosato 	__u8 util_str[];
7053ba2eeeSMatthew Rosato };
7153ba2eeeSMatthew Rosato 
7253ba2eeeSMatthew Rosato /**
7353ba2eeeSMatthew Rosato  * VFIO_DEVICE_INFO_CAP_ZPCI_PFIP - PCI Function Path
7453ba2eeeSMatthew Rosato  *
7553ba2eeeSMatthew Rosato  * This capability provides the PCI function path string, which is an identifier
7653ba2eeeSMatthew Rosato  * that describes the internal hardware path of the device. 'size' specifies
7753ba2eeeSMatthew Rosato  * the length of 'pfip'.
7853ba2eeeSMatthew Rosato  */
7953ba2eeeSMatthew Rosato struct vfio_device_info_cap_zpci_pfip {
8053ba2eeeSMatthew Rosato 	struct vfio_info_cap_header header;
8153ba2eeeSMatthew Rosato 	__u32 size;
8253ba2eeeSMatthew Rosato 	__u8 pfip[];
8353ba2eeeSMatthew Rosato };
8453ba2eeeSMatthew Rosato 
8553ba2eeeSMatthew Rosato #endif
86