mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
qemu/virtio: virtio support for many interrupt vectors
Extend virtio to support many interrupt vectors, and rearrange code in preparation for multi-vector support (mostly move reset out to bindings, because we will have to reset the vectors in transport-specific code). Actual bindings in pci, and use in net, to follow. Load and save are not connected to bindings yet, so they are left stubbed out for now. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
54c96da798
commit
7055e687cd
4 changed files with 81 additions and 25 deletions
10
hw/virtio.h
10
hw/virtio.h
|
@ -75,11 +75,13 @@ typedef struct VirtQueueElement
|
|||
} VirtQueueElement;
|
||||
|
||||
typedef struct {
|
||||
void (*update_irq)(void * opaque);
|
||||
void (*notify)(void * opaque, uint16_t vector);
|
||||
} VirtIOBindings;
|
||||
|
||||
#define VIRTIO_PCI_QUEUE_MAX 16
|
||||
|
||||
#define VIRTIO_NO_VECTOR 0xffff
|
||||
|
||||
struct VirtIODevice
|
||||
{
|
||||
const char *name;
|
||||
|
@ -89,6 +91,8 @@ struct VirtIODevice
|
|||
uint32_t features;
|
||||
size_t config_len;
|
||||
void *config;
|
||||
uint16_t config_vector;
|
||||
int nvectors;
|
||||
uint32_t (*get_features)(VirtIODevice *vdev);
|
||||
uint32_t (*bad_features)(VirtIODevice *vdev);
|
||||
void (*set_features)(VirtIODevice *vdev, uint32_t val);
|
||||
|
@ -118,7 +122,7 @@ void virtio_notify(VirtIODevice *vdev, VirtQueue *vq);
|
|||
|
||||
void virtio_save(VirtIODevice *vdev, QEMUFile *f);
|
||||
|
||||
void virtio_load(VirtIODevice *vdev, QEMUFile *f);
|
||||
int virtio_load(VirtIODevice *vdev, QEMUFile *f);
|
||||
|
||||
void virtio_cleanup(VirtIODevice *vdev);
|
||||
|
||||
|
@ -144,6 +148,8 @@ void virtio_queue_set_addr(VirtIODevice *vdev, int n, target_phys_addr_t addr);
|
|||
target_phys_addr_t virtio_queue_get_addr(VirtIODevice *vdev, int n);
|
||||
int virtio_queue_get_num(VirtIODevice *vdev, int n);
|
||||
void virtio_queue_notify(VirtIODevice *vdev, int n);
|
||||
uint16_t virtio_queue_vector(VirtIODevice *vdev, int n);
|
||||
void virtio_queue_set_vector(VirtIODevice *vdev, int n, uint16_t vector);
|
||||
void virtio_reset(void *opaque);
|
||||
void virtio_update_irq(VirtIODevice *vdev);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue