qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 00/41] Memory patches for 2025-10-07
@ 2025-10-07  1:49 Philippe Mathieu-Daudé
  2025-10-07  1:49 ` [PULL 15/41] target/i386/whpx: Replace legacy cpu_physical_memory_rw() call Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-07  1:49 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit eb7abb4a719f93ddd56571bf91681044b4159399:

  hw/intc/loongarch_dintc: Set class_size for LoongArchDINTCClass (2025-10-06 13:54:50 -0700)

are available in the Git repository at:

  https://github.com/philmd/qemu.git tags/physmem-20251007

for you to fetch changes up to 9ccfde942d8b4e66eb012cf975dac16913875a2c:

  system/physmem: Extract API out of 'system/ram_addr.h' header (2025-10-07 03:37:40 +0200)

----------------------------------------------------------------
Memory patches

- Cleanups on RAMBlock API
- Cleanups on Physical Memory API
- Remove cpu_physical_memory_is_io()
- Remove cpu_physical_memory_rw()
- Legacy conversion [cpu_physical_memory -> address_space]_[un]map()

----------------------------------------------------------------

Philippe Mathieu-Daudé (40):
  system/ramblock: Remove obsolete comment
  system/ramblock: Move ram_block_is_pmem() declaration
  system/ramblock: Move ram_block_discard_*_range() declarations
  system/ramblock: Rename @start -> @offset in ram_block_discard_range()
  system/ramblock: Move RAMBlock helpers out of "system/ram_addr.h"
  docs/devel/loads-stores: Stop mentioning
    cpu_physical_memory_write_rom()
  system/memory: Factor address_space_is_io() out
  target/i386/arch_memory_mapping: Use address_space_memory_is_io()
  hw/s390x/sclp: Use address_space_memory_is_io() in sclp_service_call()
  system/physmem: Remove cpu_physical_memory_is_io()
  system/physmem: Pass address space argument to
    cpu_flush_icache_range()
  hw/s390x/sclp: Replace [cpu_physical_memory -> address_space]_r/w()
  target/s390x/mmu: Replace [cpu_physical_memory -> address_space]_rw()
  target/i386/whpx: Replace legacy cpu_physical_memory_rw() call
  target/i386/kvm: Replace legacy cpu_physical_memory_rw() call
  target/i386/nvmm: Inline cpu_physical_memory_rw() in nvmm_mem_callback
  hw/xen/hvm: Inline cpu_physical_memory_rw() in rw_phys_req_item()
  system/physmem: Un-inline cpu_physical_memory_read/write()
  system/physmem: Avoid cpu_physical_memory_rw when is_write is constant
  system/physmem: Remove legacy cpu_physical_memory_rw()
  hw/virtio/vhost: Replace legacy cpu_physical_memory_*map() calls
  hw/virtio/virtio: Replace legacy cpu_physical_memory_map() call
  system/ram_addr: Remove unnecessary 'exec/cpu-common.h' header
  accel/kvm: Include missing 'exec/target_page.h' header
  hw/s390x/s390-stattrib: Include missing 'exec/target_page.h' header
  hw/vfio/listener: Include missing 'exec/target_page.h' header
  target/arm/tcg/mte: Include missing 'exec/target_page.h' header
  hw: Remove unnecessary 'system/ram_addr.h' header
  system/physmem: Un-inline cpu_physical_memory_get_dirty_flag()
  system/physmem: Un-inline cpu_physical_memory_is_clean()
  system/physmem: Un-inline cpu_physical_memory_range_includes_clean()
  system/physmem: Un-inline cpu_physical_memory_set_dirty_flag()
  system/physmem: Un-inline cpu_physical_memory_set_dirty_range()
  system/physmem: Remove _WIN32 #ifdef'ry
  system/physmem: Un-inline cpu_physical_memory_set_dirty_lebitmap()
  system/physmem: Un-inline cpu_physical_memory_dirty_bits_cleared()
  system/physmem: Reduce cpu_physical_memory_clear_dirty_range() scope
  system/physmem: Reduce cpu_physical_memory_sync_dirty_bitmap() scope
  system/physmem: Drop 'cpu_' prefix in Physical Memory API
  system/physmem: Extract API out of 'system/ram_addr.h' header

Richard Henderson (1):
  system/memory: Split address_space_write_rom_internal

 MAINTAINERS                               |   1 +
 docs/devel/loads-stores.rst               |   6 +-
 scripts/coccinelle/exec_rw_const.cocci    |  22 -
 include/exec/cpu-common.h                 |  21 +-
 include/system/memory.h                   |  11 +
 include/system/physmem.h                  |  54 +++
 include/system/ram_addr.h                 | 426 -------------------
 include/system/ramblock.h                 |  27 +-
 accel/kvm/kvm-all.c                       |   6 +-
 accel/tcg/cputlb.c                        |  13 +-
 hw/core/loader.c                          |   2 +-
 hw/hyperv/hv-balloon-our_range_memslots.c |   1 +
 hw/ppc/spapr.c                            |   1 -
 hw/ppc/spapr_caps.c                       |   1 -
 hw/ppc/spapr_pci.c                        |   1 -
 hw/remote/memory.c                        |   1 -
 hw/remote/proxy-memory-listener.c         |   1 -
 hw/s390x/s390-stattrib-kvm.c              |   2 +-
 hw/s390x/s390-stattrib.c                  |   2 +-
 hw/s390x/s390-virtio-ccw.c                |   1 -
 hw/s390x/sclp.c                           |  14 +-
 hw/vfio/container-legacy.c                |  10 +-
 hw/vfio/container.c                       |   5 +-
 hw/vfio/listener.c                        |   2 +-
 hw/vfio/spapr.c                           |   1 -
 hw/virtio/vhost.c                         |   7 +-
 hw/virtio/virtio-balloon.c                |   1 +
 hw/virtio/virtio-mem.c                    |   2 +-
 hw/virtio/virtio.c                        |  10 +-
 hw/xen/xen-hvm-common.c                   |   8 +-
 migration/ram.c                           |  81 +++-
 system/memory.c                           |   9 +-
 system/physmem.c                          | 475 +++++++++++++++++-----
 target/arm/tcg/mte_helper.c               |   5 +-
 target/i386/arch_memory_mapping.c         |  10 +-
 target/i386/kvm/xen-emu.c                 |   4 +-
 target/i386/nvmm/nvmm-all.c               |   5 +-
 target/i386/whpx/whpx-all.c               |   7 +-
 target/s390x/mmu_helper.c                 |   7 +-
 system/memory_ldst.c.inc                  |   2 +-
 tests/tsan/ignore.tsan                    |   4 +-
 41 files changed, 636 insertions(+), 633 deletions(-)
 create mode 100644 include/system/physmem.h

-- 
2.51.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 15/41] target/i386/whpx: Replace legacy cpu_physical_memory_rw() call
  2025-10-07  1:49 [PULL 00/41] Memory patches for 2025-10-07 Philippe Mathieu-Daudé
@ 2025-10-07  1:49 ` Philippe Mathieu-Daudé
  2025-10-07  1:49 ` [PULL 23/41] hw/virtio/virtio: Replace legacy cpu_physical_memory_map() call Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-07  1:49 UTC (permalink / raw)
  To: qemu-devel

Get the vCPU address space and convert the legacy
cpu_physical_memory_rw() by address_space_rw().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20251002084203.63899-10-philmd@linaro.org>
---
 target/i386/whpx/whpx-all.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index 2a85168ed51..256761834c9 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -788,8 +788,11 @@ static HRESULT CALLBACK whpx_emu_mmio_callback(
     void *ctx,
     WHV_EMULATOR_MEMORY_ACCESS_INFO *ma)
 {
-    cpu_physical_memory_rw(ma->GpaAddress, ma->Data, ma->AccessSize,
-                           ma->Direction);
+    CPUState *cs = (CPUState *)ctx;
+    AddressSpace *as = cpu_addressspace(cs, MEMTXATTRS_UNSPECIFIED);
+
+    address_space_rw(as, ma->GpaAddress, MEMTXATTRS_UNSPECIFIED,
+                     ma->Data, ma->AccessSize, ma->Direction);
     return S_OK;
 }
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 23/41] hw/virtio/virtio: Replace legacy cpu_physical_memory_map() call
  2025-10-07  1:49 [PULL 00/41] Memory patches for 2025-10-07 Philippe Mathieu-Daudé
  2025-10-07  1:49 ` [PULL 15/41] target/i386/whpx: Replace legacy cpu_physical_memory_rw() call Philippe Mathieu-Daudé
