system/memory: Constify various RAMBlock/MemoryRegion arguments
v2 cover system/memory: Constify various RAMBlock/MemoryRegion arguments
v2:
- Dropped "stubs: Merge physmem.c within ram-block.c" (Zoltan)
- Dropped "info mtree" patches (no time to update doc for freeze)
- New Xen patch
Philippe Mathieu-Daudé (4):
system/ramblock: Constify various RAMBlock arguments system/memory: Constify various MemoryRegion arguments system/xen: Constify various MemoryRegion arguments system/memory: Have memory_region_type() correctly describe containers
include/system/memory.h | 38 ++++++++++++++++----------------- include/system/ramblock.h | 28 ++++++++++++------------ include/system/xen-mapcache.h | 2 +- include/system/xen.h | 6 +++--- hw/xen/xen-hvm-common.c | 8 +++---- hw/xen/xen-mapcache.c | 2 +- hw/xen/xen_stubs.c | 6 +++--- stubs/physmem.c | 2 +- stubs/ram-block.c | 6 +++--- system/memory.c | 40 +++++++++++++++++++---------------- system/physmem.c | 30 +++++++++++++------------- 11 files changed, 86 insertions(+), 82 deletions(-)
Signature · 1 line
2.53.0
PATCH v2 1/4 system/ramblock: Constify various RAMBlock arguments
Mark the RAMBlock structure const when is only accessed read-only.
--- include/system/ramblock.h | 28 ++++++++++++++-------------- stubs/physmem.c | 2 +- stubs/ram-block.c | 6 +++--- system/physmem.c | 28 ++++++++++++++-------------- 4 files changed, 32 insertions(+), 32 deletions(-)
include/system/ramblock.h +14 -14
@@ -154,26 +154,26 @@ RAMBlock *qemu_ram_block_by_name(const char *name);*/ RAMBlock *qemu_ram_block_from_host (void *ptr,bool round_offset,ram_addr_t *offset); -ram_addr_t qemu_ram_block_host_offset (RAMBlock *rb,void *host); +ram_addr_t qemu_ram_block_host_offset (const RAMBlock *rb,void *host);void qemu_ram_set_idstr (RAMBlock *block,const char *name,DeviceState *dev);void qemu_ram_unset_idstr (RAMBlock *block); -const char *qemu_ram_get_idstr (RAMBlock *rb); -void *qemu_ram_get_host_addr (RAMBlock *rb); -ram_addr_t qemu_ram_get_offset (RAMBlock *rb); -ram_addr_t qemu_ram_get_fd_offset (RAMBlock *rb); -ram_addr_t qemu_ram_get_used_length (RAMBlock *rb); -ram_addr_t qemu_ram_get_max_length (RAMBlock *rb); -bool qemu_ram_is_shared (RAMBlock *rb); -bool qemu_ram_is_noreserve (RAMBlock *rb); -bool qemu_ram_is_uf_zeroable (RAMBlock *rb); +const char *qemu_ram_get_idstr (const RAMBlock *rb); +void *qemu_ram_get_host_addr (const RAMBlock *rb); +ram_addr_t qemu_ram_get_offset (const RAMBlock *rb); +ram_addr_t qemu_ram_get_fd_offset (const RAMBlock *rb); +ram_addr_t qemu_ram_get_used_length (const RAMBlock *rb); +ram_addr_t qemu_ram_get_max_length (const RAMBlock *rb); +bool qemu_ram_is_shared (const RAMBlock *rb); +bool qemu_ram_is_noreserve (const RAMBlock *rb); +bool qemu_ram_is_uf_zeroable (const RAMBlock *rb);void qemu_ram_set_uf_zeroable (RAMBlock *rb); -bool qemu_ram_is_migratable (RAMBlock *rb); +bool qemu_ram_is_migratable (const RAMBlock *rb);void qemu_ram_set_migratable (RAMBlock *rb);void qemu_ram_unset_migratable (RAMBlock *rb); -bool qemu_ram_is_named_file (RAMBlock *rb); -int qemu_ram_get_fd (RAMBlock *rb); +bool qemu_ram_is_named_file (const RAMBlock *rb); +int qemu_ram_get_fd (const RAMBlock *rb); -size_t qemu_ram_pagesize (RAMBlock *block); +size_t qemu_ram_pagesize (const RAMBlock *block);size_t qemu_ram_pagesize_largest (void );#include "exec/target_page.h" #include "exec/hwaddr.h"
stubs/physmem.c +1 -1
@@ -7,7 +7,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,return NULL ; } -int qemu_ram_get_fd (RAMBlock *rb) +int qemu_ram_get_fd (const RAMBlock *rb) {return -1 ; }
stubs/ram-block.c +3 -3
@@ -3,17 +3,17 @@#include "system/ramblock.h" #include "system/memory.h" -void *qemu_ram_get_host_addr (RAMBlock *rb) +void *qemu_ram_get_host_addr (const RAMBlock *rb) {return 0 ; } -ram_addr_t qemu_ram_get_offset (RAMBlock *rb) +ram_addr_t qemu_ram_get_offset (const RAMBlock *rb) {return 0 ; } -ram_addr_t qemu_ram_get_used_length (RAMBlock *rb) +ram_addr_t qemu_ram_get_used_length (const RAMBlock *rb) {return 0 ; }
system/physmem.c +14 -14
@@ -1859,48 +1859,48 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t size) } } -const char *qemu_ram_get_idstr (RAMBlock *rb) +const char *qemu_ram_get_idstr (const RAMBlock *rb) {return rb->idstr; } -void *qemu_ram_get_host_addr (RAMBlock *rb) +void *qemu_ram_get_host_addr (const RAMBlock *rb) {return rb->host; } -ram_addr_t qemu_ram_get_offset (RAMBlock *rb) +ram_addr_t qemu_ram_get_offset (const RAMBlock *rb) {return rb->offset; } -ram_addr_t qemu_ram_get_fd_offset (RAMBlock *rb) +ram_addr_t qemu_ram_get_fd_offset (const RAMBlock *rb) {return rb->fd_offset; } -ram_addr_t qemu_ram_get_used_length (RAMBlock *rb) +ram_addr_t qemu_ram_get_used_length (const RAMBlock *rb) {return rb->used_length; } -ram_addr_t qemu_ram_get_max_length (RAMBlock *rb) +ram_addr_t qemu_ram_get_max_length (const RAMBlock *rb) {return rb->max_length; } -bool qemu_ram_is_shared (RAMBlock *rb) +bool qemu_ram_is_shared (const RAMBlock *rb) {return rb->flags &RAM_SHARED ; } -bool qemu_ram_is_noreserve (RAMBlock *rb) +bool qemu_ram_is_noreserve (const RAMBlock *rb) {return rb->flags &RAM_NORESERVE ; }/* Note: Only set at the start of postcopy */ -bool qemu_ram_is_uf_zeroable (RAMBlock *rb) +bool qemu_ram_is_uf_zeroable (const RAMBlock *rb) {return rb->flags &RAM_UF_ZEROPAGE ; }
@@ -1910,7 +1910,7 @@ void qemu_ram_set_uf_zeroable(RAMBlock *rb) rb->flags |=RAM_UF_ZEROPAGE ; } -bool qemu_ram_is_migratable (RAMBlock *rb) +bool qemu_ram_is_migratable (const RAMBlock *rb) {return rb->flags &RAM_MIGRATABLE ; }
@@ -1925,12 +1925,12 @@ void qemu_ram_unset_migratable(RAMBlock *rb) rb->flags &= ~RAM_MIGRATABLE ; } -bool qemu_ram_is_named_file (RAMBlock *rb) +bool qemu_ram_is_named_file (const RAMBlock *rb) {return rb->flags &RAM_NAMED_FILE ; } -int qemu_ram_get_fd (RAMBlock *rb) +int qemu_ram_get_fd (const RAMBlock *rb) {return rb->fd; }
@@ -1987,7 +1987,7 @@ static char *cpr_name(MemoryRegion *mr) } } -size_t qemu_ram_pagesize (RAMBlock *rb) +size_t qemu_ram_pagesize (const RAMBlock *rb) {return rb->page_size; }
@@ -2772,7 +2772,7 @@ void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr) }/* Return the offset of a hostpointer within a ramblock */ -ram_addr_t qemu_ram_block_host_offset (RAMBlock *rb,void *host) +ram_addr_t qemu_ram_block_host_offset (const RAMBlock *rb,void *host) {ram_addr_t res = (uint8_t *)host - (uint8_t *)rb->host;assert ((uintptr_t )host >= (uintptr_t )rb->host);
Signature · 1 line
2.53.0
PATCH v2 2/4 system/memory: Constify various MemoryRegion arguments
In reply to Philippe Mathieu-DaudéMark the MemoryRegion structure const when is only accessed read-only.
--- include/system/memory.h | 38 +++++++++++++++++++------------------- system/memory.c | 38 ++++++++++++++++++++------------------ system/physmem.c | 2 +- 3 files changed, 40 insertions(+), 38 deletions(-)
include/system/memory.h +19 -19
@@ -1749,14 +1749,14 @@ bool memory_region_init_rom_device(MemoryRegion *mr,* * @mr: the memory region being queried. */ -Object *memory_region_owner (MemoryRegion *mr); +Object *memory_region_owner (const MemoryRegion *mr);/** * memory_region_size: get a memory region's size. * * @mr: the memory region being queried. */ -uint64_t memory_region_size (MemoryRegion *mr); +uint64_t memory_region_size (const MemoryRegion *mr);/** * memory_region_is_ram: check whether a memory region is random access
@@ -1765,7 +1765,7 @@ uint64_t memory_region_size(MemoryRegion *mr);* * @mr: the memory region being queried */ -static inline bool memory_region_is_ram (MemoryRegion *mr) +static inline bool memory_region_is_ram (const MemoryRegion *mr) {return mr->ram; }
@@ -1777,7 +1777,7 @@ static inline bool memory_region_is_ram(MemoryRegion *mr)* * @mr: the memory region being queried */ -bool memory_region_is_ram_device (MemoryRegion *mr); +bool memory_region_is_ram_device (const MemoryRegion *mr);/** * memory_region_is_romd: check whether a memory region is in ROMD mode
@@ -1787,7 +1787,7 @@ bool memory_region_is_ram_device(MemoryRegion *mr);* * @mr: the memory region being queried */ -static inline bool memory_region_is_romd (MemoryRegion *mr) +static inline bool memory_region_is_romd (const MemoryRegion *mr) {return mr->rom_device && mr->romd_mode; }
@@ -1800,7 +1800,7 @@ static inline bool memory_region_is_romd(MemoryRegion *mr)* * @mr: the memory region being queried */ -bool memory_region_is_protected (MemoryRegion *mr); +bool memory_region_is_protected (const MemoryRegion *mr);/** * memory_region_has_guest_memfd: check whether a memory region has guest_memfd
@@ -1810,7 +1810,7 @@ bool memory_region_is_protected(MemoryRegion *mr);* * @mr: the memory region being queried */ -bool memory_region_has_guest_memfd (MemoryRegion *mr); +bool memory_region_has_guest_memfd (const MemoryRegion *mr);/** * memory_region_get_iommu: check whether a memory region is an iommu
@@ -1820,7 +1820,7 @@ bool memory_region_has_guest_memfd(MemoryRegion *mr);* * @mr: the memory region being queried */ -static inline IOMMUMemoryRegion *memory_region_get_iommu (MemoryRegion *mr) +static inline IOMMUMemoryRegion *memory_region_get_iommu (const MemoryRegion *mr) {if (mr->alias) {return memory_region_get_iommu (mr->alias);
@@ -1991,7 +1991,7 @@ const char *memory_region_name(const MemoryRegion *mr);* @mr: the memory region being queried * @client: the client being queried */ -bool memory_region_is_logging (MemoryRegion *mr,uint8_t client); +bool memory_region_is_logging (const MemoryRegion *mr,uint8_t client);/** * memory_region_get_dirty_log_mask: return the clients for which a
@@ -2002,7 +2002,7 @@ bool memory_region_is_logging(MemoryRegion *mr, uint8_t client);* * @mr: the memory region being queried */ -uint8_t memory_region_get_dirty_log_mask (MemoryRegion *mr); +uint8_t memory_region_get_dirty_log_mask (const MemoryRegion *mr);/** * memory_region_is_rom: check whether a memory region is ROM
@@ -2011,7 +2011,7 @@ uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr);* * @mr: the memory region being queried */ -static inline bool memory_region_is_rom (MemoryRegion *mr) +static inline bool memory_region_is_rom (const MemoryRegion *mr) {return mr->ram && mr->readonly; }
@@ -2023,7 +2023,7 @@ static inline bool memory_region_is_rom(MemoryRegion *mr)* * @mr: the memory region being queried */ -static inline bool memory_region_is_nonvolatile (MemoryRegion *mr) +static inline bool memory_region_is_nonvolatile (const MemoryRegion *mr) {return mr->nonvolatile; }
@@ -2036,7 +2036,7 @@ static inline bool memory_region_is_nonvolatile(MemoryRegion *mr)* * @mr: the RAM or alias memory region being queried. */ -int memory_region_get_fd (MemoryRegion *mr); +int memory_region_get_fd (const MemoryRegion *mr);/** * memory_region_from_host: Convert a pointer into a RAM memory region
@@ -2071,7 +2071,7 @@ MemoryRegion *memory_region_from_host(void *ptr, ram_addr_t *offset);* * @mr: the memory region being queried. */ -void *memory_region_get_ram_ptr (MemoryRegion *mr); +void *memory_region_get_ram_ptr (const MemoryRegion *mr);/* memory_region_ram_resize: Resize a RAM region. *
@@ -2421,7 +2421,7 @@ void memory_region_add_subregion_overlap(MemoryRegion *mr,* * @mr: the region to be queried */ -ram_addr_t memory_region_get_ram_addr (MemoryRegion *mr); +ram_addr_t memory_region_get_ram_addr (const MemoryRegion *mr);uint64_t memory_region_get_alignment (const MemoryRegion *mr);/**
@@ -2521,7 +2521,7 @@ bool memory_region_present(MemoryRegion *container, hwaddr addr);* * @mr: a #MemoryRegion which should be checked if it's mapped */ -bool memory_region_is_mapped (MemoryRegion *mr); +bool memory_region_is_mapped (const MemoryRegion *mr);/** * memory_region_get_ram_discard_manager: get the #RamDiscardManager for a
@@ -2967,7 +2967,7 @@ void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr);int memory_access_size (MemoryRegion *mr,unsigned l,hwaddr addr);bool prepare_mmio_access (MemoryRegion *mr); -static inline bool memory_region_supports_direct_access (MemoryRegion *mr) +static inline bool memory_region_supports_direct_access (const MemoryRegion *mr) {/* ROM DEVICE regions only allow direct access if in ROMD mode. */ if (memory_region_is_romd (mr)) {
@@ -2984,8 +2984,8 @@ static inline bool memory_region_supports_direct_access(MemoryRegion *mr)return !memory_region_is_ram_device (mr); } -static inline bool memory_access_is_direct (MemoryRegion *mr,bool is_write, -MemTxAttrs attrs) +static inline bool memory_access_is_direct (const MemoryRegion *mr, +bool is_write,MemTxAttrs attrs) {if (!memory_region_supports_direct_access (mr)) {return false;
system/memory.c +20 -18
@@ -1819,9 +1819,9 @@ static void memory_region_finalize(Object *obj)g_free (mr->ioeventfds); } -Object *memory_region_owner (MemoryRegion *mr) +Object *memory_region_owner (const MemoryRegion *mr) { -Object *obj =OBJECT (mr); +const Object *obj =OBJECT (mr);return obj->parent; }
@@ -1849,7 +1849,7 @@ void memory_region_unref(MemoryRegion *mr) } } -uint64_t memory_region_size (MemoryRegion *mr) +uint64_t memory_region_size (const MemoryRegion *mr) {if (int128_eq (mr->size,int128_2_64 ())) {return UINT64_MAX ;
@@ -1866,25 +1866,25 @@ const char *memory_region_name(const MemoryRegion *mr)return mr->name; } -bool memory_region_is_ram_device (MemoryRegion *mr) +bool memory_region_is_ram_device (const MemoryRegion *mr) {return mr->ram_device; } -bool memory_region_is_protected (MemoryRegion *mr) +bool memory_region_is_protected (const MemoryRegion *mr) {return mr->ram && (mr->ram_block->flags &RAM_PROTECTED ); } -bool memory_region_has_guest_memfd (MemoryRegion *mr) +bool memory_region_has_guest_memfd (const MemoryRegion *mr) {return mr->ram_block && mr->ram_block->guest_memfd >=0 ; } -uint8_t memory_region_get_dirty_log_mask (MemoryRegion *mr) +uint8_t memory_region_get_dirty_log_mask (const MemoryRegion *mr) {uint8_t mask = mr->dirty_log_mask; -RAMBlock *rb = mr->ram_block; +const RAMBlock *rb = mr->ram_block;if (global_dirty_tracking && ((rb &&qemu_ram_is_migratable (rb)) ||memory_region_is_iommu (mr))) {
@@ -1898,7 +1898,7 @@ uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr)return mask; } -bool memory_region_is_logging (MemoryRegion *mr,uint8_t client) +bool memory_region_is_logging (const MemoryRegion *mr,uint8_t client) {return memory_region_get_dirty_log_mask (mr) & (1 << client); }
@@ -2406,7 +2406,7 @@ void memory_region_reset_dirty(MemoryRegion *mr, hwaddr addr, memory_region_get_ram_addr(mr) + addr, size, client, NULL); } -int memory_region_get_fd (MemoryRegion *mr) +int memory_region_get_fd (const MemoryRegion *mr) {RCU_READ_LOCK_GUARD ();while (mr->alias) {
@@ -2415,7 +2415,7 @@ int memory_region_get_fd(MemoryRegion *mr)return mr->ram_block->fd; } -void *memory_region_get_ram_ptr (MemoryRegion *mr) +void *memory_region_get_ram_ptr (const MemoryRegion *mr) {uint64_t offset =0 ;
@@ -2440,7 +2440,7 @@ MemoryRegion *memory_region_from_host(void *ptr, ram_addr_t *offset)return block->mr; } -ram_addr_t memory_region_get_ram_addr (MemoryRegion *mr) +ram_addr_t memory_region_get_ram_addr (const MemoryRegion *mr) {return mr->ram_block ? mr->ram_block->offset :RAM_ADDR_INVALID ; }
@@ -2806,7 +2806,7 @@ static FlatRange *flatview_lookup(FlatView *view, AddrRange addr) sizeof(FlatRange), cmp_flatrange_addr); } -bool memory_region_is_mapped (MemoryRegion *mr) +bool memory_region_is_mapped (const MemoryRegion *mr) {return !!mr->container || mr->mapped_via_alias; }
@@ -3290,7 +3290,7 @@ void address_space_destroy_free(AddressSpace *as)call_rcu (as, do_address_space_destroy_free, rcu); } -static const char *memory_region_type (MemoryRegion *mr) +static const char *memory_region_type (const MemoryRegion *mr) {if (mr->alias) {return memory_region_type (mr->alias);
@@ -3483,7 +3483,6 @@ static void mtree_print_flatview(gpointer key, gpointer value,GArray *fv_address_spaces = value;struct FlatViewInfo *fvi = user_data;FlatRange *range = &view->ranges[0 ]; -MemoryRegion *mr;int n = view->nr;int i;AddressSpace *as;
@@ -3510,7 +3509,8 @@ static void mtree_print_flatview(gpointer key, gpointer value, }while (n--) { - mr = range->mr; +const MemoryRegion *mr = range->mr; +if (range->offset_in_region) { qemu_printf(MTREE_INDENT HWADDR_FMT_plx "-" HWADDR_FMT_plx " (prio %d, %s%s): %s @" HWADDR_FMT_plx,
@@ -3683,8 +3683,10 @@ static void mtree_info_as(bool dispatch_tree, bool owner, bool disabled)/* print aliased regions */ QTAILQ_FOREACH(ml, &ml_head, mrqueue) { -qemu_printf ("memory-region: %s\n" ,memory_region_name (ml->mr)); -mtree_print_mr (ml->mr,1 ,0 , &ml_head, owner, disabled); +const MemoryRegion *mr = ml->mr; + +qemu_printf ("memory-region: %s\n" ,memory_region_name (mr)); +mtree_print_mr (mr,1 ,0 , &ml_head, owner, disabled);qemu_printf ("\n" ); }
system/physmem.c +1 -1
@@ -1975,7 +1975,7 @@ void qemu_ram_unset_idstr(RAMBlock *block) } } -static char *cpr_name (MemoryRegion *mr) +static char *cpr_name (const MemoryRegion *mr) {const char *mr_name =memory_region_name (mr); g_autofree char *id = mr->dev ? qdev_get_dev_path(mr->dev) : NULL;
Signature · 1 line
2.53.0
PATCH v2 3/4 system/xen: Constify various MemoryRegion arguments
In reply to Philippe Mathieu-DaudéMark the MemoryRegion structure const when is only accessed read-only.
--- include/system/xen-mapcache.h | 2 +- include/system/xen.h | 6 +++--- hw/xen/xen-hvm-common.c | 8 ++++---- hw/xen/xen-mapcache.c | 2 +- hw/xen/xen_stubs.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-)
include/system/xen-mapcache.h +1 -1
@@ -16,7 +16,7 @@ typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr phys_offset,bool xen_map_cache_enabled (void );void xen_map_cache_init (phys_offset_to_gaddr_t f,void *opaque); -uint8_t *xen_map_cache (MemoryRegion *mr,hwaddr phys_addr,hwaddr size, +uint8_t *xen_map_cache (const MemoryRegion *mr,hwaddr phys_addr,hwaddr size,ram_addr_t ram_addr_offset,uint8_t lock,bool dma,bool is_write);
include/system/xen.h +3 -3
@@ -30,7 +30,7 @@ extern bool xen_allowed;void xen_hvm_modified_memory (ram_addr_t start,ram_addr_t length);void xen_ram_alloc (ram_addr_t ram_addr,ram_addr_t size, -struct MemoryRegion *mr,Error **errp); -bool xen_mr_is_memory (MemoryRegion *mr); -bool xen_mr_is_grants (MemoryRegion *mr); +const MemoryRegion *mr,Error **errp); +bool xen_mr_is_memory (const MemoryRegion *mr); +bool xen_mr_is_grants (const MemoryRegion *mr);#endif
hw/xen/xen-hvm-common.c +4 -4
@@ -23,19 +23,19 @@MemoryRegion xen_memory, xen_grants;/* Check for any kind of xen memory, foreign mappings or grants. */ -bool xen_mr_is_memory (MemoryRegion *mr) +bool xen_mr_is_memory (const MemoryRegion *mr) {return mr == &xen_memory || mr == &xen_grants; }/* Check specifically for grants. */ -bool xen_mr_is_grants (MemoryRegion *mr) +bool xen_mr_is_grants (const MemoryRegion *mr) {return mr == &xen_grants; } -void xen_ram_alloc (ram_addr_t ram_addr,ram_addr_t size,MemoryRegion *mr, -Error **errp) +void xen_ram_alloc (ram_addr_t ram_addr,ram_addr_t size, +const MemoryRegion *mr,Error **errp) {unsigned target_page_bits =qemu_target_page_bits ();unsigned long nr_pfn;
hw/xen/xen-mapcache.c +1 -1
@@ -460,7 +460,7 @@ tryagain:return mc->last_entry->vaddr_base + address_offset; } -uint8_t *xen_map_cache(MemoryRegion *mr, +uint8_t *xen_map_cache(const MemoryRegion *mr, hwaddr phys_addr, hwaddr size, ram_addr_t ram_addr_offset, uint8_t lock, bool dma,
hw/xen/xen_stubs.c +3 -3
@@ -19,12 +19,12 @@ void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) }void xen_ram_alloc (ram_addr_t ram_addr,ram_addr_t size, -struct MemoryRegion *mr,Error **errp) +const MemoryRegion *mr,Error **errp) {g_assert_not_reached (); } -bool xen_mr_is_memory (MemoryRegion *mr) +bool xen_mr_is_memory (const MemoryRegion *mr) {g_assert_not_reached (); }
@@ -44,7 +44,7 @@ ram_addr_t xen_ram_addr_from_mapcache(void *ptr)g_assert_not_reached (); } -uint8_t *xen_map_cache(MemoryRegion *mr, +uint8_t *xen_map_cache(const MemoryRegion *mr, hwaddr phys_addr, hwaddr size, ram_addr_t ram_addr_offset,
Signature · 1 line
2.53.0
Re: [PATCH v2 3/4] system/xen: Constify various MemoryRegion arguments
Quoted 11 lines · Philippe Mathieu-Daudé
Mark the MemoryRegion structure const when is only accessed read-only.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/system/xen-mapcache.h | 2 +- include/system/xen.h | 6 +++--- hw/xen/xen-hvm-common.c | 8 ++++---- hw/xen/xen-mapcache.c | 2 +- hw/xen/xen_stubs.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-)
PATCH v2 4/4 system/memory: Have memory_region_type() correctly describe containers
In reply to Philippe Mathieu-DaudéMemoryRegion containers are not I/O regions,
describe them as 'container'.
--- system/memory.c | 2 ++ 1 file changed, 2 insertions(+)
system/memory.c +2 -0
@@ -3303,6 +3303,8 @@ static const char *memory_region_type(const MemoryRegion *mr)return "rom" ; }else if (memory_region_is_ram (mr)) {return "ram" ; + }else if (!mr->container) { +return "container" ; }else {return "i/o" ; }
Signature · 1 line
2.53.0
Quoted 10 lines · Philippe Mathieu-Daudé
v2:
- Dropped "stubs: Mergephysmem.cwithinram-block.c" (Zoltan)
- Dropped "info mtree" patches (no time to update doc for freeze)
- New Xen patchPhilippe Mathieu-Daudé (4):
system/ramblock: Constify various RAMBlock arguments system/memory: Constify various MemoryRegion arguments system/xen: Constify various MemoryRegion arguments system/memory: Havememory_region_type()correctly describe containers
queued
Signature · 1 line
Peter Xu