[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 23/51] exec: replace leaf with skip
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 23/51] exec: replace leaf with skip |
Date: |
Fri, 21 Feb 2014 02:16:59 -0600 |
From: "Michael S. Tsirkin" <address@hidden>
In preparation for dynamic radix tree depth support, rename is_leaf
field to skip, telling us how many bits to skip to next level.
Set to 0 for leaf.
Signed-off-by: Michael S. Tsirkin <address@hidden>
(cherry picked from commit 9736e55b78dc49b7f3a265932ab32ed360f633e4)
*prereq for 53cb28c backport
Signed-off-by: Michael Roth <address@hidden>
---
exec.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/exec.c b/exec.c
index e3feaec..885e329 100644
--- a/exec.c
+++ b/exec.c
@@ -83,8 +83,9 @@ int use_icount;
typedef struct PhysPageEntry PhysPageEntry;
struct PhysPageEntry {
- uint16_t is_leaf : 1;
- /* index into phys_sections (is_leaf) or phys_map_nodes (!is_leaf) */
+ /* How many bits skip to next level (in units of L2_SIZE). 0 for a leaf. */
+ uint16_t skip : 1;
+ /* index into phys_sections (!skip) or phys_map_nodes (skip) */
uint16_t ptr : 15;
};
@@ -164,7 +165,7 @@ static uint16_t phys_map_node_alloc(void)
assert(ret != PHYS_MAP_NODE_NIL);
assert(ret != next_map.nodes_nb_alloc);
for (i = 0; i < P_L2_SIZE; ++i) {
- next_map.nodes[ret][i].is_leaf = 0;
+ next_map.nodes[ret][i].skip = 1;
next_map.nodes[ret][i].ptr = PHYS_MAP_NODE_NIL;
}
return ret;
@@ -178,12 +179,12 @@ static void phys_page_set_level(PhysPageEntry *lp, hwaddr
*index,
int i;
hwaddr step = (hwaddr)1 << (level * P_L2_BITS);
- if (!lp->is_leaf && lp->ptr == PHYS_MAP_NODE_NIL) {
+ if (lp->skip && lp->ptr == PHYS_MAP_NODE_NIL) {
lp->ptr = phys_map_node_alloc();
p = next_map.nodes[lp->ptr];
if (level == 0) {
for (i = 0; i < P_L2_SIZE; i++) {
- p[i].is_leaf = 1;
+ p[i].skip = 0;
p[i].ptr = PHYS_SECTION_UNASSIGNED;
}
}
@@ -194,7 +195,7 @@ static void phys_page_set_level(PhysPageEntry *lp, hwaddr
*index,
while (*nb && lp < &p[P_L2_SIZE]) {
if ((*index & (step - 1)) == 0 && *nb >= step) {
- lp->is_leaf = true;
+ lp->skip = 0;
lp->ptr = leaf;
*index += step;
*nb -= step;
@@ -221,7 +222,7 @@ static MemoryRegionSection *phys_page_find(PhysPageEntry
lp, hwaddr index,
PhysPageEntry *p;
int i;
- for (i = P_L2_LEVELS - 1; i >= 0 && !lp.is_leaf; i--) {
+ for (i = P_L2_LEVELS; lp.skip && (i -= lp.skip) >= 0;) {
if (lp.ptr == PHYS_MAP_NODE_NIL) {
return §ions[PHYS_SECTION_UNASSIGNED];
}
@@ -1646,7 +1647,7 @@ static void mem_begin(MemoryListener *listener)
AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
AddressSpaceDispatch *d = g_new(AddressSpaceDispatch, 1);
- d->phys_map = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .is_leaf = 0 };
+ d->phys_map = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .skip = 1 };
d->as = as;
as->next_dispatch = d;
}
--
1.7.9.5
- [Qemu-stable] [PATCH 12/51] virtio-pci: add device_unplugged callback, (continued)
- [Qemu-stable] [PATCH 12/51] virtio-pci: add device_unplugged callback, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 14/51] scsi-disk: fix VERIFY emulation, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 17/51] qom: Split out object and class caches, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 15/51] intel-hda: fix position buffer, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 16/51] memory.c: bugfix - ref counting mismatch in memory_region_find, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 19/51] vl: add missing transition debug->finish_migrate, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 18/51] migration: Fix rate limit, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 20/51] x86: only allow real mode to access 32bit without LMA, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 22/51] split definitions for exec.c and translate-all.c radix trees, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 21/51] qdev-monitor: Avoid device_add crashing on non-device driver name, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 23/51] exec: replace leaf with skip,
Michael Roth <=
- [Qemu-stable] [PATCH 06/51] virtio-blk: switch exit callback to VirtioDeviceClass, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 24/51] exec: pass hw address to phys_page_find, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 28/51] target-mips: fix 64-bit FPU config for user-mode emulation, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 26/51] pc: map PCI address space as catchall region for not mapped addresses, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 27/51] piix: fix 32bit pci hole, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 29/51] linux-user: pass correct parameter to do_shmctl(), Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 25/51] exec: separate sections and nodes per address space, Michael Roth, 2014/02/21