summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-10-29 18:22:36 +0200
committerDoug Goldstein <cardoe@cardoe.com>2012-11-21 15:25:58 -0600
commitd102db1cee0f43bb8465c9b7cc9b50580b661925 (patch)
tree84c21f0507e4c97bc13733bc4d7798016b2c3b77
parente1000: drop check_rxov, always treat RX ring with RDH == RDT as empty (diff)
downloadqemu-kvm-d102db1cee0f43bb8465c9b7cc9b50580b661925.tar.gz
qemu-kvm-d102db1cee0f43bb8465c9b7cc9b50580b661925.tar.bz2
qemu-kvm-d102db1cee0f43bb8465c9b7cc9b50580b661925.zip
memory: fix rendering of a region obscured by another
The memory core drops regions that are hidden by another region (for example, during BAR sizing), but it doesn't do so correctly if the lower address of the existing range is below the lower address of the new range. Example (qemu-system-mips -M malta -kernel vmlinux-2.6.32-5-4kc-malta -append "console=ttyS0" -nographic -vga cirrus): Existing range: 10000000-107fffff New range: 100a0000-100bffff Correct behaviour: drop new range Incorrect behaviour: add new range Fix by taking this case into account (previously we only considered equal lower boundaries). Tested-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit d26a8caea3f160782841efb87b5e8bea606b512b)
-rw-r--r--memory.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/memory.c b/memory.c
index f039464c5..d8654fcbb 100644
--- a/memory.c
+++ b/memory.c
@@ -538,12 +538,12 @@ static void render_memory_region(FlatView *view,
offset_in_region += int128_get64(now);
int128_subfrom(&remain, now);
}
- if (int128_eq(base, view->ranges[i].addr.start)) {
- now = int128_min(remain, view->ranges[i].addr.size);
- int128_addto(&base, now);
- offset_in_region += int128_get64(now);
- int128_subfrom(&remain, now);
- }
+ now = int128_sub(int128_min(int128_add(base, remain),
+ addrrange_end(view->ranges[i].addr)),
+ base);
+ int128_addto(&base, now);
+ offset_in_region += int128_get64(now);
+ int128_subfrom(&remain, now);
}
if (int128_nz(remain)) {
fr.mr = mr;