* What does OS do with the 'ranges' property in PCI RC node in the device tree?
@ 2022-11-21 13:15 Chan Kim
2022-11-21 16:51 ` Saad Masood
0 siblings, 1 reply; 2+ messages in thread
From: Chan Kim @ 2022-11-21 13:15 UTC (permalink / raw)
To: kernelnewbies
Hello linux experts,
I read https://elinux.org/Device_Tree_Usage, and it says about the "ranges"
property in the PCIe Root Complex node,
"The above ranges define how the CPU see the PCI memory, and helps the CPU
to set up the right memory windows and write the right parameters into
various PCI device registers. This is sometimes referred to as outbound
memory."
I know the 'ranges' property shows how the PCI devices's addresses are
mapped to host CPU's addresses. The PCI devices are identified by the
bus/device/function pair and the address is indicated the
config/IO/memory32/memory64 types and start and length in the PCI bus.
I understand that the BIOS or bootloader initializes PCI RC and does the
enumeration and assigns the BAR registers so that the device's resources are
mapped in host CPU's address space.
And I guess the bootloader fixes the device tree (or ACPI table) by filling
in the 'ranges' property. Is it correct?
My another question is, what does the OS do with this 'ranges' information
in the device tree? Of course the PCI device's driver uses BAR to get the
physical address (seen from the host CPU) and by ioremap, it can access the
devices memory and registers using virtual address. In the above link it
says "The above ranges define how the CPU see the PCI memory, and helps the
CPU to set up the right memory windows and write the right parameters into
various PCI device registers. This is sometimes referred to as outbound
memory." What does it mean? Does the OS do something with this 'ranges'
value?
I'll appreciated if someone could explain it to me.
Thank you!
Chan Kim
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: What does OS do with the 'ranges' property in PCI RC node in the device tree?
2022-11-21 13:15 What does OS do with the 'ranges' property in PCI RC node in the device tree? Chan Kim
@ 2022-11-21 16:51 ` Saad Masood
0 siblings, 0 replies; 2+ messages in thread
From: Saad Masood @ 2022-11-21 16:51 UTC (permalink / raw)
To: Chan Kim, kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 2628 bytes --]
Hi Chan,
The O/S builds out multiple memory nodes using the addresses in the
'ranges' property. 'Each node is divided up into a number of blocks called
*zones* which represent ranges within memory...' from (
https://www.kernel.org/doc/gorman/html/understand/understand005.html)
Also, please read this:
https://devicetree-specification.readthedocs.io/en/latest/chapter3-devicenodes.html
"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 *reg* property of a single memory node."
Thanks & regards,
Saad
On Mon, Nov 21, 2022 at 8:16 AM Chan Kim <ckim@etri.re.kr> wrote:
> Hello linux experts,
>
> I read https://elinux.org/Device_Tree_Usage, and it says about the
> "ranges"
> property in the PCIe Root Complex node,
> "The above ranges define how the CPU see the PCI memory, and helps the CPU
> to set up the right memory windows and write the right parameters into
> various PCI device registers. This is sometimes referred to as outbound
> memory."
> I know the 'ranges' property shows how the PCI devices's addresses are
> mapped to host CPU's addresses. The PCI devices are identified by the
> bus/device/function pair and the address is indicated the
> config/IO/memory32/memory64 types and start and length in the PCI bus.
> I understand that the BIOS or bootloader initializes PCI RC and does the
> enumeration and assigns the BAR registers so that the device's resources
> are
> mapped in host CPU's address space.
> And I guess the bootloader fixes the device tree (or ACPI table) by filling
> in the 'ranges' property. Is it correct?
> My another question is, what does the OS do with this 'ranges' information
> in the device tree? Of course the PCI device's driver uses BAR to get the
> physical address (seen from the host CPU) and by ioremap, it can access the
> devices memory and registers using virtual address. In the above link it
> says "The above ranges define how the CPU see the PCI memory, and helps the
> CPU to set up the right memory windows and write the right parameters into
> various PCI device registers. This is sometimes referred to as outbound
> memory." What does it mean? Does the OS do something with this 'ranges'
> value?
> I'll appreciated if someone could explain it to me.
> Thank you!
>
> Chan Kim
>
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
[-- Attachment #1.2: Type: text/html, Size: 4579 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-21 16:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-21 13:15 What does OS do with the 'ranges' property in PCI RC node in the device tree? Chan Kim
2022-11-21 16:51 ` Saad Masood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox