mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
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 <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
2292b33986
commit
1cbdabe203
2 changed files with 96 additions and 2 deletions
18
hw/virtio.h
18
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue