[PATCH v3 0/5] hw/core/loader: Add Error parameter for better error reporting

Vishal Chourasia posted 5 patches 4 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251016173502.1261674-1-vishalc@linux.ibm.com
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Peter Maydell <peter.maydell@linaro.org>, Antony Pavlov <antonynpavlov@gmail.com>, Rob Herring <robh@kernel.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Alistair Francis <alistair@alistair23.me>, "Alex Bennée" <alex.bennee@linaro.org>, Helge Deller <deller@gmx.de>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Corey Minyard <minyard@acm.org>, Song Gao <gaosong@loongson.cn>, Bibo Mao <maobibo@loongson.cn>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Thomas Huth <huth@tuxfamily.org>, Laurent Vivier <laurent@vivier.eu>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Paul Burton <paulburton@kernel.org>, Aleksandar Rikalo <arikalo@gmail.com>, Huacai Chen <chenhuacai@kernel.org>, "Hervé Poussineau" <hpoussin@reactos.org>, Aurelien Jarno <aurelien@aurel32.net>, Stafford Horne <shorne@gmail.com>, BALATON Zoltan <balaton@eik.bme.hu>, Bernhard Beschow <shentey@gmail.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Nicholas Piggin <npiggin@gmail.com>, Aditya Gupta <adityag@linux.ibm.com>, Glenn Miles <milesg@linux.ibm.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Yoshinori Sato <yoshinori.sato@nifty.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Jared Rossi <jrossi@linux.ibm.com>, Zhuoying Cai <zycai@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Magnus Damm <magnus.damm@gmail.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, "Clément Chigot" <chigot@adacore.com>, Frederic Konrad <konrad.frederic@yahoo.fr>, Artyom Tarasenko <atar4qemu@gmail.com>, Max Filippov <jcmvbkbc@gmail.com>, David Gibson <david@gibson.dropbear.id.au>
hw/alpha/dp264.c         |  4 ++--
hw/arm/armv7m.c          |  2 +-
hw/arm/boot.c            |  5 +++--
hw/arm/digic_boards.c    |  2 +-
hw/arm/highbank.c        |  3 ++-
hw/arm/raspi.c           |  2 +-
hw/arm/vexpress.c        |  2 +-
hw/core/generic-loader.c |  5 +++--
hw/core/guest-loader.c   |  4 ++--
hw/core/loader.c         | 34 +++++++++++++++++++++++++---------
hw/hppa/machine.c        |  5 +++--
hw/i386/multiboot.c      |  2 +-
hw/i386/x86-common.c     |  4 ++--
hw/ipmi/ipmi_bmc_sim.c   |  2 +-
hw/loongarch/boot.c      |  5 ++---
hw/m68k/an5206.c         |  2 +-
hw/m68k/mcf5208.c        |  4 ++--
hw/m68k/next-cube.c      |  2 +-
hw/m68k/q800.c           |  7 ++++---
hw/m68k/virt.c           |  4 ++--
hw/microblaze/boot.c     |  5 +++--
hw/mips/boston.c         |  2 +-
hw/mips/fuloong2e.c      |  9 +++++----
hw/mips/jazz.c           |  2 +-
hw/mips/loongson3_virt.c | 10 ++++++----
hw/mips/malta.c          |  9 +++++----
hw/nubus/nubus-device.c  |  2 +-
hw/openrisc/boot.c       |  5 +++--
hw/pci/pci.c             |  2 +-
hw/ppc/amigaone.c        | 11 ++++++-----
hw/ppc/e500.c            | 14 ++++++++------
hw/ppc/mac_newworld.c    | 20 ++++++++++++--------
hw/ppc/mac_oldworld.c    | 20 ++++++++++++--------
hw/ppc/pegasos2.c        | 12 +++++++-----
hw/ppc/pnv.c             | 20 ++++++++++++--------
hw/ppc/ppc440_bamboo.c   |  8 +++++---
hw/ppc/prep.c            | 19 +++++++++++--------
hw/ppc/sam460ex.c        |  8 +++++---
hw/ppc/spapr.c           | 28 +++++++++++++++-------------
hw/ppc/virtex_ml507.c    | 10 ++++++----
hw/riscv/boot.c          |  7 ++++---
hw/rx/rx-gdbsim.c        |  2 +-
hw/s390x/ipl.c           |  8 +++++---
hw/sh4/r2d.c             |  8 +++++---
hw/smbios/smbios.c       |  2 +-
hw/sparc/leon3.c         |  4 ++--
hw/sparc/sun4m.c         |  8 +++++---
hw/sparc64/sun4u.c       |  7 ++++---
hw/xtensa/xtfpga.c       |  3 ++-
include/hw/loader.h      |  8 +++++---
system/device_tree.c     |  2 +-
51 files changed, 220 insertions(+), 155 deletions(-)
[PATCH v3 0/5] hw/core/loader: Add Error parameter for better error reporting
Posted by Vishal Chourasia 4 weeks ago
Currently, when QEMU fails to load images (kernel, BIOS, initrd) via
load_image_targphys(), the error messages are not descriptive enough
for users to understand why the loading failed. This series adds the
ability to pass Error information through the loader functions to
provide more detailed error reporting.

