* [PATCH] hw/arm/raspi4b: NOP all DTB nodes when removing unimplemented devices
@ 2026-04-20 16:21 Osama Abdelkader
2026-04-27 9:53 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Osama Abdelkader @ 2026-04-20 16:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Osama Abdelkader, Peter Maydell, open list:ARM TCG CPUs
fdt_node_offset_by_compatible(fdt, -1, compat) only finds the first match.
If the blob has more than one node with the same compatible string, extra
nodes will remain active. using the same loop as imx8mp-evk.c
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
hw/arm/raspi4b.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c
index 3eeb8f447e..06aeb8db01 100644
--- a/hw/arm/raspi4b.c
+++ b/hw/arm/raspi4b.c
@@ -72,12 +72,14 @@ static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt)
for (int i = 0; i < ARRAY_SIZE(nodes_to_remove); i++) {
const char *dev_str = nodes_to_remove[i];
+ int offset;
- int offset = fdt_node_offset_by_compatible(fdt, -1, dev_str);
- if (offset >= 0) {
- if (!fdt_nop_node(fdt, offset)) {
- warn_report("bcm2711 dtc: %s has been disabled!", dev_str);
+ offset = fdt_node_offset_by_compatible(fdt, -1, dev_str);
+ while (offset >= 0) {
+ if (fdt_nop_node(fdt, offset) == 0) {
+ warn_report("bcm2711 dtb: %s has been disabled!", dev_str);
}
+ offset = fdt_node_offset_by_compatible(fdt, offset, dev_str);
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/arm/raspi4b: NOP all DTB nodes when removing unimplemented devices
2026-04-20 16:21 [PATCH] hw/arm/raspi4b: NOP all DTB nodes when removing unimplemented devices Osama Abdelkader
@ 2026-04-27 9:53 ` Peter Maydell
2026-04-27 11:07 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2026-04-27 9:53 UTC (permalink / raw)
To: Osama Abdelkader; +Cc: qemu-devel, open list:ARM TCG CPUs
On Mon, 20 Apr 2026 at 17:21, Osama Abdelkader
<osama.abdelkader@gmail.com> wrote:
>
> fdt_node_offset_by_compatible(fdt, -1, compat) only finds the first match.
> If the blob has more than one node with the same compatible string, extra
> nodes will remain active. using the same loop as imx8mp-evk.c
>
> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> ---
I wondered about whether it would be worth abstracting this
out into a helper function, but it looks like at the moment
only this raspi code and the imx8mp-evk do this. If we get
more places we want this we might do that, but not worth
it for two.
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/arm/raspi4b: NOP all DTB nodes when removing unimplemented devices
2026-04-27 9:53 ` Peter Maydell
@ 2026-04-27 11:07 ` Philippe Mathieu-Daudé
2026-04-28 17:14 ` Osama Abdelkader
0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-04-27 11:07 UTC (permalink / raw)
To: Peter Maydell, Osama Abdelkader; +Cc: qemu-devel, open list:ARM TCG CPUs
On 27/4/26 11:53, Peter Maydell wrote:
> On Mon, 20 Apr 2026 at 17:21, Osama Abdelkader
> <osama.abdelkader@gmail.com> wrote:
>>
>> fdt_node_offset_by_compatible(fdt, -1, compat) only finds the first match.
>> If the blob has more than one node with the same compatible string, extra
>> nodes will remain active. using the same loop as imx8mp-evk.c
>>
>> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
>> ---
>
> I wondered about whether it would be worth abstracting this
> out into a helper function, but it looks like at the moment
> only this raspi code and the imx8mp-evk do this. If we get
> more places we want this we might do that, but not worth
> it for two.
IIRC you were first against the approach of "use a real world
dtb and patch it", recommending to "generate a dtb with what
we emulate"; and we merged that as 'temporary kludge until we
properly emulate the missing device'.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] hw/arm/raspi4b: NOP all DTB nodes when removing unimplemented devices
2026-04-27 11:07 ` Philippe Mathieu-Daudé
@ 2026-04-28 17:14 ` Osama Abdelkader
0 siblings, 0 replies; 4+ messages in thread
From: Osama Abdelkader @ 2026-04-28 17:14 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Peter Maydell, qemu-devel, open list:ARM TCG CPUs
On Mon, Apr 27, 2026 at 01:07:00PM +0200, Philippe Mathieu-Daudé wrote:
> On 27/4/26 11:53, Peter Maydell wrote:
> > On Mon, 20 Apr 2026 at 17:21, Osama Abdelkader
> > <osama.abdelkader@gmail.com> wrote:
> > >
> > > fdt_node_offset_by_compatible(fdt, -1, compat) only finds the first match.
> > > If the blob has more than one node with the same compatible string, extra
> > > nodes will remain active. using the same loop as imx8mp-evk.c
> > >
> > > Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> > > ---
> >
> > I wondered about whether it would be worth abstracting this
> > out into a helper function, but it looks like at the moment
> > only this raspi code and the imx8mp-evk do this. If we get
> > more places we want this we might do that, but not worth
> > it for two.
>
> IIRC you were first against the approach of "use a real world
> dtb and patch it", recommending to "generate a dtb with what
> we emulate"; and we merged that as 'temporary kludge until we
> properly emulate the missing device'.
Thanks Peter and Philippe for the clarification, I would be happy to participate
in that solution too.
Best regards,
Osama
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-28 17:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 16:21 [PATCH] hw/arm/raspi4b: NOP all DTB nodes when removing unimplemented devices Osama Abdelkader
2026-04-27 9:53 ` Peter Maydell
2026-04-27 11:07 ` Philippe Mathieu-Daudé
2026-04-28 17:14 ` Osama Abdelkader
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.