From f2ba7e8c947bf38fec799fdf9122e05a6a3e8382 Mon Sep 17 00:00:00 2001 From: Diana Craciun Date: Mon, 5 Oct 2020 20:36:50 +0300 Subject: vfio/fsl-mc: Added lock support in preparation for interrupt handling Only the DPRC object allocates interrupts from the MSI interrupt domain. The interrupts are managed by the DPRC in a pool of interrupts. The access to this pool of interrupts has to be protected with a lock. This patch extends the current lock implementation to have a lock per DPRC. Signed-off-by: Diana Craciun Reviewed-by: Eric Auger Signed-off-by: Alex Williamson --- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/vfio/fsl-mc/vfio_fsl_mc_private.h') diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc_private.h b/drivers/vfio/fsl-mc/vfio_fsl_mc_private.h index be60f41af30f..d47ef6215429 100644 --- a/drivers/vfio/fsl-mc/vfio_fsl_mc_private.h +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc_private.h @@ -15,6 +15,11 @@ #define VFIO_FSL_MC_INDEX_TO_OFFSET(index) \ ((u64)(index) << VFIO_FSL_MC_OFFSET_SHIFT) +struct vfio_fsl_mc_reflck { + struct kref kref; + struct mutex lock; +}; + struct vfio_fsl_mc_region { u32 flags; u32 type; @@ -27,7 +32,7 @@ struct vfio_fsl_mc_device { struct notifier_block nb; int refcnt; struct vfio_fsl_mc_region *regions; - struct mutex driver_lock; + struct vfio_fsl_mc_reflck *reflck; }; #endif /* VFIO_FSL_MC_PRIVATE_H */ -- cgit v1.2.3