mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
vdpa: adapt vhost_ops callbacks to svq
First half of the buffers forwarding part, preparing vhost-vdpa callbacks to SVQ to offer it. QEMU cannot enable it at this moment, so this is effectively dead code at the moment, but it helps to reduce patch size. Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
dafb34c992
commit
d96be4c894
1 changed files with 41 additions and 7 deletions
|
@ -733,6 +733,13 @@ static int vhost_vdpa_get_config(struct vhost_dev *dev, uint8_t *config,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vhost_vdpa_set_dev_vring_base(struct vhost_dev *dev,
|
||||||
|
struct vhost_vring_state *ring)
|
||||||
|
{
|
||||||
|
trace_vhost_vdpa_set_vring_base(dev, ring->index, ring->num);
|
||||||
|
return vhost_vdpa_call(dev, VHOST_SET_VRING_BASE, ring);
|
||||||
|
}
|
||||||
|
|
||||||
static int vhost_vdpa_set_vring_dev_kick(struct vhost_dev *dev,
|
static int vhost_vdpa_set_vring_dev_kick(struct vhost_dev *dev,
|
||||||
struct vhost_vring_file *file)
|
struct vhost_vring_file *file)
|
||||||
{
|
{
|
||||||
|
@ -747,6 +754,18 @@ static int vhost_vdpa_set_vring_dev_call(struct vhost_dev *dev,
|
||||||
return vhost_vdpa_call(dev, VHOST_SET_VRING_CALL, file);
|
return vhost_vdpa_call(dev, VHOST_SET_VRING_CALL, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vhost_vdpa_set_vring_dev_addr(struct vhost_dev *dev,
|
||||||
|
struct vhost_vring_addr *addr)
|
||||||
|
{
|
||||||
|
trace_vhost_vdpa_set_vring_addr(dev, addr->index, addr->flags,
|
||||||
|
addr->desc_user_addr, addr->used_user_addr,
|
||||||
|
addr->avail_user_addr,
|
||||||
|
addr->log_guest_addr);
|
||||||
|
|
||||||
|
return vhost_vdpa_call(dev, VHOST_SET_VRING_ADDR, addr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the shadow virtqueue descriptors to the device
|
* Set the shadow virtqueue descriptors to the device
|
||||||
*
|
*
|
||||||
|
@ -856,11 +875,17 @@ static int vhost_vdpa_set_log_base(struct vhost_dev *dev, uint64_t base,
|
||||||
static int vhost_vdpa_set_vring_addr(struct vhost_dev *dev,
|
static int vhost_vdpa_set_vring_addr(struct vhost_dev *dev,
|
||||||
struct vhost_vring_addr *addr)
|
struct vhost_vring_addr *addr)
|
||||||
{
|
{
|
||||||
trace_vhost_vdpa_set_vring_addr(dev, addr->index, addr->flags,
|
struct vhost_vdpa *v = dev->opaque;
|
||||||
addr->desc_user_addr, addr->used_user_addr,
|
|
||||||
addr->avail_user_addr,
|
if (v->shadow_vqs_enabled) {
|
||||||
addr->log_guest_addr);
|
/*
|
||||||
return vhost_vdpa_call(dev, VHOST_SET_VRING_ADDR, addr);
|
* Device vring addr was set at device start. SVQ base is handled by
|
||||||
|
* VirtQueue code.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return vhost_vdpa_set_vring_dev_addr(dev, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vhost_vdpa_set_vring_num(struct vhost_dev *dev,
|
static int vhost_vdpa_set_vring_num(struct vhost_dev *dev,
|
||||||
|
@ -873,8 +898,17 @@ static int vhost_vdpa_set_vring_num(struct vhost_dev *dev,
|
||||||
static int vhost_vdpa_set_vring_base(struct vhost_dev *dev,
|
static int vhost_vdpa_set_vring_base(struct vhost_dev *dev,
|
||||||
struct vhost_vring_state *ring)
|
struct vhost_vring_state *ring)
|
||||||
{
|
{
|
||||||
trace_vhost_vdpa_set_vring_base(dev, ring->index, ring->num);
|
struct vhost_vdpa *v = dev->opaque;
|
||||||
return vhost_vdpa_call(dev, VHOST_SET_VRING_BASE, ring);
|
|
||||||
|
if (v->shadow_vqs_enabled) {
|
||||||
|
/*
|
||||||
|
* Device vring base was set at device start. SVQ base is handled by
|
||||||
|
* VirtQueue code.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return vhost_vdpa_set_dev_vring_base(dev, ring);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
|
static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue