From: Sinan Kaya <okaya@codeaurora.org>
To: kvm@vger.kernel.org, timur@codeaurora.org, cov@codeaurora.org,
jcm@redhat.com, eric.auger@linaro.org
Cc: shankerd@codeaurora.org, vikrams@codeaurora.org,
marc.zyngier@arm.com, mark.rutland@arm.com,
devicetree@vger.kernel.org, vinod.koul@intel.com,
agross@codeaurora.org, linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Sinan Kaya <okaya@codeaurora.org>,
Baptiste Reynal <b.reynal@virtualopensystems.com>,
Alex Williamson <alex.williamson@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH V2 2/3] vfio, platform: make reset driver a requirement
Date: Fri, 11 Mar 2016 11:54:34 -0500 [thread overview]
Message-ID: <1457715275-11925-3-git-send-email-okaya@codeaurora.org> (raw)
In-Reply-To: <1457715275-11925-1-git-send-email-okaya@codeaurora.org>
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@codeaurora.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
next prev parent reply other threads:[~2016-03-11 16:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 16:54 [PATCH V2 0/3] vfio, platform: add HIDMA and ACPI support Sinan Kaya
2016-03-11 16:54 ` [PATCH V2 1/3] vfio, platform: add support for ACPI while detecting the reset driver Sinan Kaya
2016-03-11 16:54 ` Sinan Kaya [this message]
2016-03-13 17:25 ` [PATCH V2 2/3] vfio, platform: make reset driver a requirement Sinan Kaya
[not found] ` <56E5A271.6000408-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-03-16 4:36 ` Eric Auger
[not found] ` <56E8E2CD.3020604-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-03-16 14:27 ` Sinan Kaya
2016-03-27 15:21 ` Eric Auger
2016-03-27 17:55 ` Sinan Kaya
2016-03-11 16:54 ` [PATCH V2 3/3] vfio, platform: add QTI HIDMA reset driver Sinan Kaya
2016-03-11 17:00 ` Sinan Kaya
[not found] ` <1457715275-11925-4-git-send-email-okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-03-11 18:35 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457715275-11925-3-git-send-email-okaya@codeaurora.org \
--to=okaya@codeaurora.org \
--cc=agross@codeaurora.org \
--cc=alex.williamson@redhat.com \
--cc=b.reynal@virtualopensystems.com \
--cc=cov@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=eric.auger@linaro.org \
--cc=jcm@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=shankerd@codeaurora.org \
--cc=timur@codeaurora.org \
--cc=vikrams@codeaurora.org \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).