From nobody Mon Mar 2 10:57:20 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=1772114965; cv=none; d=zohomail.com; s=zohoarc; b=MyVEla7NI/bXvdxwBKk3yHlGCUMgv+7hRjl86HNYNrC8ZEZq4EmRffRSgK5KgZcRRHsoNlM8U2y8x8b9KaCZ5EV7K8LdjGMU12A/0Jrgx5riyVr/ep9dhVdTLC0JUp3ZjPDf5l3ftAynI5xoKTnAdyoxcLLyYFrL1+uRfBpnaHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772114965; 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=O0nd8w74Eg1MZwcVqt9ubuzj/ONkZRtMKFKv1IXrpoA=; b=mHOoSQLI0XqAssfQu8mTpX9Tyo9v9TIYYftYKmzJ4WGitPuyNgTcaTfbXX0VWKEmlplzsHoaQqeRIgWnPbftMGVUVdFkzz6F4saNZPEUVWg5qKVCPV/+Jm2+8eRt/zBc4QQq+FryVCwlPvFcshWiesH6zniva5iPvj/qwVB1q20= 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 1772114965802582.8807971511507; Thu, 26 Feb 2026 06:09:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vvbvP-00034J-BH; Thu, 26 Feb 2026 09:01:07 -0500 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 1vvbv0-0002gU-9p for qemu-devel@nongnu.org; Thu, 26 Feb 2026 09:00:50 -0500 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 1vvbux-0006Jx-DY for qemu-devel@nongnu.org; Thu, 26 Feb 2026 09:00:42 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-82LJ4GjdPg6jNFUvPy69eA-1; Thu, 26 Feb 2026 09:00:34 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6D7E319560AD; Thu, 26 Feb 2026 14:00:33 +0000 (UTC) Received: from localhost (unknown [10.45.242.29]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EE9C219560B5; Thu, 26 Feb 2026 14:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772114438; 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=O0nd8w74Eg1MZwcVqt9ubuzj/ONkZRtMKFKv1IXrpoA=; b=HvcHS7wyQzsAloq4nBY1x9LIm0fdsQZP39MMzl+Bp0835gYQXZRQ9w3Lr7DUQZSkON44+y Pakfx9uLxlowYfRtYd27PQ+IFWfpc2E+DgXycG0Juyv3PCNBdc9BrO3DSOF04TIBwHpwUL 6yCq6Q2u9m8BgQirs29vWupGDGnBMpI= X-MC-Unique: 82LJ4GjdPg6jNFUvPy69eA-1 X-Mimecast-MFC-AGG-ID: 82LJ4GjdPg6jNFUvPy69eA_1772114433 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Ben Chaney , "Michael S. Tsirkin" , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Paolo Bonzini , Alex Williamson , Fabiano Rosas , David Hildenbrand , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Xu , kvm@vger.kernel.org, Mark Kanda , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v3 08/15] system/memory: constify section arguments Date: Thu, 26 Feb 2026 14:59:53 +0100 Message-ID: <20260226140001.3622334-9-marcandre.lureau@redhat.com> In-Reply-To: <20260226140001.3622334-1-marcandre.lureau@redhat.com> References: <20260226140001.3622334-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 22 X-Spam_score: 2.2 X-Spam_bar: ++ X-Spam_report: (2.2 / 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_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.306, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.668, 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: 1772114968352158500 From: Marc-Andr=C3=A9 Lureau The sections shouldn't be modified. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: C=C3=A9dric Le Goater --- include/hw/vfio/vfio-container.h | 2 +- include/hw/vfio/vfio-cpr.h | 2 +- include/system/ram-discard-manager.h | 14 +++++++------- hw/vfio/cpr-legacy.c | 4 ++-- hw/vfio/listener.c | 10 +++++----- hw/virtio/virtio-mem.c | 10 +++++----- migration/ram.c | 6 +++--- system/memory_mapping.c | 4 ++-- system/ram-block-attributes.c | 8 ++++---- system/ram-discard-manager.c | 10 +++++----- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-contai= ner.h index a7d5c5ed679..b2e7f4312c3 100644 --- a/include/hw/vfio/vfio-container.h +++ b/include/hw/vfio/vfio-container.h @@ -277,7 +277,7 @@ struct VFIOIOMMUClass { }; =20 VFIORamDiscardListener *vfio_find_ram_discard_listener( - VFIOContainer *bcontainer, MemoryRegionSection *section); + VFIOContainer *bcontainer, const MemoryRegionSection *section); =20 void vfio_container_region_add(VFIOContainer *bcontainer, MemoryRegionSection *section, bool cpr_rema= p); diff --git a/include/hw/vfio/vfio-cpr.h b/include/hw/vfio/vfio-cpr.h index 4606da500a7..ecabe0c747d 100644 --- a/include/hw/vfio/vfio-cpr.h +++ b/include/hw/vfio/vfio-cpr.h @@ -69,7 +69,7 @@ void vfio_cpr_giommu_remap(struct VFIOContainer *bcontain= er, MemoryRegionSection *section); =20 bool vfio_cpr_ram_discard_replay_populated( - struct VFIOContainer *bcontainer, MemoryRegionSection *section); + struct VFIOContainer *bcontainer, const MemoryRegionSection *section); =20 void vfio_cpr_save_vector_fd(struct VFIOPCIDevice *vdev, const char *name, int nr, int fd); diff --git a/include/system/ram-discard-manager.h b/include/system/ram-disc= ard-manager.h index da55658169f..b188e09a30f 100644 --- a/include/system/ram-discard-manager.h +++ b/include/system/ram-discard-manager.h @@ -26,9 +26,9 @@ DECLARE_OBJ_CHECKERS(RamDiscardSource, RamDiscardSourceCl= ass, =20 typedef struct RamDiscardListener RamDiscardListener; typedef int (*NotifyRamPopulate)(RamDiscardListener *rdl, - MemoryRegionSection *section); + const MemoryRegionSection *section); typedef void (*NotifyRamDiscard)(RamDiscardListener *rdl, - MemoryRegionSection *section); + const MemoryRegionSection *section); =20 struct RamDiscardListener { /* @@ -86,7 +86,7 @@ static inline void ram_discard_listener_init(RamDiscardLi= stener *rdl, * * Returns 0 on success, or a negative error if failed. */ -typedef int (*ReplayRamDiscardState)(MemoryRegionSection *section, +typedef int (*ReplayRamDiscardState)(const MemoryRegionSection *section, void *opaque); =20 /* @@ -151,7 +151,7 @@ struct RamDiscardSourceClass { * Returns 0 on success, or a negative error if any notification faile= d. */ int (*replay_populated)(const RamDiscardSource *rds, - MemoryRegionSection *section, + const MemoryRegionSection *section, ReplayRamDiscardState replay_fn, void *opaque); =20 /** @@ -168,7 +168,7 @@ struct RamDiscardSourceClass { * Returns 0 on success, or a negative error if any notification faile= d. */ int (*replay_discarded)(const RamDiscardSource *rds, - MemoryRegionSection *section, + const MemoryRegionSection *section, ReplayRamDiscardState replay_fn, void *opaque); }; =20 @@ -237,7 +237,7 @@ bool ram_discard_manager_is_populated(const RamDiscardM= anager *rdm, * Returns 0 on success, or a negative error if any notification failed. */ int ram_discard_manager_replay_populated(const RamDiscardManager *rdm, - MemoryRegionSection *section, + const MemoryRegionSection *sectio= n, ReplayRamDiscardState replay_fn, void *opaque); =20 @@ -255,7 +255,7 @@ int ram_discard_manager_replay_populated(const RamDisca= rdManager *rdm, * Returns 0 on success, or a negative error if any notification failed. */ int ram_discard_manager_replay_discarded(const RamDiscardManager *rdm, - MemoryRegionSection *section, + const MemoryRegionSection *sectio= n, ReplayRamDiscardState replay_fn, void *opaque); =20 diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c index 033a546c301..cca7dd08dfc 100644 --- a/hw/vfio/cpr-legacy.c +++ b/hw/vfio/cpr-legacy.c @@ -226,7 +226,7 @@ void vfio_cpr_giommu_remap(VFIOContainer *bcontainer, memory_region_iommu_replay(giommu->iommu_mr, &giommu->n); } =20 -static int vfio_cpr_rdm_remap(MemoryRegionSection *section, void *opaque) +static int vfio_cpr_rdm_remap(const MemoryRegionSection *section, void *op= aque) { RamDiscardListener *rdl =3D opaque; =20 @@ -242,7 +242,7 @@ static int vfio_cpr_rdm_remap(MemoryRegionSection *sect= ion, void *opaque) * directly, which calls vfio_legacy_cpr_dma_map. */ bool vfio_cpr_ram_discard_replay_populated(VFIOContainer *bcontainer, - MemoryRegionSection *section) + const MemoryRegionSection *sect= ion) { RamDiscardManager *rdm =3D memory_region_get_ram_discard_manager(secti= on->mr); VFIORamDiscardListener *vrdl =3D diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c index 960da9e0a93..d24780e089d 100644 --- a/hw/vfio/listener.c +++ b/hw/vfio/listener.c @@ -203,7 +203,7 @@ out: } =20 static void vfio_ram_discard_notify_discard(RamDiscardListener *rdl, - MemoryRegionSection *section) + const MemoryRegionSection *sec= tion) { VFIORamDiscardListener *vrdl =3D container_of(rdl, VFIORamDiscardListe= ner, listener); @@ -221,7 +221,7 @@ static void vfio_ram_discard_notify_discard(RamDiscardL= istener *rdl, } =20 static int vfio_ram_discard_notify_populate(RamDiscardListener *rdl, - MemoryRegionSection *section) + const MemoryRegionSection *sec= tion) { VFIORamDiscardListener *vrdl =3D container_of(rdl, VFIORamDiscardListe= ner, listener); @@ -465,7 +465,7 @@ static void vfio_device_error_append(VFIODevice *vbased= ev, Error **errp) } =20 VFIORamDiscardListener *vfio_find_ram_discard_listener( - VFIOContainer *bcontainer, MemoryRegionSection *section) + VFIOContainer *bcontainer, const MemoryRegionSection *section) { VFIORamDiscardListener *vrdl =3D NULL; =20 @@ -1147,8 +1147,8 @@ out: } } =20 -static int vfio_ram_discard_query_dirty_bitmap(MemoryRegionSection *sectio= n, - void *opaque) +static int vfio_ram_discard_query_dirty_bitmap(const MemoryRegionSection *= section, + void *opaque) { const hwaddr size =3D int128_get64(section->size); const hwaddr iova =3D section->offset_within_address_space; diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index be149ee9441..ec165503205 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -262,7 +262,7 @@ static int virtio_mem_for_each_plugged_range(VirtIOMEM = *vmem, void *arg, typedef int (*virtio_mem_section_cb)(MemoryRegionSection *s, void *arg); =20 static int virtio_mem_for_each_plugged_section(const VirtIOMEM *vmem, - MemoryRegionSection *s, + const MemoryRegionSection *= s, void *arg, virtio_mem_section_cb cb) { @@ -294,7 +294,7 @@ static int virtio_mem_for_each_plugged_section(const Vi= rtIOMEM *vmem, } =20 static int virtio_mem_for_each_unplugged_section(const VirtIOMEM *vmem, - MemoryRegionSection *s, + const MemoryRegionSection= *s, void *arg, virtio_mem_section_cb cb) { @@ -1680,7 +1680,7 @@ static int virtio_mem_rds_replay_cb(MemoryRegionSecti= on *s, void *arg) } =20 static int virtio_mem_rds_replay_populated(const RamDiscardSource *rds, - MemoryRegionSection *s, + const MemoryRegionSection *s, ReplayRamDiscardState replay_fn, void *opaque) { @@ -1692,11 +1692,11 @@ static int virtio_mem_rds_replay_populated(const Ra= mDiscardSource *rds, =20 g_assert(s->mr =3D=3D &vmem->memdev->mr); return virtio_mem_for_each_plugged_section(vmem, s, &data, - virtio_mem_rds_replay_cb); + virtio_mem_rds_replay_cb); } =20 static int virtio_mem_rds_replay_discarded(const RamDiscardSource *rds, - MemoryRegionSection *s, + const MemoryRegionSection *s, ReplayRamDiscardState replay_fn, void *opaque) { diff --git a/migration/ram.c b/migration/ram.c index fc7ece2c1a1..57237385300 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -860,7 +860,7 @@ static inline bool migration_bitmap_clear_dirty(RAMStat= e *rs, return ret; } =20 -static int dirty_bitmap_clear_section(MemoryRegionSection *section, +static int dirty_bitmap_clear_section(const MemoryRegionSection *section, void *opaque) { const hwaddr offset =3D section->offset_within_region; @@ -1595,7 +1595,7 @@ static inline void populate_read_range(RAMBlock *bloc= k, ram_addr_t offset, } } =20 -static inline int populate_read_section(MemoryRegionSection *section, +static inline int populate_read_section(const MemoryRegionSection *section, void *opaque) { const hwaddr size =3D int128_get64(section->size); @@ -1670,7 +1670,7 @@ void ram_write_tracking_prepare(void) } } =20 -static inline int uffd_protect_section(MemoryRegionSection *section, +static inline int uffd_protect_section(const MemoryRegionSection *section, void *opaque) { const hwaddr size =3D int128_get64(section->size); diff --git a/system/memory_mapping.c b/system/memory_mapping.c index da708a08ab7..cacef504f68 100644 --- a/system/memory_mapping.c +++ b/system/memory_mapping.c @@ -196,7 +196,7 @@ typedef struct GuestPhysListener { } GuestPhysListener; =20 static void guest_phys_block_add_section(GuestPhysListener *g, - MemoryRegionSection *section) + const MemoryRegionSection *sectio= n) { const hwaddr target_start =3D section->offset_within_address_space; const hwaddr target_end =3D target_start + int128_get64(section->size); @@ -248,7 +248,7 @@ static void guest_phys_block_add_section(GuestPhysListe= ner *g, #endif } =20 -static int guest_phys_ram_populate_cb(MemoryRegionSection *section, +static int guest_phys_ram_populate_cb(const MemoryRegionSection *section, void *opaque) { GuestPhysListener *g =3D opaque; diff --git a/system/ram-block-attributes.c b/system/ram-block-attributes.c index ceb7066e6b9..e921e09f5b3 100644 --- a/system/ram-block-attributes.c +++ b/system/ram-block-attributes.c @@ -37,7 +37,7 @@ typedef int (*ram_block_attributes_section_cb)(MemoryRegi= onSection *s, =20 static int ram_block_attributes_for_each_populated_section(const RamBlockAttributes *= attr, - MemoryRegionSection *secti= on, + const MemoryRegionSection = *section, void *arg, ram_block_attributes_secti= on_cb cb) { @@ -78,7 +78,7 @@ ram_block_attributes_for_each_populated_section(const Ram= BlockAttributes *attr, =20 static int ram_block_attributes_for_each_discarded_section(const RamBlockAttributes *= attr, - MemoryRegionSection *secti= on, + const MemoryRegionSection = *section, void *arg, ram_block_attributes_secti= on_cb cb) { @@ -161,7 +161,7 @@ ram_block_attributes_rds_is_populated(const RamDiscardS= ource *rds, =20 static int ram_block_attributes_rds_replay_populated(const RamDiscardSource *rds, - MemoryRegionSection *section, + const MemoryRegionSection *secti= on, ReplayRamDiscardState replay_fn, void *opaque) { @@ -175,7 +175,7 @@ ram_block_attributes_rds_replay_populated(const RamDisc= ardSource *rds, =20 static int ram_block_attributes_rds_replay_discarded(const RamDiscardSource *rds, - MemoryRegionSection *section, + const MemoryRegionSection *secti= on, ReplayRamDiscardState replay_fn, void *opaque) { diff --git a/system/ram-discard-manager.c b/system/ram-discard-manager.c index 3d8c85617d7..1c9ff7fda58 100644 --- a/system/ram-discard-manager.c +++ b/system/ram-discard-manager.c @@ -28,7 +28,7 @@ static bool ram_discard_source_is_populated(const RamDisc= ardSource *rds, } =20 static int ram_discard_source_replay_populated(const RamDiscardSource *rds, - MemoryRegionSection *sectio= n, + const MemoryRegionSection *= section, ReplayRamDiscardState repla= y_fn, void *opaque) { @@ -39,7 +39,7 @@ static int ram_discard_source_replay_populated(const RamD= iscardSource *rds, } =20 static int ram_discard_source_replay_discarded(const RamDiscardSource *rds, - MemoryRegionSection *sectio= n, + const MemoryRegionSection *= section, ReplayRamDiscardState repla= y_fn, void *opaque) { @@ -74,7 +74,7 @@ bool ram_discard_manager_is_populated(const RamDiscardMan= ager *rdm, } =20 int ram_discard_manager_replay_populated(const RamDiscardManager *rdm, - MemoryRegionSection *section, + const MemoryRegionSection *sectio= n, ReplayRamDiscardState replay_fn, void *opaque) { @@ -83,7 +83,7 @@ int ram_discard_manager_replay_populated(const RamDiscard= Manager *rdm, } =20 int ram_discard_manager_replay_discarded(const RamDiscardManager *rdm, - MemoryRegionSection *section, + const MemoryRegionSection *sectio= n, ReplayRamDiscardState replay_fn, void *opaque) { @@ -164,7 +164,7 @@ void ram_discard_manager_notify_discard_all(RamDiscardM= anager *rdm) } } =20 -static int rdm_populate_cb(MemoryRegionSection *section, void *opaque) +static int rdm_populate_cb(const MemoryRegionSection *section, void *opaqu= e) { RamDiscardListener *rdl =3D opaque; =20 --=20 2.53.0