All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_
@ 2024-08-16 19:06 Brian Cain
  2024-08-16 19:06 ` [PATCH 2/3] target/hexagon: rename HEX_EVENT_TRAP0=>HEX_CAUSE_TRAP0 Brian Cain
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Brian Cain @ 2024-08-16 19:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: bcain, quic_mathbern, sidneym, quic_mliebel, ltaylorsimpson,
	Laurent Vivier

Change the name of these definitions to reflect that they correspond
to the event code for the exception.

Signed-off-by: Brian Cain <bcain@quicinc.com>
---
 linux-user/hexagon/cpu_loop.c |  4 ++--
 target/hexagon/cpu.h          |  2 +-
 target/hexagon/cpu_bits.h     | 14 +++++++-------
 target/hexagon/gen_tcg.h      |  2 +-
 target/hexagon/translate.c    |  6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c
index d41159e52a..f9d9ae515f 100644
--- a/linux-user/hexagon/cpu_loop.c
+++ b/linux-user/hexagon/cpu_loop.c
@@ -42,7 +42,7 @@ void cpu_loop(CPUHexagonState *env)
         case EXCP_INTERRUPT:
             /* just indicate that signals should be handled asap */
             break;
-        case HEX_EXCP_TRAP0:
+        case HEX_EVENT_TRAP0:
             syscallnum = env->gpr[6];
             env->gpr[HEX_REG_PC] += 4;
             ret = do_syscall(env,
@@ -60,7 +60,7 @@ void cpu_loop(CPUHexagonState *env)
                 env->gpr[0] = ret;
             }
             break;
-        case HEX_EXCP_PC_NOT_ALIGNED:
+        case HEX_EVENT_PC_NOT_ALIGNED:
             force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN,
                             env->gpr[HEX_REG_R31]);
             break;
diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
index 764f3c38cc..3ef2e5bf4b 100644
--- a/target/hexagon/cpu.h
+++ b/target/hexagon/cpu.h
@@ -149,7 +149,7 @@ static inline void cpu_get_tb_cpu_state(CPUHexagonState *env, vaddr *pc,
     }
     *flags = hex_flags;
     if (*pc & PCALIGN_MASK) {
-        hexagon_raise_exception_err(env, HEX_EXCP_PC_NOT_ALIGNED, 0);
+        hexagon_raise_exception_err(env, HEX_EVENT_PC_NOT_ALIGNED, 0);
     }
 }
 
diff --git a/target/hexagon/cpu_bits.h b/target/hexagon/cpu_bits.h
index 4279281a71..5a71af2469 100644
--- a/target/hexagon/cpu_bits.h
+++ b/target/hexagon/cpu_bits.h
@@ -23,14 +23,14 @@
 #define PCALIGN 4
 #define PCALIGN_MASK (PCALIGN - 1)
 
-#define HEX_EXCP_FETCH_NO_UPAGE  0x012
-#define HEX_EXCP_INVALID_PACKET  0x015
-#define HEX_EXCP_INVALID_OPCODE  0x015
-#define HEX_EXCP_PC_NOT_ALIGNED  0x01e
-#define HEX_EXCP_PRIV_NO_UREAD   0x024
-#define HEX_EXCP_PRIV_NO_UWRITE  0x025
+#define HEX_EVENT_FETCH_NO_UPAGE  0x012
+#define HEX_EVENT_INVALID_PACKET  0x015
+#define HEX_EVENT_INVALID_OPCODE  0x015
+#define HEX_EVENT_PC_NOT_ALIGNED  0x01e
+#define HEX_EVENT_PRIV_NO_UREAD   0x024
+#define HEX_EVENT_PRIV_NO_UWRITE  0x025
 
-#define HEX_EXCP_TRAP0           0x172
+#define HEX_EVENT_TRAP0           0x172
 
 #define PACKET_WORDS_MAX         4
 
diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h
index 3fc1f4e281..8a3b801287 100644
--- a/target/hexagon/gen_tcg.h
+++ b/target/hexagon/gen_tcg.h
@@ -1365,7 +1365,7 @@
     do { \
         uiV = uiV; \
         tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], ctx->pkt->pc); \
-        TCGv excp = tcg_constant_tl(HEX_EXCP_TRAP0); \
+        TCGv excp = tcg_constant_tl(HEX_EVENT_TRAP0); \
         gen_helper_raise_exception(tcg_env, excp); \
     } while (0)
 #endif
diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
index 4b1bee3c6d..2f187c6ceb 100644
--- a/target/hexagon/translate.c
+++ b/target/hexagon/translate.c
@@ -591,7 +591,7 @@ static void gen_insn(DisasContext *ctx)
         ctx->insn->generate(ctx);
         mark_store_width(ctx);
     } else {
-        gen_exception_end_tb(ctx, HEX_EXCP_INVALID_OPCODE);
+        gen_exception_end_tb(ctx, HEX_EVENT_INVALID_OPCODE);
     }
 }
 
@@ -968,7 +968,7 @@ static void decode_and_translate_packet(CPUHexagonState *env, DisasContext *ctx)
 
     nwords = read_packet_words(env, ctx, words);
     if (!nwords) {
-        gen_exception_end_tb(ctx, HEX_EXCP_INVALID_PACKET);
+        gen_exception_end_tb(ctx, HEX_EVENT_INVALID_PACKET);
         return;
     }
 
@@ -984,7 +984,7 @@ static void decode_and_translate_packet(CPUHexagonState *env, DisasContext *ctx)
         gen_commit_packet(ctx);
         ctx->base.pc_next += pkt.encod_pkt_size_in_bytes;
     } else {
-        gen_exception_end_tb(ctx, HEX_EXCP_INVALID_PACKET);
+        gen_exception_end_tb(ctx, HEX_EVENT_INVALID_PACKET);
     }
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] target/hexagon: rename HEX_EVENT_TRAP0=>HEX_CAUSE_TRAP0
  2024-08-16 19:06 [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_ Brian Cain
@ 2024-08-16 19:06 ` Brian Cain
  2024-08-16 21:31   ` ltaylorsimpson
  2024-08-16 19:06 ` [PATCH 3/3] target/hexagon: add enums for event, cause Brian Cain
  2024-08-16 21:31 ` [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_ ltaylorsimpson
  2 siblings, 1 reply; 6+ messages in thread
From: Brian Cain @ 2024-08-16 19:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: bcain, quic_mathbern, sidneym, quic_mliebel, ltaylorsimpson

The value previously used for "HEX_EVENT_TRAP0" was the cause code
definition and not the event number.  So in this commit, we update
the name to reflect the cause code and add a new "HEX_EVENT_TRAP0"
with the correct event number.

Signed-off-by: Brian Cain <bcain@quicinc.com>
---
 target/hexagon/cpu_bits.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/hexagon/cpu_bits.h b/target/hexagon/cpu_bits.h
index 5a71af2469..eec456d8f9 100644
--- a/target/hexagon/cpu_bits.h
+++ b/target/hexagon/cpu_bits.h
@@ -23,6 +23,7 @@
 #define PCALIGN 4
 #define PCALIGN_MASK (PCALIGN - 1)
 
+#define HEX_EVENT_TRAP0           0x008
 #define HEX_EVENT_FETCH_NO_UPAGE  0x012
 #define HEX_EVENT_INVALID_PACKET  0x015
 #define HEX_EVENT_INVALID_OPCODE  0x015
@@ -30,7 +31,7 @@
 #define HEX_EVENT_PRIV_NO_UREAD   0x024
 #define HEX_EVENT_PRIV_NO_UWRITE  0x025
 
-#define HEX_EVENT_TRAP0           0x172
+#define HEX_CAUSE_TRAP0           0x172
 
 #define PACKET_WORDS_MAX         4
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] target/hexagon: add enums for event, cause
  2024-08-16 19:06 [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_ Brian Cain
  2024-08-16 19:06 ` [PATCH 2/3] target/hexagon: rename HEX_EVENT_TRAP0=>HEX_CAUSE_TRAP0 Brian Cain
