summaryrefslogtreecommitdiff
path: root/drivers/vfio
diff options
context:
space:
mode:
authorBharat Bhushan <Bharat.Bhushan@nxp.com>2017-03-06 09:52:00 (GMT)
committerXie Xiaobo <xiaobo.xie@nxp.com>2017-09-25 07:25:33 (GMT)
commit175c7ac7b23245387c5abcb0ab88a35f2b9dddff (patch)
treeb043d9630c14384df904f27a092ea52020a2902d /drivers/vfio
parentb43009bdc12c82cea808bce0c6825a99a6756cb5 (diff)
downloadlinux-175c7ac7b23245387c5abcb0ab88a35f2b9dddff.tar.xz
vfio/fsl-mc: non-dprc device support added
Non-DPRC devices shares it's parent container MC portal to communicate to MC hardware. Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/fsl-mc/vfio_fsl_mc.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
index 8f3a625..eb40249 100644
--- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c
+++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
@@ -229,9 +229,16 @@ static int vfio_fsl_mc_probe(struct fsl_mc_device *mc_dev)
goto free_vfio_device;
}
} else {
- /* Handling for Non-DPRC device to be added */
- ret = -EINVAL;
- goto free_vfio_device;
+ struct fsl_mc_device *mc_bus_dev;
+
+ /* Non-dprc devices share mc_io from the parent dprc */
+ mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
+ if (mc_bus_dev == NULL) {
+ vfio_del_group_dev(dev);
+ goto free_vfio_device;
+ }
+
+ mc_dev->mc_io = mc_bus_dev->mc_io;
}
return 0;
@@ -253,6 +260,8 @@ static int vfio_fsl_mc_remove(struct fsl_mc_device *mc_dev)
if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
vfio_fsl_mc_cleanup_dprc(vdev);
+ mc_dev->mc_io = NULL;
+
vfio_iommu_group_put(mc_dev->dev.iommu_group, dev);
kfree(vdev);