vhost_vdpa: support doorbell mapping via mmap
authorJason Wang <jasowang@redhat.com>
Fri, 29 May 2020 08:03:01 +0000 (16:03 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 4 Jun 2020 19:36:51 +0000 (15:36 -0400)
commitddd89d0a059d8e9740c75a97e0efe9bf07ee51f9
treea2e47501bbb773657cd6be05d28a033fcfd1ea7c
parentc25a26e653a61b93339dcd1b734c889df60b3eef
vhost_vdpa: support doorbell mapping via mmap

Currently the doorbell is relayed via eventfd which may have
significant overhead because of the cost of vmexits or syscall. This
patch introduces mmap() based doorbell mapping which can eliminate the
overhead caused by vmexit or syscall.

To ease the userspace modeling of the doorbell layout (usually
virtio-pci), this patch starts from a doorbell per page
model. Vhost-vdpa only support the hardware doorbell that sit at the
boundary of a page and does not share the page with other registers.

Doorbell of each virtqueue must be mapped separately, pgoff is the
index of the virtqueue. This allows userspace to map a subset of the
doorbell which may be useful for the implementation of software
assisted virtqueue (control vq) in the future.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20200529080303.15449-5-jasowang@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vdpa.c