Lines Matching +full:iommu +full:- +full:map

1 // SPDX-License-Identifier: GPL-2.0-only
3 * OF helpers for IOMMU
9 #include <linux/iommu.h>
23 * of_get_dma_window - Parse *dma-window property and returns 0 if found.
44 return -EINVAL; in of_get_dma_window()
49 snprintf(propname, sizeof(propname), "%sdma-window", prefix); in of_get_dma_window()
50 snprintf(addrname, sizeof(addrname), "%s#dma-address-cells", prefix); in of_get_dma_window()
51 snprintf(sizename, sizeof(sizename), "%s#dma-size-cells", prefix); in of_get_dma_window()
55 return -ENODEV; in of_get_dma_window()
68 prop = of_get_property(dn, "#address-cells", NULL); in of_get_dma_window()
72 return -EINVAL; in of_get_dma_window()
79 return -EINVAL; in of_get_dma_window()
94 struct fwnode_handle *fwnode = &iommu_spec->np->fwnode; in of_iommu_xlate()
98 if ((ops && !ops->of_xlate) || in of_iommu_xlate()
99 !of_device_is_available(iommu_spec->np)) in of_iommu_xlate()
102 ret = iommu_fwspec_init(dev, &iommu_spec->np->fwnode, ops); in of_iommu_xlate()
106 * The otherwise-empty fwspec handily serves to indicate the specific in of_iommu_xlate()
107 * IOMMU device we're waiting for, which will be useful if we ever get in of_iommu_xlate()
108 * a proper probe-ordering dependency mechanism in future. in of_iommu_xlate()
113 if (!try_module_get(ops->owner)) in of_iommu_xlate()
114 return -ENODEV; in of_iommu_xlate()
116 ret = ops->of_xlate(dev, iommu_spec); in of_iommu_xlate()
117 module_put(ops->owner); in of_iommu_xlate()
128 err = of_map_id(master_np, *id, "iommu-map", in of_iommu_configure_dev_id()
129 "iommu-map-mask", &iommu_spec.np, in of_iommu_configure_dev_id()
132 return err == -ENODEV ? NO_IOMMU : err; in of_iommu_configure_dev_id()
146 "#iommu-cells", in of_iommu_configure_dev()
168 return of_iommu_configure_dev_id(info->np, info->dev, &input_id); in of_pci_iommu_init()
190 if (fwspec->ops) in of_iommu_configure()
191 return fwspec->ops; in of_iommu_configure()
198 * We don't currently walk up the tree looking for a parent IOMMU. in of_iommu_configure()
200 * Documentation/devicetree/bindings/iommu/iommu.txt in of_iommu_configure()
216 of_property_read_u32(master_np, "pasid-num-bits", in of_iommu_configure()
217 &fwspec->num_pasid_bits); in of_iommu_configure()
221 * Two success conditions can be represented by non-negative err here: in of_iommu_configure()
222 * >0 : there is no IOMMU, or one was unavailable for non-fatal reasons in of_iommu_configure()
223 * 0 : we found an IOMMU, and dev->fwspec is initialised appropriately in of_iommu_configure()
229 ops = fwspec->ops; in of_iommu_configure()
232 * If we have reason to believe the IOMMU driver missed the initial in of_iommu_configure()
235 if (!err && dev->bus && !device_iommu_mapped(dev)) in of_iommu_configure()
239 if (err == -EPROBE_DEFER) { in of_iommu_configure()
242 dev_dbg(dev, "Adding to IOMMU failed: %d\n", err); in of_iommu_configure()