Skip to content
Snippets Groups Projects
Commit 4bbc69f2 authored by Diana Craciun's avatar Diana Craciun
Browse files

Add reset per device support


Currently when the device is reset, the entire DPRC container
was reset which is very inefficient because the devices within a
container will be reset multiple times.
Added support for individually resetting a device.

Signed-off-by: default avatarDiana Craciun <diana.craciun@oss.nxp.com>
parent f83ee2a6
No related merge requests found
...@@ -162,6 +162,33 @@ err_reg_init: ...@@ -162,6 +162,33 @@ err_reg_init:
return ret; return ret;
} }
static int vfio_fsl_mc_reset_device(struct vfio_fsl_mc_device *vdev)
{
struct fsl_mc_device *mc_dev = vdev->mc_dev;
u16 token;
int ret = 0;
if (is_fsl_mc_bus_dprc(vdev->mc_dev)) {
return dprc_reset_container(mc_dev->mc_io, 0,
mc_dev->mc_handle,
mc_dev->obj_desc.id,
DPRC_RESET_OPTION_NON_RECURSIVE);
} else {
int err;
err = fsl_mc_obj_open(mc_dev->mc_io, 0, mc_dev->obj_desc.id,
mc_dev->obj_desc.type,
&token);
if (err)
return err;
ret = fsl_mc_obj_reset(mc_dev->mc_io, 0, token);
err = fsl_mc_obj_close(mc_dev->mc_io, 0, token);
if (err)
return err;
}
return ret;
}
static void vfio_fsl_mc_release(void *device_data) static void vfio_fsl_mc_release(void *device_data)
{ {
struct vfio_fsl_mc_device *vdev = device_data; struct vfio_fsl_mc_device *vdev = device_data;
...@@ -177,10 +204,7 @@ static void vfio_fsl_mc_release(void *device_data) ...@@ -177,10 +204,7 @@ static void vfio_fsl_mc_release(void *device_data)
vfio_fsl_mc_regions_cleanup(vdev); vfio_fsl_mc_regions_cleanup(vdev);
/* reset the device before cleaning up the interrupts */ /* reset the device before cleaning up the interrupts */
ret = dprc_reset_container(mc_cont->mc_io, 0, ret = vfio_fsl_mc_reset_device(vdev);
mc_cont->mc_handle,
mc_cont->obj_desc.id,
DPRC_RESET_OPTION_NON_RECURSIVE);
if (ret) { if (ret) {
dev_warn(&mc_cont->dev, "VFIO_FLS_MC: reset device has failed (%d)\n", dev_warn(&mc_cont->dev, "VFIO_FLS_MC: reset device has failed (%d)\n",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment