aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Brucker <jean-philippe.brucker@arm.com>2019-01-10 14:12:49 +0000
committerWill Deacon <will.deacon@arm.com>2019-01-22 06:55:26 +0000
commit8003ede4c9720fa53f3b0396228f2864e3ad906a (patch)
treeffc146d63d7cb85ff9d916b9802b8fdab75245d8
parent7a7f45421f3a04e25d274c207ddd110af69da1bb (diff)
downloadkvmtool-8003ede4c9720fa53f3b0396228f2864e3ad906a.tar.gz
virtio/p9: Implement reset
The p9 reset cancels all running jobs and closes any open fid. Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com> Signed-off-by: Julien Thierry <julien.thierry@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--virtio/9p.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/virtio/9p.c b/virtio/9p.c
index d9f45cf0..6bae4030 100644
--- a/virtio/9p.c
+++ b/virtio/9p.c
@@ -1384,6 +1384,14 @@ static void set_guest_features(struct kvm *kvm, void *dev, u32 features)
static void notify_status(struct kvm *kvm, void *dev, u32 status)
{
+ struct p9_dev *p9dev = dev;
+ struct p9_fid *pfid, *next;
+
+ if (!(status & VIRTIO__STATUS_STOP))
+ return;
+
+ rbtree_postorder_for_each_entry_safe(pfid, next, &p9dev->fids, node)
+ close_fid(p9dev, pfid->fid);
}
static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 page_size, u32 align,
@@ -1413,6 +1421,13 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 page_size, u32 align,
return 0;
}
+static void exit_vq(struct kvm *kvm, void *dev, u32 vq)
+{
+ struct p9_dev *p9dev = dev;
+
+ thread_pool__cancel_job(&p9dev->jobs[vq].job_id);
+}
+
static int notify_vq(struct kvm *kvm, void *dev, u32 vq)
{
struct p9_dev *p9dev = dev;
@@ -1450,6 +1465,7 @@ struct virtio_ops p9_dev_virtio_ops = {
.get_host_features = get_host_features,
.set_guest_features = set_guest_features,
.init_vq = init_vq,
+ .exit_vq = exit_vq,
.notify_status = notify_status,
.notify_vq = notify_vq,
.get_vq = get_vq,