qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vishal Chourasia <vishalc@linux.ibm.com>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: adityag@linux.ibm.com, harshpb@linux.ibm.com,
	milesg@linux.ibm.com, npiggin@gmail.com,
	peter.maydell@linaro.org, alistair23@gmail.com,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org, berrange@redhat.com,
	hpoussin@reactos.org
Subject: Re: [Patch v5 6/6] hw/ppc: Pass errp to load_image_targphys() and report errors
Date: Wed, 22 Oct 2025 15:27:30 +0530	[thread overview]
Message-ID: <5696ab54-e3d7-447e-9b06-52df38bf3b73@linux.ibm.com> (raw)
In-Reply-To: <86222acd-6ccd-b833-84da-8851f5cb29f2@eik.bme.hu>


On 21/10/25 18:09, BALATON Zoltan wrote:
> On Tue, 21 Oct 2025, Vishal Chourasia wrote:
>> Pass errp to load_image_targphys() calls in ppc machine initialization
>> to capture detailed error information when loading firmware, kernel,
>> and initrd images.
>>
>> Use error_reportf_err() instead of error_report() to print the
>> underlying error details along with context about which image failed
>> to load.
>>
>> Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
>> ---
>> hw/ppc/amigaone.c      | 15 ++++++++-------
>> hw/ppc/e500.c          | 17 +++++++++--------
>> hw/ppc/mac_newworld.c  | 25 +++++++++++++++----------
>> hw/ppc/mac_oldworld.c  | 25 +++++++++++++++----------
>> hw/ppc/pegasos2.c      | 17 +++++++++++------
>> hw/ppc/pnv.c           | 31 ++++++++++++++-----------------
>> hw/ppc/ppc440_bamboo.c |  9 +++++----
>> hw/ppc/prep.c          | 25 +++++++++++++++----------
>> hw/ppc/sam460ex.c      |  9 +++++----
>> hw/ppc/spapr.c         | 15 ++++++++-------
>> hw/ppc/virtex_ml507.c  | 17 +++++++++++------
>> 11 files changed, 116 insertions(+), 89 deletions(-)
>>
>> diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c
>> index 5c5acc9872..bd14bed243 100644
>> --- a/hw/ppc/amigaone.c
>> +++ b/hw/ppc/amigaone.c
>> @@ -276,6 +276,7 @@ static void amigaone_init(MachineState *machine)
>>     DriveInfo *di;
>>     hwaddr loadaddr;
>>     struct boot_info *bi = NULL;
>> +    Error *errp = NULL;
>>
>>     /* init CPU */
>>     cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
>> @@ -324,9 +325,9 @@ static void amigaone_init(MachineState *machine)
>>             error_report("Could not find firmware '%s'", 
>> machine->firmware);
>>             exit(1);
>>         }
>> -        sz = load_image_targphys(filename, PROM_ADDR, PROM_SIZE, NULL);
>> -        if (sz <= 0 || sz > PROM_SIZE) {
>> -            error_report("Could not load firmware '%s'", filename);
>> +        sz = load_image_targphys(filename, PROM_ADDR, PROM_SIZE, 
>> &errp);
>> +        if (errp) {
>> +            error_reportf_err(errp, "Could not load firmware '%s': 
>> ", filename);
>>             exit(1);
>
> If all that's done with an errp is checking for error, printing it and 
> then exit then isn't that what passing &error_fatal is for? So these 
> should all just do that instead of open coding it, don't they? This 
> would lose the general local error messages and those would be 
> replaced by the more specific ones from the load functions that should 
> be enough. (I'm always unsure how to correctly use error and errp so 
> some more expert opinion could be useful but otherwise this series 
> does not seem to simplify things much.)

I am planning to add filename information inside the 
load_image_targphys() so that we won't need additional error reporting 
regarding the file type in the caller.
We can use error_fatal where ever we are just exiting after printing the 
error. However, in some cases, it may proceed for different reasons in 
which case errp would be more appropriate.

> If you don't want to convert all these other machines I'm also OK with 
> leaving these passing NULL to load_image_targphys for now and keep 
> current error handling which can then be converted later so 
> alternatively you can drop this patch if you can't finish it before 
> the freeze. 

I will try to improve at least for the PPC boards and see if that would 
work better.

Thanks,
Vishal

>
> Regards,
> BALATON Zoltan


  reply	other threads:[~2025-10-22  9:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 10:54 [Patch v5 0/6] hw/core/loader: capture Error from load_image_targphys Vishal Chourasia
2025-10-21 10:54 ` [Patch v5 1/6] hw/core/loader: Use qemu_open() instead of open() in get_image_size() Vishal Chourasia
2025-10-21 10:54 ` [Patch v5 2/6] hw/core/loader: capture Error from load_image_targphys Vishal Chourasia
2025-10-21 10:54 ` [Patch v5 3/6] hw/core/loader: add check for zero size in load_image_targphys_as Vishal Chourasia
2025-10-21 10:54 ` [Patch v5 4/6] hw/core: Pass errp to load_image_targphys_as() Vishal Chourasia
2025-10-21 10:54 ` [Patch v5 5/6] hw/ppc/spapr: Rename resize_hpt_err to errp Vishal Chourasia
2025-10-21 12:59   ` Philippe Mathieu-Daudé
2025-10-21 10:54 ` [Patch v5 6/6] hw/ppc: Pass errp to load_image_targphys() and report errors Vishal Chourasia
2025-10-21 12:39   ` BALATON Zoltan
2025-10-22  9:57     ` Vishal Chourasia [this message]
2025-10-22 12:06       ` 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=5696ab54-e3d7-447e-9b06-52df38bf3b73@linux.ibm.com \
    --to=vishalc@linux.ibm.com \
    --cc=adityag@linux.ibm.com \
    --cc=alistair23@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=berrange@redhat.com \
    --cc=harshpb@linux.ibm.com \
    --cc=hpoussin@reactos.org \
    --cc=milesg@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=peter.maydell@linaro.org \
    --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).