mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'patchew/20200219160953.13771-1-imammedo@redhat.com' of https://github.com/patchew-project/qemu into HEAD
This series removes ad hoc RAM allocation API (memory_region_allocate_system_memory) and consolidates it around hostmem backend. It allows to * resolve conflicts between global -mem-prealloc and hostmem's "policy" option, fixing premature allocation before binding policy is applied * simplify complicated memory allocation routines which had to deal with 2 ways to allocate RAM. * reuse hostmem backends of a choice for main RAM without adding extra CLI options to duplicate hostmem features. A recent case was -mem-shared, to enable vhost-user on targets that don't support hostmem backends [1] (ex: s390) * move RAM allocation from individual boards into generic machine code and provide them with prepared MemoryRegion. * clean up deprecated NUMA features which were tied to the old API (see patches) - "numa: remove deprecated -mem-path fallback to anonymous RAM" - (POSTPONED, waiting on libvirt side) "forbid '-numa node,mem' for 5.0 and newer machine types" - (POSTPONED) "numa: remove deprecated implicit RAM distribution between nodes" Introduce a new machine.memory-backend property and wrapper code that aliases global -mem-path and -mem-alloc into automatically created hostmem backend properties (provided memory-backend was not set explicitly given by user). A bulk of trivial patches then follow to incrementally convert individual boards to using machine.memory-backend provided MemoryRegion. Board conversion typically involves: * providing MachineClass::default_ram_size and MachineClass::default_ram_id so generic code could create default backend if user didn't explicitly provide memory-backend or -m options * dropping memory_region_allocate_system_memory() call * using convenience MachineState::ram MemoryRegion, which points to MemoryRegion allocated by ram-memdev On top of that for some boards: * missing ram_size checks are added (typically it were boards with fixed ram size) * ram_size fixups are replaced by checks and hard errors, forcing user to provide correct "-m" values instead of ignoring it and continuing running. After all boards are converted, the old API is removed and memory allocation routines are cleaned up.
This commit is contained in:
@@ -18,13 +18,6 @@
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
|
||||
/* hostmem-file.c */
|
||||
/**
|
||||
* @TYPE_MEMORY_BACKEND_FILE:
|
||||
* name of backend that uses mmap on a file descriptor
|
||||
*/
|
||||
#define TYPE_MEMORY_BACKEND_FILE "memory-backend-file"
|
||||
|
||||
#define MEMORY_BACKEND_FILE(obj) \
|
||||
OBJECT_CHECK(HostMemoryBackendFile, (obj), TYPE_MEMORY_BACKEND_FILE)
|
||||
|
||||
@@ -58,7 +51,6 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
backend->force_prealloc = mem_prealloc;
|
||||
name = host_memory_backend_get_name(backend);
|
||||
memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),
|
||||
name,
|
||||
|
||||
@@ -45,7 +45,6 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
backend->force_prealloc = mem_prealloc;
|
||||
fd = qemu_memfd_create(TYPE_MEMORY_BACKEND_MEMFD, backend->size,
|
||||
m->hugetlb, m->hugetlbsize, m->seal ?
|
||||
F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL : 0,
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
#include "qemu/module.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
|
||||
#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram"
|
||||
|
||||
static void
|
||||
ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
|
||||
{
|
||||
|
||||
+39
-14
@@ -215,7 +215,7 @@ static bool host_memory_backend_get_prealloc(Object *obj, Error **errp)
|
||||
{
|
||||
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
|
||||
|
||||
return backend->prealloc || backend->force_prealloc;
|
||||
return backend->prealloc;
|
||||
}
|
||||
|
||||
static void host_memory_backend_set_prealloc(Object *obj, bool value,
|
||||
@@ -223,15 +223,6 @@ static void host_memory_backend_set_prealloc(Object *obj, bool value,
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
|
||||
if (backend->force_prealloc) {
|
||||
if (value) {
|
||||
error_setg(errp,
|
||||
"remove -mem-prealloc to use the prealloc property");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!host_memory_backend_mr_inited(backend)) {
|
||||
backend->prealloc = value;
|
||||
@@ -243,7 +234,7 @@ static void host_memory_backend_set_prealloc(Object *obj, bool value,
|
||||
void *ptr = memory_region_get_ram_ptr(&backend->mr);
|
||||
uint64_t sz = memory_region_size(&backend->mr);
|
||||
|
||||
os_mem_prealloc(fd, ptr, sz, ms->smp.cpus, &local_err);
|
||||
os_mem_prealloc(fd, ptr, sz, backend->prealloc_threads, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
@@ -252,14 +243,43 @@ static void host_memory_backend_set_prealloc(Object *obj, bool value,
|
||||
}
|
||||
}
|
||||
|
||||
static void host_memory_backend_get_prealloc_threads(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque, Error **errp)
|
||||
{
|
||||
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
|
||||
visit_type_uint32(v, name, &backend->prealloc_threads, errp);
|
||||
}
|
||||
|
||||
static void host_memory_backend_set_prealloc_threads(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque, Error **errp)
|
||||
{
|
||||
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
|
||||
Error *local_err = NULL;
|
||||
uint32_t value;
|
||||
|
||||
visit_type_uint32(v, name, &value, &local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
if (value <= 0) {
|
||||
error_setg(&local_err,
|
||||
"property '%s' of %s doesn't take value '%d'",
|
||||
name, object_get_typename(obj), value);
|
||||
goto out;
|
||||
}
|
||||
backend->prealloc_threads = value;
|
||||
out:
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
||||
static void host_memory_backend_init(Object *obj)
|
||||
{
|
||||
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
|
||||
MachineState *machine = MACHINE(qdev_get_machine());
|
||||
|
||||
/* TODO: convert access to globals to compat properties */
|
||||
backend->merge = machine_mem_merge(machine);
|
||||
backend->dump = machine_dump_guest_core(machine);
|
||||
backend->prealloc = mem_prealloc;
|
||||
}
|
||||
|
||||
static void host_memory_backend_post_init(Object *obj)
|
||||
@@ -313,7 +333,6 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
|
||||
{
|
||||
HostMemoryBackend *backend = MEMORY_BACKEND(uc);
|
||||
HostMemoryBackendClass *bc = MEMORY_BACKEND_GET_CLASS(uc);
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
Error *local_err = NULL;
|
||||
void *ptr;
|
||||
uint64_t sz;
|
||||
@@ -378,7 +397,7 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
|
||||
*/
|
||||
if (backend->prealloc) {
|
||||
os_mem_prealloc(memory_region_get_fd(&backend->mr), ptr, sz,
|
||||
ms->smp.cpus, &local_err);
|
||||
backend->prealloc_threads, &local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
@@ -456,6 +475,12 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)
|
||||
host_memory_backend_set_prealloc, &error_abort);
|
||||
object_class_property_set_description(oc, "prealloc",
|
||||
"Preallocate memory", &error_abort);
|
||||
object_class_property_add(oc, "prealloc-threads", "int",
|
||||
host_memory_backend_get_prealloc_threads,
|
||||
host_memory_backend_set_prealloc_threads,
|
||||
NULL, NULL, &error_abort);
|
||||
object_class_property_set_description(oc, "prealloc-threads",
|
||||
"Number of CPU threads to use for prealloc", &error_abort);
|
||||
object_class_property_add(oc, "size", "int",
|
||||
host_memory_backend_get_size,
|
||||
host_memory_backend_set_size,
|
||||
|
||||
@@ -1668,59 +1668,18 @@ static int find_max_backend_pagesize(Object *obj, void *opaque)
|
||||
long qemu_minrampagesize(void)
|
||||
{
|
||||
long hpsize = LONG_MAX;
|
||||
long mainrampagesize;
|
||||
Object *memdev_root;
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
|
||||
mainrampagesize = qemu_mempath_getpagesize(mem_path);
|
||||
|
||||
/* it's possible we have memory-backend objects with
|
||||
* hugepage-backed RAM. these may get mapped into system
|
||||
* address space via -numa parameters or memory hotplug
|
||||
* hooks. we want to take these into account, but we
|
||||
* also want to make sure these supported hugepage
|
||||
* sizes are applicable across the entire range of memory
|
||||
* we may boot from, so we take the min across all
|
||||
* backends, and assume normal pages in cases where a
|
||||
* backend isn't backed by hugepages.
|
||||
*/
|
||||
memdev_root = object_resolve_path("/objects", NULL);
|
||||
if (memdev_root) {
|
||||
object_child_foreach(memdev_root, find_min_backend_pagesize, &hpsize);
|
||||
}
|
||||
if (hpsize == LONG_MAX) {
|
||||
/* No additional memory regions found ==> Report main RAM page size */
|
||||
return mainrampagesize;
|
||||
}
|
||||
|
||||
/* If NUMA is disabled or the NUMA nodes are not backed with a
|
||||
* memory-backend, then there is at least one node using "normal" RAM,
|
||||
* so if its page size is smaller we have got to report that size instead.
|
||||
*/
|
||||
if (hpsize > mainrampagesize &&
|
||||
(ms->numa_state == NULL ||
|
||||
ms->numa_state->num_nodes == 0 ||
|
||||
ms->numa_state->nodes[0].node_memdev == NULL)) {
|
||||
static bool warned;
|
||||
if (!warned) {
|
||||
error_report("Huge page support disabled (n/a for main memory).");
|
||||
warned = true;
|
||||
}
|
||||
return mainrampagesize;
|
||||
}
|
||||
Object *memdev_root = object_resolve_path("/objects", NULL);
|
||||
|
||||
object_child_foreach(memdev_root, find_min_backend_pagesize, &hpsize);
|
||||
return hpsize;
|
||||
}
|
||||
|
||||
long qemu_maxrampagesize(void)
|
||||
{
|
||||
long pagesize = qemu_mempath_getpagesize(mem_path);
|
||||
long pagesize = 0;
|
||||
Object *memdev_root = object_resolve_path("/objects", NULL);
|
||||
|
||||
if (memdev_root) {
|
||||
object_child_foreach(memdev_root, find_max_backend_pagesize,
|
||||
&pagesize);
|
||||
}
|
||||
object_child_foreach(memdev_root, find_max_backend_pagesize, &pagesize);
|
||||
return pagesize;
|
||||
}
|
||||
#else
|
||||
@@ -1843,8 +1802,6 @@ static void *file_ram_alloc(RAMBlock *block,
|
||||
bool truncate,
|
||||
Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
void *area;
|
||||
|
||||
block->page_size = qemu_fd_getpagesize(fd);
|
||||
@@ -1900,15 +1857,6 @@ static void *file_ram_alloc(RAMBlock *block,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mem_prealloc) {
|
||||
os_mem_prealloc(fd, area, memory, ms->smp.cpus, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
qemu_ram_munmap(fd, area, memory);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
block->fd = fd;
|
||||
return area;
|
||||
}
|
||||
@@ -2356,9 +2304,9 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr,
|
||||
size = HOST_PAGE_ALIGN(size);
|
||||
file_size = get_file_size(fd);
|
||||
if (file_size > 0 && file_size < size) {
|
||||
error_setg(errp, "backing store %s size 0x%" PRIx64
|
||||
error_setg(errp, "backing store size 0x%" PRIx64
|
||||
" does not match 'size' option 0x" RAM_ADDR_FMT,
|
||||
mem_path, file_size, size);
|
||||
file_size, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "hw/intc/i8259.h"
|
||||
|
||||
|
||||
PCIBus *typhoon_init(ram_addr_t, ISABus **, qemu_irq *, AlphaCPU *[4],
|
||||
PCIBus *typhoon_init(MemoryRegion *, ISABus **, qemu_irq *, AlphaCPU *[4],
|
||||
pci_map_irq_fn);
|
||||
|
||||
/* alpha_pci.c. */
|
||||
|
||||
+2
-1
@@ -75,7 +75,7 @@ static void clipper_init(MachineState *machine)
|
||||
cpus[0]->env.trap_arg2 = smp_cpus;
|
||||
|
||||
/* Init the chipset. */
|
||||
pci_bus = typhoon_init(ram_size, &isa_bus, &rtc_irq, cpus,
|
||||
pci_bus = typhoon_init(machine->ram, &isa_bus, &rtc_irq, cpus,
|
||||
clipper_pci_map_irq);
|
||||
|
||||
/* Since we have an SRM-compatible PALcode, use the SRM epoch. */
|
||||
@@ -183,6 +183,7 @@ static void clipper_machine_init(MachineClass *mc)
|
||||
mc->max_cpus = 4;
|
||||
mc->is_default = 1;
|
||||
mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
|
||||
mc->default_ram_id = "ram";
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("clipper", clipper_machine_init)
|
||||
|
||||
+2
-6
@@ -58,7 +58,6 @@ typedef struct TyphoonState {
|
||||
TyphoonCchip cchip;
|
||||
TyphoonPchip pchip;
|
||||
MemoryRegion dchip_region;
|
||||
MemoryRegion ram_region;
|
||||
} TyphoonState;
|
||||
|
||||
/* Called when one of DRIR or DIM changes. */
|
||||
@@ -817,8 +816,7 @@ static void typhoon_alarm_timer(void *opaque)
|
||||
cpu_interrupt(CPU(s->cchip.cpu[cpu]), CPU_INTERRUPT_TIMER);
|
||||
}
|
||||
|
||||
PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
|
||||
qemu_irq *p_rtc_irq,
|
||||
PCIBus *typhoon_init(MemoryRegion *ram, ISABus **isa_bus, qemu_irq *p_rtc_irq,
|
||||
AlphaCPU *cpus[4], pci_map_irq_fn sys_map_irq)
|
||||
{
|
||||
MemoryRegion *addr_space = get_system_memory();
|
||||
@@ -851,9 +849,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus **isa_bus,
|
||||
|
||||
/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB,
|
||||
but the address space hole reserved at this point is 8TB. */
|
||||
memory_region_allocate_system_memory(&s->ram_region, OBJECT(s), "ram",
|
||||
ram_size);
|
||||
memory_region_add_subregion(addr_space, 0, &s->ram_region);
|
||||
memory_region_add_subregion(addr_space, 0, ram);
|
||||
|
||||
/* TIGbus, 0x801.0000.0000, 1GB. */
|
||||
/* ??? The TIGbus is used for delivering interrupts, and access to
|
||||
|
||||
+7
-11
@@ -35,7 +35,6 @@ static struct arm_boot_info aspeed_board_binfo = {
|
||||
struct AspeedBoardState {
|
||||
AspeedSoCState soc;
|
||||
MemoryRegion ram_container;
|
||||
MemoryRegion ram;
|
||||
MemoryRegion max_ram;
|
||||
};
|
||||
|
||||
@@ -197,6 +196,7 @@ static void aspeed_machine_init(MachineState *machine)
|
||||
|
||||
memory_region_init(&bmc->ram_container, NULL, "aspeed-ram-container",
|
||||
UINT32_MAX);
|
||||
memory_region_add_subregion(&bmc->ram_container, 0, machine->ram);
|
||||
|
||||
object_initialize_child(OBJECT(machine), "soc", &bmc->soc,
|
||||
(sizeof(bmc->soc)), amc->soc_name, &error_abort,
|
||||
@@ -204,8 +204,12 @@ static void aspeed_machine_init(MachineState *machine)
|
||||
|
||||
sc = ASPEED_SOC_GET_CLASS(&bmc->soc);
|
||||
|
||||
/*
|
||||
* This will error out if isize is not supported by memory controller.
|
||||
*/
|
||||
object_property_set_uint(OBJECT(&bmc->soc), ram_size, "ram-size",
|
||||
&error_abort);
|
||||
&error_fatal);
|
||||
|
||||
object_property_set_int(OBJECT(&bmc->soc), amc->hw_strap1, "hw-strap1",
|
||||
&error_abort);
|
||||
object_property_set_int(OBJECT(&bmc->soc), amc->hw_strap2, "hw-strap2",
|
||||
@@ -228,15 +232,6 @@ static void aspeed_machine_init(MachineState *machine)
|
||||
object_property_set_bool(OBJECT(&bmc->soc), true, "realized",
|
||||
&error_abort);
|
||||
|
||||
/*
|
||||
* Allocate RAM after the memory controller has checked the size
|
||||
* was valid. If not, a default value is used.
|
||||
*/
|
||||
ram_size = object_property_get_uint(OBJECT(&bmc->soc), "ram-size",
|
||||
&error_abort);
|
||||
|
||||
memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
|
||||
memory_region_add_subregion(&bmc->ram_container, 0, &bmc->ram);
|
||||
memory_region_add_subregion(get_system_memory(),
|
||||
sc->memmap[ASPEED_SDRAM],
|
||||
&bmc->ram_container);
|
||||
@@ -439,6 +434,7 @@ static void aspeed_machine_class_init(ObjectClass *oc, void *data)
|
||||
mc->no_floppy = 1;
|
||||
mc->no_cdrom = 1;
|
||||
mc->no_parallel = 1;
|
||||
mc->default_ram_id = "ram";
|
||||
|
||||
aspeed_machine_class_props_init(oc);
|
||||
}
|
||||
|
||||
+12
-4
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/boards.h"
|
||||
#include "strongarm.h"
|
||||
@@ -27,13 +28,18 @@ static void collie_init(MachineState *machine)
|
||||
{
|
||||
StrongARMState *s;
|
||||
DriveInfo *dinfo;
|
||||
MemoryRegion *sdram = g_new(MemoryRegion, 1);
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
|
||||
if (machine->ram_size != mc->default_ram_size) {
|
||||
char *sz = size_to_str(mc->default_ram_size);
|
||||
error_report("Invalid RAM size, should be %s", sz);
|
||||
g_free(sz);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
s = sa1110_init(machine->cpu_type);
|
||||
|
||||
memory_region_allocate_system_memory(sdram, NULL, "strongarm.sdram",
|
||||
collie_binfo.ram_size);
|
||||
memory_region_add_subregion(get_system_memory(), SA_SDCS0, sdram);
|
||||
memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ram);
|
||||
|
||||
dinfo = drive_get(IF_PFLASH, 0, 0);
|
||||
pflash_cfi01_register(SA_CS0, "collie.fl1", 0x02000000,
|
||||
@@ -57,6 +63,8 @@ static void collie_machine_init(MachineClass *mc)
|
||||
mc->init = collie_init;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_cpu_type = ARM_CPU_TYPE_NAME("sa1110");
|
||||
mc->default_ram_size = 0x20000000;
|
||||
mc->default_ram_id = "strongarm.sdram";
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("collie", collie_machine_init)
|
||||
|
||||
+8
-17
@@ -28,52 +28,42 @@ static struct arm_boot_info cubieboard_binfo = {
|
||||
.board_id = 0x1008,
|
||||
};
|
||||
|
||||
typedef struct CubieBoardState {
|
||||
AwA10State *a10;
|
||||
MemoryRegion sdram;
|
||||
} CubieBoardState;
|
||||
|
||||
static void cubieboard_init(MachineState *machine)
|
||||
{
|
||||
CubieBoardState *s = g_new(CubieBoardState, 1);
|
||||
AwA10State *a10 = AW_A10(object_new(TYPE_AW_A10));
|
||||
Error *err = NULL;
|
||||
|
||||
s->a10 = AW_A10(object_new(TYPE_AW_A10));
|
||||
|
||||
object_property_set_int(OBJECT(&s->a10->emac), 1, "phy-addr", &err);
|
||||
object_property_set_int(OBJECT(&a10->emac), 1, "phy-addr", &err);
|
||||
if (err != NULL) {
|
||||
error_reportf_err(err, "Couldn't set phy address: ");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
object_property_set_int(OBJECT(&s->a10->timer), 32768, "clk0-freq", &err);
|
||||
object_property_set_int(OBJECT(&a10->timer), 32768, "clk0-freq", &err);
|
||||
if (err != NULL) {
|
||||
error_reportf_err(err, "Couldn't set clk0 frequency: ");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
object_property_set_int(OBJECT(&s->a10->timer), 24000000, "clk1-freq",
|
||||
&err);
|
||||
object_property_set_int(OBJECT(&a10->timer), 24000000, "clk1-freq", &err);
|
||||
if (err != NULL) {
|
||||
error_reportf_err(err, "Couldn't set clk1 frequency: ");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
object_property_set_bool(OBJECT(s->a10), true, "realized", &err);
|
||||
object_property_set_bool(OBJECT(a10), true, "realized", &err);
|
||||
if (err != NULL) {
|
||||
error_reportf_err(err, "Couldn't realize Allwinner A10: ");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memory_region_allocate_system_memory(&s->sdram, NULL, "cubieboard.ram",
|
||||
machine->ram_size);
|
||||
memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,
|
||||
&s->sdram);
|
||||
machine->ram);
|
||||
|
||||
/* TODO create and connect IDE devices for ide_drive_get() */
|
||||
|
||||
cubieboard_binfo.ram_size = machine->ram_size;
|
||||
arm_load_kernel(&s->a10->cpu, machine, &cubieboard_binfo);
|
||||
arm_load_kernel(&a10->cpu, machine, &cubieboard_binfo);
|
||||
}
|
||||
|
||||
static void cubieboard_machine_init(MachineClass *mc)
|
||||
@@ -84,6 +74,7 @@ static void cubieboard_machine_init(MachineClass *mc)
|
||||
mc->block_default_type = IF_IDE;
|
||||
mc->units_per_default_bus = 1;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_ram_id = "cubieboard.ram";
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("cubieboard", cubieboard_machine_init)
|
||||
|
||||
+20
-18
@@ -35,39 +35,40 @@
|
||||
#include "hw/loader.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
#define DIGIC4_ROM0_BASE 0xf0000000
|
||||
#define DIGIC4_ROM1_BASE 0xf8000000
|
||||
#define DIGIC4_ROM_MAX_SIZE 0x08000000
|
||||
|
||||
typedef struct DigicBoardState {
|
||||
DigicState *digic;
|
||||
MemoryRegion ram;
|
||||
} DigicBoardState;
|
||||
|
||||
typedef struct DigicBoard {
|
||||
hwaddr ram_size;
|
||||
void (*add_rom0)(DigicBoardState *, hwaddr, const char *);
|
||||
void (*add_rom0)(DigicState *, hwaddr, const char *);
|
||||
const char *rom0_def_filename;
|
||||
void (*add_rom1)(DigicBoardState *, hwaddr, const char *);
|
||||
void (*add_rom1)(DigicState *, hwaddr, const char *);
|
||||
const char *rom1_def_filename;
|
||||
} DigicBoard;
|
||||
|
||||
static void digic4_board_init(DigicBoard *board)
|
||||
static void digic4_board_init(MachineState *machine, DigicBoard *board)
|
||||
{
|
||||
Error *err = NULL;
|
||||
DigicState *s = DIGIC(object_new(TYPE_DIGIC));
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
|
||||
DigicBoardState *s = g_new(DigicBoardState, 1);
|
||||
if (machine->ram_size != mc->default_ram_size) {
|
||||
char *sz = size_to_str(mc->default_ram_size);
|
||||
error_report("Invalid RAM size, should be %s", sz);
|
||||
g_free(sz);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
s->digic = DIGIC(object_new(TYPE_DIGIC));
|
||||
object_property_set_bool(OBJECT(s->digic), true, "realized", &err);
|
||||
object_property_set_bool(OBJECT(s), true, "realized", &err);
|
||||
if (err != NULL) {
|
||||
error_reportf_err(err, "Couldn't realize DIGIC SoC: ");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memory_region_allocate_system_memory(&s->ram, NULL, "ram", board->ram_size);
|
||||
memory_region_add_subregion(get_system_memory(), 0, &s->ram);
|
||||
memory_region_add_subregion(get_system_memory(), 0, machine->ram);
|
||||
|
||||
if (board->add_rom0) {
|
||||
board->add_rom0(s, DIGIC4_ROM0_BASE, board->rom0_def_filename);
|
||||
@@ -78,7 +79,7 @@ static void digic4_board_init(DigicBoard *board)
|
||||
}
|
||||
}
|
||||
|
||||
static void digic_load_rom(DigicBoardState *s, hwaddr addr,
|
||||
static void digic_load_rom(DigicState *s, hwaddr addr,
|
||||
hwaddr max_size, const char *def_filename)
|
||||
{
|
||||
target_long rom_size;
|
||||
@@ -118,7 +119,7 @@ static void digic_load_rom(DigicBoardState *s, hwaddr addr,
|
||||
* Samsung K8P3215UQB
|
||||
* 64M Bit (4Mx16) Page Mode / Multi-Bank NOR Flash Memory
|
||||
*/
|
||||
static void digic4_add_k8p3215uqb_rom(DigicBoardState *s, hwaddr addr,
|
||||
static void digic4_add_k8p3215uqb_rom(DigicState *s, hwaddr addr,
|
||||
const char *def_filename)
|
||||
{
|
||||
#define FLASH_K8P3215UQB_SIZE (4 * 1024 * 1024)
|
||||
@@ -135,14 +136,13 @@ static void digic4_add_k8p3215uqb_rom(DigicBoardState *s, hwaddr addr,
|
||||
}
|
||||
|
||||
static DigicBoard digic4_board_canon_a1100 = {
|
||||
.ram_size = 64 * 1024 * 1024,
|
||||
.add_rom1 = digic4_add_k8p3215uqb_rom,
|
||||
.rom1_def_filename = "canon-a1100-rom1.bin",
|
||||
};
|
||||
|
||||
static void canon_a1100_init(MachineState *machine)
|
||||
{
|
||||
digic4_board_init(&digic4_board_canon_a1100);
|
||||
digic4_board_init(machine, &digic4_board_canon_a1100);
|
||||
}
|
||||
|
||||
static void canon_a1100_machine_init(MachineClass *mc)
|
||||
@@ -150,6 +150,8 @@ static void canon_a1100_machine_init(MachineClass *mc)
|
||||
mc->desc = "Canon PowerShot A1100 IS";
|
||||
mc->init = &canon_a1100_init;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_ram_size = 64 * MiB;
|
||||
mc->default_ram_id = "ram";
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("canon-a1100", canon_a1100_machine_init)
|
||||
|
||||
+4
-6
@@ -236,7 +236,6 @@ enum cxmachines {
|
||||
*/
|
||||
static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
|
||||
{
|
||||
ram_addr_t ram_size = machine->ram_size;
|
||||
DeviceState *dev = NULL;
|
||||
SysBusDevice *busdev;
|
||||
qemu_irq pic[128];
|
||||
@@ -247,7 +246,6 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
|
||||
qemu_irq cpu_virq[4];
|
||||
qemu_irq cpu_vfiq[4];
|
||||
MemoryRegion *sysram;
|
||||
MemoryRegion *dram;
|
||||
MemoryRegion *sysmem;
|
||||
char *sysboot_filename;
|
||||
|
||||
@@ -290,10 +288,8 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
|
||||
}
|
||||
|
||||
sysmem = get_system_memory();
|
||||
dram = g_new(MemoryRegion, 1);
|
||||
memory_region_allocate_system_memory(dram, NULL, "highbank.dram", ram_size);
|
||||
/* SDRAM at address zero. */
|
||||
memory_region_add_subregion(sysmem, 0, dram);
|
||||
memory_region_add_subregion(sysmem, 0, machine->ram);
|
||||
|
||||
sysram = g_new(MemoryRegion, 1);
|
||||
memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000,
|
||||
@@ -387,7 +383,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
|
||||
|
||||
/* TODO create and connect IDE devices for ide_drive_get() */
|
||||
|
||||
highbank_binfo.ram_size = ram_size;
|
||||
highbank_binfo.ram_size = machine->ram_size;
|
||||
/* highbank requires a dtb in order to boot, and the dtb will override
|
||||
* the board ID. The following value is ignored, so set it to -1 to be
|
||||
* clear that the value is meaningless.
|
||||
@@ -430,6 +426,7 @@ static void highbank_class_init(ObjectClass *oc, void *data)
|
||||
mc->units_per_default_bus = 1;
|
||||
mc->max_cpus = 4;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_ram_id = "highbank.dram";
|
||||
}
|
||||
|
||||
static const TypeInfo highbank_type = {
|
||||
@@ -448,6 +445,7 @@ static void midway_class_init(ObjectClass *oc, void *data)
|
||||
mc->units_per_default_bus = 1;
|
||||
mc->max_cpus = 4;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_ram_id = "highbank.dram";
|
||||
}
|
||||
|
||||
static const TypeInfo midway_type = {
|
||||
|
||||
+10
-9
@@ -32,6 +32,7 @@
|
||||
#include "exec/address-spaces.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "hw/i2c/i2c.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
/* Memory map for PDK Emulation Baseboard:
|
||||
* 0x00000000-0x7fffffff See i.MX25 SOC fr support
|
||||
@@ -58,7 +59,6 @@
|
||||
|
||||
typedef struct IMX25PDK {
|
||||
FslIMX25State soc;
|
||||
MemoryRegion ram;
|
||||
MemoryRegion ram_alias;
|
||||
} IMX25PDK;
|
||||
|
||||
@@ -66,6 +66,7 @@ static struct arm_boot_info imx25_pdk_binfo;
|
||||
|
||||
static void imx25_pdk_init(MachineState *machine)
|
||||
{
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
IMX25PDK *s = g_new0(IMX25PDK, 1);
|
||||
unsigned int ram_size;
|
||||
unsigned int alias_offset;
|
||||
@@ -78,16 +79,14 @@ static void imx25_pdk_init(MachineState *machine)
|
||||
|
||||
/* We need to initialize our memory */
|
||||
if (machine->ram_size > (FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE)) {
|
||||
warn_report("RAM size " RAM_ADDR_FMT " above max supported, "
|
||||
"reduced to %x", machine->ram_size,
|
||||
FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE);
|
||||
machine->ram_size = FSL_IMX25_SDRAM0_SIZE + FSL_IMX25_SDRAM1_SIZE;
|
||||
char *sz = size_to_str(mc->default_ram_size);
|
||||
error_report("Invalid RAM size, should be %s", sz);
|
||||
g_free(sz);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
memory_region_allocate_system_memory(&s->ram, NULL, "imx25.ram",
|
||||
machine->ram_size);
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX25_SDRAM0_ADDR,
|
||||
&s->ram);
|
||||
machine->ram);
|
||||
|
||||
/* initialize the alias memory if any */
|
||||
for (i = 0, ram_size = machine->ram_size, alias_offset = 0;
|
||||
@@ -107,7 +106,8 @@ static void imx25_pdk_init(MachineState *machine)
|
||||
|
||||
if (size < ram[i].size) {
|
||||
memory_region_init_alias(&s->ram_alias, NULL, "ram.alias",
|
||||
&s->ram, alias_offset, ram[i].size - size);
|
||||
machine->ram,
|
||||
alias_offset, ram[i].size - size);
|
||||
memory_region_add_subregion(get_system_memory(),
|
||||
ram[i].addr + size, &s->ram_alias);
|
||||
}
|
||||
@@ -135,6 +135,7 @@ static void imx25_pdk_machine_init(MachineClass *mc)
|
||||
mc->desc = "ARM i.MX25 PDK board (ARM926)";
|
||||
mc->init = imx25_pdk_init;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_ram_id = "imx25.ram";
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("imx25-pdk", imx25_pdk_machine_init)
|
||||
|
||||
@@ -585,7 +585,6 @@ static void integratorcp_init(MachineState *machine)
|
||||
Object *cpuobj;
|
||||
ARMCPU *cpu;
|
||||
MemoryRegion *address_space_mem = get_system_memory();
|
||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||
MemoryRegion *ram_alias = g_new(MemoryRegion, 1);
|
||||
qemu_irq pic[32];
|
||||
DeviceState *dev, *sic, *icp;
|
||||
@@ -605,14 +604,13 @@ static void integratorcp_init(MachineState *machine)
|
||||
|
||||
cpu = ARM_CPU(cpuobj);
|
||||
|
||||
memory_region_allocate_system_memory(ram, NULL, "integrator.ram",
|
||||
ram_size);
|
||||
/* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */
|
||||
/* ??? RAM should repeat to fill physical memory space. */
|
||||
/* SDRAM at address zero*/
|
||||
memory_region_add_subregion(address_space_mem, 0, ram);
|
||||
memory_region_add_subregion(address_space_mem, 0, machine->ram);
|
||||
/* And again at address 0x80000000 */
|
||||
memory_region_init_alias(ram_alias, NULL, "ram.alias", ram, 0, ram_size);
|
||||
memory_region_init_alias(ram_alias, NULL, "ram.alias", machine->ram,
|
||||
0, ram_size);
|
||||
memory_region_add_subregion(address_space_mem, 0x80000000, ram_alias);
|
||||
|
||||
dev = qdev_create(NULL, TYPE_INTEGRATOR_CM);
|
||||
@@ -660,6 +658,7 @@ static void integratorcp_machine_init(MachineClass *mc)
|
||||
mc->init = integratorcp_init;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926");
|
||||
mc->default_ram_id = "integrator.ram";
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("integratorcp", integratorcp_machine_init)
|
||||
|
||||
+9
-9
@@ -25,6 +25,7 @@
|
||||
#include "hw/char/serial.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
/* Memory map for Kzm Emulation Baseboard:
|
||||
* 0x00000000-0x7fffffff See i.MX31 SOC for support
|
||||
@@ -51,7 +52,6 @@
|
||||
|
||||
typedef struct IMX31KZM {
|
||||
FslIMX31State soc;
|
||||
MemoryRegion ram;
|
||||
MemoryRegion ram_alias;
|
||||
} IMX31KZM;
|
||||
|
||||
@@ -78,16 +78,14 @@ static void kzm_init(MachineState *machine)
|
||||
|
||||
/* Check the amount of memory is compatible with the SOC */
|
||||
if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE)) {
|
||||
warn_report("RAM size " RAM_ADDR_FMT " above max supported, "
|
||||
"reduced to %x", machine->ram_size,
|
||||
FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE);
|
||||
machine->ram_size = FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE;
|
||||
char *sz = size_to_str(FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE);
|
||||
error_report("RAM size more than %s is not supported", sz);
|
||||
g_free(sz);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
memory_region_allocate_system_memory(&s->ram, NULL, "kzm.ram",
|
||||
machine->ram_size);
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX31_SDRAM0_ADDR,
|
||||
&s->ram);
|
||||
machine->ram);
|
||||
|
||||
/* initialize the alias memory if any */
|
||||
for (i = 0, ram_size = machine->ram_size, alias_offset = 0;
|
||||
@@ -107,7 +105,8 @@ static void kzm_init(MachineState *machine)
|
||||
|
||||
if (size < ram[i].size) {
|
||||
memory_region_init_alias(&s->ram_alias, NULL, "ram.alias",
|
||||
&s->ram, alias_offset, ram[i].size - size);
|
||||
machine->ram,
|
||||
alias_offset, ram[i].size - size);
|
||||
memory_region_add_subregion(get_system_memory(),
|
||||
ram[i].addr + size, &s->ram_alias);
|
||||
}
|
||||
@@ -139,6 +138,7 @@ static void kzm_machine_init(MachineClass *mc)
|
||||
mc->desc = "ARM KZM Emulation Baseboard (ARM1136)";
|
||||
mc->init = kzm_init;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_ram_id = "kzm.ram";
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("kzm", kzm_machine_init)
|
||||
|
||||
+9
-16
@@ -19,15 +19,10 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/qtest.h"
|
||||
|
||||
typedef struct {
|
||||
FslIMX6ULState soc;
|
||||
MemoryRegion ram;
|
||||
} MCIMX6ULEVK;
|
||||
|
||||
static void mcimx6ul_evk_init(MachineState *machine)
|
||||
{
|
||||
static struct arm_boot_info boot_info;
|
||||
MCIMX6ULEVK *s = g_new0(MCIMX6ULEVK, 1);
|
||||
FslIMX6ULState *s;
|
||||
int i;
|
||||
|
||||
if (machine->ram_size > FSL_IMX6UL_MMDC_SIZE) {
|
||||
@@ -43,15 +38,12 @@ static void mcimx6ul_evk_init(MachineState *machine)
|
||||
.nb_cpus = machine->smp.cpus,
|
||||
};
|
||||
|
||||
object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
|
||||
TYPE_FSL_IMX6UL, &error_fatal, NULL);
|
||||
s = FSL_IMX6UL(object_new(TYPE_FSL_IMX6UL));
|
||||
object_property_add_child(OBJECT(machine), "soc", OBJECT(s), &error_fatal);
|
||||
object_property_set_bool(OBJECT(s), true, "realized", &error_fatal);
|
||||
|
||||
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
|
||||
|
||||
memory_region_allocate_system_memory(&s->ram, NULL, "mcimx6ul-evk.ram",
|
||||
machine->ram_size);
|
||||
memory_region_add_subregion(get_system_memory(),
|
||||
FSL_IMX6UL_MMDC_ADDR, &s->ram);
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_MMDC_ADDR,
|
||||
machine->ram);
|
||||
|
||||
for (i = 0; i < FSL_IMX6UL_NUM_USDHCS; i++) {
|
||||
BusState *bus;
|
||||
@@ -61,7 +53,7 @@ static void mcimx6ul_evk_init(MachineState *machine)
|
||||
|
||||
di = drive_get_next(IF_SD);
|
||||
blk = di ? blk_by_legacy_dinfo(di) : NULL;
|
||||
bus = qdev_get_child_bus(DEVICE(&s->soc.usdhc[i]), "sd-bus");
|
||||
bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
|
||||
carddev = qdev_create(bus, TYPE_SD_CARD);
|
||||
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
|
||||
object_property_set_bool(OBJECT(carddev), true,
|
||||
@@ -69,7 +61,7 @@ static void mcimx6ul_evk_init(MachineState *machine)
|
||||
}
|
||||
|
||||
if (!qtest_enabled()) {
|
||||
arm_load_kernel(&s->soc.cpu, machine, &boot_info);
|
||||
arm_load_kernel(&s->cpu, machine, &boot_info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,5 +70,6 @@ static void mcimx6ul_evk_machine_init(MachineClass *mc)
|
||||
mc->desc = "Freescale i.MX6UL Evaluation Kit (Cortex A7)";
|
||||
mc->init = mcimx6ul_evk_init;
|
||||
mc->max_cpus = FSL_IMX6UL_NUM_CPUS;
|
||||
mc->default_ram_id = "mcimx6ul-evk.ram";
|
||||
}
|
||||
DEFINE_MACHINE("mcimx6ul-evk", mcimx6ul_evk_machine_init)
|
||||
|
||||
+9
-16
@@ -21,15 +21,10 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/qtest.h"
|
||||
|
||||
typedef struct {
|
||||
FslIMX7State soc;
|
||||
MemoryRegion ram;
|
||||
} MCIMX7Sabre;
|
||||
|
||||
static void mcimx7d_sabre_init(MachineState *machine)
|
||||
{
|
||||
static struct arm_boot_info boot_info;
|
||||
MCIMX7Sabre *s = g_new0(MCIMX7Sabre, 1);
|
||||
FslIMX7State *s;
|
||||
int i;
|
||||
|
||||
if (machine->ram_size > FSL_IMX7_MMDC_SIZE) {
|
||||
@@ -45,15 +40,12 @@ static void mcimx7d_sabre_init(MachineState *machine)
|
||||
.nb_cpus = machine->smp.cpus,
|
||||
};
|
||||
|
||||
object_initialize_child(OBJECT(machine), "soc",
|
||||
&s->soc, sizeof(s->soc),
|
||||
TYPE_FSL_IMX7, &error_fatal, NULL);
|
||||
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
|
||||
s = FSL_IMX7(object_new(TYPE_FSL_IMX7));
|
||||
object_property_add_child(OBJECT(machine), "soc", OBJECT(s), &error_fatal);
|
||||
object_property_set_bool(OBJECT(s), true, "realized", &error_fatal);
|
||||
|
||||
memory_region_allocate_system_memory(&s->ram, NULL, "mcimx7d-sabre.ram",
|
||||
machine->ram_size);
|
||||
memory_region_add_subregion(get_system_memory(),
|
||||
FSL_IMX7_MMDC_ADDR, &s->ram);
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX7_MMDC_ADDR,
|
||||
machine->ram);
|
||||
|
||||
for (i = 0; i < FSL_IMX7_NUM_USDHCS; i++) {
|
||||
BusState *bus;
|
||||
@@ -63,7 +55,7 @@ static void mcimx7d_sabre_init(MachineState *machine)
|
||||
|
||||
di = drive_get_next(IF_SD);
|
||||
blk = di ? blk_by_legacy_dinfo(di) : NULL;
|
||||
bus = qdev_get_child_bus(DEVICE(&s->soc.usdhc[i]), "sd-bus");
|
||||
bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
|
||||
carddev = qdev_create(bus, TYPE_SD_CARD);
|
||||
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
|
||||
object_property_set_bool(OBJECT(carddev), true,
|
||||
@@ -71,7 +63,7 @@ static void mcimx7d_sabre_init(MachineState *machine)
|
||||
}
|
||||
|
||||
if (!qtest_enabled()) {
|
||||
arm_load_kernel(&s->soc.cpu[0], machine, &boot_info);
|
||||
arm_load_kernel(&s->cpu[0], machine, &boot_info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,5 +72,6 @@ static void mcimx7d_sabre_machine_init(MachineClass *mc)
|
||||
mc->desc = "Freescale i.MX7 DUAL SABRE (Cortex A7)";
|
||||
mc->init = mcimx7d_sabre_init;
|
||||
mc->max_cpus = FSL_IMX7_NUM_CPUS;
|
||||
mc->default_ram_id = "mcimx7d-sabre.ram";
|
||||
}
|
||||
DEFINE_MACHINE("mcimx7d-sabre", mcimx7d_sabre_machine_init)
|
||||
|
||||
+11
-4
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/arm/boot.h"
|
||||
@@ -79,7 +80,6 @@ typedef struct {
|
||||
MachineState parent;
|
||||
|
||||
ARMSSE iotkit;
|
||||
MemoryRegion psram;
|
||||
MemoryRegion ssram[3];
|
||||
MemoryRegion ssram1_m;
|
||||
MPS2SCC scc;
|
||||
@@ -388,6 +388,13 @@ static void mps2tz_common_init(MachineState *machine)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (machine->ram_size != mc->default_ram_size) {
|
||||
char *sz = size_to_str(mc->default_ram_size);
|
||||
error_report("Invalid RAM size, should be %s", sz);
|
||||
g_free(sz);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sysbus_init_child_obj(OBJECT(machine), "iotkit", &mms->iotkit,
|
||||
sizeof(mms->iotkit), mmc->armsse_type);
|
||||
iotkitdev = DEVICE(&mms->iotkit);
|
||||
@@ -458,9 +465,7 @@ static void mps2tz_common_init(MachineState *machine)
|
||||
* tradeoffs. For QEMU they're all just RAM, though. We arbitrarily
|
||||
* call the 16MB our "system memory", as it's the largest lump.
|
||||
*/
|
||||
memory_region_allocate_system_memory(&mms->psram,
|
||||
NULL, "mps.ram", 16 * MiB);
|
||||
memory_region_add_subregion(system_memory, 0x80000000, &mms->psram);
|
||||
memory_region_add_subregion(system_memory, 0x80000000, machine->ram);
|
||||
|
||||
/* The overflow IRQs for all UARTs are ORed together.
|
||||
* Tx, Rx and "combined" IRQs are sent to the NVIC separately.
|
||||
@@ -642,6 +647,8 @@ static void mps2tz_class_init(ObjectClass *oc, void *data)
|
||||
|
||||
mc->init = mps2tz_common_init;
|
||||
iic->check = mps2_tz_idau_check;
|
||||
mc->default_ram_size = 16 * MiB;
|
||||
mc->default_ram_id = "mps.ram";
|
||||
}
|
||||
|
||||
static void mps2tz_an505_class_init(ObjectClass *oc, void *data)
|
||||
|
||||
+11
-4
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/arm/boot.h"
|
||||
@@ -55,7 +56,6 @@ typedef struct {
|
||||
MachineState parent;
|
||||
|
||||
ARMv7MState armv7m;
|
||||
MemoryRegion psram;
|
||||
MemoryRegion ssram1;
|
||||
MemoryRegion ssram1_m;
|
||||
MemoryRegion ssram23;
|
||||
@@ -118,6 +118,13 @@ static void mps2_common_init(MachineState *machine)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (machine->ram_size != mc->default_ram_size) {
|
||||
char *sz = size_to_str(mc->default_ram_size);
|
||||
error_report("Invalid RAM size, should be %s", sz);
|
||||
g_free(sz);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* The FPGA images have an odd combination of different RAMs,
|
||||
* because in hardware they are different implementations and
|
||||
* connected to different buses, giving varying performance/size
|
||||
@@ -146,9 +153,7 @@ static void mps2_common_init(MachineState *machine)
|
||||
* This is of no use for QEMU so we don't implement it (as if
|
||||
* zbt_boot_ctrl is always zero).
|
||||
*/
|
||||
memory_region_allocate_system_memory(&mms->psram,
|
||||
NULL, "mps.ram", 16 * MiB);
|
||||
memory_region_add_subregion(system_memory, 0x21000000, &mms->psram);
|
||||
memory_region_add_subregion(system_memory, 0x21000000, machine->ram);
|
||||
|
||||
switch (mmc->fpga_type) {
|
||||
case FPGA_AN385:
|
||||
@@ -338,6 +343,8 @@ static void mps2_class_init(ObjectClass *oc, void *data)
|
||||
|
||||
mc->init = mps2_common_init;
|
||||
mc->max_cpus = 1;
|
||||
mc->default_ram_size = 16 * MiB;
|
||||
mc->default_ram_id = "mps.ram";
|
||||
}
|
||||
|
||||
static void mps2_an385_class_init(ObjectClass *oc, void *data)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user