v2:
- Use qemu_open() instead of open() in get_image_size() (danpb)
- Remove redundant error_setg_file_open() call (danpb)
- Use error_prepend()/error_reportf_err() to preserve underlying
  error details (danpb)

Vishal Chourasia (5):
  hw/core/loader: capture Error from load_image_targphys
  hw/core/loader: Use qemu_open() instead of open() in get_image_size()
  hw/core: Pass errp to load_image_targphys_as()
  hw/ppc/spapr: Rename resize_hpt_err to errp
  hw/ppc: Pass errp to load_image_targphys() and report errors

 hw/alpha/dp264.c         |  4 ++--
 hw/arm/armv7m.c          |  2 +-
 hw/arm/boot.c            |  5 +++--
 hw/arm/digic_boards.c    |  2 +-
 hw/arm/highbank.c        |  3 ++-
 hw/arm/raspi.c           |  2 +-
 hw/arm/vexpress.c        |  2 +-
 hw/core/generic-loader.c |  5 +++--
 hw/core/guest-loader.c   |  4 ++--
 hw/core/loader.c         | 34 +++++++++++++++++++++++++---------
 hw/hppa/machine.c        |  5 +++--
 hw/i386/multiboot.c      |  2 +-
 hw/i386/x86-common.c     |  4 ++--
 hw/ipmi/ipmi_bmc_sim.c   |  2 +-
 hw/loongarch/boot.c      |  5 ++---
 hw/m68k/an5206.c         |  2 +-
 hw/m68k/mcf5208.c        |  4 ++--
 hw/m68k/next-cube.c      |  2 +-
 hw/m68k/q800.c           |  7 ++++---
 hw/m68k/virt.c           |  4 ++--
 hw/microblaze/boot.c     |  5 +++--
 hw/mips/boston.c         |  2 +-
 hw/mips/fuloong2e.c      |  9 +++++----
 hw/mips/jazz.c           |  2 +-
 hw/mips/loongson3_virt.c | 10 ++++++----
 hw/mips/malta.c          |  9 +++++----
 hw/nubus/nubus-device.c  |  2 +-
 hw/openrisc/boot.c       |  5 +++--
 hw/pci/pci.c             |  2 +-
 hw/ppc/amigaone.c        | 11 ++++++-----
 hw/ppc/e500.c            | 14 ++++++++------
 hw/ppc/mac_newworld.c    | 20 ++++++++++++--------
 hw/ppc/mac_oldworld.c    | 20 ++++++++++++--------
 hw/ppc/pegasos2.c        | 12 +++++++-----
 hw/ppc/pnv.c             | 20 ++++++++++++--------
 hw/ppc/ppc440_bamboo.c   |  8 +++++---
 hw/ppc/prep.c            | 19 +++++++++++--------
 hw/ppc/sam460ex.c        |  8 +++++---
 hw/ppc/spapr.c           | 28 +++++++++++++++-------------
 hw/ppc/virtex_ml507.c    | 10 ++++++----
 hw/riscv/boot.c          |  7 ++++---
 hw/rx/rx-gdbsim.c        |  2 +-
 hw/s390x/ipl.c           |  8 +++++---
 hw/sh4/r2d.c             |  8 +++++---
 hw/smbios/smbios.c       |  2 +-
 hw/sparc/leon3.c         |  4 ++--
 hw/sparc/sun4m.c         |  8 +++++---
 hw/sparc64/sun4u.c       |  7 ++++---
 hw/xtensa/xtfpga.c       |  3 ++-
 include/hw/loader.h      |  8 +++++---
 system/device_tree.c     |  2 +-
 51 files changed, 220 insertions(+), 155 deletions(-)

-- 
2.51.0