]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/loongarch/virt: Add field ram_end in LoongArchVirtMachineState
authorBibo Mao <maobibo@loongson.cn>
Fri, 17 Oct 2025 06:45:17 +0000 (14:45 +0800)
committerBibo Mao <maobibo@loongson.cn>
Mon, 12 Jan 2026 06:49:21 +0000 (14:49 +0800)
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 <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
hw/loongarch/virt.c
include/hw/loongarch/virt.h

index 6efa15da473737dbbe5b3be54847b6b1874386cf..9d189e5a77104be5a44bc2166b80c34b4a302f48 100644 (file)
@@ -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);
 
index 8a04dd83146ad78e48782534158ef470141647df..d7e94428f099c411ad575b10796ca7cebda3dac2 100644 (file)
@@ -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")