Skip to contentSkip to conversation

RISC-V: Add preliminary textra trigger CSR functions

PATCH Applied Alvin Chang via 3 participants 10 messages Jul 21, 2024 – Sep 4, 2024 RISC-V

v3 of 4 Applied Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover RISC-V: Add preliminary textra trigger CSR functions

According to RISC-V Debug specification, the optional textra32 and textra64 trigger CSRs can be used to configure additional matching conditions for the triggers.

This series support to write MHVALUE and MHSELECT fields into textra32 and textra64 trigger CSRs. Besides, the additional matching condition between textra.MHVALUE and mcontext CSR is also implemented.

Changes from v2:
- Remove redundant log

Changes from v1:
- Log that mhselect only supports 0 or 4 for now
- Simplify writing of tdata3

Alvin Chang (2):
target/riscv: Preliminary textra trigger CSR writting support target/riscv: Add textra matching condition for the triggers

 target/riscv/cpu_bits.h |  10 +++
 target/riscv/debug.c    | 132 +++++++++++++++++++++++++++++++++++++---
 target/riscv/debug.h    |   3 +
 3 files changed, 138 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/2 target/riscv: Preliminary textra trigger CSR writting support

This commit allows program to write textra trigger CSR for type 2, 3, 6 triggers. In this preliminary patch, the textra.MHVALUE and the textra.MHSELECT fields are allowed to be configured. Other fields, such as textra.SBYTEMASK, textra.SVALUE, and textra.SSELECT, are hardwired to zero for now.

For textra.MHSELECT field, the only legal values are 0 (ignore) and 4 (mcontext). Writing 1~3 into textra.MHSELECT will be changed to 0, and writing 5~7 into textra.MHSELECT will be changed to 4. This behavior is aligned to RISC-V SPIKE simulator.

---
 target/riscv/cpu_bits.h | 10 ++++++
 target/riscv/debug.c    | 69 +++++++++++++++++++++++++++++++++++++----
 2 files changed, 73 insertions(+), 6 deletions(-)
