linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
@ 2021-06-04 12:06 Alexandre Ghiti
  2021-06-04 13:08 ` Arnd Bergmann
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Ghiti @ 2021-06-04 12:06 UTC (permalink / raw)
  To: Rob Herring, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	devicetree, linux-riscv, linux-kernel
  Cc: Alexandre Ghiti

Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
into the Linux image: in the same manner as Canaan soc does, create an object
file from the dtb file that will get linked into the Linux image.

Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
---
 arch/riscv/boot/dts/microchip/Makefile | 1 +
 arch/riscv/boot/dts/sifive/Makefile    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/riscv/boot/dts/microchip/Makefile b/arch/riscv/boot/dts/microchip/Makefile
index 622b12771fd3..855c1502d912 100644
--- a/arch/riscv/boot/dts/microchip/Makefile
+++ b/arch/riscv/boot/dts/microchip/Makefile
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_SOC_MICROCHIP_POLARFIRE) += microchip-mpfs-icicle-kit.dtb
+obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
diff --git a/arch/riscv/boot/dts/sifive/Makefile b/arch/riscv/boot/dts/sifive/Makefile
index 74c47fe9fc22..d90e4eb0ade8 100644
--- a/arch/riscv/boot/dts/sifive/Makefile
+++ b/arch/riscv/boot/dts/sifive/Makefile
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_SOC_SIFIVE) += hifive-unleashed-a00.dtb \
 			    hifive-unmatched-a00.dtb
+obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
  2021-06-04 12:06 [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc Alexandre Ghiti
@ 2021-06-04 13:08 ` Arnd Bergmann
  2021-06-04 15:51   ` Palmer Dabbelt
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Arnd Bergmann @ 2021-06-04 13:08 UTC (permalink / raw)
  To: Alexandre Ghiti
  Cc: Rob Herring, Paul Walmsley, Palmer Dabbelt, Albert Ou, DTML,
	linux-riscv, Linux Kernel Mailing List

On Fri, Jun 4, 2021 at 2:06 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
>
> Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
> into the Linux image: in the same manner as Canaan soc does, create an object
> file from the dtb file that will get linked into the Linux image.
>
> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>

Along the same lines as the comment that Jisheng Zhang made on the fixed
address, building a dtb into the kernel itself fundamentally breaks generic
kernel images.

I can understand using it on K210, which is extremely limited and wouldn't
run a generic kernel anyway, but for normal platforms like microchip and
sifive, it would be better to disallow CONFIG_BUILTIN_DTB in Kconfig
and require a non-broken boot loader.

      Arnd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
  2021-06-04 13:08 ` Arnd Bergmann
@ 2021-06-04 15:51   ` Palmer Dabbelt
  2021-06-04 18:34     ` Arnd Bergmann
  2021-06-04 17:45   ` Vitaly Wool
  2021-06-05  6:33   ` Alex Ghiti
  2 siblings, 1 reply; 10+ messages in thread
From: Palmer Dabbelt @ 2021-06-04 15:51 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: alex, robh+dt, Paul Walmsley, aou, devicetree, linux-riscv, linux-kernel

On Fri, 04 Jun 2021 06:08:05 PDT (-0700), Arnd Bergmann wrote:
> On Fri, Jun 4, 2021 at 2:06 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
>>
>> Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
>> into the Linux image: in the same manner as Canaan soc does, create an object
>> file from the dtb file that will get linked into the Linux image.
>>
>> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
>
> Along the same lines as the comment that Jisheng Zhang made on the fixed
> address, building a dtb into the kernel itself fundamentally breaks generic
> kernel images.
>
> I can understand using it on K210, which is extremely limited and wouldn't
> run a generic kernel anyway, but for normal platforms like microchip and
> sifive, it would be better to disallow CONFIG_BUILTIN_DTB in Kconfig
> and require a non-broken boot loader.

When we first added BUILTIN_DTB we actually had a compatibility 
mechanism in there.  There isn't enough in the ISA to handle board 
compatibility, but we were hoping to get something to deal with that.  
It didn't pan out so we dropped the compatibility mechanism, which is 
how we ended up here.

Maybe the right thing to do here is to add some sort of "be compatible 
with the platform spec" Kconfig, which we could then use to disallow all 
these features that result in non-portable kernels?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
  2021-06-04 13:08 ` Arnd Bergmann
  2021-06-04 15:51   ` Palmer Dabbelt
