From nobody Sat Apr 11 23:03:15 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773088932; cv=none; d=zohomail.com; s=zohoarc; b=P/tUW81k5e1hrLHS2g6u4Dc8CvfznOg4jtROVc62d0bTVUZcdCkBRXQdAH6rt0GM6aQx33ofYs+3VsXGQfv7AQkSmCCQDexIFZTfqeD5XpV5MKEzJaKyUfBdcOPowG7nREXhgqjUCiK74PUmwIe2fpH4fqzHt5RR4TwN27MwM0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773088932; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wLFDlachEI4Q0czjIy+BCK+FfK4yknAlsXlj9QsvgqI=; b=PuOpmVXK5h/TyzVNEmbNtMsYTCfLpt1SRRern9o+rAwhE5114Wd2oqhc5pm9pDcyhTA+9U8DqXSJ+1y05OKdiLtFx5ahEbtCK0ydNh8phoEla2753ceSRnMqk1ihIi0hvBwTbc8gM02GlkTNYdIz9/g9q7XPe4rzGrYL7m4Hmt4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773088932951128.94890994324965; Mon, 9 Mar 2026 13:42:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vzhPJ-0004lc-Ga; Mon, 09 Mar 2026 16:40:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vzhPD-0004hQ-RT for qemu-devel@nongnu.org; Mon, 09 Mar 2026 16:40:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vzhPA-0007or-OM for qemu-devel@nongnu.org; Mon, 09 Mar 2026 16:40:47 -0400 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-Qf8io0T3OoK9061sp40L0g-1; Mon, 09 Mar 2026 16:40:42 -0400 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8cd84943c76so954916085a.0 for ; Mon, 09 Mar 2026 13:40:42 -0700 (PDT) Received: from x1.local (bras-vprn-aurron9134w-lp130-03-174-91-117-149.dsl.bell.ca. [174.91.117.149]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8cd8576db0esm332951885a.47.2026.03.09.13.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 13:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773088844; 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=wLFDlachEI4Q0czjIy+BCK+FfK4yknAlsXlj9QsvgqI=; b=AiX/1YjMKJPd52tLFbxQBjIMmLtMZZ6ZKwszPmZzgjU2VMXYmHi1X60zI+fRAshLP75Edz 8uwjiSOPpb1kDi0tTTAVfs8eSzWspBbZ+F9jUaxCTIldNAP2LP/ujl+EOLrhA/gKRTh5Uu yQ1wnv2mpdHN05Ejfl1MAEj4v+62rMw= X-MC-Unique: Qf8io0T3OoK9061sp40L0g-1 X-Mimecast-MFC-AGG-ID: Qf8io0T3OoK9061sp40L0g_1773088842 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773088842; x=1773693642; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wLFDlachEI4Q0czjIy+BCK+FfK4yknAlsXlj9QsvgqI=; b=fyEfShR7j7ZjtH/mKs7wb5l9jQA5ACaopEsgQ4pYAOMXQPKG2AlPoj0MDsGs0CdFM/ fN8JkgdjOdsUVjNFJM5Hcg0v5/528sYawScT8jxan5QpMuVqCNCLNH2UAfytWa1+AhZh sxh0pedHbeG8N6Mh7wCDxme070Vbg0vXB0aljd0jlvNurmu/iMCgfWs+js9muLYDbBlR 3VX1A3QmdholFm35OWDEvE3tJLFFNYD6IsGKZgHQ/LcZ5VsNjq2XTcdykE2LWHIx2CF+ Kc/STs/Wr7QLIO+fb0IbjCh9gpzEQ7pk9tcV4AO2nH7/Mhx2e4jEwng3lkQNgWo14ebP Bbdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773088842; x=1773693642; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wLFDlachEI4Q0czjIy+BCK+FfK4yknAlsXlj9QsvgqI=; b=w30iVuMABp9BTtIWkGUzWOlx+/RFpBDZVaEc02JkfhU7bCTIGjBsqPodhq7j0tjzxH 2DTU/VJUuVBZgPQZYytl7h2bYH5mNnYofmqgmiX9liGzgXTZUvT71YZJjmpP7LTGeygi L31nHyMxP0XGSF8jqgfF61GuqfU0/etz0bmTbgERnhE/30rRJq3Rd7yP6VW1xGT4Aw+m 9OGqXMIVxSzuNznGc9GnSsqcTkuKyRCCOTpT31KqUi6kvTGRVGn+tuk02bUR7XrWvNVQ pycLw2xLTNUl0xW1XCUT0wuTQjcRmOt5cNar3UuWgxmLSx5VwdSHw9nqwKxfAd+vzwFb QeNQ== X-Gm-Message-State: AOJu0YwEWNHV3hFpEmRygbBIgau78ZaulHthC0m8kJwHYbj6evGn8eOC k0CTUBwMONb/lgmxzh94MRQX+qdMi2c5pFzoOPjNaNIGMb++bywhopDaPkg2uJC5BehnMIiO/B7 cu5NEDvBbvofc/MPlfwpLO5MUg2iFSDbIWS/v9tIPFU3D68+FcTHE9ubElGeHOjOvFXzS8SxpJJ YZ9GEedKcV1kxlAwYQkoWaARHk1SnMcHIBFyo5iw== X-Gm-Gg: ATEYQzzfJlsCjDweI8KeJrlEw6Lo4ktqVjEvBk1sLle78saJRvDZ7kvnRPp4/vvJpjx RZrECVd1ZexSS+CN6S7KWFR4bO4EUa9+npRO4VKC6PFQiSwXHKvnwzszjML5LJHE9DI3D1Osed3 IykPJV5CpLACNtwj060+b7qZYPeoXAZNKYd3Jiai8M6KcIrFjBUeAyaeGpGOqUOMUlYyrpPecRU tW4174KXgmnYKvl3HRKabhlP+FW5zbuvLn17zURHplZsVQNrkpl5QSwSaxTL3ja8AdBBCvtPPhA YvEB5NHp0COsZyELAbpzejBXe0/fBb6qqEkjb+kNsrWW2COinLrN0qfwCUBLbzwSkP7Rb766SXY BCOyoQT5Kh3fAZXJa1ePS/GlZ/htDAGuLtiqywkEYXUhCZ3e6Pd+YGlJLn+yPkh7hYZ7c8GFy+d EARcxUXw== X-Received: by 2002:a05:620a:4083:b0:8cd:75a9:eab9 with SMTP id af79cd13be357-8cd93b7eb74mr108391685a.14.1773088841654; Mon, 09 Mar 2026 13:40:41 -0700 (PDT) X-Received: by 2002:a05:620a:4083:b0:8cd:75a9:eab9 with SMTP id af79cd13be357-8cd93b7eb74mr108387485a.14.1773088840971; Mon, 09 Mar 2026 13:40:40 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PULL 16/18] system/memory: Constify various MemoryRegion arguments Date: Mon, 9 Mar 2026 16:40:05 -0400 Message-ID: <20260309204007.1709441-17-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260309204007.1709441-1-peterx@redhat.com> References: <20260309204007.1709441-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1773088934561154100 From: Philippe Mathieu-Daud=C3=A9 Mark the MemoryRegion structure const when is only accessed read-only. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier Reviewed-by: Peter Xu Link: https://lore.kernel.org/r/20260309183536.88976-3-philmd@linaro.org Signed-off-by: Peter Xu --- include/system/memory.h | 38 +++++++++++++++++++------------------- system/memory.c | 38 ++++++++++++++++++++------------------ system/physmem.c | 2 +- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/include/system/memory.h b/include/system/memory.h index a9b0e19be8..d7b18b632d 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -1690,14 +1690,14 @@ bool memory_region_init_rom_device(MemoryRegion *mr, * * @mr: the memory region being queried. */ -Object *memory_region_owner(MemoryRegion *mr); +Object *memory_region_owner(const MemoryRegion *mr); =20 /** * memory_region_size: get a memory region's size. * * @mr: the memory region being queried. */ -uint64_t memory_region_size(MemoryRegion *mr); +uint64_t memory_region_size(const MemoryRegion *mr); =20 /** * memory_region_is_ram: check whether a memory region is random access @@ -1706,7 +1706,7 @@ uint64_t memory_region_size(MemoryRegion *mr); * * @mr: the memory region being queried */ -static inline bool memory_region_is_ram(MemoryRegion *mr) +static inline bool memory_region_is_ram(const MemoryRegion *mr) { return mr->ram; } @@ -1718,7 +1718,7 @@ static inline bool memory_region_is_ram(MemoryRegion = *mr) * * @mr: the memory region being queried */ -bool memory_region_is_ram_device(MemoryRegion *mr); +bool memory_region_is_ram_device(const MemoryRegion *mr); =20 /** * memory_region_is_romd: check whether a memory region is in ROMD mode @@ -1728,7 +1728,7 @@ bool memory_region_is_ram_device(MemoryRegion *mr); * * @mr: the memory region being queried */ -static inline bool memory_region_is_romd(MemoryRegion *mr) +static inline bool memory_region_is_romd(const MemoryRegion *mr) { return mr->rom_device && mr->romd_mode; } @@ -1741,7 +1741,7 @@ static inline bool memory_region_is_romd(MemoryRegion= *mr) * * @mr: the memory region being queried */ -bool memory_region_is_protected(MemoryRegion *mr); +bool memory_region_is_protected(const MemoryRegion *mr); =20 /** * memory_region_has_guest_memfd: check whether a memory region has guest_= memfd @@ -1751,7 +1751,7 @@ bool memory_region_is_protected(MemoryRegion *mr); * * @mr: the memory region being queried */ -bool memory_region_has_guest_memfd(MemoryRegion *mr); +bool memory_region_has_guest_memfd(const MemoryRegion *mr); =20 /** * memory_region_get_iommu: check whether a memory region is an iommu @@ -1761,7 +1761,7 @@ bool memory_region_has_guest_memfd(MemoryRegion *mr); * * @mr: the memory region being queried */ -static inline IOMMUMemoryRegion *memory_region_get_iommu(MemoryRegion *mr) +static inline IOMMUMemoryRegion *memory_region_get_iommu(const MemoryRegio= n *mr) { if (mr->alias) { return memory_region_get_iommu(mr->alias); @@ -1932,7 +1932,7 @@ const char *memory_region_name(const MemoryRegion *mr= ); * @mr: the memory region being queried * @client: the client being queried */ -bool memory_region_is_logging(MemoryRegion *mr, uint8_t client); +bool memory_region_is_logging(const MemoryRegion *mr, uint8_t client); =20 /** * memory_region_get_dirty_log_mask: return the clients for which a @@ -1943,7 +1943,7 @@ bool memory_region_is_logging(MemoryRegion *mr, uint8= _t client); * * @mr: the memory region being queried */ -uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr); +uint8_t memory_region_get_dirty_log_mask(const MemoryRegion *mr); =20 /** * memory_region_is_rom: check whether a memory region is ROM @@ -1952,7 +1952,7 @@ uint8_t memory_region_get_dirty_log_mask(MemoryRegion= *mr); * * @mr: the memory region being queried */ -static inline bool memory_region_is_rom(MemoryRegion *mr) +static inline bool memory_region_is_rom(const MemoryRegion *mr) { return mr->ram && mr->readonly; } @@ -1964,7 +1964,7 @@ static inline bool memory_region_is_rom(MemoryRegion = *mr) * * @mr: the memory region being queried */ -static inline bool memory_region_is_nonvolatile(MemoryRegion *mr) +static inline bool memory_region_is_nonvolatile(const MemoryRegion *mr) { return mr->nonvolatile; } @@ -1977,7 +1977,7 @@ static inline bool memory_region_is_nonvolatile(Memor= yRegion *mr) * * @mr: the RAM or alias memory region being queried. */ -int memory_region_get_fd(MemoryRegion *mr); +int memory_region_get_fd(const MemoryRegion *mr); =20 /** * memory_region_from_host: Convert a pointer into a RAM memory region @@ -2012,7 +2012,7 @@ MemoryRegion *memory_region_from_host(void *ptr, ram_= addr_t *offset); * * @mr: the memory region being queried. */ -void *memory_region_get_ram_ptr(MemoryRegion *mr); +void *memory_region_get_ram_ptr(const MemoryRegion *mr); =20 /* memory_region_ram_resize: Resize a RAM region. * @@ -2362,7 +2362,7 @@ void memory_region_add_subregion_overlap(MemoryRegion= *mr, * * @mr: the region to be queried */ -ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr); +ram_addr_t memory_region_get_ram_addr(const MemoryRegion *mr); =20 uint64_t memory_region_get_alignment(const MemoryRegion *mr); /** @@ -2462,7 +2462,7 @@ bool memory_region_present(MemoryRegion *container, h= waddr addr); * * @mr: a #MemoryRegion which should be checked if it's mapped */ -bool memory_region_is_mapped(MemoryRegion *mr); +bool memory_region_is_mapped(const MemoryRegion *mr); =20 /** * memory_region_get_ram_discard_manager: get the #RamDiscardManager for a @@ -2908,7 +2908,7 @@ void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_= t addr); int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr); bool prepare_mmio_access(MemoryRegion *mr); =20 -static inline bool memory_region_supports_direct_access(MemoryRegion *mr) +static inline bool memory_region_supports_direct_access(const MemoryRegion= *mr) { /* ROM DEVICE regions only allow direct access if in ROMD mode. */ if (memory_region_is_romd(mr)) { @@ -2925,8 +2925,8 @@ static inline bool memory_region_supports_direct_acce= ss(MemoryRegion *mr) return !memory_region_is_ram_device(mr); } =20 -static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write, - MemTxAttrs attrs) +static inline bool memory_access_is_direct(const MemoryRegion *mr, + bool is_write, MemTxAttrs attrs) { if (!memory_region_supports_direct_access(mr)) { return false; diff --git a/system/memory.c b/system/memory.c index f1db72eb42..fca74ee62b 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1750,9 +1750,9 @@ static void memory_region_finalize(Object *obj) g_free(mr->ioeventfds); } =20 -Object *memory_region_owner(MemoryRegion *mr) +Object *memory_region_owner(const MemoryRegion *mr) { - Object *obj =3D OBJECT(mr); + const Object *obj =3D OBJECT(mr); return obj->parent; } =20 @@ -1780,7 +1780,7 @@ void memory_region_unref(MemoryRegion *mr) } } =20 -uint64_t memory_region_size(MemoryRegion *mr) +uint64_t memory_region_size(const MemoryRegion *mr) { if (int128_eq(mr->size, int128_2_64())) { return UINT64_MAX; @@ -1797,25 +1797,25 @@ const char *memory_region_name(const MemoryRegion *= mr) return mr->name; } =20 -bool memory_region_is_ram_device(MemoryRegion *mr) +bool memory_region_is_ram_device(const MemoryRegion *mr) { return mr->ram_device; } =20 -bool memory_region_is_protected(MemoryRegion *mr) +bool memory_region_is_protected(const MemoryRegion *mr) { return mr->ram && (mr->ram_block->flags & RAM_PROTECTED); } =20 -bool memory_region_has_guest_memfd(MemoryRegion *mr) +bool memory_region_has_guest_memfd(const MemoryRegion *mr) { return mr->ram_block && mr->ram_block->guest_memfd >=3D 0; } =20 -uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr) +uint8_t memory_region_get_dirty_log_mask(const MemoryRegion *mr) { uint8_t mask =3D mr->dirty_log_mask; - RAMBlock *rb =3D mr->ram_block; + const RAMBlock *rb =3D mr->ram_block; =20 if (global_dirty_tracking && ((rb && qemu_ram_is_migratable(rb)) || memory_region_is_iommu(mr))) { @@ -1829,7 +1829,7 @@ uint8_t memory_region_get_dirty_log_mask(MemoryRegion= *mr) return mask; } =20 -bool memory_region_is_logging(MemoryRegion *mr, uint8_t client) +bool memory_region_is_logging(const MemoryRegion *mr, uint8_t client) { return memory_region_get_dirty_log_mask(mr) & (1 << client); } @@ -2337,7 +2337,7 @@ void memory_region_reset_dirty(MemoryRegion *mr, hwad= dr addr, memory_region_get_ram_addr(mr) + addr, size, client, NULL); } =20 -int memory_region_get_fd(MemoryRegion *mr) +int memory_region_get_fd(const MemoryRegion *mr) { RCU_READ_LOCK_GUARD(); while (mr->alias) { @@ -2346,7 +2346,7 @@ int memory_region_get_fd(MemoryRegion *mr) return mr->ram_block->fd; } =20 -void *memory_region_get_ram_ptr(MemoryRegion *mr) +void *memory_region_get_ram_ptr(const MemoryRegion *mr) { uint64_t offset =3D 0; =20 @@ -2371,7 +2371,7 @@ MemoryRegion *memory_region_from_host(void *ptr, ram_= addr_t *offset) return block->mr; } =20 -ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr) +ram_addr_t memory_region_get_ram_addr(const MemoryRegion *mr) { return mr->ram_block ? mr->ram_block->offset : RAM_ADDR_INVALID; } @@ -2737,7 +2737,7 @@ static FlatRange *flatview_lookup(FlatView *view, Add= rRange addr) sizeof(FlatRange), cmp_flatrange_addr); } =20 -bool memory_region_is_mapped(MemoryRegion *mr) +bool memory_region_is_mapped(const MemoryRegion *mr) { return !!mr->container || mr->mapped_via_alias; } @@ -3221,7 +3221,7 @@ void address_space_destroy_free(AddressSpace *as) call_rcu(as, do_address_space_destroy_free, rcu); } =20 -static const char *memory_region_type(MemoryRegion *mr) +static const char *memory_region_type(const MemoryRegion *mr) { if (mr->alias) { return memory_region_type(mr->alias); @@ -3414,7 +3414,6 @@ static void mtree_print_flatview(gpointer key, gpoint= er value, GArray *fv_address_spaces =3D value; struct FlatViewInfo *fvi =3D user_data; FlatRange *range =3D &view->ranges[0]; - MemoryRegion *mr; int n =3D view->nr; int i; AddressSpace *as; @@ -3441,7 +3440,8 @@ static void mtree_print_flatview(gpointer key, gpoint= er value, } =20 while (n--) { - mr =3D range->mr; + const MemoryRegion *mr =3D range->mr; + if (range->offset_in_region) { qemu_printf(MTREE_INDENT HWADDR_FMT_plx "-" HWADDR_FMT_plx " (prio %d, %s%s): %s @" HWADDR_FMT_plx, @@ -3614,8 +3614,10 @@ static void mtree_info_as(bool dispatch_tree, bool o= wner, bool disabled) =20 /* print aliased regions */ QTAILQ_FOREACH(ml, &ml_head, mrqueue) { - qemu_printf("memory-region: %s\n", memory_region_name(ml->mr)); - mtree_print_mr(ml->mr, 1, 0, &ml_head, owner, disabled); + const MemoryRegion *mr =3D ml->mr; + + qemu_printf("memory-region: %s\n", memory_region_name(mr)); + mtree_print_mr(mr, 1, 0, &ml_head, owner, disabled); qemu_printf("\n"); } =20 diff --git a/system/physmem.c b/system/physmem.c index e5390d09be..4a9e076004 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -1975,7 +1975,7 @@ void qemu_ram_unset_idstr(RAMBlock *block) } } =20 -static char *cpr_name(MemoryRegion *mr) +static char *cpr_name(const MemoryRegion *mr) { const char *mr_name =3D memory_region_name(mr); g_autofree char *id =3D mr->dev ? qdev_get_dev_path(mr->dev) : NULL; --=20 2.50.1