Skip to contentSkip to conversation

target/riscv: Support RISC-V privilege 1.13 spec

PATCH RESEND Superseded Fea.Wang 5 participants 20 messages May 15, 2024 – Jun 4, 2024 RISC-V

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Fea.Wang

author
#0 lore raw

v2 cover target/riscv: Support RISC-V privilege 1.13 spec

Based on the change log for the RISC-V privilege 1.13 spec, add the support for ss1p13.

Ref:https://github.com/riscv/riscv-isa-manual/blob/a7d93c9/src/priv-preface.adoc?plain=1#L40-L72

Lists what to do without clarification or document format.
* Redefined misa.MXL to be read-only, making MXLEN a constant.(Skip, implementation ignored)
* Added the constraint that SXLEN≥UXLEN.(Skip, implementation ignored)
* Defined the misa.V field to reflect that the V extension has been implemented.(Skip, existed)
* Defined the RV32-only medelegh and hedelegh CSRs.(Done in these patches)
* Defined the misaligned atomicity granule PMA, superseding the proposed Zam extension..(Skip, implementation ignored)
* Allocated interrupt 13 for Sscofpmf LCOFI interrupt.(Skip, existed)
* Defined hardware error and software check exception codes.(Done in these patches)
* Specified synchronization requirements when changing the PBMTE fields in menvcfg and henvcfg.(Skip, implementation ignored)
* Incorporated Svade and Svadu extension specifications.(Skip, existed)

Fea.Wang (4):
target/riscv: Support the version for ss1p13 target/riscv: Add 'P1P13' bit in SMSTATEEN0 target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32 target/riscv: Reserve exception codes for sw-check and hw-err

Jim Shu (1):
target/riscv: Reuse the conversion function of priv_spec

 target/riscv/cpu.c         |  8 ++++++--
 target/riscv/cpu.h         |  5 ++++-
 target/riscv/cpu_bits.h    |  5 +++++
 target/riscv/cpu_cfg.h     |  1 +
 target/riscv/csr.c         | 39 ++++++++++++++++++++++++++++++++++++++
 target/riscv/tcg/tcg-cpu.c | 17 ++++++++---------
 6 files changed, 63 insertions(+), 12 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH RESEND v2 1/5 target/riscv: Reuse the conversion function of priv_spec

From: Jim Shu <[email protected]>

Public the conversion function of priv_spec in cpu.h, so that tcg-cpu.c could also use it.

---
 target/riscv/cpu.c         |  2 +-
 target/riscv/cpu.h         |  1 +
 target/riscv/tcg/tcg-cpu.c | 13 ++++---------
 3 files changed, 6 insertions(+), 10 deletions(-)
target/riscv/cpu.c +1 -1
index 2946ac298a..6dd3d7f4a3 100644
@@ -1786,7 +1786,7 @@ static int priv_spec_from_str(const char *priv_spec_str)
     return priv_version;
 }
 