@ 2021-06-04 17:45   ` Vitaly Wool
  2021-06-04 18:33     ` Arnd Bergmann
  2021-06-05  6:33   ` Alex Ghiti
  2 siblings, 1 reply; 10+ messages in thread
From: Vitaly Wool @ 2021-06-04 17:45 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alexandre Ghiti, Rob Herring, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, DTML, linux-riscv, Linux Kernel Mailing List

Hey Arnd,

On Fri, Jun 4, 2021 at 3:18 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Fri, Jun 4, 2021 at 2:06 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
> >
> > Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
> > into the Linux image: in the same manner as Canaan soc does, create an object
> > file from the dtb file that will get linked into the Linux image.
> >
> > Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
>
> Along the same lines as the comment that Jisheng Zhang made on the fixed
> address, building a dtb into the kernel itself fundamentally breaks generic
> kernel images.
>
> I can understand using it on K210, which is extremely limited and wouldn't
> run a generic kernel anyway, but for normal platforms like microchip and
> sifive, it would be better to disallow CONFIG_BUILTIN_DTB in Kconfig
> and require a non-broken boot loader.

can't quite agree here. If we take XIP, it does make sense to have
BUILTIN_DTB, since 1) this will not be a generic kernel anyway 2) we
may want to skip the bootloader altogether or at least make it as thin
as possible and 3) copying device tree binaries from bootloader to RAM
as opposed to having it handy compiled in the kernel will be just a
waste of RAM.

Best regards,
   Vitaly

>       Arnd
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
  2021-06-04 17:45   ` Vitaly Wool
@ 2021-06-04 18:33     ` Arnd Bergmann
  0 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2021-06-04 18:33 UTC (permalink / raw)
  To: Vitaly Wool
  Cc: Alexandre Ghiti, Rob Herring, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, DTML, linux-riscv, Linux Kernel Mailing List

On Fri, Jun 4, 2021 at 7:45 PM Vitaly Wool <vitaly.wool@konsulko.com> wrote:
> On Fri, Jun 4, 2021 at 3:18 PM Arnd Bergmann <arnd@arndb.de> wrote:
> > On Fri, Jun 4, 2021 at 2:06 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
> > >
> > > Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
> > > into the Linux image: in the same manner as Canaan soc does, create an object
> > > file from the dtb file that will get linked into the Linux image.
> > >
> > > Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
> >
> > Along the same lines as the comment that Jisheng Zhang made on the fixed
> > address, building a dtb into the kernel itself fundamentally breaks generic
> > kernel images.
> >
> > I can understand using it on K210, which is extremely limited and wouldn't
> > run a generic kernel anyway, but for normal platforms like microchip and
> > sifive, it would be better to disallow CONFIG_BUILTIN_DTB in Kconfig
> > and require a non-broken boot loader.
>
> can't quite agree here. If we take XIP, it does make sense to have
> BUILTIN_DTB, since 1) this will not be a generic kernel anyway 2) we
> may want to skip the bootloader altogether or at least make it as thin
> as possible and 3) copying device tree binaries from bootloader to RAM
> as opposed to having it handy compiled in the kernel will be just a
> waste of RAM.

Indeed, it does make sense in combination with XIP. Maybe there could
be a Kconfig option that depends on CONFIG_EXPERT and that can
be used to guard non-generic options like this?

       Arnd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
  2021-06-04 15:51   ` Palmer Dabbelt
