android_kernel_msm-6.1_noth.../drivers/vhost
Cindy Lu 2f5aa54e40 vhost_vdpa: fix unmap process in no-batch mode
commit c82729e06644f4e087f5ff0f91b8fb15e03b8890 upstream.

While using the vdpa device with vIOMMU enabled
in the guest VM, when the vdpa device bind to vfio-pci and run testpmd
then system will fail to unmap.
The test process is
Load guest VM --> attach to virtio driver--> bind to vfio-pci driver
So the mapping process is
1)batched mode map to normal MR
2)batched mode unmapped the normal MR
3)unmapped all the memory
4)mapped to iommu MR

This error happened in step 3). The iotlb was freed in step 2)
and the function vhost_vdpa_process_iotlb_msg will return fail
Which causes failure.

To fix this, we will not remove the AS while the iotlb->nmaps is 0.
This will free in the vhost_vdpa_clean

Cc: stable@vger.kernel.org
Fixes: aaca8373c4 ("vhost-vdpa: support ASID based IOTLB API")
Signed-off-by: Cindy Lu <lulu@redhat.com>
Message-Id: <20230420151734.860168-1-lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-11 23:03:41 +09:00
..
iotlb.c vhost_iotlb: split out IOTLB initialization 2022-05-31 12:44:28 -04:00
Kconfig vhost_vdpa: implement IRQ offloading in vhost_vdpa 2020-08-05 11:08:42 -04:00
Makefile vhost: introduce vDPA-based backend 2020-04-02 10:41:40 -04:00
net.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
scsi.c vhost-scsi: unbreak any layout for response 2023-02-09 11:28:04 +01:00
test.c vhost: rename vhost_work_dev_flush 2022-05-31 12:45:10 -04:00
test.h tools/virtio: Add --reset 2020-06-22 12:34:21 -04:00
vdpa.c vhost_vdpa: fix unmap process in no-batch mode 2023-05-11 23:03:41 +09:00
vhost.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
vhost.h vhost/net: Clear the pending messages when the backend is removed 2023-02-09 11:28:03 +01:00
vringh.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
vsock.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00