-static const char *priv_spec_to_str(int priv_version)
+const char *priv_spec_to_str(int priv_version)
 {
     switch (priv_version) {
     case PRIV_VERSION_1_10_0:
target/riscv/cpu.h +1 -0
index 1501868008..140eb43fcb 100644
@@ -833,4 +833,5 @@ const char *satp_mode_str(uint8_t satp_mode, bool is_32_bit);
 /* Implemented in th_csr.c */
 void th_register_custom_csrs(RISCVCPU *cpu);
 
+const char *priv_spec_to_str(int priv_version);
 #endif /* RISCV_CPU_H */
target/riscv/tcg/tcg-cpu.c +4 -9
index f59b5d7f2d..fa186093fb 100644
@@ -76,16 +76,11 @@ static void riscv_cpu_write_misa_bit(RISCVCPU *cpu, uint32_t bit,
 
 static const char *cpu_priv_ver_to_str(int priv_ver)
 {
-    switch (priv_ver) {
-    case PRIV_VERSION_1_10_0:
-        return "v1.10.0";
-    case PRIV_VERSION_1_11_0:
-        return "v1.11.0";
-    case PRIV_VERSION_1_12_0:
-        return "v1.12.0";
-    }
+    const char *priv_spec_str = priv_spec_to_str(priv_ver);
 
-    g_assert_not_reached();
+    g_assert(priv_spec_str);
+
+    return priv_spec_str;
 }
 
 static void riscv_cpu_synchronize_from_tb(CPUState *cs,
Signature · 1 line
2.34.1
Reviewed-by on v2 1/5
#2 lore raw

Re: [RESEND PATCH v2 1/5] target/riscv: Reuse the conversion function of priv_spec

Quoted 10 lines · Fea.Wang

From: Jim Shu <[email protected]>

Public the conversion function of priv_spec in cpu.h, so that tcg-cpu.c could also use it.

Alistair

Quoted 58 lines
---
 target/riscv/cpu.c         |  2 +-
 target/riscv/cpu.h         |  1 +
 target/riscv/tcg/tcg-cpu.c | 13 ++++---------
 3 files changed, 6 insertions(+), 10 deletions(-)
target/riscv/cpu.c +1 -1
index 2946ac298a..6dd3d7f4a3 100644
@@ -1786,7 +1786,7 @@ static int priv_spec_from_str(const char *priv_spec_str)
     return priv_version;
 }
 
-static const char *priv_spec_to_str(int priv_version)
+const char *priv_spec_to_str(int priv_version)
 {
     switch (priv_version) {
     case PRIV_VERSION_1_10_0:
target/riscv/cpu.h +1 -0
index 1501868008..140eb43fcb 100644
@@ -833,4 +833,5 @@ const char *satp_mode_str(uint8_t satp_mode, bool is_32_bit);
 /* Implemented in th_csr.c */
 void th_register_custom_csrs(RISCVCPU *cpu);
 
+const char *priv_spec_to_str(int priv_version);
 #endif /* RISCV_CPU_H */
target/riscv/tcg/tcg-cpu.c +4 -10
index f59b5d7f2d..fa186093fb 100644
@@ -76,16 +76,11 @@ static void riscv_cpu_write_misa_bit(RISCVCPU *cpu, uint32_t bit,
 
 static const char *cpu_priv_ver_to_str(int priv_ver)
 {
-    switch (priv_ver) {
-    case PRIV_VERSION_1_10_0:
-        return "v1.10.0";
-    case PRIV_VERSION_1_11_0:
-        return "v1.11.0";
-    case PRIV_VERSION_1_12_0:
-        return "v1.12.0";
-    }
+    const char *priv_spec_str = priv_spec_to_str(priv_ver);
 
-    g_assert_not_reached();
+    g_assert(priv_spec_str);
+
+    return priv_spec_str;
 }
 
 static void riscv_cpu_synchronize_from_tb(CPUState *cs,
--

2.34.1

author
#3 lore raw

PATCH RESEND v2 2/5 target/riscv: Support the version for ss1p13

In reply to Fea.Wang

Add RISC-V privilege 1.13 support.

---
 target/riscv/cpu.c         | 6 +++++-
 target/riscv/cpu.h         | 4 +++-
 target/riscv/cpu_cfg.h     | 1 +
 target/riscv/tcg/tcg-cpu.c | 4 ++++
 4 files changed, 13 insertions(+), 2 deletions(-)
target/riscv/cpu.c +5 -1
index 6dd3d7f4a3..ee2ec4c4e5 100644
@@ -1775,7 +1775,9 @@ static int priv_spec_from_str(const char *priv_spec_str)
 {
     int priv_version = -1;
 
-    if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {
+    if (!g_strcmp0(priv_spec_str, PRIV_VER_1_13_0_STR)) {
+        priv_version = PRIV_VERSION_1_13_0;
+    } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {
         priv_version = PRIV_VERSION_1_12_0;
     } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_11_0_STR)) {
         priv_version = PRIV_VERSION_1_11_0;
@@ -1795,6 +1797,8 @@ const char *priv_spec_to_str(int priv_version)
         return PRIV_VER_1_11_0_STR;
     case PRIV_VERSION_1_12_0:
         return PRIV_VER_1_12_0_STR;
+    case PRIV_VERSION_1_13_0:
+        return PRIV_VER_1_13_0_STR;
     default:
         return NULL;
     }
target/riscv/cpu.h +3 -1
index 140eb43fcb..f691c7d828 100644
@@ -96,12 +96,14 @@ extern RISCVCPUProfile *riscv_profiles[];
 #define PRIV_VER_1_10_0_STR "v1.10.0"
 #define PRIV_VER_1_11_0_STR "v1.11.0"
 #define PRIV_VER_1_12_0_STR "v1.12.0"
+#define PRIV_VER_1_13_0_STR "v1.13.0"
 enum {
     PRIV_VERSION_1_10_0 = 0,
     PRIV_VERSION_1_11_0,
     PRIV_VERSION_1_12_0,
+    PRIV_VERSION_1_13_0,
 
-    PRIV_VERSION_LATEST = PRIV_VERSION_1_12_0,
+    PRIV_VERSION_LATEST = PRIV_VERSION_1_13_0,
 };
 
 #define VEXT_VERSION_1_00_0 0x00010000
target/riscv/cpu_cfg.h +1 -0
index e1e4f32698..fb7eebde52 100644
@@ -136,6 +136,7 @@ struct RISCVCPUConfig {
      * TCG always implement/can't be user disabled,
      * based on spec version.
      */
+    bool has_priv_1_13;
     bool has_priv_1_12;
     bool has_priv_1_11;
 
target/riscv/tcg/tcg-cpu.c +4 -0
index fa186093fb..f53422d605 100644
@@ -318,6 +318,10 @@ static void riscv_cpu_update_named_features(RISCVCPU *cpu)
         cpu->cfg.has_priv_1_12 = true;
     }
 
+    if (cpu->env.priv_ver >= PRIV_VERSION_1_13_0) {
+        cpu->cfg.has_priv_1_13 = true;
+    }
+
     /* zic64b is 1.12 or later */
     cpu->cfg.ext_zic64b = cpu->cfg.cbom_blocksize == 64 &&
                           cpu->cfg.cbop_blocksize == 64 &&
Signature · 1 line
2.34.1
Reviewed-by on v2 2/5
#4 lore raw

Re: [RESEND PATCH v2 2/5] target/riscv: Support the version for ss1p13

Quoted 7 lines · Fea.Wang

Add RISC-V privilege 1.13 support.

Alistair

Quoted 82 lines
---
 target/riscv/cpu.c         | 6 +++++-
 target/riscv/cpu.h         | 4 +++-
 target/riscv/cpu_cfg.h     | 1 +
 target/riscv/tcg/tcg-cpu.c | 4 ++++
 4 files changed, 13 insertions(+), 2 deletions(-)
target/riscv/cpu.c +5 -1
index 6dd3d7f4a3..ee2ec4c4e5 100644
@@ -1775,7 +1775,9 @@ static int priv_spec_from_str(const char *priv_spec_str)
 {
     int priv_version = -1;
 
-    if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {
+    if (!g_strcmp0(priv_spec_str, PRIV_VER_1_13_0_STR)) {
+        priv_version = PRIV_VERSION_1_13_0;
+    } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {
         priv_version = PRIV_VERSION_1_12_0;
     } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_11_0_STR)) {
         priv_version = PRIV_VERSION_1_11_0;
@@ -1795,6 +1797,8 @@ const char *priv_spec_to_str(int priv_version)
         return PRIV_VER_1_11_0_STR;
     case PRIV_VERSION_1_12_0:
         return PRIV_VER_1_12_0_STR;
+    case PRIV_VERSION_1_13_0:
+        return PRIV_VER_1_13_0_STR;
     default:
         return NULL;
     }
target/riscv/cpu.h +3 -1
index 140eb43fcb..f691c7d828 100644
@@ -96,12 +96,14 @@ extern RISCVCPUProfile *riscv_profiles[];
 #define PRIV_VER_1_10_0_STR "v1.10.0"
 #define PRIV_VER_1_11_0_STR "v1.11.0"
 #define PRIV_VER_1_12_0_STR "v1.12.0"
+#define PRIV_VER_1_13_0_STR "v1.13.0"
 enum {
     PRIV_VERSION_1_10_0 = 0,
     PRIV_VERSION_1_11_0,
     PRIV_VERSION_1_12_0,
+    PRIV_VERSION_1_13_0,
 
-    PRIV_VERSION_LATEST = PRIV_VERSION_1_12_0,
+    PRIV_VERSION_LATEST = PRIV_VERSION_1_13_0,
 };
 
 #define VEXT_VERSION_1_00_0 0x00010000
target/riscv/cpu_cfg.h +1 -0
index e1e4f32698..fb7eebde52 100644
@@ -136,6 +136,7 @@ struct RISCVCPUConfig {
      * TCG always implement/can't be user disabled,
      * based on spec version.
      */
+    bool has_priv_1_13;
     bool has_priv_1_12;
     bool has_priv_1_11;
 
target/riscv/tcg/tcg-cpu.c +4 -1
index fa186093fb..f53422d605 100644
@@ -318,6 +318,10 @@ static void riscv_cpu_update_named_features(RISCVCPU *cpu)
         cpu->cfg.has_priv_1_12 = true;
     }
 
+    if (cpu->env.priv_ver >= PRIV_VERSION_1_13_0) {
+        cpu->cfg.has_priv_1_13 = true;
+    }
+
     /* zic64b is 1.12 or later */
     cpu->cfg.ext_zic64b = cpu->cfg.cbom_blocksize == 64 &&
                           cpu->cfg.cbop_blocksize == 64 &&
--

2.34.1

#5 lore raw

Re: [RESEND PATCH v2 2/5] target/riscv: Support the version for ss1p13

Quoted 11 lines · Alistair Francis
Quoted 7 lines · Fea.Wang

Add RISC-V privilege 1.13 support.

Whoops, ignore this.

Quoted 18 lines

Alistair

Quoted 15 lines
---
 target/riscv/cpu.c         | 6 +++++-
 target/riscv/cpu.h         | 4 +++-
 target/riscv/cpu_cfg.h     | 1 +
 target/riscv/tcg/tcg-cpu.c | 4 ++++
 4 files changed, 13 insertions(+), 2 deletions(-)
target/riscv/cpu.c +0 -0
index 6dd3d7f4a3..ee2ec4c4e5 100644
@@ -1775,7 +1775,9 @@ static int priv_spec_from_str(const char *priv_spec_str)
 {
     int priv_version = -1;
 
Quoted 4 lines

target/riscv/cpu.c static int priv_spec_from_str(const char *priv_spec_str) · line 1780

Quoted 4 lines
target/riscv/cpu.c +3 -1
-    if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {
+    if (!g_strcmp0(priv_spec_str, PRIV_VER_1_13_0_STR)) {
+        priv_version = PRIV_VERSION_1_13_0;
+    } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {

This patch should be split in half. We only want to expose this to user after it has been implemented.

Alistair

Quoted 63 lines
Quoted 63 lines
target/riscv/cpu.c +2 -0
         priv_version = PRIV_VERSION_1_12_0;
     } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_11_0_STR)) {
         priv_version = PRIV_VERSION_1_11_0;
@@ -1795,6 +1797,8 @@ const char *priv_spec_to_str(int priv_version)
         return PRIV_VER_1_11_0_STR;
     case PRIV_VERSION_1_12_0:
         return PRIV_VER_1_12_0_STR;
+    case PRIV_VERSION_1_13_0:
+        return PRIV_VER_1_13_0_STR;
     default:
         return NULL;
     }
target/riscv/cpu.h +3 -1
index 140eb43fcb..f691c7d828 100644
@@ -96,12 +96,14 @@ extern RISCVCPUProfile *riscv_profiles[];
 #define PRIV_VER_1_10_0_STR "v1.10.0"
 #define PRIV_VER_1_11_0_STR "v1.11.0"
 #define PRIV_VER_1_12_0_STR "v1.12.0"
+#define PRIV_VER_1_13_0_STR "v1.13.0"
 enum {
     PRIV_VERSION_1_10_0 = 0,
     PRIV_VERSION_1_11_0,
     PRIV_VERSION_1_12_0,
+    PRIV_VERSION_1_13_0,
 
-    PRIV_VERSION_LATEST = PRIV_VERSION_1_12_0,
+    PRIV_VERSION_LATEST = PRIV_VERSION_1_13_0,
 };
 
 #define VEXT_VERSION_1_00_0 0x00010000
target/riscv/cpu_cfg.h +1 -0
index e1e4f32698..fb7eebde52 100644
@@ -136,6 +136,7 @@ struct RISCVCPUConfig {
      * TCG always implement/can't be user disabled,
      * based on spec version.
      */
+    bool has_priv_1_13;
     bool has_priv_1_12;
     bool has_priv_1_11;
 
target/riscv/tcg/tcg-cpu.c +4 -1
index fa186093fb..f53422d605 100644
@@ -318,6 +318,10 @@ static void riscv_cpu_update_named_features(RISCVCPU *cpu)
         cpu->cfg.has_priv_1_12 = true;
     }
 
+    if (cpu->env.priv_ver >= PRIV_VERSION_1_13_0) {
+        cpu->cfg.has_priv_1_13 = true;
+    }
+
     /* zic64b is 1.12 or later */
     cpu->cfg.ext_zic64b = cpu->cfg.cbom_blocksize == 64 &&
                           cpu->cfg.cbop_blocksize == 64 &&
--

2.34.1

author
#6 lore raw

Re: [RESEND PATCH v2 2/5] target/riscv: Support the version for ss1p13

Got it.
I will fix it in the next version of the patch series.

Sincerely,
Fea

Quoted 110 lines · Alistair Francis
Quoted 11 lines · Alistair Francis
Quoted 7 lines · Fea.Wang

Add RISC-V privilege 1.13 support.

Whoops, ignore this.

Quoted 10 lines

Alistair

Quoted 7 lines
---
 target/riscv/cpu.c         | 6 +++++-
 target/riscv/cpu.h         | 4 +++-
 target/riscv/cpu_cfg.h     | 1 +
 target/riscv/tcg/tcg-cpu.c | 4 ++++
 4 files changed, 13 insertions(+), 2 deletions(-)
Quoted 5 lines

target/riscv/cpu.c static int priv_spec_from_str(const char

Quoted 5 lines
target/riscv/cpu.c +0 -0
index 6dd3d7f4a3..ee2ec4c4e5 100644
@@ -1775,7 +1775,9 @@ static int priv_spec_from_str(const char

*priv_spec_str)

Quoted 7 lines

target/riscv/cpu.c static int priv_spec_from_str(const char *priv_spec_str) · line 1780

Quoted 7 lines
target/riscv/cpu.c +3 -1
 {
     int priv_version = -1;
 
-    if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {
+    if (!g_strcmp0(priv_spec_str, PRIV_VER_1_13_0_STR)) {
+        priv_version = PRIV_VERSION_1_13_0;
+    } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_12_0_STR)) {

This patch should be split in half. We only want to expose this to user after it has been implemented.

Alistair

Quoted 44 lines
Quoted 44 lines
target/riscv/cpu.c +2 -0
         priv_version = PRIV_VERSION_1_12_0;
     } else if (!g_strcmp0(priv_spec_str, PRIV_VER_1_11_0_STR)) {
         priv_version = PRIV_VERSION_1_11_0;
@@ -1795,6 +1797,8 @@ const char *priv_spec_to_str(int priv_version)
         return PRIV_VER_1_11_0_STR;
     case PRIV_VERSION_1_12_0:
         return PRIV_VER_1_12_0_STR;
+    case PRIV_VERSION_1_13_0:
+        return PRIV_VER_1_13_0_STR;
     default:
         return NULL;
     }
target/riscv/cpu.h +3 -1
index 140eb43fcb..f691c7d828 100644
@@ -96,12 +96,14 @@ extern RISCVCPUProfile *riscv_profiles[];
 #define PRIV_VER_1_10_0_STR "v1.10.0"
 #define PRIV_VER_1_11_0_STR "v1.11.0"
 #define PRIV_VER_1_12_0_STR "v1.12.0"
+#define PRIV_VER_1_13_0_STR "v1.13.0"
 enum {
     PRIV_VERSION_1_10_0 = 0,
     PRIV_VERSION_1_11_0,
     PRIV_VERSION_1_12_0,
+    PRIV_VERSION_1_13_0,
 
-    PRIV_VERSION_LATEST = PRIV_VERSION_1_12_0,
+    PRIV_VERSION_LATEST = PRIV_VERSION_1_13_0,
 };
 
 #define VEXT_VERSION_1_00_0 0x00010000
target/riscv/cpu_cfg.h +1 -0
index e1e4f32698..fb7eebde52 100644
@@ -136,6 +136,7 @@ struct RISCVCPUConfig {
      * TCG always implement/can't be user disabled,
      * based on spec version.
      */
+    bool has_priv_1_13;
     bool has_priv_1_12;
     bool has_priv_1_11;
 
Quoted 5 lines

target/riscv/tcg/tcg-cpu.c static void

Quoted 5 lines
target/riscv/tcg/tcg-cpu.c +0 -0
index fa186093fb..f53422d605 100644
@@ -318,6 +318,10 @@ static void

riscv_cpu_update_named_features(RISCVCPU *cpu)

Quoted 14 lines
Quoted 14 lines
target/riscv/tcg/tcg-cpu.c +4 -1
         cpu->cfg.has_priv_1_12 = true;
     }
 
+    if (cpu->env.priv_ver >= PRIV_VERSION_1_13_0) {
+        cpu->cfg.has_priv_1_13 = true;
+    }
+
     /* zic64b is 1.12 or later */
     cpu->cfg.ext_zic64b = cpu->cfg.cbom_blocksize == 64 &&
                           cpu->cfg.cbop_blocksize == 64 &&
--

2.34.1

author
#7 lore raw

PATCH RESEND v2 3/5 target/riscv: Add 'P1P13' bit in SMSTATEEN0

In reply to Fea.Wang

Based on privilege 1.13 spec, there should be a bit56 for 'P1P13' in SMSTATEEN0 that controls access to the hedeleg.

---
 target/riscv/cpu_bits.h | 1 +
 target/riscv/csr.c      | 8 ++++++++
 2 files changed, 9 insertions(+)
target/riscv/cpu_bits.h +1 -0
index 74318a925c..28bd3fb0b4 100644
@@ -315,6 +315,7 @@
 #define SMSTATEEN0_CS       (1ULL << 0)
 #define SMSTATEEN0_FCSR     (1ULL << 1)
 #define SMSTATEEN0_JVT      (1ULL << 2)
+#define SMSTATEEN0_P1P13    (1ULL << 56)
 #define SMSTATEEN0_HSCONTXT (1ULL << 57)
 #define SMSTATEEN0_IMSIC    (1ULL << 58)
 #define SMSTATEEN0_AIA      (1ULL << 59)
target/riscv/csr.c +8 -0
index 6b460ee0e8..bdbc8de0e2 100644
@@ -2248,6 +2248,10 @@ static RISCVException write_mstateen0(CPURISCVState *env, int csrno,
         wr_mask |= SMSTATEEN0_FCSR;
     }
 
+    if (env->priv_ver >= PRIV_VERSION_1_13_0) {
+        wr_mask |= SMSTATEEN0_P1P13;
+    }
+
     return write_mstateen(env, csrno, wr_mask, new_val);
 }
 
@@ -2283,6 +2287,10 @@ static RISCVException write_mstateen0h(CPURISCVState *env, int csrno,
 {
     uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
 
+    if (env->priv_ver >= PRIV_VERSION_1_13_0) {
+        wr_mask |= SMSTATEEN0_P1P13;
+    }
+
     return write_mstateenh(env, csrno, wr_mask, new_val);
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v2 3/5
#8 lore raw

Re: [RESEND PATCH v2 3/5] target/riscv: Add 'P1P13' bit in SMSTATEEN0

Quoted 39 lines · Fea.Wang

Based on privilege 1.13 spec, there should be a bit56 for 'P1P13' in SMSTATEEN0 that controls access to the hedeleg.

---
  target/riscv/cpu_bits.h | 1 +
  target/riscv/csr.c      | 8 ++++++++
  2 files changed, 9 insertions(+)
target/riscv/cpu_bits.h +1 -0
index 74318a925c..28bd3fb0b4 100644
@@ -315,6 +315,7 @@
  #define SMSTATEEN0_CS       (1ULL << 0)
  #define SMSTATEEN0_FCSR     (1ULL << 1)
  #define SMSTATEEN0_JVT      (1ULL << 2)
+#define SMSTATEEN0_P1P13    (1ULL << 56)
  #define SMSTATEEN0_HSCONTXT (1ULL << 57)
  #define SMSTATEEN0_IMSIC    (1ULL << 58)
  #define SMSTATEEN0_AIA      (1ULL << 59)
target/riscv/csr.c +4 -0
index 6b460ee0e8..bdbc8de0e2 100644
@@ -2248,6 +2248,10 @@ static RISCVException write_mstateen0(CPURISCVState *env, int csrno,
          wr_mask |= SMSTATEEN0_FCSR;
      }
 
+    if (env->priv_ver >= PRIV_VERSION_1_13_0) {
+        wr_mask |= SMSTATEEN0_P1P13;
+    }
+
      return write_mstateen(env, csrno, wr_mask, new_val);
  }
 

target/riscv/csr.c static RISCVException write_mstateen0h(CPURISCVState *env, int csrno, · line 2293

Quoted 7 lines
target/riscv/csr.c +4 -0
@@ -2283,6 +2287,10 @@ static RISCVException write_mstateen0h(CPURISCVState *env, int csrno,
  {
      uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
 
+    if (env->priv_ver >= PRIV_VERSION_1_13_0) {
+        wr_mask |= SMSTATEEN0_P1P13;
+    }
+

Zhiwei

Quoted 3 lines
target/riscv/csr.c +0 -0
      return write_mstateenh(env, csrno, wr_mask, new_val);
  }
 
#9 lore raw

Re: [RESEND PATCH v2 3/5] target/riscv: Add 'P1P13' bit in SMSTATEEN0

In reply to Fea.Wang
Quoted 3 lines · Fea.Wang

Based on privilege 1.13 spec, there should be a bit56 for 'P1P13' in SMSTATEEN0 that controls access to the hedeleg.

I don't see this in the spec. I only see P1P13 in mstateen0

Alistair

Quoted 51 lines
---
 target/riscv/cpu_bits.h | 1 +
 target/riscv/csr.c      | 8 ++++++++
 2 files changed, 9 insertions(+)
target/riscv/cpu_bits.h +1 -0
index 74318a925c..28bd3fb0b4 100644
@@ -315,6 +315,7 @@
 #define SMSTATEEN0_CS       (1ULL << 0)
 #define SMSTATEEN0_FCSR     (1ULL << 1)
 #define SMSTATEEN0_JVT      (1ULL << 2)
+#define SMSTATEEN0_P1P13    (1ULL << 56)
 #define SMSTATEEN0_HSCONTXT (1ULL << 57)
 #define SMSTATEEN0_IMSIC    (1ULL << 58)
 #define SMSTATEEN0_AIA      (1ULL << 59)
target/riscv/csr.c +8 -1
index 6b460ee0e8..bdbc8de0e2 100644
@@ -2248,6 +2248,10 @@ static RISCVException write_mstateen0(CPURISCVState *env, int csrno,
         wr_mask |= SMSTATEEN0_FCSR;
     }
 
+    if (env->priv_ver >= PRIV_VERSION_1_13_0) {
+        wr_mask |= SMSTATEEN0_P1P13;
+    }
+
     return write_mstateen(env, csrno, wr_mask, new_val);
 }
 
@@ -2283,6 +2287,10 @@ static RISCVException write_mstateen0h(CPURISCVState *env, int csrno,
 {
     uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
 
+    if (env->priv_ver >= PRIV_VERSION_1_13_0) {
+        wr_mask |= SMSTATEEN0_P1P13;
+    }
+
     return write_mstateenh(env, csrno, wr_mask, new_val);
 }
 
--

2.34.1

author
#10 lore raw

Re: [RESEND PATCH v2 3/5] target/riscv: Add 'P1P13' bit in SMSTATEEN0

Thank you for correcting me.
I will fix it in the next version of the patch series.

Sincerely,
Fea

Quoted 63 lines · Alistair Francis
Quoted 3 lines · Fea.Wang

Based on privilege 1.13 spec, there should be a bit56 for 'P1P13' in SMSTATEEN0 that controls access to the hedeleg.

I don't see this in the spec. I only see P1P13 in mstateen0

Alistair

target/riscv/csr.c static RISCVException

Quoted 26 lines
---
 target/riscv/cpu_bits.h | 1 +
 target/riscv/csr.c      | 8 ++++++++
 2 files changed, 9 insertions(+)
target/riscv/cpu_bits.h +1 -0
index 74318a925c..28bd3fb0b4 100644
@@ -315,6 +315,7 @@
 #define SMSTATEEN0_CS       (1ULL << 0)
 #define SMSTATEEN0_FCSR     (1ULL << 1)
 #define SMSTATEEN0_JVT      (1ULL << 2)
+#define SMSTATEEN0_P1P13    (1ULL << 56)
 #define SMSTATEEN0_HSCONTXT (1ULL << 57)
 #define SMSTATEEN0_IMSIC    (1ULL << 58)
 #define SMSTATEEN0_AIA      (1ULL << 59)
target/riscv/csr.c +0 -0
index 6b460ee0e8..bdbc8de0e2 100644
@@ -2248,6 +2248,10 @@ static RISCVException

write_mstateen0(CPURISCVState *env, int csrno,

target/riscv/csr.c static RISCVException

Quoted 11 lines
target/riscv/csr.c +4 -0
         wr_mask |= SMSTATEEN0_FCSR;
     }
 
+    if (env->priv_ver >= PRIV_VERSION_1_13_0) {
+        wr_mask |= SMSTATEEN0_P1P13;
+    }
+
     return write_mstateen(env, csrno, wr_mask, new_val);
 }
 
@@ -2283,6 +2287,10 @@ static RISCVException

write_mstateen0h(CPURISCVState *env, int csrno,

Quoted 14 lines
target/riscv/csr.c +4 -1
 {
     uint64_t wr_mask = SMSTATEEN_STATEEN | SMSTATEEN0_HSENVCFG;
 
+    if (env->priv_ver >= PRIV_VERSION_1_13_0) {
+        wr_mask |= SMSTATEEN0_P1P13;
+    }
+
     return write_mstateenh(env, csrno, wr_mask, new_val);
 }
 
--

2.34.1

author
#11 lore raw

PATCH RESEND v2 4/5 target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32

In reply to Fea.Wang

Based on privileged spec 1.13, the RV32 needs to implement MEDELEGH and HEDELEGH for exception codes 32-47 for reserving and exception codes 48-63 for custom use. Add the CSR number though the implementation is just reading zero and writing ignore. Besides, for accessing HEDELEGH, it should be controlled by mstateen0 'P1P13' bit.

---
 target/riscv/cpu_bits.h |  2 ++
 target/riscv/csr.c      | 31 +++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
target/riscv/cpu_bits.h +2 -0
index 28bd3fb0b4..f888025c59 100644
@@ -156,6 +156,8 @@
 
 /* 32-bit only */
 #define CSR_MSTATUSH        0x310
+#define CSR_MEDELEGH        0x312
+#define CSR_HEDELEGH        0x612
 
 /* Machine Trap Handling */
 #define CSR_MSCRATCH        0x340
target/riscv/csr.c +31 -0
index bdbc8de0e2..c5ff40eed8 100644
@@ -3225,6 +3225,33 @@ static RISCVException write_hedeleg(CPURISCVState *env, int csrno,
     return RISCV_EXCP_NONE;
 }
 
+static RISCVException read_hedelegh(CPURISCVState *env, int csrno,
+                                   target_ulong *val)
+{
+    RISCVException ret;
+    ret = smstateen_acc_ok(env, 0, SMSTATEEN0_P1P13);
+    if (ret != RISCV_EXCP_NONE) {
+        return ret;
+    }
+
+    /* Reserved, now read zero */
+    *val = 0;
+    return RISCV_EXCP_NONE;
+}
+
+static RISCVException write_hedelegh(CPURISCVState *env, int csrno,
+                                    target_ulong val)
+{
+    RISCVException ret;
+    ret = smstateen_acc_ok(env, 0, SMSTATEEN0_P1P13);
+    if (ret != RISCV_EXCP_NONE) {
+        return ret;
+    }
+
+    /* Reserved, now write ignore */
+    return RISCV_EXCP_NONE;
+}
+
 static RISCVException rmw_hvien64(CPURISCVState *env, int csrno,
                                     uint64_t *ret_val,
                                     uint64_t new_val, uint64_t wr_mask)
@@ -4672,6 +4699,10 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = {
 
     [CSR_MSTATUSH]    = { "mstatush",   any32, read_mstatush,
                           write_mstatush                                   },
+    [CSR_MEDELEGH]    = { "medelegh",   any32, read_zero, write_ignore,
+                          .min_priv_ver = PRIV_VERSION_1_13_0              },
+    [CSR_HEDELEGH]    = { "hedelegh",   hmode32, read_hedelegh, write_hedelegh,
+                          .min_priv_ver = PRIV_VERSION_1_13_0              },
 
     /* Machine Trap Handling */
     [CSR_MSCRATCH] = { "mscratch", any,  read_mscratch, write_mscratch,
Signature · 1 line
2.34.1
Reviewed-by on v2 4/5
#12 lore raw

Re: [RESEND PATCH v2 4/5] target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32

Quoted 10 lines · Fea.Wang

Based on privileged spec 1.13, the RV32 needs to implement MEDELEGH and HEDELEGH for exception codes 32-47 for reserving and exception codes 48-63 for custom use. Add the CSR number though the implementation is just reading zero and writing ignore. Besides, for accessing HEDELEGH, it should be controlled by mstateen0 'P1P13' bit.

Alistair

Quoted 71 lines
---
 target/riscv/cpu_bits.h |  2 ++
 target/riscv/csr.c      | 31 +++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
target/riscv/cpu_bits.h +2 -0
index 28bd3fb0b4..f888025c59 100644
@@ -156,6 +156,8 @@
 
 /* 32-bit only */
 #define CSR_MSTATUSH        0x310
+#define CSR_MEDELEGH        0x312
+#define CSR_HEDELEGH        0x612
 
 /* Machine Trap Handling */
 #define CSR_MSCRATCH        0x340
target/riscv/csr.c +31 -1
index bdbc8de0e2..c5ff40eed8 100644
@@ -3225,6 +3225,33 @@ static RISCVException write_hedeleg(CPURISCVState *env, int csrno,
     return RISCV_EXCP_NONE;
 }
 
+static RISCVException read_hedelegh(CPURISCVState *env, int csrno,
+                                   target_ulong *val)
+{
+    RISCVException ret;
+    ret = smstateen_acc_ok(env, 0, SMSTATEEN0_P1P13);
+    if (ret != RISCV_EXCP_NONE) {
+        return ret;
+    }
+
+    /* Reserved, now read zero */
+    *val = 0;
+    return RISCV_EXCP_NONE;
+}
+
+static RISCVException write_hedelegh(CPURISCVState *env, int csrno,
+                                    target_ulong val)
+{
+    RISCVException ret;
+    ret = smstateen_acc_ok(env, 0, SMSTATEEN0_P1P13);
+    if (ret != RISCV_EXCP_NONE) {
+        return ret;
+    }
+
+    /* Reserved, now write ignore */
+    return RISCV_EXCP_NONE;
+}
+
 static RISCVException rmw_hvien64(CPURISCVState *env, int csrno,
                                     uint64_t *ret_val,
                                     uint64_t new_val, uint64_t wr_mask)
@@ -4672,6 +4699,10 @@ riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = {
 
     [CSR_MSTATUSH]    = { "mstatush",   any32, read_mstatush,
                           write_mstatush                                   },
+    [CSR_MEDELEGH]    = { "medelegh",   any32, read_zero, write_ignore,
+                          .min_priv_ver = PRIV_VERSION_1_13_0              },
+    [CSR_HEDELEGH]    = { "hedelegh",   hmode32, read_hedelegh, write_hedelegh,
+                          .min_priv_ver = PRIV_VERSION_1_13_0              },
 
     /* Machine Trap Handling */
     [CSR_MSCRATCH] = { "mscratch", any,  read_mscratch, write_mscratch,
--

2.34.1

author
#13 lore raw

PATCH RESEND v2 5/5 target/riscv: Reserve exception codes for sw-check and hw-err

In reply to Fea.Wang

Based on the priv-1.13.0, add the exception codes for Software-check and Hardware-error.

---
 target/riscv/cpu_bits.h | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/cpu_bits.h +2 -0
index f888025c59..f037f727d9 100644
@@ -673,6 +673,8 @@ typedef enum RISCVException {
     RISCV_EXCP_INST_PAGE_FAULT = 0xc, /* since: priv-1.10.0 */
     RISCV_EXCP_LOAD_PAGE_FAULT = 0xd, /* since: priv-1.10.0 */
     RISCV_EXCP_STORE_PAGE_FAULT = 0xf, /* since: priv-1.10.0 */
+    RISCV_EXCP_SW_CHECK = 0x12, /* since: priv-1.13.0 */
+    RISCV_EXCP_HW_ERR = 0x13, /* since: priv-1.13.0 */
     RISCV_EXCP_INST_GUEST_PAGE_FAULT = 0x14,
     RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT = 0x15,
     RISCV_EXCP_VIRT_INSTRUCTION_FAULT = 0x16,
Signature · 1 line
2.34.1
Reviewed-by on v2 5/5
#14 lore raw

Re: [RESEND PATCH v2 5/5] target/riscv: Reserve exception codes for sw-check and hw-err

Quoted 7 lines · Fea.Wang

Based on the priv-1.13.0, add the exception codes for Software-check and Hardware-error.

Alistair

Quoted 21 lines
---
 target/riscv/cpu_bits.h | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/cpu_bits.h +2 -1
index f888025c59..f037f727d9 100644
@@ -673,6 +673,8 @@ typedef enum RISCVException {
     RISCV_EXCP_INST_PAGE_FAULT = 0xc, /* since: priv-1.10.0 */
     RISCV_EXCP_LOAD_PAGE_FAULT = 0xd, /* since: priv-1.10.0 */
     RISCV_EXCP_STORE_PAGE_FAULT = 0xf, /* since: priv-1.10.0 */
+    RISCV_EXCP_SW_CHECK = 0x12, /* since: priv-1.13.0 */
+    RISCV_EXCP_HW_ERR = 0x13, /* since: priv-1.13.0 */
     RISCV_EXCP_INST_GUEST_PAGE_FAULT = 0x14,
     RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT = 0x15,
     RISCV_EXCP_VIRT_INSTRUCTION_FAULT = 0x16,
--

2.34.1

#15 lore raw
In reply to Fea.Wang

Fea,

Please try to also add all RISC-V QEMU maintainers and reviewers when sending patches. It will get your patches reviewed and queued faster. Otherwise the maintainers can miss you your series due to high ML traffic.

You can fetch who you want to CC using the get_maintainer.pl script with the patch files or any source file in particular, e.g.:

$ ./scripts/get_maintainer.pl -f target/riscv/cpu.c
Palmer Dabbelt <[email protected]> (supporter:RISC-V TCG CPUs)
Alistair Francis <[email protected]> (supporter:RISC-V TCG CPUs)
Bin Meng <[email protected]> (supporter:RISC-V TCG CPUs)
Weiwei Li <[email protected]> (reviewer:RISC-V TCG CPUs)
Daniel Henrique Barboza <[email protected]> (reviewer:RISC-V TCG CPUs)
Liu Zhiwei <[email protected]> (reviewer:RISC-V TCG CPUs)
[email protected] (open list:RISC-V TCG CPUs)
[email protected] (open list:All patches CC here)

I added the extra folk in the CC for this reply so don't worry about it.

Alistair, please queue this series. It's already fully acked and I would like to add some bits on top of the priv_spec 1.13 support.

Thanks,

Daniel

Quoted 34 lines · Fea.Wang

Based on the change log for the RISC-V privilege 1.13 spec, add the support for ss1p13.

Ref:https://github.com/riscv/riscv-isa-manual/blob/a7d93c9/src/priv-preface.adoc?plain=1#L40-L72

Lists what to do without clarification or document format.
* Redefined misa.MXL to be read-only, making MXLEN a constant.(Skip, implementation ignored)
* Added the constraint that SXLEN≥UXLEN.(Skip, implementation ignored)
* Defined the misa.V field to reflect that the V extension has been implemented.(Skip, existed)
* Defined the RV32-only medelegh and hedelegh CSRs.(Done in these patches)
* Defined the misaligned atomicity granule PMA, superseding the proposed Zam extension..(Skip, implementation ignored)
* Allocated interrupt 13 for Sscofpmf LCOFI interrupt.(Skip, existed)
* Defined hardware error and software check exception codes.(Done in these patches)
* Specified synchronization requirements when changing the PBMTE fields in menvcfg and henvcfg.(Skip, implementation ignored)
* Incorporated Svade and Svadu extension specifications.(Skip, existed)

Fea.Wang (4):
target/riscv: Support the version for ss1p13 target/riscv: Add 'P1P13' bit in SMSTATEEN0 target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32 target/riscv: Reserve exception codes for sw-check and hw-err

Jim Shu (1):
target/riscv: Reuse the conversion function of priv_spec

  target/riscv/cpu.c         |  8 ++++++--
  target/riscv/cpu.h         |  5 ++++-
  target/riscv/cpu_bits.h    |  5 +++++
  target/riscv/cpu_cfg.h     |  1 +
  target/riscv/csr.c         | 39 ++++++++++++++++++++++++++++++++++++++
  target/riscv/tcg/tcg-cpu.c | 17 ++++++++---------
  6 files changed, 63 insertions(+), 12 deletions(-)
author
#16 lore raw

Hi Daniel,
thank you for your help.

I found that only the cover is without many maintainers. I used to send patches by git send-email --dry-run --to '[email protected], [email protected]' --cc-cmd='scripts/get_maintainer.pl -i' patches/*. Do you have a better script for me?
Thank you.

Sincerely,
Fea

Quoted 79 lines · Daniel Henrique Barboza

Fea,

Please try to also add all RISC-V QEMU maintainers and reviewers when sending
patches. It will get your patches reviewed and queued faster. Otherwise the maintainers can miss you your series due to high ML traffic.

You can fetch who you want to CC using the get_maintainer.pl script with the
patch files or any source file in particular, e.g.:

$ ./scripts/get_maintainer.pl -f target/riscv/cpu.c
Palmer Dabbelt <[email protected]> (supporter:RISC-V TCG CPUs)
Alistair Francis <[email protected]> (supporter:RISC-V TCG CPUs)
Bin Meng <[email protected]> (supporter:RISC-V TCG CPUs)
Weiwei Li <[email protected]> (reviewer:RISC-V TCG CPUs)
Daniel Henrique Barboza <[email protected]> (reviewer:RISC-V TCG
CPUs)
Liu Zhiwei <[email protected]> (reviewer:RISC-V TCG CPUs)
[email protected] (open list:RISC-V TCG CPUs)
[email protected] (open list:All patches CC here)

I added the extra folk in the CC for this reply so don't worry about it.

Alistair, please queue this series. It's already fully acked and I would like to add
some bits on top of the priv_spec 1.13 support.

Thanks,

Daniel

Quoted 4 lines · Fea.Wang

Based on the change log for the RISC-V privilege 1.13 spec, add the support for ss1p13.

Ref:

https://github.com/riscv/riscv-isa-manual/blob/a7d93c9/src/priv-preface.adoc?plain=1#L40-L72

Quoted 3 lines

Lists what to do without clarification or document format.
* Redefined misa.MXL to be read-only, making MXLEN a constant.(Skip,

implementation ignored)

Quoted 2 lines

* Added the constraint that SXLEN≥UXLEN.(Skip, implementation ignored)
* Defined the misa.V field to reflect that the V extension has been

implemented.(Skip, existed)

Quoted 1 line

* Defined the RV32-only medelegh and hedelegh CSRs.(Done in these

patches)

Quoted 1 line

* Defined the misaligned atomicity granule PMA, superseding the proposed

Zam extension..(Skip, implementation ignored)

Quoted 2 lines

* Allocated interrupt 13 for Sscofpmf LCOFI interrupt.(Skip, existed)
* Defined hardware error and software check exception codes.(Done in

these patches)

Quoted 1 line

* Specified synchronization requirements when changing the PBMTE fields

in menvcfg and henvcfg.(Skip, implementation ignored)

Quoted 20 lines

* Incorporated Svade and Svadu extension specifications.(Skip, existed)

Fea.Wang (4):
target/riscv: Support the version for ss1p13 target/riscv: Add 'P1P13' bit in SMSTATEEN0 target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32 target/riscv: Reserve exception codes for sw-check and hw-err

Jim Shu (1):
target/riscv: Reuse the conversion function of priv_spec

  target/riscv/cpu.c         |  8 ++++++--
  target/riscv/cpu.h         |  5 ++++-
  target/riscv/cpu_bits.h    |  5 +++++
  target/riscv/cpu_cfg.h     |  1 +
  target/riscv/csr.c         | 39 ++++++++++++++++++++++++++++++++++++++
  target/riscv/tcg/tcg-cpu.c | 17 ++++++++---------
  6 files changed, 63 insertions(+), 12 deletions(-)
#17 lore raw

Hi Fea,

Quoted 4 lines · Fea Wang

Hi Daniel,
thank you for your help.

I found that only the cover is without many maintainers. I used to send patches by git send-email --dry-run --to '[email protected] <mailto:[email protected]>,[email protected] <mailto:[email protected]>' --cc-cmd='scripts/get_maintainer.pl <http://get_maintainer.pl> -i' patches/*. Do you have a better script for me?

Hmmm no I don't actually :) my script is worse than yours. I just use a git alias that hardcode everyone in the CC:

	askreview-riscv = send-email --suppress-cc=sob --to [email protected] \
		--cc [email protected] \
		--cc (everyone from the output of get_maintainers.pl for RISC-V files)

And then "git askreview-riscv (patches)"

From reading git docs it seems like one detail with your script is that the CC is calculated patch by patch via the "--cc-cmd" output, but the cover letter is considered an empty commit, so the script returns nothing. This is why every other patch has a CC but the cover doesn't.

This is more a get_maintainer.pl detail than anything, so don't worry about it. Having the patches properly CCed is enough. We'll go after the cover-letter manually if needed.

Thanks,

Daniel

Quoted 75 lines

Thank you.

Sincerely,
Fea

On Mon, May 27, 2024 at 5:21 PM Daniel Henrique Barboza <[email protected] <mailto:[email protected]>> wrote:

Fea,

Please try to also add all RISC-V QEMU maintainers and reviewers when sending patches. It will get your patches reviewed and queued faster. Otherwise the maintainers can miss you your series due to high ML traffic.

You can fetch who you want to CC using the get_maintainer.pl <http://get_maintainer.pl> script with the patch files or any source file in particular, e.g.:

$ ./scripts/get_maintainer.pl <http://get_maintainer.pl> -f target/riscv/cpu.c
Palmer Dabbelt <[email protected] <mailto:[email protected]>> (supporter:RISC-V TCG CPUs) Alistair Francis <[email protected] <mailto:[email protected]>> (supporter:RISC-V TCG CPUs) Bin Meng <[email protected] <mailto:[email protected]>> (supporter:RISC-V TCG CPUs)
Weiwei Li <[email protected] <mailto:[email protected]>> (reviewer:RISC-V TCG CPUs)
Daniel Henrique Barboza <[email protected] <mailto:[email protected]>> (reviewer:RISC-V TCG CPUs) Liu Zhiwei <[email protected] <mailto:[email protected]>> (reviewer:RISC-V TCG CPUs) [email protected] <mailto:[email protected]> (open list:RISC-V TCG CPUs) [email protected] <mailto:[email protected]> (open list:All patches CC here)

I added the extra folk in the CC for this reply so don't worry about it.

Alistair, please queue this series. It's already fully acked and I would like to add some bits on top of the priv_spec 1.13 support.

Thanks,

Daniel

On 5/15/24 05:05, Fea.Wang wrote:
> Based on the change log for the RISC-V privilege 1.13 spec, add the
> support for ss1p13.
>
> Ref:https://github.com/riscv/riscv-isa-manual/blob/a7d93c9/src/priv-preface.adoc?plain=1#L40-L72 <https://github.com/riscv/riscv-isa-manual/blob/a7d93c9/src/priv-preface.adoc?plain=1#L40-L72>
>
> Lists what to do without clarification or document format.
> * Redefined misa.MXL to be read-only, making MXLEN a constant.(Skip, implementation ignored)
> * Added the constraint that SXLEN≥UXLEN.(Skip, implementation ignored)
> * Defined the misa.V field to reflect that the V extension has been implemented.(Skip, existed)
> * Defined the RV32-only medelegh and hedelegh CSRs.(Done in these patches)
> * Defined the misaligned atomicity granule PMA, superseding the proposed Zam extension..(Skip, implementation ignored)
> * Allocated interrupt 13 for Sscofpmf LCOFI interrupt.(Skip, existed)
> * Defined hardware error and software check exception codes.(Done in these patches)
> * Specified synchronization requirements when changing the PBMTE fields in menvcfg and henvcfg.(Skip, implementation ignored)
> * Incorporated Svade and Svadu extension specifications.(Skip, existed)
>
>
> Fea.Wang (4):
>    target/riscv: Support the version for ss1p13
>    target/riscv: Add 'P1P13' bit in SMSTATEEN0
>    target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32
>    target/riscv: Reserve exception codes for sw-check and hw-err
>
> Jim Shu (1):
>    target/riscv: Reuse the conversion function of priv_spec
>
>   target/riscv/cpu.c         |  8 ++++++--
>   target/riscv/cpu.h         |  5 ++++-
>   target/riscv/cpu_bits.h    |  5 +++++
>   target/riscv/cpu_cfg.h     |  1 +
>   target/riscv/csr.c         | 39 ++++++++++++++++++++++++++++++++++++++
>   target/riscv/tcg/tcg-cpu.c | 17 ++++++++---------
>   6 files changed, 63 insertions(+), 12 deletions(-)
>

#18 lore raw
In reply to Fea Wang
Quoted 8 lines · Fea Wang

Hi Daniel,
thank you for your help.

I found that only the cover is without many maintainers. I used to send patches by git send-email --dry-run --to '[email protected], [email protected]' --cc-cmd='scripts/get_maintainer.pl -i' patches/*. Do you have a better script for me?
Thank you.

Some maintainers frown on that because they prefer the whole series, even if only a few patches touch code they maintain. And, the cover letter is quite important to get the context. Also, depending on mail client and filter configurations, CC's that are per patch can mess up the threading, making a mess of the mailbox. I tend to use scripts/get_maintainer.pl to pull together a set of people/lists to CC as an independent step, dump the contents into a file and then do 'git send-email $(cat my-series.to-list) patches/my-series'

git-publish can help with that too by capturing the "to list" and maintaining it for you.

Thanks,
drew

Quoted 86 lines

Sincerely,
Fea

Quoted 79 lines · Daniel Henrique Barboza

Fea,

Please try to also add all RISC-V QEMU maintainers and reviewers when sending
patches. It will get your patches reviewed and queued faster. Otherwise the maintainers can miss you your series due to high ML traffic.

You can fetch who you want to CC using the get_maintainer.pl script with the
patch files or any source file in particular, e.g.:

$ ./scripts/get_maintainer.pl -f target/riscv/cpu.c
Palmer Dabbelt <[email protected]> (supporter:RISC-V TCG CPUs)
Alistair Francis <[email protected]> (supporter:RISC-V TCG CPUs)
Bin Meng <[email protected]> (supporter:RISC-V TCG CPUs)
Weiwei Li <[email protected]> (reviewer:RISC-V TCG CPUs)
Daniel Henrique Barboza <[email protected]> (reviewer:RISC-V TCG
CPUs)
Liu Zhiwei <[email protected]> (reviewer:RISC-V TCG CPUs)
[email protected] (open list:RISC-V TCG CPUs)
[email protected] (open list:All patches CC here)

I added the extra folk in the CC for this reply so don't worry about it.

Alistair, please queue this series. It's already fully acked and I would like to add
some bits on top of the priv_spec 1.13 support.

Thanks,

Daniel

Quoted 4 lines · Fea.Wang

Based on the change log for the RISC-V privilege 1.13 spec, add the support for ss1p13.

Ref:

https://github.com/riscv/riscv-isa-manual/blob/a7d93c9/src/priv-preface.adoc?plain=1#L40-L72

Quoted 3 lines

Lists what to do without clarification or document format.
* Redefined misa.MXL to be read-only, making MXLEN a constant.(Skip,

implementation ignored)

Quoted 2 lines

* Added the constraint that SXLEN≥UXLEN.(Skip, implementation ignored)
* Defined the misa.V field to reflect that the V extension has been

implemented.(Skip, existed)

Quoted 1 line

* Defined the RV32-only medelegh and hedelegh CSRs.(Done in these

patches)

Quoted 1 line

* Defined the misaligned atomicity granule PMA, superseding the proposed

Zam extension..(Skip, implementation ignored)

Quoted 2 lines

* Allocated interrupt 13 for Sscofpmf LCOFI interrupt.(Skip, existed)
* Defined hardware error and software check exception codes.(Done in

these patches)

Quoted 1 line

* Specified synchronization requirements when changing the PBMTE fields

in menvcfg and henvcfg.(Skip, implementation ignored)

Quoted 20 lines

* Incorporated Svade and Svadu extension specifications.(Skip, existed)

Fea.Wang (4):
target/riscv: Support the version for ss1p13 target/riscv: Add 'P1P13' bit in SMSTATEEN0 target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32 target/riscv: Reserve exception codes for sw-check and hw-err

Jim Shu (1):
target/riscv: Reuse the conversion function of priv_spec

  target/riscv/cpu.c         |  8 ++++++--
  target/riscv/cpu.h         |  5 ++++-
  target/riscv/cpu_bits.h    |  5 +++++
  target/riscv/cpu_cfg.h     |  1 +
  target/riscv/csr.c         | 39 ++++++++++++++++++++++++++++++++++++++
  target/riscv/tcg/tcg-cpu.c | 17 ++++++++---------
  6 files changed, 63 insertions(+), 12 deletions(-)
author
#19 lore raw

Hi Daniel, Andrew:

Thank you for giving me the feedback.
I found a new command set to cc the related maintainer's email. It also includes these emails for the cover letter.
git send-email --dry-run --to='[email protected],[email protected]' --cc="$(scripts/get_maintainer.pl XXXPATCH/* |sed -e 's/$/,/')" /XXXPATCH/*

Sincerely,
Fea

Quoted 125 lines · Andrew Jones
Quoted 6 lines · Fea Wang

Hi Daniel,
thank you for your help.

I found that only the cover is without many maintainers. I used to send patches by git send-email --dry-run --to '[email protected], [email protected]' --cc-cmd='scripts/get_maintainer.pl -i'

patches/*.

Quoted 2 lines

Do you have a better script for me?
Thank you.

Some maintainers frown on that because they prefer the whole series, even if only a few patches touch code they maintain. And, the cover letter is quite important to get the context. Also, depending on mail client and filter configurations, CC's that are per patch can mess up the threading, making a mess of the mailbox. I tend to use scripts/get_maintainer.pl to pull together a set of people/lists to CC as an independent step, dump the contents into a file and then do 'git send-email $(cat my-series.to-list) patches/my-series'

git-publish can help with that too by capturing the "to list" and maintaining it for you.

Thanks,
drew

Quoted 12 lines

Sincerely,
Fea

Quoted 5 lines · Daniel Henrique Barboza

Fea,

Please try to also add all RISC-V QEMU maintainers and reviewers when sending
patches. It will get your patches reviewed and queued faster.

Otherwise the

Quoted 3 lines
Quoted 3 lines

maintainers can miss you your series due to high ML traffic.

You can fetch who you want to CC using the get_maintainer.pl script

with

Quoted 6 lines
Quoted 6 lines

the
patch files or any source file in particular, e.g.:

$ ./scripts/get_maintainer.pl -f target/riscv/cpu.c
Palmer Dabbelt <[email protected]> (supporter:RISC-V TCG CPUs)
Alistair Francis <[email protected]> (supporter:RISC-V TCG

CPUs)

Quoted 3 lines
Quoted 3 lines

Bin Meng <[email protected]> (supporter:RISC-V TCG CPUs) Weiwei Li <[email protected]> (reviewer:RISC-V TCG CPUs) Daniel Henrique Barboza <[email protected]> (reviewer:RISC-V

TCG

Quoted 7 lines
Quoted 7 lines

CPUs)
Liu Zhiwei <[email protected]> (reviewer:RISC-V TCG CPUs) [email protected] (open list:RISC-V TCG CPUs) [email protected] (open list:All patches CC here)

I added the extra folk in the CC for this reply so don't worry about

it.

Quoted 3 lines
Quoted 3 lines

Alistair, please queue this series. It's already fully acked and I

would

Quoted 7 lines
Quoted 7 lines

like to add
some bits on top of the priv_spec 1.13 support.

Thanks,

Quoted 8 lines
Quoted 8 lines

Daniel

Quoted 4 lines · Fea.Wang

Based on the change log for the RISC-V privilege 1.13 spec, add the support for ss1p13.

Ref:

https://github.com/riscv/riscv-isa-manual/blob/a7d93c9/src/priv-preface.adoc?plain=1#L40-L72

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

Lists what to do without clarification or document format.
* Redefined misa.MXL to be read-only, making MXLEN a constant.(Skip,

implementation ignored)

Quoted 1 line

* Added the constraint that SXLEN≥UXLEN.(Skip, implementation

ignored)

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

* Defined the misa.V field to reflect that the V extension has been

implemented.(Skip, existed)

Quoted 1 line

* Defined the RV32-only medelegh and hedelegh CSRs.(Done in these

patches)

Quoted 1 line

* Defined the misaligned atomicity granule PMA, superseding the

proposed

Quoted 5 lines
Quoted 5 lines

Zam extension..(Skip, implementation ignored)

Quoted 2 lines

* Allocated interrupt 13 for Sscofpmf LCOFI interrupt.(Skip, existed)
* Defined hardware error and software check exception codes.(Done in

these patches)

Quoted 1 line

* Specified synchronization requirements when changing the PBMTE

fields

Quoted 2 lines
Quoted 2 lines

in menvcfg and henvcfg.(Skip, implementation ignored)

Quoted 1 line

* Incorporated Svade and Svadu extension specifications.(Skip,

existed)

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Fea.Wang (4):
target/riscv: Support the version for ss1p13 target/riscv: Add 'P1P13' bit in SMSTATEEN0 target/riscv: Add MEDELEGH, HEDELEGH csrs for RV32 target/riscv: Reserve exception codes for sw-check and hw-err

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Jim Shu (1):
target/riscv: Reuse the conversion function of priv_spec

  target/riscv/cpu.c         |  8 ++++++--
  target/riscv/cpu.h         |  5 ++++-
  target/riscv/cpu_bits.h    |  5 +++++
  target/riscv/cpu_cfg.h     |  1 +
  target/riscv/csr.c         | 39

++++++++++++++++++++++++++++++++++++++

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
  target/riscv/tcg/tcg-cpu.c | 17 ++++++++---------
  6 files changed, 63 insertions(+), 12 deletions(-)