You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some applications, we need user/kernel address split of 3G/1G - rather than default 2G/2G.
Until RPi2, modifying kernel source's (github.com/raspberrypi/linux) bcm2709_defconfig
from CONFIG_VMSPLIT_2G to CONFIG_VMSPLIT_3G, and recompiling the kernel - works fine.
On RPi3, modifying it blocks kernel booting. With VMSPLIT_2G, kernel & OS are working fine.
But with VMSPLIT_3G, kernel shows nothing on HDMI output neither on serial console.
I have tried on a few branches - rpi-4.1.y / rpi-4.2.y / rpi-4.5.y - and results were same,
and used device tree files were bcm2709-rpi-2-b.dtb & bcm2710-rpi-3-b.dtb for matched RPi boards.
With a 3G/1G split, the kernel virtual addresses can only cover 768MB (lowmem) because address space is needed for other areas such as the 240MB vmalloc area:
On Pi2 and Pi3 the top 16MB of RAM is not addressable by the ARM because the peripherals are mapped there, leaving 240MB of RAM that is physically addressable but can't be used without temporarily mapping it into the vmalloc or other area; this is what enabling highmem does. You could shrink the vmalloc area (and others), but the problem will remain to some extent.
The reason the kernel doesn't boot with a 3G/1G split is down to the placement of the initial Device Tree blob. It used to be located at 0x100, but this limits it to (0x4000 - 0x100 = 0x3f00) bytes (about 16KB), and some users have already exceeded this limit with sizeable (but reasonable) overlays. One of the first things the kernel does is "unflatten" the DTB, building internal data structures that are more convenient to work with. After this point, the source memory is free to be used for something else. I changed the firmware logic to place the DTB at the top of memory (just below the space reserved for the GPU and the initrd/initramfs), which works well with the 2G/2G split but can be too high for 3G/1G - the kernel faults trying to copy it.
The next (or next but one) firmware release will place a 768MB cap on the initial DTB (and initrd/initramfs) placement, avoiding this booting problem. Until then you achieve the same result by setting gpu_mem=240 (or higher), although this reduces the total memory usable by the ARM.
By the way, the Pi2 is no different to the Pi3 in this respect, except that you will see "Uncompressing Linux... done, booting the kernel." on the UART before it crashes silently. Do you have a larger gpu_mem on your Pi2 card?
On my configuration I used gpu_mem=256. This might have enabled RPi2 operation.
I am using same gpu_mem=256 on RPi3, but it does not boot up. So your temporal workaround seems not working on RPi3.
There was a mistake that gpu_mem=256 was not correctly applied to config.txt in my RPi3 boot partition.
After getting your last comment with kernel log, I found this mistake.
So, I cross checked that RPi3 VMSPLIT_3G boot-up failure could be avoided by larger (>=240) gpu_mem value in config.txt.
On my Pi3 configuration, new firmware on following commit does not fix the issue. (made it worse) raspberrypi/firmware@e968a4e
On both cases of adding or removing "gpu_mem=240" to config.txt - kernel failed to boot.
Tried firmware on following commit, but shows same problems as before :
On both cases of adding or removing "gpu_mem=240" to config.txt - kernel failed to boot. raspberrypi/firmware@5a1c159
@gonzoua I suspect the firmware thinks the 4.4 DTB is too large. Some part of the Linux kernel, perhaps the built-in decompressor, is using the memory from 0x4000-0x8000, so if you start at 0x100 the firmware only has about 16KB to play with.
The DT compiler in the 4.4 tree generates larger output files than before. I should be able to get the firmware to strip out some unnecessary extras, but I haven't done this yet so you are probably hitting the 0x3f00-byte limit. If you are using U-boot then the 0x4000 limit probably doesn't apply; you can tell the firmware this by setting device_tree_end=0x8000 (or whatever your upper bound is). N.B. The end address is exclusive, so you are actually telling it the first address not to use.
@gonzoua I had the same problem. The only way I got to boot FreeBSD with this new firmware and with the latest u-boot was to remove the disable_commandline_tags line from config.txt and tag the u-boot.bin binary :-( with:
Now another Linux dependency in our workflow. I tried all other combination disable_commandline_tags=[0,1,2] with tagged and untagged, that is the only one which works.
I guess we have to update our u-boot RPI 1 & 2 ports. In such case, a recent u-boot commit (don't know which one but less than 10 days old) made reading from the MMC 6x faster! I was reading ubldr.bin and kernel @ 700 kB/s and now u-boot reading speed is showing 5 MB/s. Let's try to use in our ports a recent u-boot GIT commit then, which takes this improvement into account :-)
@pelwell Would you make the firmware trust the "kernel" it loads is DTB compliant by default so that we don't need to tag it anymore? I believe you already have done the same thing when in 64bits mode.
@pelwell You're right, I no longer need to tag u-boot to make it use the DT and pass it to the FreeBSD kernel. No more disable_commandline_tags is necessary in config.txt now.
I hope this is ok to ask here, but is it (theoretically) possible that a change could be made so that CONFIG_VMSPLIT setting could be placed controlled via config.txt (or similar), rather than requiring a kernel recompile?
It is useful for certain emulation purposes (eg notaz/pcsx_rearmed#71) but would prefer to stick to regular raspian if possible.
No, it requires a rebuilt kernel. You could build a second kernel, call it kernel7_3g.img and choose which kernel to use in config.txt (kernel=kernel7_3g.img).
But, no it's not possible to use a single kernel for this.
Activity
pelwell commentedon Apr 6, 2016
With a 3G/1G split, the kernel virtual addresses can only cover 768MB (lowmem) because address space is needed for other areas such as the 240MB vmalloc area:
On Pi2 and Pi3 the top 16MB of RAM is not addressable by the ARM because the peripherals are mapped there, leaving 240MB of RAM that is physically addressable but can't be used without temporarily mapping it into the vmalloc or other area; this is what enabling highmem does. You could shrink the vmalloc area (and others), but the problem will remain to some extent.
The reason the kernel doesn't boot with a 3G/1G split is down to the placement of the initial Device Tree blob. It used to be located at 0x100, but this limits it to (0x4000 - 0x100 = 0x3f00) bytes (about 16KB), and some users have already exceeded this limit with sizeable (but reasonable) overlays. One of the first things the kernel does is "unflatten" the DTB, building internal data structures that are more convenient to work with. After this point, the source memory is free to be used for something else. I changed the firmware logic to place the DTB at the top of memory (just below the space reserved for the GPU and the initrd/initramfs), which works well with the 2G/2G split but can be too high for 3G/1G - the kernel faults trying to copy it.
The next (or next but one) firmware release will place a 768MB cap on the initial DTB (and initrd/initramfs) placement, avoiding this booting problem. Until then you achieve the same result by setting gpu_mem=240 (or higher), although this reduces the total memory usable by the ARM.
pelwell commentedon Apr 6, 2016
By the way, the Pi2 is no different to the Pi3 in this respect, except that you will see "Uncompressing Linux... done, booting the kernel." on the UART before it crashes silently. Do you have a larger gpu_mem on your Pi2 card?
peyo-hd commentedon Apr 6, 2016
On my configuration I used gpu_mem=256. This might have enabled RPi2 operation.
I am using same gpu_mem=256 on RPi3, but it does not boot up. So your temporal workaround seems not working on RPi3.
pelwell commentedon Apr 6, 2016
It works for me on a Pi3.
My config.txt:
My boot log start:
You could try
device_tree_address=0x10000000instead.peyo-hd commentedon Apr 6, 2016
There was a mistake that gpu_mem=256 was not correctly applied to config.txt in my RPi3 boot partition.
After getting your last comment with kernel log, I found this mistake.
So, I cross checked that RPi3 VMSPLIT_3G boot-up failure could be avoided by larger (>=240) gpu_mem value in config.txt.
Thanks.
pelwell commentedon Apr 6, 2016
Let's keep this issue open until the firmware takes care of it automatically.
pwm_sdm: fix ring buffer UINT_MAX wraparound bug
pwm_sdm: fix ring buffer UINT_MAX wraparound bug
popcornmix commentedon Apr 8, 2016
Latest rpi-update firmware has a potential fix for this.
peyo-hd commentedon Apr 8, 2016
On my Pi3 configuration, new firmware on following commit does not fix the issue. (made it worse)
raspberrypi/firmware@e968a4e
On both cases of adding or removing "gpu_mem=240" to config.txt - kernel failed to boot.
With previous version firmware,
raspberrypi/firmware@0a96f63
Adding "gpu_mem=240" enabled kernel boot-up.
pelwell commentedon Apr 12, 2016
There is new rpi-update firmware that should fix this problem.
peyo-hd commentedon Apr 12, 2016
Tried firmware on following commit, but shows same problems as before :
On both cases of adding or removing "gpu_mem=240" to config.txt - kernel failed to boot.
raspberrypi/firmware@5a1c159
I keep staying on following older version :
raspberrypi/firmware@0a96f63
gonzoua commentedon Apr 12, 2016
I believe e968a4 has broken device_tree_address attribute. I have this in my config.txt:
disable_commandline_tags=0
device_tree_address=0x100
device_tree=rpi2.dtb
kernel=u-boot.bin
gpu_mem=128
It works fine with u-boot on 0a96f63 but on e968a4e I get
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Memory at 0x100 contains ATAG sequence. So it seems device_tree_address is ignored
pelwell commentedon Apr 13, 2016
@gonzoua I suspect the firmware thinks the 4.4 DTB is too large. Some part of the Linux kernel, perhaps the built-in decompressor, is using the memory from 0x4000-0x8000, so if you start at 0x100 the firmware only has about 16KB to play with.
The DT compiler in the 4.4 tree generates larger output files than before. I should be able to get the firmware to strip out some unnecessary extras, but I haven't done this yet so you are probably hitting the 0x3f00-byte limit. If you are using U-boot then the 0x4000 limit probably doesn't apply; you can tell the firmware this by setting
device_tree_end=0x8000(or whatever your upper bound is). N.B. The end address is exclusive, so you are actually telling it the first address not to use.SylvainGarrigues commentedon Apr 15, 2016
@gonzoua I had the same problem. The only way I got to boot FreeBSD with this new firmware and with the latest u-boot was to remove the disable_commandline_tags line from config.txt and tag the u-boot.bin binary :-( with:
perl mkknlimg --dtok /Volumes/BOOT/U-BOOT.BIN.UNTAGGED /Volumes/BOOT/U-BOOT.BIN
Now another Linux dependency in our workflow. I tried all other combination disable_commandline_tags=[0,1,2] with tagged and untagged, that is the only one which works.
I guess we have to update our u-boot RPI 1 & 2 ports. In such case, a recent u-boot commit (don't know which one but less than 10 days old) made reading from the MMC 6x faster! I was reading ubldr.bin and kernel @ 700 kB/s and now u-boot reading speed is showing 5 MB/s. Let's try to use in our ports a recent u-boot GIT commit then, which takes this improvement into account :-)
SylvainGarrigues commentedon Apr 15, 2016
@pelwell Would you make the firmware trust the "kernel" it loads is DTB compliant by default so that we don't need to tag it anymore? I believe you already have done the same thing when in 64bits mode.
pelwell commentedon Apr 15, 2016
Yes, it's going to happen.
pelwell commentedon Apr 18, 2016
As of yesterday's firmware release (f063c24a8307ae57040eda58f4751a97efdf7ab8), the kernel is assumed to be DT-capable by default:
SylvainGarrigues commentedon Apr 18, 2016
@pelwell You're right, I no longer need to tag u-boot to make it use the DT and pass it to the FreeBSD kernel. No more disable_commandline_tags is necessary in config.txt now.
SylvainGarrigues commentedon Apr 18, 2016
I just don't manage to boot our kernel directly however, I still need u-boot. But it may be FreeBSD-kernel related.
pwm_sdm: fix ring buffer UINT_MAX wraparound bug
dankcushions commentedon Aug 16, 2016
I hope this is ok to ask here, but is it (theoretically) possible that a change could be made so that CONFIG_VMSPLIT setting could be placed controlled via config.txt (or similar), rather than requiring a kernel recompile?
It is useful for certain emulation purposes (eg notaz/pcsx_rearmed#71) but would prefer to stick to regular raspian if possible.
popcornmix commentedon Aug 16, 2016
No, it requires a rebuilt kernel. You could build a second kernel, call it kernel7_3g.img and choose which kernel to use in config.txt (kernel=kernel7_3g.img).
But, no it's not possible to use a single kernel for this.
popcornmix commentedon Aug 16, 2016
Closing as original issue is resolved.
pwm_sdm: fix ring buffer UINT_MAX wraparound bug