public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm tools: Add optional callbacks for VQs
@ 2011-11-16 12:24 Sasha Levin
  2011-11-16 12:24 ` [PATCH 2/2] kvm tools: Add vhost-net support Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2011-11-16 12:24 UTC (permalink / raw)
  To: penberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Sasha Levin

This patch adds optional callbacks which get called when the VQ gets assigned
an eventfd for notifications, and when it gets assigned with a GSI.

This allows the device to pass the eventfds to 3rd parties which can use
them to notify and get notifications regarding the VQ.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/include/kvm/virtio-trans.h |    2 ++
 tools/kvm/virtio/pci.c               |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/include/kvm/virtio-trans.h b/tools/kvm/include/kvm/virtio-trans.h
index d9f4b95..e7c186e 100644
--- a/tools/kvm/include/kvm/virtio-trans.h
+++ b/tools/kvm/include/kvm/virtio-trans.h
@@ -20,6 +20,8 @@ struct virtio_ops {
 	int (*notify_vq)(struct kvm *kvm, void *dev, u32 vq);
 	int (*get_pfn_vq)(struct kvm *kvm, void *dev, u32 vq);
 	int (*get_size_vq)(struct kvm *kvm, void *dev, u32 vq);
+	void (*notify_vq_gsi)(struct kvm *kvm, void *dev, u32 vq, u32 gsi);
+	void (*notify_vq_eventfd)(struct kvm *kvm, void *dev, u32 vq, u32 efd);
 };
 
 struct virtio_trans_ops {
diff --git a/tools/kvm/virtio/pci.c b/tools/kvm/virtio/pci.c
index 1660f06..0737ae7 100644
--- a/tools/kvm/virtio/pci.c
+++ b/tools/kvm/virtio/pci.c
@@ -51,6 +51,9 @@ static int virtio_pci__init_ioeventfd(struct kvm *kvm, struct virtio_trans *vtra
 
 	ioeventfd__add_event(&ioevent);
 
+	if (vtrans->virtio_ops->notify_vq_eventfd)
+		vtrans->virtio_ops->notify_vq_eventfd(kvm, vpci->dev, vq, ioevent.fd);
+
 	return 0;
 }
 
@@ -152,6 +155,9 @@ static bool virtio_pci__specific_io_out(struct kvm *kvm, struct virtio_trans *vt
 
 			gsi = irq__add_msix_route(kvm, &vpci->msix_table[vec].msg);
 			vpci->gsis[vpci->queue_selector] = gsi;
+			if (vtrans->virtio_ops->notify_vq_gsi)
+				vtrans->virtio_ops->notify_vq_gsi(kvm, vpci->dev,
+							vpci->queue_selector, gsi);
 			break;
 		}
 		};
-- 
1.7.8.rc1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-16 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-16 12:24 [PATCH 1/2] kvm tools: Add optional callbacks for VQs Sasha Levin
2011-11-16 12:24 ` [PATCH 2/2] kvm tools: Add vhost-net support Sasha Levin
2011-11-16 12:45   ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox