From 1cbdabe203164433fbbec3a1815d8be42a085c88 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 17 Mar 2010 13:08:02 +0200 Subject: virtio: notifier support + APIs for queue fields vhost needs physical addresses for ring and other queue fields, so add APIs for these. In particular, add binding API to set host/guest notifiers. Will be used by vhost. Signed-off-by: Michael S. Tsirkin Signed-off-by: Anthony Liguori --- hw/virtio.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'hw/virtio.h') diff --git a/hw/virtio.h b/hw/virtio.h index 3baa2a34da..d0155e2761 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -19,6 +19,7 @@ #include "qdev.h" #include "sysemu.h" #include "block_int.h" +#include "event_notifier.h" /* from Linux's linux/virtio_config.h */ @@ -89,6 +90,8 @@ typedef struct { int (*load_config)(void * opaque, QEMUFile *f); int (*load_queue)(void * opaque, int n, QEMUFile *f); unsigned (*get_features)(void * opaque); + int (*set_guest_notifier)(void * opaque, int n, bool assigned); + int (*set_host_notifier)(void * opaque, int n, bool assigned); } VirtIOBindings; #define VIRTIO_PCI_QUEUE_MAX 64 @@ -181,5 +184,18 @@ void virtio_net_exit(VirtIODevice *vdev); DEFINE_PROP_BIT("indirect_desc", _state, _field, \ VIRTIO_RING_F_INDIRECT_DESC, true) - +target_phys_addr_t virtio_queue_get_desc_addr(VirtIODevice *vdev, int n); +target_phys_addr_t virtio_queue_get_avail_addr(VirtIODevice *vdev, int n); +target_phys_addr_t virtio_queue_get_used_addr(VirtIODevice *vdev, int n); +target_phys_addr_t virtio_queue_get_ring_addr(VirtIODevice *vdev, int n); +target_phys_addr_t virtio_queue_get_desc_size(VirtIODevice *vdev, int n); +target_phys_addr_t virtio_queue_get_avail_size(VirtIODevice *vdev, int n); +target_phys_addr_t virtio_queue_get_used_size(VirtIODevice *vdev, int n); +target_phys_addr_t virtio_queue_get_ring_size(VirtIODevice *vdev, int n); +uint16_t virtio_queue_get_last_avail_idx(VirtIODevice *vdev, int n); +void virtio_queue_set_last_avail_idx(VirtIODevice *vdev, int n, uint16_t idx); +VirtQueue *virtio_get_queue(VirtIODevice *vdev, int n); +EventNotifier *virtio_queue_get_guest_notifier(VirtQueue *vq); +EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq); +void virtio_irq(VirtQueue *vq); #endif -- cgit v1.2.3