[PATCH v3 00/18] target/loongarch: Small enhancements to CSR emulation

Bibo Mao posted 18 patches 1 day, 18 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261126071440.3293877-1-maobibo@loongson.cn
Maintainers: Song Gao <17746591750@163.com>, Bibo Mao <maobibo@loongson.cn>, Xianglai Li <lixianglai@loongson.cn>
target/loongarch/cpu-csr.h                    | 108 +++++++++---
target/loongarch/cpu.c                        |  17 +-
target/loongarch/cpu.h                        |  19 +-
target/loongarch/csr.c                        | 165 ++++++++++--------
target/loongarch/csr.h                        |   9 +
target/loongarch/disas.c                      |   4 -
target/loongarch/tcg/csr_helper.c             |  67 +++++--
target/loongarch/tcg/helper.h                 |   9 +-
.../tcg/insn_trans/trans_privileged.c.inc     | 139 +++++++++++----
target/loongarch/tcg/op_helper.c              |   3 +-
target/loongarch/tcg/tcg_cpu.c                |  25 +--
target/loongarch/tcg/tlb_helper.c             |   4 +-
12 files changed, 366 insertions(+), 203 deletions(-)
[PATCH v3 00/18] target/loongarch: Small enhancements to CSR emulation
Posted by Bibo Mao 1 day, 18 hours ago
There are some small enhancements to CSR register emulation on
LoongArch based on the manual, such as fixing CSR.MISC being
incorrectly marked read-only and avoiding raising an exception on
writes to read-only CSRs etc.

---
v2 ... v3:
  1. Add reserved fields to register CSR_MISC in new patch 13
  2. Fix CSR_ECFG field definitions and remove MSGINT field in new patch
     14
  3. Add field reserve bit with CSR bit definition, use reserve bit
     marco for CSR write mask setting.
  4. Modify some code style issues.

v1 ... v2:
  1. Add sign-extended value with 32-bit CSR reading
  2. Add read-only bit support with CSR register writing, discard
     writing for these read-only bit
  3. Remove debug exception support
  4. Remove some unused CSR registers such as CSR CTAG and Memory Error
     register, which QEMU emulation does not support.
---
Bibo Mao (18):
  target/loongarch: Remove csrrd_cpuid() helper
  target/loongarch: Remove debug exception support
  target/loongarch: Remove some unused CSR registers
  target/loongarch: Move field definition of some CSR register to
    cpu-csr.h
  target/loongarch: Move CSR_TLBRERA FIELD definition next to
    LOONGARCH_CSR_TLBRERA
  target/loongarch: Fix BADV for BCE exception
  target/loongarch: Fix CSR.MISC being incorrectly marked read-only
  target/loongarch: Set register CSR_MSGIS as read-only
  target/loongarch: Do not raise exception on read-only CSR write
  target/loongarch: Add CSRFL_WIDTH64 flag for some CSR registers
  target/loongarch: Return sign-extended value when reading 32-bit CSR
    registers
  target/loongarch: Add write mask to CSRInfo
  target/loongarch: Add reserved fields to CSR_MISC
  target/loongarch: Fix CSR_ECFG field definitions
  target/loongarch: Add fine-grained write masks for CSRs
  target/loongarch: Add generic csrwr helper
  target/loongarch: Call generic csrwr helper for part read-only bits
  target/loongarch: Define some csrwr helper functions static

 target/loongarch/cpu-csr.h                    | 108 +++++++++---
 target/loongarch/cpu.c                        |  17 +-
 target/loongarch/cpu.h                        |  19 +-
 target/loongarch/csr.c                        | 165 ++++++++++--------
 target/loongarch/csr.h                        |   9 +
 target/loongarch/disas.c                      |   4 -
 target/loongarch/tcg/csr_helper.c             |  67 +++++--
 target/loongarch/tcg/helper.h                 |   9 +-
 .../tcg/insn_trans/trans_privileged.c.inc     | 139 +++++++++++----
 target/loongarch/tcg/op_helper.c              |   3 +-
 target/loongarch/tcg/tcg_cpu.c                |  25 +--
 target/loongarch/tcg/tlb_helper.c             |   4 +-
 12 files changed, 366 insertions(+), 203 deletions(-)


base-commit: 16067c8ad46433975758ffa9f38a2646e8b641af
-- 
2.54.0