[PATCH v2 0/4] Add support for PowerPC e500 little-endian pages

Danila Zhebryakov posted 4 patches 2 days, 22 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250903134146.1487794-1-d.zhebryakov@yandex.ru
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>, Nicholas Piggin <npiggin@gmail.com>, Chinmay Rath <rathc@linux.ibm.com>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>
accel/tcg/atomic_common.c.inc       |  36 +--
accel/tcg/atomic_template.h         | 326 ++++++++++------------------
accel/tcg/cputlb.c                  |  29 ++-
accel/tcg/tcg-runtime.h             |  48 +---
accel/tcg/user-exec.c               |   2 +-
include/accel/tcg/cpu-ldst-common.h |  51 ++---
target/m68k/op_helper.c             |   4 +-
target/ppc/gdbstub.c                |  17 +-
target/ppc/internal.h               |   3 +-
target/ppc/mmu-booke.c              |  67 +++---
target/ppc/mmu-booke.h              |   2 +-
target/ppc/mmu-hash32.c             |  30 +--
target/ppc/mmu-hash32.h             |   3 +-
target/ppc/mmu-hash64.c             |  14 +-
target/ppc/mmu-hash64.h             |   2 +-
target/ppc/mmu-radix64.c            |  20 +-
target/ppc/mmu-radix64.h            |   2 +-
target/ppc/mmu_common.c             |  75 ++++---
target/ppc/mmu_helper.c             |  15 +-
target/ppc/translate.c              |  42 +++-
target/s390x/tcg/mem_helper.c       |   6 +-
tcg/tcg-op-ldst.c                   |  43 ++--
22 files changed, 370 insertions(+), 467 deletions(-)
[PATCH v2 0/4] Add support for PowerPC e500 little-endian pages
Posted by Danila Zhebryakov 2 days, 22 hours ago
These changes make powerpc booke206 mmu pass TLB_BSWAP flag for pages marked as LE, and also fixes all the issues this causes.
 - added TLB_BSWAP to non-MMIO flags
 - inserted additional check for LE page when bswap-ing instructions
 - removed assert for cross-page TLB_BSWAP accesses
 - added gdbstub fix to account for TLB_BSWAP of the currently running code

BE- and LE- atomic operations (used by load-and-reserve and store-conditional instructions) were unified to support TLB_BSWAP

Some of the fixes are based on what is done in https://github.com/YetAnotherMod/qemu

V2:
 - Removed usage of PAGE_USER bit for LE (comment on previous version)
 - Refactored MMU code so directly setting TLB_BSWAP is possible
 - moved translation LE page detect to occur 1 time per translation (comment on previous version)
 - Removed redundant assert in atomic_mmu_lookup (comment on previous version)
 - Added assert on cross-endian accesses (ideally, there should be an exception)
 - Changed atomic need_bswap handling (comment on previous version)
 - Rebased and fixed atomics

According to RM, unaligned accesses between LE and BE pages should cause an exception on e500.
However, (as I understand it) supporting this would require adding a new callback to TCGCPUOps, likely just for E500 or maybe a couple other CPUs doing this.
Such accesses are clearly not normal and usually don't occur in real applications, so I think just placing assert is OK here.

Danila Zhebryakov (4):
  accel/tcg: Unify big- and little- endian atomic ops
  target/ppc: refactor MMU helpers
  target/ppc: Add support for LE pages on PowerPC booke206 mmu
  target/ppc: fix GDB stub to work correctly with LE pages

 accel/tcg/atomic_common.c.inc       |  36 +--
 accel/tcg/atomic_template.h         | 326 ++++++++++------------------
 accel/tcg/cputlb.c                  |  29 ++-
 accel/tcg/tcg-runtime.h             |  48 +---
 accel/tcg/user-exec.c               |   2 +-
 include/accel/tcg/cpu-ldst-common.h |  51 ++---
 target/m68k/op_helper.c             |   4 +-
 target/ppc/gdbstub.c                |  17 +-
 target/ppc/internal.h               |   3 +-
 target/ppc/mmu-booke.c              |  67 +++---
 target/ppc/mmu-booke.h              |   2 +-
 target/ppc/mmu-hash32.c             |  30 +--
 target/ppc/mmu-hash32.h             |   3 +-
 target/ppc/mmu-hash64.c             |  14 +-
 target/ppc/mmu-hash64.h             |   2 +-
 target/ppc/mmu-radix64.c            |  20 +-
 target/ppc/mmu-radix64.h            |   2 +-
 target/ppc/mmu_common.c             |  75 ++++---
 target/ppc/mmu_helper.c             |  15 +-
 target/ppc/translate.c              |  42 +++-
 target/s390x/tcg/mem_helper.c       |   6 +-
 tcg/tcg-op-ldst.c                   |  43 ++--
 22 files changed, 370 insertions(+), 467 deletions(-)

-- 
2.47.2