Re: [PATCH 20/20] hw/arm: xilinx_zynq: Store boot info in the machine state

Alistair <[email protected]>
Newsgroups org.nongnu.qemu-devel,org.nongnu.qemu-arm
Message-ID <[email protected]>
On Thu, 2026-08-13 at 23:49 +0800, Bin Meng wrote:
> arm_load_kernel() keeps a pointer to the boot info struct for the
> lifetime of the VM, so the struct logically belongs to the machine
> rather than to a file scoped static object.
> 
> Move the boot info into the existing ZynqMachineState.
> 
> As in the xlnx-zcu102 and raspi machines, the boot info belongs to
> the machine rather than to a static object:
> 
> 4d1ac883a7 ("hw/arm: xlnx-zcu102: Move arm_boot_info into
> XlnxZCU102")
> 0f15c6e338 ("hw/arm/raspi: Move arm_boot_info structure to
> RaspiMachineState")
> 
> Signed-off-by: Bin Meng <[email protected]>

Reviewed-by: Alistair Francis <[email protected]>

Alistair

> 
> ---
> 
>  hw/arm/xilinx_zynq.c         | 17 ++++++++---------
>  include/hw/arm/xilinx_zynq.h |  2 ++
>  2 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
> index 6c83439017..f314897540 100644
> --- a/hw/arm/xilinx_zynq.c
> +++ b/hw/arm/xilinx_zynq.c
> @@ -103,8 +103,6 @@ static void zynq_write_board_setup(ARMCPU *cpu,
>                         sizeof(board_setup_blob), BOARD_SETUP_ADDR);
>  }
>  
> -static struct arm_boot_info zynq_binfo = {};
> -
>  static void gem_init(uint32_t base, qemu_irq irq)
>  {
>      DeviceState *dev;
> @@ -268,7 +266,7 @@ static void zynq_init(MachineState *machine)
>      busdev = SYS_BUS_DEVICE(dev);
>      sysbus_realize_and_unref(busdev, &error_fatal);
>      sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE);
> -    zynq_binfo.gic_cpu_if_addr = MPCORE_PERIPHBASE + 0x100;
> +    zynq_machine->bootinfo.gic_cpu_if_addr = MPCORE_PERIPHBASE +
> 0x100;
>      sysbus_create_varargs("l2x0", MPCORE_PERIPHBASE + 0x2000, NULL);
>      for (n = 0; n < smp_cpus; n++) {
>          /* See "hw/intc/arm_gic.h" for the IRQ line association */
> @@ -444,13 +442,14 @@ static void zynq_init(MachineState *machine)
>      create_unimplemented_device("zynq.qos301_dmac", 0xF8947000,
> 0x130);
>      create_unimplemented_device("zynq.qos301_iou", 0xF8948000,
> 0x130);
>  
> -    zynq_binfo.ram_size = machine->ram_size;
> -    zynq_binfo.board_id = 0xd32;
> -    zynq_binfo.loader_start = 0;
> -    zynq_binfo.board_setup_addr = BOARD_SETUP_ADDR;
> -    zynq_binfo.write_board_setup = zynq_write_board_setup;
> +    zynq_machine->bootinfo.ram_size = machine->ram_size;
> +    zynq_machine->bootinfo.board_id = 0xd32;
> +    zynq_machine->bootinfo.loader_start = 0;
> +    zynq_machine->bootinfo.board_setup_addr = BOARD_SETUP_ADDR;
> +    zynq_machine->bootinfo.write_board_setup =
> zynq_write_board_setup;
>  
> -    arm_load_kernel(zynq_machine->cpu[0], machine, &zynq_binfo);
> +    arm_load_kernel(zynq_machine->cpu[0], machine,
> +                    &zynq_machine->bootinfo);
>  }
>  
>  static void zynq_machine_class_init(ObjectClass *oc, const void
> *data)
> diff --git a/include/hw/arm/xilinx_zynq.h
> b/include/hw/arm/xilinx_zynq.h
> index cefb7789ff..669c516ad1 100644
> --- a/include/hw/arm/xilinx_zynq.h
> +++ b/include/hw/arm/xilinx_zynq.h
> @@ -14,6 +14,7 @@
>  
>  #include "target/arm/cpu-qom.h"
>  #include "hw/core/qdev-clock.h"
> +#include "hw/arm/boot.h"
>  
>  #define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9")
>  OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE)
> @@ -25,6 +26,7 @@ struct ZynqMachineState {
>      Clock *ps_clk;
>      ARMCPU *cpu[ZYNQ_MAX_CPUS];
>      uint8_t boot_mode;
> +    struct arm_boot_info bootinfo;
>  };
>  
>  #endif /* QEMU_ARM_ZYNQ_H */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.