From 9ddea9499e522a2db73419153ad05d6f5879c97b Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 23 Jul 2012 13:44:35 +0200 Subject: [PATCH 1/6] usb: Clean common object and dependency files Signed-off-by: Jan Kiszka Signed-off-by: Stefan Hajnoczi --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 621cb8617c..d872d46555 100644 --- a/Makefile +++ b/Makefile @@ -216,7 +216,7 @@ clean: rm -Rf .libs rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d qapi/*.o qapi/*.d qga/*.o qga/*.d rm -f qom/*.o qom/*.d - rm -f usb/*.o usb/*.d hw/*.o hw/*.d + rm -f hw/usb/*.o hw/usb/*.d hw/*.o hw/*.d rm -f qemu-img-cmds.h rm -f trace/*.o trace/*.d rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp From 536c86fbf85ba1ab1651b028a4670033e3dfc9ed Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 23 Jul 2012 13:45:01 +0200 Subject: [PATCH 2/6] qom: Clean libuser object and dependency files Signed-off-by: Jan Kiszka Signed-off-by: Stefan Hajnoczi --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d872d46555..000b46c379 100644 --- a/Makefile +++ b/Makefile @@ -215,7 +215,7 @@ clean: rm -f *.o *.d *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~ rm -Rf .libs rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d qapi/*.o qapi/*.d qga/*.o qga/*.d - rm -f qom/*.o qom/*.d + rm -f qom/*.o qom/*.d libuser/qom/*.o libuser/qom/*.d rm -f hw/usb/*.o hw/usb/*.d hw/*.o hw/*.d rm -f qemu-img-cmds.h rm -f trace/*.o trace/*.d From 8715fc1e4caee09bde28f8e6844ad1a3bfe52f0e Mon Sep 17 00:00:00 2001 From: Amos Kong Date: Fri, 3 Aug 2012 11:06:22 +0800 Subject: [PATCH 3/6] socket: clean up redundant assignment Signed-off-by: Amos Kong Signed-off-by: Stefan Hajnoczi --- qemu-sockets.c | 1 - 1 file changed, 1 deletion(-) diff --git a/qemu-sockets.c b/qemu-sockets.c index 668fa93294..beb2bb6f4a 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -284,7 +284,6 @@ int inet_connect_opts(QemuOpts *opts, Error **errp) inet_strfamily(e->ai_family), e->ai_canonname, uaddr, uport, strerror(errno)); closesocket(sock); - sock = -1; continue; } freeaddrinfo(res); From adb2a9b5d4d5170f0b58b9f92f816048f6b8932b Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Wed, 25 Jul 2012 18:45:03 -0400 Subject: [PATCH 4/6] exec.c: Fix off-by-one error in register_subpage subpage_register() expects "end" to be the last byte in the mapping. Registering a non-page-aligned memory region that extends up to or beyond a page boundary causes subpage_register() to silently fail through the (end >= PAGE_SIZE) check. This bug does not cause noticeable problems for mappings that do not extend to a page boundary, though they do register an extra byte. Signed-off-by: Tyler Hall Reviewed-by: Peter Maydell Reviewed-by: Avi Kivity Signed-off-by: Stefan Hajnoczi --- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.c b/exec.c index feb4795525..27b100cb23 100644 --- a/exec.c +++ b/exec.c @@ -2271,7 +2271,7 @@ static void register_subpage(MemoryRegionSection *section) subpage = container_of(existing->mr, subpage_t, iomem); } start = section->offset_within_address_space & ~TARGET_PAGE_MASK; - end = start + section->size; + end = start + section->size - 1; subpage_register(subpage, start, end, phys_section_add(section)); } From 69b67646bc7ae7f3d28b278e6ae4435a767450ec Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Wed, 25 Jul 2012 18:45:04 -0400 Subject: [PATCH 5/6] exec.c: Use subpages for large unaligned mappings Registering a multi-page memory region that is non-page-aligned results in a subpage from the start to the page boundary, some number of full pages, and possibly another subpage from the last page boundary to the end. The full pages will have a value for offset_within_region that is not a multiple of TARGET_PAGE_SIZE. Accesses through softmmu are unable to handle this and will segfault. Handling full pages through subpages is not optimal, but only non-page-aligned mappings take the penalty. Signed-off-by: Tyler Hall Reviewed-by: Peter Maydell Reviewed-by: Avi Kivity Signed-off-by: Stefan Hajnoczi --- exec.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index 27b100cb23..e6ac3e7065 100644 --- a/exec.c +++ b/exec.c @@ -2305,10 +2305,15 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section, remain.offset_within_address_space += now.size; remain.offset_within_region += now.size; } - now = remain; - now.size &= TARGET_PAGE_MASK; - if (now.size) { - register_multipage(&now); + while (remain.size >= TARGET_PAGE_SIZE) { + now = remain; + if (remain.offset_within_region & ~TARGET_PAGE_MASK) { + now.size = TARGET_PAGE_SIZE; + register_subpage(&now); + } else { + now.size &= TARGET_PAGE_MASK; + register_multipage(&now); + } remain.size -= now.size; remain.offset_within_address_space += now.size; remain.offset_within_region += now.size; From c308efe63a875eb0d839f7490e69e58e4595466c Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Wed, 1 Aug 2012 14:35:47 +0100 Subject: [PATCH 6/6] exec.c: Remove out of date comment Remove an out of date comment: this comment used to be attached to cpu_register_physical_memory_log(), before commit 0f0cb164 accidentally inserted a couple of other functions between the comment and its function. It is in any case obsolete since (a) the function arguments it refers to have been replaced with a single MemoryRegionSection* argument and (b) the inability to handle regions whose offset_within_address_space and offset_within_region aren't equally aligned was fixed as part of the rewrite of this code. Signed-off-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- exec.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/exec.c b/exec.c index e6ac3e7065..a42a0b5b78 100644 --- a/exec.c +++ b/exec.c @@ -2240,14 +2240,6 @@ static void phys_sections_clear(void) phys_sections_nb = 0; } -/* register physical memory. - For RAM, 'size' must be a multiple of the target page size. - If (phys_offset & ~TARGET_PAGE_MASK) != 0, then it is an - io memory page. The address used when calling the IO function is - the offset from the start of the region, plus region_offset. Both - start_addr and region_offset are rounded down to a page boundary - before calculating this offset. This should not be a problem unless - the low bits of start_addr and region_offset differ. */ static void register_subpage(MemoryRegionSection *section) { subpage_t *subpage;