diff mbox series

[PULL,24/51] meson: compile bundled device trees

Message ID 20230907130004.500601-25-pbonzini@redhat.com
State New
Headers show
Series [PULL,01/51] linux-user, bsd-user: disable on unsupported host architectures | expand

Commit Message

Paolo Bonzini Sept. 7, 2023, 12:59 p.m. UTC
If dtc is available, compile the .dts files in the pc-bios directory
instead of using the precompiled binaries.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 pc-bios/Makefile    | 19 -------------------
 pc-bios/meson.build | 25 +++++++++++++++++++++----
 2 files changed, 21 insertions(+), 23 deletions(-)
 delete mode 100644 pc-bios/Makefile

Comments

Philippe Mathieu-Daudé Sept. 8, 2023, 4:27 p.m. UTC | #1
On 7/9/23 14:59, Paolo Bonzini wrote:
> If dtc is available, compile the .dts files in the pc-bios directory
> instead of using the precompiled binaries.
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   pc-bios/Makefile    | 19 -------------------
>   pc-bios/meson.build | 25 +++++++++++++++++++++----
>   2 files changed, 21 insertions(+), 23 deletions(-)
>   delete mode 100644 pc-bios/Makefile

FWIW I'm getting:

[50/1419] Generating pc-bios/bamboo.dts with a custom command
../../pc-bios/bamboo.dts:45.9-48.4: Warning (unit_address_vs_reg): 
/memory: node has a reg or ranges property, but no unit name
../../pc-bios/bamboo.dts:87.13-154.5: Warning (unit_address_vs_reg): 
/plb/opb: node has a reg or ranges property, but no unit name
../../pc-bios/bamboo.dts:198.3-50: Warning (chosen_node_stdout_path): 
/chosen:linux,stdout-path: Use 'stdout-path' instead
../../pc-bios/bamboo.dts:87.13-154.5: Warning (interrupts_property): 
/plb/opb: Missing interrupt-parent
../../pc-bios/bamboo.dts:100.14-108.6: Warning (interrupts_property): 
/plb/opb/ebc: Missing interrupt-parent
[51/1419] Generating pc-bios/canyonlands.dts with a custom command
../../pc-bios/canyonlands.dts:47.9-50.4: Warning (unit_address_vs_reg): 
/memory: node has a reg or ranges property, but no unit name
../../pc-bios/canyonlands.dts:210.13-429.5: Warning 
(unit_address_vs_reg): /plb/opb: node has a reg or ranges property, but 
no unit name
../../pc-bios/canyonlands.dts:464.26-504.5: Warning (pci_bridge): 
/plb/pciex@d00000000: node name is not "pci" or "pcie"
../../pc-bios/canyonlands.dts:506.26-546.5: Warning (pci_bridge): 
/plb/pciex@d20000000: node name is not "pci" or "pcie"
pc-bios/canyonlands.dtb: Warning (unit_address_format): Failed 
prerequisite 'pci_bridge'
pc-bios/canyonlands.dtb: Warning (pci_device_reg): Failed prerequisite 
'pci_bridge'
pc-bios/canyonlands.dtb: Warning (pci_device_bus_num): Failed 
prerequisite 'pci_bridge'
../../pc-bios/canyonlands.dts:268.14-289.7: Warning 
(avoid_unnecessary_addr_size): /plb/opb/ebc/ndfc@3,0: unnecessary 
#address-cells/#size-cells without "ranges", "dma-ranges" or child "reg" 
property
Michael Tokarev Sept. 8, 2023, 5:20 p.m. UTC | #2
08.09.2023 19:27, Philippe Mathieu-Daudé:
> On 7/9/23 14:59, Paolo Bonzini wrote:
>> If dtc is available, compile the .dts files in the pc-bios directory
>> instead of using the precompiled binaries.
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   pc-bios/Makefile    | 19 -------------------
>>   pc-bios/meson.build | 25 +++++++++++++++++++++----
>>   2 files changed, 21 insertions(+), 23 deletions(-)
>>   delete mode 100644 pc-bios/Makefile
> 
> FWIW I'm getting:
> 
> [50/1419] Generating pc-bios/bamboo.dts with a custom command
> ../../pc-bios/bamboo.dts:45.9-48.4: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
> ../../pc-bios/bamboo.dts:87.13-154.5: Warning (unit_address_vs_reg): /plb/opb: node has a reg or ranges property, but no unit name
> ../../pc-bios/bamboo.dts:198.3-50: Warning (chosen_node_stdout_path): /chosen:linux,stdout-path: Use 'stdout-path' instead
> ../../pc-bios/bamboo.dts:87.13-154.5: Warning (interrupts_property): /plb/opb: Missing interrupt-parent
> ../../pc-bios/bamboo.dts:100.14-108.6: Warning (interrupts_property): /plb/opb/ebc: Missing interrupt-parent
> [51/1419] Generating pc-bios/canyonlands.dts with a custom command
> ../../pc-bios/canyonlands.dts:47.9-50.4: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
> ../../pc-bios/canyonlands.dts:210.13-429.5: Warning (unit_address_vs_reg): /plb/opb: node has a reg or ranges property, but no unit name
> ../../pc-bios/canyonlands.dts:464.26-504.5: Warning (pci_bridge): /plb/pciex@d00000000: node name is not "pci" or "pcie"
> ../../pc-bios/canyonlands.dts:506.26-546.5: Warning (pci_bridge): /plb/pciex@d20000000: node name is not "pci" or "pcie"
> pc-bios/canyonlands.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge'
> pc-bios/canyonlands.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge'
> pc-bios/canyonlands.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge'
> ../../pc-bios/canyonlands.dts:268.14-289.7: Warning (avoid_unnecessary_addr_size): /plb/opb/ebc/ndfc@3,0: unnecessary #address-cells/#size-cells 
> without "ranges", "dma-ranges" or child "reg" property

