Skip to contentSkip to conversation

target/loongarch: fix ASXE flag conflict

PATCH In review Jiajie Chen 3 participants 3 messages Sep 30, 2023 – Oct 8, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/loongarch: fix ASXE flag conflict

HW_FLAGS_EUEN_ASXE acccidentally conflicts with HW_FLAGS_CRMD_PG, enabling LASX instructions even when CSR_EUEN.ASXE=0.

---
 target/loongarch/cpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/loongarch/cpu.h +1 -1
index f125a8e49b..79ad79a289 100644
@@ -462,7 +462,7 @@ static inline void set_pc(CPULoongArchState *env, uint64_t value)
 #define HW_FLAGS_CRMD_PG    R_CSR_CRMD_PG_MASK   /* 0x10 */
 #define HW_FLAGS_EUEN_FPE   0x04
 #define HW_FLAGS_EUEN_SXE   0x08
-#define HW_FLAGS_EUEN_ASXE  0x10
+#define HW_FLAGS_EUEN_ASXE  0x40
 #define HW_FLAGS_VA32       0x20
 
 static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Jiajie Chen

HW_FLAGS_EUEN_ASXE acccidentally conflicts with HW_FLAGS_CRMD_PG, enabling LASX instructions even when CSR_EUEN.ASXE=0.

---
  target/loongarch/cpu.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target/loongarch/cpu.h +0 -0
index f125a8e49b..79ad79a289 100644

target/loongarch/cpu.h static inline void set_pc(CPULoongArchState *env, uint64_t value) · line 468

Quoted 8 lines
target/loongarch/cpu.h +1 -1
@@ -462,7 +462,7 @@ static inline void set_pc(CPULoongArchState *env, uint64_t value)
  #define HW_FLAGS_CRMD_PG    R_CSR_CRMD_PG_MASK   /* 0x10 */
  #define HW_FLAGS_EUEN_FPE   0x04
  #define HW_FLAGS_EUEN_SXE   0x08
-#define HW_FLAGS_EUEN_ASXE  0x10
+#define HW_FLAGS_EUEN_ASXE  0x40
  #define HW_FLAGS_VA32       0x20
 
  static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,

Better to put all defines in bit order, otherwise it will be easy to make the same mistake again.

With that,

r~

Reviewed-by
#2 lore raw
Quoted 24 lines · Richard Henderson
Quoted 13 lines · Jiajie Chen

HW_FLAGS_EUEN_ASXE acccidentally conflicts with HW_FLAGS_CRMD_PG, enabling LASX instructions even when CSR_EUEN.ASXE=0.

---
  target/loongarch/cpu.h | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
target/loongarch/cpu.h +0 -0
index f125a8e49b..79ad79a289 100644

target/loongarch/cpu.h static inline void set_pc(CPULoongArchState *env, · line 468

Quoted 8 lines
target/loongarch/cpu.h +1 -1
@@ -462,7 +462,7 @@ static inline void set_pc(CPULoongArchState *env, 
 uint64_t value)
   #define HW_FLAGS_CRMD_PG    R_CSR_CRMD_PG_MASK   /* 0x10 */
   #define HW_FLAGS_EUEN_FPE   0x04
   #define HW_FLAGS_EUEN_SXE   0x08
-#define HW_FLAGS_EUEN_ASXE  0x10
+#define HW_FLAGS_EUEN_ASXE  0x40
   #define HW_FLAGS_VA32       0x20
   static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,

Better to put all defines in bit order, otherwise it will be easy to make the same mistake again.

Quoted 5 lines
Quoted 1 line

With that,

r

Thanks.
Song Gao