@ 2025-10-07  1:49 ` Philippe Mathieu-Daudé
  2025-10-07  3:05 ` [PULL 00/41] Memory patches for 2025-10-07 Philippe Mathieu-Daudé
  2025-10-07 22:58 ` Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-07  1:49 UTC (permalink / raw)
  To: qemu-devel

Propagate VirtIODevice::dma_as to virtqueue_undo_map_desc()
in order to replace the legacy cpu_physical_memory_unmap()
call by address_space_unmap().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20251002084203.63899-18-philmd@linaro.org>
---
 hw/virtio/virtio.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index be73753b59f..153ee0a0cf1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -32,6 +32,7 @@
 #include "hw/virtio/virtio-access.h"
 #include "system/dma.h"
 #include "system/iothread.h"
+#include "system/memory.h"
 #include "system/runstate.h"
 #include "virtio-qmp.h"
 
@@ -1632,7 +1633,8 @@ out:
  * virtqueue_unmap_sg() can't be used).  Assumes buffers weren't written to
  * yet.
  */
-static void virtqueue_undo_map_desc(unsigned int out_num, unsigned int in_num,
+static void virtqueue_undo_map_desc(AddressSpace *as,
+                                    unsigned int out_num, unsigned int in_num,
                                     struct iovec *iov)
 {
     unsigned int i;
@@ -1640,7 +1642,7 @@ static void virtqueue_undo_map_desc(unsigned int out_num, unsigned int in_num,
     for (i = 0; i < out_num + in_num; i++) {
         int is_write = i >= out_num;
 
-        cpu_physical_memory_unmap(iov->iov_base, iov->iov_len, is_write, 0);
+        address_space_unmap(as, iov->iov_base, iov->iov_len, is_write, 0);
         iov++;
     }
 }
@@ -1842,7 +1844,7 @@ done:
     return elem;
 
 err_undo_map:
-    virtqueue_undo_map_desc(out_num, in_num, iov);
+    virtqueue_undo_map_desc(vdev->dma_as, out_num, in_num, iov);
     goto done;
 }
 
@@ -1992,7 +1994,7 @@ done:
     return elem;
 
 err_undo_map:
-    virtqueue_undo_map_desc(out_num, in_num, iov);
+    virtqueue_undo_map_desc(vdev->dma_as, out_num, in_num, iov);
     goto done;
 }
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PULL 00/41] Memory patches for 2025-10-07
  2025-10-07  1:49 [PULL 00/41] Memory patches for 2025-10-07 Philippe Mathieu-Daudé
  2025-10-07  1:49 ` [PULL 15/41] target/i386/whpx: Replace legacy cpu_physical_memory_rw() call Philippe Mathieu-Daudé
  2025-10-07  1:49 ` [PULL 23/41] hw/virtio/virtio: Replace legacy cpu_physical_memory_map() call Philippe Mathieu-Daudé
@ 2025-10-07  3:05 ` Philippe Mathieu-Daudé
  2025-10-07 22:58 ` Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-07  3:05 UTC (permalink / raw)
  To: qemu-devel

On 7/10/25 03:49, Philippe Mathieu-Daudé wrote:
> The following changes since commit eb7abb4a719f93ddd56571bf91681044b4159399:
> 
>    hw/intc/loongarch_dintc: Set class_size for LoongArchDINTCClass (2025-10-06 13:54:50 -0700)
> 
> are available in the Git repository at:
> 
>    https://github.com/philmd/qemu.git tags/physmem-20251007
> 
> for you to fetch changes up to 9ccfde942d8b4e66eb012cf975dac16913875a2c:

(update as 4db362f68c7cd28a6b1aa2f9ada68aa3556f9613)

> 
>    system/physmem: Extract API out of 'system/ram_addr.h' header (2025-10-07 03:37:40 +0200)
> 
> ----------------------------------------------------------------
> Memory patches
> 
> - Cleanups on RAMBlock API
> - Cleanups on Physical Memory API
> - Remove cpu_physical_memory_is_io()
> - Remove cpu_physical_memory_rw()
> - Legacy conversion [cpu_physical_memory -> address_space]_[un]map()
> 
> ----------------------------------------------------------------



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PULL 00/41] Memory patches for 2025-10-07
  2025-10-07  1:49 [PULL 00/41] Memory patches for 2025-10-07 Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2025-10-07  3:05 ` [PULL 00/41] Memory patches for 2025-10-07 Philippe Mathieu-Daudé
