Skip to content

Commit

Permalink
hw/riscv: Adjust the memory allocation size of evalsoc to resolve the…
Browse files Browse the repository at this point in the history
… issue of insufficient memory allocation in QEMU.

xip:32MB
ddr:64MB
ilm:8MB
dlm:8MB
sram:512MB

If -m size is configured, the size is used as the size of the DDR. Otherwise, the size of the DDR is determined by parsing the json script, and the default size is 64MB.
  • Loading branch information
bigmagic123 committed Jun 28, 2024
1 parent 8fc2bff commit 5054d0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions hw/riscv/nuclei_evalsoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,13 @@ static void evalsoc_machine_init(MachineState *machine)
memory_region_add_subregion(system_memory, s->sram.addr_base,
&s->soc.sram);

// ddr
//if -m 128M or no -m,s->ddr.addr_size is first json,then EVALSOC_DDR_SIZE
if(machine->ram_size != 128 * MiB)
{
s->ddr.addr_size = machine->ram_size;
}

memory_region_init_ram(&s->soc.ddr, NULL, "riscv.evalsoc.ram.ddr",
s->ddr.addr_size, &error_fatal);
memory_region_add_subregion(system_memory, s->ddr.addr_base,
Expand Down
10 changes: 5 additions & 5 deletions include/hw/riscv/nuclei_evalsoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,15 @@ enum
#define EVALSOC_QSPI2_SIZE (0x1000)

#define EVALSOC_XIP_BASE (0x20000000)
#define EVALSOC_XIP_SIZE (0x20000000)
#define EVALSOC_XIP_SIZE (0x02000000)//32MB
#define EVALSOC_DDR_BASE (0x80000000)
#define EVALSOC_DDR_SIZE (0x80000000)
#define EVALSOC_DDR_SIZE (0x04000000)//64MB
#define EVALSOC_ILM_BASE (0x80000000)
#define EVALSOC_ILM_SIZE (0x80000000)
#define EVALSOC_ILM_SIZE (0x00800000)//8MB
#define EVALSOC_DLM_BASE (0x90000000)
#define EVALSOC_DLM_SIZE (0x70000000)
#define EVALSOC_DLM_SIZE (0x00800000)//8MB
#define EVALSOC_SRAM_BASE (0xA0000000)
#define EVALSOC_SRAM_SIZE (0x60000000)
#define EVALSOC_SRAM_SIZE (0x20000000)//512MB

/* IREGION Offsets */
#define IREGION_IINFO_OFS (0x0)
Expand Down

0 comments on commit 5054d0c

Please sign in to comment.