@samitouri / QOSamiQemu / commits / 024fff8b81

hw/hexagon: move VTCM to the common machine state

The VTCM is described by the config table, so every machine can set it up the same way. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Link: https://lore.kernel.org/qemu-devel/20260806042723.3785369-3-brian.cain@oss.qualcomm.com Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>

Brian Cain committed Aug 5, 2026 at 21:27 UTC 024fff8b8160e20621731502213e1a077567b839
4 files changed +9 -6
hw/hexagon/hex-subsys.c
+8
@@ -29,4 +29,12 @@ void hex_subsys_create(HexagonCommonMachineState *hms,
29 rom_add_blob_fixed_as("config_table.rom", &m_cfg->cfgtable,
30 sizeof(m_cfg->cfgtable), m_cfg->cfgbase,
31 &address_space_memory);
32 +
33 + if (m_cfg->cfgtable.vtcm_size_kb > 0) {
34 + memory_region_init_ram(&hms->vtcm, NULL, "vtcm.ram",
35 + m_cfg->cfgtable.vtcm_size_kb * 1024,
36 + &error_fatal);
37 + memory_region_add_subregion(sysmem, m_cfg->cfgtable.vtcm_base << 16,
38 + &hms->vtcm);
39 + }
40 }
hw/hexagon/virt.c
-5
@@ -75,11 +75,6 @@ static void fdt_add_hvx(HexagonVirtMachineState *vms,
75 const MachineState *ms = MACHINE(vms);
76 uint32_t vtcm_size_bytes = m_cfg->cfgtable.vtcm_size_kb * 1024;
77 if (vtcm_size_bytes > 0) {
78 - memory_region_init_ram(&vms->vtcm, NULL, "vtcm.ram", vtcm_size_bytes,
79 - &error_fatal);
80 - memory_region_add_subregion(vms->sys, m_cfg->cfgtable.vtcm_base << 16,
81 - &vms->vtcm);
82 -
78 qemu_fdt_add_subnode(ms->fdt, "/soc/vtcm");
79 qemu_fdt_setprop_string(ms->fdt, "/soc/vtcm", "compatible",
80 "qcom,hexagon_vtcm");
include/hw/hexagon/hexagon.h
+1
@@ -156,6 +156,7 @@ struct HexagonCommonMachineState {
156
157 MemoryRegion ram;
158 MemoryRegion cfgtable_rom;
159 + MemoryRegion vtcm;
160 };
161
162 #endif
include/hw/hexagon/virt.h
-1
@@ -17,7 +17,6 @@ struct HexagonVirtMachineState {
17 int fdt_size;
18 MemoryRegion *sys;
19 MemoryRegion tcm;
20 - MemoryRegion vtcm;
20 MemoryRegion bios;
21 Clock *apb_clk;
22 };