From patchwork Tue Jan 19 22:34:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 8065281 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BDB869F96D for ; Tue, 19 Jan 2016 22:37:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 206812052A for ; Tue, 19 Jan 2016 22:37:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49DAF20456 for ; Tue, 19 Jan 2016 22:37:47 +0000 (UTC) Received: from localhost ([::1]:39461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLeuI-0000BE-LK for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jan 2016 17:37:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLeu5-00007H-IO for qemu-devel@nongnu.org; Tue, 19 Jan 2016 17:37:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLeu2-0003mG-C7 for qemu-devel@nongnu.org; Tue, 19 Jan 2016 17:37:33 -0500 Received: from mail-cys01nam02on0071.outbound.protection.outlook.com ([104.47.37.71]:37792 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLeu2-0003ln-5Z for qemu-devel@nongnu.org; Tue, 19 Jan 2016 17:37:30 -0500 Received: from CY1NAM02FT028.eop-nam02.prod.protection.outlook.com (10.152.74.52) by CY1NAM02HT120.eop-nam02.prod.protection.outlook.com (10.152.74.81) with Microsoft SMTP Server (TLS) id 15.1.355.15; Tue, 19 Jan 2016 22:37:28 +0000 Authentication-Results: spf=fail (sender IP is 149.199.60.96) smtp.mailfrom=xilinx.com; suse.de; dkim=none (message not signed) header.d=none; suse.de; dmarc=none action=none header.from=xilinx.com; Received-SPF: Fail (protection.outlook.com: domain of xilinx.com does not designate 149.199.60.96 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.96; helo=xsj-tvapsmtpgw01; Received: from xsj-tvapsmtpgw01 (149.199.60.96) by CY1NAM02FT028.mail.protection.outlook.com (10.152.75.132) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Tue, 19 Jan 2016 22:37:27 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:34398 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1aLetz-0008QT-59; Tue, 19 Jan 2016 14:37:27 -0800 Received: from [127.0.0.1] (port=41617 helo=tsj-smtp-dlp1.xlnx.xilinx.com) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1aLetv-0007ft-Vg; Tue, 19 Jan 2016 14:37:24 -0800 Received: from xsj-tvapsmtp02 (xsj-tvapsmtp02.xilinx.com [172.16.1.203]) by tsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id u0JMVo5d015213; Tue, 19 Jan 2016 14:31:50 -0800 Received: from [172.19.74.182] (port=39698 helo=xsjalistai50.xlnx.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1aLetv-0007fq-7g; Tue, 19 Jan 2016 14:37:23 -0800 From: Alistair Francis To: Date: Tue, 19 Jan 2016 14:34:56 -0800 Message-ID: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: X-RCIS-Action: ALLOW X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-22054.006 X-TM-AS-Result: No--10.826-7.0-31-10 X-imss-scan-details: No--10.826-7.0-31-10 X-TMASE-MatchedRID: uvmf2XsR/xk1vivz3L6ga0KcYi5Qw/RVWDdWpJMntKhOCtCDJNptxgiz 42iHHepw7gx5KenrvmzbCHv011Gy9WVvmuSSvBOoMJoQm3jo+mmqdpuEuCeGaCyxxpIF4+APuCO JcgdoXN2Bv5eB+0UmrrU5N0pg8TMMGKxAbYjDCBGeAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8h+IC quNi0WJOTpo9tmi6RgLIRux3jHxmX1v2bJSkdQaKGc2OltkLxdftwZ3X11IV0= X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.96; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(87936001)(92566002)(189998001)(33646002)(77096005)(6806005)(1096002)(47776003)(2950100001)(50986999)(1220700001)(36756003)(81156007)(85426001)(2906002)(5001960100002)(105606002)(71366001)(50466002)(19580395003)(5003600100002)(48376002)(50226001)(4326007)(64026002)(5003940100001)(110136002)(106466001)(2351001)(5008740100001)(86362001)(586003)(118296001)(229853001)(19580405001)(76176999)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1NAM02HT120; H:xsj-tvapsmtpgw01; FPR:; SPF:Fail; PTR:unknown-60-96.xilinx.com; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 2ef036e4-f440-48a3-a475-08d321211c28 X-Exchange-Antispam-Report-Test: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:CY1NAM02HT120; UriScan:(192813158149592); X-Microsoft-Antispam-PRVS: <9b008a2b279a4ff491a71bb9d6928d96@CY1NAM02HT120.eop-nam02.prod.protection.outlook.com> X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13018025)(5005006)(13017025)(520078)(8121501046)(13023025)(13024025)(3002001)(10201501046); SRVR:CY1NAM02HT120; BCL:0; PCL:0; RULEID:; SRVR:CY1NAM02HT120; X-Forefront-PRVS: 0826B2F01B X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2016 22:37:27.6934 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.96]; Helo=[xsj-tvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT120 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.37.71 Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, alistair.francis@xilinx.com, crosthwaitepeter@gmail.com, edgar.iglesias@gmail.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH v2 01/16] memory: Allow subregions to not be printed by info mtree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 01f1004..eff2a89 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; @@ -952,6 +953,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 93bd8ed..ee90682 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, @@ -2190,7 +2198,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; }