[PATCH v2 00/16] target/loongarch: Small enhancements to CSR emulation

Bibo Mao posted 16 patches 3 days, 2 hours ago
target/loongarch/cpu-csr.h                    |  93 +++++++---
target/loongarch/cpu.c                        |   7 +-
target/loongarch/cpu.h                        |  17 --
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     | 138 +++++++++++----
target/loongarch/tcg/tcg_cpu.c                |  20 +--
target/loongarch/tcg/tlb_helper.c             |   4 +-
11 files changed, 338 insertions(+), 195 deletions(-)
[PATCH v2 00/16] target/loongarch: Small enhancements to CSR emulation
Posted by Bibo Mao 3 days, 2 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.

---
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 (16):
  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 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                    |  93 +++++++---
 target/loongarch/cpu.c                        |   7 +-
 target/loongarch/cpu.h                        |  17 --
 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     | 138 +++++++++++----
 target/loongarch/tcg/tcg_cpu.c                |  20 +--
 target/loongarch/tcg/tlb_helper.c             |   4 +-
 11 files changed, 338 insertions(+), 195 deletions(-)


base-commit: e9fa1f66f0d47c74b6766e1b8b87ad7c2a9394d5
-- 
2.54.0