target/xtensa: implement options for modern cores
cover target/xtensa: implement options for modern cores
Hello,
this series implements options used by the modern xtensa cores: memory protection unit, block prefetch and exclusive access and adds special register definitions and IRQ types for a few other options not fully
implemented: ECC/parity, scatter/gather and IDMA.
Max Filippov (9):
target/xtensa: get rid of centralized SR properties target/xtensa: make internal MMU functions static target/xtensa: define IDMA and gather/scatter IRQ types target/xtensa: add parity/ECC option SRs target/xtensa: implement MPU option target/xtensa: implement DIWBUI.P opcode target/xtensa: implement block prefetch option opcodes target/xtensa: update list of exception causes target/xtensa: implement exclusive access option
target/xtensa/cpu.c | 2 +- target/xtensa/cpu.h | 58 +- target/xtensa/helper.c | 1 + target/xtensa/helper.h | 6 + target/xtensa/mmu_helper.c | 532 ++++++- target/xtensa/op_helper.c | 42 + target/xtensa/overlay_tool.h | 43 +- target/xtensa/translate.c | 2951 ++++++++++++++++++++++++------------- tests/tcg/xtensa/test_exclusive.S | 48 + 9 files changed, 2574 insertions(+), 1109 deletions(-) create mode 100644 tests/tcg/xtensa/test_exclusive.S
Signature · 1 line
2.11.0
PATCH 1/9 target/xtensa: get rid of centralized SR properties
SR numbers are not unique: different Xtensa options may reuse SR number for different purposes. Introduce generic rsr/wsr functions and xsr template and use them instead of centralized SR access functions. Change prototypes of specific rsr/wsr functions to match XtensaOpcodeOp and use them instead of centralized SR access functions. Put xtensa option that introduces SR into the second opcode description parameter and use it to test for rsr/wsr/xsr opcode validity. Extract SR and UR names for the xtensa_cpu_dump_state from libisa. Merge SRs and URs in the dump. Register names of used SR/UR in init_libisa and use these names for TCG globals referencing these SR/UR.
--- target/xtensa/cpu.h | 1 + target/xtensa/helper.c | 1 + target/xtensa/translate.c | 2503 +++++++++++++++++++++++++++------------------ 3 files changed, 1492 insertions(+), 1013 deletions(-)
target/xtensa/cpu.h +1 -0
@@ -589,6 +589,7 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,#define XTENSA_DEFAULT_CPU_NOMMU_TYPE \ XTENSA_CPU_TYPE_NAME(XTENSA_DEFAULT_CPU_NOMMU_MODEL) +void xtensa_collect_sr_names (const XtensaConfig *config);void xtensa_translate_init (void );void **xtensa_get_regfile_by_name (const char *name);void xtensa_breakpoint_handler (CPUState *cs);
target/xtensa/helper.c +1 -0
@@ -141,6 +141,7 @@ static void init_libisa(XtensaConfig *config) }#endif } +xtensa_collect_sr_names (config); }static void xtensa_finalize_config (XtensaConfig *config)
target/xtensa/translate.c +1490 -1013
2,986 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.11.0
Part of the diff is not shown here. View the raw message.
PATCH 2/9 target/xtensa: make internal MMU functions static
In reply to Max FilippovRemove declarations of the internal mmu_helper functions from the cpu.h, make these functions static and shuffle them.
--- target/xtensa/cpu.h | 19 ------ target/xtensa/mmu_helper.c | 163 ++++++++++++++++++++++++--------------------- 2 files changed, 87 insertions(+), 95 deletions(-)
target/xtensa/cpu.h +0 -19
@@ -658,17 +658,6 @@ static inline int xtensa_get_cring(const CPUXtensaState *env) }#ifndef CONFIG_USER_ONLY -uint32_t xtensa_tlb_get_addr_mask (const CPUXtensaState *env, -bool dtlb,uint32_t way); -void split_tlb_entry_spec_way (const CPUXtensaState *env,uint32_t v,bool dtlb, -uint32_t *vpn,uint32_t wi,uint32_t *ei); -int xtensa_tlb_lookup (const CPUXtensaState *env,uint32_t addr,bool dtlb, -uint32_t *pwi,uint32_t *pei,uint8_t *pring); -void xtensa_tlb_set_entry_mmu (const CPUXtensaState *env, -xtensa_tlb_entry *entry,bool dtlb, -unsigned wi,unsigned ei,uint32_t vpn,uint32_t pte); -void xtensa_tlb_set_entry (CPUXtensaState *env,bool dtlb, -unsigned wi,unsigned ei,uint32_t vpn,uint32_t pte);int xtensa_get_physical_addr (CPUXtensaState *env,bool update_tlb,uint32_t vaddr,int is_write,int mmu_idx,uint32_t *paddr,uint32_t *page_size,unsigned *access);
@@ -679,14 +668,6 @@ static inline MemoryRegion *xtensa_get_er_region(CPUXtensaState *env) {return env->system_er; } - -static inline xtensa_tlb_entry *xtensa_tlb_get_entry (CPUXtensaState *env, -bool dtlb,unsigned wi,unsigned ei) -{ -return dtlb ? - env->dtlb[wi] + ei : - env->itlb[wi] + ei; -}#endif static inline uint32_t xtensa_replicate_windowstart (CPUXtensaState *env)
target/xtensa/mmu_helper.c +87 -76
211 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH 3/9 target/xtensa: define IDMA and gather/scatter IRQ types
In reply to Max FilippovIDMA and scatter/gather features introduced new IRQ types that overlay_tool.h need to initialize Xtensa configuration.
--- target/xtensa/cpu.h | 3 +++ target/xtensa/overlay_tool.h | 3 +++ 2 files changed, 6 insertions(+)
target/xtensa/cpu.h +3 -0
@@ -298,6 +298,9 @@ typedef enum {INTTYPE_DEBUG ,INTTYPE_WRITE_ERR ,INTTYPE_PROFILING , +INTTYPE_IDMA_DONE , +INTTYPE_IDMA_ERR , +INTTYPE_GS_ERR , INTTYPE_MAX } interrupt_type;
target/xtensa/overlay_tool.h +3 -0
@@ -200,6 +200,9 @@#define XTHAL_INTTYPE_TBD2 INTTYPE_WRITE_ERR#define XTHAL_INTTYPE_WRITE_ERROR INTTYPE_WRITE_ERR#define XTHAL_INTTYPE_PROFILING INTTYPE_PROFILING +#define XTHAL_INTTYPE_IDMA_DONE INTTYPE_IDMA_DONE +#define XTHAL_INTTYPE_IDMA_ERR INTTYPE_IDMA_ERR +#define XTHAL_INTTYPE_GS_ERR INTTYPE_GS_ERR#define INTERRUPT (i) { \
Signature · 1 line
2.11.0
PATCH 4/9 target/xtensa: add parity/ECC option SRs
In reply to Max FilippovAdd SRs and rsr/wsr/xsr opcodes defined by the parity/ECC xtensa option. The implementation is trivial since we don't emulate parity/ECC yet.
--- target/xtensa/cpu.h | 6 ++ target/xtensa/overlay_tool.h | 2 + target/xtensa/translate.c | 162 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+)
target/xtensa/cpu.h +6 -0
@@ -144,6 +144,12 @@ enum {CACHEATTR =98 ,ATOMCTL =99 ,DDR =104 , +MEPC =106 , +MEPS =107 , +MESAVE =108 , +MESR =109 , +MECR =110 , +MEVADDR =111 ,IBREAKA =128 ,DBREAKA =144 , DBREAKC = 160,
target/xtensa/overlay_tool.h +2 -0
@@ -112,6 +112,8 @@XCHAL_OPTION (XCHAL_DCACHE_LINE_LOCKABLE , \XTENSA_OPTION_DCACHE_INDEX_LOCK ) | \XCHAL_OPTION (XCHAL_UNALIGNED_LOAD_HW ,XTENSA_OPTION_HW_ALIGNMENT ) | \ +XCHAL_OPTION (XCHAL_HAVE_MEM_ECC_PARITY , \ +XTENSA_OPTION_MEMORY_ECC_PARITY ) | \/* Memory protection and translation */ \XCHAL_OPTION (XCHAL_HAVE_MIMIC_CACHEATTR , \ XTENSA_OPTION_REGION_PROTECTION) | \
target/xtensa/translate.c +162 -0
180 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH 5/9 target/xtensa: implement MPU option
In reply to Max FilippovThe Memory Protection Unit Option (MPU) is a combined instruction and data memory protection unit with more protection flexibility than the Region Protection Option or the Region Translation Option but without any translation capability. It does no demand paging and does not reference a memory-based page table.
Add memory protection unit option, internal state, SRs and opcodes. Implement MPU entries dumping in dump_mmu.
--- target/xtensa/cpu.c | 1 - target/xtensa/cpu.h | 17 ++ target/xtensa/helper.h | 5 + target/xtensa/mmu_helper.c | 369 +++++++++++++++++++++++++++++++++++++++++++ target/xtensa/overlay_tool.h | 29 ++++ target/xtensa/translate.c | 146 +++++++++++++++++ 6 files changed, 566 insertions(+), 1 deletion(-)
target/xtensa/cpu.c +0 -1
@@ -78,7 +78,6 @@ static void xtensa_cpu_reset(CPUState *s) env->sregs[VECBASE ] = env->config->vecbase; env->sregs[IBREAKENABLE ] =0 ; env->sregs[MEMCTL ] =MEMCTL_IL0EN & env->config->memctl_mask; - env->sregs[CACHEATTR ] =0x22222222 ; env->sregs[ATOMCTL ] =xtensa_option_enabled (env->config,XTENSA_OPTION_ATOMCTL ) ?0x28 :0x15 ; env->sregs[CONFIGID0 ] = env->config->configid[0 ];
target/xtensa/cpu.h +17 -0
@@ -99,6 +99,7 @@ enum {/* Memory protection and translation */ XTENSA_OPTION_REGION_PROTECTION ,XTENSA_OPTION_REGION_TRANSLATION , +XTENSA_OPTION_MPU ,XTENSA_OPTION_MMU , XTENSA_OPTION_CACHEATTR,
@@ -137,11 +138,15 @@ enum {PTEVADDR =83 ,MMID =89 ,RASID =90 , +MPUENB =90 ,ITLBCFG =91 ,DTLBCFG =92 , +MPUCFG =92 , +ERACCESS =95 ,IBREAKENABLE =96 ,MEMCTL =97 ,CACHEATTR =98 , +CACHEADRDIS =98 ,ATOMCTL =99 ,DDR =104 , MEPC = 106,
@@ -234,6 +239,7 @@ enum {#define MAX_TLB_WAY_SIZE 8#define MAX_NDBREAK 2#define MAX_NMEMORY 4 +#define MAX_MPU_FOREGROUND_SEGMENTS 32#define REGION_PAGE_MASK 0xe0000000
@@ -327,6 +333,11 @@ typedef struct xtensa_tlb {unsigned nrefillentries; } xtensa_tlb; +typedef struct xtensa_mpu_entry { +uint32_t vaddr; +uint32_t attr; +}xtensa_mpu_entry ; + typedef struct XtensaGdbReg { int targno; unsigned flags;
@@ -477,6 +488,11 @@ struct XtensaConfig {xtensa_tlb itlb;xtensa_tlb dtlb; + +uint32_t mpu_align; +unsigned n_mpu_fg_segments; +unsigned n_mpu_bg_segments; +const xtensa_mpu_entry *mpu_bg; }; typedef struct XtensaConfigList {
@@ -513,6 +529,7 @@ typedef struct CPUXtensaState {#ifndef CONFIG_USER_ONLY xtensa_tlb_entry itlb[7 ][MAX_TLB_WAY_SIZE ];xtensa_tlb_entry dtlb[10 ][MAX_TLB_WAY_SIZE ]; +xtensa_mpu_entry mpu_fg[MAX_MPU_FOREGROUND_SEGMENTS ];unsigned autorefill_idx;bool runstall;AddressSpace *address_space_er;
target/xtensa/helper.h +5 -0
@@ -33,6 +33,11 @@ DEF_HELPER_FLAGS_3(rtlb1, TCG_CALL_NO_RWG_SE, i32, env, i32, i32) DEF_HELPER_3(itlb, void, env, i32, i32) DEF_HELPER_3(ptlb, i32, env, i32, i32) DEF_HELPER_4(wtlb, void, env, i32, i32, i32) +DEF_HELPER_2(wsr_mpuenb, void, env, i32) +DEF_HELPER_3(wptlb, void, env, i32, i32) +DEF_HELPER_FLAGS_2(rptlb0, TCG_CALL_NO_RWG_SE, i32, env, i32) +DEF_HELPER_FLAGS_2(rptlb1, TCG_CALL_NO_RWG_SE, i32, env, i32) +DEF_HELPER_2(pptlb, i32, env, i32) DEF_HELPER_2(wsr_ibreakenable, void, env, i32)DEF_HELPER_3 (wsr_ibreaka, void, env, i32, i32)
target/xtensa/mmu_helper.c +369 -0
412 lines not on this page · raw message
target/xtensa/overlay_tool.h +29 -0
@@ -72,6 +72,10 @@#define XCHAL_HAVE_EXTERN_REGS 0#endif +#ifndef XCHAL_HAVE_MPU +#define XCHAL_HAVE_MPU 0 +#endif +#define XCHAL_OPTION (xchal, qemu) ((xchal) ? XTENSA_OPTION_BIT(qemu) : 0)#define XTENSA_OPTIONS ( \
@@ -119,6 +123,7 @@ XTENSA_OPTION_REGION_PROTECTION) | \XCHAL_OPTION (XCHAL_HAVE_XLT_CACHEATTR , \XTENSA_OPTION_REGION_TRANSLATION ) | \ +XCHAL_OPTION (XCHAL_HAVE_MPU ,XTENSA_OPTION_MPU ) | \XCHAL_OPTION (XCHAL_HAVE_PTP_MMU ,XTENSA_OPTION_MMU ) | \XCHAL_OPTION (XCHAL_HAVE_CACHEATTR ,XTENSA_OPTION_CACHEATTR ) | \ /* Other, TODO */ \
@@ -361,6 +366,30 @@#define XCHAL_SYSRAM0_SIZE 0x04000000#endif +#elif XCHAL_HAVE_MPU + +#ifndef XTENSA_MPU_BG_MAP +#define XTENSA_MPU_BG_MAP (xtensa_mpu_entry []){\ + { .vaddr = 0, .attr = 0x00006700, }, \ +} +#endif + +#define TLB_SECTION \ + .mpu_align = XCHAL_MPU_ALIGN, \ + .n_mpu_fg_segments = XCHAL_MPU_ENTRIES, \ + .n_mpu_bg_segments = 1, \ + .mpu_bg = XTENSA_MPU_BG_MAP + +#ifndef XCHAL_SYSROM0_PADDR +#define XCHAL_SYSROM0_PADDR 0x50000000 +#define XCHAL_SYSROM0_SIZE 0x04000000 +#endif + +#ifndef XCHAL_SYSRAM0_PADDR +#define XCHAL_SYSRAM0_PADDR 0x60000000 +#define XCHAL_SYSRAM0_SIZE 0x04000000 +#endif +#else #ifndef XCHAL_SYSROM0_PADDR
target/xtensa/translate.c +146 -0
248 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH 6/9 target/xtensa: implement DIWBUI.P opcode
In reply to Max FilippovThis is a recent addition to the set of data cache opcodes.
--- target/xtensa/cpu.h | 1 + target/xtensa/overlay_tool.h | 1 + target/xtensa/translate.c | 10 ++++++++++ 3 files changed, 12 insertions(+)
target/xtensa/cpu.h +1 -0
@@ -466,6 +466,7 @@ struct XtensaConfig {unsigned icache_ways;unsigned dcache_ways; +unsigned dcache_line_bytes;uint32_t memctl_mask;XtensaMemory instrom;
target/xtensa/overlay_tool.h +1 -0
@@ -425,6 +425,7 @@#define CACHE_SECTION \ .icache_ways = XCHAL_ICACHE_WAYS, \ .dcache_ways = XCHAL_DCACHE_WAYS, \ + .dcache_line_bytes = XCHAL_DCACHE_LINESIZE, \ .memctl_mask = \ (XCHAL_ICACHE_SIZE ? MEMCTL_IUSEWAYS_MASK : 0) | \ (XCHAL_DCACHE_SIZE ? \
target/xtensa/translate.c +10 -0
@@ -1620,6 +1620,12 @@ static void translate_depbits(DisasContext *dc, const OpcodeArg arg[], arg[2].imm, arg[3].imm); } +static void translate_diwbuip (DisasContext *dc,const OpcodeArg arg[], +const uint32_t par[]) +{ +tcg_gen_addi_i32 (arg[0 ].out, arg[0 ].in, dc->config->dcache_line_bytes); +} +static bool test_ill_entry (DisasContext *dc,const OpcodeArg arg[],const uint32_t par[]) {
@@ -3098,6 +3104,10 @@ static const XtensaOpcodeOps core_ops[] = { .translate = translate_nop, .op_flags = XTENSA_OP_PRIVILEGED, }, { + .name = "diwbui.p", + .translate = translate_diwbuip, + .op_flags = XTENSA_OP_PRIVILEGED, + }, { .name = "dpfl", .translate = translate_dcache, .op_flags = XTENSA_OP_PRIVILEGED,
Signature · 1 line
2.11.0
PATCH 7/9 target/xtensa: implement block prefetch option opcodes
In reply to Max FilippovBlock prefetch option adds a bunch of non-privileged opcodes that may be implemented as nops since QEMU doesn't model caches.
--- target/xtensa/translate.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
target/xtensa/translate.c +42 -0
@@ -3078,6 +3078,9 @@ static const XtensaOpcodeOps core_ops[] = { .translate = translate_dcache, .op_flags = XTENSA_OP_PRIVILEGED, }, { + .name = "dhi.b", + .translate = translate_nop, + }, { .name = "dhu", .translate = translate_dcache, .op_flags = XTENSA_OP_PRIVILEGED,
@@ -3085,9 +3088,15 @@ static const XtensaOpcodeOps core_ops[] = { .name = "dhwb", .translate = translate_dcache, }, { + .name = "dhwb.b", + .translate = translate_nop, + }, { .name = "dhwbi", .translate = translate_dcache, }, { + .name = "dhwbi.b", + .translate = translate_nop, + }, { .name = "dii", .translate = translate_nop, .op_flags = XTENSA_OP_PRIVILEGED,
@@ -3112,15 +3121,33 @@ static const XtensaOpcodeOps core_ops[] = { .translate = translate_dcache, .op_flags = XTENSA_OP_PRIVILEGED, }, { + .name = "dpfm.b", + .translate = translate_nop, + }, { + .name = "dpfm.bf", + .translate = translate_nop, + }, { .name = "dpfr", .translate = translate_nop, }, { + .name = "dpfr.b", + .translate = translate_nop, + }, { + .name = "dpfr.bf", + .translate = translate_nop, + }, { .name = "dpfro", .translate = translate_nop, }, { .name = "dpfw", .translate = translate_nop, }, { + .name = "dpfw.b", + .translate = translate_nop, + }, { + .name = "dpfw.bf", + .translate = translate_nop, + }, { .name = "dpfwo", .translate = translate_nop, }, {
@@ -3628,6 +3655,21 @@ static const XtensaOpcodeOps core_ops[] = { .par = (const uint32_t[]){true}, .op_flags = XTENSA_OP_PRIVILEGED, }, { + .name = "pfend.a", + .translate = translate_nop, + }, { + .name = "pfend.o", + .translate = translate_nop, + }, { + .name = "pfnxt.f", + .translate = translate_nop, + }, { + .name = "pfwait.a", + .translate = translate_nop, + }, { + .name = "pfwait.o", + .translate = translate_nop, + }, { .name = "pitlb", .translate = translate_ptlb, .par = (const uint32_t[]){false},
Signature · 1 line
2.11.0
Re: [Qemu-devel] [PATCH 7/9] target/xtensa: implement block prefetch option opcodes
Quoted 85 lines · Max Filippov
Block prefetch option adds a bunch of non-privileged opcodes that may be implemented as nops since QEMU doesn't model caches.
Signed-off-by Max Filippov <[email protected]>--- target/xtensa/translate.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)target/xtensa/translate.c +35
-0@@ -3078,6 +3078,9 @@ static const XtensaOpcodeOps core_ops[] = { .translate = translate_dcache, .op_flags = XTENSA_OP_PRIVILEGED, }, { + .name = "dhi.b", + .translate = translate_nop, + }, { .name = "dhu", .translate = translate_dcache, .op_flags = XTENSA_OP_PRIVILEGED,@@ -3085,9 +3088,15 @@ static const XtensaOpcodeOps core_ops[] = { .name = "dhwb", .translate = translate_dcache, }, { + .name = "dhwb.b", + .translate = translate_nop, + }, { .name = "dhwbi", .translate = translate_dcache, }, { + .name = "dhwbi.b", + .translate = translate_nop, + }, { .name = "dii", .translate = translate_nop, .op_flags = XTENSA_OP_PRIVILEGED,@@ -3112,15 +3121,33 @@ static const XtensaOpcodeOps core_ops[] = { .translate = translate_dcache, .op_flags = XTENSA_OP_PRIVILEGED, }, { + .name = "dpfm.b", + .translate = translate_nop, + }, { + .name = "dpfm.bf", + .translate = translate_nop, + }, { .name = "dpfr", .translate = translate_nop, }, { + .name = "dpfr.b", + .translate = translate_nop, + }, { + .name = "dpfr.bf", + .translate = translate_nop, + }, { .name = "dpfro", .translate = translate_nop, }, { .name = "dpfw", .translate = translate_nop, }, { + .name = "dpfw.b", + .translate = translate_nop, + }, { + .name = "dpfw.bf", + .translate = translate_nop, + }, { .name = "dpfwo", .translate = translate_nop, }, {@@ -3628,6 +3655,21 @@ static const XtensaOpcodeOps core_ops[] = { .par = (const uint32_t[]){true}, .op_flags = XTENSA_OP_PRIVILEGED, }, { + .name = "pfend.a", + .translate = translate_nop, + }, { + .name = "pfend.o", + .translate = translate_nop, + }, { + .name = "pfnxt.f", + .translate = translate_nop,
target/xtensa/translate.c static const XtensaOpcodeOps core_ops[] = { · line 3675
Quoted 10 lines
target/xtensa/translate.c +7
-0+ }, { + .name = "pfwait.a", + .translate = translate_nop, + }, { + .name = "pfwait.o", + .translate = translate_nop, + }, { .name = "pitlb", .translate = translate_ptlb, .par = (const uint32_t[]){false},
PATCH 8/9 target/xtensa: update list of exception causes
In reply to Max FilippovAdd XEA2 exception cause codes defined in recent Xtensa ISA releases.
--- target/xtensa/cpu.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
target/xtensa/cpu.h +5 -4
@@ -280,14 +280,15 @@ enum {LEVEL1_INTERRUPT_CAUSE ,ALLOCA_CAUSE ,INTEGER_DIVIDE_BY_ZERO_CAUSE , -PRIVILEGED_CAUSE =8 , +PC_VALUE_ERROR_CAUSE , +PRIVILEGED_CAUSE ,LOAD_STORE_ALIGNMENT_CAUSE , - -INSTR_PIF_DATA_ERROR_CAUSE =12 , +EXTERNAL_REG_PRIVILEGE_CAUSE , +EXCLUSIVE_ERROR_CAUSE , +INSTR_PIF_DATA_ERROR_CAUSE ,LOAD_STORE_PIF_DATA_ERROR_CAUSE ,INSTR_PIF_ADDR_ERROR_CAUSE ,LOAD_STORE_PIF_ADDR_ERROR_CAUSE , -INST_TLB_MISS_CAUSE ,INST_TLB_MULTI_HIT_CAUSE , INST_FETCH_PRIVILEGE_CAUSE,
Signature · 1 line
2.11.0
PATCH 9/9 target/xtensa: implement exclusive access option
In reply to Max FilippovThe Exclusive Instructions provide a general-purpose mechanism for atomic updates of memory-based synchronization variables that can be used for exclusion algorithms.
Use cmpxchg-based implementation that is sufficient for the typical use of exclusive access in atomic operations.
--- target/xtensa/cpu.c | 1 + target/xtensa/cpu.h | 2 + target/xtensa/helper.h | 1 + target/xtensa/op_helper.c | 42 ++++++++++++++++ target/xtensa/overlay_tool.h | 8 ++- target/xtensa/translate.c | 100 ++++++++++++++++++++++++++++++++++++++ tests/tcg/xtensa/test_exclusive.S | 48 ++++++++++++++++++ 7 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 tests/tcg/xtensa/test_exclusive.S
target/xtensa/cpu.c +1 -0
@@ -82,6 +82,7 @@ static void xtensa_cpu_reset(CPUState *s) XTENSA_OPTION_ATOMCTL) ? 0x28 : 0x15; env->sregs[CONFIGID0 ] = env->config->configid[0 ]; env->sregs[CONFIGID1 ] = env->config->configid[1 ]; + env->exclusive_addr =-1 ;#ifndef CONFIG_USER_ONLY reset_mmu (env);
target/xtensa/cpu.h +2 -0
@@ -527,6 +527,8 @@ typedef struct CPUXtensaState { } fregs[16 ];float_status fp_status;uint32_t windowbase_next; +uint32_t exclusive_addr; +uint32_t exclusive_val;#ifndef CONFIG_USER_ONLY xtensa_tlb_entry itlb[7 ][MAX_TLB_WAY_SIZE ];
target/xtensa/helper.h +1 -0
@@ -24,6 +24,7 @@ DEF_HELPER_1(check_interrupts, void, env) DEF_HELPER_2(intset, void, env, i32) DEF_HELPER_2(intclear, void, env, i32) DEF_HELPER_3(check_atomctl, void, env, i32, i32) +DEF_HELPER_4(check_exclusive, void, env, i32, i32, i32) DEF_HELPER_2(wsr_memctl, void, env, i32)DEF_HELPER_2 (itlb_hit_test, void, env, i32)
target/xtensa/op_helper.c +42 -0
48 lines not on this page · raw message
target/xtensa/overlay_tool.h +6 -2
@@ -76,6 +76,10 @@#define XCHAL_HAVE_MPU 0#endif +#ifndef XCHAL_HAVE_EXCLUSIVE +#define XCHAL_HAVE_EXCLUSIVE 0 +#endif +#define XCHAL_OPTION (xchal, qemu) ((xchal) ? XTENSA_OPTION_BIT(qemu) : 0)#define XTENSA_OPTIONS ( \
@@ -96,8 +100,8 @@XCHAL_OPTION (XCHAL_HAVE_FP ,XTENSA_OPTION_FP_COPROCESSOR ) | \XCHAL_OPTION (XCHAL_HAVE_RELEASE_SYNC ,XTENSA_OPTION_MP_SYNCHRO ) | \XCHAL_OPTION (XCHAL_HAVE_S32C1I ,XTENSA_OPTION_CONDITIONAL_STORE ) | \ -XCHAL_OPTION (XCHAL_HAVE_S32C1I &&XCHAL_HW_MIN_VERSION >=230000 , \ -XTENSA_OPTION_ATOMCTL ) | \ +XCHAL_OPTION (((XCHAL_HAVE_S32C1I &&XCHAL_HW_MIN_VERSION >=230000 ) || \ +XCHAL_HAVE_EXCLUSIVE ),XTENSA_OPTION_ATOMCTL ) | \XCHAL_OPTION (XCHAL_HAVE_DEPBITS ,XTENSA_OPTION_DEPBITS ) | \/* Interrupts and exceptions */ \ XCHAL_OPTION(XCHAL_HAVE_EXCEPTIONS, XTENSA_OPTION_EXCEPTION) | \
target/xtensa/translate.c +100 -0
160 lines not on this page · raw message
tests/tcg/xtensa/test_exclusive.S new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
2.11.0