summaryrefslogtreecommitdiffstats
path: root/memory.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-08-19 13:00:57 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-08-19 13:00:57 +0100
commit0e4a77370594c91dd126f9872893ed473374cc72 (patch)
tree821715343d4c22b6e71d98676b51e63d59466c55 /memory.c
parent8e6e2c2ae7a81f625cf1cb320891d5270e277548 (diff)
parentf54bb15f9d373877954e44db3a8bb368aff45b42 (diff)
downloadhqemu-0e4a77370594c91dd126f9872893ed473374cc72.zip
hqemu-0e4a77370594c91dd126f9872893ed473374cc72.tar.gz
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
SCSI changes that enable sending vendor-specific commands via virtio-scsi. Memory changes for QOMification and automatic tracking of MR lifetime. # gpg: Signature made Mon 18 Aug 2014 13:03:09 BST using RSA key ID 9B4D86F2 # gpg: Good signature from "Paolo Bonzini <pbonzini@redhat.com>" # gpg: aka "Paolo Bonzini <bonzini@gnu.org>" * remotes/bonzini/tags/for-upstream: mtree: remove write-only field memory: Use canonical path component as the name memory: Use memory_region_name for name access memory: constify memory_region_name exec: Abstract away ref to memory region names loader: Abstract away ref to memory region names tpm_tis: remove instance_finalize callback memory: remove memory_region_destroy memory: convert memory_region_destroy to object_unparent ioport: split deletion and destruction nic: do not destroy memory regions in cleanup functions vga: do not dynamically allocate chain4_alias sysbus: remove unused function sysbus_del_io qom: object: move unparenting to the child property's release callback qom: object: delete properties before calling instance_finalize virtio-scsi: implement parse_cdb scsi-block, scsi-generic: implement parse_cdb scsi-block: extract scsi_block_is_passthrough scsi-bus: introduce parse_cdb in SCSIDeviceClass and SCSIBusInfo scsi-bus: prepare scsi_req_new for introduction of parse_cdb Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/memory.c b/memory.c
index dbe6675..d0966c0 100644
--- a/memory.c
+++ b/memory.c
@@ -914,7 +914,6 @@ void memory_region_init(MemoryRegion *mr,
if (size == UINT64_MAX) {
mr->size = int128_2_64();
}
- mr->name = g_strdup(name);
if (name) {
object_property_add_child_array(owner, name, OBJECT(mr));
@@ -1259,16 +1258,9 @@ static void memory_region_finalize(Object *obj)
assert(memory_region_transaction_depth == 0);
mr->destructor(mr);
memory_region_clear_coalescing(mr);
- g_free((char *)mr->name);
g_free(mr->ioeventfds);
}
-void memory_region_destroy(MemoryRegion *mr)
-{
- object_unparent(OBJECT(mr));
-}
-
-
Object *memory_region_owner(MemoryRegion *mr)
{
Object *obj = OBJECT(mr);
@@ -1313,9 +1305,9 @@ uint64_t memory_region_size(MemoryRegion *mr)
return int128_get64(mr->size);
}
-const char *memory_region_name(MemoryRegion *mr)
+const char *memory_region_name(const MemoryRegion *mr)
{
- return mr->name;
+ return object_get_canonical_path_component(OBJECT(mr));
}
bool memory_region_is_ram(MemoryRegion *mr)
@@ -1979,7 +1971,6 @@ typedef struct MemoryRegionList MemoryRegionList;
struct MemoryRegionList {
const MemoryRegion *mr;
- bool printed;
QTAILQ_ENTRY(MemoryRegionList) queue;
};
@@ -2009,7 +2000,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
/* check if the alias is already in the queue */
QTAILQ_FOREACH(ml, alias_print_queue, queue) {
- if (ml->mr == mr->alias && !ml->printed) {
+ if (ml->mr == mr->alias) {
found = true;
}
}
@@ -2017,7 +2008,6 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
if (!found) {
ml = g_new(MemoryRegionList, 1);
ml->mr = mr->alias;
- ml->printed = false;
QTAILQ_INSERT_TAIL(alias_print_queue, ml, queue);
}
mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx
@@ -2032,8 +2022,8 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
mr->romd_mode ? 'R' : '-',
!mr->readonly && !(mr->rom_device && mr->romd_mode) ? 'W'
: '-',
- mr->name,
- mr->alias->name,
+ memory_region_name(mr),
+ memory_region_name(mr->alias),
mr->alias_offset,
mr->alias_offset
+ (int128_nz(mr->size) ?
@@ -2051,7 +2041,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
mr->romd_mode ? 'R' : '-',
!mr->readonly && !(mr->rom_device && mr->romd_mode) ? 'W'
: '-',
- mr->name);
+ memory_region_name(mr));
}
QTAILQ_INIT(&submr_print_queue);
@@ -2099,10 +2089,8 @@ void mtree_info(fprintf_function mon_printf, void *f)
mon_printf(f, "aliases\n");
/* print aliased regions */
QTAILQ_FOREACH(ml, &ml_head, queue) {
- if (!ml->printed) {
- mon_printf(f, "%s\n", ml->mr->name);
- mtree_print_mr(mon_printf, f, ml->mr, 0, 0, &ml_head);
- }
+ mon_printf(f, "%s\n", memory_region_name(ml->mr));
+ mtree_print_mr(mon_printf, f, ml->mr, 0, 0, &ml_head);
}
QTAILQ_FOREACH_SAFE(ml, &ml_head, queue, ml2) {
OpenPOWER on IntegriCloud