提交 7ef32e52 编写于 作者: Y Yan Zhao 提交者: Alex Williamson

vfio: add a singleton check for vfio_group_pin_pages

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: 95fc87b4 ("vfio: Selective dirty page tracking if IOMMU backed device pins pages")
Signed-off-by: NYan Zhao <yan.y.zhao@intel.com>
Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
上级 ba4f184e
...@@ -2051,6 +2051,9 @@ int vfio_group_pin_pages(struct vfio_group *group, ...@@ -2051,6 +2051,9 @@ int vfio_group_pin_pages(struct vfio_group *group,
if (!group || !user_iova_pfn || !phys_pfn || !npage) if (!group || !user_iova_pfn || !phys_pfn || !npage)
return -EINVAL; return -EINVAL;
if (group->dev_counter > 1)
return -EINVAL;
if (npage > VFIO_PIN_PAGES_MAX_ENTRIES) if (npage > VFIO_PIN_PAGES_MAX_ENTRIES)
return -E2BIG; return -E2BIG;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册