<div dir="ltr">Hi Chan,<div> The O/S builds out multiple memory nodes using the addresses in the 'ranges' property. <span style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium">'Each node is divided up into a number of blocks called </span><em style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium">zones</em><a name="@mainindex51" style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium"></a><span style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium"> which represent ranges within memory...' from (</span><a href="https://www.kernel.org/doc/gorman/html/understand/understand005.html">https://www.kernel.org/doc/gorman/html/understand/understand005.html</a><span style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium">)</span></div><div><br></div><div> Also, please read this:</div><div> </div><div><div> <a href="https://devicetree-specification.readthedocs.io/en/latest/chapter3-devicenodes.html">https://devicetree-specification.readthedocs.io/en/latest/chapter3-devicenodes.html</a></div><div><br></div><div><span style="color:rgb(62,67,73);font-family:Georgia,serif;font-size:17px">"A memory device node is required for all device trees and describes the physical memory layout for the system. If a system has multiple ranges of memory, multiple memory nodes can be created, or the ranges can be specified in the </span><em style="color:rgb(62,67,73);font-family:Georgia,serif;font-size:17px">reg</em><span style="color:rgb(62,67,73);font-family:Georgia,serif;font-size:17px"> property of a single memory node."</span><br></div></div><div><br></div><div>Thanks & regards,</div><div><br></div><div><br></div><div><br>Saad</div><div><span style="color:rgb(62,67,73);font-family:Georgia,serif;font-size:17px"> </span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 21, 2022 at 8:16 AM Chan Kim <<a href="mailto:ckim@etri.re.kr">ckim@etri.re.kr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello linux experts,<br>
<br>
I read <a href="https://elinux.org/Device_Tree_Usage" rel="noreferrer" target="_blank">https://elinux.org/Device_Tree_Usage</a>, and it says about the "ranges"<br>
property in the PCIe Root Complex node, <br>
"The above ranges define how the CPU see the PCI memory, and helps the CPU<br>
to set up the right memory windows and write the right parameters into<br>
various PCI device registers. This is sometimes referred to as outbound<br>
memory."<br>
I know the 'ranges' property shows how the PCI devices's addresses are<br>
mapped to host CPU's addresses. The PCI devices are identified by the<br>
bus/device/function pair and the address is indicated the<br>
config/IO/memory32/memory64 types and start and length in the PCI bus. <br>
I understand that the BIOS or bootloader initializes PCI RC and does the<br>
enumeration and assigns the BAR registers so that the device's resources are<br>
mapped in host CPU's address space.<br>
And I guess the bootloader fixes the device tree (or ACPI table) by filling<br>
in the 'ranges' property. Is it correct?<br>
My another question is, what does the OS do with this 'ranges' information<br>
in the device tree? Of course the PCI device's driver uses BAR to get the<br>
physical address (seen from the host CPU) and by ioremap, it can access the<br>
devices memory and registers using virtual address. In the above link it<br>
says "The above ranges define how the CPU see the PCI memory, and helps the<br>
CPU to set up the right memory windows and write the right parameters into<br>
various PCI device registers. This is sometimes referred to as outbound<br>
memory." What does it mean? Does the OS do something with this 'ranges'<br>
value?<br>
I'll appreciated if someone could explain it to me.<br>
Thank you!<br>
<br>
Chan Kim<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div>