All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hao <haokexin@gmail.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org
Subject: Re: [PATCH] MIPS: OCTEON: Fix the boot broken when using built-in DTB
Date: Tue, 19 Jan 2021 18:56:48 +0800	[thread overview]
Message-ID: <20210119105648.GA343327@pek-khao-d2.corp.ad.wrs.com> (raw)
In-Reply-To: <20210118182419.GA16580@alpha.franken.de>

[-- Attachment #1: Type: text/plain, Size: 2360 bytes --]

On Mon, Jan 18, 2021 at 07:24:19PM +0100, Thomas Bogendoerfer wrote:
> On Sat, Jan 09, 2021 at 07:49:58PM +0800, Kevin Hao wrote:
> > For the OCTEON boards, it need to patch the built-in DTB before using
> > it. Previously it judges if it is a built-in DTB by checking
> > fw_passed_dtb. But after commit 37e5c69ffd41 ("MIPS: head.S: Init
> > fw_passed_dtb to builtin DTB", the fw_passed_dtb is initialized even
> > when using built-in DTB. This causes the OCTEON boards boot broken due
> > to an unpatched built-in DTB is used. Add more checks to judge if we
> > really use built-in DTB or not.
> > 
> > Fixed: 37e5c69ffd41 ("MIPS: head.S: Init fw_passed_dtb to builtin DTB")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Kevin Hao <haokexin@gmail.com>
> > ---
> >  arch/mips/cavium-octeon/setup.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
> > index 982826ba0ef7..41d9c80e9666 100644
> > --- a/arch/mips/cavium-octeon/setup.c
> > +++ b/arch/mips/cavium-octeon/setup.c
> > @@ -1149,7 +1149,8 @@ void __init device_tree_init(void)
> >  	bool do_prune;
> >  	bool fill_mac;
> >  
> > -	if (fw_passed_dtb) {
> > +	if (fw_passed_dtb && (fw_passed_dtb != (ulong)&__dtb_octeon_68xx_begin) &&
> > +	    (fw_passed_dtb != (ulong)&__dtb_octeon_3xxx_begin)) {
> 
> well, if someone add a third dtb do the builtin DTBs, this might fail
> again. Let's fix it for real...
> 
> >  		fdt = (void *)fw_passed_dtb;
> >  		do_prune = false;
> >  		fill_mac = true;
> 
> .... IMHO the real bug is d9df9fb901d2 MIPS: Octeon: Remove special handling
> of CONFIG_MIPS_ELF_APPENDED_DTB=y. I'm tending to simply revert that commit.

Yes, this indeed seem much better. I will send a patch to revert d9df9fb901d2.
Another issue is that the name of fw_passed_dtb seems pretty confusion after the
change of commit 37e5c69ffd41. Could we rename it to something like final_dtb_addr?

Thanks,
Kevin

> A different option would be to not place the two __dtb_octeon dtbs into the
> builtin dtb section, which looks like more work for not much gain...
> 
> Thomas.
> 
> -- 
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-01-19 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09 11:49 [PATCH] MIPS: OCTEON: Fix the boot broken when using built-in DTB Kevin Hao
2021-01-18 18:24 ` Thomas Bogendoerfer
2021-01-19 10:56   ` Kevin Hao [this message]
2021-01-20 17:39     ` Thomas Bogendoerfer

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=20210119105648.GA343327@pek-khao-d2.corp.ad.wrs.com \
    --to=haokexin@gmail.com \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.