Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-09 Thread Rob Herring
On Thu, Nov 9, 2017 at 6:23 AM, Masahiro Yamada
 wrote:
> Hi James,
>
>
> 2017-11-09 21:19 GMT+09:00 James Hogan :
>> (resend using a working From address)
>>
>>  wrote:
>>> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
>>> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
>>> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
>>> It could be a race problem when building DTBS in parallel.
>>>
>>> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
>>> sub-directories, so this broke when Broadcom added one more hierarchy
>>> in arch/arm64/boot/dts/broadcom//.
>>>
>>> One idea to fix the issues in a clean way is to move DTB handling
>>> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
>>> natively, so it should not hurt to do so.
>>>
>>> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
>>> enabled.  All clutter things in Makefiles go away.
>>>
>>> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
>>> directly to traverse sub-directories.
>>>
>>> Signed-off-by: Masahiro Yamada 
>>
>>  ...
>>
>>> diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
>>> index 7891ffa..b2b0d88 100644
>>> --- a/arch/mips/boot/dts/Makefile
>>> +++ b/arch/mips/boot/dts/Makefile
>>> @@ -1,20 +1,14 @@
>>> -dts-dirs   += brcm
>>> -dts-dirs   += cavium-octeon
>>> -dts-dirs   += img
>>> -dts-dirs   += ingenic
>>> -dts-dirs   += lantiq
>>> -dts-dirs   += mti
>>> -dts-dirs   += netlogic
>>> -dts-dirs   += ni
>>> -dts-dirs   += pic32
>>> -dts-dirs   += qca
>>> -dts-dirs   += ralink
>>> -dts-dirs   += xilfpga
>>> +subdir-y   += brcm
>>> +subdir-y   += cavium-octeon
>>> +subdir-y   += img
>>> +subdir-y   += ingenic
>>> +subdir-y   += lantiq
>>> +subdir-y   += mti
>>> +subdir-y   += netlogic
>>> +subdir-y   += ni
>>> +subdir-y   += pic32
>>> +subdir-y   += qca
>>> +subdir-y   += ralink
>>> +subdir-y   += xilfpga
>>>
>>> -obj-y  := $(addsuffix /, $(dts-dirs))
>>> -
>>> -dtstree:= $(srctree)/$(src)
>>> -dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(foreach 
>>> d,$(dts-dirs), $(wildcard $(dtstree)/$(d)/*.dts)))
>>> -
>>> -always := $(dtb-y)
>>> -subdir-y   := $(dts-dirs)
>>> +obj-$(BUILTIN_DTB) := $(addsuffix /, $(subdir-y))
>>
>> I wonder if that should be CONFIG_BUILTIN_DTB?
>>
>> This is causing failures in linux-next with MIPS
>> cavium_octeon_defconfig like below, and changing this line to
>> CONFIG_BUILTIN_DTB seems to fix it.
>
> Good catch!
>
>
> Rob,
> Can you fix it to CONFIG_BUILTIN_DTB?

Fixed.

Rob


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-09 Thread Rob Herring
On Thu, Nov 9, 2017 at 6:23 AM, Masahiro Yamada
 wrote:
> Hi James,
>
>
> 2017-11-09 21:19 GMT+09:00 James Hogan :
>> (resend using a working From address)
>>
>>  wrote:
>>> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
>>> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
>>> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
>>> It could be a race problem when building DTBS in parallel.
>>>
>>> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
>>> sub-directories, so this broke when Broadcom added one more hierarchy
>>> in arch/arm64/boot/dts/broadcom//.
>>>
>>> One idea to fix the issues in a clean way is to move DTB handling
>>> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
>>> natively, so it should not hurt to do so.
>>>
>>> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
>>> enabled.  All clutter things in Makefiles go away.
>>>
>>> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
>>> directly to traverse sub-directories.
>>>
>>> Signed-off-by: Masahiro Yamada 
>>
>>  ...
>>
>>> diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
>>> index 7891ffa..b2b0d88 100644
>>> --- a/arch/mips/boot/dts/Makefile
>>> +++ b/arch/mips/boot/dts/Makefile
>>> @@ -1,20 +1,14 @@
>>> -dts-dirs   += brcm
>>> -dts-dirs   += cavium-octeon
>>> -dts-dirs   += img
>>> -dts-dirs   += ingenic
>>> -dts-dirs   += lantiq
>>> -dts-dirs   += mti
>>> -dts-dirs   += netlogic
>>> -dts-dirs   += ni
>>> -dts-dirs   += pic32
>>> -dts-dirs   += qca
>>> -dts-dirs   += ralink
>>> -dts-dirs   += xilfpga
>>> +subdir-y   += brcm
>>> +subdir-y   += cavium-octeon
>>> +subdir-y   += img
>>> +subdir-y   += ingenic
>>> +subdir-y   += lantiq
>>> +subdir-y   += mti
>>> +subdir-y   += netlogic
>>> +subdir-y   += ni
>>> +subdir-y   += pic32
>>> +subdir-y   += qca
>>> +subdir-y   += ralink
>>> +subdir-y   += xilfpga
>>>
>>> -obj-y  := $(addsuffix /, $(dts-dirs))
>>> -
>>> -dtstree:= $(srctree)/$(src)
>>> -dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(foreach 
>>> d,$(dts-dirs), $(wildcard $(dtstree)/$(d)/*.dts)))
>>> -
>>> -always := $(dtb-y)
>>> -subdir-y   := $(dts-dirs)
>>> +obj-$(BUILTIN_DTB) := $(addsuffix /, $(subdir-y))
>>
>> I wonder if that should be CONFIG_BUILTIN_DTB?
>>
>> This is causing failures in linux-next with MIPS
>> cavium_octeon_defconfig like below, and changing this line to
>> CONFIG_BUILTIN_DTB seems to fix it.
>
> Good catch!
>
>
> Rob,
> Can you fix it to CONFIG_BUILTIN_DTB?

Fixed.

Rob


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-09 Thread Masahiro Yamada
Hi James,


2017-11-09 21:19 GMT+09:00 James Hogan :
> (resend using a working From address)
>
>  wrote:
>> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
>> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
>> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
>> It could be a race problem when building DTBS in parallel.
>>
>> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
>> sub-directories, so this broke when Broadcom added one more hierarchy
>> in arch/arm64/boot/dts/broadcom//.
>>
>> One idea to fix the issues in a clean way is to move DTB handling
>> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
>> natively, so it should not hurt to do so.
>>
>> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
>> enabled.  All clutter things in Makefiles go away.
>>
>> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
>> directly to traverse sub-directories.
>>
>> Signed-off-by: Masahiro Yamada 
>
>  ...
>
>> diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
>> index 7891ffa..b2b0d88 100644
>> --- a/arch/mips/boot/dts/Makefile
>> +++ b/arch/mips/boot/dts/Makefile
>> @@ -1,20 +1,14 @@
>> -dts-dirs   += brcm
>> -dts-dirs   += cavium-octeon
>> -dts-dirs   += img
>> -dts-dirs   += ingenic
>> -dts-dirs   += lantiq
>> -dts-dirs   += mti
>> -dts-dirs   += netlogic
>> -dts-dirs   += ni
>> -dts-dirs   += pic32
>> -dts-dirs   += qca
>> -dts-dirs   += ralink
>> -dts-dirs   += xilfpga
>> +subdir-y   += brcm
>> +subdir-y   += cavium-octeon
>> +subdir-y   += img
>> +subdir-y   += ingenic
>> +subdir-y   += lantiq
>> +subdir-y   += mti
>> +subdir-y   += netlogic
>> +subdir-y   += ni
>> +subdir-y   += pic32
>> +subdir-y   += qca
>> +subdir-y   += ralink
>> +subdir-y   += xilfpga
>>
>> -obj-y  := $(addsuffix /, $(dts-dirs))
>> -
>> -dtstree:= $(srctree)/$(src)
>> -dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(foreach 
>> d,$(dts-dirs), $(wildcard $(dtstree)/$(d)/*.dts)))
>> -
>> -always := $(dtb-y)
>> -subdir-y   := $(dts-dirs)
>> +obj-$(BUILTIN_DTB) := $(addsuffix /, $(subdir-y))
>
> I wonder if that should be CONFIG_BUILTIN_DTB?
>
> This is causing failures in linux-next with MIPS
> cavium_octeon_defconfig like below, and changing this line to
> CONFIG_BUILTIN_DTB seems to fix it.

Good catch!


Rob,
Can you fix it to CONFIG_BUILTIN_DTB?

Thanks!



> arch/mips/cavium-octeon/setup.o: In function `__octeon_is_model_runtime__':
> /work/mips/linux/main/./arch/mips/include/asm/octeon/octeon-model.h:368:
> undefined reference to `__dtb_octeon_3xxx_begin'
> arch/mips/cavium-octeon/setup.o: In function `device_tree_init':
> /work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1188: undefined
> reference to `__dtb_octeon_3xxx_begin'
> /work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1184: undefined
> reference to `__dtb_octeon_68xx_begin'
> /work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1184: undefined
> reference to `__dtb_octeon_68xx_begin'
>
> Thanks
> James
>
>


-- 
Best Regards
Masahiro Yamada


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-09 Thread Masahiro Yamada
Hi James,


2017-11-09 21:19 GMT+09:00 James Hogan :
> (resend using a working From address)
>
>  wrote:
>> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
>> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
>> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
>> It could be a race problem when building DTBS in parallel.
>>
>> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
>> sub-directories, so this broke when Broadcom added one more hierarchy
>> in arch/arm64/boot/dts/broadcom//.
>>
>> One idea to fix the issues in a clean way is to move DTB handling
>> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
>> natively, so it should not hurt to do so.
>>
>> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
>> enabled.  All clutter things in Makefiles go away.
>>
>> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
>> directly to traverse sub-directories.
>>
>> Signed-off-by: Masahiro Yamada 
>
>  ...
>
>> diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
>> index 7891ffa..b2b0d88 100644
>> --- a/arch/mips/boot/dts/Makefile
>> +++ b/arch/mips/boot/dts/Makefile
>> @@ -1,20 +1,14 @@
>> -dts-dirs   += brcm
>> -dts-dirs   += cavium-octeon
>> -dts-dirs   += img
>> -dts-dirs   += ingenic
>> -dts-dirs   += lantiq
>> -dts-dirs   += mti
>> -dts-dirs   += netlogic
>> -dts-dirs   += ni
>> -dts-dirs   += pic32
>> -dts-dirs   += qca
>> -dts-dirs   += ralink
>> -dts-dirs   += xilfpga
>> +subdir-y   += brcm
>> +subdir-y   += cavium-octeon
>> +subdir-y   += img
>> +subdir-y   += ingenic
>> +subdir-y   += lantiq
>> +subdir-y   += mti
>> +subdir-y   += netlogic
>> +subdir-y   += ni
>> +subdir-y   += pic32
>> +subdir-y   += qca
>> +subdir-y   += ralink
>> +subdir-y   += xilfpga
>>
>> -obj-y  := $(addsuffix /, $(dts-dirs))
>> -
>> -dtstree:= $(srctree)/$(src)
>> -dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(foreach 
>> d,$(dts-dirs), $(wildcard $(dtstree)/$(d)/*.dts)))
>> -
>> -always := $(dtb-y)
>> -subdir-y   := $(dts-dirs)
>> +obj-$(BUILTIN_DTB) := $(addsuffix /, $(subdir-y))
>
> I wonder if that should be CONFIG_BUILTIN_DTB?
>
> This is causing failures in linux-next with MIPS
> cavium_octeon_defconfig like below, and changing this line to
> CONFIG_BUILTIN_DTB seems to fix it.

Good catch!


Rob,
Can you fix it to CONFIG_BUILTIN_DTB?

Thanks!



> arch/mips/cavium-octeon/setup.o: In function `__octeon_is_model_runtime__':
> /work/mips/linux/main/./arch/mips/include/asm/octeon/octeon-model.h:368:
> undefined reference to `__dtb_octeon_3xxx_begin'
> arch/mips/cavium-octeon/setup.o: In function `device_tree_init':
> /work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1188: undefined
> reference to `__dtb_octeon_3xxx_begin'
> /work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1184: undefined
> reference to `__dtb_octeon_68xx_begin'
> /work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1184: undefined
> reference to `__dtb_octeon_68xx_begin'
>
> Thanks
> James
>
>


-- 
Best Regards
Masahiro Yamada


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-09 Thread James Hogan
(resend using a working From address)

 wrote:
> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
> It could be a race problem when building DTBS in parallel.
>
> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
> sub-directories, so this broke when Broadcom added one more hierarchy
> in arch/arm64/boot/dts/broadcom//.
>
> One idea to fix the issues in a clean way is to move DTB handling
> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
> natively, so it should not hurt to do so.
>
> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
> enabled.  All clutter things in Makefiles go away.
>
> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
> directly to traverse sub-directories.
>
> Signed-off-by: Masahiro Yamada 

 ...

> diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
> index 7891ffa..b2b0d88 100644
> --- a/arch/mips/boot/dts/Makefile
> +++ b/arch/mips/boot/dts/Makefile
> @@ -1,20 +1,14 @@
> -dts-dirs   += brcm
> -dts-dirs   += cavium-octeon
> -dts-dirs   += img
> -dts-dirs   += ingenic
> -dts-dirs   += lantiq
> -dts-dirs   += mti
> -dts-dirs   += netlogic
> -dts-dirs   += ni
> -dts-dirs   += pic32
> -dts-dirs   += qca
> -dts-dirs   += ralink
> -dts-dirs   += xilfpga
> +subdir-y   += brcm
> +subdir-y   += cavium-octeon
> +subdir-y   += img
> +subdir-y   += ingenic
> +subdir-y   += lantiq
> +subdir-y   += mti
> +subdir-y   += netlogic
> +subdir-y   += ni
> +subdir-y   += pic32
> +subdir-y   += qca
> +subdir-y   += ralink
> +subdir-y   += xilfpga
>
> -obj-y  := $(addsuffix /, $(dts-dirs))
> -
> -dtstree:= $(srctree)/$(src)
> -dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(foreach 
> d,$(dts-dirs), $(wildcard $(dtstree)/$(d)/*.dts)))
> -
> -always := $(dtb-y)
> -subdir-y   := $(dts-dirs)
> +obj-$(BUILTIN_DTB) := $(addsuffix /, $(subdir-y))

I wonder if that should be CONFIG_BUILTIN_DTB?

This is causing failures in linux-next with MIPS
cavium_octeon_defconfig like below, and changing this line to
CONFIG_BUILTIN_DTB seems to fix it.

arch/mips/cavium-octeon/setup.o: In function `__octeon_is_model_runtime__':
/work/mips/linux/main/./arch/mips/include/asm/octeon/octeon-model.h:368:
undefined reference to `__dtb_octeon_3xxx_begin'
arch/mips/cavium-octeon/setup.o: In function `device_tree_init':
/work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1188: undefined
reference to `__dtb_octeon_3xxx_begin'
/work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1184: undefined
reference to `__dtb_octeon_68xx_begin'
/work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1184: undefined
reference to `__dtb_octeon_68xx_begin'

Thanks
James


-- 
James Hogan


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-09 Thread James Hogan
(resend using a working From address)

 wrote:
> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
> It could be a race problem when building DTBS in parallel.
>
> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
> sub-directories, so this broke when Broadcom added one more hierarchy
> in arch/arm64/boot/dts/broadcom//.
>
> One idea to fix the issues in a clean way is to move DTB handling
> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
> natively, so it should not hurt to do so.
>
> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
> enabled.  All clutter things in Makefiles go away.
>
> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
> directly to traverse sub-directories.
>
> Signed-off-by: Masahiro Yamada 

 ...

> diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
> index 7891ffa..b2b0d88 100644
> --- a/arch/mips/boot/dts/Makefile
> +++ b/arch/mips/boot/dts/Makefile
> @@ -1,20 +1,14 @@
> -dts-dirs   += brcm
> -dts-dirs   += cavium-octeon
> -dts-dirs   += img
> -dts-dirs   += ingenic
> -dts-dirs   += lantiq
> -dts-dirs   += mti
> -dts-dirs   += netlogic
> -dts-dirs   += ni
> -dts-dirs   += pic32
> -dts-dirs   += qca
> -dts-dirs   += ralink
> -dts-dirs   += xilfpga
> +subdir-y   += brcm
> +subdir-y   += cavium-octeon
> +subdir-y   += img
> +subdir-y   += ingenic
> +subdir-y   += lantiq
> +subdir-y   += mti
> +subdir-y   += netlogic
> +subdir-y   += ni
> +subdir-y   += pic32
> +subdir-y   += qca
> +subdir-y   += ralink
> +subdir-y   += xilfpga
>
> -obj-y  := $(addsuffix /, $(dts-dirs))
> -
> -dtstree:= $(srctree)/$(src)
> -dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(foreach 
> d,$(dts-dirs), $(wildcard $(dtstree)/$(d)/*.dts)))
> -
> -always := $(dtb-y)
> -subdir-y   := $(dts-dirs)
> +obj-$(BUILTIN_DTB) := $(addsuffix /, $(subdir-y))

I wonder if that should be CONFIG_BUILTIN_DTB?

This is causing failures in linux-next with MIPS
cavium_octeon_defconfig like below, and changing this line to
CONFIG_BUILTIN_DTB seems to fix it.

arch/mips/cavium-octeon/setup.o: In function `__octeon_is_model_runtime__':
/work/mips/linux/main/./arch/mips/include/asm/octeon/octeon-model.h:368:
undefined reference to `__dtb_octeon_3xxx_begin'
arch/mips/cavium-octeon/setup.o: In function `device_tree_init':
/work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1188: undefined
reference to `__dtb_octeon_3xxx_begin'
/work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1184: undefined
reference to `__dtb_octeon_68xx_begin'
/work/mips/linux/main/arch/mips/cavium-octeon/setup.c:1184: undefined
reference to `__dtb_octeon_68xx_begin'

Thanks
James


-- 
James Hogan


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-08 Thread Rob Herring
On Sun, Nov 5, 2017 at 7:49 AM, Arnd Bergmann  wrote:
> On Sun, Nov 5, 2017 at 6:30 AM, Masahiro Yamada
>  wrote:
>> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
>> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
>> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
>> It could be a race problem when building DTBS in parallel.
>>
>> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
>> sub-directories, so this broke when Broadcom added one more hierarchy
>> in arch/arm64/boot/dts/broadcom//.
>>
>> One idea to fix the issues in a clean way is to move DTB handling
>> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
>> natively, so it should not hurt to do so.
>>
>> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
>> enabled.  All clutter things in Makefiles go away.
>>
>> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
>> directly to traverse sub-directories.
>>
>> Signed-off-by: Masahiro Yamada 
>
> Nice, that's much better than the hack I had.
>
> Acked-by: Arnd Bergmann 

I applied this, but it has a few conflicts with SPDX tags from Greg
and some board additions in arm-soc. Please take a look.

Rob


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-08 Thread Rob Herring
On Sun, Nov 5, 2017 at 7:49 AM, Arnd Bergmann  wrote:
> On Sun, Nov 5, 2017 at 6:30 AM, Masahiro Yamada
>  wrote:
>> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
>> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
>> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
>> It could be a race problem when building DTBS in parallel.
>>
>> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
>> sub-directories, so this broke when Broadcom added one more hierarchy
>> in arch/arm64/boot/dts/broadcom//.
>>
>> One idea to fix the issues in a clean way is to move DTB handling
>> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
>> natively, so it should not hurt to do so.
>>
>> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
>> enabled.  All clutter things in Makefiles go away.
>>
>> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
>> directly to traverse sub-directories.
>>
>> Signed-off-by: Masahiro Yamada 
>
> Nice, that's much better than the hack I had.
>
> Acked-by: Arnd Bergmann 

I applied this, but it has a few conflicts with SPDX tags from Greg
and some board additions in arm-soc. Please take a look.

Rob


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-05 Thread Arnd Bergmann
On Sun, Nov 5, 2017 at 6:30 AM, Masahiro Yamada
 wrote:
> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
> It could be a race problem when building DTBS in parallel.
>
> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
> sub-directories, so this broke when Broadcom added one more hierarchy
> in arch/arm64/boot/dts/broadcom//.
>
> One idea to fix the issues in a clean way is to move DTB handling
> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
> natively, so it should not hurt to do so.
>
> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
> enabled.  All clutter things in Makefiles go away.
>
> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
> directly to traverse sub-directories.
>
> Signed-off-by: Masahiro Yamada 

Nice, that's much better than the hack I had.

Acked-by: Arnd Bergmann 


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-05 Thread Arnd Bergmann
On Sun, Nov 5, 2017 at 6:30 AM, Masahiro Yamada
 wrote:
> If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
> DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
> the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
> It could be a race problem when building DTBS in parallel.
>
> Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
> sub-directories, so this broke when Broadcom added one more hierarchy
> in arch/arm64/boot/dts/broadcom//.
>
> One idea to fix the issues in a clean way is to move DTB handling
> to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
> natively, so it should not hurt to do so.
>
> Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
> enabled.  All clutter things in Makefiles go away.
>
> As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
> directly to traverse sub-directories.
>
> Signed-off-by: Masahiro Yamada 

Nice, that's much better than the hack I had.

Acked-by: Arnd Bergmann 


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-05 Thread Sam Ravnborg
Hi Masahiro

Nice cleanup - looks good.

> --- a/arch/mips/boot/dts/brcm/Makefile
> +++ b/arch/mips/boot/dts/brcm/Makefile
> @@ -37,5 +37,3 @@ obj-y   += $(patsubst %.dtb, 
> %.dtb.o, $(dtb-y))
>  
>  # Force kbuild to make empty built-in.o if necessary
>  obj- += dummy.o

I noticed a few of these dummy.o in the patched files.
Looks like another candidate for cleaning up - in a separate patch.

Sam


Re: [PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-05 Thread Sam Ravnborg
Hi Masahiro

Nice cleanup - looks good.

> --- a/arch/mips/boot/dts/brcm/Makefile
> +++ b/arch/mips/boot/dts/brcm/Makefile
> @@ -37,5 +37,3 @@ obj-y   += $(patsubst %.dtb, 
> %.dtb.o, $(dtb-y))
>  
>  # Force kbuild to make empty built-in.o if necessary
>  obj- += dummy.o

I noticed a few of these dummy.o in the patched files.
Looks like another candidate for cleaning up - in a separate patch.

Sam


[PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-04 Thread Masahiro Yamada
If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
It could be a race problem when building DTBS in parallel.

Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
sub-directories, so this broke when Broadcom added one more hierarchy
in arch/arm64/boot/dts/broadcom//.

One idea to fix the issues in a clean way is to move DTB handling
to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
natively, so it should not hurt to do so.

Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
enabled.  All clutter things in Makefiles go away.

As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
directly to traverse sub-directories.

Signed-off-by: Masahiro Yamada 
---

 arch/arc/boot/dts/Makefile   |  7 ++-
 arch/arm/boot/dts/Makefile   |  5 --
 arch/arm64/boot/dts/Makefile | 58 ++--
 arch/arm64/boot/dts/actions/Makefile |  3 --
 arch/arm64/boot/dts/al/Makefile  |  3 --
 arch/arm64/boot/dts/allwinner/Makefile   |  3 --
 arch/arm64/boot/dts/altera/Makefile  |  3 --
 arch/arm64/boot/dts/amd/Makefile |  3 --
 arch/arm64/boot/dts/amlogic/Makefile |  3 --
 arch/arm64/boot/dts/apm/Makefile |  3 --
 arch/arm64/boot/dts/arm/Makefile |  3 --
 arch/arm64/boot/dts/broadcom/Makefile|  6 +--
 arch/arm64/boot/dts/broadcom/northstar2/Makefile |  3 --
 arch/arm64/boot/dts/broadcom/stingray/Makefile   |  3 --
 arch/arm64/boot/dts/cavium/Makefile  |  3 --
 arch/arm64/boot/dts/exynos/Makefile  |  3 --
 arch/arm64/boot/dts/freescale/Makefile   |  3 --
 arch/arm64/boot/dts/hisilicon/Makefile   |  3 --
 arch/arm64/boot/dts/lg/Makefile  |  3 --
 arch/arm64/boot/dts/marvell/Makefile |  3 --
 arch/arm64/boot/dts/mediatek/Makefile|  3 --
 arch/arm64/boot/dts/nvidia/Makefile  |  2 -
 arch/arm64/boot/dts/qcom/Makefile|  3 --
 arch/arm64/boot/dts/realtek/Makefile |  3 --
 arch/arm64/boot/dts/renesas/Makefile |  2 -
 arch/arm64/boot/dts/rockchip/Makefile|  3 --
 arch/arm64/boot/dts/socionext/Makefile   |  2 -
 arch/arm64/boot/dts/sprd/Makefile|  3 --
 arch/arm64/boot/dts/xilinx/Makefile  |  3 --
 arch/arm64/boot/dts/zte/Makefile |  3 --
 arch/h8300/boot/dts/Makefile |  5 --
 arch/metag/boot/dts/Makefile |  5 --
 arch/mips/boot/dts/Makefile  | 32 ++---
 arch/mips/boot/dts/brcm/Makefile |  2 -
 arch/mips/boot/dts/cavium-octeon/Makefile|  2 -
 arch/mips/boot/dts/img/Makefile  |  2 -
 arch/mips/boot/dts/ingenic/Makefile  |  2 -
 arch/mips/boot/dts/lantiq/Makefile   |  2 -
 arch/mips/boot/dts/mti/Makefile  |  2 -
 arch/mips/boot/dts/netlogic/Makefile |  2 -
 arch/mips/boot/dts/ni/Makefile   |  2 -
 arch/mips/boot/dts/pic32/Makefile|  2 -
 arch/mips/boot/dts/qca/Makefile  |  2 -
 arch/mips/boot/dts/ralink/Makefile   |  2 -
 arch/mips/boot/dts/xilfpga/Makefile  |  2 -
 arch/xtensa/boot/dts/Makefile|  7 ++-
 scripts/Makefile.dtbinst |  6 +--
 scripts/Makefile.lib |  5 ++
 48 files changed, 53 insertions(+), 182 deletions(-)

diff --git a/arch/arc/boot/dts/Makefile b/arch/arc/boot/dts/Makefile
index 1257db1..9ece28b 100644
--- a/arch/arc/boot/dts/Makefile
+++ b/arch/arc/boot/dts/Makefile
@@ -10,7 +10,6 @@ dtb-y := $(builtindtb-y).dtb
 
 .SECONDARY: $(obj)/$(builtindtb-y).dtb.S
 
-dtstree:= $(srctree)/$(src)
-dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard 
$(dtstree)/*.dts))
-
-always := $(dtb-y)
+# for CONFIG_OF_ALL_DTBS test
+dtstree:= $(srctree)/$(src)
+dtb-   := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 5eeefbc..4b650d6 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1069,8 +1069,3 @@ dtb-$(CONFIG_ARCH_ASPEED) += aspeed-bmc-opp-palmetto.dtb \
aspeed-bmc-opp-romulus.dtb \
aspeed-ast2500-evb.dtb
 endif
-
-dtstree:= $(srctree)/$(src)
-dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard 
$(dtstree)/*.dts))
-
-always := $(dtb-y)
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 8e19512..a7ecb42 100644
--- a/arch/arm64/boot/dts/Makefile
+++ 

[PATCH 2/2] kbuild: handle dtb-y and CONFIG_OF_ALL_DTBS natively in Makefile.lib

2017-11-04 Thread Masahiro Yamada
If CONFIG_OF_ALL_DTBS is enabled, "make ARCH=arm64 dtbs" compiles each
DTB twice; one from arch/arm64/boot/dts/*/Makefile and the other from
the dtb-$(CONFIG_OF_ALL_DTBS) line in arch/arm64/boot/dts/Makefile.
It could be a race problem when building DTBS in parallel.

Another minor issue is CONFIG_OF_ALL_DTBS covers only *.dts in vendor
sub-directories, so this broke when Broadcom added one more hierarchy
in arch/arm64/boot/dts/broadcom//.

One idea to fix the issues in a clean way is to move DTB handling
to Kbuild core scripts.  Makefile.dtbinst already recognizes dtb-y
natively, so it should not hurt to do so.

Add $(dtb-y) to extra-y, and $(dtb-) as well if CONFIG_OF_ALL_DTBS is
enabled.  All clutter things in Makefiles go away.

As a bonus clean-up, I also removed dts-dirs.  Just use subdir-y
directly to traverse sub-directories.

Signed-off-by: Masahiro Yamada 
---

 arch/arc/boot/dts/Makefile   |  7 ++-
 arch/arm/boot/dts/Makefile   |  5 --
 arch/arm64/boot/dts/Makefile | 58 ++--
 arch/arm64/boot/dts/actions/Makefile |  3 --
 arch/arm64/boot/dts/al/Makefile  |  3 --
 arch/arm64/boot/dts/allwinner/Makefile   |  3 --
 arch/arm64/boot/dts/altera/Makefile  |  3 --
 arch/arm64/boot/dts/amd/Makefile |  3 --
 arch/arm64/boot/dts/amlogic/Makefile |  3 --
 arch/arm64/boot/dts/apm/Makefile |  3 --
 arch/arm64/boot/dts/arm/Makefile |  3 --
 arch/arm64/boot/dts/broadcom/Makefile|  6 +--
 arch/arm64/boot/dts/broadcom/northstar2/Makefile |  3 --
 arch/arm64/boot/dts/broadcom/stingray/Makefile   |  3 --
 arch/arm64/boot/dts/cavium/Makefile  |  3 --
 arch/arm64/boot/dts/exynos/Makefile  |  3 --
 arch/arm64/boot/dts/freescale/Makefile   |  3 --
 arch/arm64/boot/dts/hisilicon/Makefile   |  3 --
 arch/arm64/boot/dts/lg/Makefile  |  3 --
 arch/arm64/boot/dts/marvell/Makefile |  3 --
 arch/arm64/boot/dts/mediatek/Makefile|  3 --
 arch/arm64/boot/dts/nvidia/Makefile  |  2 -
 arch/arm64/boot/dts/qcom/Makefile|  3 --
 arch/arm64/boot/dts/realtek/Makefile |  3 --
 arch/arm64/boot/dts/renesas/Makefile |  2 -
 arch/arm64/boot/dts/rockchip/Makefile|  3 --
 arch/arm64/boot/dts/socionext/Makefile   |  2 -
 arch/arm64/boot/dts/sprd/Makefile|  3 --
 arch/arm64/boot/dts/xilinx/Makefile  |  3 --
 arch/arm64/boot/dts/zte/Makefile |  3 --
 arch/h8300/boot/dts/Makefile |  5 --
 arch/metag/boot/dts/Makefile |  5 --
 arch/mips/boot/dts/Makefile  | 32 ++---
 arch/mips/boot/dts/brcm/Makefile |  2 -
 arch/mips/boot/dts/cavium-octeon/Makefile|  2 -
 arch/mips/boot/dts/img/Makefile  |  2 -
 arch/mips/boot/dts/ingenic/Makefile  |  2 -
 arch/mips/boot/dts/lantiq/Makefile   |  2 -
 arch/mips/boot/dts/mti/Makefile  |  2 -
 arch/mips/boot/dts/netlogic/Makefile |  2 -
 arch/mips/boot/dts/ni/Makefile   |  2 -
 arch/mips/boot/dts/pic32/Makefile|  2 -
 arch/mips/boot/dts/qca/Makefile  |  2 -
 arch/mips/boot/dts/ralink/Makefile   |  2 -
 arch/mips/boot/dts/xilfpga/Makefile  |  2 -
 arch/xtensa/boot/dts/Makefile|  7 ++-
 scripts/Makefile.dtbinst |  6 +--
 scripts/Makefile.lib |  5 ++
 48 files changed, 53 insertions(+), 182 deletions(-)

diff --git a/arch/arc/boot/dts/Makefile b/arch/arc/boot/dts/Makefile
index 1257db1..9ece28b 100644
--- a/arch/arc/boot/dts/Makefile
+++ b/arch/arc/boot/dts/Makefile
@@ -10,7 +10,6 @@ dtb-y := $(builtindtb-y).dtb
 
 .SECONDARY: $(obj)/$(builtindtb-y).dtb.S
 
-dtstree:= $(srctree)/$(src)
-dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard 
$(dtstree)/*.dts))
-
-always := $(dtb-y)
+# for CONFIG_OF_ALL_DTBS test
+dtstree:= $(srctree)/$(src)
+dtb-   := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts))
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 5eeefbc..4b650d6 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1069,8 +1069,3 @@ dtb-$(CONFIG_ARCH_ASPEED) += aspeed-bmc-opp-palmetto.dtb \
aspeed-bmc-opp-romulus.dtb \
aspeed-ast2500-evb.dtb
 endif
-
-dtstree:= $(srctree)/$(src)
-dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard 
$(dtstree)/*.dts))
-
-always := $(dtb-y)
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 8e19512..a7ecb42 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -1,33 +1,25 @@