memory: Rename mem_begin/mem_commit/mem_add helpers

This renames some helpers to reflect better what they do.

This should cause no behavioural change.

Backports commit 8629d3fcb77e9775e44d9051bad0fb5187925eae from qemu
This commit is contained in:
Alexey Kardashevskiy 2018-03-11 21:34:55 -04:00 committed by Lioncash
parent 489abbbd8b
commit d9bc1bcc8c
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
17 changed files with 52 additions and 59 deletions

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_aarch64
#define address_space_cache_invalidate address_space_cache_invalidate_aarch64
#define address_space_destroy address_space_destroy_aarch64
#define address_space_dispatch_compact address_space_dispatch_compact_aarch64
#define address_space_dispatch_free address_space_dispatch_free_aarch64
#define address_space_dispatch_new address_space_dispatch_new_aarch64
#define address_space_get_flatview address_space_get_flatview_aarch64
#define address_space_init address_space_init_aarch64
#define address_space_init_dispatch address_space_init_dispatch_aarch64
@ -443,6 +445,7 @@
#define find_string find_string_aarch64
#define find_type find_type_aarch64
#define flatrange_equal flatrange_equal_aarch64
#define flatview_add_to_dispatch flatview_add_to_dispatch_aarch64
#define flatview_destroy flatview_destroy_aarch64
#define flatview_init flatview_init_aarch64
#define flatview_insert flatview_insert_aarch64
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_aarch64
#define mapping_have_same_region mapping_have_same_region_aarch64
#define mapping_merge mapping_merge_aarch64
#define mem_add mem_add_aarch64
#define mem_begin mem_begin_aarch64
#define mem_commit mem_commit_aarch64
#define memory_access_size memory_access_size_aarch64
#define memory_free memory_free_aarch64
#define memory_init memory_init_aarch64

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_aarch64eb
#define address_space_cache_invalidate address_space_cache_invalidate_aarch64eb
#define address_space_destroy address_space_destroy_aarch64eb
#define address_space_dispatch_compact address_space_dispatch_compact_aarch64eb
#define address_space_dispatch_free address_space_dispatch_free_aarch64eb
#define address_space_dispatch_new address_space_dispatch_new_aarch64eb
#define address_space_get_flatview address_space_get_flatview_aarch64eb
#define address_space_init address_space_init_aarch64eb
#define address_space_init_dispatch address_space_init_dispatch_aarch64eb
@ -443,6 +445,7 @@
#define find_string find_string_aarch64eb
#define find_type find_type_aarch64eb
#define flatrange_equal flatrange_equal_aarch64eb
#define flatview_add_to_dispatch flatview_add_to_dispatch_aarch64eb
#define flatview_destroy flatview_destroy_aarch64eb
#define flatview_init flatview_init_aarch64eb
#define flatview_insert flatview_insert_aarch64eb
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_aarch64eb
#define mapping_have_same_region mapping_have_same_region_aarch64eb
#define mapping_merge mapping_merge_aarch64eb
#define mem_add mem_add_aarch64eb
#define mem_begin mem_begin_aarch64eb
#define mem_commit mem_commit_aarch64eb
#define memory_access_size memory_access_size_aarch64eb
#define memory_free memory_free_aarch64eb
#define memory_init memory_init_aarch64eb

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_arm
#define address_space_cache_invalidate address_space_cache_invalidate_arm
#define address_space_destroy address_space_destroy_arm
#define address_space_dispatch_compact address_space_dispatch_compact_arm
#define address_space_dispatch_free address_space_dispatch_free_arm
#define address_space_dispatch_new address_space_dispatch_new_arm
#define address_space_get_flatview address_space_get_flatview_arm
#define address_space_init address_space_init_arm
#define address_space_init_dispatch address_space_init_dispatch_arm
@ -443,6 +445,7 @@
#define find_string find_string_arm
#define find_type find_type_arm
#define flatrange_equal flatrange_equal_arm
#define flatview_add_to_dispatch flatview_add_to_dispatch_arm
#define flatview_destroy flatview_destroy_arm
#define flatview_init flatview_init_arm
#define flatview_insert flatview_insert_arm
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_arm
#define mapping_have_same_region mapping_have_same_region_arm
#define mapping_merge mapping_merge_arm
#define mem_add mem_add_arm
#define mem_begin mem_begin_arm
#define mem_commit mem_commit_arm
#define memory_access_size memory_access_size_arm
#define memory_free memory_free_arm
#define memory_init memory_init_arm

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_armeb
#define address_space_cache_invalidate address_space_cache_invalidate_armeb
#define address_space_destroy address_space_destroy_armeb
#define address_space_dispatch_compact address_space_dispatch_compact_armeb
#define address_space_dispatch_free address_space_dispatch_free_armeb
#define address_space_dispatch_new address_space_dispatch_new_armeb
#define address_space_get_flatview address_space_get_flatview_armeb
#define address_space_init address_space_init_armeb
#define address_space_init_dispatch address_space_init_dispatch_armeb
@ -443,6 +445,7 @@
#define find_string find_string_armeb
#define find_type find_type_armeb
#define flatrange_equal flatrange_equal_armeb
#define flatview_add_to_dispatch flatview_add_to_dispatch_armeb
#define flatview_destroy flatview_destroy_armeb
#define flatview_init flatview_init_armeb
#define flatview_insert flatview_insert_armeb
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_armeb
#define mapping_have_same_region mapping_have_same_region_armeb
#define mapping_merge mapping_merge_armeb
#define mem_add mem_add_armeb
#define mem_begin mem_begin_armeb
#define mem_commit mem_commit_armeb
#define memory_access_size memory_access_size_armeb
#define memory_free memory_free_armeb
#define memory_init memory_init_armeb

