From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPJwn-0004RD-0e for qemu-devel@nongnu.org; Fri, 29 Jan 2016 20:03:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPJwi-0007yw-On for qemu-devel@nongnu.org; Fri, 29 Jan 2016 20:03:28 -0500 Received: from mail-sn1nam02on0074.outbound.protection.outlook.com ([104.47.36.74]:62912 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPJwi-0007yg-He for qemu-devel@nongnu.org; Fri, 29 Jan 2016 20:03:24 -0500 From: Alistair Francis Date: Fri, 29 Jan 2016 17:00:45 -0800 Message-ID: <09f39516d69c78ebf356ef3b08838abb879b6cb6.1454115217.git.alistair.francis@xilinx.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v3 01/16] memory: Allow subregions to not be printed by info mtree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, peter.maydell@linaro.org, fred.konrad@greensocs.com Cc: edgar.iglesias@xilinx.com, edgar.iglesias@gmail.com, crosthwaitepeter@gmail.com, afaerber@suse.de, alistair.francis@xilinx.com Add a function called memory_region_add_subregion_no_print() that creates memory subregions that won't be printed when running the 'info mtree' command. Signed-off-by: Alistair Francis Reviewed-by: KONRAD Frederic --- include/exec/memory.h | 17 +++++++++++++++++ memory.c | 10 +++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index c92734a..25353df 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -186,6 +186,7 @@ struct MemoryRegion { bool skip_dump; bool enabled; bool warning_printed; /* For reservations */ + bool do_not_print; uint8_t vga_logging_count; MemoryRegion *alias; hwaddr alias_offset; @@ -954,6 +955,22 @@ void memory_region_del_eventfd(MemoryRegion *mr, void memory_region_add_subregion(MemoryRegion *mr, hwaddr offset, MemoryRegion *subregion); + +/** + * memory_region_add_subregion_no_print: Add a subregion to a container. + * + * The same functionality as memory_region_add_subregion except that any + * memory regions added by this function are not printed by 'info mtree'. + * + * @mr: the region to contain the new subregion; must be a container + * initialized with memory_region_init(). + * @offset: the offset relative to @mr where @subregion is added. + * @subregion: the subregion to be added. + */ +void memory_region_add_subregion_no_print(MemoryRegion *mr, + hwaddr offset, + MemoryRegion *subregion); + /** * memory_region_add_subregion_overlap: Add a subregion to a container * with overlap. diff --git a/memory.c b/memory.c index d2d0a92..4b9d961 100644 --- a/memory.c +++ b/memory.c @@ -1827,6 +1827,14 @@ void memory_region_add_subregion(MemoryRegion *mr, memory_region_add_subregion_common(mr, offset, subregion); } +void memory_region_add_subregion_no_print(MemoryRegion *mr, + hwaddr offset, + MemoryRegion *subregion) +{ + memory_region_add_subregion(mr, offset, subregion); + subregion->do_not_print = true; +} + void memory_region_add_subregion_overlap(MemoryRegion *mr, hwaddr offset, MemoryRegion *subregion, @@ -2217,7 +2225,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, const MemoryRegion *submr; unsigned int i; - if (!mr) { + if (!mr || mr->do_not_print) { return; } -- 2.5.0