[PATCH RFC v2 00/10] vdpa: add vdpa simulator for block device

From: Stefano Garzarella
Date: Thu Jan 28 2021 - 09:43:35 EST


v1: https://lore.kernel.org/lkml/93f207c0-61e6-3696-f218-e7d7ea9a7c93@xxxxxxxxxx/

This series is the second part of the v1 linked above. The first part with
refactoring of vdpa_sim has already been merged.

The patches are based on Max Gurtovoy's work and extend the block simulator to
have a ramdisk behaviour.

As mentioned in the v1 there was 2 issues and I fixed them in this series:
1. The identical mapping in the IOMMU used until now in vdpa_sim created issues
when mapping different virtual pages with the same physical address.
Fixed by patch "vdpa_sim: use iova module to allocate IOVA addresses"

2. There was a race accessing the IOMMU between the vdpasim_blk_work() and the
device driver that map/unmap DMA regions. Fixed by patch "vringh: add
'iotlb_lock' to synchronize iotlb accesses"

Since this series is still a RFC, I used the Xie's patch as is to allow
vhost-vdpa to use block devices, but I'll rebase when he splits it into
multiple patches.

The series also includes small fixes for vdpa_sim that I discovered while
implementing the block simulator.

Thanks for your feedback,
Stefano

Max Gurtovoy (1):
vdpa: add vdpa simulator for block device

Stefano Garzarella (8):
vdpa_sim: use iova module to allocate IOVA addresses
vringh: add 'iotlb_lock' to synchronize iotlb accesses
vringh: reset kiov 'consumed' field in __vringh_iov()
vringh: implement vringh_kiov_advance()
vringh: add vringh_kiov_length() helper
vdpa_sim: cleanup kiovs in vdpasim_free()
vdpa_sim_blk: implement ramdisk behaviour
vdpa_sim_blk: handle VIRTIO_BLK_T_GET_ID

Xie Yongji (1):
vdpa: Remove the restriction that only supports virtio-net devices

drivers/vdpa/vdpa_sim/vdpa_sim.h | 2 +
include/linux/vringh.h | 19 +-
drivers/vdpa/vdpa_sim/vdpa_sim.c | 118 +++++++----
drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 288 +++++++++++++++++++++++++++
drivers/vhost/vdpa.c | 28 +--
drivers/vhost/vringh.c | 54 +++--
drivers/vdpa/Kconfig | 8 +
drivers/vdpa/vdpa_sim/Makefile | 1 +
8 files changed, 433 insertions(+), 85 deletions(-)
create mode 100644 drivers/vdpa/vdpa_sim/vdpa_sim_blk.c

--
2.29.2