/* the notify function used when creating a virt queue */ boolvp_notify(struct virtqueue *vq) { /* we write the queue's selector into the notification register to * signal the other end */ iowrite16(vq->index, (void __iomem *)vq->priv); returntrue; }
/* * vp_modern_get_queue_notify_off - get notification offset for a virtqueue * @mdev: the modern virtio-pci device * @index: the queue index * * Returns the notification offset for a virtqueue */ static u16 vp_modern_get_queue_notify_off(struct virtio_pci_modern_device *mdev, u16 index) { vp_iowrite16(index, &mdev->common->queue_select);
/* * vp_modern_map_vq_notify - map notification area for a * specific virtqueue * @mdev: the modern virtio-pci device * @index: the queue index * @pa: the pointer to the physical address of the nofity area * * Returns the address of the notification area */ void __iomem *vp_modern_map_vq_notify(struct virtio_pci_modern_device *mdev, u16 index, resource_size_t *pa) { u16 off = vp_modern_get_queue_notify_off(mdev, index);
if (mdev->notify_base) { /* offset should not wrap */ if ((u64)off * mdev->notify_offset_multiplier + 2 > mdev->notify_len) { dev_warn(&mdev->pci_dev->dev, "bad notification offset %u (x %u) " "for queue %u > %zd", off, mdev->notify_offset_multiplier, index, mdev->notify_len); returnNULL; } if (pa) *pa = mdev->notify_pa + off * mdev->notify_offset_multiplier; return mdev->notify_base + off * mdev->notify_offset_multiplier; } else { ... } }