diff --git a/configs/riscv64-dual-xs-ref_defconfig b/configs/riscv64-dual-xs-ref_defconfig index c708e7e54..1a83d8b61 100644 --- a/configs/riscv64-dual-xs-ref_defconfig +++ b/configs/riscv64-dual-xs-ref_defconfig @@ -155,6 +155,7 @@ CONFIG_AC_NONE=y CONFIG_VECTOR_AC_SOFT=y CONFIG_MMIO_AC_SOFT=y CONFIG_AMO_AC_SOFT=y +CONFIG_RESERVATION_SET_WIDTH=6 # # Processor difftest reference config diff --git a/configs/riscv64-xs-ahead-ref_defconfig b/configs/riscv64-xs-ahead-ref_defconfig index 88be0c629..b3ded697e 100644 --- a/configs/riscv64-xs-ahead-ref_defconfig +++ b/configs/riscv64-xs-ahead-ref_defconfig @@ -110,6 +110,7 @@ CONFIG_FPU_SOFT=y # CONFIG_AC_HOST is not set CONFIG_AC_SOFT=y # CONFIG_AC_NONE is not set +CONFIG_RESERVATION_SET_WIDTH=6 # # Processor difftest reference config diff --git a/configs/riscv64-xs-cpt_defconfig b/configs/riscv64-xs-cpt_defconfig index a14b5ba73..e3c33814a 100644 --- a/configs/riscv64-xs-cpt_defconfig +++ b/configs/riscv64-xs-cpt_defconfig @@ -171,6 +171,7 @@ CONFIG_AC_NONE=y CONFIG_VECTOR_AC_SOFT=y CONFIG_MMIO_AC_SOFT=y CONFIG_AMO_AC_SOFT=y +CONFIG_RESERVATION_SET_WIDTH=6 # # Processor difftest reference config diff --git a/configs/riscv64-xs-diff-spike-agnostic_defconfig b/configs/riscv64-xs-diff-spike-agnostic_defconfig index 4bf5ad385..1a64fdd01 100644 --- a/configs/riscv64-xs-diff-spike-agnostic_defconfig +++ b/configs/riscv64-xs-diff-spike-agnostic_defconfig @@ -155,6 +155,7 @@ CONFIG_FPU_SOFT=y # CONFIG_AC_HOST is not set CONFIG_AC_SOFT=y # CONFIG_AC_NONE is not set +CONFIG_RESERVATION_SET_WIDTH=6 # # Processor difftest reference config diff --git a/configs/riscv64-xs-diff-spike_defconfig b/configs/riscv64-xs-diff-spike_defconfig index 8bbcde6cc..6e746671a 100644 --- a/configs/riscv64-xs-diff-spike_defconfig +++ b/configs/riscv64-xs-diff-spike_defconfig @@ -173,6 +173,7 @@ CONFIG_AC_NONE=y # CONFIG_VECTOR_AC_SOFT is not set # CONFIG_MMIO_AC_SOFT is not set # CONFIG_AMO_AC_SOFT is not set +CONFIG_RESERVATION_SET_WIDTH=6 # # Processor difftest reference config diff --git a/configs/riscv64-xs-fpga_defconfig b/configs/riscv64-xs-fpga_defconfig index d920588d1..a666e52e9 100644 --- a/configs/riscv64-xs-fpga_defconfig +++ b/configs/riscv64-xs-fpga_defconfig @@ -117,6 +117,7 @@ CONFIG_FPU_SOFT=y # CONFIG_AC_HOST is not set CONFIG_AC_SOFT=y # CONFIG_AC_NONE is not set +CONFIG_RESERVATION_SET_WIDTH=6 # # Processor difftest reference config diff --git a/configs/riscv64-xs-novga_defconfig b/configs/riscv64-xs-novga_defconfig index 486bebb47..5985aa612 100644 --- a/configs/riscv64-xs-novga_defconfig +++ b/configs/riscv64-xs-novga_defconfig @@ -111,6 +111,7 @@ CONFIG_FPU_SOFT=y # CONFIG_AC_HOST is not set CONFIG_AC_SOFT=y # CONFIG_AC_NONE is not set +CONFIG_RESERVATION_SET_WIDTH=6 # # Processor difftest reference config diff --git a/configs/riscv64-xs-ref_defconfig b/configs/riscv64-xs-ref_defconfig index 8ffd8868f..f3b89a66f 100644 --- a/configs/riscv64-xs-ref_defconfig +++ b/configs/riscv64-xs-ref_defconfig @@ -156,6 +156,7 @@ CONFIG_AC_NONE=y CONFIG_VECTOR_AC_SOFT=y CONFIG_MMIO_AC_SOFT=y CONFIG_AMO_AC_SOFT=y +CONFIG_RESERVATION_SET_WIDTH=6 # # Processor difftest reference config diff --git a/configs/riscv64-xs_defconfig b/configs/riscv64-xs_defconfig index 798e14819..43036c9a4 100644 --- a/configs/riscv64-xs_defconfig +++ b/configs/riscv64-xs_defconfig @@ -176,6 +176,7 @@ CONFIG_AC_NONE=y CONFIG_VECTOR_AC_SOFT=y CONFIG_MMIO_AC_SOFT=y CONFIG_AMO_AC_SOFT=y +CONFIG_RESERVATION_SET_WIDTH=6 # # Processor difftest reference config diff --git a/src/isa/riscv64/Kconfig b/src/isa/riscv64/Kconfig index 012a4e7f5..331c2a671 100644 --- a/src/isa/riscv64/Kconfig +++ b/src/isa/riscv64/Kconfig @@ -451,4 +451,8 @@ config RV_ZCB bool "RISC-V Zcb Extension, Version 1.0.0" default n +config RESERVATION_SET_WIDTH + int "The Width of the Reservation Set Size" + default 0 + endmenu diff --git a/src/isa/riscv64/instr/rva/amo.c b/src/isa/riscv64/instr/rva/amo.c index 0cd0d75d7..9acf943d8 100644 --- a/src/isa/riscv64/instr/rva/amo.c +++ b/src/isa/riscv64/instr/rva/amo.c @@ -57,7 +57,7 @@ def_rtl(amo_slow_path, rtlreg_t *dest, const rtlreg_t *src1, const rtlreg_t *src cpu.amo = true; #endif // should check overlapping instead of equality - int success = (cpu.lr_addr == *src1) && cpu.lr_valid; + int success = ((cpu.lr_addr ^ *src1) >> CONFIG_RESERVATION_SET_WIDTH == 0) && cpu.lr_valid; Logti("cpu sc addr=%lx scr1=%lx vaild=%ld success=%d", cpu.lr_addr,*src1, cpu.lr_valid,success); cpu.lr_valid = 0; if (success) {