[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <42f5cec9d3f03eab3af9509bd5a730f6a1414989.1674849118.git.nicolinc@nvidia.com>
Date: Fri, 27 Jan 2023 12:04:20 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: <jgg@...dia.com>, <kevin.tian@...el.com>, <robin.murphy@....com>,
<joro@...tes.org>, <will@...nel.org>, <agross@...nel.org>,
<andersson@...nel.org>, <konrad.dybcio@...aro.org>,
<yong.wu@...iatek.com>, <matthias.bgg@...il.com>,
<thierry.reding@...il.com>, <alex.williamson@...hat.com>,
<cohuck@...hat.com>
CC: <vdumpa@...dia.com>, <jonathanh@...dia.com>,
<iommu@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<linux-arm-msm@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-tegra@...r.kernel.org>, <kvm@...r.kernel.org>
Subject: [PATCH 4/4] vfio: Do not allocate domain if broken_unmanaged_domain
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@...dia.com>
Signed-off-by: Nicolin Chen <nicolinc@...dia.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
Powered by blists - more mailing lists