From nobody Mon Feb 9 17:37:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1630513198; cv=none; d=zohomail.com; s=zohoarc; b=Pd5QPd+KzqLVHo5Uv94TFnQ4A1r1oA3BXabrurkUF2rpxGE77LARrDXymSsLfuSuX+anvGrZGHiUfkPEFi9rYyW82yidTdS/kYelq1Li2/nFB0b6unVyXkSXlOGMQ6e8KWibQfDgNXPXvr65EgVP/AWL2TtbaA5fKgbMcstQi18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630513198; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Kk7AoJgI8qARtyKWpkBg86PldAYgZZy6ZQx9AZo/Lg8=; b=SkRt14UkN1qMKo1PcpIngk/GNUNZGSuYZQZY/rfY+CWLRPFKgSehCLmrsuz4u1G7ze4KCJg8jmI1iICB+zdQZ9ehRDt1SprnDPWMz2AiPHlUcyaLuydMPqdtwIYORE80xXuRQvCkXbPpPMh38H4cWS93Fp5KeW0gSntlbcWH9dM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1630513198491588.5042496780931; Wed, 1 Sep 2021 09:19:58 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-lK98YFlQOECqjoz993o7Qw-1; Wed, 01 Sep 2021 12:19:56 -0400 Received: by mail-wm1-f71.google.com with SMTP id g3-20020a1c2003000000b002e751c4f439so23860wmg.7 for ; Wed, 01 Sep 2021 09:19:56 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id f17sm25160170wrt.63.2021.09.01.09.19.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Sep 2021 09:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630513197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kk7AoJgI8qARtyKWpkBg86PldAYgZZy6ZQx9AZo/Lg8=; b=X310MQnEW0RBvGXRyedkAGRt3UpvgzUSjzsWnEGk/bcWSlOBTOvjo8ZFo90vyFiXAlkxap PoQkJnmFbfzfE+b3Qj9HpMCNH77XD928Ah0fLy3vcXh3fBDobV/y9ZRh8M4JTxFchuoy0A llHv/cFNXepi6QkV8zBHpaT+ulm8qIY= X-MC-Unique: lK98YFlQOECqjoz993o7Qw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Kk7AoJgI8qARtyKWpkBg86PldAYgZZy6ZQx9AZo/Lg8=; b=IcdCtZSKq9+I2HipOx/O6OIIfhULlV99R4PTjiEoEZai0wLGsOolwLfmyH3O2Jzh3/ CGm2T32YH6bKDKLXGlB0XHyO3wDUjIFQfPBRw7W2V0Uvvbd0SSKjCVmYdE1m7FAiT30h CJarpXWZD5D/zaXwA8XYnAfzw0jJLak/ksNLCW/ignTkDfhztqAFuR+dCz5Uuul9Ve8l C2cdQ6knqAdTfSGg8IyfCdMLWxEXpWAgtXS9grw92Lhf46VzOqei4LnqdQEslLKgtLzg 8wkk1p6cHyJrmJ1eyTyHA7pN5J9n7eznoylHEk5HrnL3/E8jRqD0PGmDIq/P87Eir1Qq wYKg== X-Gm-Message-State: AOAM532S9pVP+M3axqb7KmZjD2NOAkMMp+1B7SgXx3ECDKfQd0cQsItC qkfb5QK/XXljYnAl6sCjMM5fWwnDOAcfeDYudMTE5YXaFJ8qb4Pc2QtYSTvXLBhDLZuKwu/RhGB 4qhExrFtj5qsd9A== X-Received: by 2002:adf:a2c4:: with SMTP id t4mr208613wra.258.1630513194405; Wed, 01 Sep 2021 09:19:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXtjZrT9i4QhHU7/wjj9AHlEXNgoQApqEN/duEol5J/c/TZeHwzBqCWcrDF/6SnClSX0v8Ew== X-Received: by 2002:adf:a2c4:: with SMTP id t4mr208587wra.258.1630513194282; Wed, 01 Sep 2021 09:19:54 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Paolo Bonzini , Peter Xu , Gerd Hoffmann , Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH v4 2/3] memory: Extract mtree_info_as() from mtree_info() Date: Wed, 1 Sep 2021 18:19:42 +0200 Message-Id: <20210901161943.4174212-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901161943.4174212-1-philmd@redhat.com> References: <20210901161943.4174212-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630513199618100001 While mtree_info() handles both ASes and flatviews cases, the two cases share basically no code. Split mtree_info_as() out of mtree_info() to simplify. Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson --- softmmu/memory.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/softmmu/memory.c b/softmmu/memory.c index 3eb6f52de67..5be7d5e7412 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -3284,18 +3284,12 @@ static void mtree_info_flatview(bool dispatch_tree,= bool owner) g_hash_table_unref(views); } =20 -void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabl= ed) +static void mtree_info_as(bool dispatch_tree, bool owner, bool disabled) { MemoryRegionListHead ml_head; MemoryRegionList *ml, *ml2; AddressSpace *as; =20 - if (flatview) { - mtree_info_flatview(dispatch_tree, owner); - - return; - } - QTAILQ_INIT(&ml_head); =20 QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) { @@ -3316,6 +3310,15 @@ void mtree_info(bool flatview, bool dispatch_tree, b= ool owner, bool disabled) } } =20 +void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabl= ed) +{ + if (flatview) { + mtree_info_flatview(dispatch_tree, owner); + } else { + mtree_info_as(dispatch_tree, owner, disabled); + } +} + void memory_region_init_ram(MemoryRegion *mr, Object *owner, const char *name, --=20 2.31.1