[PULL v2 00/37] Memory API patches for 2026-01-22

Philippe Mathieu-Daudé posted 37 patches 2 days, 21 hours ago
Only 6 patches received!
MAINTAINERS                                  |   1 +
configs/targets/hexagon-linux-user.mak       |   1 +
configs/targets/hppa-linux-user.mak          |   1 +
configs/targets/hppa-softmmu.mak             |   1 +
configs/targets/loongarch64-linux-user.mak   |   1 +
configs/targets/loongarch64-softmmu.mak      |   1 +
configs/targets/or1k-linux-user.mak          |   1 +
configs/targets/or1k-softmmu.mak             |   1 +
configs/targets/rx-softmmu.mak               |   1 +
configs/targets/s390x-linux-user.mak         |   1 +
configs/targets/s390x-softmmu.mak            |   1 +
configs/targets/tricore-softmmu.mak          |   1 +
block/qcow2.h                                |   1 +
include/accel/tcg/cpu-ldst.h                 |   2 +
include/exec/cpu-common.h                    |   4 -
include/exec/memop.h                         |   4 +
include/exec/translator.h                    |   5 +-
include/exec/tswap.h                         |   3 +
include/hw/core/cpu.h                        |   7 +-
include/qemu/bswap.h                         |  72 +++
include/qemu/host-utils.h                    |   1 -
include/qemu/int128.h                        |   2 -
include/system/memory.h                      |   8 +-
include/system/memory_cached.h               |   2 +
system/memory-internal.h                     |   2 +
target/arm/cpu.h                             |   1 +
target/i386/cpu.h                            |   1 +
target/i386/ops_sse.h                        |  12 +-
target/i386/tcg/seg_helper.h                 |  12 +-
include/system/memory_ldst.h.inc             |  52 +--
include/system/memory_ldst_endian.h.inc      |  33 ++
include/system/memory_ldst_phys.h.inc        | 113 +----
include/system/memory_ldst_phys_endian.h.inc |  57 +++
audio/audio.c                                |   1 +
block/blklogwrites.c                         |   1 +
block/export/vduse-blk.c                     |   1 +
block/export/vhost-user-blk-server.c         |   1 +
block/export/virtio-blk-handler.c            |   1 +
block/parallels-ext.c                        |   1 +
dump/win_dump-stubs.c                        |  21 +
dump/{win_dump.c => win_dump-x86.c}          |  20 +-
hw/9pfs/9p-local.c                           |   1 +
hw/block/cdrom.c                             |   1 +
hw/block/hd-geometry.c                       |   1 +
hw/core/cpu-common.c                         |   1 -
hw/core/cpu-system.c                         |   2 +-
hw/net/can/ctucan_core.c                     |   1 +
hw/nvram/xlnx-efuse.c                        |   1 +
hw/scsi/scsi-generic.c                       |   1 +
hw/sd/sd.c                                   |   1 +
hw/sd/ssi-sd.c                               |   1 +
linux-user/vm86.c                            |   4 +-
net/l2tpv3.c                                 |   1 +
qga/commands-linux.c                         |   1 +
scsi/pr-manager-helper.c                     |   1 +
system/cpus.c                                |   1 -
system/physmem.c                             |   8 +-
target/arm/cpu.c                             |  13 +-
target/arm/tcg/arith_helper.c                |   1 +
target/i386/cpu.c                            |   1 +
target/i386/kvm/kvm-cpu.c                    |   1 -
target/i386/tcg/mem_helper.c                 |   8 +-
target/i386/tcg/mpx_helper.c                 |  28 +-
target/i386/tcg/seg_helper.c                 |  16 +-
target/i386/tcg/system/excp_helper.c         |   8 +-
target/i386/tcg/system/svm_helper.c          |  69 +--
target/i386/tcg/system/tcg-cpu.c             |   1 -
target/m68k/fpu_helper.c                     |  12 +-
target/m68k/op_helper.c                      |  91 ++--
target/ppc/mem_helper.c                      |  31 +-
target/riscv/vector_helper.c                 |  12 +-
target/sh4/op_helper.c                       |   5 +-
target/sparc/ldst_helper.c                   |   6 +-
tests/qtest/acpi-utils.c                     |   1 +
tests/qtest/ahci-test.c                      |   2 +-
tests/qtest/aspeed-hace-utils.c              |   1 +
tests/qtest/bios-tables-test.c               |   1 +
tests/qtest/libqos/ahci.c                    |   2 +-
tests/qtest/libqos/generic-pcihost.c         |   2 +-
tests/qtest/libqos/igb.c                     |   1 +
tests/qtest/libqos/pci-spapr.c               |   2 +-
tests/qtest/libqos/virtio-9p-client.c        |   1 +
tests/qtest/migration/framework.c            |   1 +
tests/qtest/npcm7xx_emc-test.c               |   1 +
tests/qtest/tpm-emu.c                        |   1 +
tests/qtest/ufs-test.c                       |   1 +
tests/qtest/vmgenid-test.c                   |   1 +
tests/unit/test-hbitmap.c                    |   1 +
util/bitmap.c                                |   1 +
util/hbitmap.c                               |   2 +-
system/memory_ldst.c.inc                     | 449 ++-----------------
system/memory_ldst_endian.c.inc              |  70 +++
Kconfig                                      |   1 +
dump/Kconfig                                 |   6 +
dump/meson.build                             |   3 +-
scripts/make-config-poison.sh                |   1 +
96 files changed, 566 insertions(+), 769 deletions(-)
create mode 100644 include/system/memory_ldst_endian.h.inc
create mode 100644 include/system/memory_ldst_phys_endian.h.inc
create mode 100644 dump/win_dump-stubs.c
rename dump/{win_dump.c => win_dump-x86.c} (97%)
create mode 100644 system/memory_ldst_endian.c.inc
create mode 100644 dump/Kconfig
[PULL v2 00/37] Memory API patches for 2026-01-22
Posted by Philippe Mathieu-Daudé 2 days, 21 hours ago
The following changes since commit 2339d0a1cfac6ecc667e6e062a593865c1541c35:

  Merge tag 'hw-misc-20260120' of https://github.com/philmd/qemu into staging (2026-01-21 07:39:57 +1100)