@ 2021-06-04 18:34     ` Arnd Bergmann
  0 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2021-06-04 18:34 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: Alexandre Ghiti, Rob Herring, Paul Walmsley, Albert Ou, DTML,
	linux-riscv, Linux Kernel Mailing List

On Fri, Jun 4, 2021 at 5:51 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
> On Fri, 04 Jun 2021 06:08:05 PDT (-0700), Arnd Bergmann wrote:
> > On Fri, Jun 4, 2021 at 2:06 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
> >>
> >> Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
> >> into the Linux image: in the same manner as Canaan soc does, create an object
> >> file from the dtb file that will get linked into the Linux image.
> >>
> >> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
> >
> > Along the same lines as the comment that Jisheng Zhang made on the fixed
> > address, building a dtb into the kernel itself fundamentally breaks generic
> > kernel images.
> >
> > I can understand using it on K210, which is extremely limited and wouldn't
> > run a generic kernel anyway, but for normal platforms like microchip and
> > sifive, it would be better to disallow CONFIG_BUILTIN_DTB in Kconfig
> > and require a non-broken boot loader.
>
> When we first added BUILTIN_DTB we actually had a compatibility
> mechanism in there.  There isn't enough in the ISA to handle board
> compatibility, but we were hoping to get something to deal with that.
> It didn't pan out so we dropped the compatibility mechanism, which is
> how we ended up here.
>
> Maybe the right thing to do here is to add some sort of "be compatible
> with the platform spec" Kconfig, which we could then use to disallow all
> these features that result in non-portable kernels?

Yes, I should have read your email before I replied with the same
suggestion to Vitaly ;-)

       Arnd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
  2021-06-04 13:08 ` Arnd Bergmann
  2021-06-04 15:51   ` Palmer Dabbelt
  2021-06-04 17:45   ` Vitaly Wool
@ 2021-06-05  6:33   ` Alex Ghiti
  2021-06-05 11:00     ` Arnd Bergmann
  2 siblings, 1 reply; 10+ messages in thread
From: Alex Ghiti @ 2021-06-05  6:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Rob Herring, Paul Walmsley, Palmer Dabbelt, Albert Ou, DTML,
	linux-riscv, Linux Kernel Mailing List

Hi Arnd,

Le 4/06/2021 à 15:08, Arnd Bergmann a écrit :
> On Fri, Jun 4, 2021 at 2:06 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
>>
>> Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
>> into the Linux image: in the same manner as Canaan soc does, create an object
>> file from the dtb file that will get linked into the Linux image.
>>
>> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
> 
> Along the same lines as the comment that Jisheng Zhang made on the fixed
> address, building a dtb into the kernel itself fundamentally breaks generic
> kernel images.
> 
> I can understand using it on K210, which is extremely limited and wouldn't
> run a generic kernel anyway, but for normal platforms like microchip and
> sifive, it would be better to disallow CONFIG_BUILTIN_DTB in Kconfig
> and require a non-broken boot loader.

I kind of disagree because if I want to build a custom kernel for those 
platforms with a builtin dtb for some reasons (debug, development..Etc), 
I think I should be able to do so.

> 
>        Arnd
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
  2021-06-05  6:33   ` Alex Ghiti
@ 2021-06-05 11:00     ` Arnd Bergmann
  2021-06-06  7:40       ` Alex Ghiti
  0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2021-06-05 11:00 UTC (permalink / raw)
  To: Alex Ghiti
  Cc: Rob Herring, Paul Walmsley, Palmer Dabbelt, Albert Ou, DTML,
	linux-riscv, Linux Kernel Mailing List

On Sat, Jun 5, 2021 at 8:37 AM Alex Ghiti <alex@ghiti.fr> wrote:
> Le 4/06/2021 à 15:08, Arnd Bergmann a écrit :
> > On Fri, Jun 4, 2021 at 2:06 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
> >>
> >> Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
> >> into the Linux image: in the same manner as Canaan soc does, create an object
> >> file from the dtb file that will get linked into the Linux image.
> >>
> >> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
> >
> > Along the same lines as the comment that Jisheng Zhang made on the fixed
> > address, building a dtb into the kernel itself fundamentally breaks generic
> > kernel images.
> >
> > I can understand using it on K210, which is extremely limited and wouldn't
> > run a generic kernel anyway, but for normal platforms like microchip and
> > sifive, it would be better to disallow CONFIG_BUILTIN_DTB in Kconfig
> > and require a non-broken boot loader.
>
> I kind of disagree because if I want to build a custom kernel for those
> platforms with a builtin dtb for some reasons (debug, development..Etc),
> I think I should be able to do so.

How is the builtin dtb better than appended dtb, or passing the dtb to the
boot loader in that case?

         Arnd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
  2021-06-05 11:00     ` Arnd Bergmann
@ 2021-06-06  7:40       ` Alex Ghiti
  2021-06-12  4:10         ` Palmer Dabbelt
  0 siblings, 1 reply; 10+ messages in thread
From: Alex Ghiti @ 2021-06-06  7:40 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Rob Herring, Paul Walmsley, Palmer Dabbelt, Albert Ou, DTML,
	linux-riscv, Linux Kernel Mailing List

