Thread (35 messages) 35 messages, 8 authors, 2020-10-16

Re: [PATCH v3 3/8] of/address: Introduce of_dma_get_max_cpu_address()

From: Nicolas Saenz Julienne <hidden>
Date: 2020-10-15 08:54:16
Also in: linux-devicetree, linux-iommu, lkml

On Wed, 2020-10-14 at 17:02 -0500, Rob Herring wrote:
On Wed, Oct 14, 2020 at 2:12 PM Nicolas Saenz Julienne
[off-list ref] wrote:
quoted
Introduce of_dma_get_max_cpu_address(), which provides the highest CPU
physical address addressable by all DMA masters in the system. It's
specially useful for setting memory zones sizes at early boot time.

Signed-off-by: Nicolas Saenz Julienne <redacted>

---
[...]
quoted
+       struct of_range_parser parser;
+       phys_addr_t subtree_max_addr;
+       struct device_node *child;
+       phys_addr_t cpu_end = 0;
+       struct of_range range;
+       const __be32 *ranges;
+       int len;
+
+       if (!np)
+               np = of_root;
+
+       ranges = of_get_property(np, "dma-ranges", &len);
I'm not really following why you changed the algorithm here. You're
skipping disabled nodes which is good. Was there some other reason?
Yes, it's a little more complex. But I had to change it in order to be able to
start parsing down from an arbitrary device node, which is needed for the unit
tests.

for_each_of_allnodes() and friends will traverse the whole tree, regardless of
the starting point. I couldn't find a similar function that would just iterate
over a subsection of the tree, so I went with this recursive approach.

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