@ 2024-08-16 19:06 ` Brian Cain
  2024-08-16 21:32   ` ltaylorsimpson
  2024-08-16 21:31 ` [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_ ltaylorsimpson
  2 siblings, 1 reply; 6+ messages in thread
From: Brian Cain @ 2024-08-16 19:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: bcain, quic_mathbern, sidneym, quic_mliebel, ltaylorsimpson

Signed-off-by: Brian Cain <bcain@quicinc.com>
---
 target/hexagon/cpu_bits.h | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/target/hexagon/cpu_bits.h b/target/hexagon/cpu_bits.h
index eec456d8f9..2454ef72bf 100644
--- a/target/hexagon/cpu_bits.h
+++ b/target/hexagon/cpu_bits.h
@@ -23,15 +23,21 @@
 #define PCALIGN 4
 #define PCALIGN_MASK (PCALIGN - 1)
 
-#define HEX_EVENT_TRAP0           0x008
-#define HEX_EVENT_FETCH_NO_UPAGE  0x012
-#define HEX_EVENT_INVALID_PACKET  0x015
-#define HEX_EVENT_INVALID_OPCODE  0x015
-#define HEX_EVENT_PC_NOT_ALIGNED  0x01e
-#define HEX_EVENT_PRIV_NO_UREAD   0x024
-#define HEX_EVENT_PRIV_NO_UWRITE  0x025
+enum hex_event {
+    HEX_EVENT_NONE           = -1,
+    HEX_EVENT_TRAP0          =  0x008,
+    HEX_EVENT_FETCH_NO_UPAGE =  0x012,
+    HEX_EVENT_INVALID_PACKET =  0x015,
+    HEX_EVENT_INVALID_OPCODE =  0x015,
+    HEX_EVENT_PC_NOT_ALIGNED =  0x01e,
+    HEX_EVENT_PRIV_NO_UREAD  =  0x024,
+    HEX_EVENT_PRIV_NO_UWRITE =  0x025,
+};
 
-#define HEX_CAUSE_TRAP0           0x172
+enum hex_cause {
+    HEX_CAUSE_NONE = -1,
+    HEX_CAUSE_TRAP0 = 0x172,
+};
 
 #define PACKET_WORDS_MAX         4
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_
  2024-08-16 19:06 [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_ Brian Cain
  2024-08-16 19:06 ` [PATCH 2/3] target/hexagon: rename HEX_EVENT_TRAP0=>HEX_CAUSE_TRAP0 Brian Cain
  2024-08-16 19:06 ` [PATCH 3/3] target/hexagon: add enums for event, cause Brian Cain
@ 2024-08-16 21:31 ` ltaylorsimpson
  2 siblings, 0 replies; 6+ messages in thread