are available in the Git repository at:

  https://github.com/philmd/qemu.git tags/memory-api-20260122

for you to fetch changes up to 1280ec826e98342db4e7c35daf7680d09121bde6:

  cpus: Allocate maximum number of ASes supported by the arch (2026-01-22 10:48:46 +0100)

----------------------------------------------------------------
Memory API patches

- Use explicit endianness for cpu_ld/st_data*() on some targets
- Reduce 'qemu/bswap.h' uses
- Introduce ldm_p/stm_p (MemOp) load/store helpers
- Allow restricting the legacy 'native-endian' APIs
- Forbid various targets to use legacy native endianness APIs
- Simplify cpu_address_space_init() API
----------------------------------------------------------------

Deliberately ignored checkpatch.pl errors:

 ERROR: DEVICE_NATIVE_ENDIAN is not allowed, use DEVICE_LITTLE_ENDIAN or DEVICE_BIG_ENDIAN instead
 #314: FILE: system/memory_ldst.c.inc:448:
 +#define DEVICE_ENDIANNESS       DEVICE_NATIVE_ENDIAN

 ERROR: DEVICE_NATIVE_ENDIAN is not allowed, use DEVICE_LITTLE_ENDIAN or DEVICE_BIG_ENDIAN instead
 #182: FILE: system/memory_ldst.c.inc:97:
 +                                                    DEVICE_NATIVE_ENDIAN);

 ERROR: DEVICE_NATIVE_ENDIAN is not allowed, use DEVICE_LITTLE_ENDIAN or DEVICE_BIG_ENDIAN instead
 #332: FILE: system/memory_ldst.c.inc:171:
 +                                             DEVICE_NATIVE_ENDIAN);

 ERROR: DEVICE_NATIVE_ENDIAN is not allowed, use DEVICE_LITTLE_ENDIAN or DEVICE_BIG_ENDIAN instead
 #34: FILE: include/system/memory.h:31:
 +    DEVICE_NATIVE_ENDIAN = 0,

False negative:

  WARNING: added, moved or deleted file(s):

    dump/win_dump-stubs.c
    dump/win_dump-x86.c
    dump/Kconfig

  Does MAINTAINERS need updating?

Gustavo Romero (3):
  target/arm: Initialize AS 0 first
  target/i386: Add a _MAX sentinel to X86ASIdx enum
  target/arm: Add a _MAX sentinel to ARMASIdx enum

