Thread (41 messages) 41 messages, 8 authors, 2022-04-01

Re: [PATCH v2 2/5] iommu: Implement of_iommu_get_resv_regions()

From: Dmitry Osipenko <digetx@gmail.com>
Date: 2021-07-17 11:07:22
Also in: linux-iommu, linux-tegra

16.07.2021 17:41, Rob Herring пишет:
On Fri, Jul 2, 2021 at 8:05 AM Dmitry Osipenko [off-list ref] wrote:
quoted
23.04.2021 19:32, Thierry Reding пишет:
quoted
+void of_iommu_get_resv_regions(struct device *dev, struct list_head *list)
+{
+     struct of_phandle_iterator it;
+     int err;
+
+     of_for_each_phandle(&it, err, dev->of_node, "memory-region", "#memory-region-cells", 0) {
+             struct iommu_resv_region *region;
+             struct of_phandle_args args;
+             struct resource res;
+
+             args.args_count = of_phandle_iterator_args(&it, args.args, MAX_PHANDLE_ARGS);
+
+             err = of_address_to_resource(it.node, 0, &res);
+             if (err < 0) {
+                     dev_err(dev, "failed to parse memory region %pOF: %d\n",
+                             it.node, err);
+                     continue;
+             }
+
+             if (args.args_count > 0) {
+                     /*
+                      * Active memory regions are expected to be accessed by hardware during
+                      * boot and must therefore have an identity mapping created prior to the
+                      * driver taking control of the hardware. This ensures that non-quiescent
+                      * hardware doesn't cause IOMMU faults during boot.
+                      */
+                     if (args.args[0] & MEMORY_REGION_IDENTITY_MAPPING) {
+                             region = iommu_alloc_resv_region(res.start, resource_size(&res),
+                                                              IOMMU_READ | IOMMU_WRITE,
+                                                              IOMMU_RESV_DIRECT_RELAXABLE);
+                             if (!region)
+                                     continue;
+
+                             list_add_tail(&region->list, list);
+                     }
+             }
+     }
+}
+EXPORT_SYMBOL(of_iommu_get_resv_regions);
Any reason why this is not EXPORT_SYMBOL_GPL? I'm curious what is the
logic behind the OF symbols in general since it looks like half of them
are GPL.
Generally, new ones are _GPL. Old ones probably predate _GPL.

This one is up to the IOMMU maintainers.
Thank you.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help