* [PULL 00/23] Misc HW patches for 2025-10-28
@ 2025-10-28 7:48 Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 01/23] target/hppa: Set FPCR exception flag bits for non-trapped exceptions Philippe Mathieu-Daudé
` (23 more replies)
0 siblings, 24 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé
The following changes since commit 36076d24f04ea9dc3357c0fbe7bb14917375819c:
Merge tag 'next-pr-pull-request' of https://gitlab.com/berrange/qemu into staging (2025-10-25 10:42:55 +0200)
are available in the Git repository at:
https://github.com/philmd/qemu.git tags/hw-misc-20251028
for you to fetch changes up to 7dbe2d7df094aa8af2d8fcdf08fccce70b1ca5bc:
hw/riscv: Widen OpenSBI dynamic info struct (2025-10-28 08:19:18 +0100)
----------------------------------------------------------------
Misc HW patches
Various fixes and cleanups:
- Set FPCR exception flag bits for HPPA non-trapped exceptions
- Convert VirtIONet::vlans from pointer to array
and remove VMSTATE_BUFFER_POINTER_UNSAFE()
- Remove redundant QOM typedef when OBJECT_DECLARE_SIMPLE_TYPE() is used
- Have various QDev / SysBus helpers take a const device argument
- Improve errors when loaders parse images
- Remove IntelIOMMUState::dma_translation leftover
- Remove most target_[u]long uses in hw/riscv/
- Fix DS1225Y MemoryRegion owner
- Simplification refactors on Raven PCI Host Bridge
----------------------------------------------------------------
Akihiko Odaki (1):
nw/nvram/ds1225y: Fix nvram MemoryRegion owner
Anton Johansson (2):
hw/riscv: Use generic hwaddr for firmware addresses
hw/riscv: Widen OpenSBI dynamic info struct
BALATON Zoltan (5):
hw/pci-host/raven: Simplify creating PCI facing part
hw/pci-host/raven: Simplify PCI facing part
hw/pci-host/raven: Simplify host bridge type declaration
hw/pci-host/raven: Use DEFINE_TYPES macro
hw/pci-host/raven: Simplify PCI bus creation
Clément Mathieu--Drif (1):
hw/i386/intel_iommu: Remove an unused state field
Michael Tokarev (2):
hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer
migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro
Nguyen Dinh Phi (1):
qom: remove redundant typedef when use OBJECT_DECLARE_SIMPLE_TYPE
Peter Maydell (1):
target/hppa: Set FPCR exception flag bits for non-trapped exceptions
Philippe Mathieu-Daudé (4):
hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg
hw/sysbus: Have various helpers take a const SysBusDevice argument
hw/uefi: Include missing 'system/memory.h' header
hw/int/loongarch: Include missing 'system/memory.h' header
Vishal Chourasia (6):
hw/core/loader: Use qemu_open() instead of open() in get_image_size()
hw/core/loader: capture Error from load_image_targphys
hw/core/loader: improve error handling in image loading functions
hw/core/loader: add check for zero size in load_image_targphys_as
hw/core/loader: Pass errp to load_image_targphys_as()
hw/ppc: Pass error_fatal to load_image_targphys()
hw/net/fsl_etsec/etsec.h | 1 -
include/hw/char/serial.h | 1 -
include/hw/i386/intel_iommu.h | 1 -
include/hw/input/lasips2.h | 6 +-
include/hw/intc/loongarch_dintc.h | 2 +-
include/hw/intc/loongarch_extioi_common.h | 1 +
include/hw/intc/loongarch_pch_msi.h | 1 +
include/hw/intc/loongarch_pic_common.h | 1 +
include/hw/intc/loongson_ipi_common.h | 1 +
include/hw/loader.h | 8 +-
include/hw/misc/auxbus.h | 7 +-
include/hw/misc/bcm2835_mphi.h | 7 +-
include/hw/misc/npcm7xx_pwm.h | 7 +-
include/hw/pci-host/pnv_phb3.h | 6 +-
include/hw/pci-host/pnv_phb4.h | 8 +-
include/hw/ppc/mac_dbdma.h | 7 +-
include/hw/qdev-core.h | 3 +-
include/hw/riscv/boot.h | 18 ++--
include/hw/riscv/boot_opensbi.h | 14 +--
include/hw/riscv/iommu.h | 3 -
include/hw/scsi/scsi.h | 7 +-
include/hw/sysbus.h | 10 +--
include/hw/uefi/var-service.h | 1 +
include/hw/vfio/vfio-container-legacy.h | 5 +-
include/hw/virtio/virtio-net.h | 2 +-
include/hw/virtio/virtio-serial.h | 5 +-
include/migration/vmstate.h | 9 --
include/net/can_emu.h | 7 +-
backends/cryptodev-lkcf.c | 1 -
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/char/ipoctal232.c | 9 +-
hw/char/xen_console.c | 1 -
hw/core/generic-loader.c | 5 +-
hw/core/gpio.c | 3 +-
hw/core/guest-loader.c | 4 +-
hw/core/loader.c | 42 ++++++---
hw/core/sysbus.c | 10 +--
hw/dma/pl330.c | 6 +-
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/net/virtio-net.c | 9 +-
hw/net/xen_nic.c | 2 -
hw/nubus/nubus-device.c | 2 +-
hw/nvram/ds1225y.c | 2 +-
hw/openrisc/boot.c | 5 +-
hw/pci-host/bonito.c | 7 +-
hw/pci-host/raven.c | 105 +++++++---------------
hw/pci/pci.c | 2 +-
hw/ppc/amigaone.c | 13 +--
hw/ppc/e500.c | 20 +----
hw/ppc/mac_newworld.c | 19 ++--
hw/ppc/mac_oldworld.c | 19 ++--
hw/ppc/pef.c | 1 -
hw/ppc/pegasos2.c | 10 +--
hw/ppc/pnv.c | 27 ++----
hw/ppc/ppc440_bamboo.c | 9 +-
hw/ppc/prep.c | 19 ++--
hw/ppc/sam460ex.c | 8 +-
hw/ppc/spapr.c | 17 +---
hw/ppc/virtex_ml507.c | 11 +--
hw/riscv/boot.c | 49 +++++-----
hw/riscv/microchip_pfsoc.c | 2 +-
hw/riscv/sifive_u.c | 2 +-
hw/riscv/spike.c | 4 +-
hw/riscv/virt.c | 2 +-
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/usb/dev-mtp.c | 7 +-
hw/usb/dev-uas.c | 7 +-
hw/xtensa/xtfpga.c | 3 +-
system/device_tree.c | 2 +-
target/hppa/fpu_helper.c | 7 +-
97 files changed, 321 insertions(+), 434 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [PULL 01/23] target/hppa: Set FPCR exception flag bits for non-trapped exceptions
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 02/23] qom: remove redundant typedef when use OBJECT_DECLARE_SIMPLE_TYPE Philippe Mathieu-Daudé
` (22 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-stable, Helge Deller,
Philippe Mathieu-Daudé, Richard Henderson
From: Peter Maydell <peter.maydell@linaro.org>
In commit ebd394948de4e8 ("target/hppa: Fix FPE exceptions") when
we added the code for setting up the registers correctly on trapping
FP exceptions, we accidentally broke the handling of the flag bits
for non-trapping exceptions.
In update_fr0_op() we incorrectly zero out the flag bits and the C
bit, so any fp operation would clear previously set flag bits. We
also stopped setting the flag bits when the fp operation raises
an exception and the trap is not enabled.
Adjust the code so that we set the Flag bits for every exception that
happened and where the trap is not enabled. (This is the correct
behaviour for the case where an instruction triggers two exceptions,
one of which traps and one of which does not; that can only happen
for inexact + underflow or inexact + overflow.)
Cc: qemu-stable@nongnu.org
Fixes: ebd394948de4e8 ("target/hppa: Fix FPE exceptions")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3158
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Helge Deller <deller@gmx.de>
Tested-by: Helge Deller <deller@gmx.de>
Message-ID: <20251017085350.895681-1-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/hppa/fpu_helper.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/target/hppa/fpu_helper.c b/target/hppa/fpu_helper.c
index 45353202fae..2d272730f60 100644
--- a/target/hppa/fpu_helper.c
+++ b/target/hppa/fpu_helper.c
@@ -94,7 +94,8 @@ static void update_fr0_op(CPUHPPAState *env, uintptr_t ra)
{
uint32_t soft_exp = get_float_exception_flags(&env->fp_status);
uint32_t hard_exp = 0;
- uint32_t shadow = env->fr0_shadow & 0x3ffffff;
+ uint32_t shadow = env->fr0_shadow;
+ uint32_t to_flag = 0;
uint32_t fr1 = 0;
if (likely(soft_exp == 0)) {
@@ -122,6 +123,10 @@ static void update_fr0_op(CPUHPPAState *env, uintptr_t ra)
fr1 |= hard_exp << (R_FPSR_FLAGS_SHIFT - R_FPSR_ENABLES_SHIFT);
}
}
+ /* Set the Flag bits for every exception that was not enabled */
+ to_flag = hard_exp & ~shadow;
+ shadow |= to_flag << (R_FPSR_FLAGS_SHIFT - R_FPSR_ENABLES_SHIFT);
+
env->fr0_shadow = shadow;
env->fr[0] = (uint64_t)shadow << 32 | fr1;
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 02/23] qom: remove redundant typedef when use OBJECT_DECLARE_SIMPLE_TYPE
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 01/23] target/hppa: Set FPCR exception flag bits for non-trapped exceptions Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 03/23] hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer Philippe Mathieu-Daudé
` (21 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Nguyen Dinh Phi, Philippe Mathieu-Daudé, Gonglei (Arei),
Zhenwei Pi, Alberto Garcia, Marc-André Lureau, Paolo Bonzini,
Stefano Stabellini, Anthony PERARD, Paul Durrant,
Edgar E. Iglesias, Peter Maydell, Bernhard Beschow, Jason Wang,
Huacai Chen, Jiaxun Yang, Nicholas Piggin, Harsh Prateek Bora,
Richard Henderson, Helge Deller, Tyrone Ting, Hao Wu,
Aditya Gupta, Glenn Miles, Mark Cave-Ayland, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
Fam Zheng, Alex Williamson, Cédric Le Goater, Laurent Vivier,
Amit Shah, Michael S. Tsirkin, Pavel Pisa, Francisco Iglesias,
Vikram Garhwal, xen-devel, qemu-arm, qemu-ppc, qemu-riscv
From: Nguyen Dinh Phi <phind.uet@gmail.com>
When OBJECT_DECLARE_SIMPLE_TYPE is used, it automatically provides
the typedef, so we don’t have to define it ourselves.
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251023063429.1400398-1-phind.uet@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/net/fsl_etsec/etsec.h | 1 -
include/hw/char/serial.h | 1 -
include/hw/input/lasips2.h | 6 ++----
include/hw/misc/auxbus.h | 7 +++----
include/hw/misc/bcm2835_mphi.h | 7 ++-----
include/hw/misc/npcm7xx_pwm.h | 7 ++-----
include/hw/pci-host/pnv_phb3.h | 6 ++----
include/hw/pci-host/pnv_phb4.h | 8 ++++----
include/hw/ppc/mac_dbdma.h | 7 +++----
include/hw/riscv/iommu.h | 3 ---
include/hw/scsi/scsi.h | 7 +++----
include/hw/vfio/vfio-container-legacy.h | 5 ++---
include/hw/virtio/virtio-serial.h | 5 ++---
include/net/can_emu.h | 7 +++----
backends/cryptodev-lkcf.c | 1 -
hw/char/ipoctal232.c | 9 ++++-----
hw/char/xen_console.c | 1 -
hw/dma/pl330.c | 6 ++----
hw/net/xen_nic.c | 2 --
hw/pci-host/bonito.c | 7 +++----
hw/ppc/pef.c | 1 -
hw/usb/dev-mtp.c | 7 +++----
hw/usb/dev-uas.c | 7 +++----
23 files changed, 43 insertions(+), 75 deletions(-)
diff --git a/hw/net/fsl_etsec/etsec.h b/hw/net/fsl_etsec/etsec.h
index 3860864a3f5..bd2de3f99c7 100644
--- a/hw/net/fsl_etsec/etsec.h
+++ b/hw/net/fsl_etsec/etsec.h
@@ -130,7 +130,6 @@ struct eTSEC {
/* Whether we should flush the rx queue when buffer becomes available. */
bool need_flush;
};
-typedef struct eTSEC eTSEC;
#define TYPE_ETSEC_COMMON "eTSEC"
OBJECT_DECLARE_SIMPLE_TYPE(eTSEC, ETSEC_COMMON)
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 4bf90a46f3c..2cfeaed7fb9 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -77,7 +77,6 @@ struct SerialState {
QEMUTimer *modem_status_poll;
MemoryRegion io;
};
-typedef struct SerialState SerialState;
extern const VMStateDescription vmstate_serial;
extern const MemoryRegionOps serial_io_ops;
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 01911c50f9b..fd74883073b 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -32,7 +32,8 @@ struct LASIPS2PortDeviceClass {
DeviceRealize parent_realize;
};
-typedef struct LASIPS2State LASIPS2State;
+#define TYPE_LASIPS2 "lasips2"
+OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2)
struct LASIPS2Port {
DeviceState parent_obj;
@@ -74,7 +75,4 @@ struct LASIPS2State {
qemu_irq irq;
};
-#define TYPE_LASIPS2 "lasips2"
-OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2)
-
#endif /* HW_INPUT_LASIPS2_H */
diff --git a/include/hw/misc/auxbus.h b/include/hw/misc/auxbus.h
index ccd18ce2095..0051e039471 100644
--- a/include/hw/misc/auxbus.h
+++ b/include/hw/misc/auxbus.h
@@ -29,13 +29,15 @@
#include "hw/qdev-core.h"
#include "qom/object.h"
-typedef struct AUXSlave AUXSlave;
typedef enum AUXCommand AUXCommand;
typedef enum AUXReply AUXReply;
#define TYPE_AUXTOI2C "aux-to-i2c-bridge"
OBJECT_DECLARE_SIMPLE_TYPE(AUXTOI2CState, AUXTOI2C)
+#define TYPE_AUX_SLAVE "aux-slave"
+OBJECT_DECLARE_SIMPLE_TYPE(AUXSlave, AUX_SLAVE)
+
enum AUXCommand {
WRITE_I2C = 0,
READ_I2C = 1,
@@ -73,9 +75,6 @@ struct AUXBus {
AddressSpace aux_addr_space;
};
-#define TYPE_AUX_SLAVE "aux-slave"
-OBJECT_DECLARE_SIMPLE_TYPE(AUXSlave, AUX_SLAVE)
-
struct AUXSlave {
/* < private > */
DeviceState parent_obj;
diff --git a/include/hw/misc/bcm2835_mphi.h b/include/hw/misc/bcm2835_mphi.h
index 751363f496c..3f1997e5f24 100644
--- a/include/hw/misc/bcm2835_mphi.h
+++ b/include/hw/misc/bcm2835_mphi.h
@@ -23,7 +23,8 @@
#define MPHI_MMIO_SIZE 0x1000
-typedef struct BCM2835MphiState BCM2835MphiState;
+#define TYPE_BCM2835_MPHI "bcm2835-mphi"
+OBJECT_DECLARE_SIMPLE_TYPE(BCM2835MphiState, BCM2835_MPHI)
struct BCM2835MphiState {
SysBusDevice parent_obj;
@@ -37,8 +38,4 @@ struct BCM2835MphiState {
uint32_t swirq;
};
-#define TYPE_BCM2835_MPHI "bcm2835-mphi"
-
-OBJECT_DECLARE_SIMPLE_TYPE(BCM2835MphiState, BCM2835_MPHI)
-
#endif
diff --git a/include/hw/misc/npcm7xx_pwm.h b/include/hw/misc/npcm7xx_pwm.h
index bf953440acc..df927266209 100644
--- a/include/hw/misc/npcm7xx_pwm.h
+++ b/include/hw/misc/npcm7xx_pwm.h
@@ -35,8 +35,8 @@
* value of 100,000 the duty cycle for that PWM is 10%.
*/
#define NPCM7XX_PWM_MAX_DUTY 1000000
-
-typedef struct NPCM7xxPWMState NPCM7xxPWMState;
+#define TYPE_NPCM7XX_PWM "npcm7xx-pwm"
+OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxPWMState, NPCM7XX_PWM)
/**
* struct NPCM7xxPWM - The state of a single PWM channel.
@@ -100,7 +100,4 @@ struct NPCM7xxPWMState {
uint32_t piir;
};
-#define TYPE_NPCM7XX_PWM "npcm7xx-pwm"
-OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxPWMState, NPCM7XX_PWM)
-
#endif /* NPCM7XX_PWM_H */
diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h
index 24ca3dddaa9..682f62a638f 100644
--- a/include/hw/pci-host/pnv_phb3.h
+++ b/include/hw/pci-host/pnv_phb3.h
@@ -14,7 +14,8 @@
#include "qom/object.h"
#include "hw/pci-host/pnv_phb.h"
-typedef struct PnvPHB3 PnvPHB3;
+#define TYPE_PNV_PHB3 "pnv-phb3"
+OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB3, PNV_PHB3)
/*
* PHB3 XICS Source for MSIs
@@ -115,9 +116,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB3RootBus, PNV_PHB3_ROOT_BUS)
/*
* PHB3 PCIe Host Bridge for PowerNV machines (POWER8)
*/
-#define TYPE_PNV_PHB3 "pnv-phb3"
-OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB3, PNV_PHB3)
-
#define PNV_PHB3_NUM_M64 16
#define PNV_PHB3_NUM_REGS (0x1000 >> 3)
#define PNV_PHB3_NUM_LSI 8
diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index 8a80c0c667a..de996e718b0 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -17,8 +17,11 @@
#include "hw/ppc/xive.h"
#include "qom/object.h"
+
+#define TYPE_PNV_PHB4 "pnv-phb4"
+OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB4, PNV_PHB4)
+
typedef struct PnvPhb4PecStack PnvPhb4PecStack;
-typedef struct PnvPHB4 PnvPHB4;
/*
* We have one such address space wrapper per possible device under
@@ -59,9 +62,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB4RootBus, PNV_PHB4_ROOT_BUS)
/*
* PHB4 PCIe Host Bridge for PowerNV machines (POWER9)
*/
-#define TYPE_PNV_PHB4 "pnv-phb4"
-OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB4, PNV_PHB4)
-
#define PNV_PHB4_MAX_LSIs 8
#define PNV_PHB4_MAX_INTs 4096
#define PNV_PHB4_MAX_MIST (PNV_PHB4_MAX_INTs >> 2)
diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h
index 896ee4a2b17..76764882453 100644
--- a/include/hw/ppc/mac_dbdma.h
+++ b/include/hw/ppc/mac_dbdma.h
@@ -164,7 +164,9 @@ struct DBDMAState {
DBDMA_channel channels[DBDMA_CHANNELS];
QEMUBH *bh;
};
-typedef struct DBDMAState DBDMAState;
+
+#define TYPE_MAC_DBDMA "mac-dbdma"
+OBJECT_DECLARE_SIMPLE_TYPE(DBDMAState, MAC_DBDMA)
/* Externally callable functions */
@@ -173,7 +175,4 @@ void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq,
void *opaque);
void DBDMA_kick(DBDMAState *dbdma);
-#define TYPE_MAC_DBDMA "mac-dbdma"
-OBJECT_DECLARE_SIMPLE_TYPE(DBDMAState, MAC_DBDMA)
-
#endif
diff --git a/include/hw/riscv/iommu.h b/include/hw/riscv/iommu.h
index 8a8acfc3f07..25f1a8b1596 100644
--- a/include/hw/riscv/iommu.h
+++ b/include/hw/riscv/iommu.h
@@ -24,18 +24,15 @@
#define TYPE_RISCV_IOMMU "riscv-iommu"
OBJECT_DECLARE_SIMPLE_TYPE(RISCVIOMMUState, RISCV_IOMMU)
-typedef struct RISCVIOMMUState RISCVIOMMUState;
#define TYPE_RISCV_IOMMU_MEMORY_REGION "riscv-iommu-mr"
typedef struct RISCVIOMMUSpace RISCVIOMMUSpace;
#define TYPE_RISCV_IOMMU_PCI "riscv-iommu-pci"
OBJECT_DECLARE_SIMPLE_TYPE(RISCVIOMMUStatePci, RISCV_IOMMU_PCI)
-typedef struct RISCVIOMMUStatePci RISCVIOMMUStatePci;
#define TYPE_RISCV_IOMMU_SYS "riscv-iommu-device"
OBJECT_DECLARE_SIMPLE_TYPE(RISCVIOMMUStateSys, RISCV_IOMMU_SYS)
-typedef struct RISCVIOMMUStateSys RISCVIOMMUStateSys;
#define FDT_IRQ_TYPE_EDGE_LOW 1
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
index 90ee192b4d4..044bd048b49 100644
--- a/include/hw/scsi/scsi.h
+++ b/include/hw/scsi/scsi.h
@@ -10,7 +10,9 @@
#define MAX_SCSI_DEVS 255
-typedef struct SCSIBus SCSIBus;
+#define TYPE_SCSI_BUS "SCSI"
+OBJECT_DECLARE_SIMPLE_TYPE(SCSIBus, SCSI_BUS)
+
typedef struct SCSIBusInfo SCSIBusInfo;
typedef struct SCSIDevice SCSIDevice;
typedef struct SCSIRequest SCSIRequest;
@@ -151,9 +153,6 @@ struct SCSIBusInfo {
void (*drained_end)(SCSIBus *bus);
};
-#define TYPE_SCSI_BUS "SCSI"
-OBJECT_DECLARE_SIMPLE_TYPE(SCSIBus, SCSI_BUS)
-
struct SCSIBus {
BusState qbus;
int busnr;
diff --git a/include/hw/vfio/vfio-container-legacy.h b/include/hw/vfio/vfio-container-legacy.h
index ffd594e80d6..fe822125268 100644
--- a/include/hw/vfio/vfio-container-legacy.h
+++ b/include/hw/vfio/vfio-container-legacy.h
@@ -12,7 +12,8 @@
#include "hw/vfio/vfio-container.h"
#include "hw/vfio/vfio-cpr.h"
-typedef struct VFIOLegacyContainer VFIOLegacyContainer;
+OBJECT_DECLARE_SIMPLE_TYPE(VFIOLegacyContainer, VFIO_IOMMU_LEGACY);
+
typedef struct VFIODevice VFIODevice;
typedef struct VFIOGroup {
@@ -35,6 +36,4 @@ struct VFIOLegacyContainer {
VFIOContainerCPR cpr;
};
-OBJECT_DECLARE_SIMPLE_TYPE(VFIOLegacyContainer, VFIO_IOMMU_LEGACY);
-
#endif /* HW_VFIO_CONTAINER_LEGACY_H */
diff --git a/include/hw/virtio/virtio-serial.h b/include/hw/virtio/virtio-serial.h
index d87c62eab7a..60641860bf8 100644
--- a/include/hw/virtio/virtio-serial.h
+++ b/include/hw/virtio/virtio-serial.h
@@ -29,7 +29,8 @@ struct virtio_serial_conf {
OBJECT_DECLARE_TYPE(VirtIOSerialPort, VirtIOSerialPortClass,
VIRTIO_SERIAL_PORT)
-typedef struct VirtIOSerial VirtIOSerial;
+#define TYPE_VIRTIO_SERIAL "virtio-serial-device"
+OBJECT_DECLARE_SIMPLE_TYPE(VirtIOSerial, VIRTIO_SERIAL)
#define TYPE_VIRTIO_SERIAL_BUS "virtio-serial-bus"
OBJECT_DECLARE_SIMPLE_TYPE(VirtIOSerialBus, VIRTIO_SERIAL_BUS)
@@ -221,7 +222,5 @@ size_t virtio_serial_guest_ready(VirtIOSerialPort *port);
*/
void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle);
-#define TYPE_VIRTIO_SERIAL "virtio-serial-device"
-OBJECT_DECLARE_SIMPLE_TYPE(VirtIOSerial, VIRTIO_SERIAL)
#endif
diff --git a/include/net/can_emu.h b/include/net/can_emu.h
index 6f9b206bb5f..777281bad96 100644
--- a/include/net/can_emu.h
+++ b/include/net/can_emu.h
@@ -85,7 +85,9 @@ typedef struct qemu_can_filter {
#define QEMU_CAN_INV_FILTER 0x20000000U
typedef struct CanBusClientState CanBusClientState;
-typedef struct CanBusState CanBusState;
+
+#define TYPE_CAN_BUS "can-bus"
+OBJECT_DECLARE_SIMPLE_TYPE(CanBusState, CAN_BUS)
typedef struct CanBusClientInfo {
bool (*can_receive)(CanBusClientState *);
@@ -105,9 +107,6 @@ struct CanBusClientState {
bool fd_mode;
};
-#define TYPE_CAN_BUS "can-bus"
-OBJECT_DECLARE_SIMPLE_TYPE(CanBusState, CAN_BUS)
-
int can_bus_filter_match(struct qemu_can_filter *filter, qemu_canid_t can_id);
int can_bus_insert_client(CanBusState *bus, CanBusClientState *client);
diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c
index bb7a81d5d06..97a8a8812ce 100644
--- a/backends/cryptodev-lkcf.c
+++ b/backends/cryptodev-lkcf.c
@@ -68,7 +68,6 @@ typedef struct CryptoDevBackendLKCFSession {
QCryptoAkCipherOptions akcipher_opts;
} CryptoDevBackendLKCFSession;
-typedef struct CryptoDevBackendLKCF CryptoDevBackendLKCF;
typedef struct CryptoDevLKCFTask CryptoDevLKCFTask;
struct CryptoDevLKCFTask {
CryptoDevBackendLKCFSession *sess;
diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index 752c6c818ab..0a7ffcd0b7e 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -93,7 +93,10 @@
#define ISR_RXRDY(CH) (((CH) & 1) ? BIT(5) : BIT(1))
#define ISR_BREAK(CH) (((CH) & 1) ? BIT(6) : BIT(2))
-typedef struct IPOctalState IPOctalState;
+#define TYPE_IPOCTAL "ipoctal232"
+
+OBJECT_DECLARE_SIMPLE_TYPE(IPOctalState, IPOCTAL)
+
typedef struct SCC2698Channel SCC2698Channel;
typedef struct SCC2698Block SCC2698Block;
@@ -122,10 +125,6 @@ struct IPOctalState {
uint8_t irq_vector;
};
-#define TYPE_IPOCTAL "ipoctal232"
-
-OBJECT_DECLARE_SIMPLE_TYPE(IPOctalState, IPOCTAL)
-
static const VMStateDescription vmstate_scc2698_channel = {
.name = "scc2698_channel",
.version_id = 1,
diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c
index 9c34a554bfa..0e73c2aee40 100644
--- a/hw/char/xen_console.c
+++ b/hw/char/xen_console.c
@@ -56,7 +56,6 @@ struct XenConsole {
CharBackend chr;
int backlog;
};
-typedef struct XenConsole XenConsole;
#define TYPE_XEN_CONSOLE_DEVICE "xen-console"
OBJECT_DECLARE_SIMPLE_TYPE(XenConsole, XEN_CONSOLE_DEVICE)
diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c
index a570bb08ec4..f9c91f924bb 100644
--- a/hw/dma/pl330.c
+++ b/hw/dma/pl330.c
@@ -111,7 +111,8 @@ typedef enum {
pl330_chan_fault = 15,
} PL330ChanState;
-typedef struct PL330State PL330State;
+#define TYPE_PL330 "pl330"
+OBJECT_DECLARE_SIMPLE_TYPE(PL330State, PL330)
typedef struct PL330Chan {
uint32_t src;
@@ -274,9 +275,6 @@ struct PL330State {
AddressSpace *mem_as;
};
-#define TYPE_PL330 "pl330"
-OBJECT_DECLARE_SIMPLE_TYPE(PL330State, PL330)
-
static const VMStateDescription vmstate_pl330 = {
.name = "pl330",
.version_id = 2,
diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c
index 34c6a1d0b08..e7bdc732de0 100644
--- a/hw/net/xen_nic.c
+++ b/hw/net/xen_nic.c
@@ -62,8 +62,6 @@ struct XenNetDev {
NICState *nic;
};
-typedef struct XenNetDev XenNetDev;
-
#define TYPE_XEN_NET_DEVICE "xen-net-device"
OBJECT_DECLARE_SIMPLE_TYPE(XenNetDev, XEN_NET_DEVICE)
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 7d6251a78d7..cbda068ef7d 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -230,7 +230,9 @@ struct PCIBonitoState {
MemoryRegion bonito_localio;
};
-typedef struct PCIBonitoState PCIBonitoState;
+
+#define TYPE_PCI_BONITO "Bonito"
+OBJECT_DECLARE_SIMPLE_TYPE(PCIBonitoState, PCI_BONITO)
struct BonitoState {
PCIHostState parent_obj;
@@ -239,9 +241,6 @@ struct BonitoState {
MemoryRegion pci_mem;
};
-#define TYPE_PCI_BONITO "Bonito"
-OBJECT_DECLARE_SIMPLE_TYPE(PCIBonitoState, PCI_BONITO)
-
static void bonito_writel(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
diff --git a/hw/ppc/pef.c b/hw/ppc/pef.c
index 254f5707876..39b4ce94f10 100644
--- a/hw/ppc/pef.c
+++ b/hw/ppc/pef.c
@@ -19,7 +19,6 @@
#define TYPE_PEF_GUEST "pef-guest"
OBJECT_DECLARE_SIMPLE_TYPE(PefGuest, PEF_GUEST)
-typedef struct PefGuest PefGuest;
typedef struct PefGuestClass PefGuestClass;
struct PefGuestClass {
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index ce45c9cd061..afd7944b737 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -123,11 +123,13 @@ typedef struct {
/* ----------------------------------------------------------------------- */
-typedef struct MTPState MTPState;
typedef struct MTPControl MTPControl;
typedef struct MTPData MTPData;
typedef struct MTPObject MTPObject;
+#define TYPE_USB_MTP "usb-mtp"
+OBJECT_DECLARE_SIMPLE_TYPE(MTPState, USB_MTP)
+
enum {
EP_DATA_IN = 1,
EP_DATA_OUT,
@@ -236,9 +238,6 @@ typedef struct {
/* string and other data follows */
} QEMU_PACKED ObjectInfo;
-#define TYPE_USB_MTP "usb-mtp"
-OBJECT_DECLARE_SIMPLE_TYPE(MTPState, USB_MTP)
-
#define QEMU_STORAGE_ID 0x00010001
#define MTP_FLAG_WRITABLE 0
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 21cc2835c62..18ebe15d0c4 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -109,10 +109,12 @@ typedef struct {
#define UAS_STREAM_BM_ATTR 4
#define UAS_MAX_STREAMS (1 << UAS_STREAM_BM_ATTR)
-typedef struct UASDevice UASDevice;
typedef struct UASRequest UASRequest;
typedef struct UASStatus UASStatus;
+#define TYPE_USB_UAS "usb-uas"
+OBJECT_DECLARE_SIMPLE_TYPE(UASDevice, USB_UAS)
+
struct UASDevice {
USBDevice dev;
SCSIBus bus;
@@ -133,9 +135,6 @@ struct UASDevice {
USBPacket *status3[UAS_MAX_STREAMS + 1];
};
-#define TYPE_USB_UAS "usb-uas"
-OBJECT_DECLARE_SIMPLE_TYPE(UASDevice, USB_UAS)
-
struct UASRequest {
uint16_t tag;
uint64_t lun;
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 03/23] hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 01/23] target/hppa: Set FPCR exception flag bits for non-trapped exceptions Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 02/23] qom: remove redundant typedef when use OBJECT_DECLARE_SIMPLE_TYPE Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-12-09 12:15 ` Fiona Ebner
2025-10-28 7:48 ` [PULL 04/23] migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro Philippe Mathieu-Daudé
` (20 subsequent siblings)
23 siblings, 1 reply; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Michael Tokarev, Akihiko Odaki, Lei Yang,
Philippe Mathieu-Daudé, Michael S. Tsirkin, Jason Wang
From: Michael Tokarev <mjt@tls.msk.ru>
This field is a fixed-size buffer (number of elements is MAX_VLAN,
known at build time). There's no need to allocate it dynamically,
it can be made an integral part of VirtIONet structure.
This field is the only user of VMSTATE_BUFFER_POINTER_UNSAFE() macro.
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Message-ID: <20251023135316.31128-2-mjt@tls.msk.ru>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/virtio/virtio-net.h | 2 +-
hw/net/virtio-net.c | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
index 5b8ab7bda79..f7083553068 100644
--- a/include/hw/virtio/virtio-net.h
+++ b/include/hw/virtio/virtio-net.h
@@ -202,7 +202,7 @@ struct VirtIONet {
uint8_t uni_overflow;
uint8_t *macs;
} mac_table;
- uint32_t *vlans;
+ uint32_t vlans[MAX_VLAN];
virtio_net_conf net_conf;
NICConf nic_conf;
DeviceState *qdev;
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 33116712eb4..17ed0ef9190 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -986,7 +986,7 @@ static void virtio_net_set_features(VirtIODevice *vdev,
virtio_has_feature_ex(vdev->guest_features_ex,
VIRTIO_NET_F_CTRL_VLAN)) {
bool vlan = virtio_has_feature_ex(features, VIRTIO_NET_F_CTRL_VLAN);
- memset(n->vlans, vlan ? 0 : 0xff, MAX_VLAN >> 3);
+ memset(n->vlans, vlan ? 0 : 0xff, sizeof(n->vlans));
}
if (virtio_has_feature_ex(features, VIRTIO_NET_F_STANDBY)) {
@@ -3600,7 +3600,8 @@ static const VMStateDescription vmstate_virtio_net_device = {
* buffer; hold onto your endiannesses; it's actually used as a bitmap
* but based on the uint.
*/
- VMSTATE_BUFFER_POINTER_UNSAFE(vlans, VirtIONet, 0, MAX_VLAN >> 3),
+ VMSTATE_BUFFER_UNSAFE(vlans, VirtIONet, 0,
+ sizeof(typeof_field(VirtIONet, vlans))),
VMSTATE_WITH_TMP(VirtIONet, struct VirtIONetMigTmp,
vmstate_virtio_net_has_vnet),
VMSTATE_UINT8(mac_table.multi_overflow, VirtIONet),
@@ -4018,8 +4019,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
n->mac_table.macs = g_malloc0(MAC_TABLE_ENTRIES * ETH_ALEN);
- n->vlans = g_malloc0(MAX_VLAN >> 3);
- memset(n->vlans, 0xff, MAX_VLAN >> 3);
+ memset(n->vlans, 0xff, sizeof(n->vlans));
nc = qemu_get_queue(n->nic);
nc->rxfilter_notify_enabled = 1;
@@ -4068,7 +4068,6 @@ static void virtio_net_device_unrealize(DeviceState *dev)
n->netclient_type = NULL;
g_free(n->mac_table.macs);
- g_free(n->vlans);
if (n->failover) {
qobject_unref(n->primary_opts);
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 04/23] migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2025-10-28 7:48 ` [PULL 03/23] hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 05/23] hw/pci-host/raven: Simplify creating PCI facing part Philippe Mathieu-Daudé
` (19 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Michael Tokarev, Philippe Mathieu-Daudé, Peter Xu,
Fabiano Rosas
From: Michael Tokarev <mjt@tls.msk.ru>
The only user of this macro was VirtIONet.vlans, which has been
converted to regular VMSTATE_BUFFER.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Peter Xu <peterx@redhat.com>
Message-ID: <20251023135316.31128-3-mjt@tls.msk.ru>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/migration/vmstate.h | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 63ccaee07ad..09f1eefcfb6 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -727,15 +727,6 @@ extern const VMStateInfo vmstate_info_qlist;
.offset = offsetof(_state, _field), \
}
-#define VMSTATE_BUFFER_POINTER_UNSAFE(_field, _state, _version, _size) { \
- .name = (stringify(_field)), \
- .version_id = (_version), \
- .size = (_size), \
- .info = &vmstate_info_buffer, \
- .flags = VMS_BUFFER|VMS_POINTER, \
- .offset = offsetof(_state, _field), \
-}
-
/* Allocate a temporary of type 'tmp_type', set tmp->parent to _state
* and execute the vmsd on the temporary. Note that we're working with
* the whole of _state here, not a field within it.
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 05/23] hw/pci-host/raven: Simplify creating PCI facing part
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2025-10-28 7:48 ` [PULL 04/23] migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 06/23] hw/pci-host/raven: Simplify " Philippe Mathieu-Daudé
` (18 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: BALATON Zoltan, Mark Cave-Ayland, Philippe Mathieu-Daudé,
Hervé Poussineau, qemu-ppc
From: BALATON Zoltan <balaton@eik.bme.hu>
There is no need to init and realize the PCI facing part of the host
bridge separately as it does not expose any properties that need to be
available before realize. It can be simpilfied using pci_create_simple.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-ID: <5a60e395d72e5eb4d01093434fbb645d72ac567a.1761232472.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/pci-host/raven.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index eacffc86d84..c0492d14569 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -65,7 +65,6 @@ struct PRePPCIState {
MemoryRegion bm_ram_alias;
MemoryRegion bm_pci_memory_alias;
AddressSpace bm_as;
- RavenPCIState pci_dev;
int contiguous_map;
};
@@ -260,8 +259,7 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
"pci-intack", 1);
memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->pci_intack);
- /* TODO Remove once realize propagates to child devices. */
- qdev_realize(DEVICE(&s->pci_dev), BUS(&s->pci_bus), errp);
+ pci_create_simple(&s->pci_bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE);
}
static void raven_pcihost_initfn(Object *obj)
@@ -269,7 +267,6 @@ static void raven_pcihost_initfn(Object *obj)
PCIHostState *h = PCI_HOST_BRIDGE(obj);
PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(obj);
MemoryRegion *address_space_mem = get_system_memory();
- DeviceState *pci_dev;
memory_region_init(&s->pci_io, obj, "pci-io", 0x3f800000);
memory_region_init_io(&s->pci_io_non_contiguous, obj, &raven_io_ops, s,
@@ -306,12 +303,6 @@ static void raven_pcihost_initfn(Object *obj)
pci_setup_iommu(&s->pci_bus, &raven_iommu_ops, s);
h->bus = &s->pci_bus;
-
- object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_RAVEN_PCI_DEVICE);
- pci_dev = DEVICE(&s->pci_dev);
- object_property_set_int(OBJECT(&s->pci_dev), "addr", PCI_DEVFN(0, 0),
- NULL);
- qdev_prop_set_bit(pci_dev, "multifunction", false);
}
static void raven_realize(PCIDevice *d, Error **errp)
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 06/23] hw/pci-host/raven: Simplify PCI facing part
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2025-10-28 7:48 ` [PULL 05/23] hw/pci-host/raven: Simplify creating PCI facing part Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 07/23] hw/pci-host/raven: Simplify host bridge type declaration Philippe Mathieu-Daudé
` (17 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: BALATON Zoltan, Mark Cave-Ayland, Philippe Mathieu-Daudé,
Hervé Poussineau, qemu-ppc
From: BALATON Zoltan <balaton@eik.bme.hu>
The raven PCI device does not need a state struct as it has no data to
store there any more, so we can remove that to simplify code.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-ID: <3c4cb144c24a2a729669549c4c0e6e47d230e68e.1761232472.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/pci-host/raven.c | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index c0492d14569..fa76e5170c8 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -31,7 +31,6 @@
#include "hw/pci/pci_bus.h"
#include "hw/pci/pci_host.h"
#include "hw/qdev-properties.h"
-#include "migration/vmstate.h"
#include "hw/intc/i8259.h"
#include "hw/irq.h"
#include "hw/or-irq.h"
@@ -40,12 +39,6 @@
#define TYPE_RAVEN_PCI_DEVICE "raven"
#define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost"
-OBJECT_DECLARE_SIMPLE_TYPE(RavenPCIState, RAVEN_PCI_DEVICE)
-
-struct RavenPCIState {
- PCIDevice dev;
-};
-
typedef struct PRePPCIState PREPPCIState;
DECLARE_INSTANCE_CHECKER(PREPPCIState, RAVEN_PCI_HOST_BRIDGE,
TYPE_RAVEN_PCI_HOST_BRIDGE)
@@ -312,16 +305,6 @@ static void raven_realize(PCIDevice *d, Error **errp)
d->config[PCI_CAPABILITY_LIST] = 0x00;
}
-static const VMStateDescription vmstate_raven = {
- .name = "raven",
- .version_id = 0,
- .minimum_version_id = 0,
- .fields = (const VMStateField[]) {
- VMSTATE_PCI_DEVICE(dev, RavenPCIState),
- VMSTATE_END_OF_LIST()
- },
-};
-
static void raven_class_init(ObjectClass *klass, const void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
@@ -333,7 +316,6 @@ static void raven_class_init(ObjectClass *klass, const void *data)
k->revision = 0x00;
k->class_id = PCI_CLASS_BRIDGE_HOST;
dc->desc = "PReP Host Bridge - Motorola Raven";
- dc->vmsd = &vmstate_raven;
/*
* Reason: PCI-facing part of the host bridge, not usable without
* the host-facing part, which can't be device_add'ed, yet.
@@ -344,7 +326,6 @@ static void raven_class_init(ObjectClass *klass, const void *data)
static const TypeInfo raven_info = {
.name = TYPE_RAVEN_PCI_DEVICE,
.parent = TYPE_PCI_DEVICE,
- .instance_size = sizeof(RavenPCIState),
.class_init = raven_class_init,
.interfaces = (const InterfaceInfo[]) {
{ INTERFACE_CONVENTIONAL_PCI_DEVICE },
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 07/23] hw/pci-host/raven: Simplify host bridge type declaration
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2025-10-28 7:48 ` [PULL 06/23] hw/pci-host/raven: Simplify " Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 08/23] hw/pci-host/raven: Use DEFINE_TYPES macro Philippe Mathieu-Daudé
` (16 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: BALATON Zoltan, Philippe Mathieu-Daudé, Mark Cave-Ayland,
Hervé Poussineau, qemu-ppc
From: BALATON Zoltan <balaton@eik.bme.hu>
Use OBJECT_DECLARE_SIMPLE_TYPE macro instead of open coding it and
change state struct name to match the previous typedef.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-ID: <e14793737092eac0642aa87214801a1f4bb1e2e7.1761232472.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/pci-host/raven.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index fa76e5170c8..ea5ad69547a 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -39,11 +39,9 @@
#define TYPE_RAVEN_PCI_DEVICE "raven"
#define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost"
-typedef struct PRePPCIState PREPPCIState;
-DECLARE_INSTANCE_CHECKER(PREPPCIState, RAVEN_PCI_HOST_BRIDGE,
- TYPE_RAVEN_PCI_HOST_BRIDGE)
+OBJECT_DECLARE_SIMPLE_TYPE(PREPPCIState, RAVEN_PCI_HOST_BRIDGE)
-struct PRePPCIState {
+struct PREPPCIState {
PCIHostState parent_obj;
OrIRQState *or_irq;
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 08/23] hw/pci-host/raven: Use DEFINE_TYPES macro
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2025-10-28 7:48 ` [PULL 07/23] hw/pci-host/raven: Simplify host bridge type declaration Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 09/23] hw/pci-host/raven: Simplify PCI bus creation Philippe Mathieu-Daudé
` (15 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: BALATON Zoltan, Philippe Mathieu-Daudé, Mark Cave-Ayland,
Hervé Poussineau, qemu-ppc
From: BALATON Zoltan <balaton@eik.bme.hu>
Convert to using DEFINE_TYPES macro and move raven_pcihost_class_init
so methods of each object are grouped together.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-ID: <4ff8a3e1de847846f08d9ea6b389efeb3eb12aed.1761232472.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/pci-host/raven.c | 57 +++++++++++++++++++++------------------------
1 file changed, 26 insertions(+), 31 deletions(-)
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index ea5ad69547a..1d09a28bff2 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -296,6 +296,15 @@ static void raven_pcihost_initfn(Object *obj)
h->bus = &s->pci_bus;
}
+static void raven_pcihost_class_init(ObjectClass *klass, const void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
+ dc->realize = raven_pcihost_realizefn;
+ dc->fw_name = "pci";
+}
+
static void raven_realize(PCIDevice *d, Error **errp)
{
d->config[PCI_CACHE_LINE_SIZE] = 0x08;
@@ -321,37 +330,23 @@ static void raven_class_init(ObjectClass *klass, const void *data)
dc->user_creatable = false;
}
-static const TypeInfo raven_info = {
- .name = TYPE_RAVEN_PCI_DEVICE,
- .parent = TYPE_PCI_DEVICE,
- .class_init = raven_class_init,
- .interfaces = (const InterfaceInfo[]) {
- { INTERFACE_CONVENTIONAL_PCI_DEVICE },
- { },
+static const TypeInfo raven_types[] = {
+ {
+ .name = TYPE_RAVEN_PCI_HOST_BRIDGE,
+ .parent = TYPE_PCI_HOST_BRIDGE,
+ .instance_size = sizeof(PREPPCIState),
+ .instance_init = raven_pcihost_initfn,
+ .class_init = raven_pcihost_class_init,
+ },
+ {
+ .name = TYPE_RAVEN_PCI_DEVICE,
+ .parent = TYPE_PCI_DEVICE,
+ .class_init = raven_class_init,
+ .interfaces = (const InterfaceInfo[]) {
+ { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+ { },
+ },
},
};
-static void raven_pcihost_class_init(ObjectClass *klass, const void *data)
-{
- DeviceClass *dc = DEVICE_CLASS(klass);
-
- set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
- dc->realize = raven_pcihost_realizefn;
- dc->fw_name = "pci";
-}
-
-static const TypeInfo raven_pcihost_info = {
- .name = TYPE_RAVEN_PCI_HOST_BRIDGE,
- .parent = TYPE_PCI_HOST_BRIDGE,
- .instance_size = sizeof(PREPPCIState),
- .instance_init = raven_pcihost_initfn,
- .class_init = raven_pcihost_class_init,
-};
-
-static void raven_register_types(void)
-{
- type_register_static(&raven_pcihost_info);
- type_register_static(&raven_info);
-}
-
-type_init(raven_register_types)
+DEFINE_TYPES(raven_types)
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 09/23] hw/pci-host/raven: Simplify PCI bus creation
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2025-10-28 7:48 ` [PULL 08/23] hw/pci-host/raven: Use DEFINE_TYPES macro Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 10/23] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg Philippe Mathieu-Daudé
` (14 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: BALATON Zoltan, Mark Cave-Ayland, Philippe Mathieu-Daudé,
Hervé Poussineau, qemu-ppc
From: BALATON Zoltan <balaton@eik.bme.hu>
Instead of doing it manually use pci_register_root_bus() to create and
register the PCI bus. Also drop pci_bus from PREPPCIState and use the
existing bus field in the parent PCIHostState.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-ID: <4ffa168d68947d95a16c51d73cedd141b0df0ea0.1761232472.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/pci-host/raven.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 1d09a28bff2..22ad244eb6e 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -46,7 +46,6 @@ struct PREPPCIState {
OrIRQState *or_irq;
qemu_irq pci_irqs[PCI_NUM_PINS];
- PCIBus pci_bus;
AddressSpace pci_io_as;
MemoryRegion pci_io;
MemoryRegion pci_io_non_contiguous;
@@ -231,8 +230,9 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
qdev_init_gpio_in(d, raven_change_gpio, 1);
- pci_bus_irqs(&s->pci_bus, raven_set_irq, s, PCI_NUM_PINS);
- pci_bus_map_irqs(&s->pci_bus, raven_map_irq);
+ h->bus = pci_register_root_bus(d, NULL, raven_set_irq, raven_map_irq,
+ s, &s->pci_memory, &s->pci_io, 0, 4,
+ TYPE_PCI_BUS);
memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_le_ops, s,
"pci-conf-idx", 4);
@@ -250,12 +250,14 @@ static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
"pci-intack", 1);
memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->pci_intack);
- pci_create_simple(&s->pci_bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE);
+ pci_create_simple(h->bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE);
+
+ address_space_init(&s->bm_as, &s->bm, "raven-bm");
+ pci_setup_iommu(h->bus, &raven_iommu_ops, s);
}
static void raven_pcihost_initfn(Object *obj)
{
- PCIHostState *h = PCI_HOST_BRIDGE(obj);
PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(obj);
MemoryRegion *address_space_mem = get_system_memory();
@@ -278,8 +280,6 @@ static void raven_pcihost_initfn(Object *obj)
memory_region_add_subregion_overlap(address_space_mem, PCI_IO_BASE_ADDR,
&s->pci_io_non_contiguous, 1);
memory_region_add_subregion(address_space_mem, 0xc0000000, &s->pci_memory);
- pci_root_bus_init(&s->pci_bus, sizeof(s->pci_bus), DEVICE(obj), NULL,
- &s->pci_memory, &s->pci_io, 0, TYPE_PCI_BUS);
/* Bus master address space */
memory_region_init(&s->bm, obj, "bm-raven", 4 * GiB);
@@ -290,10 +290,6 @@ static void raven_pcihost_initfn(Object *obj)
get_system_memory(), 0, 0x80000000);
memory_region_add_subregion(&s->bm, 0 , &s->bm_pci_memory_alias);
memory_region_add_subregion(&s->bm, 0x80000000, &s->bm_ram_alias);
- address_space_init(&s->bm_as, &s->bm, "raven-bm");
- pci_setup_iommu(&s->pci_bus, &raven_iommu_ops, s);
-
- h->bus = &s->pci_bus;
}
static void raven_pcihost_class_init(ObjectClass *klass, const void *data)
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 10/23] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2025-10-28 7:48 ` [PULL 09/23] hw/pci-host/raven: Simplify PCI bus creation Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 11/23] hw/sysbus: Have various helpers take a const SysBusDevice argument Philippe Mathieu-Daudé
` (13 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Mark Cave-Ayland, Paolo Bonzini,
Daniel P. Berrangé, Eduardo Habkost
This getter doesn't update any DeviceState internal fields,
make it const.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20251024190416.8803-2-philmd@linaro.org>
---
include/hw/qdev-core.h | 3 ++-
hw/core/gpio.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index a7bfb10dc70..2caa0cbd26f 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -725,7 +725,8 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
*
* Return: qemu_irq associated with GPIO or NULL if un-wired.
*/
-qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n);
+qemu_irq qdev_get_gpio_out_connector(const DeviceState *dev,
+ const char *name, int n);
/**
* qdev_intercept_gpio_out: Intercept an existing GPIO connection
diff --git a/hw/core/gpio.c b/hw/core/gpio.c
index 6e32a8eec61..c7c2936fc55 100644
--- a/hw/core/gpio.c
+++ b/hw/core/gpio.c
@@ -129,7 +129,8 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
g_free(propname);
}
-qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
+qemu_irq qdev_get_gpio_out_connector(const DeviceState *dev,
+ const char *name, int n)
{
g_autofree char *propname = g_strdup_printf("%s[%d]",
name ? name : "unnamed-gpio-out", n);
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 11/23] hw/sysbus: Have various helpers take a const SysBusDevice argument
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2025-10-28 7:48 ` [PULL 10/23] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 12/23] hw/uefi: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
` (12 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Mark Cave-Ayland, Paolo Bonzini,
Daniel P. Berrangé, Eduardo Habkost
These getters don't update any SysBusDevice internal fields,
make the argument const.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20251024190416.8803-3-philmd@linaro.org>
---
include/hw/sysbus.h | 10 +++++-----
hw/core/sysbus.c | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index 18fde8a7b48..69eb62e29c8 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -70,17 +70,17 @@ struct SysBusDevice {
typedef void FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
-MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
+MemoryRegion *sysbus_mmio_get_region(const SysBusDevice *dev, int n);
void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);
void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target);
void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size);
-bool sysbus_has_irq(SysBusDevice *dev, int n);
-bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n);
+bool sysbus_has_irq(const SysBusDevice *dev, int n);
+bool sysbus_has_mmio(const SysBusDevice *dev, unsigned int n);
void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq);
-bool sysbus_is_irq_connected(SysBusDevice *dev, int n);
-qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n);
+bool sysbus_is_irq_connected(const SysBusDevice *dev, int n);
+qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n);
void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr);
int sysbus_mmio_map_name(SysBusDevice *dev, const char*name, hwaddr addr);
void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr,
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index ec69e877a2c..ae447c1196a 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -80,7 +80,7 @@ static void system_bus_class_init(ObjectClass *klass, const void *data)
}
/* Check whether an IRQ source exists */
-bool sysbus_has_irq(SysBusDevice *dev, int n)
+bool sysbus_has_irq(const SysBusDevice *dev, int n)
{
char *prop = g_strdup_printf("%s[%d]", SYSBUS_DEVICE_GPIO_IRQ, n);
ObjectProperty *r;
@@ -91,12 +91,12 @@ bool sysbus_has_irq(SysBusDevice *dev, int n)
return (r != NULL);
}
-bool sysbus_is_irq_connected(SysBusDevice *dev, int n)
+bool sysbus_is_irq_connected(const SysBusDevice *dev, int n)
{
return !!sysbus_get_connected_irq(dev, n);
}
-qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n)
+qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n)
{
DeviceState *d = DEVICE(dev);
return qdev_get_gpio_out_connector(d, SYSBUS_DEVICE_GPIO_IRQ, n);
@@ -114,7 +114,7 @@ void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
}
/* Check whether an MMIO region exists */
-bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n)
+bool sysbus_has_mmio(const SysBusDevice *dev, unsigned int n)
{
return (n < dev->num_mmio);
}
@@ -190,7 +190,7 @@ void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory)
dev->mmio[n].memory = memory;
}
-MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n)
+MemoryRegion *sysbus_mmio_get_region(const SysBusDevice *dev, int n)
{
assert(n >= 0 && n < QDEV_MAX_MMIO);
return dev->mmio[n].memory;
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 12/23] hw/uefi: Include missing 'system/memory.h' header
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2025-10-28 7:48 ` [PULL 11/23] hw/sysbus: Have various helpers take a const SysBusDevice argument Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 13/23] hw/int/loongarch: " Philippe Mathieu-Daudé
` (11 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Gerd Hoffmann
"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:
include/hw/uefi/var-service.h:50:39: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
50 | MemoryRegion mr;
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20251024190416.8803-14-philmd@linaro.org>
---
include/hw/uefi/var-service.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/hw/uefi/var-service.h b/include/hw/uefi/var-service.h
index f7ceac4ce24..91fb4a20918 100644
--- a/include/hw/uefi/var-service.h
+++ b/include/hw/uefi/var-service.h
@@ -9,6 +9,7 @@
#include "qemu/uuid.h"
#include "qemu/queue.h"
+#include "system/memory.h"
#include "hw/uefi/var-service-edk2.h"
#define MAX_BUFFER_SIZE (64 * 1024)
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 13/23] hw/int/loongarch: Include missing 'system/memory.h' header
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2025-10-28 7:48 ` [PULL 12/23] hw/uefi: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 14/23] hw/core/loader: Use qemu_open() instead of open() in get_image_size() Philippe Mathieu-Daudé
` (10 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Song Gao, Jiaxun Yang,
Huacai Chen
"system/memory.h" header is indirectly pulled by "hw/sysbus.h".
Include it explicitly to avoid when refactoring the latter:
In file included from ../../hw/intc/loongson_ipi.c:9:
In file included from /Users/philmd/source/qemu/include/hw/intc/loongson_ipi.h:12:
include/hw/intc/loongson_ipi_common.h:37:18: error: field has incomplete type 'MemoryRegion' (aka 'struct MemoryRegion')
37 | MemoryRegion ipi_iocsr_mem;
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Message-Id: <20251024190416.8803-21-philmd@linaro.org>
---
include/hw/intc/loongarch_dintc.h | 2 +-
include/hw/intc/loongarch_extioi_common.h | 1 +
include/hw/intc/loongarch_pch_msi.h | 1 +
include/hw/intc/loongarch_pic_common.h | 1 +
include/hw/intc/loongson_ipi_common.h | 1 +
5 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/hw/intc/loongarch_dintc.h b/include/hw/intc/loongarch_dintc.h
index 0b0b5347b2c..01bb1e465cb 100644
--- a/include/hw/intc/loongarch_dintc.h
+++ b/include/hw/intc/loongarch_dintc.h
@@ -8,7 +8,7 @@
#include "qom/object.h"
#include "hw/sysbus.h"
#include "hw/loongarch/virt.h"
-
+#include "system/memory.h"
#define NR_VECTORS 256
diff --git a/include/hw/intc/loongarch_extioi_common.h b/include/hw/intc/loongarch_extioi_common.h
index c021ccee0fa..1bd2bfa07fc 100644
--- a/include/hw/intc/loongarch_extioi_common.h
+++ b/include/hw/intc/loongarch_extioi_common.h
@@ -10,6 +10,7 @@
#include "qom/object.h"
#include "hw/sysbus.h"
#include "hw/loongarch/virt.h"
+#include "system/memory.h"
#define LS3A_INTC_IP 8
#define EXTIOI_IRQS (256)
diff --git a/include/hw/intc/loongarch_pch_msi.h b/include/hw/intc/loongarch_pch_msi.h
index b8586fb3b6f..ef4ec4fdeb8 100644
--- a/include/hw/intc/loongarch_pch_msi.h
+++ b/include/hw/intc/loongarch_pch_msi.h
@@ -6,6 +6,7 @@
*/
#include "hw/sysbus.h"
+#include "system/memory.h"
#define TYPE_LOONGARCH_PCH_MSI "loongarch_pch_msi"
OBJECT_DECLARE_SIMPLE_TYPE(LoongArchPCHMSI, LOONGARCH_PCH_MSI)
diff --git a/include/hw/intc/loongarch_pic_common.h b/include/hw/intc/loongarch_pic_common.h
index 675ba96e64e..179361eb567 100644
--- a/include/hw/intc/loongarch_pic_common.h
+++ b/include/hw/intc/loongarch_pic_common.h
@@ -9,6 +9,7 @@
#include "hw/loongarch/virt.h"
#include "hw/sysbus.h"
+#include "system/memory.h"
#define PCH_PIC_INT_ID 0x00
#define PCH_PIC_INT_ID_VAL 0x7
diff --git a/include/hw/intc/loongson_ipi_common.h b/include/hw/intc/loongson_ipi_common.h
index e58ce2aa1c4..4fa03bc351f 100644
--- a/include/hw/intc/loongson_ipi_common.h
+++ b/include/hw/intc/loongson_ipi_common.h
@@ -11,6 +11,7 @@
#include "qom/object.h"
#include "hw/sysbus.h"
#include "exec/memattrs.h"
+#include "system/memory.h"
#define IPI_MBX_NUM 4
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 14/23] hw/core/loader: Use qemu_open() instead of open() in get_image_size()
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (12 preceding siblings ...)
2025-10-28 7:48 ` [PULL 13/23] hw/int/loongarch: " Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 15/23] hw/core/loader: capture Error from load_image_targphys Philippe Mathieu-Daudé
` (9 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Vishal Chourasia, Daniel P. Berrangé,
Philippe Mathieu-Daudé
From: Vishal Chourasia <vishalc@linux.ibm.com>
Replace open() with qemu_open() which provides better error handling
via the Error object, automatically sets O_CLOEXEC, and supports FD
passing with /dev/fdset.
Currently pass errp argument as NULL.
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Message-ID: <20251024130556.1942835-4-vishalc@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/loader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 477661a0255..c9782d67e86 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -74,7 +74,7 @@ int64_t get_image_size(const char *filename)
{
int fd;
int64_t size;
- fd = open(filename, O_RDONLY | O_BINARY);
+ fd = qemu_open(filename, O_RDONLY | O_BINARY, NULL);
if (fd < 0)
return -1;
size = lseek(fd, 0, SEEK_END);
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 15/23] hw/core/loader: capture Error from load_image_targphys
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (13 preceding siblings ...)
2025-10-28 7:48 ` [PULL 14/23] hw/core/loader: Use qemu_open() instead of open() in get_image_size() Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 16/23] hw/core/loader: improve error handling in image loading functions Philippe Mathieu-Daudé
` (8 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Vishal Chourasia, Peter Maydell, Philippe Mathieu-Daudé,
Aditya Gupta, Richard Henderson, Antony Pavlov, Rob Herring,
Alistair Francis, Alex Bennée, Helge Deller,
Michael S. Tsirkin, Marcel Apfelbaum, Paolo Bonzini,
Eduardo Habkost, Corey Minyard, Song Gao, Bibo Mao, Jiaxun Yang,
Thomas Huth, Laurent Vivier, Edgar E. Iglesias, Paul Burton,
Aleksandar Rikalo, Huacai Chen, Hervé Poussineau,
Aurelien Jarno, Stafford Horne, BALATON Zoltan, Bernhard Beschow,
Mark Cave-Ayland, Nicholas Piggin, Glenn Miles,
Harsh Prateek Bora, Palmer Dabbelt, Weiwei Li,
Daniel Henrique Barboza, Liu Zhiwei, Yoshinori Sato,
Christian Borntraeger, Jared Rossi, Zhuoying Cai, Halil Pasic,
Eric Farman, Matthew Rosato, David Hildenbrand, Ilya Leoshkevich,
Magnus Damm, Igor Mammedov, Ani Sinha, Clément Chigot,
Frederic Konrad, Artyom Tarasenko, Max Filippov, David Gibson,
qemu-arm, qemu-ppc, qemu-riscv, qemu-s390x
From: Vishal Chourasia <vishalc@linux.ibm.com>
Add Error **errp parameter to load_image_targphys(),
load_image_targphys_as(), and get_image_size() to enable better
error reporting when image loading fails.
Pass NULL for errp in all existing call sites to maintain current
behavior. No functional change intended in this patch.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Tested-by: Aditya Gupta <adityag@linux.ibm.com>
Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Message-ID: <20251024130556.1942835-6-vishalc@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/loader.h | 8 +++++---
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 | 3 ++-
hw/core/guest-loader.c | 2 +-
hw/core/loader.c | 16 +++++++++-------
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 | 4 ++--
hw/ppc/e500.c | 5 +++--
hw/ppc/mac_newworld.c | 9 ++++++---
hw/ppc/mac_oldworld.c | 9 ++++++---
hw/ppc/pegasos2.c | 5 +++--
hw/ppc/pnv.c | 9 ++++++---
hw/ppc/ppc440_bamboo.c | 3 ++-
hw/ppc/prep.c | 8 +++++---
hw/ppc/sam460ex.c | 3 ++-
hw/ppc/spapr.c | 8 ++++----
hw/ppc/virtex_ml507.c | 5 +++--
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 ++-
system/device_tree.c | 2 +-
51 files changed, 145 insertions(+), 106 deletions(-)
diff --git a/include/hw/loader.h b/include/hw/loader.h
index c96b5e141c6..d035e72748a 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -1,6 +1,7 @@
#ifndef LOADER_H
#define LOADER_H
#include "hw/nvram/fw_cfg.h"
+#include "qemu/typedefs.h"
/* loader.c */
/**
@@ -10,7 +11,7 @@
* Returns the size of the image file on success, -1 otherwise.
* On error, errno is also set as appropriate.
*/
-int64_t get_image_size(const char *filename);
+int64_t get_image_size(const char *filename, Error **errp);
/**
* load_image_size: load an image file into specified buffer
* @filename: Path to the image file
@@ -41,7 +42,8 @@ ssize_t load_image_size(const char *filename, void *addr, size_t size);
* Returns the size of the loaded image on success, -1 otherwise.
*/
ssize_t load_image_targphys_as(const char *filename,
- hwaddr addr, uint64_t max_sz, AddressSpace *as);
+ hwaddr addr, uint64_t max_sz, AddressSpace *as,
+ Error **errp);
/**load_targphys_hex_as:
* @filename: Path to the .hex file
@@ -61,7 +63,7 @@ ssize_t load_targphys_hex_as(const char *filename, hwaddr *entry,
* an AddressSpace.
*/
ssize_t load_image_targphys(const char *filename, hwaddr,
- uint64_t max_sz);
+ uint64_t max_sz, Error **errp);
/**
* load_image_mr: load an image into a memory region
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 19562b59674..b6155646ef7 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -182,7 +182,7 @@ static void clipper_init(MachineState *machine)
long initrd_base;
int64_t initrd_size;
- initrd_size = get_image_size(initrd_filename);
+ initrd_size = get_image_size(initrd_filename, NULL);
if (initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
initrd_filename);
@@ -192,7 +192,7 @@ static void clipper_init(MachineState *machine)
/* Put the initrd image as high in memory as possible. */
initrd_base = (ram_size - initrd_size) & TARGET_PAGE_MASK;
load_image_targphys(initrd_filename, initrd_base,
- ram_size - initrd_base);
+ ram_size - initrd_base, NULL);
address_space_stq(&address_space_memory, param_offset + 0x100,
initrd_base + 0xfffffc0000000000ULL,
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index cea3eb49ee5..c4a9c3ac529 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -611,7 +611,7 @@ void armv7m_load_kernel(ARMCPU *cpu, const char *kernel_filename,
NULL, ELFDATA2LSB, EM_ARM, 1, 0, as);
if (image_size < 0) {
image_size = load_image_targphys_as(kernel_filename, mem_base,
- mem_size, as);
+ mem_size, as, NULL);
}
if (image_size < 0) {
error_report("Could not load kernel '%s'", kernel_filename);
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index e77d8679d88..b91660208f5 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -964,7 +964,8 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
/* 32-bit ARM */
entry = info->loader_start + KERNEL_LOAD_ADDR;
kernel_size = load_image_targphys_as(info->kernel_filename, entry,
- ram_end - KERNEL_LOAD_ADDR, as);
+ ram_end - KERNEL_LOAD_ADDR, as,
+ NULL);
is_linux = 1;
if (kernel_size >= 0) {
image_low_addr = entry;
@@ -1025,7 +1026,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
info->initrd_start,
ram_end -
info->initrd_start,
- as);
+ as, NULL);
}
if (initrd_size < 0) {
error_report("could not load initrd '%s'",
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index 466b8b84c0e..de56991baca 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -97,7 +97,7 @@ static void digic_load_rom(DigicState *s, hwaddr addr,
exit(1);
}
- rom_size = load_image_targphys(fn, addr, max_size);
+ rom_size = load_image_targphys(fn, addr, max_size, NULL);
if (rom_size < 0 || rom_size > max_size) {
error_report("Couldn't load rom image '%s'.", filename);
exit(1);
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index 165c0b741a5..ff987467a99 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -235,7 +235,8 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
if (machine->firmware != NULL) {
sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);
if (sysboot_filename != NULL) {
- if (load_image_targphys(sysboot_filename, 0xfff88000, 0x8000) < 0) {
+ if (load_image_targphys(sysboot_filename, 0xfff88000, 0x8000,
+ NULL) < 0) {
error_report("Unable to load %s", machine->firmware);
exit(1);
}
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 9d9af63d654..fbf3e09c030 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -230,7 +230,7 @@ static void setup_boot(MachineState *machine, ARMCPU *cpu,
? FIRMWARE_ADDR_2 : FIRMWARE_ADDR_3;
/* load the firmware image (typically kernel.img) */
r = load_image_targphys(machine->firmware, firmware_addr,
- ram_size - firmware_addr);
+ ram_size - firmware_addr, NULL);
if (r < 0) {
error_report("Failed to load firmware from %s", machine->firmware);
exit(1);
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 35f8d05ea17..60cd375fe75 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -578,7 +578,7 @@ static void vexpress_common_init(MachineState *machine)
exit(1);
}
image_size = load_image_targphys(fn, map[VE_NORFLASH0],
- VEXPRESS_FLASH_SIZE);
+ VEXPRESS_FLASH_SIZE, NULL);
g_free(fn);
if (image_size < 0) {
error_report("Could not load ROM image '%s'", machine->firmware);
diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
index e72bbde2a23..6689847c33f 100644
--- a/hw/core/generic-loader.c
+++ b/hw/core/generic-loader.c
@@ -148,7 +148,8 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
if (size < 0 || s->force_raw) {
/* Default to the maximum size being the machine's ram size */
- size = load_image_targphys_as(s->file, s->addr, current_machine->ram_size, as);
+ size = load_image_targphys_as(s->file, s->addr,
+ current_machine->ram_size, as, NULL);
} else {
s->addr = entry;
}
diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c
index 3db89d7a2e1..59f325ad9c5 100644
--- a/hw/core/guest-loader.c
+++ b/hw/core/guest-loader.c
@@ -101,7 +101,7 @@ static void guest_loader_realize(DeviceState *dev, Error **errp)
/* Default to the maximum size being the machine's ram size */
size = load_image_targphys_as(file, s->addr, current_machine->ram_size,
- NULL);
+ NULL, NULL);
if (size < 0) {
error_setg(errp, "Cannot load specified image %s", file);
return;
diff --git a/hw/core/loader.c b/hw/core/loader.c
index c9782d67e86..7aca4989ef0 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -48,6 +48,7 @@
#include "qapi/error.h"
#include "qapi/qapi-commands-machine.h"
#include "qapi/type-helpers.h"
+#include "qemu/units.h"
#include "trace.h"
#include "hw/hw.h"
#include "disas/disas.h"
@@ -70,11 +71,11 @@
static int roms_loaded;
/* return the size or -1 if error */
-int64_t get_image_size(const char *filename)
+int64_t get_image_size(const char *filename, Error **errp)
{
int fd;
int64_t size;
- fd = qemu_open(filename, O_RDONLY | O_BINARY, NULL);
+ fd = qemu_open(filename, O_RDONLY | O_BINARY, errp);
if (fd < 0)
return -1;
size = lseek(fd, 0, SEEK_END);
@@ -118,18 +119,19 @@ ssize_t read_targphys(const char *name,
}
ssize_t load_image_targphys(const char *filename,
- hwaddr addr, uint64_t max_sz)
+ hwaddr addr, uint64_t max_sz, Error **errp)
{
- return load_image_targphys_as(filename, addr, max_sz, NULL);
+ return load_image_targphys_as(filename, addr, max_sz, NULL, errp);
}
/* return the size or -1 if error */
ssize_t load_image_targphys_as(const char *filename,
- hwaddr addr, uint64_t max_sz, AddressSpace *as)
+ hwaddr addr, uint64_t max_sz, AddressSpace *as,
+ Error **errp)
{
ssize_t size;
- size = get_image_size(filename);
+ size = get_image_size(filename, errp);
if (size < 0 || size > max_sz) {
return -1;
}
@@ -150,7 +152,7 @@ ssize_t load_image_mr(const char *filename, MemoryRegion *mr)
return -1;
}
- size = get_image_size(filename);
+ size = get_image_size(filename, NULL);
if (size < 0 || size > memory_region_size(mr)) {
return -1;
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index cddca69b938..ba894f8b1e9 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -495,7 +495,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
ram_addr_t initrd_base;
int64_t initrd_size;
- initrd_size = get_image_size(initrd_filename);
+ initrd_size = get_image_size(initrd_filename, NULL);
if (initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
initrd_filename);
@@ -516,7 +516,8 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
exit(1);
}
- load_image_targphys(initrd_filename, initrd_base, initrd_size);
+ load_image_targphys(initrd_filename, initrd_base, initrd_size,
+ NULL);
cpu[0]->env.initrd_base = initrd_base;
cpu[0]->env.initrd_end = initrd_base + initrd_size;
}
diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index 6e6b96bc345..78690781b74 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -337,7 +337,7 @@ int load_multiboot(X86MachineState *x86ms,
*next_space = '\0';
}
mb_debug("multiboot loading module: %s", one_file);
- mb_mod_length = get_image_size(one_file);
+ mb_mod_length = get_image_size(one_file, NULL);
if (mb_mod_length < 0) {
error_report("Failed to open file '%s'", one_file);
exit(1);
diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index 7512be64d67..6e78f3d07d6 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -924,7 +924,7 @@ void x86_load_linux(X86MachineState *x86ms,
exit(1);
}
- dtb_size = get_image_size(dtb_filename);
+ dtb_size = get_image_size(dtb_filename, NULL);
if (dtb_size <= 0) {
fprintf(stderr, "qemu: error reading dtb %s: %s\n",
dtb_filename, strerror(errno));
@@ -1025,7 +1025,7 @@ void x86_bios_rom_init(X86MachineState *x86ms, const char *default_firmware,
bios_name = MACHINE(x86ms)->firmware ?: default_firmware;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
- bios_size = get_image_size(filename);
+ bios_size = get_image_size(filename, NULL);
} else {
bios_size = -1;
}
diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
index 04e1dcd0e76..4604d632b1e 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -2211,7 +2211,7 @@ static void ipmi_fru_init(IPMIFru *fru)
goto out;
}
- fsize = get_image_size(fru->filename);
+ fsize = get_image_size(fru->filename, NULL);
if (fsize > 0) {
size = QEMU_ALIGN_UP(fsize, fru->areasize);
fru->data = g_malloc0(size);
diff --git a/hw/loongarch/boot.c b/hw/loongarch/boot.c
index 3dd48cb8aab..8857a049980 100644
--- a/hw/loongarch/boot.c
+++ b/hw/loongarch/boot.c
@@ -328,14 +328,13 @@ static int64_t load_kernel_info(struct loongarch_boot_info *info)
}
if (info->initrd_filename) {
- ssize_t initrd_size = get_image_size(info->initrd_filename);
-
+ ssize_t initrd_size = get_image_size(info->initrd_filename, NULL);
if (initrd_size > 0) {
initrd_offset = ROUND_UP(kernel_high + 4 * kernel_size, 64 * KiB);
initrd_offset = alloc_initrd_memory(info, initrd_offset,
initrd_size);
initrd_size = load_image_targphys(info->initrd_filename,
- initrd_offset, initrd_size);
+ initrd_offset, initrd_size, NULL);
}
if (initrd_size == -1) {
diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c
index d97399b882b..ff21d7779e1 100644
--- a/hw/m68k/an5206.c
+++ b/hw/m68k/an5206.c
@@ -82,7 +82,7 @@ static void an5206_init(MachineState *machine)
}
if (kernel_size < 0) {
kernel_size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR,
- ram_size - KERNEL_LOAD_ADDR);
+ ram_size - KERNEL_LOAD_ADDR, NULL);
entry = KERNEL_LOAD_ADDR;
}
if (kernel_size < 0) {
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index 75cc076f787..4a585b231db 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -351,7 +351,7 @@ static void mcf5208evb_init(MachineState *machine)
error_report("Could not find ROM image '%s'", machine->firmware);
exit(1);
}
- if (load_image_targphys(fn, 0x0, ROM_SIZE) < 8) {
+ if (load_image_targphys(fn, 0x0, ROM_SIZE, NULL) < 8) {
error_report("Could not load ROM image '%s'", machine->firmware);
exit(1);
}
@@ -380,7 +380,7 @@ static void mcf5208evb_init(MachineState *machine)
}
if (kernel_size < 0) {
kernel_size = load_image_targphys(kernel_filename, 0x40000000,
- ram_size);
+ ram_size, NULL);
entry = 0x40000000;
}
if (kernel_size < 0) {
diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c
index 957644b2d1e..cfb2b319e5e 100644
--- a/hw/m68k/next-cube.c
+++ b/hw/m68k/next-cube.c
@@ -1325,7 +1325,7 @@ static void next_cube_init(MachineState *machine)
memory_region_init_alias(&m->rom2, NULL, "next.rom2", &m->rom, 0x0,
0x20000);
memory_region_add_subregion(sysmem, 0x0, &m->rom2);
- if (load_image_targphys(bios_name, 0x01000000, 0x20000) < 8) {
+ if (load_image_targphys(bios_name, 0x01000000, 0x20000, NULL) < 8) {
if (!qtest_enabled()) {
error_report("Failed to load firmware '%s'.", bios_name);
}
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 793b23f8155..b8676feb418 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -629,7 +629,7 @@ static void q800_machine_init(MachineState *machine)
/* load initrd */
if (initrd_filename) {
- initrd_size = get_image_size(initrd_filename);
+ initrd_size = get_image_size(initrd_filename, NULL);
if (initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
initrd_filename);
@@ -638,7 +638,7 @@ static void q800_machine_init(MachineState *machine)
initrd_base = (ram_size - initrd_size) & TARGET_PAGE_MASK;
load_image_targphys(initrd_filename, initrd_base,
- ram_size - initrd_base);
+ ram_size - initrd_base, NULL);
BOOTINFO2(param_ptr, BI_RAMDISK, initrd_base,
initrd_size);
} else {
@@ -668,7 +668,8 @@ static void q800_machine_init(MachineState *machine)
/* Load MacROM binary */
if (filename) {
- bios_size = load_image_targphys(filename, MACROM_ADDR, MACROM_SIZE);
+ bios_size = load_image_targphys(filename, MACROM_ADDR, MACROM_SIZE,
+ NULL);
g_free(filename);
} else {
bios_size = -1;
diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index 98cfe43c73a..3f65d915561 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -283,7 +283,7 @@ static void virt_init(MachineState *machine)
/* load initrd */
if (initrd_filename) {
- initrd_size = get_image_size(initrd_filename);
+ initrd_size = get_image_size(initrd_filename, NULL);
if (initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
initrd_filename);
@@ -292,7 +292,7 @@ static void virt_init(MachineState *machine)
initrd_base = (ram_size - initrd_size) & TARGET_PAGE_MASK;
load_image_targphys(initrd_filename, initrd_base,
- ram_size - initrd_base);
+ ram_size - initrd_base, NULL);
BOOTINFO2(param_ptr, BI_RAMDISK, initrd_base,
initrd_size);
} else {
diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
index 4a9c9df3181..ec38107f503 100644
--- a/hw/microblaze/boot.c
+++ b/hw/microblaze/boot.c
@@ -170,7 +170,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, bool is_little_endian,
/* Not an ELF image nor an u-boot image, try a RAW image. */
if (kernel_size < 0) {
kernel_size = load_image_targphys(kernel_filename, ddr_base,
- ramsize);
+ ramsize, NULL);
boot_info.bootstrap_pc = ddr_base;
high = (ddr_base + kernel_size + 3) & ~3;
}
@@ -189,7 +189,8 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, bool is_little_endian,
if (initrd_size < 0) {
initrd_size = load_image_targphys(initrd_filename,
boot_info.initrd_start,
- ramsize - initrd_offset);
+ ramsize - initrd_offset,
+ NULL);
}
if (initrd_size < 0) {
error_report("could not load initrd '%s'",
diff --git a/hw/mips/boston.c b/hw/mips/boston.c
index 149a263bd5a..0a3a827b5f6 100644
--- a/hw/mips/boston.c
+++ b/hw/mips/boston.c
@@ -778,7 +778,7 @@ static void boston_mach_init(MachineState *machine)
if (machine->firmware) {
fw_size = load_image_targphys(machine->firmware,
- 0x1fc00000, 4 * MiB);
+ 0x1fc00000, 4 * MiB, NULL);
if (fw_size == -1) {
error_report("unable to load firmware image '%s'",
machine->firmware);
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index 2a8507b8b0a..5fe40eee65a 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -118,7 +118,7 @@ static uint64_t load_kernel(MIPSCPU *cpu)
initrd_size = 0;
initrd_offset = 0;
if (loaderparams.initrd_filename) {
- initrd_size = get_image_size(loaderparams.initrd_filename);
+ initrd_size = get_image_size(loaderparams.initrd_filename, NULL);
if (initrd_size > 0) {
initrd_offset = ROUND_UP(kernel_high, INITRD_PAGE_SIZE);
if (initrd_offset + initrd_size > loaderparams.ram_size) {
@@ -127,8 +127,9 @@ static uint64_t load_kernel(MIPSCPU *cpu)
exit(1);
}
initrd_size = load_image_targphys(loaderparams.initrd_filename,
- initrd_offset,
- loaderparams.ram_size - initrd_offset);
+ initrd_offset,
+ loaderparams.ram_size - initrd_offset,
+ NULL);
}
if (initrd_size == (target_ulong) -1) {
error_report("could not load initial ram disk '%s'",
@@ -264,7 +265,7 @@ static void mips_fuloong2e_init(MachineState *machine)
machine->firmware ?: FULOONG_BIOSNAME);
if (filename) {
bios_size = load_image_targphys(filename, 0x1fc00000LL,
- BIOS_SIZE);
+ BIOS_SIZE, NULL);
g_free(filename);
} else {
bios_size = -1;
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
index 7fb0b97a388..1d6bdc00917 100644
--- a/hw/mips/jazz.c
+++ b/hw/mips/jazz.c
@@ -245,7 +245,7 @@ static void mips_jazz_init(MachineState *machine,
machine->firmware ?: bios_name);
if (filename) {
bios_size = load_image_targphys(filename, 0xfff00000LL,
- MAGNUM_BIOS_SIZE);
+ MAGNUM_BIOS_SIZE, NULL);
g_free(filename);
} else {
bios_size = -1;
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 672083dec98..77dc895648f 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -371,7 +371,7 @@ static uint64_t load_kernel(CPUMIPSState *env)
initrd_size = 0;
initrd_offset = 0;
if (loaderparams.initrd_filename) {
- initrd_size = get_image_size(loaderparams.initrd_filename);
+ initrd_size = get_image_size(loaderparams.initrd_filename, NULL);
if (initrd_size > 0) {
initrd_offset = MAX(loader_memmap[LOADER_INITRD].base,
ROUND_UP(kernel_high, INITRD_PAGE_SIZE));
@@ -383,8 +383,9 @@ static uint64_t load_kernel(CPUMIPSState *env)
}
initrd_size = load_image_targphys(loaderparams.initrd_filename,
- initrd_offset,
- loaderparams.ram_size - initrd_offset);
+ initrd_offset,
+ loaderparams.ram_size - initrd_offset,
+ NULL);
}
if (initrd_size == (target_ulong) -1) {
@@ -650,7 +651,8 @@ static void mips_loongson3_virt_init(MachineState *machine)
if (filename) {
bios_size = load_image_targphys(filename,
virt_memmap[VIRT_BIOS_ROM].base,
- virt_memmap[VIRT_BIOS_ROM].size);
+ virt_memmap[VIRT_BIOS_ROM].size,
+ NULL);
g_free(filename);
} else {
bios_size = -1;
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 02da629b5af..806e8d50789 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -892,7 +892,7 @@ static uint64_t load_kernel(void)
initrd_size = 0;
initrd_offset = 0;
if (loaderparams.initrd_filename) {
- initrd_size = get_image_size(loaderparams.initrd_filename);
+ initrd_size = get_image_size(loaderparams.initrd_filename, NULL);
if (initrd_size > 0) {
/*
* The kernel allocates the bootmap memory in the low memory after
@@ -908,8 +908,9 @@ static uint64_t load_kernel(void)
exit(1);
}
initrd_size = load_image_targphys(loaderparams.initrd_filename,
- initrd_offset,
- loaderparams.ram_size - initrd_offset);
+ initrd_offset,
+ loaderparams.ram_size - initrd_offset,
+ NULL);
}
if (initrd_size == (target_ulong) -1) {
error_report("could not load initial ram disk '%s'",
@@ -1176,7 +1177,7 @@ void mips_malta_init(MachineState *machine)
machine->firmware ?: bios_name);
if (filename) {
bios_size = load_image_targphys(filename, FLASH_ADDRESS,
- BIOS_SIZE);
+ BIOS_SIZE, NULL);
g_free(filename);
} else {
bios_size = -1;
diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c
index 7797e61c7fc..0d4d6c0d875 100644
--- a/hw/nubus/nubus-device.c
+++ b/hw/nubus/nubus-device.c
@@ -68,7 +68,7 @@ static void nubus_device_realize(DeviceState *dev, Error **errp)
path = g_strdup(nd->romfile);
}
- size = get_image_size(path);
+ size = get_image_size(path, NULL);
if (size < 0) {
error_setg(errp, "failed to find romfile \"%s\"", nd->romfile);
g_free(path);
diff --git a/hw/openrisc/boot.c b/hw/openrisc/boot.c
index c81efe8138a..db6fea071e8 100644
--- a/hw/openrisc/boot.c
+++ b/hw/openrisc/boot.c
@@ -44,7 +44,8 @@ hwaddr openrisc_load_kernel(ram_addr_t ram_size,
if (kernel_size < 0) {
kernel_size = load_image_targphys(kernel_filename,
KERNEL_LOAD_ADDR,
- ram_size - KERNEL_LOAD_ADDR);
+ ram_size - KERNEL_LOAD_ADDR,
+ NULL);
high_addr = KERNEL_LOAD_ADDR + kernel_size;
}
@@ -74,7 +75,7 @@ hwaddr openrisc_load_initrd(void *fdt, const char *filename,
size = load_ramdisk(filename, start, mem_size - start);
if (size < 0) {
- size = load_image_targphys(filename, start, mem_size - start);
+ size = load_image_targphys(filename, start, mem_size - start, NULL);
if (size < 0) {
error_report("could not load ramdisk '%s'", filename);
exit(1);
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index acc03fd4707..738b0c41ae5 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2557,7 +2557,7 @@ static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom,
path = g_strdup(pdev->romfile);
}
- size = get_image_size(path);
+ size = get_image_size(path, NULL);
if (size < 0) {
error_setg(errp, "failed to find romfile \"%s\"", pdev->romfile);
return;
diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c
index 47fb016b4aa..192474e0aee 100644
--- a/hw/ppc/amigaone.c
+++ b/hw/ppc/amigaone.c
@@ -324,7 +324,7 @@ 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);
+ sz = load_image_targphys(filename, PROM_ADDR, PROM_SIZE, NULL);
if (sz <= 0 || sz > PROM_SIZE) {
error_report("Could not load firmware '%s'", filename);
exit(1);
@@ -413,7 +413,7 @@ static void amigaone_init(MachineState *machine)
loadaddr = ROUND_UP(loadaddr + 4 * MiB, 4 * KiB);
loadaddr = MAX(loadaddr, INITRD_MIN_ADDR);
sz = load_image_targphys(machine->initrd_filename, loadaddr,
- bi->bd_info - loadaddr);
+ bi->bd_info - loadaddr, NULL);
if (sz <= 0) {
error_report("Could not load initrd '%s'",
machine->initrd_filename);
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 3d69428f31c..418e1bb2fb4 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -1227,7 +1227,7 @@ void ppce500_init(MachineState *machine)
kernel_base = cur_base;
kernel_size = load_image_targphys(machine->kernel_filename,
cur_base,
- machine->ram_size - cur_base);
+ machine->ram_size - cur_base, NULL);
if (kernel_size < 0) {
error_report("could not load kernel '%s'",
machine->kernel_filename);
@@ -1241,7 +1241,8 @@ void ppce500_init(MachineState *machine)
if (machine->initrd_filename) {
initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;
initrd_size = load_image_targphys(machine->initrd_filename, initrd_base,
- machine->ram_size - initrd_base);
+ machine->ram_size - initrd_base,
+ NULL);
if (initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 0b6e096116a..004efc6b97b 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -188,7 +188,8 @@ static void ppc_core99_init(MachineState *machine)
if (bios_size <= 0) {
/* or load binary ROM image */
- bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE);
+ bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE,
+ NULL);
}
g_free(filename);
}
@@ -210,7 +211,8 @@ static void ppc_core99_init(MachineState *machine)
if (kernel_size < 0) {
kernel_size = load_image_targphys(machine->kernel_filename,
kernel_base,
- machine->ram_size - kernel_base);
+ machine->ram_size - kernel_base,
+ NULL);
}
if (kernel_size < 0) {
error_report("could not load kernel '%s'",
@@ -222,7 +224,8 @@ static void ppc_core99_init(MachineState *machine)
initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
initrd_size = load_image_targphys(machine->initrd_filename,
initrd_base,
- machine->ram_size - initrd_base);
+ machine->ram_size - initrd_base,
+ NULL);
if (initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
machine->initrd_filename);
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 40ae936ad8a..c7e44d49b07 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -143,7 +143,8 @@ static void ppc_heathrow_init(MachineState *machine)
if (bios_size <= 0) {
/* or if could not load ELF try loading a binary ROM image */
- bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE);
+ bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE,
+ NULL);
bios_addr = PROM_BASE;
}
g_free(filename);
@@ -166,7 +167,8 @@ static void ppc_heathrow_init(MachineState *machine)
if (kernel_size < 0) {
kernel_size = load_image_targphys(machine->kernel_filename,
kernel_base,
- machine->ram_size - kernel_base);
+ machine->ram_size - kernel_base,
+ NULL);
}
if (kernel_size < 0) {
error_report("could not load kernel '%s'",
@@ -179,7 +181,8 @@ static void ppc_heathrow_init(MachineState *machine)
KERNEL_GAP);
initrd_size = load_image_targphys(machine->initrd_filename,
initrd_base,
- machine->ram_size - initrd_base);
+ machine->ram_size - initrd_base,
+ NULL);
if (initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
machine->initrd_filename);
diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
index 93696ed381f..a9e706644c5 100644
--- a/hw/ppc/pegasos2.c
+++ b/hw/ppc/pegasos2.c
@@ -197,7 +197,8 @@ static void pegasos_init(MachineState *machine)
sz = load_elf(filename, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
ELFDATA2MSB, PPC_ELF_MACHINE, 0, 0);
if (sz <= 0) {
- sz = load_image_targphys(filename, pm->vof ? 0 : prom_addr, PROM_SIZE);
+ sz = load_image_targphys(filename, pm->vof ? 0 : prom_addr, PROM_SIZE,
+ NULL);
}
if (sz <= 0 || sz > PROM_SIZE) {
error_report("Could not load firmware '%s'", filename);
@@ -301,7 +302,7 @@ static void pegasos_init(MachineState *machine)
pm->initrd_addr = ROUND_UP(pm->initrd_addr, 4);
pm->initrd_addr = MAX(pm->initrd_addr, INITRD_MIN_ADDR);
sz = load_image_targphys(machine->initrd_filename, pm->initrd_addr,
- machine->ram_size - pm->initrd_addr);
+ machine->ram_size - pm->initrd_addr, NULL);
if (sz <= 0) {
error_report("Could not load initrd '%s'",
machine->initrd_filename);
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index f0469cdb8b6..1c0dadda876 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1068,7 +1068,8 @@ static void pnv_init(MachineState *machine)
exit(1);
}
- fw_size = load_image_targphys(fw_filename, pnv->fw_load_addr, FW_MAX_SIZE);
+ fw_size = load_image_targphys(fw_filename, pnv->fw_load_addr, FW_MAX_SIZE,
+ NULL);
if (fw_size < 0) {
error_report("Could not load OPAL firmware '%s'", fw_filename);
exit(1);
@@ -1080,7 +1081,8 @@ static void pnv_init(MachineState *machine)
long kernel_size;
kernel_size = load_image_targphys(machine->kernel_filename,
- KERNEL_LOAD_ADDR, KERNEL_MAX_SIZE);
+ KERNEL_LOAD_ADDR, KERNEL_MAX_SIZE,
+ NULL);
if (kernel_size < 0) {
error_report("Could not load kernel '%s'",
machine->kernel_filename);
@@ -1092,7 +1094,8 @@ static void pnv_init(MachineState *machine)
if (machine->initrd_filename) {
pnv->initrd_base = INITRD_LOAD_ADDR;
pnv->initrd_size = load_image_targphys(machine->initrd_filename,
- pnv->initrd_base, INITRD_MAX_SIZE);
+ pnv->initrd_base,
+ INITRD_MAX_SIZE, NULL);
if (pnv->initrd_size < 0) {
error_report("Could not load initial ram disk '%s'",
machine->initrd_filename);
diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
index 6fff0d8afbc..7c66912c103 100644
--- a/hw/ppc/ppc440_bamboo.c
+++ b/hw/ppc/ppc440_bamboo.c
@@ -242,7 +242,8 @@ static void bamboo_init(MachineState *machine)
/* Load initrd. */
if (initrd_filename) {
initrd_size = load_image_targphys(initrd_filename, RAMDISK_ADDR,
- machine->ram_size - RAMDISK_ADDR);
+ machine->ram_size - RAMDISK_ADDR,
+ NULL);
if (initrd_size < 0) {
error_report("could not load ram disk '%s' at %x",
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index c730cb3429e..0759e95cb64 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -280,7 +280,7 @@ static void ibm_40p_init(MachineState *machine)
bios_size = load_elf(filename, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
ELFDATA2MSB, PPC_ELF_MACHINE, 0, 0);
if (bios_size < 0) {
- bios_size = load_image_targphys(filename, BIOS_ADDR, BIOS_SIZE);
+ bios_size = load_image_targphys(filename, BIOS_ADDR, BIOS_SIZE, NULL);
}
if (bios_size < 0 || bios_size > BIOS_SIZE) {
error_report("Could not load bios image '%s'", filename);
@@ -379,7 +379,8 @@ static void ibm_40p_init(MachineState *machine)
kernel_base = KERNEL_LOAD_ADDR;
kernel_size = load_image_targphys(machine->kernel_filename,
kernel_base,
- machine->ram_size - kernel_base);
+ machine->ram_size - kernel_base,
+ NULL);
if (kernel_size < 0) {
error_report("could not load kernel '%s'",
machine->kernel_filename);
@@ -392,7 +393,8 @@ static void ibm_40p_init(MachineState *machine)
initrd_base = INITRD_LOAD_ADDR;
initrd_size = load_image_targphys(machine->initrd_filename,
initrd_base,
- machine->ram_size - initrd_base);
+ machine->ram_size - initrd_base,
+ NULL);
if (initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
machine->initrd_filename);
diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
index ee31bd8f349..68d3eacbff8 100644
--- a/hw/ppc/sam460ex.c
+++ b/hw/ppc/sam460ex.c
@@ -494,7 +494,8 @@ static void sam460ex_init(MachineState *machine)
if (machine->initrd_filename) {
initrd_size = load_image_targphys(machine->initrd_filename,
RAMDISK_ADDR,
- machine->ram_size - RAMDISK_ADDR);
+ machine->ram_size - RAMDISK_ADDR,
+ NULL);
if (initrd_size < 0) {
error_report("could not load ram disk '%s' at %x",
machine->initrd_filename, RAMDISK_ADDR);
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 6764730beb4..cdf2fdeadc2 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2854,7 +2854,7 @@ static void spapr_machine_init(MachineState *machine)
error_report("Could not find LPAR firmware '%s'", bios_name);
exit(1);
}
- fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
+ fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE, NULL);
if (fw_size <= 0) {
error_report("Could not load LPAR firmware '%s'", filename);
exit(1);
@@ -3115,9 +3115,9 @@ static void spapr_machine_init(MachineState *machine)
spapr->initrd_base = (spapr->kernel_addr + spapr->kernel_size
+ 0x1ffff) & ~0xffff;
spapr->initrd_size = load_image_targphys(initrd_filename,
- spapr->initrd_base,
- load_limit
- - spapr->initrd_base);
+ spapr->initrd_base,
+ load_limit - spapr->initrd_base,
+ NULL);
if (spapr->initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
initrd_filename);
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index c9969ae48a8..00d9ab75090 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -253,7 +253,7 @@ static void virtex_init(MachineState *machine)
/* If we failed loading ELF's try a raw image. */
kernel_size = load_image_targphys(kernel_filename,
boot_offset,
- machine->ram_size);
+ machine->ram_size, NULL);
boot_info.bootstrap_pc = boot_offset;
high = boot_info.bootstrap_pc + kernel_size + 8192;
}
@@ -264,7 +264,8 @@ static void virtex_init(MachineState *machine)
if (machine->initrd_filename) {
initrd_base = high = ROUND_UP(high, 4);
initrd_size = load_image_targphys(machine->initrd_filename,
- high, machine->ram_size - high);
+ high, machine->ram_size - high,
+ NULL);
if (initrd_size < 0) {
error_report("couldn't load ram disk '%s'",
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index 828a867be39..f38078c8c22 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -172,7 +172,8 @@ target_ulong riscv_load_firmware(const char *firmware_filename,
firmware_size = load_image_targphys_as(firmware_filename,
*firmware_load_addr,
- current_machine->ram_size, NULL);
+ current_machine->ram_size, NULL,
+ NULL);
if (firmware_size > 0) {
return *firmware_load_addr + firmware_size;
@@ -207,7 +208,7 @@ static void riscv_load_initrd(MachineState *machine, RISCVBootInfo *info)
size = load_ramdisk(filename, start, mem_size - start);
if (size == -1) {
- size = load_image_targphys(filename, start, mem_size - start);
+ size = load_image_targphys(filename, start, mem_size - start, NULL);
if (size == -1) {
error_report("could not load ramdisk '%s'", filename);
exit(1);
@@ -262,7 +263,7 @@ void riscv_load_kernel(MachineState *machine,
}
kernel_size = load_image_targphys_as(kernel_filename, kernel_start_addr,
- current_machine->ram_size, NULL);
+ current_machine->ram_size, NULL, NULL);
if (kernel_size > 0) {
info->kernel_size = kernel_size;
info->image_low_addr = kernel_start_addr;
diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
index 5b9004e9e15..ed91c631788 100644
--- a/hw/rx/rx-gdbsim.c
+++ b/hw/rx/rx-gdbsim.c
@@ -63,7 +63,7 @@ static void rx_load_image(RXCPU *cpu, const char *filename,
long kernel_size;
int i;
- kernel_size = load_image_targphys(filename, start, size);
+ kernel_size = load_image_targphys(filename, start, size, NULL);
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", filename);
exit(1);
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index 2f082396c73..3843d2a8505 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -169,7 +169,7 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
} else {
/* Try to load non-ELF file */
bios_size = load_image_targphys(bios_filename, ZIPL_IMAGE_START,
- 4096);
+ 4096, NULL);
ipl->bios_start_addr = ZIPL_IMAGE_START;
}
g_free(bios_filename);
@@ -188,7 +188,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
&pentry, NULL,
NULL, NULL, ELFDATA2MSB, EM_S390, 0, 0);
if (kernel_size < 0) {
- kernel_size = load_image_targphys(ipl->kernel, 0, ms->ram_size);
+ kernel_size = load_image_targphys(ipl->kernel, 0, ms->ram_size,
+ NULL);
if (kernel_size < 0) {
error_setg(errp, "could not load kernel '%s'", ipl->kernel);
return;
@@ -247,7 +248,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
initrd_offset += 0x100000;
}
initrd_size = load_image_targphys(ipl->initrd, initrd_offset,
- ms->ram_size - initrd_offset);
+ ms->ram_size - initrd_offset,
+ NULL);
if (initrd_size == -1) {
error_setg(errp, "could not load initrd '%s'", ipl->initrd);
return;
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index d68c94e82ef..010be6d5394 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -329,8 +329,9 @@ static void r2d_init(MachineState *machine)
int kernel_size;
kernel_size = load_image_targphys(kernel_filename,
- SDRAM_BASE + LINUX_LOAD_OFFSET,
- INITRD_LOAD_OFFSET - LINUX_LOAD_OFFSET);
+ SDRAM_BASE + LINUX_LOAD_OFFSET,
+ INITRD_LOAD_OFFSET - LINUX_LOAD_OFFSET,
+ NULL);
if (kernel_size < 0) {
error_report("qemu: could not load kernel '%s'", kernel_filename);
exit(1);
@@ -350,7 +351,8 @@ static void r2d_init(MachineState *machine)
initrd_size = load_image_targphys(initrd_filename,
SDRAM_BASE + INITRD_LOAD_OFFSET,
- SDRAM_SIZE - INITRD_LOAD_OFFSET);
+ SDRAM_SIZE - INITRD_LOAD_OFFSET,
+ NULL);
if (initrd_size < 0) {
error_report("qemu: could not load initrd '%s'", initrd_filename);
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 13e21a9c43e..7558b2ad839 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1340,7 +1340,7 @@ void smbios_entry_add(QemuOpts *opts, Error **errp)
return;
}
- size = get_image_size(val);
+ size = get_image_size(val, NULL);
if (size == -1 || size < sizeof(struct smbios_structure_header)) {
error_setg(errp, "Cannot read SMBIOS file %s", val);
return;
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index 09d2cec488c..631c6113b5c 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -349,7 +349,7 @@ static void leon3_generic_hw_init(MachineState *machine)
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
- bios_size = get_image_size(filename);
+ bios_size = get_image_size(filename, NULL);
} else {
bios_size = -1;
}
@@ -360,7 +360,7 @@ static void leon3_generic_hw_init(MachineState *machine)
}
if (bios_size > 0) {
- ret = load_image_targphys(filename, LEON3_PROM_OFFSET, bios_size);
+ ret = load_image_targphys(filename, LEON3_PROM_OFFSET, bios_size, NULL);
if (ret < 0 || ret > prom_size) {
error_report("could not load prom '%s'", filename);
exit(1);
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 8ac7e625ef1..53d7ae08ae9 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -245,7 +245,8 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
if (kernel_size < 0)
kernel_size = load_image_targphys(kernel_filename,
KERNEL_LOAD_ADDR,
- RAM_size - KERNEL_LOAD_ADDR);
+ RAM_size - KERNEL_LOAD_ADDR,
+ NULL);
if (kernel_size < 0) {
error_report("could not load kernel '%s'", kernel_filename);
exit(1);
@@ -256,7 +257,8 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
if (initrd_filename) {
*initrd_size = load_image_targphys(initrd_filename,
INITRD_LOAD_ADDR,
- RAM_size - INITRD_LOAD_ADDR);
+ RAM_size - INITRD_LOAD_ADDR,
+ NULL);
if ((int)*initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
initrd_filename);
@@ -700,7 +702,7 @@ static void prom_init(hwaddr addr, const char *bios_name)
translate_prom_address, &addr, NULL,
NULL, NULL, NULL, ELFDATA2MSB, EM_SPARC, 0, 0);
if (ret < 0 || ret > PROM_SIZE_MAX) {
- ret = load_image_targphys(filename, addr, PROM_SIZE_MAX);
+ ret = load_image_targphys(filename, addr, PROM_SIZE_MAX, NULL);
}
g_free(filename);
} else {
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index e9f9b0a4cb9..82c3e7c855b 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -182,7 +182,8 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,
if (kernel_size < 0) {
kernel_size = load_image_targphys(kernel_filename,
KERNEL_LOAD_ADDR,
- RAM_size - KERNEL_LOAD_ADDR);
+ RAM_size - KERNEL_LOAD_ADDR,
+ NULL);
}
if (kernel_size < 0) {
error_report("could not load kernel '%s'", kernel_filename);
@@ -195,7 +196,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,
*initrd_size = load_image_targphys(initrd_filename,
*initrd_addr,
- RAM_size - *initrd_addr);
+ RAM_size - *initrd_addr, NULL);
if ((int)*initrd_size < 0) {
error_report("could not load initial ram disk '%s'",
initrd_filename);
@@ -437,7 +438,7 @@ static void prom_init(hwaddr addr, const char *bios_name)
ret = load_elf(filename, NULL, translate_prom_address, &addr,
NULL, NULL, NULL, NULL, ELFDATA2MSB, EM_SPARCV9, 0, 0);
if (ret < 0 || ret > PROM_SIZE_MAX) {
- ret = load_image_targphys(filename, addr, PROM_SIZE_MAX);
+ ret = load_image_targphys(filename, addr, PROM_SIZE_MAX, NULL);
}
g_free(filename);
} else {
diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index 55de1a7a073..db3b0155495 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -381,7 +381,8 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
if (initrd_size < 0) {
initrd_size = load_image_targphys(initrd_filename,
cur_lowmem,
- lowmem_end - cur_lowmem);
+ lowmem_end - cur_lowmem,
+ NULL);
}
if (initrd_size < 0) {
error_report("could not load initrd '%s'", initrd_filename);
diff --git a/system/device_tree.c b/system/device_tree.c
index aa3fe9516f3..7850b90fa72 100644
--- a/system/device_tree.c
+++ b/system/device_tree.c
@@ -83,7 +83,7 @@ void *load_device_tree(const char *filename_path, int *sizep)
void *fdt = NULL;
*sizep = 0;
- dt_size = get_image_size(filename_path);
+ dt_size = get_image_size(filename_path, NULL);
if (dt_size < 0) {
error_report("Unable to get size of device tree file '%s'",
filename_path);
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 16/23] hw/core/loader: improve error handling in image loading functions
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (14 preceding siblings ...)
2025-10-28 7:48 ` [PULL 15/23] hw/core/loader: capture Error from load_image_targphys Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 17/23] hw/core/loader: add check for zero size in load_image_targphys_as Philippe Mathieu-Daudé
` (7 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Vishal Chourasia, Philippe Mathieu-Daudé, Aditya Gupta
From: Vishal Chourasia <vishalc@linux.ibm.com>
Add error checking for lseek() failure and provide better error
messages when image loading fails, including filenames and addresses.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Message-ID: <20251024130556.1942835-8-vishalc@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/loader.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 7aca4989ef0..d7c11c18f11 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -79,6 +79,10 @@ int64_t get_image_size(const char *filename, Error **errp)
if (fd < 0)
return -1;
size = lseek(fd, 0, SEEK_END);
+ if (size < 0) {
+ error_setg_errno(errp, errno, "lseek failure: %s", filename);
+ return -1;
+ }
close(fd);
return size;
}
@@ -132,11 +136,20 @@ ssize_t load_image_targphys_as(const char *filename,
ssize_t size;
size = get_image_size(filename, errp);
- if (size < 0 || size > max_sz) {
+ if (size < 0) {
return -1;
}
+
+ if (size > max_sz) {
+ error_setg(errp, "%s exceeds maximum image size (%s)",
+ filename, size_to_str(max_sz));
+ return -1;
+ }
+
if (size > 0) {
if (rom_add_file_fixed_as(filename, addr, -1, as) < 0) {
+ error_setg(errp, "could not load '%s' at %" HWADDR_PRIx,
+ filename, addr);
return -1;
}
}
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 17/23] hw/core/loader: add check for zero size in load_image_targphys_as
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (15 preceding siblings ...)
2025-10-28 7:48 ` [PULL 16/23] hw/core/loader: improve error handling in image loading functions Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 18/23] hw/core/loader: Pass errp to load_image_targphys_as() Philippe Mathieu-Daudé
` (6 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel; +Cc: Vishal Chourasia, Philippe Mathieu-Daudé
From: Vishal Chourasia <vishalc@linux.ibm.com>
Currently load_image_targphys_as() returns -1 on file open failure or
when max size is exceeded. Add an explicit check for zero-sized files
to catch this error early, since some callers check for size <= 0.
Also, remove the redundant size > 0 check later in the function.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Message-ID: <20251024130556.1942835-10-vishalc@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/loader.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index d7c11c18f11..590c5b02aa1 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -140,18 +140,21 @@ ssize_t load_image_targphys_as(const char *filename,
return -1;
}
+ if (size == 0) {
+ error_setg(errp, "empty file: %s", filename);
+ return -1;
+ }
+
if (size > max_sz) {
error_setg(errp, "%s exceeds maximum image size (%s)",
filename, size_to_str(max_sz));
return -1;
}
- if (size > 0) {
- if (rom_add_file_fixed_as(filename, addr, -1, as) < 0) {
- error_setg(errp, "could not load '%s' at %" HWADDR_PRIx,
- filename, addr);
- return -1;
- }
+ if (rom_add_file_fixed_as(filename, addr, -1, as) < 0) {
+ error_setg(errp, "could not load '%s' at %" HWADDR_PRIx,
+ filename, addr);
+ return -1;
}
return size;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 18/23] hw/core/loader: Pass errp to load_image_targphys_as()
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (16 preceding siblings ...)
2025-10-28 7:48 ` [PULL 17/23] hw/core/loader: add check for zero size in load_image_targphys_as Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 19/23] hw/ppc: Pass error_fatal to load_image_targphys() Philippe Mathieu-Daudé
` (5 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Vishal Chourasia, Philippe Mathieu-Daudé, Alistair Francis,
Alex Bennée
From: Vishal Chourasia <vishalc@linux.ibm.com>
Pass errp to load_image_targphys_as() in generic-loader and
guest-loader to capture detailed error information from the
loader functions.
Use error_prepend() instead of error_setg() to preserve the
underlying error details while adding context about which image
failed to load.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Message-ID: <20251024130556.1942835-12-vishalc@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/core/generic-loader.c | 4 ++--
hw/core/guest-loader.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
index 6689847c33f..433efb73872 100644
--- a/hw/core/generic-loader.c
+++ b/hw/core/generic-loader.c
@@ -149,13 +149,13 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
if (size < 0 || s->force_raw) {
/* Default to the maximum size being the machine's ram size */
size = load_image_targphys_as(s->file, s->addr,
- current_machine->ram_size, as, NULL);
+ current_machine->ram_size, as, errp);
} else {
s->addr = entry;
}
if (size < 0) {
- error_setg(errp, "Cannot load specified image %s", s->file);
+ error_prepend(errp, "Cannot load specified image %s: ", s->file);
return;
}
}
diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c
index 59f325ad9c5..618455e5566 100644
--- a/hw/core/guest-loader.c
+++ b/hw/core/guest-loader.c
@@ -101,9 +101,9 @@ static void guest_loader_realize(DeviceState *dev, Error **errp)
/* Default to the maximum size being the machine's ram size */
size = load_image_targphys_as(file, s->addr, current_machine->ram_size,
- NULL, NULL);
+ NULL, errp);
if (size < 0) {
- error_setg(errp, "Cannot load specified image %s", file);
+ error_prepend(errp, "Cannot load specified image %s: ", file);
return;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 19/23] hw/ppc: Pass error_fatal to load_image_targphys()
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (17 preceding siblings ...)
2025-10-28 7:48 ` [PULL 18/23] hw/core/loader: Pass errp to load_image_targphys_as() Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 20/23] nw/nvram/ds1225y: Fix nvram MemoryRegion owner Philippe Mathieu-Daudé
` (4 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Vishal Chourasia, Aditya Gupta, BALATON Zoltan,
Philippe Mathieu-Daudé, Bernhard Beschow, Mark Cave-Ayland,
Nicholas Piggin, Glenn Miles, Hervé Poussineau,
Harsh Prateek Bora, Edgar E. Iglesias, qemu-ppc
From: Vishal Chourasia <vishalc@linux.ibm.com>
Pass error_fatal to load_image_targphys() calls in ppc machine initialization
to capture detailed error information when loading firmware, kernel,
and initrd images.
Passing error_fatal automatically reports detailed error messages and
exits immediately on failure. Eliminating redundant exit(1) calls, as
error_fatal handles termination
The behavior remains functionally identical, but error messages now
come directly from the loader function with more context about the
failure cause.
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Message-ID: <20251024130556.1942835-14-vishalc@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ppc/amigaone.c | 13 ++-----------
hw/ppc/e500.c | 19 +++----------------
hw/ppc/mac_newworld.c | 16 +++-------------
hw/ppc/mac_oldworld.c | 16 +++-------------
hw/ppc/pegasos2.c | 9 ++-------
hw/ppc/pnv.c | 28 +++++-----------------------
hw/ppc/ppc440_bamboo.c | 8 +-------
hw/ppc/prep.c | 17 ++++-------------
hw/ppc/sam460ex.c | 7 +------
hw/ppc/spapr.c | 13 ++-----------
hw/ppc/virtex_ml507.c | 10 ++--------
11 files changed, 28 insertions(+), 128 deletions(-)
diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c
index 192474e0aee..74a1fa3b635 100644
--- a/hw/ppc/amigaone.c
+++ b/hw/ppc/amigaone.c
@@ -324,11 +324,7 @@ 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);
- exit(1);
- }
+ sz = load_image_targphys(filename, PROM_ADDR, PROM_SIZE, &error_fatal);
}
/* Articia S */
@@ -413,12 +409,7 @@ static void amigaone_init(MachineState *machine)
loadaddr = ROUND_UP(loadaddr + 4 * MiB, 4 * KiB);
loadaddr = MAX(loadaddr, INITRD_MIN_ADDR);
sz = load_image_targphys(machine->initrd_filename, loadaddr,
- bi->bd_info - loadaddr, NULL);
- if (sz <= 0) {
- error_report("Could not load initrd '%s'",
- machine->initrd_filename);
- exit(1);
- }
+ bi->bd_info - loadaddr, &error_fatal);
bi->initrd_start = loadaddr;
bi->initrd_end = loadaddr + sz;
}
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 418e1bb2fb4..8842f7f6b88 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -1226,14 +1226,8 @@ void ppce500_init(MachineState *machine)
if (machine->kernel_filename && !kernel_as_payload) {
kernel_base = cur_base;
kernel_size = load_image_targphys(machine->kernel_filename,
- cur_base,
- machine->ram_size - cur_base, NULL);
- if (kernel_size < 0) {
- error_report("could not load kernel '%s'",
- machine->kernel_filename);
- exit(1);
- }
-
+ cur_base, machine->ram_size - cur_base,
+ &error_fatal);
cur_base += kernel_size;
}
@@ -1242,14 +1236,7 @@ void ppce500_init(MachineState *machine)
initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;
initrd_size = load_image_targphys(machine->initrd_filename, initrd_base,
machine->ram_size - initrd_base,
- NULL);
-
- if (initrd_size < 0) {
- error_report("could not load initial ram disk '%s'",
- machine->initrd_filename);
- exit(1);
- }
-
+ &error_fatal);
cur_base = initrd_base + initrd_size;
}
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 004efc6b97b..951de4bae4b 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -189,7 +189,7 @@ static void ppc_core99_init(MachineState *machine)
if (bios_size <= 0) {
/* or load binary ROM image */
bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE,
- NULL);
+ &error_fatal);
}
g_free(filename);
}
@@ -212,12 +212,7 @@ static void ppc_core99_init(MachineState *machine)
kernel_size = load_image_targphys(machine->kernel_filename,
kernel_base,
machine->ram_size - kernel_base,
- NULL);
- }
- if (kernel_size < 0) {
- error_report("could not load kernel '%s'",
- machine->kernel_filename);
- exit(1);
+ &error_fatal);
}
/* load initrd */
if (machine->initrd_filename) {
@@ -225,12 +220,7 @@ static void ppc_core99_init(MachineState *machine)
initrd_size = load_image_targphys(machine->initrd_filename,
initrd_base,
machine->ram_size - initrd_base,
- NULL);
- if (initrd_size < 0) {
- error_report("could not load initial ram disk '%s'",
- machine->initrd_filename);
- exit(1);
- }
+ &error_fatal);
cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
} else {
cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index c7e44d49b07..cd2bb46442f 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -144,7 +144,7 @@ static void ppc_heathrow_init(MachineState *machine)
if (bios_size <= 0) {
/* or if could not load ELF try loading a binary ROM image */
bios_size = load_image_targphys(filename, PROM_BASE, PROM_SIZE,
- NULL);
+ &error_fatal);
bios_addr = PROM_BASE;
}
g_free(filename);
@@ -168,12 +168,7 @@ static void ppc_heathrow_init(MachineState *machine)
kernel_size = load_image_targphys(machine->kernel_filename,
kernel_base,
machine->ram_size - kernel_base,
- NULL);
- }
- if (kernel_size < 0) {
- error_report("could not load kernel '%s'",
- machine->kernel_filename);
- exit(1);
+ &error_fatal);
}
/* load initrd */
if (machine->initrd_filename) {
@@ -182,12 +177,7 @@ static void ppc_heathrow_init(MachineState *machine)
initrd_size = load_image_targphys(machine->initrd_filename,
initrd_base,
machine->ram_size - initrd_base,
- NULL);
- if (initrd_size < 0) {
- error_report("could not load initial ram disk '%s'",
- machine->initrd_filename);
- exit(1);
- }
+ &error_fatal);
cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
} else {
cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size + KERNEL_GAP);
diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
index a9e706644c5..3c02c53c3aa 100644
--- a/hw/ppc/pegasos2.c
+++ b/hw/ppc/pegasos2.c
@@ -198,7 +198,7 @@ static void pegasos_init(MachineState *machine)
ELFDATA2MSB, PPC_ELF_MACHINE, 0, 0);
if (sz <= 0) {
sz = load_image_targphys(filename, pm->vof ? 0 : prom_addr, PROM_SIZE,
- NULL);
+ &error_fatal);
}
if (sz <= 0 || sz > PROM_SIZE) {
error_report("Could not load firmware '%s'", filename);
@@ -302,12 +302,7 @@ static void pegasos_init(MachineState *machine)
pm->initrd_addr = ROUND_UP(pm->initrd_addr, 4);
pm->initrd_addr = MAX(pm->initrd_addr, INITRD_MIN_ADDR);
sz = load_image_targphys(machine->initrd_filename, pm->initrd_addr,
- machine->ram_size - pm->initrd_addr, NULL);
- if (sz <= 0) {
- error_report("Could not load initrd '%s'",
- machine->initrd_filename);
- exit(1);
- }
+ machine->ram_size - pm->initrd_addr, &error_fatal);
pm->initrd_size = sz;
}
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 1c0dadda876..895132da91b 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1009,7 +1009,6 @@ static void pnv_init(MachineState *machine)
PnvMachineClass *pmc = PNV_MACHINE_GET_CLASS(machine);
int max_smt_threads = pmc->max_smt_threads;
char *fw_filename;
- long fw_size;
uint64_t chip_ram_start = 0;
int i;
char *chip_typename;
@@ -1068,26 +1067,14 @@ static void pnv_init(MachineState *machine)
exit(1);
}
- fw_size = load_image_targphys(fw_filename, pnv->fw_load_addr, FW_MAX_SIZE,
- NULL);
- if (fw_size < 0) {
- error_report("Could not load OPAL firmware '%s'", fw_filename);
- exit(1);
- }
+ load_image_targphys(fw_filename, pnv->fw_load_addr, FW_MAX_SIZE,
+ &error_fatal);
g_free(fw_filename);
/* load kernel */
if (machine->kernel_filename) {
- long kernel_size;
-
- kernel_size = load_image_targphys(machine->kernel_filename,
- KERNEL_LOAD_ADDR, KERNEL_MAX_SIZE,
- NULL);
- if (kernel_size < 0) {
- error_report("Could not load kernel '%s'",
- machine->kernel_filename);
- exit(1);
- }
+ load_image_targphys(machine->kernel_filename,
+ KERNEL_LOAD_ADDR, KERNEL_MAX_SIZE, &error_fatal);
}
/* load initrd */
@@ -1095,12 +1082,7 @@ static void pnv_init(MachineState *machine)
pnv->initrd_base = INITRD_LOAD_ADDR;
pnv->initrd_size = load_image_targphys(machine->initrd_filename,
pnv->initrd_base,
- INITRD_MAX_SIZE, NULL);
- if (pnv->initrd_size < 0) {
- error_report("Could not load initial ram disk '%s'",
- machine->initrd_filename);
- exit(1);
- }
+ INITRD_MAX_SIZE, &error_fatal);
}
/* load dtb if passed */
diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
index 7c66912c103..7e739a21147 100644
--- a/hw/ppc/ppc440_bamboo.c
+++ b/hw/ppc/ppc440_bamboo.c
@@ -243,13 +243,7 @@ static void bamboo_init(MachineState *machine)
if (initrd_filename) {
initrd_size = load_image_targphys(initrd_filename, RAMDISK_ADDR,
machine->ram_size - RAMDISK_ADDR,
- NULL);
-
- if (initrd_size < 0) {
- error_report("could not load ram disk '%s' at %x",
- initrd_filename, RAMDISK_ADDR);
- exit(1);
- }
+ &error_fatal);
}
/* If we're loading a kernel directly, we must load the device tree too. */
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 0759e95cb64..c2fe16e985a 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -280,7 +280,8 @@ static void ibm_40p_init(MachineState *machine)
bios_size = load_elf(filename, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
ELFDATA2MSB, PPC_ELF_MACHINE, 0, 0);
if (bios_size < 0) {
- bios_size = load_image_targphys(filename, BIOS_ADDR, BIOS_SIZE, NULL);
+ bios_size = load_image_targphys(filename, BIOS_ADDR, BIOS_SIZE,
+ &error_fatal);
}
if (bios_size < 0 || bios_size > BIOS_SIZE) {
error_report("Could not load bios image '%s'", filename);
@@ -380,12 +381,7 @@ static void ibm_40p_init(MachineState *machine)
kernel_size = load_image_targphys(machine->kernel_filename,
kernel_base,
machine->ram_size - kernel_base,
- NULL);
- if (kernel_size < 0) {
- error_report("could not load kernel '%s'",
- machine->kernel_filename);
- exit(1);
- }
+ &error_fatal);
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base);
fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
/* load initrd */
@@ -394,12 +390,7 @@ static void ibm_40p_init(MachineState *machine)
initrd_size = load_image_targphys(machine->initrd_filename,
initrd_base,
machine->ram_size - initrd_base,
- NULL);
- if (initrd_size < 0) {
- error_report("could not load initial ram disk '%s'",
- machine->initrd_filename);
- exit(1);
- }
+ &error_fatal);
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_base);
fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
}
diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
index 68d3eacbff8..258d43f8d2d 100644
--- a/hw/ppc/sam460ex.c
+++ b/hw/ppc/sam460ex.c
@@ -495,12 +495,7 @@ static void sam460ex_init(MachineState *machine)
initrd_size = load_image_targphys(machine->initrd_filename,
RAMDISK_ADDR,
machine->ram_size - RAMDISK_ADDR,
- NULL);
- if (initrd_size < 0) {
- error_report("could not load ram disk '%s' at %x",
- machine->initrd_filename, RAMDISK_ADDR);
- exit(1);
- }
+ &error_fatal);
}
/* If we're loading a kernel directly, we must load the device tree too. */
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index cdf2fdeadc2..99b843ba2fa 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2854,11 +2854,7 @@ static void spapr_machine_init(MachineState *machine)
error_report("Could not find LPAR firmware '%s'", bios_name);
exit(1);
}
- fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE, NULL);
- if (fw_size <= 0) {
- error_report("Could not load LPAR firmware '%s'", filename);
- exit(1);
- }
+ fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE, &error_fatal);
/*
* if Secure VM (PEF) support is configured, then initialize it
@@ -3117,12 +3113,7 @@ static void spapr_machine_init(MachineState *machine)
spapr->initrd_size = load_image_targphys(initrd_filename,
spapr->initrd_base,
load_limit - spapr->initrd_base,
- NULL);
- if (spapr->initrd_size < 0) {
- error_report("could not load initial ram disk '%s'",
- initrd_filename);
- exit(1);
- }
+ &error_fatal);
}
}
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index 00d9ab75090..43a6d505a84 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -253,7 +253,7 @@ static void virtex_init(MachineState *machine)
/* If we failed loading ELF's try a raw image. */
kernel_size = load_image_targphys(kernel_filename,
boot_offset,
- machine->ram_size, NULL);
+ machine->ram_size, &error_fatal);
boot_info.bootstrap_pc = boot_offset;
high = boot_info.bootstrap_pc + kernel_size + 8192;
}
@@ -265,13 +265,7 @@ static void virtex_init(MachineState *machine)
initrd_base = high = ROUND_UP(high, 4);
initrd_size = load_image_targphys(machine->initrd_filename,
high, machine->ram_size - high,
- NULL);
-
- if (initrd_size < 0) {
- error_report("couldn't load ram disk '%s'",
- machine->initrd_filename);
- exit(1);
- }
+ &error_fatal);
high = ROUND_UP(high + initrd_size, 4);
}
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 20/23] nw/nvram/ds1225y: Fix nvram MemoryRegion owner
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (18 preceding siblings ...)
2025-10-28 7:48 ` [PULL 19/23] hw/ppc: Pass error_fatal to load_image_targphys() Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 21/23] hw/i386/intel_iommu: Remove an unused state field Philippe Mathieu-Daudé
` (3 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Akihiko Odaki, Philippe Mathieu-Daudé, Hervé Poussineau,
Aleksandar Rikalo
From: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
s points to the MemoryRegion itself. dev points to DS1225Y, the real
owner.
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251027-ds1225y-v1-1-406888eb495f@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/nvram/ds1225y.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/nvram/ds1225y.c b/hw/nvram/ds1225y.c
index dbfd0d2e536..0945e36652e 100644
--- a/hw/nvram/ds1225y.c
+++ b/hw/nvram/ds1225y.c
@@ -126,7 +126,7 @@ static void nvram_sysbus_realize(DeviceState *dev, Error **errp)
s->contents = g_malloc0(s->chip_size);
- memory_region_init_io(&s->iomem, OBJECT(s), &nvram_ops, s,
+ memory_region_init_io(&s->iomem, OBJECT(dev), &nvram_ops, s,
"nvram", s->chip_size);
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 21/23] hw/i386/intel_iommu: Remove an unused state field
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (19 preceding siblings ...)
2025-10-28 7:48 ` [PULL 20/23] nw/nvram/ds1225y: Fix nvram MemoryRegion owner Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 22/23] hw/riscv: Use generic hwaddr for firmware addresses Philippe Mathieu-Daudé
` (2 subsequent siblings)
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: CLEMENT MATHIEU--DRIF, Philippe Mathieu-Daudé,
Michael S. Tsirkin, Jason Wang, Yi Liu, Marcel Apfelbaum
From: CLEMENT MATHIEU--DRIF <clement.mathieu--drif@eviden.com>
dma_translation has been moved to x86-iommu and is no longer referenced.
Fixes: b6b49c2cd6c2 (intel-iommu: Move dma_translation to x86-iommu)
Signed-off-by: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251027075232.95262-1-clement.mathieu--drif@eviden.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/i386/intel_iommu.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h
index 47730ac3c76..b2f1ef9595d 100644
--- a/include/hw/i386/intel_iommu.h
+++ b/include/hw/i386/intel_iommu.h
@@ -307,7 +307,6 @@ struct IntelIOMMUState {
bool buggy_eim; /* Force buggy EIM unless eim=off */
uint8_t aw_bits; /* Host/IOVA address width (in bits) */
bool dma_drain; /* Whether DMA r/w draining enabled */
- bool dma_translation; /* Whether DMA translation supported */
bool pasid; /* Whether to support PASID */
bool fs1gp; /* First Stage 1-GByte Page Support */
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 22/23] hw/riscv: Use generic hwaddr for firmware addresses
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (20 preceding siblings ...)
2025-10-28 7:48 ` [PULL 21/23] hw/i386/intel_iommu: Remove an unused state field Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 23/23] hw/riscv: Widen OpenSBI dynamic info struct Philippe Mathieu-Daudé
2025-10-28 12:12 ` [PULL 00/23] Misc HW patches for 2025-10-28 Richard Henderson
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Anton Johansson, Philippe Mathieu-Daudé, Palmer Dabbelt,
Alistair Francis, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
qemu-riscv
From: Anton Johansson <anjo@rev.ng>
Signed-off-by: Anton Johansson <anjo@rev.ng>
Message-ID: <20251027-feature-single-binary-hw-v1-v2-1-44478d589ae9@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
[PMD: Do not update riscv_load_kernel()]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/riscv/boot.h | 18 +++++++++---------
hw/riscv/boot.c | 20 ++++++++++----------
hw/riscv/microchip_pfsoc.c | 2 +-
hw/riscv/sifive_u.c | 2 +-
hw/riscv/spike.c | 4 ++--
hw/riscv/virt.c | 2 +-
6 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/include/hw/riscv/boot.h b/include/hw/riscv/boot.h
index 7d59b2e6c63..51b0e13bd3e 100644
--- a/include/hw/riscv/boot.h
+++ b/include/hw/riscv/boot.h
@@ -43,18 +43,18 @@ bool riscv_is_32bit(RISCVHartArrayState *harts);
char *riscv_plic_hart_config_string(int hart_count);
void riscv_boot_info_init(RISCVBootInfo *info, RISCVHartArrayState *harts);
-target_ulong riscv_calc_kernel_start_addr(RISCVBootInfo *info,
- target_ulong firmware_end_addr);
-target_ulong riscv_find_and_load_firmware(MachineState *machine,
- const char *default_machine_firmware,
- hwaddr *firmware_load_addr,
- symbol_fn_t sym_cb);
+hwaddr riscv_calc_kernel_start_addr(RISCVBootInfo *info,
+ hwaddr firmware_end_addr);
+hwaddr riscv_find_and_load_firmware(MachineState *machine,
+ const char *default_machine_firmware,
+ hwaddr *firmware_load_addr,
+ symbol_fn_t sym_cb);
const char *riscv_default_firmware_name(RISCVHartArrayState *harts);
char *riscv_find_firmware(const char *firmware_filename,
const char *default_machine_firmware);
-target_ulong riscv_load_firmware(const char *firmware_filename,
- hwaddr *firmware_load_addr,
- symbol_fn_t sym_cb);
+hwaddr riscv_load_firmware(const char *firmware_filename,
+ hwaddr *firmware_load_addr,
+ symbol_fn_t sym_cb);
void riscv_load_kernel(MachineState *machine,
RISCVBootInfo *info,
target_ulong kernel_start_addr,
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index f38078c8c22..9510fca939b 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -74,8 +74,8 @@ void riscv_boot_info_init(RISCVBootInfo *info, RISCVHartArrayState *harts)
info->is_32bit = riscv_is_32bit(harts);
}
-target_ulong riscv_calc_kernel_start_addr(RISCVBootInfo *info,
- target_ulong firmware_end_addr) {
+hwaddr riscv_calc_kernel_start_addr(RISCVBootInfo *info,
+ hwaddr firmware_end_addr) {
if (info->is_32bit) {
return QEMU_ALIGN_UP(firmware_end_addr, 4 * MiB);
} else {
@@ -133,13 +133,13 @@ char *riscv_find_firmware(const char *firmware_filename,
return filename;
}
-target_ulong riscv_find_and_load_firmware(MachineState *machine,
- const char *default_machine_firmware,
- hwaddr *firmware_load_addr,
- symbol_fn_t sym_cb)
+hwaddr riscv_find_and_load_firmware(MachineState *machine,
+ const char *default_machine_firmware,
+ hwaddr *firmware_load_addr,
+ symbol_fn_t sym_cb)
{
char *firmware_filename;
- target_ulong firmware_end_addr = *firmware_load_addr;
+ hwaddr firmware_end_addr = *firmware_load_addr;
firmware_filename = riscv_find_firmware(machine->firmware,
default_machine_firmware);
@@ -154,9 +154,9 @@ target_ulong riscv_find_and_load_firmware(MachineState *machine,
return firmware_end_addr;
}
-target_ulong riscv_load_firmware(const char *firmware_filename,
- hwaddr *firmware_load_addr,
- symbol_fn_t sym_cb)
+hwaddr riscv_load_firmware(const char *firmware_filename,
+ hwaddr *firmware_load_addr,
+ symbol_fn_t sym_cb)
{
uint64_t firmware_entry, firmware_end;
ssize_t firmware_size;
diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c
index 4c939d8e96c..a17f62cd082 100644
--- a/hw/riscv/microchip_pfsoc.c
+++ b/hw/riscv/microchip_pfsoc.c
@@ -521,7 +521,7 @@ static void microchip_icicle_kit_machine_init(MachineState *machine)
uint64_t mem_low_size, mem_high_size;
hwaddr firmware_load_addr;
const char *firmware_name;
- target_ulong firmware_end_addr, kernel_start_addr;
+ hwaddr firmware_end_addr, kernel_start_addr;
uint64_t kernel_entry;
uint64_t fdt_load_addr;
DriveInfo *dinfo = drive_get(IF_SD, 0, 0);
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 3e1ed209ca9..a7492aa27a4 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -515,7 +515,7 @@ static void sifive_u_machine_init(MachineState *machine)
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *flash0 = g_new(MemoryRegion, 1);
hwaddr start_addr = memmap[SIFIVE_U_DEV_DRAM].base;
- target_ulong firmware_end_addr, kernel_start_addr;
+ hwaddr firmware_end_addr, kernel_start_addr;
const char *firmware_name;
uint32_t start_addr_hi32 = 0x00000000;
uint32_t fdt_load_addr_hi32 = 0x00000000;
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
index 641aae8c019..b0bab3fe008 100644
--- a/hw/riscv/spike.c
+++ b/hw/riscv/spike.c
@@ -197,9 +197,9 @@ static void spike_board_init(MachineState *machine)
SpikeState *s = SPIKE_MACHINE(machine);
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *mask_rom = g_new(MemoryRegion, 1);
- target_ulong firmware_end_addr = memmap[SPIKE_DRAM].base;
+ hwaddr firmware_end_addr = memmap[SPIKE_DRAM].base;
hwaddr firmware_load_addr = memmap[SPIKE_DRAM].base;
- target_ulong kernel_start_addr;
+ hwaddr kernel_start_addr;
char *firmware_name;
uint64_t fdt_load_addr;
uint64_t kernel_entry;
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 47e573f85ab..17909206c7e 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1434,7 +1434,7 @@ static void virt_machine_done(Notifier *notifier, void *data)
machine_done);
MachineState *machine = MACHINE(s);
hwaddr start_addr = s->memmap[VIRT_DRAM].base;
- target_ulong firmware_end_addr, kernel_start_addr;
+ hwaddr firmware_end_addr, kernel_start_addr;
const char *firmware_name = riscv_default_firmware_name(&s->soc[0]);
uint64_t fdt_load_addr;
uint64_t kernel_entry = 0;
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PULL 23/23] hw/riscv: Widen OpenSBI dynamic info struct
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (21 preceding siblings ...)
2025-10-28 7:48 ` [PULL 22/23] hw/riscv: Use generic hwaddr for firmware addresses Philippe Mathieu-Daudé
@ 2025-10-28 7:48 ` Philippe Mathieu-Daudé
2025-10-28 12:12 ` [PULL 00/23] Misc HW patches for 2025-10-28 Richard Henderson
23 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-28 7:48 UTC (permalink / raw)
To: qemu-devel
Cc: Anton Johansson, Alistair Francis, Philippe Mathieu-Daudé,
Palmer Dabbelt, Weiwei Li, Daniel Henrique Barboza, Liu Zhiwei,
qemu-riscv
From: Anton Johansson <anjo@rev.ng>
Since fw_dynamic_info is only used for non 32 bit targets, target_long
is int64_t anyway. Rename struct to fw_dynamic_info64 and use int64_t.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251027-feature-single-binary-hw-v1-v2-3-44478d589ae9@rev.ng>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/riscv/boot_opensbi.h | 14 +++++++-------
hw/riscv/boot.c | 22 ++++++++++++----------
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/include/hw/riscv/boot_opensbi.h b/include/hw/riscv/boot_opensbi.h
index 18664a174b5..ab9999be3f7 100644
--- a/include/hw/riscv/boot_opensbi.h
+++ b/include/hw/riscv/boot_opensbi.h
@@ -29,17 +29,17 @@ enum sbi_scratch_options {
};
/** Representation dynamic info passed by previous booting stage */
-struct fw_dynamic_info {
+struct fw_dynamic_info64 {
/** Info magic */
- target_long magic;
+ int64_t magic;
/** Info version */
- target_long version;
+ int64_t version;
/** Next booting stage address */
- target_long next_addr;
+ int64_t next_addr;
/** Next booting stage mode */
- target_long next_mode;
+ int64_t next_mode;
/** Options for OpenSBI library */
- target_long options;
+ int64_t options;
/**
* Preferred boot HART id
*
@@ -55,7 +55,7 @@ struct fw_dynamic_info {
* stage can set it to -1UL which will force the FW_DYNAMIC firmware
* to use the relocation lottery mechanism.
*/
- target_long boot_hart;
+ int64_t boot_hart;
};
/** Representation dynamic info passed by previous booting stage */
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index 9510fca939b..75f34287ff1 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -388,7 +388,8 @@ void riscv_rom_copy_firmware_info(MachineState *machine,
uint64_t kernel_entry)
{
struct fw_dynamic_info32 dinfo32;
- struct fw_dynamic_info dinfo;
+ struct fw_dynamic_info64 dinfo64;
+ void *dinfo_ptr = NULL;
size_t dinfo_len;
if (riscv_is_32bit(harts)) {
@@ -398,15 +399,17 @@ void riscv_rom_copy_firmware_info(MachineState *machine,
dinfo32.next_addr = cpu_to_le32(kernel_entry);
dinfo32.options = 0;
dinfo32.boot_hart = 0;
+ dinfo_ptr = &dinfo32;
dinfo_len = sizeof(dinfo32);
} else {
- dinfo.magic = cpu_to_le64(FW_DYNAMIC_INFO_MAGIC_VALUE);
- dinfo.version = cpu_to_le64(FW_DYNAMIC_INFO_VERSION);
- dinfo.next_mode = cpu_to_le64(FW_DYNAMIC_INFO_NEXT_MODE_S);
- dinfo.next_addr = cpu_to_le64(kernel_entry);
- dinfo.options = 0;
- dinfo.boot_hart = 0;
- dinfo_len = sizeof(dinfo);
+ dinfo64.magic = cpu_to_le64(FW_DYNAMIC_INFO_MAGIC_VALUE);
+ dinfo64.version = cpu_to_le64(FW_DYNAMIC_INFO_VERSION);
+ dinfo64.next_mode = cpu_to_le64(FW_DYNAMIC_INFO_NEXT_MODE_S);
+ dinfo64.next_addr = cpu_to_le64(kernel_entry);
+ dinfo64.options = 0;
+ dinfo64.boot_hart = 0;
+ dinfo_ptr = &dinfo64;
+ dinfo_len = sizeof(dinfo64);
}
/**
@@ -420,8 +423,7 @@ void riscv_rom_copy_firmware_info(MachineState *machine,
}
rom_add_blob_fixed_as("mrom.finfo",
- riscv_is_32bit(harts) ?
- (void *)&dinfo32 : (void *)&dinfo,
+ dinfo_ptr,
dinfo_len,
rom_base + reset_vec_size,
&address_space_memory);
--
2.51.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PULL 00/23] Misc HW patches for 2025-10-28
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
` (22 preceding siblings ...)
2025-10-28 7:48 ` [PULL 23/23] hw/riscv: Widen OpenSBI dynamic info struct Philippe Mathieu-Daudé
@ 2025-10-28 12:12 ` Richard Henderson
23 siblings, 0 replies; 27+ messages in thread
From: Richard Henderson @ 2025-10-28 12:12 UTC (permalink / raw)
To: qemu-devel
On 10/28/25 08:48, Philippe Mathieu-Daudé wrote:
> The following changes since commit 36076d24f04ea9dc3357c0fbe7bb14917375819c:
>
> Merge tag 'next-pr-pull-request' ofhttps://gitlab.com/berrange/qemu into staging (2025-10-25 10:42:55 +0200)
>
> are available in the Git repository at:
>
> https://github.com/philmd/qemu.git tags/hw-misc-20251028
>
> for you to fetch changes up to 7dbe2d7df094aa8af2d8fcdf08fccce70b1ca5bc:
>
> hw/riscv: Widen OpenSBI dynamic info struct (2025-10-28 08:19:18 +0100)
>
> ----------------------------------------------------------------
> Misc HW patches
>
> Various fixes and cleanups:
> - Set FPCR exception flag bits for HPPA non-trapped exceptions
> - ConvertVirtIONet::vlans from pointer to array
> and remove VMSTATE_BUFFER_POINTER_UNSAFE()
> - Remove redundant QOM typedef when OBJECT_DECLARE_SIMPLE_TYPE() is used
> - Have various QDev / SysBus helpers take a const device argument
> - Improve errors when loaders parse images
> - RemoveIntelIOMMUState::dma_translation leftover
> - Remove most target_[u]long uses in hw/riscv/
> - Fix DS1225Y MemoryRegion owner
> - Simplification refactors on Raven PCI Host Bridge
> ----------------------------------------------------------------
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.
r~
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PULL 03/23] hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer
2025-10-28 7:48 ` [PULL 03/23] hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer Philippe Mathieu-Daudé
@ 2025-12-09 12:15 ` Fiona Ebner
2025-12-09 20:07 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 27+ messages in thread
From: Fiona Ebner @ 2025-12-09 12:15 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Michael Tokarev, Akihiko Odaki, Lei Yang, Michael S. Tsirkin,
Jason Wang
Hi,
Am 28.10.25 um 11:19 AM schrieb Philippe Mathieu-Daudé:
> From: Michael Tokarev <mjt@tls.msk.ru>
>
> This field is a fixed-size buffer (number of elements is MAX_VLAN,
> known at build time). There's no need to allocate it dynamically,
> it can be made an integral part of VirtIONet structure.
>
> This field is the only user of VMSTATE_BUFFER_POINTER_UNSAFE() macro.
>
> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
> Tested-by: Lei Yang <leiyang@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> Message-ID: <20251023135316.31128-2-mjt@tls.msk.ru>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
unfortunately, after this commit, loading a VM state taken with v10.1.2
or older doesn't work anymore:
> qemu-system-x86_64: Missing section footer for 0000:00:13.0/virtio-net
> qemu-system-x86_64: Section footer error, section_id: 41
Reproducer below [0].
Reverting
> 58341158d0 migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro
> 3a9cd2a4a1 hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer
in current master makes it work again.
I'm also seeing the following when a guest is actually running:
> kvm: VQ 1 size 0x100 < last_avail_idx 0x9 - used_idx 0x3e30
> kvm: load of migration failed: Operation not permitted: error while loading state for instance 0x0 of device '0000:00:13.0/virtio-net': Failed to load element of type virtio for virtio: -1
and here too a revert of the two commits seems to help :)
Best Regards,
Fiona
[0]:
> [I] root@pve9a1 ~# cat snapshot-virtio-net.sh
> #!/bin/bash
> rm /tmp/disk.qcow2
> args="
> -netdev type=tap,id=net1,ifname=tap104i1,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on
> -device virtio-net-pci,mac=BC:24:11:32:3C:69,netdev=net1,bus=pci.0,addr=0x13,id=net1
> -machine type=pc-i440fx-10.1
> "
> $1/qemu-img create -f qcow2 /tmp/disk.qcow2 1G
> $1/qemu-system-x86_64 --qmp stdio --blockdev qcow2,node-name=node0,file.driver=file,file.filename=/tmp/disk.qcow2 $args <<EOF
> {"execute": "qmp_capabilities"}
> {"execute": "snapshot-save", "arguments": { "job-id": "save0", "tag": "snap", "vmstate": "node0", "devices": ["node0"] } }
> {"execute": "quit"}
> EOF
> $2/qemu-system-x86_64 --qmp stdio --blockdev qcow2,node-name=node0,file.driver=file,file.filename=/tmp/disk.qcow2 $args -loadvm snap
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PULL 03/23] hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer
2025-12-09 12:15 ` Fiona Ebner
@ 2025-12-09 20:07 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 27+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-12-09 20:07 UTC (permalink / raw)
To: Fiona Ebner, qemu-devel
Cc: Michael Tokarev, Akihiko Odaki, Lei Yang, Michael S. Tsirkin,
Jason Wang
Hi Fiona,
On 9/12/25 13:15, Fiona Ebner wrote:
> Hi,
>
> Am 28.10.25 um 11:19 AM schrieb Philippe Mathieu-Daudé:
>> From: Michael Tokarev <mjt@tls.msk.ru>
>>
>> This field is a fixed-size buffer (number of elements is MAX_VLAN,
>> known at build time). There's no need to allocate it dynamically,
>> it can be made an integral part of VirtIONet structure.
>>
>> This field is the only user of VMSTATE_BUFFER_POINTER_UNSAFE() macro.
>>
>> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
>> Tested-by: Lei Yang <leiyang@redhat.com>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
>> Message-ID: <20251023135316.31128-2-mjt@tls.msk.ru>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> unfortunately, after this commit, loading a VM state taken with v10.1.2
> or older doesn't work anymore:
>
>> qemu-system-x86_64: Missing section footer for 0000:00:13.0/virtio-net
>> qemu-system-x86_64: Section footer error, section_id: 41
>
> Reproducer below [0].
>
>
> Reverting
>
>> 58341158d0 migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro
>> 3a9cd2a4a1 hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer
>
> in current master makes it work again.
Thanks for the report. Commits reverted.
>
>
> I'm also seeing the following when a guest is actually running:
>
>> kvm: VQ 1 size 0x100 < last_avail_idx 0x9 - used_idx 0x3e30
>> kvm: load of migration failed: Operation not permitted: error while loading state for instance 0x0 of device '0000:00:13.0/virtio-net': Failed to load element of type virtio for virtio: -1
>
> and here too a revert of the two commits seems to help :)
>
>
> Best Regards,
> Fiona
>
>
> [0]:
>
>> [I] root@pve9a1 ~# cat snapshot-virtio-net.sh
>> #!/bin/bash
>> rm /tmp/disk.qcow2
>> args="
>> -netdev type=tap,id=net1,ifname=tap104i1,script=/usr/libexec/qemu-server/pve-bridge,downscript=/usr/libexec/qemu-server/pve-bridgedown,vhost=on
>> -device virtio-net-pci,mac=BC:24:11:32:3C:69,netdev=net1,bus=pci.0,addr=0x13,id=net1
>> -machine type=pc-i440fx-10.1
>> "
>> $1/qemu-img create -f qcow2 /tmp/disk.qcow2 1G
>> $1/qemu-system-x86_64 --qmp stdio --blockdev qcow2,node-name=node0,file.driver=file,file.filename=/tmp/disk.qcow2 $args <<EOF
>> {"execute": "qmp_capabilities"}
>> {"execute": "snapshot-save", "arguments": { "job-id": "save0", "tag": "snap", "vmstate": "node0", "devices": ["node0"] } }
>> {"execute": "quit"}
>> EOF
>> $2/qemu-system-x86_64 --qmp stdio --blockdev qcow2,node-name=node0,file.driver=file,file.filename=/tmp/disk.qcow2 $args -loadvm snap
>
>
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2025-12-09 20:08 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 7:48 [PULL 00/23] Misc HW patches for 2025-10-28 Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 01/23] target/hppa: Set FPCR exception flag bits for non-trapped exceptions Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 02/23] qom: remove redundant typedef when use OBJECT_DECLARE_SIMPLE_TYPE Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 03/23] hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer Philippe Mathieu-Daudé
2025-12-09 12:15 ` Fiona Ebner
2025-12-09 20:07 ` Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 04/23] migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 05/23] hw/pci-host/raven: Simplify creating PCI facing part Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 06/23] hw/pci-host/raven: Simplify " Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 07/23] hw/pci-host/raven: Simplify host bridge type declaration Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 08/23] hw/pci-host/raven: Use DEFINE_TYPES macro Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 09/23] hw/pci-host/raven: Simplify PCI bus creation Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 10/23] hw/qdev: Have qdev_get_gpio_out_connector() take const DeviceState arg Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 11/23] hw/sysbus: Have various helpers take a const SysBusDevice argument Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 12/23] hw/uefi: Include missing 'system/memory.h' header Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 13/23] hw/int/loongarch: " Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 14/23] hw/core/loader: Use qemu_open() instead of open() in get_image_size() Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 15/23] hw/core/loader: capture Error from load_image_targphys Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 16/23] hw/core/loader: improve error handling in image loading functions Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 17/23] hw/core/loader: add check for zero size in load_image_targphys_as Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 18/23] hw/core/loader: Pass errp to load_image_targphys_as() Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 19/23] hw/ppc: Pass error_fatal to load_image_targphys() Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 20/23] nw/nvram/ds1225y: Fix nvram MemoryRegion owner Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 21/23] hw/i386/intel_iommu: Remove an unused state field Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 22/23] hw/riscv: Use generic hwaddr for firmware addresses Philippe Mathieu-Daudé
2025-10-28 7:48 ` [PULL 23/23] hw/riscv: Widen OpenSBI dynamic info struct Philippe Mathieu-Daudé
2025-10-28 12:12 ` [PULL 00/23] Misc HW patches for 2025-10-28 Richard Henderson
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).