This smells like something which has been here forever and no one noticed
because the compile only happens when updating these files, ie, almost
never.

So, "don't blame the messenger" :)

/mjt
BALATON Zoltan Sept. 8, 2023, 7:21 p.m. UTC | #3
On Fri, 8 Sep 2023, Michael Tokarev wrote:
> 08.09.2023 19:27, Philippe Mathieu-Daudé:
>> On 7/9/23 14:59, Paolo Bonzini wrote:
>>> If dtc is available, compile the .dts files in the pc-bios directory
>>> instead of using the precompiled binaries.
>>> 
>>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> ---
>>>   pc-bios/Makefile    | 19 -------------------
>>>   pc-bios/meson.build | 25 +++++++++++++++++++++----
>>>   2 files changed, 21 insertions(+), 23 deletions(-)
>>>   delete mode 100644 pc-bios/Makefile
>> 
>> FWIW I'm getting:
>> 
>> [50/1419] Generating pc-bios/bamboo.dts with a custom command
>> ../../pc-bios/bamboo.dts:45.9-48.4: Warning (unit_address_vs_reg): /memory: 
>> node has a reg or ranges property, but no unit name
>> ../../pc-bios/bamboo.dts:87.13-154.5: Warning (unit_address_vs_reg): 
>> /plb/opb: node has a reg or ranges property, but no unit name
>> ../../pc-bios/bamboo.dts:198.3-50: Warning (chosen_node_stdout_path): 
>> /chosen:linux,stdout-path: Use 'stdout-path' instead
>> ../../pc-bios/bamboo.dts:87.13-154.5: Warning (interrupts_property): 
>> /plb/opb: Missing interrupt-parent
>> ../../pc-bios/bamboo.dts:100.14-108.6: Warning (interrupts_property): 
>> /plb/opb/ebc: Missing interrupt-parent
>> [51/1419] Generating pc-bios/canyonlands.dts with a custom command
>> ../../pc-bios/canyonlands.dts:47.9-50.4: Warning (unit_address_vs_reg): 
>> /memory: node has a reg or ranges property, but no unit name
>> ../../pc-bios/canyonlands.dts:210.13-429.5: Warning (unit_address_vs_reg): 
>> /plb/opb: node has a reg or ranges property, but no unit name
>> ../../pc-bios/canyonlands.dts:464.26-504.5: Warning (pci_bridge): 
>> /plb/pciex@d00000000: node name is not "pci" or "pcie"
>> ../../pc-bios/canyonlands.dts:506.26-546.5: Warning (pci_bridge): 
>> /plb/pciex@d20000000: node name is not "pci" or "pcie"
>> pc-bios/canyonlands.dtb: Warning (unit_address_format): Failed prerequisite 
>> 'pci_bridge'
>> pc-bios/canyonlands.dtb: Warning (pci_device_reg): Failed prerequisite 
>> 'pci_bridge'
>> pc-bios/canyonlands.dtb: Warning (pci_device_bus_num): Failed prerequisite 
>> 'pci_bridge'
>> ../../pc-bios/canyonlands.dts:268.14-289.7: Warning 
>> (avoid_unnecessary_addr_size): /plb/opb/ebc/ndfc@3,0: unnecessary 
>> #address-cells/#size-cells without "ranges", "dma-ranges" or child "reg" 
>> property
>
> This smells like something which has been here forever and no one noticed
> because the compile only happens when updating these files, ie, almost
> never.
>
> So, "don't blame the messenger" :)

