From: Ian Campbell <ijc+uboot@hellion.org.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] sunxi: display: Align end of memory to work around a linux-4.0 bug
Date: Sat, 02 May 2015 14:21:46 +0100 [thread overview]
Message-ID: <1430572906.15640.93.camel@hellion.org.uk> (raw)
In-Reply-To: <1429900783-15152-1-git-send-email-hdegoede@redhat.com>
On Fri, 2015-04-24 at 20:39 +0200, Hans de Goede wrote:
> 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.
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.
> Cc: Stefan Agner <stefan@agner.ch>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/video/sunxi_display.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
> index 95cfe94..4607269 100644
> --- a/drivers/video/sunxi_display.c
> +++ b/drivers/video/sunxi_display.c
> @@ -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");
next prev parent reply other threads:[~2015-05-02 13:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-24 18:39 [U-Boot] [PATCH] sunxi: display: Align end of memory to work around a linux-4.0 bug Hans de Goede
2015-05-02 13:21 ` Ian Campbell [this message]
2015-05-04 8:51 ` Hans de Goede
2015-05-04 9:36 ` Ian Campbell
2015-05-05 9:39 ` Mark Rutland
2015-05-12 13:53 ` Mark Rutland
2015-05-12 14:31 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430572906.15640.93.camel@hellion.org.uk \
--to=ijc+uboot@hellion.org.uk \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox