Thread (28 messages) 28 messages, 2 authors, 2023-06-10

Re: [PATCH v3 23/25] iommu: Add ops->domain_alloc_paging()

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2023-06-10 12:04:02
Also in: linux-arm-msm, linux-iommu, linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi, linux-tegra

On Sat, Jun 10, 2023 at 05:08:31PM +0800, Baolu Lu wrote:
quoted
@@ -1992,8 +1993,13 @@ static struct iommu_domain *__iommu_domain_alloc(const struct iommu_ops *ops,
  	if (alloc_type == IOMMU_DOMAIN_IDENTITY && ops->identity_domain)
  		return ops->identity_domain;
+	else if (type & __IOMMU_DOMAIN_PAGING) {
+		domain = ops->domain_alloc_paging(dev);
This might be problematic because not all IOMMU drivers implement this
callback now. In the missing cases, the code will always result in a
null pointer reference issue?
Ah, thank you that is a rebasing error :(
quoted
  struct iommu_domain *iommu_domain_alloc(const struct bus_type *bus)
  {
  	if (bus == NULL || bus->iommu_ops == NULL)
  		return NULL;
-	return __iommu_domain_alloc(bus->iommu_ops, IOMMU_DOMAIN_UNMANAGED);
+	return __iommu_domain_alloc(bus->iommu_ops, NULL,
+				    IOMMU_DOMAIN_UNMANAGED);
Suppose that iommu_domain_alloc() is always called from device drivers
where device pointer is always available. Is it possible to convert it
to a real device pointer?
Yes, Robin has a series for that

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help