mirror of https://github.com/xemu-project/xemu.git
Merge remote-tracking branch 'remotes/bonzini/memory' into staging
* remotes/bonzini/memory: memory: Don't call memory_region_update_coalesced_range if nothing changed memory: MemoryRegion: rename parent to container memory: MemoryRegion: factor out memory region re-adder memory: MemoryRegion: factor out subregion add functionality qtest: fix qtest_clock_warp() for no deadline case exec: dummy_section: Pass address space through. memory: Simplify mr_add_subregion() if-else memory: Don't update all memory region when ioeventfd changed unset RAMBlock idstr when unregister MemoryRegion exec: introduce qemu_ram_unset_idstr() to unset RAMBlock idstr MAINTAINERS: Add myself as Memory API maintainer Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
2edaf21b93
10
MAINTAINERS
10
MAINTAINERS
|
@ -726,6 +726,16 @@ S: Odd Fixes
|
||||||
F: gdbstub*
|
F: gdbstub*
|
||||||
F: gdb-xml/
|
F: gdb-xml/
|
||||||
|
|
||||||
|
Memory API
|
||||||
|
M: Paolo Bonzini <pbonzini@redhat.com>
|
||||||
|
S: Supported
|
||||||
|
F: include/exec/ioport.h
|
||||||
|
F: ioport.c
|
||||||
|
F: include/exec/memory.h
|
||||||
|
F: memory.c
|
||||||
|
F: include/exec/memory-internal.h
|
||||||
|
F: exec.c
|
||||||
|
|
||||||
SPICE
|
SPICE
|
||||||
M: Gerd Hoffmann <kraxel@redhat.com>
|
M: Gerd Hoffmann <kraxel@redhat.com>
|
||||||
S: Supported
|
S: Supported
|
||||||
|
|
2
cpus.c
2
cpus.c
|
@ -347,7 +347,7 @@ void qtest_clock_warp(int64_t dest)
|
||||||
assert(qtest_enabled());
|
assert(qtest_enabled());
|
||||||
while (clock < dest) {
|
while (clock < dest) {
|
||||||
int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
|
int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
|
||||||
int64_t warp = MIN(dest - clock, deadline);
|
int64_t warp = qemu_soonest_timeout(dest - clock, deadline);
|
||||||
seqlock_write_lock(&timers_state.vm_clock_seqlock);
|
seqlock_write_lock(&timers_state.vm_clock_seqlock);
|
||||||
qemu_icount_bias += warp;
|
qemu_icount_bias += warp;
|
||||||
seqlock_write_unlock(&timers_state.vm_clock_seqlock);
|
seqlock_write_unlock(&timers_state.vm_clock_seqlock);
|
||||||
|
|
40
exec.c
40
exec.c
|
@ -1201,17 +1201,24 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
|
static RAMBlock *find_ram_block(ram_addr_t addr)
|
||||||
{
|
{
|
||||||
RAMBlock *new_block, *block;
|
RAMBlock *block;
|
||||||
|
|
||||||
new_block = NULL;
|
|
||||||
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
|
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
|
||||||
if (block->offset == addr) {
|
if (block->offset == addr) {
|
||||||
new_block = block;
|
return block;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
|
||||||
|
{
|
||||||
|
RAMBlock *new_block = find_ram_block(addr);
|
||||||
|
RAMBlock *block;
|
||||||
|
|
||||||
assert(new_block);
|
assert(new_block);
|
||||||
assert(!new_block->idstr[0]);
|
assert(!new_block->idstr[0]);
|
||||||
|
|
||||||
|
@ -1236,6 +1243,15 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
|
||||||
qemu_mutex_unlock_ramlist();
|
qemu_mutex_unlock_ramlist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qemu_ram_unset_idstr(ram_addr_t addr)
|
||||||
|
{
|
||||||
|
RAMBlock *block = find_ram_block(addr);
|
||||||
|
|
||||||
|
if (block) {
|
||||||
|
memset(block->idstr, 0, sizeof(block->idstr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int memory_try_enable_merging(void *addr, size_t len)
|
static int memory_try_enable_merging(void *addr, size_t len)
|
||||||
{
|
{
|
||||||
if (!qemu_opt_get_bool(qemu_get_machine_opts(), "mem-merge", true)) {
|
if (!qemu_opt_get_bool(qemu_get_machine_opts(), "mem-merge", true)) {
|
||||||
|
@ -1760,10 +1776,12 @@ static subpage_t *subpage_init(AddressSpace *as, hwaddr base)
|
||||||
return mmio;
|
return mmio;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t dummy_section(PhysPageMap *map, MemoryRegion *mr)
|
static uint16_t dummy_section(PhysPageMap *map, AddressSpace *as,
|
||||||
|
MemoryRegion *mr)
|
||||||
{
|
{
|
||||||
|
assert(as);
|
||||||
MemoryRegionSection section = {
|
MemoryRegionSection section = {
|
||||||
.address_space = &address_space_memory,
|
.address_space = as,
|
||||||
.mr = mr,
|
.mr = mr,
|
||||||
.offset_within_address_space = 0,
|
.offset_within_address_space = 0,
|
||||||
.offset_within_region = 0,
|
.offset_within_region = 0,
|
||||||
|
@ -1795,13 +1813,13 @@ static void mem_begin(MemoryListener *listener)
|
||||||
AddressSpaceDispatch *d = g_new0(AddressSpaceDispatch, 1);
|
AddressSpaceDispatch *d = g_new0(AddressSpaceDispatch, 1);
|
||||||
uint16_t n;
|
uint16_t n;
|
||||||
|
|
||||||
n = dummy_section(&d->map, &io_mem_unassigned);
|
n = dummy_section(&d->map, as, &io_mem_unassigned);
|
||||||
assert(n == PHYS_SECTION_UNASSIGNED);
|
assert(n == PHYS_SECTION_UNASSIGNED);
|
||||||
n = dummy_section(&d->map, &io_mem_notdirty);
|
n = dummy_section(&d->map, as, &io_mem_notdirty);
|
||||||
assert(n == PHYS_SECTION_NOTDIRTY);
|
assert(n == PHYS_SECTION_NOTDIRTY);
|
||||||
n = dummy_section(&d->map, &io_mem_rom);
|
n = dummy_section(&d->map, as, &io_mem_rom);
|
||||||
assert(n == PHYS_SECTION_ROM);
|
assert(n == PHYS_SECTION_ROM);
|
||||||
n = dummy_section(&d->map, &io_mem_watch);
|
n = dummy_section(&d->map, as, &io_mem_watch);
|
||||||
assert(n == PHYS_SECTION_WATCH);
|
assert(n == PHYS_SECTION_WATCH);
|
||||||
|
|
||||||
d->phys_map = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .skip = 1 };
|
d->phys_map = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .skip = 1 };
|
||||||
|
|
|
@ -54,6 +54,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length);
|
||||||
/* This should not be used by devices. */
|
/* This should not be used by devices. */
|
||||||
MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr);
|
MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr);
|
||||||
void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev);
|
void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev);
|
||||||
|
void qemu_ram_unset_idstr(ram_addr_t addr);
|
||||||
|
|
||||||
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
|
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
|
||||||
int len, int is_write);
|
int len, int is_write);
|
||||||
|
|
|
@ -135,7 +135,7 @@ struct MemoryRegion {
|
||||||
const MemoryRegionIOMMUOps *iommu_ops;
|
const MemoryRegionIOMMUOps *iommu_ops;
|
||||||
void *opaque;
|
void *opaque;
|
||||||
struct Object *owner;
|
struct Object *owner;
|
||||||
MemoryRegion *parent;
|
MemoryRegion *container;
|
||||||
Int128 size;
|
Int128 size;
|
||||||
hwaddr addr;
|
hwaddr addr;
|
||||||
void (*destructor)(MemoryRegion *mr);
|
void (*destructor)(MemoryRegion *mr);
|
||||||
|
@ -815,11 +815,11 @@ void memory_region_set_enabled(MemoryRegion *mr, bool enabled);
|
||||||
/*
|
/*
|
||||||
* memory_region_set_address: dynamically update the address of a region
|
* memory_region_set_address: dynamically update the address of a region
|
||||||
*
|
*
|
||||||
* Dynamically updates the address of a region, relative to its parent.
|
* Dynamically updates the address of a region, relative to its container.
|
||||||
* May be used on regions are currently part of a memory hierarchy.
|
* May be used on regions are currently part of a memory hierarchy.
|
||||||
*
|
*
|
||||||
* @mr: the region to be updated
|
* @mr: the region to be updated
|
||||||
* @addr: new address, relative to parent region
|
* @addr: new address, relative to container region
|
||||||
*/
|
*/
|
||||||
void memory_region_set_address(MemoryRegion *mr, hwaddr addr);
|
void memory_region_set_address(MemoryRegion *mr, hwaddr addr);
|
||||||
|
|
||||||
|
@ -836,16 +836,16 @@ void memory_region_set_alias_offset(MemoryRegion *mr,
|
||||||
hwaddr offset);
|
hwaddr offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* memory_region_present: checks if an address relative to a @parent
|
* memory_region_present: checks if an address relative to a @container
|
||||||
* translates into #MemoryRegion within @parent
|
* translates into #MemoryRegion within @container
|
||||||
*
|
*
|
||||||
* Answer whether a #MemoryRegion within @parent covers the address
|
* Answer whether a #MemoryRegion within @container covers the address
|
||||||
* @addr.
|
* @addr.
|
||||||
*
|
*
|
||||||
* @parent: a #MemoryRegion within which @addr is a relative address
|
* @container: a #MemoryRegion within which @addr is a relative address
|
||||||
* @addr: the area within @parent to be searched
|
* @addr: the area within @container to be searched
|
||||||
*/
|
*/
|
||||||
bool memory_region_present(MemoryRegion *parent, hwaddr addr);
|
bool memory_region_present(MemoryRegion *container, hwaddr addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* memory_region_find: translate an address/size relative to a
|
* memory_region_find: translate an address/size relative to a
|
||||||
|
@ -866,7 +866,7 @@ bool memory_region_present(MemoryRegion *parent, hwaddr addr);
|
||||||
* Similarly, the .@offset_within_address_space is relative to the
|
* Similarly, the .@offset_within_address_space is relative to the
|
||||||
* address space that contains both regions, the passed and the
|
* address space that contains both regions, the passed and the
|
||||||
* returned one. However, in the special case where the @mr argument
|
* returned one. However, in the special case where the @mr argument
|
||||||
* has no parent (and thus is the root of the address space), the
|
* has no container (and thus is the root of the address space), the
|
||||||
* following will hold:
|
* following will hold:
|
||||||
* .@offset_within_address_space >= @addr
|
* .@offset_within_address_space >= @addr
|
||||||
* .@offset_within_address_space + .@size <= @addr + @size
|
* .@offset_within_address_space + .@size <= @addr + @size
|
||||||
|
|
112
memory.c
112
memory.c
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
static unsigned memory_region_transaction_depth;
|
static unsigned memory_region_transaction_depth;
|
||||||
static bool memory_region_update_pending;
|
static bool memory_region_update_pending;
|
||||||
|
static bool ioeventfd_update_pending;
|
||||||
static bool global_dirty_log = false;
|
static bool global_dirty_log = false;
|
||||||
|
|
||||||
/* flat_view_mutex is taken around reading as->current_map; the critical
|
/* flat_view_mutex is taken around reading as->current_map; the critical
|
||||||
|
@ -484,8 +485,8 @@ static AddressSpace *memory_region_to_address_space(MemoryRegion *mr)
|
||||||
{
|
{
|
||||||
AddressSpace *as;
|
AddressSpace *as;
|
||||||
|
|
||||||
while (mr->parent) {
|
while (mr->container) {
|
||||||
mr = mr->parent;
|
mr = mr->container;
|
||||||
}
|
}
|
||||||
QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
|
QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
|
||||||
if (mr == as->root) {
|
if (mr == as->root) {
|
||||||
|
@ -786,22 +787,34 @@ void memory_region_transaction_begin(void)
|
||||||
++memory_region_transaction_depth;
|
++memory_region_transaction_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void memory_region_clear_pending(void)
|
||||||
|
{
|
||||||
|
memory_region_update_pending = false;
|
||||||
|
ioeventfd_update_pending = false;
|
||||||
|
}
|
||||||
|
|
||||||
void memory_region_transaction_commit(void)
|
void memory_region_transaction_commit(void)
|
||||||
{
|
{
|
||||||
AddressSpace *as;
|
AddressSpace *as;
|
||||||
|
|
||||||
assert(memory_region_transaction_depth);
|
assert(memory_region_transaction_depth);
|
||||||
--memory_region_transaction_depth;
|
--memory_region_transaction_depth;
|
||||||
if (!memory_region_transaction_depth && memory_region_update_pending) {
|
if (!memory_region_transaction_depth) {
|
||||||
memory_region_update_pending = false;
|
if (memory_region_update_pending) {
|
||||||
MEMORY_LISTENER_CALL_GLOBAL(begin, Forward);
|
MEMORY_LISTENER_CALL_GLOBAL(begin, Forward);
|
||||||
|
|
||||||
QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
|
QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
|
||||||
address_space_update_topology(as);
|
address_space_update_topology(as);
|
||||||
|
}
|
||||||
|
|
||||||
|
MEMORY_LISTENER_CALL_GLOBAL(commit, Forward);
|
||||||
|
} else if (ioeventfd_update_pending) {
|
||||||
|
QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
|
||||||
|
address_space_update_ioeventfds(as);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
memory_region_clear_pending();
|
||||||
MEMORY_LISTENER_CALL_GLOBAL(commit, Forward);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void memory_region_destructor_none(MemoryRegion *mr)
|
static void memory_region_destructor_none(MemoryRegion *mr)
|
||||||
|
@ -837,7 +850,7 @@ void memory_region_init(MemoryRegion *mr,
|
||||||
mr->opaque = NULL;
|
mr->opaque = NULL;
|
||||||
mr->owner = owner;
|
mr->owner = owner;
|
||||||
mr->iommu_ops = NULL;
|
mr->iommu_ops = NULL;
|
||||||
mr->parent = NULL;
|
mr->container = NULL;
|
||||||
mr->size = int128_make64(size);
|
mr->size = int128_make64(size);
|
||||||
if (size == UINT64_MAX) {
|
if (size == UINT64_MAX) {
|
||||||
mr->size = int128_2_64();
|
mr->size = int128_2_64();
|
||||||
|
@ -1319,6 +1332,7 @@ void memory_region_add_coalescing(MemoryRegion *mr,
|
||||||
void memory_region_clear_coalescing(MemoryRegion *mr)
|
void memory_region_clear_coalescing(MemoryRegion *mr)
|
||||||
{
|
{
|
||||||
CoalescedMemoryRange *cmr;
|
CoalescedMemoryRange *cmr;
|
||||||
|
bool updated = false;
|
||||||
|
|
||||||
qemu_flush_coalesced_mmio_buffer();
|
qemu_flush_coalesced_mmio_buffer();
|
||||||
mr->flush_coalesced_mmio = false;
|
mr->flush_coalesced_mmio = false;
|
||||||
|
@ -1327,8 +1341,12 @@ void memory_region_clear_coalescing(MemoryRegion *mr)
|
||||||
cmr = QTAILQ_FIRST(&mr->coalesced);
|
cmr = QTAILQ_FIRST(&mr->coalesced);
|
||||||
QTAILQ_REMOVE(&mr->coalesced, cmr, link);
|
QTAILQ_REMOVE(&mr->coalesced, cmr, link);
|
||||||
g_free(cmr);
|
g_free(cmr);
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updated) {
|
||||||
|
memory_region_update_coalesced_range(mr);
|
||||||
}
|
}
|
||||||
memory_region_update_coalesced_range(mr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void memory_region_set_flush_coalesced(MemoryRegion *mr)
|
void memory_region_set_flush_coalesced(MemoryRegion *mr)
|
||||||
|
@ -1373,7 +1391,7 @@ void memory_region_add_eventfd(MemoryRegion *mr,
|
||||||
memmove(&mr->ioeventfds[i+1], &mr->ioeventfds[i],
|
memmove(&mr->ioeventfds[i+1], &mr->ioeventfds[i],
|
||||||
sizeof(*mr->ioeventfds) * (mr->ioeventfd_nb-1 - i));
|
sizeof(*mr->ioeventfds) * (mr->ioeventfd_nb-1 - i));
|
||||||
mr->ioeventfds[i] = mrfd;
|
mr->ioeventfds[i] = mrfd;
|
||||||
memory_region_update_pending |= mr->enabled;
|
ioeventfd_update_pending |= mr->enabled;
|
||||||
memory_region_transaction_commit();
|
memory_region_transaction_commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1406,22 +1424,19 @@ void memory_region_del_eventfd(MemoryRegion *mr,
|
||||||
--mr->ioeventfd_nb;
|
--mr->ioeventfd_nb;
|
||||||
mr->ioeventfds = g_realloc(mr->ioeventfds,
|
mr->ioeventfds = g_realloc(mr->ioeventfds,
|
||||||
sizeof(*mr->ioeventfds)*mr->ioeventfd_nb + 1);
|
sizeof(*mr->ioeventfds)*mr->ioeventfd_nb + 1);
|
||||||
memory_region_update_pending |= mr->enabled;
|
ioeventfd_update_pending |= mr->enabled;
|
||||||
memory_region_transaction_commit();
|
memory_region_transaction_commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void memory_region_add_subregion_common(MemoryRegion *mr,
|
static void memory_region_update_container_subregions(MemoryRegion *subregion)
|
||||||
hwaddr offset,
|
|
||||||
MemoryRegion *subregion)
|
|
||||||
{
|
{
|
||||||
|
hwaddr offset = subregion->addr;
|
||||||
|
MemoryRegion *mr = subregion->container;
|
||||||
MemoryRegion *other;
|
MemoryRegion *other;
|
||||||
|
|
||||||
memory_region_transaction_begin();
|
memory_region_transaction_begin();
|
||||||
|
|
||||||
assert(!subregion->parent);
|
|
||||||
memory_region_ref(subregion);
|
memory_region_ref(subregion);
|
||||||
subregion->parent = mr;
|
|
||||||
subregion->addr = offset;
|
|
||||||
QTAILQ_FOREACH(other, &mr->subregions, subregions_link) {
|
QTAILQ_FOREACH(other, &mr->subregions, subregions_link) {
|
||||||
if (subregion->may_overlap || other->may_overlap) {
|
if (subregion->may_overlap || other->may_overlap) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1455,6 +1470,15 @@ done:
|
||||||
memory_region_transaction_commit();
|
memory_region_transaction_commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void memory_region_add_subregion_common(MemoryRegion *mr,
|
||||||
|
hwaddr offset,
|
||||||
|
MemoryRegion *subregion)
|
||||||
|
{
|
||||||
|
assert(!subregion->container);
|
||||||
|
subregion->container = mr;
|
||||||
|
subregion->addr = offset;
|
||||||
|
memory_region_update_container_subregions(subregion);
|
||||||
|
}
|
||||||
|
|
||||||
void memory_region_add_subregion(MemoryRegion *mr,
|
void memory_region_add_subregion(MemoryRegion *mr,
|
||||||
hwaddr offset,
|
hwaddr offset,
|
||||||
|
@ -1479,8 +1503,8 @@ void memory_region_del_subregion(MemoryRegion *mr,
|
||||||
MemoryRegion *subregion)
|
MemoryRegion *subregion)
|
||||||
{
|
{
|
||||||
memory_region_transaction_begin();
|
memory_region_transaction_begin();
|
||||||
assert(subregion->parent == mr);
|
assert(subregion->container == mr);
|
||||||
subregion->parent = NULL;
|
subregion->container = NULL;
|
||||||
QTAILQ_REMOVE(&mr->subregions, subregion, subregions_link);
|
QTAILQ_REMOVE(&mr->subregions, subregion, subregions_link);
|
||||||
memory_region_unref(subregion);
|
memory_region_unref(subregion);
|
||||||
memory_region_update_pending |= mr->enabled && subregion->enabled;
|
memory_region_update_pending |= mr->enabled && subregion->enabled;
|
||||||
|
@ -1498,27 +1522,27 @@ void memory_region_set_enabled(MemoryRegion *mr, bool enabled)
|
||||||
memory_region_transaction_commit();
|
memory_region_transaction_commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void memory_region_readd_subregion(MemoryRegion *mr)
|
||||||
|
{
|
||||||
|
MemoryRegion *container = mr->container;
|
||||||
|
|
||||||
|
if (container) {
|
||||||
|
memory_region_transaction_begin();
|
||||||
|
memory_region_ref(mr);
|
||||||
|
memory_region_del_subregion(container, mr);
|
||||||
|
mr->container = container;
|
||||||
|
memory_region_update_container_subregions(mr);
|
||||||
|
memory_region_unref(mr);
|
||||||
|
memory_region_transaction_commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void memory_region_set_address(MemoryRegion *mr, hwaddr addr)
|
void memory_region_set_address(MemoryRegion *mr, hwaddr addr)
|
||||||
{
|
{
|
||||||
MemoryRegion *parent = mr->parent;
|
if (addr != mr->addr) {
|
||||||
int priority = mr->priority;
|
|
||||||
bool may_overlap = mr->may_overlap;
|
|
||||||
|
|
||||||
if (addr == mr->addr || !parent) {
|
|
||||||
mr->addr = addr;
|
mr->addr = addr;
|
||||||
return;
|
memory_region_readd_subregion(mr);
|
||||||
}
|
}
|
||||||
|
|
||||||
memory_region_transaction_begin();
|
|
||||||
memory_region_ref(mr);
|
|
||||||
memory_region_del_subregion(parent, mr);
|
|
||||||
if (may_overlap) {
|
|
||||||
memory_region_add_subregion_overlap(parent, addr, mr, priority);
|
|
||||||
} else {
|
|
||||||
memory_region_add_subregion(parent, addr, mr);
|
|
||||||
}
|
|
||||||
memory_region_unref(mr);
|
|
||||||
memory_region_transaction_commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void memory_region_set_alias_offset(MemoryRegion *mr, hwaddr offset)
|
void memory_region_set_alias_offset(MemoryRegion *mr, hwaddr offset)
|
||||||
|
@ -1559,10 +1583,10 @@ static FlatRange *flatview_lookup(FlatView *view, AddrRange addr)
|
||||||
sizeof(FlatRange), cmp_flatrange_addr);
|
sizeof(FlatRange), cmp_flatrange_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool memory_region_present(MemoryRegion *parent, hwaddr addr)
|
bool memory_region_present(MemoryRegion *container, hwaddr addr)
|
||||||
{
|
{
|
||||||
MemoryRegion *mr = memory_region_find(parent, addr, 1).mr;
|
MemoryRegion *mr = memory_region_find(container, addr, 1).mr;
|
||||||
if (!mr || (mr == parent)) {
|
if (!mr || (mr == container)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memory_region_unref(mr);
|
memory_region_unref(mr);
|
||||||
|
@ -1580,8 +1604,8 @@ MemoryRegionSection memory_region_find(MemoryRegion *mr,
|
||||||
FlatRange *fr;
|
FlatRange *fr;
|
||||||
|
|
||||||
addr += mr->addr;
|
addr += mr->addr;
|
||||||
for (root = mr; root->parent; ) {
|
for (root = mr; root->container; ) {
|
||||||
root = root->parent;
|
root = root->container;
|
||||||
addr += root->addr;
|
addr += root->addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
savevm.c
2
savevm.c
|
@ -1209,7 +1209,7 @@ void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
|
||||||
|
|
||||||
void vmstate_unregister_ram(MemoryRegion *mr, DeviceState *dev)
|
void vmstate_unregister_ram(MemoryRegion *mr, DeviceState *dev)
|
||||||
{
|
{
|
||||||
/* Nothing do to while the implementation is in RAMBlock */
|
qemu_ram_unset_idstr(memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vmstate_register_ram_global(MemoryRegion *mr)
|
void vmstate_register_ram_global(MemoryRegion *mr)
|
||||||
|
|
Loading…
Reference in New Issue