From 4200872b37ee59b5432d010becaabf84709798c5 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sat, 10 Mar 2012 16:57:10 +0000 Subject: [PATCH 1/3] ioport: use INT64_MAX for IO ranges Expression UINT64_MAX + 1 will make the range bigger than what can be represented with a 64 bit type. This would trigger an assert in int128_get64() after the next patch. Signed-off-by: Blue Swirl Signed-off-by: Avi Kivity --- ioport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ioport.c b/ioport.c index 78a3b890fb..6e4ca0dd91 100644 --- a/ioport.c +++ b/ioport.c @@ -385,7 +385,7 @@ static void portio_list_add_1(PortioList *piolist, * rather than an offset relative to to start + off_low. */ memory_region_init_io(region, ops, piolist->opaque, piolist->name, - UINT64_MAX); + INT64_MAX); memory_region_init_alias(alias, piolist->name, region, start + off_low, off_high - off_low); memory_region_add_subregion(piolist->address_space, From b9f9be88385e9ab51d4163bfd66f015f14f56286 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sat, 10 Mar 2012 16:58:35 +0000 Subject: [PATCH 2/3] memory: print aliased IO ranges in info mtree Print also I/O ports behind bridges and other aliases. Signed-off-by: Blue Swirl Signed-off-by: Avi Kivity --- memory.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/memory.c b/memory.c index 22b0352b74..a3f5b59990 100644 --- a/memory.c +++ b/memory.c @@ -1621,6 +1621,13 @@ void mtree_info(fprintf_function mon_printf, void *f) mon_printf(f, "memory\n"); mtree_print_mr(mon_printf, f, address_space_memory.root, 0, 0, &ml_head); + if (address_space_io.root && + !QTAILQ_EMPTY(&address_space_io.root->subregions)) { + mon_printf(f, "I/O\n"); + mtree_print_mr(mon_printf, f, address_space_io.root, 0, 0, &ml_head); + } + + mon_printf(f, "aliases\n"); /* print aliased regions */ QTAILQ_FOREACH(ml, &ml_head, queue) { if (!ml->printed) { @@ -1632,11 +1639,4 @@ void mtree_info(fprintf_function mon_printf, void *f) QTAILQ_FOREACH_SAFE(ml, &ml_head, queue, ml2) { g_free(ml); } - - if (address_space_io.root && - !QTAILQ_EMPTY(&address_space_io.root->subregions)) { - QTAILQ_INIT(&ml_head); - mon_printf(f, "I/O\n"); - mtree_print_mr(mon_printf, f, address_space_io.root, 0, 0, &ml_head); - } } From 221b3a3f1e5edb9e41a48bfa384803800184b397 Mon Sep 17 00:00:00 2001 From: Julien Grall Date: Wed, 4 Apr 2012 15:15:41 +0100 Subject: [PATCH 3/3] memory: check address space when a listener is registered This patch resolves a bug in memory listener registration. "range_add" callback was called on each section of the both address space (IO and memory space) even if it doesn't match the address space filter. Signed-off-by: Julien Grall Signed-off-by: Avi Kivity --- memory.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/memory.c b/memory.c index a3f5b59990..aab4a31323 100644 --- a/memory.c +++ b/memory.c @@ -1444,6 +1444,11 @@ static void listener_add_address_space(MemoryListener *listener, { FlatRange *fr; + if (listener->address_space_filter + && listener->address_space_filter != as->root) { + return; + } + if (global_dirty_log) { listener->log_global_start(listener); }