Re: [PATCH 1/4] hw/riscv/boot: Make RISCVBootInfo const where possible
Portia Stephens <[email protected]>
| Newsgroups | org.nongnu.qemu-riscv,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
On 24/8/2026 3:56 PM, Joel Stanley wrote: > As with riscv_load_firmware, take a const pointer in functions that > reads the structure without writing. > > Suggested-by: Philippe Mathieu-Daudé <[email protected]> > Signed-off-by: Joel Stanley <[email protected]> > --- > include/hw/riscv/boot.h | 6 +++--- > hw/riscv/boot.c | 6 +++--- > 2 files changed, 6 insertions(+), 6 deletions(-) Reviewed-by: Portia Stephens <[email protected]> > > diff --git a/include/hw/riscv/boot.h b/include/hw/riscv/boot.h > index 4e7bd9a225ef..d23f45d78077 100644 > --- a/include/hw/riscv/boot.h > +++ b/include/hw/riscv/boot.h > @@ -50,10 +50,10 @@ void riscv_boot_info_init(RISCVBootInfo *info, RISCVHartArrayState *harts); > void riscv_boot_info_init_discontig_mem(RISCVBootInfo *info, > RISCVHartArrayState *harts, > hwaddr low_start, hwaddr low_size); > -vaddr riscv_calc_kernel_start_addr(RISCVBootInfo *info, > +vaddr riscv_calc_kernel_start_addr(const RISCVBootInfo *info, > hwaddr firmware_end_addr); > hwaddr riscv_find_and_load_firmware(MachineState *machine, > - RISCVBootInfo *info, > + const RISCVBootInfo *info, > const char *default_machine_firmware, > hwaddr *firmware_load_addr, > symbol_fn_t sym_cb); > @@ -71,7 +71,7 @@ void riscv_load_kernel(MachineState *machine, > bool load_initrd, > symbol_fn_t sym_cb); > uint64_t riscv_compute_fdt_addr(hwaddr dram_base, hwaddr dram_size, > - MachineState *ms, RISCVBootInfo *info); > + MachineState *ms, const RISCVBootInfo *info); > void riscv_load_fdt(hwaddr fdt_addr, void *fdt); > void riscv_setup_rom_reset_vec(MachineState *machine, RISCVHartArrayState *harts, > hwaddr saddr, > diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c > index 5e2dfa091a13..4ac0b8ef6581 100644 > --- a/hw/riscv/boot.c > +++ b/hw/riscv/boot.c > @@ -91,7 +91,7 @@ void riscv_boot_info_init_discontig_mem(RISCVBootInfo *info, > info->ram_low_size = low_size; > } > > -vaddr riscv_calc_kernel_start_addr(RISCVBootInfo *info, > +vaddr riscv_calc_kernel_start_addr(const RISCVBootInfo *info, > hwaddr firmware_end_addr) { > if (info->is_32bit) { > return QEMU_ALIGN_UP(firmware_end_addr, 4 * MiB); > @@ -151,7 +151,7 @@ char *riscv_find_firmware(const char *firmware_filename, > } > > hwaddr riscv_find_and_load_firmware(MachineState *machine, > - RISCVBootInfo *info, > + const RISCVBootInfo *info, > const char *default_machine_firmware, > hwaddr *firmware_load_addr, > symbol_fn_t sym_cb) > @@ -348,7 +348,7 @@ out: > * The FDT is fdt_packed() during the calculation. > */ > uint64_t riscv_compute_fdt_addr(hwaddr dram_base, hwaddr dram_size, > - MachineState *ms, RISCVBootInfo *info) > + MachineState *ms, const RISCVBootInfo *info) > { > int ret = fdt_pack(ms->fdt); > hwaddr dram_end, temp;