lkml.org 
[lkml]   [2023]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/4] vfio: Do not allocate domain if broken_unmanaged_domain
Date
Add a sanity of the broken_unmanaged_domain flag to reject the use of
vfio_iommu_type1 in the early stage, if the flag is set by the iommu
driver.

Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
drivers/vfio/vfio_iommu_type1.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 23c24fe98c00..6ec238aefe89 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -2170,7 +2170,10 @@ static int vfio_iommu_domain_alloc(struct device *dev, void *data)
{
struct iommu_domain **domain = data;

- *domain = iommu_domain_alloc(dev->bus);
+ if (device_iommu_unmanaged_supported(dev))
+ *domain = iommu_domain_alloc(dev->bus);
+ else
+ *domain = NULL;
return 1; /* Don't iterate */
}

--
2.39.1
\
 
 \ /
  Last update: 2023-03-26 23:59    [W:0.129 / U:0.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site