View file

@ -281,7 +281,7 @@ static void phys_page_compact(PhysPageEntry *lp, Node *nodes, unsigned long *com
}
}
static void phys_page_compact_all(AddressSpaceDispatch *d, int nodes_nb)
void address_space_dispatch_compact(AddressSpaceDispatch *d)
{
//DECLARE_BITMAP(compacted, nodes_nb);
// this isnt actually used
@ -1093,7 +1093,7 @@ static void register_multipage(FlatView *fv,
phys_page_set(d, start_addr >> TARGET_PAGE_BITS, num_pages, section_index);
}
void mem_add(FlatView *fv, MemoryRegionSection *section)
void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section)
{
MemoryRegionSection now = *section, remain = *section;
Int128 page_size = int128_make64(TARGET_PAGE_SIZE);
@ -1853,15 +1853,13 @@ MemoryRegion *iotlb_to_region(CPUState *cpu, hwaddr index, MemTxAttrs attrs)
return sections[index & ~TARGET_PAGE_MASK].mr;
}
AddressSpaceDispatch *mem_begin(AddressSpace *as)
AddressSpaceDispatch *address_space_dispatch_new(struct uc_struct *uc, FlatView *fv)
{
FlatView *fv = address_space_to_flatview(as);
AddressSpaceDispatch *d = g_new0(AddressSpaceDispatch, 1);
uint16_t n;
PhysPageEntry ppe = { 1, PHYS_MAP_NODE_NIL };
struct uc_struct *uc = as->uc;
d->uc = as->uc;
d->uc = uc;
n = dummy_section(&d->map, fv, &uc->io_mem_unassigned);
assert(n == PHYS_SECTION_UNASSIGNED);
@ -1883,11 +1881,6 @@ void address_space_dispatch_free(AddressSpaceDispatch *d)
g_free(d);
}
void mem_commit(AddressSpaceDispatch *d)
{
phys_page_compact_all(d, d->map.nodes_nb);
}
static void tcg_commit(MemoryListener *listener)
{
CPUAddressSpace *cpuas;

View file

@ -60,7 +60,9 @@ symbols = (
'address_space_cache_init',
'address_space_cache_invalidate',
'address_space_destroy',
'address_space_dispatch_compact',
'address_space_dispatch_free',
'address_space_dispatch_new',
'address_space_get_flatview',
'address_space_init',
'address_space_init_dispatch',
@ -449,6 +451,7 @@ symbols = (
'find_string',
'find_type',
'flatrange_equal',
'flatview_add_to_dispatch',
'flatview_destroy',
'flatview_init',
'flatview_insert',
@ -1759,9 +1762,6 @@ symbols = (
'mapping_contiguous',
'mapping_have_same_region',
'mapping_merge',
'mem_add',
'mem_begin',
'mem_commit',
'memory_access_size',
'memory_free',
'memory_init',

View file

@ -27,9 +27,9 @@ extern const MemoryRegionOps unassigned_mem_ops;
bool memory_region_access_valid(MemoryRegion *mr, hwaddr addr,
unsigned size, bool is_write);
void mem_add(FlatView *fv, MemoryRegionSection *section);
AddressSpaceDispatch *mem_begin(AddressSpace *as);
void mem_commit(AddressSpaceDispatch *d);
void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section);
AddressSpaceDispatch *address_space_dispatch_new(struct uc_struct *uc, FlatView *fv);
void address_space_dispatch_compact(AddressSpaceDispatch *d);
AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as);
AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv);

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_m68k
#define address_space_cache_invalidate address_space_cache_invalidate_m68k
#define address_space_destroy address_space_destroy_m68k
#define address_space_dispatch_compact address_space_dispatch_compact_m68k
#define address_space_dispatch_free address_space_dispatch_free_m68k
#define address_space_dispatch_new address_space_dispatch_new_m68k
#define address_space_get_flatview address_space_get_flatview_m68k
#define address_space_init address_space_init_m68k
#define address_space_init_dispatch address_space_init_dispatch_m68k
@ -443,6 +445,7 @@
#define find_string find_string_m68k
#define find_type find_type_m68k
#define flatrange_equal flatrange_equal_m68k
#define flatview_add_to_dispatch flatview_add_to_dispatch_m68k
#define flatview_destroy flatview_destroy_m68k
#define flatview_init flatview_init_m68k
#define flatview_insert flatview_insert_m68k
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_m68k
#define mapping_have_same_region mapping_have_same_region_m68k
#define mapping_merge mapping_merge_m68k
#define mem_add mem_add_m68k
#define mem_begin mem_begin_m68k
#define mem_commit mem_commit_m68k
#define memory_access_size memory_access_size_m68k
#define memory_free memory_free_m68k
#define memory_init memory_init_m68k

View file

@ -781,13 +781,13 @@ static void address_space_update_topology(AddressSpace *as)
FlatView *new_view = generate_memory_topology(as->root);
int i;
new_view->dispatch = mem_begin(as);
new_view->dispatch = address_space_dispatch_new(as->uc, new_view);
for (i = 0; i < new_view->nr; i++) {
MemoryRegionSection mrs =
section_from_flat_range(&new_view->ranges[i], new_view);
mem_add(new_view, &mrs);
flatview_add_to_dispatch(new_view, &mrs);
}
mem_commit(new_view->dispatch);
address_space_dispatch_compact(new_view->dispatch);
if (!QTAILQ_EMPTY(&as->listeners)) {
address_space_update_topology_pass(as, old_view, new_view, false);

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_mips
#define address_space_cache_invalidate address_space_cache_invalidate_mips
#define address_space_destroy address_space_destroy_mips
#define address_space_dispatch_compact address_space_dispatch_compact_mips
#define address_space_dispatch_free address_space_dispatch_free_mips
#define address_space_dispatch_new address_space_dispatch_new_mips
#define address_space_get_flatview address_space_get_flatview_mips
#define address_space_init address_space_init_mips
#define address_space_init_dispatch address_space_init_dispatch_mips
@ -443,6 +445,7 @@
#define find_string find_string_mips
#define find_type find_type_mips
#define flatrange_equal flatrange_equal_mips
#define flatview_add_to_dispatch flatview_add_to_dispatch_mips
#define flatview_destroy flatview_destroy_mips
#define flatview_init flatview_init_mips
#define flatview_insert flatview_insert_mips
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_mips
#define mapping_have_same_region mapping_have_same_region_mips
#define mapping_merge mapping_merge_mips
#define mem_add mem_add_mips
#define mem_begin mem_begin_mips
#define mem_commit mem_commit_mips
#define memory_access_size memory_access_size_mips
#define memory_free memory_free_mips
#define memory_init memory_init_mips

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_mips64
#define address_space_cache_invalidate address_space_cache_invalidate_mips64
#define address_space_destroy address_space_destroy_mips64
#define address_space_dispatch_compact address_space_dispatch_compact_mips64
#define address_space_dispatch_free address_space_dispatch_free_mips64
#define address_space_dispatch_new address_space_dispatch_new_mips64
#define address_space_get_flatview address_space_get_flatview_mips64
#define address_space_init address_space_init_mips64
#define address_space_init_dispatch address_space_init_dispatch_mips64
@ -443,6 +445,7 @@
#define find_string find_string_mips64
#define find_type find_type_mips64
#define flatrange_equal flatrange_equal_mips64
#define flatview_add_to_dispatch flatview_add_to_dispatch_mips64
#define flatview_destroy flatview_destroy_mips64
#define flatview_init flatview_init_mips64
#define flatview_insert flatview_insert_mips64
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_mips64
#define mapping_have_same_region mapping_have_same_region_mips64
#define mapping_merge mapping_merge_mips64
#define mem_add mem_add_mips64
#define mem_begin mem_begin_mips64
#define mem_commit mem_commit_mips64
#define memory_access_size memory_access_size_mips64
#define memory_free memory_free_mips64
#define memory_init memory_init_mips64

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_mips64el
#define address_space_cache_invalidate address_space_cache_invalidate_mips64el
#define address_space_destroy address_space_destroy_mips64el
#define address_space_dispatch_compact address_space_dispatch_compact_mips64el
#define address_space_dispatch_free address_space_dispatch_free_mips64el
#define address_space_dispatch_new address_space_dispatch_new_mips64el
#define address_space_get_flatview address_space_get_flatview_mips64el
#define address_space_init address_space_init_mips64el
#define address_space_init_dispatch address_space_init_dispatch_mips64el
@ -443,6 +445,7 @@
#define find_string find_string_mips64el
#define find_type find_type_mips64el
#define flatrange_equal flatrange_equal_mips64el
#define flatview_add_to_dispatch flatview_add_to_dispatch_mips64el
#define flatview_destroy flatview_destroy_mips64el
#define flatview_init flatview_init_mips64el
#define flatview_insert flatview_insert_mips64el
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_mips64el
#define mapping_have_same_region mapping_have_same_region_mips64el
#define mapping_merge mapping_merge_mips64el
#define mem_add mem_add_mips64el
#define mem_begin mem_begin_mips64el
#define mem_commit mem_commit_mips64el
#define memory_access_size memory_access_size_mips64el
#define memory_free memory_free_mips64el
#define memory_init memory_init_mips64el

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_mipsel
#define address_space_cache_invalidate address_space_cache_invalidate_mipsel
#define address_space_destroy address_space_destroy_mipsel
#define address_space_dispatch_compact address_space_dispatch_compact_mipsel
#define address_space_dispatch_free address_space_dispatch_free_mipsel
#define address_space_dispatch_new address_space_dispatch_new_mipsel
#define address_space_get_flatview address_space_get_flatview_mipsel
#define address_space_init address_space_init_mipsel
#define address_space_init_dispatch address_space_init_dispatch_mipsel
@ -443,6 +445,7 @@
#define find_string find_string_mipsel
#define find_type find_type_mipsel
#define flatrange_equal flatrange_equal_mipsel
#define flatview_add_to_dispatch flatview_add_to_dispatch_mipsel
#define flatview_destroy flatview_destroy_mipsel
#define flatview_init flatview_init_mipsel
#define flatview_insert flatview_insert_mipsel
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_mipsel
#define mapping_have_same_region mapping_have_same_region_mipsel
#define mapping_merge mapping_merge_mipsel
#define mem_add mem_add_mipsel
#define mem_begin mem_begin_mipsel
#define mem_commit mem_commit_mipsel
#define memory_access_size memory_access_size_mipsel
#define memory_free memory_free_mipsel
#define memory_init memory_init_mipsel

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_powerpc
#define address_space_cache_invalidate address_space_cache_invalidate_powerpc
#define address_space_destroy address_space_destroy_powerpc
#define address_space_dispatch_compact address_space_dispatch_compact_powerpc
#define address_space_dispatch_free address_space_dispatch_free_powerpc
#define address_space_dispatch_new address_space_dispatch_new_powerpc
#define address_space_get_flatview address_space_get_flatview_powerpc
#define address_space_init address_space_init_powerpc
#define address_space_init_dispatch address_space_init_dispatch_powerpc
@ -443,6 +445,7 @@
#define find_string find_string_powerpc
#define find_type find_type_powerpc
#define flatrange_equal flatrange_equal_powerpc
#define flatview_add_to_dispatch flatview_add_to_dispatch_powerpc
#define flatview_destroy flatview_destroy_powerpc
#define flatview_init flatview_init_powerpc
#define flatview_insert flatview_insert_powerpc
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_powerpc
#define mapping_have_same_region mapping_have_same_region_powerpc
#define mapping_merge mapping_merge_powerpc
#define mem_add mem_add_powerpc
#define mem_begin mem_begin_powerpc
#define mem_commit mem_commit_powerpc
#define memory_access_size memory_access_size_powerpc
#define memory_free memory_free_powerpc
#define memory_init memory_init_powerpc

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_sparc
#define address_space_cache_invalidate address_space_cache_invalidate_sparc
#define address_space_destroy address_space_destroy_sparc
#define address_space_dispatch_compact address_space_dispatch_compact_sparc
#define address_space_dispatch_free address_space_dispatch_free_sparc
#define address_space_dispatch_new address_space_dispatch_new_sparc
#define address_space_get_flatview address_space_get_flatview_sparc
#define address_space_init address_space_init_sparc
#define address_space_init_dispatch address_space_init_dispatch_sparc
@ -443,6 +445,7 @@
#define find_string find_string_sparc
#define find_type find_type_sparc
#define flatrange_equal flatrange_equal_sparc
#define flatview_add_to_dispatch flatview_add_to_dispatch_sparc
#define flatview_destroy flatview_destroy_sparc
#define flatview_init flatview_init_sparc
#define flatview_insert flatview_insert_sparc
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_sparc
#define mapping_have_same_region mapping_have_same_region_sparc
#define mapping_merge mapping_merge_sparc
#define mem_add mem_add_sparc
#define mem_begin mem_begin_sparc
#define mem_commit mem_commit_sparc
#define memory_access_size memory_access_size_sparc
#define memory_free memory_free_sparc
#define memory_init memory_init_sparc

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_sparc64
#define address_space_cache_invalidate address_space_cache_invalidate_sparc64
#define address_space_destroy address_space_destroy_sparc64
#define address_space_dispatch_compact address_space_dispatch_compact_sparc64
#define address_space_dispatch_free address_space_dispatch_free_sparc64
#define address_space_dispatch_new address_space_dispatch_new_sparc64
#define address_space_get_flatview address_space_get_flatview_sparc64
#define address_space_init address_space_init_sparc64
#define address_space_init_dispatch address_space_init_dispatch_sparc64
@ -443,6 +445,7 @@
#define find_string find_string_sparc64
#define find_type find_type_sparc64
#define flatrange_equal flatrange_equal_sparc64
#define flatview_add_to_dispatch flatview_add_to_dispatch_sparc64
#define flatview_destroy flatview_destroy_sparc64
#define flatview_init flatview_init_sparc64
#define flatview_insert flatview_insert_sparc64
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_sparc64
#define mapping_have_same_region mapping_have_same_region_sparc64
#define mapping_merge mapping_merge_sparc64
#define mem_add mem_add_sparc64
#define mem_begin mem_begin_sparc64
#define mem_commit mem_commit_sparc64
#define memory_access_size memory_access_size_sparc64
#define memory_free memory_free_sparc64
#define memory_init memory_init_sparc64

View file

@ -54,7 +54,9 @@
#define address_space_cache_init address_space_cache_init_x86_64
#define address_space_cache_invalidate address_space_cache_invalidate_x86_64
#define address_space_destroy address_space_destroy_x86_64
#define address_space_dispatch_compact address_space_dispatch_compact_x86_64
#define address_space_dispatch_free address_space_dispatch_free_x86_64
#define address_space_dispatch_new address_space_dispatch_new_x86_64
#define address_space_get_flatview address_space_get_flatview_x86_64
#define address_space_init address_space_init_x86_64
#define address_space_init_dispatch address_space_init_dispatch_x86_64
@ -443,6 +445,7 @@
#define find_string find_string_x86_64
#define find_type find_type_x86_64
#define flatrange_equal flatrange_equal_x86_64
#define flatview_add_to_dispatch flatview_add_to_dispatch_x86_64
#define flatview_destroy flatview_destroy_x86_64
#define flatview_init flatview_init_x86_64
#define flatview_insert flatview_insert_x86_64
@ -1753,9 +1756,6 @@
#define mapping_contiguous mapping_contiguous_x86_64
#define mapping_have_same_region mapping_have_same_region_x86_64
#define mapping_merge mapping_merge_x86_64
#define mem_add mem_add_x86_64
#define mem_begin mem_begin_x86_64
#define mem_commit mem_commit_x86_64
#define memory_access_size memory_access_size_x86_64
#define memory_free memory_free_x86_64
#define memory_init memory_init_x86_64