From: Nils Asmussen Date: Fri, 14 Feb 2020 16:35:30 +0000 (+0100) Subject: arch-riscv: make accesses to CSRs SerializeAfter. X-Git-Tag: v20.0.0.0~113 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3f3a84cfb5911f08efc4a217a22216f2e96477a;p=gem5.git arch-riscv: make accesses to CSRs SerializeAfter. According to page 57 in the RISC-V manual, CSR accesses "need to be performed in program order with respect to those instructions whose execution behavior is affected by the state of the accessed CSR". Thus, we need to make them SerializeAfter to ensure that the following instructions are executed with the potential changes to the CSR. In theory, we could be smarter here by only considering write accesses to CSRs and considering the following instructions, but for now we simply serialize for every CSR access. Change-Id: I69391fccaec31c34d944c55bac2f04d37947ebfe Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25655 Tested-by: kokoro Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com> Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- diff --git a/src/arch/riscv/isa/decoder.isa b/src/arch/riscv/isa/decoder.isa index 8dad14caa..9e65ecf5c 100644 --- a/src/arch/riscv/isa/decoder.isa +++ b/src/arch/riscv/isa/decoder.isa @@ -1842,27 +1842,27 @@ decode QUADRANT default Unknown::unknown() { 0x1: csrrw({{ Rd = data; data = Rs1; - }}, IsNonSpeculative, No_OpClass); + }}, IsSerializeAfter, IsNonSpeculative, No_OpClass); 0x2: csrrs({{ Rd = data; data |= Rs1; - }}, IsNonSpeculative, No_OpClass); + }}, IsSerializeAfter, IsNonSpeculative, No_OpClass); 0x3: csrrc({{ Rd = data; data &= ~Rs1; - }}, IsNonSpeculative, No_OpClass); + }}, IsSerializeAfter, IsNonSpeculative, No_OpClass); 0x5: csrrwi({{ Rd = data; data = uimm; - }}, IsNonSpeculative, No_OpClass); + }}, IsSerializeAfter, IsNonSpeculative, No_OpClass); 0x6: csrrsi({{ Rd = data; data |= uimm; - }}, IsNonSpeculative, No_OpClass); + }}, IsSerializeAfter, IsNonSpeculative, No_OpClass); 0x7: csrrci({{ Rd = data; data &= ~uimm; - }}, IsNonSpeculative, No_OpClass); + }}, IsSerializeAfter, IsNonSpeculative, No_OpClass); } }