mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-07 10:01:00 +01:00
vfio: Require that devices support DMA cache coherence
IOMMU_CACHE means that normal DMAs do not require any additional coherency mechanism and is the basic uAPI that VFIO exposes to userspace. For instance VFIO applications like DPDK will not work if additional coherency operations are required. Therefore check IOMMU_CAP_CACHE_COHERENCY like vdpa & usnic do before allowing an IOMMU backed VFIO device to be created. Reviewed-by: Kevin Tian <[email protected]> Acked-by: Alex Williamson <[email protected]> Acked-by: Robin Murphy <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
This commit is contained in:
1 parent
f78dc1dad8
commit
e8ae0e140c
1 file changed
+7
@@ -815,6 +815,13 @@ static int __vfio_register_dev(struct vfio_device *device,
|
||||
|
||||
int vfio_register_group_dev(struct vfio_device *device)
|
||||
{
|
||||
/*
|
||||
* VFIO always sets IOMMU_CACHE because we offer no way for userspace to
|
||||
* restore cache coherency.
|
||||
*/
|
||||
if (!iommu_capable(device->dev->bus, IOMMU_CAP_CACHE_COHERENCY))
|
||||
return -EINVAL;
|
||||
|
||||
return __vfio_register_dev(device,
|
||||
vfio_group_find_or_alloc(device->dev));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user