[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/20] memory: replace phys_page_find_alloc() with p
From: |
Avi Kivity |
Subject: |
[Qemu-devel] [PATCH 16/20] memory: replace phys_page_find_alloc() with phys_page_set() |
Date: |
Tue, 14 Feb 2012 11:27:46 +0200 |
By giving the function the value we want to set, we make it
more flexible for the next patch.
Signed-off-by: Avi Kivity <address@hidden>
---
exec.c | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/exec.c b/exec.c
index e382858..26e70c3 100644
--- a/exec.c
+++ b/exec.c
@@ -429,7 +429,7 @@ static void phys_map_nodes_reset(void)
phys_map_nodes_nb = 0;
}
-static uint16_t *phys_page_find_alloc(target_phys_addr_t index, int alloc)
+static void phys_page_set(target_phys_addr_t index, uint16_t leaf)
{
PhysPageEntry *lp, *p;
int i, j;
@@ -439,9 +439,6 @@ static uint16_t *phys_page_find_alloc(target_phys_addr_t
index, int alloc)
/* Level 1..N. */
for (i = P_L2_LEVELS - 1; i >= 0; i--) {
if (lp->u.node == PHYS_MAP_NODE_NIL) {
- if (!alloc) {
- return NULL;
- }
p = phys_map_node_alloc(&lp->u.node);
if (i == 0) {
for (j = 0; j < L2_SIZE; j++) {
@@ -454,7 +451,7 @@ static uint16_t *phys_page_find_alloc(target_phys_addr_t
index, int alloc)
lp = &p[(index >> (i * L2_BITS)) & (L2_SIZE - 1)];
}
- return &lp->u.leaf;
+ lp->u.leaf = leaf;
}
static MemoryRegionSection phys_page_find(target_phys_addr_t index)
@@ -2611,7 +2608,6 @@ static void register_subpage(MemoryRegionSection *section)
.offset_within_address_space = base,
.size = TARGET_PAGE_SIZE,
};
- uint16_t *ptr;
target_phys_addr_t start, end;
assert(existing.mr->subpage || existing.mr == &io_mem_unassigned);
@@ -2619,8 +2615,7 @@ static void register_subpage(MemoryRegionSection *section)
if (!(existing.mr->subpage)) {
subpage = subpage_init(base);
subsection.mr = &subpage->iomem;
- ptr = phys_page_find_alloc(base >> TARGET_PAGE_BITS, 1);
- *ptr = phys_section_add(&subsection);
+ phys_page_set(base >> TARGET_PAGE_BITS, phys_section_add(&subsection));
} else {
subpage = container_of(existing.mr, subpage_t, iomem);
}
@@ -2643,9 +2638,7 @@ static void register_multipage(MemoryRegionSection
*section)
addr = start_addr;
do {
- uint16_t *p = phys_page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
- assert(*p == phys_section_unassigned);
- *p = section_index;
+ phys_page_set(addr >> TARGET_PAGE_BITS, section_index);
addr += TARGET_PAGE_SIZE;
} while (addr != end_addr);
}
--
1.7.9
- [Qemu-devel] [PATCH 06/20] memory: remove first level of l1_phys_map, (continued)
- [Qemu-devel] [PATCH 06/20] memory: remove first level of l1_phys_map, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 01/20] memory: allow MemoryListeners to observe a specific address space, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 11/20] memory: unify the two branches of cpu_register_physical_memory_log(), Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 10/20] memory: fix RAM subpages in newly initialized pages, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 17/20] memory: switch phys_page_set() to a recursive implementation, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 12/20] memory: move tlb flush to MemoryListener commit callback, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 07/20] memory: unify phys_map last level with intermediate levels, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 14/20] memory: give phys_page_find() its own tree search loop, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 03/20] memory: split memory listener for the two address spaces, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 18/20] memory: change phys_page_set() to set multiple pages, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 16/20] memory: replace phys_page_find_alloc() with phys_page_set(),
Avi Kivity <=
- [Qemu-devel] [PATCH 09/20] memory: compress phys_map node pointers to 16 bits, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 08/20] memory: store MemoryRegionSection pointers in phys_map, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 02/20] xen: ignore I/O memory regions, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 20/20] memory: allow phys_map tree paths to terminate early, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 15/20] memory: simplify multipage/subpage registration, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 13/20] memory: make phys_page_find() return a MemoryRegionSection, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 19/20] memory: unify PhysPageEntry::node and ::leaf, Avi Kivity, 2012/02/14
- [Qemu-devel] [PATCH 05/20] memory: change memory registration to rebuild the memory map on each change, Avi Kivity, 2012/02/14