RISC-V: Respect fences for user-only emulators
commit3502dc824a7b0218abb49f4350e80a49829748cf
authorPalmer Dabbelt <palmer@sifive.com>
Fri, 9 Nov 2018 18:56:50 +0000 (9 10:56 -0800)
committerPalmer Dabbelt <palmer@sifive.com>
Tue, 13 Nov 2018 23:12:15 +0000 (13 15:12 -0800)
treec057e6b64222647cda9235f5c59a3cc86b12d2c6
parent657377730647c2156f1e20087e28129dc32e1242
RISC-V: Respect fences for user-only emulators

Our current fence implementation ignores fences for the user-only
configurations.  This is incorrect but unlikely to manifest: it requires
multi-threaded user-only code that takes advantage of the weakness in
the host's memory model and can be inlined by TCG.

This patch simply treats fences the same way for all our emulators.
I've given it to testing as I don't want to construct a test that would
actually trigger the failure.

Our fence implementation has an additional deficiency where we map all
RISC-V fences to full fences.  Now that we have a formal memory model
for RISC-V we can start to take advantage of the strength bits on our
fence instructions.  This requires a bit more though, so I'm going to
split it out because the implementation is still correct without taking
advantage of these weaker fences.

Thanks to Richard Henderson for pointing out both of the issues.

Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
target/riscv/translate.c