Re: [PATCH v4 1/3] of: address: Add parent_bus_addr to struct of_pci_range

From: Bjorn Helgaas
Date: Thu Oct 10 2024 - 18:54:20 EST


On Thu, Oct 10, 2024 at 06:40:48PM -0400, Frank Li wrote:
> On Thu, Oct 10, 2024 at 04:57:45PM -0500, Bjorn Helgaas wrote:
> > On Tue, Oct 08, 2024 at 03:53:58PM -0400, Frank Li wrote:
> > > Introduce field 'parent_bus_addr' in of_pci_range to retrieve untranslated
> > > CPU address information.

> It is "untranslated CPU address", previous patch use cpu_untranslate_addr.
> Rob suggest change to parent_bus_addr.
>
> Is it better change to "to retrieve the address at bus fabric port" instead
> of *untranslated* CPU address

"parent_bus_addr" will hold an untranslated CPU address in some cases,
but not all. I think it's better to use a generic term like "parent
bus addres" here because that is accurate in all cases.

> > and this "ranges":
> >
> > ranges = <0x5f000000 0x0 0x5f000000 0x21000000>,
> > <0x80000000 0x0 0x70000000 0x10000000>;
> >
> > means:
> >
> > (IA 0x5f000000, CPU 0x0 0x5f000000, length 0x21000000)
> > (IA 0x80000000, CPU 0x0 0x70000000, length 0x10000000)
> >
> > which would mean:
> >
> > CPU 0x0_5f000000-0x0_7fffffff -> IA 0x5f000000-0x7fffffff
> > CPU 0x0_70000000-0x0_7fffffff -> IA 0x80000000-0x8fffffff
>
> Yes,
>
> > I must be misunderstanding something because this would mean CPU addr
> > 0x70000000 would translate to IA addr 0x70000000 via the first range
> > and to IA addr 0x80000000 via the second range, which doesn't make
> > sense.
>
> Yes, it is my mistake, first length should reduce to 0x0100_0000 from
> 0x21000000. It works because dt convert IA to CPU, instead of CPU to
> IA. for example, input IA: 0x80000000, match second one, convert to
> CPU address 0x0_70000000.

Great, if we can omit 0x5f000000 completely that will avoid the
confusion. I hope the actual DT doesn't have this error.

Bjorn