sunxi: display: Align end of memory to work around a linux-4.0 bug
Subsystems (2)
PATCH 1/1 sunxi: display: Align end of memory to work around a linux-4.0 bug
Linux-4.0 as shipped has a bug causing it to not boot if the end of memory is not aligned to a multiple of 2 MiB. For details see the linux-arm mailing list post titled:
"Memory size unaligned to section boundary"
http://www.spinics.net/lists/arm-kernel/msg413811.html
This is something which specifically hits the sunxi display driver because we carve out the exact needed framebuffer size at the top of mem, this commit works around this issue by aligning the carve out.
--- drivers/video/sunxi_display.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/video/sunxi_display.c +13 -0
@@ -1278,6 +1278,19 @@ int sunxi_simplefb_setup(void *blob)*/ start = gd->bd->bi_dram[0 ].start; size = gd->bd->bi_dram[0 ].size - sunxi_display.fb_size; + +/* +* Linux-4.0 as shipped has a bug causing it not boot if the end +* of memory is not aligned to a multiple of 2 MiB. For details +* see the linux-arm mailing list post titled: +* "Memory size unaligned to section boundary" +* http://www.spinics.net/lists/arm-kernel/msg413811.html +* +* This workaround should be removed once the bug has been fixed +* and we no longer care about the Linux versions with the bug. +*/ + size &= ~(2 *1024 *1024 -1 ); + ret =fdt_fixup_memory_banks (blob, &start, &size,1 );if (ret) {eprintf ("Cannot setup simplefb: Error reserving memory\n" );
Signature · 1 line
2.3.5
PATCH 1/1 sunxi: display: Align end of memory to work around a linux-4.0 bug
Quoted 9 lines · Hans de Goede
Linux-4.0 as shipped has a bug causing it to not boot if the end of memory is not aligned to a multiple of 2 MiB. For details see the linux-arm mailing list post titled:
"Memory size unaligned to section boundary"
http://www.spinics.net/lists/arm-kernel/msg413811.htmlThis is something which specifically hits the sunxi display driver because we carve out the exact needed framebuffer size at the top of mem, this commit works around this issue by aligning the carve out.
I'm afraid I don't like this, we shouldn't be working around Linux bugs in the firmware, especially when both are Free software. Lets just fix Linux and get the fix into the appropriate stable trees and in the meantime tell people to avoid this buggy kernel.
The problem with this sort of thing is that it is very hard to get rid of these workarounds, even once the underlying issue is fixed and we no longer care about the versions with the bug OS authors (including non-Linux OSes) can inadvertently come to rely on the quirky behaviour, (i.e. the work around masks other bugs). Hence we end up in a quirks-race as everyone works around the other parties last workaround.
If there is to be a workaround instead of a fix then it should be for Linux to align memory to 2MB boundaries if that is what it requires.
Quoted 30 lines
Cc Stefan Agner <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- drivers/video/sunxi_display.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/video/sunxi_display.c +13
-0@@ -1278,6 +1278,19 @@ int sunxi_simplefb_setup(void *blob)*/ start = gd->bd->bi_dram[0 ].start; size = gd->bd->bi_dram[0 ].size - sunxi_display.fb_size; + +/* +* Linux-4.0 as shipped has a bug causing it not boot if the end +* of memory is not aligned to a multiple of 2 MiB. For details +* see the linux-arm mailing list post titled: +* "Memory size unaligned to section boundary" +* http://www.spinics.net/lists/arm-kernel/msg413811.html +* +* This workaround should be removed once the bug has been fixed +* and we no longer care about the Linux versions with the bug. +*/ + size &= ~(2 *1024 *1024 -1 ); + ret =fdt_fixup_memory_banks (blob, &start, &size,1 );if (ret) {eprintf ("Cannot setup simplefb: Error reserving memory\n" );
PATCH 1/1 sunxi: display: Align end of memory to work around a linux-4.0 bug
Hi,
Quoted 23 lines · Ian Campbell
Quoted 9 lines · Hans de Goede
Linux-4.0 as shipped has a bug causing it to not boot if the end of memory is not aligned to a multiple of 2 MiB. For details see the linux-arm mailing list post titled:
"Memory size unaligned to section boundary"
http://www.spinics.net/lists/arm-kernel/msg413811.htmlThis is something which specifically hits the sunxi display driver because we carve out the exact needed framebuffer size at the top of mem, this commit works around this issue by aligning the carve out.
I'm afraid I don't like this, we shouldn't be working around Linux bugs in the firmware, especially when both are Free software. Lets just fix Linux and get the fix into the appropriate stable trees and in the meantime tell people to avoid this buggy kernel.
The problem with this sort of thing is that it is very hard to get rid of these workarounds, even once the underlying issue is fixed and we no longer care about the versions with the bug OS authors (including non-Linux OSes) can inadvertently come to rely on the quirky behaviour, (i.e. the work around masks other bugs). Hence we end up in a quirks-race as everyone works around the other parties last workaround.
Quoted 2 lines
If there is to be a workaround instead of a fix then it should be for Linux to align memory to 2MB boundaries if that is what it requires.
I can understand where you're coming from, the problem is that despite various mails to the arm kernel mailing list no one from the upstream kernel seems to be looking into this, and I've no clue where to even begun looking.
In the mean time any sunxi boards users using a 1024x600 framebuffer (and likely other resulutions, 1024x600 is just one known way to trigger the problem), trying to boot using the latest upstream kernel end up with a non working system, without any clue as to why the kernel dies (as it dies really early). This also means that people trying to bring up new boards will not succeed, costing us potential contributors.
All in all I really believe that this is something which we should workaround, also keep in mind that what we're doing is quite special (clearly otherwise the bug would hit more users), we are not just curving out X MB of RAM at the top, but exactly the amount we need, and no more, lots of boards likely just carve out 8 / 16 MiB and thus are fine.
Regards,
Hans
Quoted 33 lines
Quoted 31 lines
Cc Stefan Agner <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- drivers/video/sunxi_display.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/video/sunxi_display.c +13
-0@@ -1278,6 +1278,19 @@ int sunxi_simplefb_setup(void *blob)*/ start = gd->bd->bi_dram[0 ].start; size = gd->bd->bi_dram[0 ].size - sunxi_display.fb_size; + +/* +* Linux-4.0 as shipped has a bug causing it not boot if the end +* of memory is not aligned to a multiple of 2 MiB. For details +* see the linux-arm mailing list post titled: +* "Memory size unaligned to section boundary" +* http://www.spinics.net/lists/arm-kernel/msg413811.html +* +* This workaround should be removed once the bug has been fixed +* and we no longer care about the Linux versions with the bug. +*/ + size &= ~(2 *1024 *1024 -1 ); + ret =fdt_fixup_memory_banks (blob, &start, &size,1 );if (ret) {eprintf ("Cannot setup simplefb: Error reserving memory\n" );
PATCH 1/1 sunxi: display: Align end of memory to work around a linux-4.0 bug
Quoted 26 lines · Hans de Goede
Hi,
Quoted 23 lines · Ian Campbell
Quoted 9 lines · Hans de Goede
Linux-4.0 as shipped has a bug causing it to not boot if the end of memory is not aligned to a multiple of 2 MiB. For details see the linux-arm mailing list post titled:
"Memory size unaligned to section boundary"
http://www.spinics.net/lists/arm-kernel/msg413811.htmlThis is something which specifically hits the sunxi display driver because we carve out the exact needed framebuffer size at the top of mem, this commit works around this issue by aligning the carve out.
I'm afraid I don't like this, we shouldn't be working around Linux bugs in the firmware, especially when both are Free software. Lets just fix Linux and get the fix into the appropriate stable trees and in the meantime tell people to avoid this buggy kernel.
The problem with this sort of thing is that it is very hard to get rid of these workarounds, even once the underlying issue is fixed and we no longer care about the versions with the bug OS authors (including non-Linux OSes) can inadvertently come to rely on the quirky behaviour, (i.e. the work around masks other bugs). Hence we end up in a quirks-race as everyone works around the other parties last workaround.
Quoted 6 lines
Quoted 2 lines
If there is to be a workaround instead of a fix then it should be for Linux to align memory to 2MB boundaries if that is what it requires.
I can understand where you're coming from, the problem is that despite various mails to the arm kernel mailing list no one from the upstream kernel seems to be looking into this,
Mark, do you think you could find some cycles (not necessarily your own) to look at this, or perhaps you know the appropriate maintainers to ping?
I'd really like to avoid having to hack around kernel bugs in the firmware.
Quoted 9 lines
and I've no clue where to even
begun looking.In the mean time any sunxi boards users using a 1024x600 framebuffer (and likely other resulutions, 1024x600 is just one known way to trigger the problem), trying to boot using the latest upstream kernel end up with a non working system, without any clue as to why the kernel dies (as it dies really early). This also means that people trying to bring up new boards will not succeed, costing us potential contributors.
I see where you are coming from here, but really this should just be a short term problem, one which can be solved by a) making plenty of noise on the right lists and b) appropriate docs for new comers pointing out this pitfall.
Adding the workaround just makes this into a long term problem.
Quoted 5 lines
All in all I really believe that this is something which we should workaround, also keep in mind that what we're doing is quite special (clearly otherwise the bug would hit more users), we are not just curving out X MB of RAM at the top, but exactly the amount we need, and no more, lots of boards likely just carve out 8 / 16 MiB and thus are fine.
I could see an argument for us doing similarly, just not the argument for doing it as a temporary workaround (since in reality it likely won't be).
Ian.
PATCH 1/1 sunxi: display: Align end of memory to work around a linux-4.0 bug
Quoted 30 lines · Ian Campbell
Quoted 29 lines · Hans de Goede
Hi,
Quoted 25 lines · Ian Campbell
Quoted 9 lines · Hans de Goede
Linux-4.0 as shipped has a bug causing it to not boot if the end of memory is not aligned to a multiple of 2 MiB. For details see the linux-arm mailing list post titled:
"Memory size unaligned to section boundary"
http://www.spinics.net/lists/arm-kernel/msg413811.htmlThis is something which specifically hits the sunxi display driver because we carve out the exact needed framebuffer size at the top of mem, this commit works around this issue by aligning the carve out.
I'm afraid I don't like this, we shouldn't be working around Linux bugs in the firmware, especially when both are Free software. Lets just fix Linux and get the fix into the appropriate stable trees and in the meantime tell people to avoid this buggy kernel.
The problem with this sort of thing is that it is very hard to get rid of these workarounds, even once the underlying issue is fixed and we no longer care about the versions with the bug OS authors (including non-Linux OSes) can inadvertently come to rely on the quirky behaviour, (i.e. the work around masks other bugs). Hence we end up in a quirks-race as everyone works around the other parties last workaround.
If there is to be a workaround instead of a fix then it should be for Linux to align memory to 2MB boundaries if that is what it requires.
Quoted 7 lines
Quoted 3 lines
I can understand where you're coming from, the problem is that despite various mails to the arm kernel mailing list no one from the upstream kernel seems to be looking into this,
Mark, do you think you could find some cycles (not necessarily your own) to look at this, or perhaps you know the appropriate maintainers to ping?
I'll have another look and see if I can come up with a kernel patch. Perhaps proposing something (even if slightly wrong) will provoke people to respond.
Quoted 2 lines
I'd really like to avoid having to hack around kernel bugs in the firmware.
Likewise.
Mark.
PATCH 1/1 sunxi: display: Align end of memory to work around a linux-4.0 bug
Quoted 35 lines · Mark Rutland
Quoted 34 lines · Ian Campbell
Quoted 32 lines · Hans de Goede
Hi,
Quoted 23 lines · Ian Campbell
Quoted 9 lines · Hans de Goede
Linux-4.0 as shipped has a bug causing it to not boot if the end of memory is not aligned to a multiple of 2 MiB. For details see the linux-arm mailing list post titled:
"Memory size unaligned to section boundary"
http://www.spinics.net/lists/arm-kernel/msg413811.htmlThis is something which specifically hits the sunxi display driver because we carve out the exact needed framebuffer size at the top of mem, this commit works around this issue by aligning the carve out.
I'm afraid I don't like this, we shouldn't be working around Linux bugs in the firmware, especially when both are Free software. Lets just fix Linux and get the fix into the appropriate stable trees and in the meantime tell people to avoid this buggy kernel.
The problem with this sort of thing is that it is very hard to get rid of these workarounds, even once the underlying issue is fixed and we no longer care about the versions with the bug OS authors (including non-Linux OSes) can inadvertently come to rely on the quirky behaviour, (i.e. the work around masks other bugs). Hence we end up in a quirks-race as everyone works around the other parties last workaround.
Quoted 2 lines
If there is to be a workaround instead of a fix then it should be for Linux to align memory to 2MB boundaries if that is what it requires.
I can understand where you're coming from, the problem is that despite various mails to the arm kernel mailing list no one from the upstream kernel seems to be looking into this,
Quoted 7 lines
Quoted 3 lines
Mark, do you think you could find some cycles (not necessarily your own) to look at this, or perhaps you know the appropriate maintainers to ping?
I'll have another look and see if I can come up with a kernel patch. Perhaps proposing something (even if slightly wrong) will provoke people to respond.
For the benefit of anyone not on the Linux ARM kernel list there's now a patch addressing the issue [1].
Mark.
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-May/342210.html
PATCH 1/1 sunxi: display: Align end of memory to work around a linux-4.0 bug
Quoted 6 lines · Mark Rutland
Quoted 3 lines
I'll have another look and see if I can come up with a kernel patch. Perhaps proposing something (even if slightly wrong) will provoke people to respond.
For the benefit of anyone not on the Linux ARM kernel list there's now a patch addressing the issue [1].
Thanks!