qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH v3 03/13] hw/ppc/pegasos2: Change device tree generation
Date: Mon, 20 Oct 2025 17:04:26 +0200	[thread overview]
Message-ID: <2eb6a945-cc98-42a8-81d5-830f3fc75fb6@linaro.org> (raw)
In-Reply-To: <32159874-8735-8443-7842-9b667b1d33d9@eik.bme.hu>

On 20/10/25 15:06, BALATON Zoltan wrote:
> On Mon, 20 Oct 2025, Philippe Mathieu-Daudé wrote:
>> On 18/10/25 17:11, BALATON Zoltan wrote:
>>> We generate a flattened device tree programmatically for VOF. Change
>>> this to load the static parts from a device tree blob and only
>>> generate the parts that depend on run time conditions such as CPU
>>> type, memory size and PCI devices. Moving the static parts in a dts
>>> makes the board code simpler and more generic.
>>>
>>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>>> ---
>>>   hw/ppc/pegasos2.c        | 292 +++++++--------------------------------
>>>   pc-bios/dtb/meson.build  |   1 +
>>>   pc-bios/dtb/pegasos2.dtb | Bin 0 -> 1701 bytes
>>>   pc-bios/dtb/pegasos2.dts | 167 ++++++++++++++++++++++
>>>   4 files changed, 220 insertions(+), 240 deletions(-)
>>>   create mode 100644 pc-bios/dtb/pegasos2.dtb
>>>   create mode 100644 pc-bios/dtb/pegasos2.dts
>>
>>
>>>   #define TYPE_PEGASOS2_MACHINE  MACHINE_TYPE_NAME("pegasos2")
>>>   OBJECT_DECLARE_TYPE(Pegasos2MachineState, MachineClass, 
>>> PEGASOS2_MACHINE)
>>> @@ -411,7 +403,11 @@ static void pegasos2_machine_reset(MachineState 
>>> *machine, ResetType type)
>>>           error_report("Memory for initrd is in use");
>>>           exit(1);
>>>       }
>>> +
>>>       fdt = build_fdt(machine, &sz);
>>> +    if (!fdt) {
>>> +        exit(1);
>>
>> To avoid confusing users, either report an error or abort.
> 
> Errors are reported by build_fdt so no need to report again here.

I'll defer to Markus for error style.

> 
>>> +    }
>>>       /* FIXME: VOF assumes entry is same as load address */
>>>       d[0] = cpu_to_be64(pm->kernel_entry);
>>>       d[1] = cpu_to_be64(pm->kernel_size - (pm->kernel_entry - pm- 
>>> >kernel_addr));
>>
>>
>>> +static void *load_dtb(const char *filename, int *fdt_size)
>>> +{
>>> +    void *fdt;
>>> +    char *name = qemu_find_file(QEMU_FILE_TYPE_DTB, filename);
>>
>> g_autofree? Otherwise,
> 
> This function is simple enough to not need autofree but maybe it would 
> be better to ensure it's not forgotten. I may change that if need to 
> respin for some other reason.
> 
> Regards,
> BALATON Zoltan
> 
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>
>>> +
>>> +    if (!name) {
>>> +        error_report("Could not find dtb file '%s'", filename);
>>> +        return NULL;
>>> +    }
>>> +    fdt = load_device_tree(name, fdt_size);
>>> +    if (!fdt) {
>>> +        error_report("Could not load dtb file '%s'", name);
>>> +    }
>>> +    g_free(name);
>>> +    return fdt;
>>> +}
>>
>>



  reply	other threads:[~2025-10-20 15:05 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-18 15:11 [PATCH v3 00/13] Pegasos2 clean up and pegasos1 emulation BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 01/13] ppc/vof: Make nextprop behave more like Open Firmware BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 02/13] hw/ppc/pegasos2: Remove explicit name properties from device tree BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 03/13] hw/ppc/pegasos2: Change device tree generation BALATON Zoltan
2025-10-20  8:47   ` Philippe Mathieu-Daudé
2025-10-20 13:06     ` BALATON Zoltan
2025-10-20 15:04       ` Philippe Mathieu-Daudé [this message]
2025-10-20  8:54   ` Philippe Mathieu-Daudé
2025-10-20 13:02     ` BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 04/13] hw/ppc/pegasos2: Remove fdt pointer from machine state BALATON Zoltan
2025-10-20  8:48   ` Philippe Mathieu-Daudé
2025-10-18 15:11 ` [PATCH v3 05/13] hw/ppc/pegasos2: Rename mv field in " BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 06/13] hw/ppc/pegasos2: Add south bridge pointer in the " BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 07/13] hw/ppc/pegasos2: Move PCI IRQ routing setup to a function BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 08/13] hw/ppc/pegasos2: Move hardware specific parts out of machine reset BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 09/13] hw/ppc/pegasos2: Introduce abstract superclass BALATON Zoltan
2025-10-20  8:49   ` Philippe Mathieu-Daudé
2025-10-18 15:11 ` [PATCH v3 10/13] hw/ppc/pegasos2: Add bus frequency to machine state BALATON Zoltan
2025-10-20  8:53   ` Philippe Mathieu-Daudé
2025-10-20 13:26     ` BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 11/13] hw/boards: Extend DEFINE_MACHINE macro to cover more use cases BALATON Zoltan
2025-10-20 15:05   ` Philippe Mathieu-Daudé
2025-10-20 15:11     ` Philippe Mathieu-Daudé
2025-10-20 15:32       ` Philippe Mathieu-Daudé
2025-10-20 15:40         ` BALATON Zoltan
2025-10-20 15:35       ` BALATON Zoltan
2025-10-21  4:47         ` Harsh Prateek Bora
2025-10-18 15:11 ` [PATCH v3 12/13] hw/ppc/pegasos2: Add Pegasos I emulation BALATON Zoltan
2025-10-18 15:11 ` [PATCH v3 13/13] hw/ppc/pegasos2: Add VOF support for pegasos1 BALATON Zoltan
2025-10-19  6:56 ` [PATCH v3 00/13] Pegasos2 clean up and pegasos1 emulation Yogesh Vyas
2025-10-19 12:07   ` BALATON Zoltan
2025-10-26  5:49     ` Yogesh Vyas
2025-10-26 11:09       ` BALATON Zoltan
2025-10-26 13:18         ` Yogesh Vyas
2025-10-26 16:44           ` BALATON Zoltan
2025-10-26 16:45           ` BALATON Zoltan
2025-10-27 14:24             ` Yogesh Vyas
2025-10-27 20:18               ` BALATON Zoltan

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=2eb6a945-cc98-42a8-81d5-830f3fc75fb6@linaro.org \
    --to=philmd@linaro.org \
    --cc=armbru@redhat.com \
    --cc=balaton@eik.bme.hu \
    --cc=berrange@redhat.com \
    --cc=harshpb@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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 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).