qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Address space per CPU at machine initialization time


From: Pierre Mallard
Subject: [Qemu-devel] Address space per CPU at machine initialization time
Date: Tue, 9 Sep 2014 20:06:42 +0200

Hi,

I would like to instantiate two CPU on a XILINX board (FX100T).
These two CPU shall have their own memory device (one DDR ram and one internal "xpr" RAM each) with addresses overlapping (0 to 0xFFFFFFFF each).

Here is a snapshot of machine initialization routine working with one CPU :

memory_region_allocate_system_memory(ddr_ram, NULL, "ram", ram_size);
memory_region_add_subregion(get_system_memory(), 0x0, ddr_ram);

memory_region_init_ram(xpr_bram, NULL, "xpr_bram", 0x10000);
memory_region_add_subregion(get_system_memory(), 0xFFFF0000, xpr_bram);

load_elf(machine->firmware, NULL, NULL, &entry,&lowaddr, &highaddr, 1, ELF_MACHINE, 0);
 
Since, region is attached to get_system_memory() and that nothing is given to load_elf to map elf element to correct address space I can't figure out how I could have my two CPU working on different address space, using same range of address, either for instantiation of memory or elf loading. In other words I would like to do this :

///////////////////////////
//CPU0
memory_region_allocate_system_memory(ddr_ram0, NULL, "ram0", ram0_size);
memory_region_add_subregion(CPU0_SYSTEM_MEMORY, 0x0, ddr_ram0);

memory_region_init_ram(xpr_bram0, NULL, "xpr_bram0", 0x10000);
memory_region_add_subregion(CPU0_SYSTEM_MEMORY, 0xFFFF0000, xpr_bram0);

//magically load elf in CPU0_SYSTEM_MEMORY
load_elf(machine->firmware0, NULL, NULL, &entry,&lowaddr, &highaddr, 1, ELF_MACHINE, 0);

/////////////////////////////
//CPU1
memory_region_allocate_system_memory(ddr_ram1, NULL, "ram1", ram1_size);
memory_region_add_subregion(CPU1_SYSTEM_MEMORY, 0x0, ddr_ram1);

memory_region_init_ram(xpr_bram1, NULL, "xpr_bram1", 0x10000);
memory_region_add_subregion(CPU1_SYSTEM_MEMORY, 0xFFFF0000, xpr_bram1);

//magically load elf in CPU1_SYSTEM_MEMORY
load_elf(machine->firmware, NULL, NULL, &entry,&lowaddr, &highaddr, 1, ELF_MACHINE, 0);

// Attach CPUX_SYSTEM_MEMORY to CPUX so that they end up using correct memory

Thanks for your suggestion !
Pierre


reply via email to

[Prev in Thread] Current Thread [Next in Thread]