Philippe Mathieu-Daudé (34):
  target/i386: Use little-endian variant of cpu_ld/st_data*()
  target/riscv: Use little-endian variant of cpu_ld/st_data*() for
    vector
  target/m68k: Use big-endian variant of cpu_ld/st_data*()
  target/sparc: Use big-endian variant of cpu_ld/st_data*()
  target/sh4: Replace cpu_stl_data() call in OCBI helper
  target/ppc: Simplify endianness handling in Altivec opcodes
  bswap: Include missing 'qemu/bswap.h' header
  bswap: Use 'qemu/bswap.h' instead of 'qemu/host-utils.h'
  bswap: Remove unnecessary 'qemu/bswap.h'
  system/memory: Introduce ldm_p() and stm_p() load/store helpers
  system/memory: Define address_space_ldst[W] endian variants via
    template
  system/memory: Define address_space_ldst[L] endian variants via
    template
  system/memory: Define address_space_ldst[Q] endian variants via
    template
  system/memory: Factor address_space_ldst[M]_internal() helper out
  system/memory: Pass device_endian argument as MemOp bit
  system/memory: Use ldm_p() and stm_p() helpers
  system/memory: Directly call address_space_ldst[M]_internal() helper
  system: Allow restricting the legacy ld/st_phys() 'native-endian' API
  system: Allow restricting legacy address_space_ldst() native-endian
    API
  system: Allow restricting the legacy cpu_ld/st() 'native-endian' API
  system: Allow restricting the legacy translator_ld() 'native-endian'
    API
  system: Allow restricting the legacy tswap() 'native-endian' API
  system: Allow restricting the legacy MO_TE* 'native-endian'
    definitions
  system: Allow restricting the legacy DEVICE_NATIVE_ENDIAN definition
  configs/targets: Forbid Hexagon to use legacy native endianness API
  configs/targets: Forbid HPPA to use legacy native endianness APIs
  configs/targets: Forbid LoongArch to use legacy native endianness APIs
  configs/targets: Forbid OpenRISC to use legacy native endianness APIs
  configs/targets: Forbid TriCore to use legacy native endianness API
  configs/targets: Forbid Renesas RX to use legacy native endianness API
  configs/targets: Forbid s390x to use legacy native endianness APIs
  dump: Abort in create_win_dump() on non-x86 guests
  dump: Build stubs once for non-x86 targets
  cpus: Allocate maximum number of ASes supported by the arch

 MAINTAINERS                                  |   1 +
 configs/targets/hexagon-linux-user.mak       |   1 +
 configs/targets/hppa-linux-user.mak          |   1 +
 configs/targets/hppa-softmmu.mak             |   1 +
 configs/targets/loongarch64-linux-user.mak   |   1 +
 configs/targets/loongarch64-softmmu.mak      |   1 +
 configs/targets/or1k-linux-user.mak          |   1 +
 configs/targets/or1k-softmmu.mak             |   1 +
 configs/targets/rx-softmmu.mak               |   1 +
 configs/targets/s390x-linux-user.mak         |   1 +
 configs/targets/s390x-softmmu.mak            |   1 +
 configs/targets/tricore-softmmu.mak          |   1 +
 block/qcow2.h                                |   1 +
 include/accel/tcg/cpu-ldst.h                 |   2 +
 include/exec/cpu-common.h                    |   4 -
 include/exec/memop.h                         |   4 +
 include/exec/translator.h                    |   5 +-
 include/exec/tswap.h                         |   3 +
 include/hw/core/cpu.h                        |   7 +-
 include/qemu/bswap.h                         |  72 +++
 include/qemu/host-utils.h                    |   1 -
 include/qemu/int128.h                        |   2 -
 include/system/memory.h                      |   8 +-
 include/system/memory_cached.h               |   2 +
 system/memory-internal.h                     |   2 +
 target/arm/cpu.h                             |   1 +
 target/i386/cpu.h                            |   1 +
 target/i386/ops_sse.h                        |  12 +-
 target/i386/tcg/seg_helper.h                 |  12 +-
 include/system/memory_ldst.h.inc             |  52 +--
 include/system/memory_ldst_endian.h.inc      |  33 ++
 include/system/memory_ldst_phys.h.inc        | 113 +----
 include/system/memory_ldst_phys_endian.h.inc |  57 +++
 audio/audio.c                                |   1 +
 block/blklogwrites.c                         |   1 +
 block/export/vduse-blk.c                     |   1 +
 block/export/vhost-user-blk-server.c         |   1 +
 block/export/virtio-blk-handler.c            |   1 +
 block/parallels-ext.c                        |   1 +
 dump/win_dump-stubs.c                        |  21 +
 dump/{win_dump.c => win_dump-x86.c}          |  20 +-
 hw/9pfs/9p-local.c                           |   1 +
 hw/block/cdrom.c                             |   1 +
 hw/block/hd-geometry.c                       |   1 +
 hw/core/cpu-common.c                         |   1 -
 hw/core/cpu-system.c                         |   2 +-
 hw/net/can/ctucan_core.c                     |   1 +
 hw/nvram/xlnx-efuse.c                        |   1 +
 hw/scsi/scsi-generic.c                       |   1 +
 hw/sd/sd.c                                   |   1 +
 hw/sd/ssi-sd.c                               |   1 +
 linux-user/vm86.c                            |   4 +-
 net/l2tpv3.c                                 |   1 +
 qga/commands-linux.c                         |   1 +
 scsi/pr-manager-helper.c                     |   1 +
 system/cpus.c                                |   1 -
 system/physmem.c                             |   8 +-
 target/arm/cpu.c                             |  13 +-
 target/arm/tcg/arith_helper.c                |   1 +
 target/i386/cpu.c                            |   1 +
 target/i386/kvm/kvm-cpu.c                    |   1 -
 target/i386/tcg/mem_helper.c                 |   8 +-
 target/i386/tcg/mpx_helper.c                 |  28 +-
 target/i386/tcg/seg_helper.c                 |  16 +-
 target/i386/tcg/system/excp_helper.c         |   8 +-
 target/i386/tcg/system/svm_helper.c          |  69 +--
 target/i386/tcg/system/tcg-cpu.c             |   1 -
 target/m68k/fpu_helper.c                     |  12 +-
 target/m68k/op_helper.c                      |  91 ++--
 target/ppc/mem_helper.c                      |  31 +-
 target/riscv/vector_helper.c                 |  12 +-
 target/sh4/op_helper.c                       |   5 +-
 target/sparc/ldst_helper.c                   |   6 +-
 tests/qtest/acpi-utils.c                     |   1 +
 tests/qtest/ahci-test.c                      |   2 +-
 tests/qtest/aspeed-hace-utils.c              |   1 +
 tests/qtest/bios-tables-test.c               |   1 +
 tests/qtest/libqos/ahci.c                    |   2 +-
 tests/qtest/libqos/generic-pcihost.c         |   2 +-
 tests/qtest/libqos/igb.c                     |   1 +
 tests/qtest/libqos/pci-spapr.c               |   2 +-
 tests/qtest/libqos/virtio-9p-client.c        |   1 +
 tests/qtest/migration/framework.c            |   1 +
 tests/qtest/npcm7xx_emc-test.c               |   1 +
 tests/qtest/tpm-emu.c                        |   1 +
 tests/qtest/ufs-test.c                       |   1 +
 tests/qtest/vmgenid-test.c                   |   1 +
 tests/unit/test-hbitmap.c                    |   1 +
 util/bitmap.c                                |   1 +
 util/hbitmap.c                               |   2 +-
 system/memory_ldst.c.inc                     | 449 ++-----------------
 system/memory_ldst_endian.c.inc              |  70 +++
 Kconfig                                      |   1 +
 dump/Kconfig                                 |   6 +
 dump/meson.build                             |   3 +-
 scripts/make-config-poison.sh                |   1 +
 96 files changed, 566 insertions(+), 769 deletions(-)
 create mode 100644 include/system/memory_ldst_endian.h.inc
 create mode 100644 include/system/memory_ldst_phys_endian.h.inc
 create mode 100644 dump/win_dump-stubs.c
 rename dump/{win_dump.c => win_dump-x86.c} (97%)
 create mode 100644 system/memory_ldst_endian.c.inc
 create mode 100644 dump/Kconfig

-- 
2.52.0


Re: [PULL v2 00/37] Memory API patches for 2026-01-22
Posted by Richard Henderson 1 day, 11 hours ago
On 1/22/26 22:16, Philippe Mathieu-Daudé wrote:
> The following changes since commit 2339d0a1cfac6ecc667e6e062a593865c1541c35:
> 
>    Merge tag 'hw-misc-20260120' ofhttps://github.com/philmd/qemu into staging (2026-01-21 07:39:57 +1100)
> 
> are available in the Git repository at:
> 
>    https://github.com/philmd/qemu.git tags/memory-api-20260122
> 
> for you to fetch changes up to 1280ec826e98342db4e7c35daf7680d09121bde6:
> 
>    cpus: Allocate maximum number of ASes supported by the arch (2026-01-22 10:48:46 +0100)
> 
> ----------------------------------------------------------------
> Memory API patches
> 
> - Use explicit endianness for cpu_ld/st_data*() on some targets
> - Reduce 'qemu/bswap.h' uses
> - Introduce ldm_p/stm_p (MemOp) load/store helpers
> - Allow restricting the legacy 'native-endian' APIs
> - Forbid various targets to use legacy native endianness APIs
> - Simplify cpu_address_space_init() API


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

r~