@ 2025-10-07 22:58 ` Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2025-10-07 22:58 UTC (permalink / raw)
  To: qemu-devel

On 10/6/25 18:49, Philippe Mathieu-Daudé wrote:
> The following changes since commit eb7abb4a719f93ddd56571bf91681044b4159399:
> 
>    hw/intc/loongarch_dintc: Set class_size for LoongArchDINTCClass (2025-10-06 13:54:50 -0700)
> 
> are available in the Git repository at:
> 
>    https://github.com/philmd/qemu.git tags/physmem-20251007
> 
> for you to fetch changes up to 9ccfde942d8b4e66eb012cf975dac16913875a2c:
> 
>    system/physmem: Extract API out of 'system/ram_addr.h' header (2025-10-07 03:37:40 +0200)
> 
> ----------------------------------------------------------------
> Memory patches
> 
> - Cleanups on RAMBlock API
> - Cleanups on Physical Memory API
> - Remove cpu_physical_memory_is_io()
> - Remove cpu_physical_memory_rw()
> - Legacy conversion [cpu_physical_memory -> address_space]_[un]map()


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.

r~


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-07 23:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-07  1:49 [PULL 00/41] Memory patches for 2025-10-07 Philippe Mathieu-Daudé
2025-10-07  1:49 ` [PULL 15/41] target/i386/whpx: Replace legacy cpu_physical_memory_rw() call Philippe Mathieu-Daudé
2025-10-07  1:49 ` [PULL 23/41] hw/virtio/virtio: Replace legacy cpu_physical_memory_map() call Philippe Mathieu-Daudé
2025-10-07  3:05 ` [PULL 00/41] Memory patches for 2025-10-07 Philippe Mathieu-Daudé
2025-10-07 22:58 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).