[PATCH v5 09/10] ARM: sunplus: Add initial support for Sunplus SP7021 SoC
Ard Biesheuvel
ardb at kernel.org
Thu Dec 9 02:12:13 PST 2021
On Thu, 9 Dec 2021 at 10:58, Arnd Bergmann <arnd at arndb.de> wrote:
>
> On Thu, Dec 9, 2021 at 9:49 AM qinjian[覃健] <qinjian at cqplus1.com> wrote:
> > > On Tue, Dec 7, 2021 at 8:21 AM qinjian[覃健] <qinjian at cqplus1.com> wrote:
> > > > > > @@ -152,6 +152,7 @@ textofs-$(CONFIG_ARCH_MSM8X60) := 0x00208000
> > > > > > textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000
> > > > > > textofs-$(CONFIG_ARCH_MESON) := 0x00208000
> > > > > > textofs-$(CONFIG_ARCH_AXXIA) := 0x00308000
> > > > > > +textofs-$(CONFIG_ARCH_SUNPLUS) := 0x00308000
> > > > >
> > > > > What is this needed for? If it boots without this line, better avoid
> > > > > adding it, because
> > > > > it will increase the kernel size for everyone else (unless they also enable
> > > > > AXXIA).
> > > > >
> > > >
> > > > SP7021 reserved the 1st 1MB memory for ARM926 at P-Chip using,
> > > > The 2nd 1MB memory for IOP device and the 3rd 1MB memory for bootloader.
> > > > I'll add these comments at next commit.
> > >
> > > I think you can just remove the memory from the system memory map in the
> > > device tree and pretend it only starts after the bootloader. It's been a while
> > > since I looked at this though, so I could be misremembering what the minimum
> > > boundaries are for doing this.
> >
> > I have test following 3 methods:
>
> Right, I was thinking of the third method here, which has the advantage of
> not requiring the same odd base address for all other platforms, this
> is important to us.
> I don't see what the problem is with it in your example, does that mean you
> have a little less usable memory, or that something fails to work right? I don't
> know what the requirements are for memreserve.
>
> Adding a few more people to Cc, maybe they have ideas about how this
> was solved elsewhere.
>
The phys2virt patching now assumes a granularity of 2 MiB. This means
that by removing 3 MiB at the start of DRAM, you lose 1 MIB of usable
memory unless you find a way to memremap() it directly.
So I think a combination of the two approaches might work here
- remove 2 MiB from the the /memory node.
- add 1 MiB to the text offset instead of 3 MiB.
Note that this is a compromise, and still not our preferred approach.
It would be far better to move these reserved regions to the end of
DRAM instead.
>
> > 1. current patch
> > DT:
> > memory {
> > reg = <0x00000000 0x20000000>; /* 512MB */
> > };
> >
> > reserved-memory {
> > #address-cells = <1>;
> > #size-cells = <1>;
> > ranges;
> >
> > iop_reserve: iop_device {
> > no-map;
> > reg = <0x00100000 0x00100000>;
> > };
> > a926_reserve: a926_memory {
> > no-map;
> > reg = <0x00000000 0x00100000>;
> > };
> > };
> > arch/arm/Makefile:
> > textofs-$(CONFIG_ARCH_SUNPLUS) := 0x00308000
> >
> > bootlog & meminfo :
> > [ 0.000000] Zone ranges:
> > [ 0.000000] Normal [mem 0x0000000000000000-0x000000001fffffff]
> > [ 0.000000] Movable zone start for each node
> > [ 0.000000] Early memory node ranges
> > [ 0.000000] node 0: [mem 0x0000000000000000-0x00000000001fffff]
> > [ 0.000000] node 0: [mem 0x0000000000200000-0x000000001fffffff]
> > [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000001fffffff]
> >
> > ~ # cat /proc/meminfo
> > MemTotal: 514008 kB
> > MemFree: 491960 kB
> > MemAvailable: 488608 kB
> >
> >
> >
> > 2. DT same as case 1, but no modify @ arch/arm/Makefile
> >
> > bootlog & meminfo :
> > [ 0.000000] OF: fdt: Reserved memory: failed to reserve memory for node 'iop_device': base 0x00100000, size 1 MiB
> > [ 0.000000] OF: fdt: Reserved memory: failed to reserve memory for node 'a926_memory': base 0x00000000, size 1 MiB
> > ...
> > [ 0.000000] Zone ranges:
> > [ 0.000000] Normal [mem 0x0000000000000000-0x000000001fffffff]
> > [ 0.000000] Movable zone start for each node
> > [ 0.000000] Early memory node ranges
> > [ 0.000000] node 0: [mem 0x0000000000000000-0x000000001fffffff]
> > [ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000001fffffff]
> >
> > ~ # cat /proc/meminfo
> > MemTotal: 516056 kB
> > MemFree: 493928 kB
> > MemAvailable: 490572 kB
> >
> >
> >
> > 3. DT:
> > memory {
> > reg = <0x00300000 0x1FD00000>; /* 512 - 3 MB */
> > };
> > no modify @ arch/arm/Makefile
> >
> > bootlog & meminfo :
> > [ 0.000000] Zone ranges:
> > [ 0.000000] Normal [mem 0x0000000000400000-0x000000001fffffff]
> > [ 0.000000] Movable zone start for each node
> > [ 0.000000] Early memory node ranges
> > [ 0.000000] node 0: [mem 0x0000000000400000-0x000000001fffffff]
> > [ 0.000000] Initmem setup node 0 [mem 0x0000000000400000-0x000000001fffffff]
> >
> > ~ # cat /proc/meminfo
> > MemTotal: 511964 kB
> > MemFree: 489636 kB
> > MemAvailable: 486292 kB
> >
> >
> >
> > I think method 1 should be correct (compare method 2) & better (compare method 3).
> >
More information about the linux-arm-kernel
mailing list