target/riscv/cpu_bits.h +10 -0
index c257c5ed7d..0530b4f9f4 100644
@@ -906,6 +906,16 @@ typedef enum RISCVException {
 #define JVT_BASE                           (~0x3F)
 
 /* Debug Sdtrig CSR masks */
+#define TEXTRA32_MHVALUE                   0xFC000000
+#define TEXTRA32_MHSELECT                  0x03800000
+#define TEXTRA32_SBYTEMASK                 0x000C0000
+#define TEXTRA32_SVALUE                    0x0003FFFC
+#define TEXTRA32_SSELECT                   0x00000003
+#define TEXTRA64_MHVALUE                   0xFFF8000000000000ULL
+#define TEXTRA64_MHSELECT                  0x0007000000000000ULL
+#define TEXTRA64_SBYTEMASK                 0x000000F000000000ULL
+#define TEXTRA64_SVALUE                    0x00000003FFFFFFFCULL
+#define TEXTRA64_SSELECT                   0x0000000000000003ULL
 #define MCONTEXT32                         0x0000003F
 #define MCONTEXT64                         0x0000000000001FFFULL
 #define MCONTEXT32_HCONTEXT                0x0000007F
target/riscv/debug.c +63 -6

93 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

PATCH v3 2/2 target/riscv: Add textra matching condition for the triggers

In reply to Alvin Chang via

According to RISC-V Debug specification, the optional textra32 and textra64 trigger CSRs can be used to configure additional matching conditions for the triggers. For example, if the textra.MHSELECT field is set to 4 (mcontext), this trigger will only match or fire if the low bits of mcontext/hcontext equal textra.MHVALUE field.

This commit adds the aforementioned matching condition as common trigger matching conditions. Currently, the only legal values of textra.MHSELECT are 0 (ignore) and 4 (mcontext). When textra.MHSELECT is 0, we pass the checking. When textra.MHSELECT is 4, we compare textra.MHVALUE with mcontext CSR. The remaining fields, such as textra.SBYTEMASK, textra.SVALUE, and textra.SSELECT, are hardwired to zero for now. Thus, we skip checking them here.

---
 target/riscv/debug.c | 63 +++++++++++++++++++++++++++++++++++++++++++-
 target/riscv/debug.h |  3 +++
 2 files changed, 65 insertions(+), 1 deletion(-)
target/riscv/debug.c +62 -1
index d6b4a06144..62bb758860 100644
@@ -364,11 +364,72 @@ static bool trigger_priv_match(CPURISCVState *env, trigger_type_t type,
     return false;
 }
 
+static bool trigger_textra_match(CPURISCVState *env, trigger_type_t type,
+                                 int trigger_index)
+{
+    target_ulong textra = env->tdata3[trigger_index];
+    target_ulong mhvalue, mhselect;
+
+    if (type < TRIGGER_TYPE_AD_MATCH || type > TRIGGER_TYPE_AD_MATCH6) {
+        /* textra checking is only applicable when type is 2, 3, 4, 5, or 6 */
+        return true;
+    }
+
+    switch (riscv_cpu_mxl(env)) {
+    case MXL_RV32:
+        mhvalue  = get_field(textra, TEXTRA32_MHVALUE);
+        mhselect = get_field(textra, TEXTRA32_MHSELECT);
+        break;
+    case MXL_RV64:
+    case MXL_RV128:
+        mhvalue  = get_field(textra, TEXTRA64_MHVALUE);
+        mhselect = get_field(textra, TEXTRA64_MHSELECT);
+        break;
+    default:
+        g_assert_not_reached();
+    }
+
+    /* Check mhvalue and mhselect. */
+    switch (mhselect) {
+    case MHSELECT_IGNORE:
+        break;
+    case MHSELECT_MCONTEXT:
+        /* Match or fire if the low bits of mcontext/hcontext equal mhvalue. */
+        if (riscv_has_ext(env, RVH)) {
+            if (mhvalue != env->mcontext) {
+                return false;
+            }
+        } else {
+            switch (riscv_cpu_mxl(env)) {
+            case MXL_RV32:
+                if (mhvalue != (env->mcontext & MCONTEXT32)) {
+                    return false;
+                }
+                break;
+            case MXL_RV64:
+            case MXL_RV128:
+                if (mhvalue != (env->mcontext & MCONTEXT64)) {
+                    return false;
+                }
+                break;
+            default:
+                g_assert_not_reached();
+            }
+        }
+        break;
+    default:
+        break;
+    }
+
+    return true;
+}
+
 /* Common matching conditions for all types of the triggers. */
 static bool trigger_common_match(CPURISCVState *env, trigger_type_t type,
                                  int trigger_index)
 {
-    return trigger_priv_match(env, type, trigger_index);
+    return trigger_priv_match(env, type, trigger_index) &&
+           trigger_textra_match(env, type, trigger_index);
 }
 
 /* type 2 trigger */
target/riscv/debug.h +3 -0
index c347863578..f76b8f944a 100644
@@ -131,6 +131,9 @@ enum {
 #define ITRIGGER_VU           BIT(25)
 #define ITRIGGER_VS           BIT(26)
 
+#define MHSELECT_IGNORE       0
+#define MHSELECT_MCONTEXT     4
+
 bool tdata_available(CPURISCVState *env, int tdata_index);
 
 target_ulong tselect_csr_read(CPURISCVState *env);
Signature · 1 line
2.34.1
#3 lore raw

RE: [PATCH v3 2/2] target/riscv: Add textra matching condition for the triggers

Hi Alistair,

Quoted 85 lines

-----Original Message-----
From: Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Sent: Sunday, July 21, 2024 3:24 PM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Subject: [PATCH v3 2/2] target/riscv: Add textra matching condition for the triggers

According to RISC-V Debug specification, the optional textra32 and textra64 trigger CSRs can be used to configure additional matching conditions for the triggers. For example, if the textra.MHSELECT field is set to 4 (mcontext), this trigger will only match or fire if the low bits of mcontext/hcontext equal textra.MHVALUE field.

This commit adds the aforementioned matching condition as common trigger matching conditions. Currently, the only legal values of textra.MHSELECT are 0 (ignore) and 4 (mcontext). When textra.MHSELECT is 0, we pass the checking. When textra.MHSELECT is 4, we compare textra.MHVALUE with mcontext CSR. The remaining fields, such as textra.SBYTEMASK, textra.SVALUE, and textra.SSELECT, are hardwired to zero for now. Thus, we skip checking them here.

---
 target/riscv/debug.c | 63
+++++++++++++++++++++++++++++++++++++++++++-
 target/riscv/debug.h |  3 +++
 2 files changed, 65 insertions(+), 1 deletion(-)
target/riscv/debug.c index renamed from target/riscv/debug.c +0 -0

d6b4a06144..62bb758860 100644

target/riscv/debug.c +41 -0
@@ -364,11 +364,72 @@ static bool trigger_priv_match(CPURISCVState *env,
 trigger_type_t type,
     return false;
 }
 
+static bool trigger_textra_match(CPURISCVState *env, trigger_type_t type,
+                                 int trigger_index) {
+    target_ulong textra = env->tdata3[trigger_index];
+    target_ulong mhvalue, mhselect;
+
+    if (type < TRIGGER_TYPE_AD_MATCH || type >
 TRIGGER_TYPE_AD_MATCH6) {
+        /* textra checking is only applicable when type is 2, 3, 4, 5, or 6 */
+        return true;
+    }
+
+    switch (riscv_cpu_mxl(env)) {
+    case MXL_RV32:
+        mhvalue  = get_field(textra, TEXTRA32_MHVALUE);
+        mhselect = get_field(textra, TEXTRA32_MHSELECT);
+        break;
+    case MXL_RV64:
+    case MXL_RV128:
+        mhvalue  = get_field(textra, TEXTRA64_MHVALUE);
+        mhselect = get_field(textra, TEXTRA64_MHSELECT);
+        break;
+    default:
+        g_assert_not_reached();
+    }
+
+    /* Check mhvalue and mhselect. */
+    switch (mhselect) {
+    case MHSELECT_IGNORE:
+        break;
+    case MHSELECT_MCONTEXT:
+        /* Match or fire if the low bits of mcontext/hcontext equal mhvalue.
 */
+        if (riscv_has_ext(env, RVH)) {
+            if (mhvalue != env->mcontext) {
+                return false;
+            }
+        } else {
+            switch (riscv_cpu_mxl(env)) {
+            case MXL_RV32:
+                if (mhvalue != (env->mcontext & MCONTEXT32)) {
+                    return false;
+                }
+                break;

target/riscv/debug.c static bool trigger_priv_match(CPURISCVState *env, · line 420

Quoted 10 lines
target/riscv/debug.c +10 -0
+            case MXL_RV64:
+            case MXL_RV128:
+                if (mhvalue != (env->mcontext & MCONTEXT64)) {
+                    return false;
+                }
+                break;
+            default:
+                g_assert_not_reached();
+            }
+        }

I have some new ideas on this part.
Should we replace this whole if-else with just the following simple code ?

    case MHSELECT_MCONTEXT:
        /* Match if the low bits of mcontext/hcontext equal mhvalue. */
        if (mhvalue != env->mcontext) {
            return false;
        }
        break;

Those masks on mcontext have been applied in write_mcontext(). I think we can skip the masks here.
What do you think ?

Regards,
Alvin Chang

Quoted 32 lines
target/riscv/debug.c +10 -1
+        break;
+    default:
+        break;
+    }
+
+    return true;
+}
+
 /* Common matching conditions for all types of the triggers. */  static bool
 trigger_common_match(CPURISCVState *env, trigger_type_t type,
                                  int trigger_index)  {
-    return trigger_priv_match(env, type, trigger_index);
+    return trigger_priv_match(env, type, trigger_index) &&
+           trigger_textra_match(env, type, trigger_index);
 }
 
 /* type 2 trigger */
target/riscv/debug.h index renamed from target/riscv/debug.h +0 -0

c347863578..f76b8f944a 100644

target/riscv/debug.h +3 -1
@@ -131,6 +131,9 @@ enum {
 #define ITRIGGER_VU           BIT(25)
 #define ITRIGGER_VS           BIT(26)
 
+#define MHSELECT_IGNORE       0
+#define MHSELECT_MCONTEXT     4
+
 bool tdata_available(CPURISCVState *env, int tdata_index);
 
 target_ulong tselect_csr_read(CPURISCVState *env);
--
Quoted 1 line

2.34.1

CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.

#4 lore raw

Re: [PATCH v3 2/2] target/riscv: Add textra matching condition for the triggers

Quoted 109 lines · Alvin Che-Chia Chang(張哲嘉)

Hi Alistair,

Quoted 85 lines

-----Original Message-----
From: Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Sent: Sunday, July 21, 2024 3:24 PM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Subject: [PATCH v3 2/2] target/riscv: Add textra matching condition for the triggers

According to RISC-V Debug specification, the optional textra32 and textra64 trigger CSRs can be used to configure additional matching conditions for the triggers. For example, if the textra.MHSELECT field is set to 4 (mcontext), this trigger will only match or fire if the low bits of mcontext/hcontext equal textra.MHVALUE field.

This commit adds the aforementioned matching condition as common trigger matching conditions. Currently, the only legal values of textra.MHSELECT are 0 (ignore) and 4 (mcontext). When textra.MHSELECT is 0, we pass the checking. When textra.MHSELECT is 4, we compare textra.MHVALUE with mcontext CSR. The remaining fields, such as textra.SBYTEMASK, textra.SVALUE, and textra.SSELECT, are hardwired to zero for now. Thus, we skip checking them here.

---
 target/riscv/debug.c | 63
+++++++++++++++++++++++++++++++++++++++++++-
 target/riscv/debug.h |  3 +++
 2 files changed, 65 insertions(+), 1 deletion(-)
target/riscv/debug.c index renamed from target/riscv/debug.c +0 -0

d6b4a06144..62bb758860 100644

target/riscv/debug.c +41 -0
@@ -364,11 +364,72 @@ static bool trigger_priv_match(CPURISCVState *env,
 trigger_type_t type,
     return false;
 }
 
+static bool trigger_textra_match(CPURISCVState *env, trigger_type_t type,
+                                 int trigger_index) {
+    target_ulong textra = env->tdata3[trigger_index];
+    target_ulong mhvalue, mhselect;
+
+    if (type < TRIGGER_TYPE_AD_MATCH || type >
 TRIGGER_TYPE_AD_MATCH6) {
+        /* textra checking is only applicable when type is 2, 3, 4, 5, or 6 */
+        return true;
+    }
+
+    switch (riscv_cpu_mxl(env)) {
+    case MXL_RV32:
+        mhvalue  = get_field(textra, TEXTRA32_MHVALUE);
+        mhselect = get_field(textra, TEXTRA32_MHSELECT);
+        break;
+    case MXL_RV64:
+    case MXL_RV128:
+        mhvalue  = get_field(textra, TEXTRA64_MHVALUE);
+        mhselect = get_field(textra, TEXTRA64_MHSELECT);
+        break;
+    default:
+        g_assert_not_reached();
+    }
+
+    /* Check mhvalue and mhselect. */
+    switch (mhselect) {
+    case MHSELECT_IGNORE:
+        break;
+    case MHSELECT_MCONTEXT:
+        /* Match or fire if the low bits of mcontext/hcontext equal mhvalue.
 */
+        if (riscv_has_ext(env, RVH)) {
+            if (mhvalue != env->mcontext) {
+                return false;
+            }
+        } else {
+            switch (riscv_cpu_mxl(env)) {
+            case MXL_RV32:
+                if (mhvalue != (env->mcontext & MCONTEXT32)) {
+                    return false;
+                }
+                break;

target/riscv/debug.c static bool trigger_priv_match(CPURISCVState *env, · line 420

Quoted 10 lines
target/riscv/debug.c +10 -0
+            case MXL_RV64:
+            case MXL_RV128:
+                if (mhvalue != (env->mcontext & MCONTEXT64)) {
+                    return false;
+                }
+                break;
+            default:
+                g_assert_not_reached();
+            }
+        }

I have some new ideas on this part.
Should we replace this whole if-else with just the following simple code ?

    case MHSELECT_MCONTEXT:
        /* Match if the low bits of mcontext/hcontext equal mhvalue. */
        if (mhvalue != env->mcontext) {
            return false;
        }
        break;
Quoted 3 lines

Those masks on mcontext have been applied in write_mcontext(). I think we can skip the masks here.
What do you think ?

Yep, that would be much better

Alistair

Quoted 44 lines

Regards,
Alvin Chang

Quoted 32 lines
target/riscv/debug.c +10 -1
+        break;
+    default:
+        break;
+    }
+
+    return true;
+}
+
 /* Common matching conditions for all types of the triggers. */  static bool
 trigger_common_match(CPURISCVState *env, trigger_type_t type,
                                  int trigger_index)  {
-    return trigger_priv_match(env, type, trigger_index);
+    return trigger_priv_match(env, type, trigger_index) &&
+           trigger_textra_match(env, type, trigger_index);
 }
 
 /* type 2 trigger */
target/riscv/debug.h index renamed from target/riscv/debug.h +0 -0

c347863578..f76b8f944a 100644

target/riscv/debug.h +3 -1
@@ -131,6 +131,9 @@ enum {
 #define ITRIGGER_VU           BIT(25)
 #define ITRIGGER_VS           BIT(26)
 
+#define MHSELECT_IGNORE       0
+#define MHSELECT_MCONTEXT     4
+
 bool tdata_available(CPURISCVState *env, int tdata_index);
 
 target_ulong tselect_csr_read(CPURISCVState *env);
--
Quoted 1 line

2.34.1

CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.

#5 lore raw

RE: [PATCH v3 2/2] target/riscv: Add textra matching condition for the triggers

Hi Alistair,

Quoted 129 lines

-----Original Message-----
From: Alistair Francis <[email protected]>
Sent: Monday, August 26, 2024 8:26 AM
To: Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 2/2] target/riscv: Add textra matching condition for the triggers

[EXTERNAL MAIL]

Quoted 24 lines · Alvin Che-Chia Chang(張哲嘉)

Hi Alistair,

Quoted 21 lines

-----Original Message-----
From: Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Sent: Sunday, July 21, 2024 3:24 PM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Subject: [PATCH v3 2/2] target/riscv: Add textra matching condition for the triggers

According to RISC-V Debug specification, the optional textra32 and textra64 trigger CSRs can be used to configure additional matching conditions for the triggers. For example, if the textra.MHSELECT field is set to 4 (mcontext), this trigger will only match or fire if the low bits of mcontext/hcontext equal textra.MHVALUE field.

This commit adds the aforementioned matching condition as common trigger matching conditions. Currently, the only legal values of textra.MHSELECT are 0
(ignore) and 4 (mcontext). When textra.MHSELECT is 0, we pass the

checking.

Quoted 1 line
Quoted 1 line

When textra.MHSELECT is 4, we compare textra.MHVALUE with mcontext

CSR.

Quoted 21 lines
Quoted 21 lines

The remaining fields, such as textra.SBYTEMASK, textra.SVALUE, and textra.SSELECT, are hardwired to zero for now. Thus, we skip checking them here.

---
 target/riscv/debug.c | 63
+++++++++++++++++++++++++++++++++++++++++++-
 target/riscv/debug.h |  3 +++
 2 files changed, 65 insertions(+), 1 deletion(-)
target/riscv/debug.c index renamed from target/riscv/debug.c +0 -0

d6b4a06144..62bb758860 100644

target/riscv/debug.c +0 -0
@@ -364,11 +364,72 @@ static bool trigger_priv_match(CPURISCVState
 *env, trigger_type_t type,
     return false;
 }
 
Quoted 1 line

target/riscv/debug.c static bool trigger_priv_match(CPURISCVState · line 368

Quoted 1 line
target/riscv/debug.c +1 -0
+static bool trigger_textra_match(CPURISCVState *env, trigger_type_t

type,

Quoted 7 lines

target/riscv/debug.c static bool trigger_priv_match(CPURISCVState · line 375

Quoted 7 lines
target/riscv/debug.c +6 -0
+                                 int trigger_index) {
+    target_ulong textra = env->tdata3[trigger_index];
+    target_ulong mhvalue, mhselect;
+
+    if (type < TRIGGER_TYPE_AD_MATCH || type >
 TRIGGER_TYPE_AD_MATCH6) {
+        /* textra checking is only applicable when type is 2, 3, 4, 5, or 6

*/

Quoted 15 lines
Quoted 15 lines
target/riscv/debug.c +15 -0
+        return true;
+    }
+
+    switch (riscv_cpu_mxl(env)) {
+    case MXL_RV32:
+        mhvalue  = get_field(textra, TEXTRA32_MHVALUE);
+        mhselect = get_field(textra, TEXTRA32_MHSELECT);
+        break;
+    case MXL_RV64:
+    case MXL_RV128:
+        mhvalue  = get_field(textra, TEXTRA64_MHVALUE);
+        mhselect = get_field(textra, TEXTRA64_MHSELECT);
+        break;
+    default:
+        g_assert_not_reached();
Quoted 8 lines

target/riscv/debug.c static bool trigger_priv_match(CPURISCVState *env, trigger_type_t type,

Quoted 8 lines
target/riscv/debug.c +8 -0
+    }
+
+    /* Check mhvalue and mhselect. */
+    switch (mhselect) {
+    case MHSELECT_IGNORE:
+        break;
+    case MHSELECT_MCONTEXT:
+        /* Match or fire if the low bits of mcontext/hcontext equal

mhvalue.

Quoted 33 lines
Quoted 12 lines
target/riscv/debug.c +11 -0
 */
+        if (riscv_has_ext(env, RVH)) {
+            if (mhvalue != env->mcontext) {
+                return false;
+            }
+        } else {
+            switch (riscv_cpu_mxl(env)) {
+            case MXL_RV32:
+                if (mhvalue != (env->mcontext & MCONTEXT32)) {
+                    return false;
+                }
+                break;

target/riscv/debug.c static bool trigger_priv_match(CPURISCVState *env, trigger_type_t type, · line 418

Quoted 10 lines
target/riscv/debug.c +10 -0
+            case MXL_RV64:
+            case MXL_RV128:
+                if (mhvalue != (env->mcontext & MCONTEXT64)) {
+                    return false;
+                }
+                break;
+            default:
+                g_assert_not_reached();
+            }
+        }

I have some new ideas on this part.
Should we replace this whole if-else with just the following simple code ?

    case MHSELECT_MCONTEXT:
        /* Match if the low bits of mcontext/hcontext equal mhvalue. */
        if (mhvalue != env->mcontext) {
            return false;
        }
        break;
Quoted 5 lines
Quoted 3 lines

Those masks on mcontext have been applied in write_mcontext(). I think we can skip the masks here.
What do you think ?

Yep, that would be much better

I've submitted v4 patch to simplify this code.
Please see https://lists.gnu.org/archive/html/qemu-riscv/2024-08/msg00512.html

Sincerely,
Alvin

Quoted 45 lines

Alistair

Quoted 5 lines

Regards,
Alvin Chang

Quoted 10 lines
Quoted 10 lines
target/riscv/debug.c +8 -0
+        break;
+    default:
+        break;
+    }
+
+    return true;
+}
+
 /* Common matching conditions for all types of the triggers. */

static bool trigger_common_match(CPURISCVState *env, trigger_type_t

type,

Quoted 26 lines
Quoted 22 lines
                                  int trigger_index)  {
target/riscv/debug.c +2 -1
-    return trigger_priv_match(env, type, trigger_index);
+    return trigger_priv_match(env, type, trigger_index) &&
+           trigger_textra_match(env, type, trigger_index);
 }
 
 /* type 2 trigger */
target/riscv/debug.h index renamed from target/riscv/debug.h +0 -0

c347863578..f76b8f944a 100644

target/riscv/debug.h +3 -1
@@ -131,6 +131,9 @@ enum {
 #define ITRIGGER_VU           BIT(25)
 #define ITRIGGER_VS           BIT(26)
 
+#define MHSELECT_IGNORE       0
+#define MHSELECT_MCONTEXT     4
+
 bool tdata_available(CPURISCVState *env, int tdata_index);
 
 target_ulong tselect_csr_read(CPURISCVState *env);
--
Quoted 1 line

2.34.1

CONFIDENTIALITY NOTICE:

Quoted 9 lines
Quoted 1 line

This e-mail (and its attachments) may contain confidential and legally

privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Quoted 2 lines

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.

CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.

#6 lore raw
In reply to Alvin Chang via
Quoted 12 lines · Alvin Chang via

According to RISC-V Debug specification, the optional textra32 and textra64 trigger CSRs can be used to configure additional matching conditions for the triggers.

This series support to write MHVALUE and MHSELECT fields into textra32 and textra64 trigger CSRs. Besides, the additional matching condition between textra.MHVALUE and mcontext CSR is also implemented.

Changes from v2:
- Remove redundant log

Quoted 7 lines

Changes from v1:
- Log that mhselect only supports 0 or 4 for now
- Simplify writing of tdata3

Alvin Chang (2):
target/riscv: Preliminary textra trigger CSR writting support target/riscv: Add textra matching condition for the triggers

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 10 lines
 target/riscv/cpu_bits.h |  10 +++
 target/riscv/debug.c    | 132 +++++++++++++++++++++++++++++++++++++---
 target/riscv/debug.h    |   3 +
 3 files changed, 138 insertions(+), 7 deletions(-)

--
2.34.1

#7 lore raw

Hello Alistair,

Quoted 31 lines

-----Original Message-----
From: Alistair Francis <[email protected]>
Sent: Wednesday, July 24, 2024 10:40 AM
To: Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 0/2] RISC-V: Add preliminary textra trigger CSR functions

[EXTERNAL MAIL]

Quoted 17 lines · Alvin Chang via

According to RISC-V Debug specification, the optional textra32 and textra64 trigger CSRs can be used to configure additional matching conditions for the triggers.

This series support to write MHVALUE and MHSELECT fields into textra32 and
textra64 trigger CSRs. Besides, the additional matching condition between textra.MHVALUE and mcontext CSR is also implemented.

Changes from v2:
- Remove redundant log

Changes from v1:
- Log that mhselect only supports 0 or 4 for now
- Simplify writing of tdata3

Quoted 7 lines
Quoted 3 lines

Alvin Chang (2):
target/riscv: Preliminary textra trigger CSR writting support target/riscv: Add textra matching condition for the triggers

Thanks!

Applied to riscv-to-apply.next

I saw latest riscv-to-apply queue was submitted to qemu-devel yesterday. But this series was not included. Please allow me to inform this. Thanks!

Best regards,
Alvin Chang

Quoted 14 lines

Alistair

Quoted 3 lines
 target/riscv/cpu_bits.h |  10 +++
 target/riscv/debug.c    | 132

+++++++++++++++++++++++++++++++++++++---

Quoted 7 lines
 target/riscv/debug.h    |   3 +
 3 files changed, 138 insertions(+), 7 deletions(-)

--
2.34.1

CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.

#8 lore raw
Quoted 38 lines · Alvin Che-Chia Chang(張哲嘉)

Hello Alistair,

Quoted 35 lines

-----Original Message-----
From: Alistair Francis <[email protected]>
Sent: Wednesday, July 24, 2024 10:40 AM
To: Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 0/2] RISC-V: Add preliminary textra trigger CSR functions

[EXTERNAL MAIL]

Quoted 20 lines · Alvin Chang via

According to RISC-V Debug specification, the optional textra32 and textra64 trigger CSRs can be used to configure additional matching conditions for the triggers.

This series support to write MHVALUE and MHSELECT fields into textra32 and
textra64 trigger CSRs. Besides, the additional matching condition between textra.MHVALUE and mcontext CSR is also implemented.

Changes from v2:
- Remove redundant log

Changes from v1:
- Log that mhselect only supports 0 or 4 for now
- Simplify writing of tdata3

Alvin Chang (2):
target/riscv: Preliminary textra trigger CSR writting support target/riscv: Add textra matching condition for the triggers

Quoted 6 lines
Quoted 3 lines

Thanks!

Applied to riscv-to-apply.next

I saw latest riscv-to-apply queue was submitted to qemu-devel yesterday. But this series was not included. Please allow me to inform this. Thanks!

Good catch!

The PR yesterday was just fixing bugs for the upcoming release [1].

As this series isn't a bug fix I dropped it from the PR. It will be in the first PR for 9.2 though

1: https://wiki.qemu.org/Planning/9.1

Alistair

#9 lore raw
Quoted 59 lines

-----Original Message-----
From: Alistair Francis <[email protected]>
Sent: Wednesday, August 7, 2024 6:59 PM
To: Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 0/2] RISC-V: Add preliminary textra trigger CSR functions

[EXTERNAL MAIL]

Quoted 40 lines · Alvin Che-Chia Chang(張哲嘉)

Hello Alistair,

Quoted 37 lines

-----Original Message-----
From: Alistair Francis <[email protected]>
Sent: Wednesday, July 24, 2024 10:40 AM
To: Alvin Che-Chia Chang(張哲嘉) <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 0/2] RISC-V: Add preliminary textra trigger CSR functions

[EXTERNAL MAIL]

Quoted 20 lines · Alvin Chang via

According to RISC-V Debug specification, the optional textra32 and textra64 trigger CSRs can be used to configure additional matching conditions for the triggers.

This series support to write MHVALUE and MHSELECT fields into textra32 and
textra64 trigger CSRs. Besides, the additional matching condition between textra.MHVALUE and mcontext CSR is also implemented.

Changes from v2:
- Remove redundant log

Changes from v1:
- Log that mhselect only supports 0 or 4 for now
- Simplify writing of tdata3

Alvin Chang (2):
target/riscv: Preliminary textra trigger CSR writting support target/riscv: Add textra matching condition for the triggers

Quoted 5 lines
Quoted 3 lines

Thanks!

Applied to riscv-to-apply.next

I saw latest riscv-to-apply queue was submitted to qemu-devel yesterday. But

this series was not included.

Quoted 8 lines
Quoted 1 line

Please allow me to inform this. Thanks!

Good catch!

The PR yesterday was just fixing bugs for the upcoming release [1].

As this series isn't a bug fix I dropped it from the PR. It will be in the first PR for 9.2 though

Got it! Thanks!

Alvin Chang

Quoted 4 lines

1: https://wiki.qemu.org/Planning/9.1

Alistair

CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.