From: ltaylorsimpson @ 2024-08-16 21:31 UTC (permalink / raw)
  To: 'Brian Cain', qemu-devel
  Cc: quic_mathbern, sidneym, quic_mliebel, 'Laurent Vivier'



> -----Original Message-----
> From: Brian Cain <bcain@quicinc.com>
> Sent: Friday, August 16, 2024 1:06 PM
> To: qemu-devel@nongnu.org
> Cc: bcain@quicinc.com; quic_mathbern@quicinc.com;
> sidneym@quicinc.com; quic_mliebel@quicinc.com;
> ltaylorsimpson@gmail.com; Laurent Vivier <laurent@vivier.eu>
> Subject: [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_
> 
> Change the name of these definitions to reflect that they correspond to the
> event code for the exception.
> 
> Signed-off-by: Brian Cain <bcain@quicinc.com>
> ---
>  linux-user/hexagon/cpu_loop.c |  4 ++--
>  target/hexagon/cpu.h          |  2 +-
>  target/hexagon/cpu_bits.h     | 14 +++++++-------
>  target/hexagon/gen_tcg.h      |  2 +-
>  target/hexagon/translate.c    |  6 +++---
>  5 files changed, 14 insertions(+), 14 deletions(-)

Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/3] target/hexagon: rename HEX_EVENT_TRAP0=>HEX_CAUSE_TRAP0
  2024-08-16 19:06 ` [PATCH 2/3] target/hexagon: rename HEX_EVENT_TRAP0=>HEX_CAUSE_TRAP0 Brian Cain
@ 2024-08-16 21:31   ` ltaylorsimpson
  0 siblings, 0 replies; 6+ messages in thread
From: ltaylorsimpson @ 2024-08-16 21:31 UTC (permalink / raw)
  To: 'Brian Cain', qemu-devel; +Cc: quic_mathbern, sidneym, quic_mliebel



> -----Original Message-----
> From: Brian Cain <bcain@quicinc.com>
> Sent: Friday, August 16, 2024 1:06 PM
> To: qemu-devel@nongnu.org
> Cc: bcain@quicinc.com; quic_mathbern@quicinc.com;
> sidneym@quicinc.com; quic_mliebel@quicinc.com;
> ltaylorsimpson@gmail.com
> Subject: [PATCH 2/3] target/hexagon: rename
> HEX_EVENT_TRAP0=>HEX_CAUSE_TRAP0
> 
> The value previously used for "HEX_EVENT_TRAP0" was the cause code
> definition and not the event number.  So in this commit, we update the
> name to reflect the cause code and add a new "HEX_EVENT_TRAP0"
> with the correct event number.
> 
> Signed-off-by: Brian Cain <bcain@quicinc.com>
> ---
>  target/hexagon/cpu_bits.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 3/3] target/hexagon: add enums for event, cause
  2024-08-16 19:06 ` [PATCH 3/3] target/hexagon: add enums for event, cause Brian Cain
@ 2024-08-16 21:32   ` ltaylorsimpson
  0 siblings, 0 replies; 6+ messages in thread
From: ltaylorsimpson @ 2024-08-16 21:32 UTC (permalink / raw)
  To: 'Brian Cain', qemu-devel; +Cc: quic_mathbern, sidneym, quic_mliebel



> -----Original Message-----
> From: Brian Cain <bcain@quicinc.com>
> Sent: Friday, August 16, 2024 1:06 PM
> To: qemu-devel@nongnu.org
> Cc: bcain@quicinc.com; quic_mathbern@quicinc.com;
> sidneym@quicinc.com; quic_mliebel@quicinc.com;
> ltaylorsimpson@gmail.com
> Subject: [PATCH 3/3] target/hexagon: add enums for event, cause
> 
> Signed-off-by: Brian Cain <bcain@quicinc.com>
> ---
>  target/hexagon/cpu_bits.h | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)

Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com>




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-08-16 21:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16 19:06 [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_ Brian Cain
2024-08-16 19:06 ` [PATCH 2/3] target/hexagon: rename HEX_EVENT_TRAP0=>HEX_CAUSE_TRAP0 Brian Cain
2024-08-16 21:31   ` ltaylorsimpson
2024-08-16 19:06 ` [PATCH 3/3] target/hexagon: add enums for event, cause Brian Cain
2024-08-16 21:32   ` ltaylorsimpson
2024-08-16 21:31 ` [PATCH 1/3] target/hexagon: Rename HEX_EXCP_ => HEX_EVENT_ ltaylorsimpson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.