I was about to ask, since when but probably nobody knows then. AFAIR I had 
no such errors for the canyonlands one when I've added it but that was 
quite some years ago and things in dtc for example could have changed so 
it now gives these warnings.

The dts files come from Linux so maybe it's fixed there but not sure if 
updating these would generate different dtb that the guests might not like 
as both these machines and guests running on them are quite old. So maybe 
it's safer to ignore the warnings? On the other hand, maybe this dtb is 
only used when booting Linux with -kernel, otherwise the u-boot firmware 
will generate it so updating it may not affect most guests anyway. I think 
Guenter Roeck (cc'd) used this for testing Linux kernels so maybe he has 
some more info or insight. This may not help much but that's all I can add 
to this.

Regards,
BALATON Zoltan
Michael Tokarev Sept. 8, 2023, 7:40 p.m. UTC | #4
08.09.2023 22:21, BALATON Zoltan:
..
> I was about to ask, since when but probably nobody knows then. AFAIR I had no such errors for the canyonlands one when I've added it but that was 
> quite some years ago and things in dtc for example could have changed so it now gives these warnings.

I think it can be said based on debian build logs. Lemme see..

https://buildd.debian.org/status/logs.php?pkg=qemu&arch=all

The first log entry there is from 2018-12-12, for qemu 3.1, dtc 1.4.7.
It has:

dtc -o b/qemu/pc-bios/bamboo.dtb pc-bios/bamboo.dts
b/qemu/pc-bios/bamboo.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
b/qemu/pc-bios/bamboo.dtb: Warning (unit_address_vs_reg): /plb/opb: node has a reg or ranges property, but no unit name
b/qemu/pc-bios/bamboo.dtb: Warning (chosen_node_stdout_path): /chosen:linux,stdout-path: Use 'stdout-path' instead
b/qemu/pc-bios/bamboo.dtb: Warning (interrupts_property): /plb/opb: Missing interrupt-parent
b/qemu/pc-bios/bamboo.dtb: Warning (interrupts_property): /plb/opb/ebc: Missing interrupt-parent

next it was moved to one of the subpackages, and moved back to
arch-independent package in 6.2 (2022-01-09, dtc 1.6.0), which has:

dtc -o b/misc/bamboo.dtb pc-bios/bamboo.dts
pc-bios/bamboo.dts:45.9-48.4: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
pc-bios/bamboo.dts:87.13-154.5: Warning (unit_address_vs_reg): /plb/opb: node has a reg or ranges property, but no unit name
pc-bios/bamboo.dts:198.3-50: Warning (chosen_node_stdout_path): /chosen:linux,stdout-path: Use 'stdout-path' instead
pc-bios/bamboo.dts:87.13-154.5: Warning (interrupts_property): /plb/opb: Missing interrupt-parent
pc-bios/bamboo.dts:100.14-108.6: Warning (interrupts_property): /plb/opb/ebc: Missing interrupt-parent
dtc -o b/misc/canyonlands.dtb pc-bios/canyonlands.dts
pc-bios/canyonlands.dts:47.9-50.4: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
pc-bios/canyonlands.dts:210.13-429.5: Warning (unit_address_vs_reg): /plb/opb: node has a reg or ranges property, but no unit name
pc-bios/canyonlands.dts:464.26-504.5: Warning (pci_bridge): /plb/pciex@d00000000: node name is not "pci" or "pcie"
pc-bios/canyonlands.dts:506.26-546.5: Warning (pci_bridge): /plb/pciex@d20000000: node name is not "pci" or "pcie"
b/misc/canyonlands.dtb: Warning (unit_address_format): Failed prerequisite 'pci_bridge'
b/misc/canyonlands.dtb: Warning (pci_device_reg): Failed prerequisite 'pci_bridge'
b/misc/canyonlands.dtb: Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge'
pc-bios/canyonlands.dts:268.14-289.7: Warning (avoid_unnecessary_addr_size): /plb/opb/ebc/ndfc@3,0: unnecessary #address-cells/#size-cells without 
"ranges" or child "reg" property

FWIW.

/mjt
BALATON Zoltan Sept. 8, 2023, 8:07 p.m. UTC | #5
On Fri, 8 Sep 2023, Michael Tokarev wrote:
> 08.09.2023 22:21, BALATON Zoltan:
>> I was about to ask, since when but probably nobody knows then. AFAIR I had 
>> no such errors for the canyonlands one when I've added it but that was 
>> quite some years ago and things in dtc for example could have changed so it 
>> now gives these warnings.
>
> I think it can be said based on debian build logs. Lemme see..
>
> https://buildd.debian.org/status/logs.php?pkg=qemu&arch=all
>
> The first log entry there is from 2018-12-12, for qemu 3.1, dtc 1.4.7.
> It has:
>
> dtc -o b/qemu/pc-bios/bamboo.dtb pc-bios/bamboo.dts
> b/qemu/pc-bios/bamboo.dtb: Warning (unit_address_vs_reg): /memory: node has a 
> reg or ranges property, but no unit name
> b/qemu/pc-bios/bamboo.dtb: Warning (unit_address_vs_reg): /plb/opb: node has 
> a reg or ranges property, but no unit name
> b/qemu/pc-bios/bamboo.dtb: Warning (chosen_node_stdout_path): 
> /chosen:linux,stdout-path: Use 'stdout-path' instead
> b/qemu/pc-bios/bamboo.dtb: Warning (interrupts_property): /plb/opb: Missing 
> interrupt-parent
> b/qemu/pc-bios/bamboo.dtb: Warning (interrupts_property): /plb/opb/ebc: 
> Missing interrupt-parent


OK so bamboo was likely always like that. Sam460ex (aka canyonlands which 
is the devel board it is based on) was added in February 2018 so that was 
OK back then but later dtc versions may have become pickier somewhere 
between 1.4.7 and 1.6.0.

> next it was moved to one of the subpackages, and moved back to
> arch-independent package in 6.2 (2022-01-09, dtc 1.6.0), which has:
>
> dtc -o b/misc/bamboo.dtb pc-bios/bamboo.dts
> pc-bios/bamboo.dts:45.9-48.4: Warning (unit_address_vs_reg): /memory: node 
> has a reg or ranges property, but no unit name
> pc-bios/bamboo.dts:87.13-154.5: Warning (unit_address_vs_reg): /plb/opb: node 
> has a reg or ranges property, but no unit name
> pc-bios/bamboo.dts:198.3-50: Warning (chosen_node_stdout_path): 
> /chosen:linux,stdout-path: Use 'stdout-path' instead
> pc-bios/bamboo.dts:87.13-154.5: Warning (interrupts_property): /plb/opb: 
> Missing interrupt-parent
> pc-bios/bamboo.dts:100.14-108.6: Warning (interrupts_property): /plb/opb/ebc: 
> Missing interrupt-parent
> dtc -o b/misc/canyonlands.dtb pc-bios/canyonlands.dts
> pc-bios/canyonlands.dts:47.9-50.4: Warning (unit_address_vs_reg): /memory: 
> node has a reg or ranges property, but no unit name
> pc-bios/canyonlands.dts:210.13-429.5: Warning (unit_address_vs_reg): 
> /plb/opb: node has a reg or ranges property, but no unit name
> pc-bios/canyonlands.dts:464.26-504.5: Warning (pci_bridge): 
> /plb/pciex@d00000000: node name is not "pci" or "pcie"
> pc-bios/canyonlands.dts:506.26-546.5: Warning (pci_bridge): 
> /plb/pciex@d20000000: node name is not "pci" or "pcie"

Linux has this in arch/powerpc/boot/dts/canyonlands.dts and at least had a 
change of the pciex names to pcie that should fix some of these but if the 
u-boot still uses older names then could updating this result in different 
results between using -kernel and without that? I don't know how guests 
use the dtb so can't tell what to do but keeping it consistent with the 
older u-boot this board has seems like a safer option.

Regards,
BALATON Zoltan

> b/misc/canyonlands.dtb: Warning (unit_address_format): Failed prerequisite 
> 'pci_bridge'
> b/misc/canyonlands.dtb: Warning (pci_device_reg): Failed prerequisite 
> 'pci_bridge'
> b/misc/canyonlands.dtb: Warning (pci_device_bus_num): Failed prerequisite 
> 'pci_bridge'
> pc-bios/canyonlands.dts:268.14-289.7: Warning (avoid_unnecessary_addr_size): 
> /plb/opb/ebc/ndfc@3,0: unnecessary #address-cells/#size-cells without 
> "ranges" or child "reg" property
>
> FWIW.
>
> /mjt
>
>
Philippe Mathieu-Daudé Sept. 11, 2023, 2:48 p.m. UTC | #6
On 8/9/23 22:07, BALATON Zoltan wrote:
> On Fri, 8 Sep 2023, Michael Tokarev wrote:
>> 08.09.2023 22:21, BALATON Zoltan:
>>> I was about to ask, since when but probably nobody knows then. AFAIR 
>>> I had no such errors for the canyonlands one when I've added it but 
>>> that was quite some years ago and things in dtc for example could 
>>> have changed so it now gives these warnings.
>>
>> I think it can be said based on debian build logs. Lemme see..
>>
>> https://buildd.debian.org/status/logs.php?pkg=qemu&arch=all
>>
>> The first log entry there is from 2018-12-12, for qemu 3.1, dtc 1.4.7.
>> It has:
>>
>> dtc -o b/qemu/pc-bios/bamboo.dtb pc-bios/bamboo.dts
>> b/qemu/pc-bios/bamboo.dtb: Warning (unit_address_vs_reg): /memory: 
>> node has a reg or ranges property, but no unit name
>> b/qemu/pc-bios/bamboo.dtb: Warning (unit_address_vs_reg): /plb/opb: 
>> node has a reg or ranges property, but no unit name
>> b/qemu/pc-bios/bamboo.dtb: Warning (chosen_node_stdout_path): 
>> /chosen:linux,stdout-path: Use 'stdout-path' instead
>> b/qemu/pc-bios/bamboo.dtb: Warning (interrupts_property): /plb/opb: 
>> Missing interrupt-parent
>> b/qemu/pc-bios/bamboo.dtb: Warning (interrupts_property): 
>> /plb/opb/ebc: Missing interrupt-parent
> 
> 
> OK so bamboo was likely always like that. Sam460ex (aka canyonlands 
> which is the devel board it is based on) was added in February 2018 so 
> that was OK back then but later dtc versions may have become pickier 
> somewhere between 1.4.7 and 1.6.0.
> 
>> next it was moved to one of the subpackages, and moved back to
>> arch-independent package in 6.2 (2022-01-09, dtc 1.6.0), which has:
>>
>> dtc -o b/misc/bamboo.dtb pc-bios/bamboo.dts
>> pc-bios/bamboo.dts:45.9-48.4: Warning (unit_address_vs_reg): /memory: 
>> node has a reg or ranges property, but no unit name
>> pc-bios/bamboo.dts:87.13-154.5: Warning (unit_address_vs_reg): 
>> /plb/opb: node has a reg or ranges property, but no unit name
>> pc-bios/bamboo.dts:198.3-50: Warning (chosen_node_stdout_path): 
>> /chosen:linux,stdout-path: Use 'stdout-path' instead
>> pc-bios/bamboo.dts:87.13-154.5: Warning (interrupts_property): 
>> /plb/opb: Missing interrupt-parent
>> pc-bios/bamboo.dts:100.14-108.6: Warning (interrupts_property): 
>> /plb/opb/ebc: Missing interrupt-parent
>> dtc -o b/misc/canyonlands.dtb pc-bios/canyonlands.dts
>> pc-bios/canyonlands.dts:47.9-50.4: Warning (unit_address_vs_reg): 
>> /memory: node has a reg or ranges property, but no unit name
>> pc-bios/canyonlands.dts:210.13-429.5: Warning (unit_address_vs_reg): 
>> /plb/opb: node has a reg or ranges property, but no unit name
>> pc-bios/canyonlands.dts:464.26-504.5: Warning (pci_bridge): 
>> /plb/pciex@d00000000: node name is not "pci" or "pcie"
>> pc-bios/canyonlands.dts:506.26-546.5: Warning (pci_bridge): 
>> /plb/pciex@d20000000: node name is not "pci" or "pcie"
> 
> Linux has this in arch/powerpc/boot/dts/canyonlands.dts and at least had 
> a change of the pciex names to pcie that should fix some of these but if 
> the u-boot still uses older names then could updating this result in 
> different results between using -kernel and without that? I don't know 
> how guests use the dtb so can't tell what to do but keeping it 
> consistent with the older u-boot this board has seems like a safer option.

Maybe we can use '-W no-pci_bridge' for this particular one.
Peter Maydell Sept. 11, 2023, 3:16 p.m. UTC | #7
On Fri, 8 Sept 2023 at 21:08, BALATON Zoltan <balaton@eik.bme.hu> wrote:
>
> On Fri, 8 Sep 2023, Michael Tokarev wrote:
> > 08.09.2023 22:21, BALATON Zoltan:
> >> I was about to ask, since when but probably nobody knows then. AFAIR I had
> >> no such errors for the canyonlands one when I've added it but that was
> >> quite some years ago and things in dtc for example could have changed so it
> >> now gives these warnings.
> >
> > I think it can be said based on debian build logs. Lemme see..
> >
> > https://buildd.debian.org/status/logs.php?pkg=qemu&arch=all
> >
> > The first log entry there is from 2018-12-12, for qemu 3.1, dtc 1.4.7.
> > It has:
> >
> > dtc -o b/qemu/pc-bios/bamboo.dtb pc-bios/bamboo.dts
> > b/qemu/pc-bios/bamboo.dtb: Warning (unit_address_vs_reg): /memory: node has a
> > reg or ranges property, but no unit name
> > b/qemu/pc-bios/bamboo.dtb: Warning (unit_address_vs_reg): /plb/opb: node has
> > a reg or ranges property, but no unit name
> > b/qemu/pc-bios/bamboo.dtb: Warning (chosen_node_stdout_path):
> > /chosen:linux,stdout-path: Use 'stdout-path' instead
> > b/qemu/pc-bios/bamboo.dtb: Warning (interrupts_property): /plb/opb: Missing
> > interrupt-parent
> > b/qemu/pc-bios/bamboo.dtb: Warning (interrupts_property): /plb/opb/ebc:
> > Missing interrupt-parent
>
>
> OK so bamboo was likely always like that. Sam460ex (aka canyonlands which
> is the devel board it is based on) was added in February 2018 so that was
> OK back then but later dtc versions may have become pickier somewhere
> between 1.4.7 and 1.6.0.

Yeah, at some point dtc started warning about a lot of these
things, I think in the hope that people writing dt files would
fix them before the dt got into wide circulation.

> > next it was moved to one of the subpackages, and moved back to
> > arch-independent package in 6.2 (2022-01-09, dtc 1.6.0), which has:
> >
> > dtc -o b/misc/bamboo.dtb pc-bios/bamboo.dts
> > pc-bios/bamboo.dts:45.9-48.4: Warning (unit_address_vs_reg): /memory: node
> > has a reg or ranges property, but no unit name
> > pc-bios/bamboo.dts:87.13-154.5: Warning (unit_address_vs_reg): /plb/opb: node
> > has a reg or ranges property, but no unit name
> > pc-bios/bamboo.dts:198.3-50: Warning (chosen_node_stdout_path):
> > /chosen:linux,stdout-path: Use 'stdout-path' instead
> > pc-bios/bamboo.dts:87.13-154.5: Warning (interrupts_property): /plb/opb:
> > Missing interrupt-parent
> > pc-bios/bamboo.dts:100.14-108.6: Warning (interrupts_property): /plb/opb/ebc:
> > Missing interrupt-parent
> > dtc -o b/misc/canyonlands.dtb pc-bios/canyonlands.dts
> > pc-bios/canyonlands.dts:47.9-50.4: Warning (unit_address_vs_reg): /memory:
> > node has a reg or ranges property, but no unit name
> > pc-bios/canyonlands.dts:210.13-429.5: Warning (unit_address_vs_reg):
> > /plb/opb: node has a reg or ranges property, but no unit name
> > pc-bios/canyonlands.dts:464.26-504.5: Warning (pci_bridge):
> > /plb/pciex@d00000000: node name is not "pci" or "pcie"
> > pc-bios/canyonlands.dts:506.26-546.5: Warning (pci_bridge):
> > /plb/pciex@d20000000: node name is not "pci" or "pcie"
>
> Linux has this in arch/powerpc/boot/dts/canyonlands.dts and at least had a
> change of the pciex names to pcie that should fix some of these but if the
> u-boot still uses older names then could updating this result in different
> results between using -kernel and without that? I don't know how guests
> use the dtb so can't tell what to do but keeping it consistent with the
> older u-boot this board has seems like a safer option.

At least in theory, guest code looking at a device tree blob
should be searching it by 'compatible' property name, not
by the name of the node itself. So changing node names is
a fairly safe change, though as you say the absolute safest
thing would be to not change at all.

Did we get these dts file from some other "upstream" source?
If so then the best thing is probably either to just update
from that upstream source again, or else say "these aren't
files the QEMU project is writing, so there's no point in
having the compile process warning about them, turn all the
dtc warnings off using the '-q' option".

-- PMM
diff mbox series

Patch

diff --git a/pc-bios/Makefile b/pc-bios/Makefile
deleted file mode 100644
index 315288df84e..00000000000
--- a/pc-bios/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@ 
-#
-# NOTE: only compilable with x86 cross compile tools
-#
-include ../config-host.mak
-
-DEFINES=
-
-TARGETS=
-
-all: $(TARGETS)
-
-%.o: %.S
-	$(CC) $(DEFINES) -c -o $@ $<
-
-%.dtb: %.dts
-	dtc -I dts -O dtb -o $@ $<
-
-clean:
-	rm -f $(TARGETS) *.o *~
diff --git a/pc-bios/meson.build b/pc-bios/meson.build
index a7224ef4699..e67fa433a1b 100644
--- a/pc-bios/meson.build
+++ b/pc-bios/meson.build
@@ -57,10 +57,6 @@  blobs = [
   'efi-e1000e.rom',
   'efi-vmxnet3.rom',
   'qemu-nsis.bmp',
-  'bamboo.dtb',
-  'canyonlands.dtb',
-  'petalogix-s3adsp1800.dtb',
-  'petalogix-ml605.dtb',
   'multiboot.bin',
   'multiboot_dma.bin',
   'linuxboot.bin',
@@ -84,6 +80,27 @@  blobs = [
   'vof-nvram.bin',
 ]
 
+dtc = find_program('dtc', required: false)
+foreach f : [
+  'bamboo.dts',
+  'canyonlands.dts',
+  'petalogix-s3adsp1800.dts',
+  'petalogix-ml605.dts',
+]
+  out = fs.replace_suffix(f, '.dtb')
+  if dtc.found()
+    custom_target(f,
+        build_by_default: have_system,
+        input: files(f),
+        output: out,
+        install: get_option('install_blobs'),
+        install_dir: qemu_datadir,
+        command: [ dtc, '-I', 'dts', '-O', 'dtb', '-o', '@OUTPUT@', '@INPUT0@' ])
+  else
+    blobs += out
+  endif
+endforeach
+
 if get_option('install_blobs')
   install_data(blobs, install_dir: qemu_datadir)
 endif