xref: /linux/include/uapi/linux/vfio_zdev.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
10c633f0bSMatthew Rosato /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
20c633f0bSMatthew Rosato /*
30c633f0bSMatthew Rosato  * VFIO Region definitions for ZPCI devices
40c633f0bSMatthew Rosato  *
50c633f0bSMatthew Rosato  * Copyright IBM Corp. 2020
60c633f0bSMatthew Rosato  *
70c633f0bSMatthew Rosato  * Author(s): Pierre Morel <pmorel@linux.ibm.com>
80c633f0bSMatthew Rosato  *            Matthew Rosato <mjrosato@linux.ibm.com>
90c633f0bSMatthew Rosato  */
100c633f0bSMatthew Rosato 
110c633f0bSMatthew Rosato #ifndef _VFIO_ZDEV_H_
120c633f0bSMatthew Rosato #define _VFIO_ZDEV_H_
130c633f0bSMatthew Rosato 
140c633f0bSMatthew Rosato #include <linux/types.h>
150c633f0bSMatthew Rosato #include <linux/vfio.h>
160c633f0bSMatthew Rosato 
170c633f0bSMatthew Rosato /**
180c633f0bSMatthew Rosato  * VFIO_DEVICE_INFO_CAP_ZPCI_BASE - Base PCI Function information
190c633f0bSMatthew Rosato  *
200c633f0bSMatthew Rosato  * This capability provides a set of descriptive information about the
210c633f0bSMatthew Rosato  * associated PCI function.
220c633f0bSMatthew Rosato  */
230c633f0bSMatthew Rosato struct vfio_device_info_cap_zpci_base {
240c633f0bSMatthew Rosato 	struct vfio_info_cap_header header;
250c633f0bSMatthew Rosato 	__u64 start_dma;	/* Start of available DMA addresses */
260c633f0bSMatthew Rosato 	__u64 end_dma;		/* End of available DMA addresses */
270c633f0bSMatthew Rosato 	__u16 pchid;		/* Physical Channel ID */
280c633f0bSMatthew Rosato 	__u16 vfn;		/* Virtual function number */
290c633f0bSMatthew Rosato 	__u16 fmb_length;	/* Measurement Block Length (in bytes) */
300c633f0bSMatthew Rosato 	__u8 pft;		/* PCI Function Type */
310c633f0bSMatthew Rosato 	__u8 gid;		/* PCI function group ID */
32faf3bfcbSMatthew Rosato 	/* End of version 1 */
33faf3bfcbSMatthew Rosato 	__u32 fh;		/* PCI function handle */
34faf3bfcbSMatthew Rosato 	/* End of version 2 */
350c633f0bSMatthew Rosato };
360c633f0bSMatthew Rosato 
370c633f0bSMatthew Rosato /**
380c633f0bSMatthew Rosato  * VFIO_DEVICE_INFO_CAP_ZPCI_GROUP - Base PCI Function Group information
390c633f0bSMatthew Rosato  *
400c633f0bSMatthew Rosato  * This capability provides a set of descriptive information about the group of
410c633f0bSMatthew Rosato  * PCI functions that the associated device belongs to.
420c633f0bSMatthew Rosato  */
430c633f0bSMatthew Rosato struct vfio_device_info_cap_zpci_group {
440c633f0bSMatthew Rosato 	struct vfio_info_cap_header header;
450c633f0bSMatthew Rosato 	__u64 dasm;		/* DMA Address space mask */
460c633f0bSMatthew Rosato 	__u64 msi_addr;		/* MSI address */
470c633f0bSMatthew Rosato 	__u64 flags;
480c633f0bSMatthew Rosato #define VFIO_DEVICE_INFO_ZPCI_FLAG_REFRESH 1 /* Program-specified TLB refresh */
490c633f0bSMatthew Rosato 	__u16 mui;		/* Measurement Block Update Interval */
500c633f0bSMatthew Rosato 	__u16 noi;		/* Maximum number of MSIs */
510c633f0bSMatthew Rosato 	__u16 maxstbl;		/* Maximum Store Block Length */
520c633f0bSMatthew Rosato 	__u8 version;		/* Supported PCI Version */
53*ba6090ffSMatthew Rosato 	/* End of version 1 */
54*ba6090ffSMatthew Rosato 	__u8 reserved;
55*ba6090ffSMatthew Rosato 	__u16 imaxstbl;		/* Maximum Interpreted Store Block Length */
56*ba6090ffSMatthew Rosato 	/* End of version 2 */
570c633f0bSMatthew Rosato };
580c633f0bSMatthew Rosato 
590c633f0bSMatthew Rosato /**
600c633f0bSMatthew Rosato  * VFIO_DEVICE_INFO_CAP_ZPCI_UTIL - Utility String
610c633f0bSMatthew Rosato  *
620c633f0bSMatthew Rosato  * This capability provides the utility string for the associated device, which
630c633f0bSMatthew Rosato  * is a device identifier string made up of EBCDID characters.  'size' specifies
640c633f0bSMatthew Rosato  * the length of 'util_str'.
650c633f0bSMatthew Rosato  */
660c633f0bSMatthew Rosato struct vfio_device_info_cap_zpci_util {
670c633f0bSMatthew Rosato 	struct vfio_info_cap_header header;
680c633f0bSMatthew Rosato 	__u32 size;
690c633f0bSMatthew Rosato 	__u8 util_str[];
700c633f0bSMatthew Rosato };
710c633f0bSMatthew Rosato 
720c633f0bSMatthew Rosato /**
730c633f0bSMatthew Rosato  * VFIO_DEVICE_INFO_CAP_ZPCI_PFIP - PCI Function Path
740c633f0bSMatthew Rosato  *
750c633f0bSMatthew Rosato  * This capability provides the PCI function path string, which is an identifier
760c633f0bSMatthew Rosato  * that describes the internal hardware path of the device. 'size' specifies
770c633f0bSMatthew Rosato  * the length of 'pfip'.
780c633f0bSMatthew Rosato  */
790c633f0bSMatthew Rosato struct vfio_device_info_cap_zpci_pfip {
800c633f0bSMatthew Rosato 	struct vfio_info_cap_header header;
810c633f0bSMatthew Rosato 	__u32 size;
820c633f0bSMatthew Rosato 	__u8 pfip[];
830c633f0bSMatthew Rosato };
840c633f0bSMatthew Rosato 
850c633f0bSMatthew Rosato #endif
86