Commit 705e60ba authored by Eric Auger's avatar Eric Auger Committed by Alex Williamson

vfio: platform: add dev_info on device reset

It might be helpful for the end-user to check the device reset
function was found by the vfio platform reset framework.

Lets store a pointer to the struct device in vfio_platform_device
and trace when the reset function is called or not found.
Signed-off-by: default avatarEric Auger <eric.auger@linaro.org>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent e9e0506e
...@@ -144,8 +144,12 @@ static void vfio_platform_release(void *device_data) ...@@ -144,8 +144,12 @@ static void vfio_platform_release(void *device_data)
mutex_lock(&driver_lock); mutex_lock(&driver_lock);
if (!(--vdev->refcnt)) { if (!(--vdev->refcnt)) {
if (vdev->reset) if (vdev->reset) {
dev_info(vdev->device, "reset\n");
vdev->reset(vdev); vdev->reset(vdev);
} else {
dev_warn(vdev->device, "no reset function found!\n");
}
vfio_platform_regions_cleanup(vdev); vfio_platform_regions_cleanup(vdev);
vfio_platform_irq_cleanup(vdev); vfio_platform_irq_cleanup(vdev);
} }
...@@ -174,8 +178,12 @@ static int vfio_platform_open(void *device_data) ...@@ -174,8 +178,12 @@ static int vfio_platform_open(void *device_data)
if (ret) if (ret)
goto err_irq; goto err_irq;
if (vdev->reset) if (vdev->reset) {
dev_info(vdev->device, "reset\n");
vdev->reset(vdev); vdev->reset(vdev);
} else {
dev_warn(vdev->device, "no reset function found!\n");
}
} }
vdev->refcnt++; vdev->refcnt++;
...@@ -551,6 +559,8 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev, ...@@ -551,6 +559,8 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev,
return -EINVAL; return -EINVAL;
} }
vdev->device = dev;
group = iommu_group_get(dev); group = iommu_group_get(dev);
if (!group) { if (!group) {
pr_err("VFIO: No IOMMU group for device %s\n", vdev->name); pr_err("VFIO: No IOMMU group for device %s\n", vdev->name);
......
...@@ -59,6 +59,7 @@ struct vfio_platform_device { ...@@ -59,6 +59,7 @@ struct vfio_platform_device {
struct module *parent_module; struct module *parent_module;
const char *compat; const char *compat;
struct module *reset_module; struct module *reset_module;
struct device *device;
/* /*
* These fields should be filled by the bus specific binder * These fields should be filled by the bus specific binder
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment