summaryrefslogtreecommitdiffstats
path: root/drivers/vfio/fsl-mc/vfio_fsl_mc_private.h
diff options
context:
space:
mode:
authorDiana Craciun <diana.craciun@oss.nxp.com>2020-10-05 20:36:48 +0300
committerAlex Williamson <alex.williamson@redhat.com>2020-10-12 11:32:24 -0600
commitdf747bcd5b216dae7be26945fab2558ed2f7f363 (patch)
tree3b8fe3851102adbb9803dd0c66152cf9ae424d8e /drivers/vfio/fsl-mc/vfio_fsl_mc_private.h
parentf97f4c04e5d6ca8b90b5b412bd7e72de79426263 (diff)
downloadlinux-stable-df747bcd5b216dae7be26945fab2558ed2f7f363.tar.gz
linux-stable-df747bcd5b216dae7be26945fab2558ed2f7f363.tar.bz2
linux-stable-df747bcd5b216dae7be26945fab2558ed2f7f363.zip
vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call
Expose to userspace information about the memory regions. Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com> Signed-off-by: Diana Craciun <diana.craciun@oss.nxp.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/fsl-mc/vfio_fsl_mc_private.h')
-rw-r--r--drivers/vfio/fsl-mc/vfio_fsl_mc_private.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc_private.h b/drivers/vfio/fsl-mc/vfio_fsl_mc_private.h
index 37d61eaa58c8..be60f41af30f 100644
--- a/drivers/vfio/fsl-mc/vfio_fsl_mc_private.h
+++ b/drivers/vfio/fsl-mc/vfio_fsl_mc_private.h
@@ -7,9 +7,27 @@
#ifndef VFIO_FSL_MC_PRIVATE_H
#define VFIO_FSL_MC_PRIVATE_H
+#define VFIO_FSL_MC_OFFSET_SHIFT 40
+#define VFIO_FSL_MC_OFFSET_MASK (((u64)(1) << VFIO_FSL_MC_OFFSET_SHIFT) - 1)
+
+#define VFIO_FSL_MC_OFFSET_TO_INDEX(off) ((off) >> VFIO_FSL_MC_OFFSET_SHIFT)
+
+#define VFIO_FSL_MC_INDEX_TO_OFFSET(index) \
+ ((u64)(index) << VFIO_FSL_MC_OFFSET_SHIFT)
+
+struct vfio_fsl_mc_region {
+ u32 flags;
+ u32 type;
+ u64 addr;
+ resource_size_t size;
+};
+
struct vfio_fsl_mc_device {
struct fsl_mc_device *mc_dev;
struct notifier_block nb;
+ int refcnt;
+ struct vfio_fsl_mc_region *regions;
+ struct mutex driver_lock;
};
#endif /* VFIO_FSL_MC_PRIVATE_H */