Le 5/06/2021 à 13:00, Arnd Bergmann a écrit :
> On Sat, Jun 5, 2021 at 8:37 AM Alex Ghiti <alex@ghiti.fr> wrote:
>> Le 4/06/2021 à 15:08, Arnd Bergmann a écrit :
>>> On Fri, Jun 4, 2021 at 2:06 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
>>>>
>>>> Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
>>>> into the Linux image: in the same manner as Canaan soc does, create an object
>>>> file from the dtb file that will get linked into the Linux image.
>>>>
>>>> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
>>>
>>> Along the same lines as the comment that Jisheng Zhang made on the fixed
>>> address, building a dtb into the kernel itself fundamentally breaks generic
>>> kernel images.
>>>
>>> I can understand using it on K210, which is extremely limited and wouldn't
>>> run a generic kernel anyway, but for normal platforms like microchip and
>>> sifive, it would be better to disallow CONFIG_BUILTIN_DTB in Kconfig
>>> and require a non-broken boot loader.
>>
>> I kind of disagree because if I want to build a custom kernel for those
>> platforms with a builtin dtb for some reasons (debug, development..Etc),
>> I think I should be able to do so.
> 
> How is the builtin dtb better than appended dtb, or passing the dtb to the
> boot loader in that case?

Ah never said it was better, just it was available so there is no reason 
we could not allow it :)

> 
>           Arnd
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc
  2021-06-06  7:40       ` Alex Ghiti
@ 2021-06-12  4:10         ` Palmer Dabbelt
  0 siblings, 0 replies; 10+ messages in thread
From: Palmer Dabbelt @ 2021-06-12  4:10 UTC (permalink / raw)
  To: alex
  Cc: Arnd Bergmann, robh+dt, Paul Walmsley, aou, devicetree,
	linux-riscv, linux-kernel

On Sun, 06 Jun 2021 00:40:34 PDT (-0700), alex@ghiti.fr wrote:
> Le 5/06/2021 à 13:00, Arnd Bergmann a écrit :
>> On Sat, Jun 5, 2021 at 8:37 AM Alex Ghiti <alex@ghiti.fr> wrote:
>>> Le 4/06/2021 à 15:08, Arnd Bergmann a écrit :
>>>> On Fri, Jun 4, 2021 at 2:06 PM Alexandre Ghiti <alex@ghiti.fr> wrote:
>>>>>
>>>>> Fix BUILTIN_DTB config which resulted in a dtb that was actually not built
>>>>> into the Linux image: in the same manner as Canaan soc does, create an object
>>>>> file from the dtb file that will get linked into the Linux image.
>>>>>
>>>>> Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
>>>>
>>>> Along the same lines as the comment that Jisheng Zhang made on the fixed
>>>> address, building a dtb into the kernel itself fundamentally breaks generic
>>>> kernel images.
>>>>
>>>> I can understand using it on K210, which is extremely limited and wouldn't
>>>> run a generic kernel anyway, but for normal platforms like microchip and
>>>> sifive, it would be better to disallow CONFIG_BUILTIN_DTB in Kconfig
>>>> and require a non-broken boot loader.
>>>
>>> I kind of disagree because if I want to build a custom kernel for those
>>> platforms with a builtin dtb for some reasons (debug, development..Etc),
>>> I think I should be able to do so.
>>
>> How is the builtin dtb better than appended dtb, or passing the dtb to the
>> boot loader in that case?
>
> Ah never said it was better, just it was available so there is no reason
> we could not allow it :)

I agree: I'm not really a fan of BUILTIN_DTB (and I tried pretty hard 
not to have it in the first place), but whatever we have shouldn't be 
broken.

This is on fixes.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-12  4:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 12:06 [PATCH -fixes] riscv: Fix BUILTIN_DTB for sifive and microchip soc Alexandre Ghiti
2021-06-04 13:08 ` Arnd Bergmann
2021-06-04 15:51   ` Palmer Dabbelt
2021-06-04 18:34     ` Arnd Bergmann
2021-06-04 17:45   ` Vitaly Wool
2021-06-04 18:33     ` Arnd Bergmann
2021-06-05  6:33   ` Alex Ghiti
2021-06-05 11:00     ` Arnd Bergmann
2021-06-06  7:40       ` Alex Ghiti
2021-06-12  4:10         ` Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).