On 15.09.21 22:10, Oleksandr wrote:
Hi Stefano.
[snip]
+static int __init find_memory_holes(const struct kernel_info *kinfo,
+ struct meminfo *ext_regions)
+{
+ struct dt_device_node *np;
+ struct rangeset *mem_holes;
+ paddr_t start, end;
+ unsigned int i;
+ int res;
+
+ dt_dprintk("Find memory holes for extended regions\n");
+
+ mem_holes = rangeset_new(NULL, NULL, 0);
+ if ( !mem_holes )
+ return -ENOMEM;
+
+ /* Start with maximum possible addressable physical memory
range */
+ start = EXT_REGION_START;
+ end = min((1ULL << p2m_ipa_bits) - 1, EXT_REGION_END);
+ res = rangeset_add_range(mem_holes, start, end);
+ if ( res )
+ {
+ printk(XENLOG_ERR "Failed to add: %#"PRIx64"->%#"PRIx64"\n",
+ start, end);
+ goto out;
+ }
+
+ /* Remove all regions described by "reg" property (MMIO, RAM,
etc) */
+ dt_for_each_device_node( dt_host, np )
Don't you need something like device_tree_for_each_node ?
dt_for_each_device_node won't go down any deeper in the tree?
Thank you for pointing this out, I will investigate and update the patch.
I have checked, dt_for_each_device_node( dt_host, np ) iterates all
nodes, so nothing will be skipped.
As an example for this node:
hdmi@fead0000 {
compatible = "renesas,r8a7795-hdmi", "renesas,rcar-gen3-hdmi";
reg = <0x0 0xfead0000 0x0 0x10000>;
interrupts = <0x0 0x185 0x4>;
clocks = <0xc 0x1 0x2d9 0xc 0x0 0x28>;
clock-names = "iahb", "isfr";
power-domains = <0x9 0x20>;
resets = <0xc 0x2d9>;
status = "okay";
iommus = <0x50 0xc>;
xen,passthrough;
ports {
#address-cells = <0x1>;
#size-cells = <0x0>;
port@0 {
reg = <0x0>;
endpoint {
remote-endpoint = <0xb1>;
phandle = <0xc1>;
};
};
port@1 {
reg = <0x1>;
endpoint {
remote-endpoint = <0xb2>;
phandle = <0xd1>;
};
};
port@2 {
reg = <0x2>;
endpoint {
remote-endpoint = <0x6f>;
phandle = <0x6e>;
};
};
};
};
(XEN) process /soc/hdmi@fead0000
(XEN) ---number_of_address = 1
(XEN) -------0: 0xfead0000->0xfeae0000
(XEN) process /soc/hdmi@fead0000/ports
(XEN) ---number_of_address = 0
(XEN) process /soc/hdmi@fead0000/ports/port@0
(XEN) ---number_of_address = 0
(XEN) process /soc/hdmi@fead0000/ports/port@0/endpoint
(XEN) ---number_of_address = 0
(XEN) process /soc/hdmi@fead0000/ports/port@1
(XEN) ---number_of_address = 0
(XEN) process /soc/hdmi@fead0000/ports/port@1/endpoint
(XEN) ---number_of_address = 0
(XEN) process /soc/hdmi@fead0000/ports/port@2
(XEN) ---number_of_address = 0
(XEN) process /soc/hdmi@fead0000/ports/port@2/endpoint
(XEN) ---number_of_address = 0
[snip]
--
Regards,
Oleksandr Tyshchenko