[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74f7033192488c472ca04b7d03e4dc5705f80cc0.1674849118.git.nicolinc@nvidia.com>
Date: Fri, 27 Jan 2023 12:04:19 -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 3/4] iommufd: Do not allocate device object if broken_unmanaged_domain
Add a sanity of the broken_unmanaged_domain flag to reject the use of
iommufd 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/iommu/iommufd/device.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index d81f93a321af..41b55615a693 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -73,6 +73,9 @@ struct iommufd_device *iommufd_device_bind(struct iommufd_ctx *ictx,
if (!device_iommu_capable(dev, IOMMU_CAP_CACHE_COHERENCY))
return ERR_PTR(-EINVAL);
+ if (!device_iommu_unmanaged_supported(dev))
+ return ERR_PTR(-EINVAL);
+
group = iommu_group_get(dev);
if (!group)
return ERR_PTR(-ENODEV);
--
2.39.1
Powered by blists - more mailing lists