Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2018 21:24:24 +0000
From:      bugzilla-noreply@freebsd.org
To:        ppc@FreeBSD.org
Subject:   [Bug 226974] kernel DSI read trap at boot
Message-ID:  <bug-226974-21-ewvYjNFRjm@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-226974-21@https.bugs.freebsd.org/bugzilla/>
References:  <bug-226974-21@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D226974

--- Comment #12 from Leandro Lupori <leandro.lupori@gmail.com> ---
I have an update on this. I think I've found what is causing this issue.

When ofw_mem_regions() is called during initialization, it looks for
/chosen/fdtmemreserv property in the device tree. When FDT is enabled, this
property will always exist, as it's a "fake" property returned by OFW FDT
getprop itself.

Then, if the fdtmemreserv property exists, excise_fdt_reserved() is called,=
 and
it does 2 main things:
1- Excludes reserved memory from available memory regions
2- Excludes FDT memory region itself from available memory

In my case, it's the second item that causes a problem later, at
moea64_early_bootstrap().
There is one part of this function that checks for overlaps between availab=
le
memory regions and the region where the kernel was loaded. When this overla=
p is
found, the available memory list is supposed to be adjusted to exclude kern=
el
memory.
But this code doesn't work correctly for some available memory regions, like
the one that is produced by excise_fdt_reserved() when there is an overlap
between FDT and kernel end.

This is the relevant part of the available regions in my case:
0x00004000 - 0x01800074 (~24MB)
0x0180b04c - 0x02c00000 (~20MB)
0x0344d3f0 - 0x7dbe0000 (~2GB)

kernelstart =3D 0x0100100
kernelend   =3D 0x1b60000
fdt         =3D 0x1b5b000 - 0x1b5f000 (upper bound rounded to page size)

When FDT is not used, moea64_early_bootstrap() will adjust the regions like
this:

0x00004000 - 0x01000000
0x01b60000 - 0x02c00000
0x0344d3f0 - 0x7dbe0000

And everything works fine.
However, when FDT is used, excise_fdt_reserved() will change the available
regions to this:

0x00004000 - 0x01800074
0x0180b04c - 0x01b5b000
0x01b5f000 - 0x02c00000
0x0344d3f0 - 0x7dbe0000

And then moea64_early_bootstrap() will adjust the regions and produce this:

0x00004000 - 0x01000000
0x0180b04c - 0x01b5b000
0x01b61000 - 0x02c00000
0x0344d3f0 - 0x7dbe0000

Which turns a large part of the kernel memory (0x0180b04c - 0x01b5b000) into
available memory, causing the issue when this region starts being used as s=
uch.


I'm not sure about the best way to fix this. Maybe one (or more) of the
following:
1- Change moea64_early_bootstrap() to make it able to detect and adjust reg=
ions
such as (0x0180b04c - 0x01b5b000), in which case the whole region should be
removed from available list.
2- Change the boot loader to place the FDT after kernelend.


And one last thing that I noticed and seems odd to me is that region
(0x01800074 - 0x0180b04c) is not reported as available, but even so the ker=
nel
is loaded at (0x0100100 - 0x1b60000), which includes the not available regi=
on.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-226974-21-ewvYjNFRjm>