mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* device_del fix (Julia) * FXAM fix (myself) * memdev refactoring (Igor) * memory region API cleanups (Peter, Philippe) * ioeventfd optimization (Stefan) * new WHPX maintainer (Sunil) * Large guest startup optimizations (Chen) # gpg: Signature made Tue 25 Feb 2020 12:42:24 GMT # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (104 commits) WHPX: Assigning maintainer for Windows Hypervisor Platform accel/kvm: Check ioctl(KVM_SET_USER_MEMORY_REGION) return value target/i386: check for empty register in FXAM qdev-monitor: Forbid repeated device_del mem-prealloc: optimize large guest startup memory: batch allocate ioeventfds[] in address_space_update_ioeventfds() Avoid cpu_physical_memory_rw() with a constant is_write argument Let cpu_[physical]_memory() calls pass a boolean 'is_write' argument exec: Let cpu_[physical]_memory API use a boolean 'is_write' argument Avoid address_space_rw() with a constant is_write argument Let address_space_rw() calls pass a boolean 'is_write' argument exec: Let address_space_unmap() use a boolean 'is_write' argument hw/virtio: Let vhost_memory_map() use a boolean 'is_write' argument hw/virtio: Let virtqueue_map_iovec() use a boolean 'is_write' argument hw/ide: Let the DMAIntFunc prototype use a boolean 'is_write' argument hw/ide/internal: Remove unused DMARestartFunc typedef Remove unnecessary cast when using the cpu_[physical]_memory API exec: Let the cpu_[physical]_memory API use void pointer arguments Remove unnecessary cast when using the address_space API hw/net: Avoid casting non-const pointer, use address_space_write() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -404,6 +404,14 @@ S: Supported
|
||||
F: target/i386/kvm.c
|
||||
F: scripts/kvm/vmxcap
|
||||
|
||||
WHPX CPUs
|
||||
M: Sunil Muthuswamy <sunilmut@microsoft.com>
|
||||
S: Supported
|
||||
F: target/i386/whpx-all.c
|
||||
F: target/i386/whp-dispatch.h
|
||||
F: accel/stubs/whpx-stub.c
|
||||
F: include/sysemu/whpx.h
|
||||
|
||||
Guest CPU Cores (Xen)
|
||||
---------------------
|
||||
X86 Xen CPUs
|
||||
|
||||
+14
-4
@@ -308,13 +308,23 @@ static int kvm_set_user_memory_region(KVMMemoryListener *kml, KVMSlot *slot, boo
|
||||
/* Set the slot size to 0 before setting the slot to the desired
|
||||
* value. This is needed based on KVM commit 75d61fbc. */
|
||||
mem.memory_size = 0;
|
||||
kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, &mem);
|
||||
ret = kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, &mem);
|
||||
if (ret < 0) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
mem.memory_size = slot->memory_size;
|
||||
ret = kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, &mem);
|
||||
slot->old_flags = mem.flags;
|
||||
err:
|
||||
trace_kvm_set_user_memory(mem.slot, mem.flags, mem.guest_phys_addr,
|
||||
mem.memory_size, mem.userspace_addr, ret);
|
||||
if (ret < 0) {
|
||||
error_report("%s: KVM_SET_USER_MEMORY_REGION failed, slot=%d,"
|
||||
" start=0x%" PRIx64 ", size=0x%" PRIx64 ": %s",
|
||||
__func__, mem.slot, slot->start_addr,
|
||||
(uint64_t)mem.memory_size, strerror(errno));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2178,9 +2188,9 @@ void kvm_flush_coalesced_mmio_buffer(void)
|
||||
ent = &ring->coalesced_mmio[ring->first];
|
||||
|
||||
if (ent->pio == 1) {
|
||||
address_space_rw(&address_space_io, ent->phys_addr,
|
||||
MEMTXATTRS_UNSPECIFIED, ent->data,
|
||||
ent->len, true);
|
||||
address_space_write(&address_space_io, ent->phys_addr,
|
||||
MEMTXATTRS_UNSPECIFIED, ent->data,
|
||||
ent->len);
|
||||
} else {
|
||||
cpu_physical_memory_write(ent->phys_addr, ent->data, ent->len);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@ int dma_memory_set(AddressSpace *as, dma_addr_t addr, uint8_t c, dma_addr_t len)
|
||||
memset(fillbuf, c, FILLBUF_SIZE);
|
||||
while (len > 0) {
|
||||
l = len < FILLBUF_SIZE ? len : FILLBUF_SIZE;
|
||||
error |= address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
fillbuf, l, true);
|
||||
error |= address_space_write(as, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
fillbuf, l);
|
||||
len -= l;
|
||||
addr += l;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -2788,9 +2736,9 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
|
||||
}
|
||||
|
||||
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
|
||||
MemTxAttrs attrs, uint8_t *buf, hwaddr len);
|
||||
MemTxAttrs attrs, void *buf, hwaddr len);
|
||||
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
|
||||
const uint8_t *buf, hwaddr len);
|
||||
const void *buf, hwaddr len);
|
||||
static bool flatview_access_valid(FlatView *fv, hwaddr addr, hwaddr len,
|
||||
bool is_write, MemTxAttrs attrs);
|
||||
|
||||
@@ -3027,11 +2975,12 @@ MemoryRegion *get_system_io(void)
|
||||
/* physical memory access (slow version, mainly for debug) */
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
||||
uint8_t *buf, target_ulong len, int is_write)
|
||||
void *ptr, target_ulong len, bool is_write)
|
||||
{
|
||||
int flags;
|
||||
target_ulong l, page;
|
||||
void * p;
|
||||
uint8_t *buf = ptr;
|
||||
|
||||
while (len > 0) {
|
||||
page = addr & TARGET_PAGE_MASK;
|
||||
@@ -3155,14 +3104,15 @@ static bool prepare_mmio_access(MemoryRegion *mr)
|
||||
/* Called within RCU critical section. */
|
||||
static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
|
||||
MemTxAttrs attrs,
|
||||
const uint8_t *buf,
|
||||
const void *ptr,
|
||||
hwaddr len, hwaddr addr1,
|
||||
hwaddr l, MemoryRegion *mr)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
uint8_t *ram_ptr;
|
||||
uint64_t val;
|
||||
MemTxResult result = MEMTX_OK;
|
||||
bool release_lock = false;
|
||||
const uint8_t *buf = ptr;
|
||||
|
||||
for (;;) {
|
||||
if (!memory_access_is_direct(mr, true)) {
|
||||
@@ -3175,8 +3125,8 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
|
||||
size_memop(l), attrs);
|
||||
} else {
|
||||
/* RAM case */
|
||||
ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);
|
||||
memcpy(ptr, buf, l);
|
||||
ram_ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);
|
||||
memcpy(ram_ptr, buf, l);
|
||||
invalidate_and_set_dirty(mr, addr1, l);
|
||||
}
|
||||
|
||||
@@ -3202,7 +3152,7 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
|
||||
|
||||
/* Called from RCU critical section. */
|
||||
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
|
||||
const uint8_t *buf, hwaddr len)
|
||||
const void *buf, hwaddr len)
|
||||
{
|
||||
hwaddr l;
|
||||
hwaddr addr1;
|
||||
@@ -3219,14 +3169,15 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
|
||||
|
||||
/* Called within RCU critical section. */
|
||||
MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
|
||||
MemTxAttrs attrs, uint8_t *buf,
|
||||
MemTxAttrs attrs, void *ptr,
|
||||
hwaddr len, hwaddr addr1, hwaddr l,
|
||||
MemoryRegion *mr)
|
||||
{
|
||||
uint8_t *ptr;
|
||||
uint8_t *ram_ptr;
|
||||
uint64_t val;
|
||||
MemTxResult result = MEMTX_OK;
|
||||
bool release_lock = false;
|
||||
uint8_t *buf = ptr;
|
||||
|
||||
for (;;) {
|
||||
if (!memory_access_is_direct(mr, false)) {
|
||||
@@ -3238,8 +3189,8 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
|
||||
stn_he_p(buf, l, val);
|
||||
} else {
|
||||
/* RAM case */
|
||||
ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);
|
||||
memcpy(buf, ptr, l);
|
||||
ram_ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);
|
||||
memcpy(buf, ram_ptr, l);
|
||||
}
|
||||
|
||||
if (release_lock) {
|
||||
@@ -3264,7 +3215,7 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
|
||||
|
||||
/* Called from RCU critical section. */
|
||||
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
|
||||
MemTxAttrs attrs, uint8_t *buf, hwaddr len)
|
||||
MemTxAttrs attrs, void *buf, hwaddr len)
|
||||
{
|
||||
hwaddr l;
|
||||
hwaddr addr1;
|
||||
@@ -3277,7 +3228,7 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
|
||||
}
|
||||
|
||||
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
|
||||
MemTxAttrs attrs, uint8_t *buf, hwaddr len)
|
||||
MemTxAttrs attrs, void *buf, hwaddr len)
|
||||
{
|
||||
MemTxResult result = MEMTX_OK;
|
||||
FlatView *fv;
|
||||
@@ -3293,7 +3244,7 @@ MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
|
||||
|
||||
MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
||||
MemTxAttrs attrs,
|
||||
const uint8_t *buf, hwaddr len)
|
||||
const void *buf, hwaddr len)
|
||||
{
|
||||
MemTxResult result = MEMTX_OK;
|
||||
FlatView *fv;
|
||||
@@ -3308,7 +3259,7 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
|
||||
}
|
||||
|
||||
MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
|
||||
uint8_t *buf, hwaddr len, bool is_write)
|
||||
void *buf, hwaddr len, bool is_write)
|
||||
{
|
||||
if (is_write) {
|
||||
return address_space_write(as, addr, attrs, buf, len);
|
||||
@@ -3317,8 +3268,8 @@ MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
|
||||
}
|
||||
}
|
||||
|
||||
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
|
||||
hwaddr len, int is_write)
|
||||
void cpu_physical_memory_rw(hwaddr addr, void *buf,
|
||||
hwaddr len, bool is_write)
|
||||
{
|
||||
address_space_rw(&address_space_memory, addr, MEMTXATTRS_UNSPECIFIED,
|
||||
buf, len, is_write);
|
||||
@@ -3332,14 +3283,15 @@ enum write_rom_type {
|
||||
static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
|
||||
hwaddr addr,
|
||||
MemTxAttrs attrs,
|
||||
const uint8_t *buf,
|
||||
const void *ptr,
|
||||
hwaddr len,
|
||||
enum write_rom_type type)
|
||||
{
|
||||
hwaddr l;
|
||||
uint8_t *ptr;
|
||||
uint8_t *ram_ptr;
|
||||
hwaddr addr1;
|
||||
MemoryRegion *mr;
|
||||
const uint8_t *buf = ptr;
|
||||
|
||||
RCU_READ_LOCK_GUARD();
|
||||
while (len > 0) {
|
||||
@@ -3351,14 +3303,14 @@ static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
|
||||
l = memory_access_size(mr, l, addr1);
|
||||
} else {
|
||||
/* ROM/RAM case */
|
||||
ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
|
||||
ram_ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
|
||||
switch (type) {
|
||||
case WRITE_DATA:
|
||||
memcpy(ptr, buf, l);
|
||||
memcpy(ram_ptr, buf, l);
|
||||
invalidate_and_set_dirty(mr, addr1, l);
|
||||
break;
|
||||
case FLUSH_CACHE:
|
||||
flush_icache_range((uintptr_t)ptr, (uintptr_t)ptr + l);
|
||||
flush_icache_range((uintptr_t)ram_ptr, (uintptr_t)ram_ptr + l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3372,7 +3324,7 @@ static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
|
||||
/* used for ROM loading : can write in RAM and ROM */
|
||||
MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
|
||||
MemTxAttrs attrs,
|
||||
const uint8_t *buf, hwaddr len)
|
||||
const void *buf, hwaddr len)
|
||||
{
|
||||
return address_space_write_rom_internal(as, addr, attrs,
|
||||
buf, len, WRITE_DATA);
|
||||
@@ -3602,11 +3554,11 @@ void *address_space_map(AddressSpace *as,
|
||||
}
|
||||
|
||||
/* Unmaps a memory region previously mapped by address_space_map().
|
||||
* Will also mark the memory as dirty if is_write == 1. access_len gives
|
||||
* Will also mark the memory as dirty if is_write is true. access_len gives
|
||||
* the amount of memory that was actually read or written by the caller.
|
||||
*/
|
||||
void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
|
||||
int is_write, hwaddr access_len)
|
||||
bool is_write, hwaddr access_len)
|
||||
{
|
||||
if (buffer != bounce.buffer) {
|
||||
MemoryRegion *mr;
|
||||
@@ -3636,14 +3588,14 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
|
||||
|
||||
void *cpu_physical_memory_map(hwaddr addr,
|
||||
hwaddr *plen,
|
||||
int is_write)
|
||||
bool is_write)
|
||||
{
|
||||
return address_space_map(&address_space_memory, addr, plen, is_write,
|
||||
MEMTXATTRS_UNSPECIFIED);
|
||||
}
|
||||
|
||||
void cpu_physical_memory_unmap(void *buffer, hwaddr len,
|
||||
int is_write, hwaddr access_len)
|
||||
bool is_write, hwaddr access_len)
|
||||
{
|
||||
return address_space_unmap(&address_space_memory, buffer, len, is_write, access_len);
|
||||
}
|
||||
@@ -3794,10 +3746,11 @@ address_space_write_cached_slow(MemoryRegionCache *cache, hwaddr addr,
|
||||
|
||||
/* virtual memory access for debug (includes writing to ROM) */
|
||||
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
||||
uint8_t *buf, target_ulong len, int is_write)
|
||||
void *ptr, target_ulong len, bool is_write)
|
||||
{
|
||||
hwaddr phys_addr;
|
||||
target_ulong l, page;
|
||||
uint8_t *buf = ptr;
|
||||
|
||||
cpu_synchronize_state(cpu);
|
||||
while (len > 0) {
|
||||
@@ -3818,8 +3771,8 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
||||
address_space_write_rom(cpu->cpu_ases[asidx].as, phys_addr,
|
||||
attrs, buf, l);
|
||||
} else {
|
||||
address_space_rw(cpu->cpu_ases[asidx].as, phys_addr,
|
||||
attrs, buf, l, 0);
|
||||
address_space_read(cpu->cpu_ases[asidx].as, phys_addr, attrs, buf,
|
||||
l);
|
||||
}
|
||||
len -= l;
|
||||
buf += l;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+2
-4
@@ -327,8 +327,7 @@ static void set_kernel_args(const struct arm_boot_info *info, AddressSpace *as)
|
||||
|
||||
cmdline_size = strlen(info->kernel_cmdline);
|
||||
address_space_write(as, p + 8, MEMTXATTRS_UNSPECIFIED,
|
||||
(const uint8_t *)info->kernel_cmdline,
|
||||
cmdline_size + 1);
|
||||
info->kernel_cmdline, cmdline_size + 1);
|
||||
cmdline_size = (cmdline_size >> 2) + 1;
|
||||
WRITE_WORD(p, cmdline_size + 2);
|
||||
WRITE_WORD(p, 0x54410009);
|
||||
@@ -420,8 +419,7 @@ static void set_kernel_args_old(const struct arm_boot_info *info,
|
||||
}
|
||||
s = info->kernel_cmdline;
|
||||
if (s) {
|
||||
address_space_write(as, p, MEMTXATTRS_UNSPECIFIED,
|
||||
(const uint8_t *)s, strlen(s) + 1);
|
||||
address_space_write(as, p, MEMTXATTRS_UNSPECIFIED, s, strlen(s) + 1);
|
||||
} else {
|
||||
WRITE_WORD(p, 0);
|
||||
}
|
||||
|
||||
+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)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user