vfio: add a singleton check for vfio_group_pin_pages
authorYan Zhao <yan.y.zhao@intel.com>
Wed, 16 Sep 2020 02:28:33 +0000 (10:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:08:05 +0000 (10:08 +0100)
commitb40bd0d87d1a1d267ba67cc55efb9ed643d6b22a
tree263d71aa836ba8b6e265c4d45390d9bfad7f4b94
parent7e4f15f7c99bd1cbf296db3b55039206db985057
vfio: add a singleton check for vfio_group_pin_pages

[ Upstream commit 7ef32e52368f62a4e041a4f0abefb4fb64e7fd4a ]

Page pinning is used both to translate and pin device mappings for DMA
purpose, as well as to indicate to the IOMMU backend to limit the dirty
page scope to those pages that have been pinned, in the case of an IOMMU
backed device.
To support this, the vfio_pin_pages() interface limits itself to only
singleton groups such that the IOMMU backend can consider dirty page
scope only at the group level.  Implement the same requirement for the
vfio_group_pin_pages() interface.

Fixes: 95fc87b44104 ("vfio: Selective dirty page tracking if IOMMU backed device pins pages")
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/vfio.c