[virtio] Add virtio 1.0 PCI support
This commit adds support for driving virtio 1.0 PCI devices. In addition to various helpers, a number of vpm_ functions are introduced to be used instead of their legacy vp_ counterparts when accessing virtio 1.0 (aka modern) devices. Signed-off-by: Ladi Prosek <lprosek@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
committed by
Michael Brown
parent
7b499f849e
commit
8a055a2a70
@@ -18,8 +18,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
#include "etherboot.h"
|
||||
#include "ipxe/io.h"
|
||||
#include "ipxe/virtio-ring.h"
|
||||
#include "ipxe/virtio-pci.h"
|
||||
#include "ipxe/virtio-ring.h"
|
||||
|
||||
#define BUG() do { \
|
||||
printf("BUG: failure at %s:%d/%s()!\n", \
|
||||
@@ -122,7 +122,8 @@ void vring_add_buf(struct vring_virtqueue *vq,
|
||||
wmb();
|
||||
}
|
||||
|
||||
void vring_kick(unsigned int ioaddr, struct vring_virtqueue *vq, int num_added)
|
||||
void vring_kick(struct virtio_pci_modern_device *vdev, unsigned int ioaddr,
|
||||
struct vring_virtqueue *vq, int num_added)
|
||||
{
|
||||
struct vring *vr = &vq->vring;
|
||||
|
||||
@@ -130,7 +131,13 @@ void vring_kick(unsigned int ioaddr, struct vring_virtqueue *vq, int num_added)
|
||||
vr->avail->idx += num_added;
|
||||
|
||||
mb();
|
||||
if (!(vr->used->flags & VRING_USED_F_NO_NOTIFY))
|
||||
vp_notify(ioaddr, vq->queue_index);
|
||||
if (!(vr->used->flags & VRING_USED_F_NO_NOTIFY)) {
|
||||
if (vdev) {
|
||||
/* virtio 1.0 */
|
||||
vpm_notify(vdev, vq);
|
||||
} else {
|
||||
/* legacy virtio */
|
||||
vp_notify(ioaddr, vq->queue_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user