1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2 /* 3 * Copyright 2013-2016 Freescale Semiconductor Inc. 4 * Copyright 2016,2019-2020 NXP 5 */ 6 7 #ifndef VFIO_FSL_MC_PRIVATE_H 8 #define VFIO_FSL_MC_PRIVATE_H 9 10 #define VFIO_FSL_MC_OFFSET_SHIFT 40 11 #define VFIO_FSL_MC_OFFSET_MASK (((u64)(1) << VFIO_FSL_MC_OFFSET_SHIFT) - 1) 12 13 #define VFIO_FSL_MC_OFFSET_TO_INDEX(off) ((off) >> VFIO_FSL_MC_OFFSET_SHIFT) 14 15 #define VFIO_FSL_MC_INDEX_TO_OFFSET(index) \ 16 ((u64)(index) << VFIO_FSL_MC_OFFSET_SHIFT) 17 18 struct vfio_fsl_mc_irq { 19 u32 flags; 20 u32 count; 21 struct eventfd_ctx *trigger; 22 char *name; 23 }; 24 25 struct vfio_fsl_mc_region { 26 u32 flags; 27 u32 type; 28 u64 addr; 29 resource_size_t size; 30 void __iomem *ioaddr; 31 }; 32 33 struct vfio_fsl_mc_device { 34 struct vfio_device vdev; 35 struct fsl_mc_device *mc_dev; 36 struct notifier_block nb; 37 struct vfio_fsl_mc_region *regions; 38 struct mutex igate; 39 struct vfio_fsl_mc_irq *mc_irqs; 40 }; 41 42 extern int vfio_fsl_mc_set_irqs_ioctl(struct vfio_fsl_mc_device *vdev, 43 u32 flags, unsigned int index, 44 unsigned int start, unsigned int count, 45 void *data); 46 47 void vfio_fsl_mc_irqs_cleanup(struct vfio_fsl_mc_device *vdev); 48 49 #endif /* VFIO_FSL_MC_PRIVATE_H */ 50