]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Merge patch series "target/riscv: Add support for Svadu extension"
authorPalmer Dabbelt <palmer@rivosinc.com>
Thu, 2 Mar 2023 01:28:21 +0000 (17:28 -0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 2 Mar 2023 01:30:34 +0000 (17:30 -0800)
Weiwei Li <liweiwei@iscas.ac.cn> says:

This patchset adds support svadu extension. It also fixes some
relationship between *envcfg fields and Svpbmt/Sstc extensions.

Specification for Svadu extension can be found in:

https://github.com/riscv/riscv-svadu

* b4-shazam-merge:
  target/riscv: Export Svadu property
  target/riscv: Add *envcfg.HADE related check in address translation
  target/riscv: Add *envcfg.PBMTE related check in address translation
  target/riscv: Add csr support for svadu
  target/riscv: Fix the relationship of PBMTE/STCE fields between menvcfg and henvcfg
  target/riscv: Fix the relationship between menvcfg.PBMTE/STCE and Svpbmt/Sstc extensions

Message-ID: <20230224040852.37109-1-liweiwei@iscas.ac.cn>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1  2 
target/riscv/cpu.c
target/riscv/cpu.h
target/riscv/cpu_helper.c
target/riscv/csr.c

Simple merge
Simple merge
Simple merge
index a2cf3536f08caaa8fafdb811c9998971ccf0c14e,be71c50f091031ff869c5fa9f2f689f917c94a4d..ee49b636f5da1ef869db716ca2cd1dc8d2ee7a57
@@@ -1877,8 -1883,9 +1877,9 @@@ static RISCVException read_menvcfg(CPUR
  }
  
  static RISCVException write_menvcfg(CPURISCVState *env, int csrno,
 -                                  target_ulong val)
 +                                    target_ulong val)
  {
+     RISCVCPUConfig *cfg = &env_archcpu(env)->cfg;
      uint64_t mask = MENVCFG_FIOM | MENVCFG_CBIE | MENVCFG_CBCFE | MENVCFG_CBZE;
  
      if (riscv_cpu_mxl(env) == MXL_RV64) {
@@@ -1897,9 -1906,12 +1900,12 @@@ static RISCVException read_menvcfgh(CPU
  }
  
  static RISCVException write_menvcfgh(CPURISCVState *env, int csrno,
 -                                  target_ulong val)
 +                                     target_ulong val)
  {
-     uint64_t mask = MENVCFG_PBMTE | MENVCFG_STCE;
+     RISCVCPUConfig *cfg = &env_archcpu(env)->cfg;
+     uint64_t mask = (cfg->ext_svpbmt ? MENVCFG_PBMTE : 0) |
+                     (cfg->ext_sstc ? MENVCFG_STCE : 0) |
+                     (cfg->ext_svadu ? MENVCFG_HADE : 0);
      uint64_t valh = (uint64_t)val << 32;
  
      env->menvcfg = (env->menvcfg & ~mask) | (valh & mask);
@@@ -2018,9 -2004,10 +2031,10 @@@ static RISCVException read_henvcfgh(CPU
  }
  
  static RISCVException write_henvcfgh(CPURISCVState *env, int csrno,
 -                                  target_ulong val)
 +                                     target_ulong val)
  {
-     uint64_t mask = HENVCFG_PBMTE | HENVCFG_STCE;
+     uint64_t mask = env->menvcfg & (HENVCFG_PBMTE | HENVCFG_STCE |
+                                     HENVCFG_HADE);
      uint64_t valh = (uint64_t)val << 32;
      RISCVException ret;