From: Bibo Mao Date: Fri, 17 Oct 2025 06:45:17 +0000 (+0800) Subject: hw/loongarch/virt: Add field ram_end in LoongArchVirtMachineState X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4150801bfd46a5b797dd1b7e5ec8fb5ac55f2cb7;p=thirdparty%2Fqemu.git hw/loongarch/virt: Add field ram_end in LoongArchVirtMachineState DRAM region is dynamically set and the last valid physical address region with LoongArch Virt Machine. To record the last valid physical address, field ram_end is added in structure LoongArchVirtMachineState. In future end address of DRAM cannot exceed base addres of PCIE 64-bit MMIO region. Signed-off-by: Bibo Mao Reviewed-by: Song Gao --- diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 6efa15da47..9d189e5a77 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -849,8 +849,10 @@ static void virt_init(MachineState *machine) exit(EXIT_FAILURE); } machine_memory_devices_init(machine, base, device_mem_size); + base += device_mem_size; } + lvms->ram_end = base; /* load the BIOS image. */ virt_firmware_init(lvms); diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h index 8a04dd8314..d7e94428f0 100644 --- a/include/hw/loongarch/virt.h +++ b/include/hw/loongarch/virt.h @@ -125,6 +125,7 @@ struct LoongArchVirtMachineState { uint64_t misc_feature; uint64_t misc_status; DeviceState *dintc; + hwaddr ram_end; }; #define TYPE_LOONGARCH_VIRT_MACHINE MACHINE_TYPE_NAME("virt")