All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Nicolas Pitre <nico@fluxnic.net>
Cc: Rob Herring <robh+dt@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/2] ARM: move device tree mapping out of linear region
Date: Wed, 7 Oct 2020 17:32:54 +0200	[thread overview]
Message-ID: <CAMj1kXFjJFDCHVZO1hTWNkZCtXVW29v2aQv7T+-FnYB4Jv99Og@mail.gmail.com> (raw)
In-Reply-To: <nycvar.YSQ.7.78.906.2010071026420.2184@knanqh.ubzr>

On Wed, 7 Oct 2020 at 17:28, Nicolas Pitre <nico@fluxnic.net> wrote:
>
> On Wed, 7 Oct 2020, Ard Biesheuvel wrote:
>
> > @@ -1078,13 +1078,18 @@ void __init hyp_mode_check(void)
> >  void __init setup_arch(char **cmdline_p)
> >  {
> >       const struct machine_desc *mdesc = NULL;
> > +     void *atags_vaddr;
> >
> >       if (__atags_pointer)
> > -             atags_vaddr = phys_to_virt(__atags_pointer);
> > +             atags_vaddr = FDT_VIRT_ADDR(__atags_pointer);
> >
> >       setup_processor();
> > -     if (atags_vaddr)
> > +     if (atags_vaddr) {
> >               mdesc = setup_machine_fdt(atags_vaddr);
>
> If __atags_pointer is zero, you'll end up with atags_vaddr being
> undefined here. I'm surprised the compiler didn't warn about that.
>

Ah yes, well spotted. I'll add a NULL initializer.

> > @@ -947,7 +949,7 @@ static void __init create_mapping(struct map_desc *md)
> >               return;
> >       }
> >
> > -     if ((md->type == MT_DEVICE || md->type == MT_ROM) &&
> > +     if (md->type == MT_DEVICE &&
> >           md->virtual >= PAGE_OFFSET && md->virtual < FIXADDR_START &&
> >           (md->virtual < VMALLOC_START || md->virtual >= VMALLOC_END)) {
> >               pr_warn("BUG: mapping for 0x%08llx at 0x%08lx out of vmalloc space\n",
>
> Hmmm... I wonder why MT_ROM was there in the first place.
>
> Digging into the history of this particular test (which has seen many
> slight variations over the years and could probably be simplified
> further nowdays) I finally found where that MT_ROM condition was
> introduced:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=457450ab3b94
>
> Oh well...
>

I didn't dig quite that far, but I did notice that the test predates
get Git era.

My reasoning to remove it was that MT_ROM is only used locally in the
same source file, whereas MT_DEVICE is used all over the place by
machine files, and so MT_DEVICE obviously requires this kind of
policing to ensure that the static device mappings do not overlap. The
XIP kernel mapping and now the DTB mapping were carefully placed in
the memory map, and so MT_ROM regions can be disregarded here.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-10-07 15:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07  8:39 [PATCH v2 0/2] ARM: move FDT mapping out of linear region Ard Biesheuvel
2020-10-07  8:39 ` [PATCH v2 1/2] ARM: centralize phys-to-virt conversion of DT/ATAGS address Ard Biesheuvel
2020-10-07 15:28   ` Nicolas Pitre
2020-10-07  8:39 ` [PATCH v2 2/2] ARM: move device tree mapping out of linear region Ard Biesheuvel
2020-10-07 15:28   ` Nicolas Pitre
2020-10-07 15:32     ` Ard Biesheuvel [this message]
2020-10-07 16:38       ` Nicolas Pitre
2020-10-07 16:40       ` Nicolas Pitre
2020-10-07 21:32     ` Russell King - ARM Linux admin
2020-10-07 22:05       ` Nicolas Pitre
     [not found]   ` <CGME20201028091912eucas1p13fb9cd947faa6bfd79199ea79648b6af@eucas1p1.samsung.com>
2020-10-28  9:19     ` Marek Szyprowski
2020-10-28  9:19       ` Marek Szyprowski
2020-10-28  9:22       ` Ard Biesheuvel
2020-10-28  9:22         ` Ard Biesheuvel
2020-10-28  9:24         ` Ard Biesheuvel
2020-10-28  9:24           ` Ard Biesheuvel
2020-10-28  9:43           ` Marek Szyprowski
2020-10-28  9:43             ` Marek Szyprowski
2020-10-28 12:05       ` Joel Stanley
2020-10-28 12:05         ` Joel Stanley
2020-10-28 12:52         ` Ard Biesheuvel
2020-10-28 12:52           ` Ard Biesheuvel
2020-10-28 12:59           ` Joel Stanley
2020-10-28 12:59             ` Joel Stanley
2020-10-28 13:00             ` Ard Biesheuvel
2020-10-28 13:00               ` Ard Biesheuvel
2020-10-28 13:06               ` Joel Stanley
2020-10-28 13:06                 ` Joel Stanley
2020-10-28 13:00           ` Russell King - ARM Linux admin
2020-10-28 13:00             ` Russell King - ARM Linux admin
2020-10-28 13:04             ` Ard Biesheuvel
2020-10-28 13:04               ` Ard Biesheuvel
2020-10-28 13:09               ` Russell King - ARM Linux admin
2020-10-28 13:09                 ` Russell King - ARM Linux admin
2020-10-28 13:16           ` Marek Szyprowski
2020-10-28 13:16             ` Marek Szyprowski
2020-10-11 16:39 ` [PATCH v2 0/2] ARM: move FDT " Ard Biesheuvel

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=CAMj1kXFjJFDCHVZO1hTWNkZCtXVW29v2aQv7T+-FnYB4Jv99Og@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=nico@fluxnic.net \
    --cc=robh+dt@kernel.org \
    /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.