dm/VBS-U: implement write callback of notify cfg

virtio_notify_cfg_write is called when guest driver performs virtqueue
kick by writing the notificaiton register of the virtqueue.

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Reviewed-by: Hao Li <hao.l.li@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jian Jun Chen 2018-03-29 12:18:25 +08:00 committed by Jack Ren
parent cfa591aedf
commit 76422fd5f1
1 changed files with 25 additions and 1 deletions

View File

@ -1340,7 +1340,31 @@ static void
virtio_notify_cfg_write(struct pci_vdev *dev, uint64_t offset, int size,
uint64_t value)
{
/* TODO: to be implemented */
struct virtio_base *base = dev->arg;
struct virtio_vq_info *vq;
struct virtio_ops *vops;
const char *name;
uint64_t idx;
idx = offset / VIRTIO_MODERN_NOTIFY_OFF_MULT;
vops = base->vops;
name = vops->name;
if (idx >= vops->nvq) {
fprintf(stderr,
"%s: queue %lu notify out of range\r\n", name, idx);
return;
}
vq = &base->queues[idx];
if (vq->notify)
(*vq->notify)(DEV_STRUCT(base), vq);
else if (vops->qnotify)
(*vops->qnotify)(DEV_STRUCT(base), vq);
else
fprintf(stderr,
"%s: qnotify queue %lu: missing vq/vops notify\r\n",
name, idx);
}
static uint32_t