[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1457715275-11925-3-git-send-email-okaya@codeaurora.org>
Date: Fri, 11 Mar 2016 11:54:34 -0500
From: Sinan Kaya <okaya@...eaurora.org>
To: kvm@...r.kernel.org, timur@...eaurora.org, cov@...eaurora.org,
jcm@...hat.com, eric.auger@...aro.org
Cc: shankerd@...eaurora.org, vikrams@...eaurora.org,
marc.zyngier@....com, mark.rutland@....com,
devicetree@...r.kernel.org, vinod.koul@...el.com,
agross@...eaurora.org, linux-arm-msm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Sinan Kaya <okaya@...eaurora.org>,
Baptiste Reynal <b.reynal@...tualopensystems.com>,
Alex Williamson <alex.williamson@...hat.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/3] vfio, platform: make reset driver a requirement
The code was allowing platform devices to be used without a supporting VFIO
reset driver. The hardware can be left in some inconsistent state after a
guest machine abort.
The reset driver will put the hardware back to safe state and disable
interrupts before returning the control back to the host machine.
Signed-off-by: Sinan Kaya <okaya@...eaurora.org>
---
drivers/vfio/platform/vfio_platform_common.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
index b3f6ba2..5535fe1 100644
--- a/drivers/vfio/platform/vfio_platform_common.c
+++ b/drivers/vfio/platform/vfio_platform_common.c
@@ -165,12 +165,8 @@ static void vfio_platform_release(void *device_data)
mutex_lock(&driver_lock);
if (!(--vdev->refcnt)) {
- if (vdev->reset) {
- dev_info(vdev->device, "reset\n");
- vdev->reset(vdev);
- } else {
- dev_warn(vdev->device, "no reset function found!\n");
- }
+ dev_info(vdev->device, "reset\n");
+ vdev->reset(vdev);
vfio_platform_regions_cleanup(vdev);
vfio_platform_irq_cleanup(vdev);
}
@@ -634,7 +630,13 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev,
return ret;
}
- vfio_platform_get_reset(vdev);
+ ret = vfio_platform_get_reset(vdev);
+ if (ret) {
+ pr_err("vfio: no reset function found for device %s\n",
+ vdev->name);
+ iommu_group_put(group);
+ return ret;
+ }
mutex_init(&vdev->igate);
return 0;
--
1.8.2.1
Powered by blists - more mailing lists