Re: [PATCH v3 1/3] target/riscv: Fix tb->flags FS status

2020-01-15 Thread ShihPo Hung
On Wed, Jan 15, 2020 at 2:29 PM Alistair Francis wrote: > > -*flags = cpu_mmu_index(env, 0); > > -if (riscv_cpu_fp_enabled(env)) { > > -*flags |= TB_FLAGS_MSTATUS_FS; > > -} > > +*flags = cpu_mmu_index(env, 0) | (env->mstatus & MSTATUS_FS); > > I don't think this is

[PATCH v3 3/3] target/riscv: update mstatus.SD when FS is set dirty

2020-01-14 Thread shihpo . hung
remove the check becuase SD bit should summarize FS and XS fields unconditionally. Signed-off-by: ShihPo Hung Reviewed-by: Richard Henderson --- target/riscv/csr.c | 3 +-- target/riscv/translate.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/target/riscv/csr.c

[PATCH v3 1/3] target/riscv: Fix tb->flags FS status

2020-01-14 Thread shihpo . hung
off-by: ShihPo Hung Reviewed-by: Richard Henderson --- target/riscv/cpu.h | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index e59343e..de0a8d8 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -293,10 +293,7 @@ static inl

[PATCH v3 2/3] target/riscv: fsd/fsw doesn't dirty FP state

2020-01-14 Thread shihpo . hung
Signed-off-by: ShihPo Hung Reviewed-by: Richard Henderson --- target/riscv/insn_trans/trans_rvd.inc.c | 1 - target/riscv/insn_trans/trans_rvf.inc.c | 1 - 2 files changed, 2 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvd.inc.c b/target/riscv/insn_trans/trans_rvd.inc.c index

Re: [PATCH v2 1/3] target/riscv: Fix tb->flags FS status

2020-01-14 Thread ShihPo Hung
On Tue, Jan 14, 2020 at 11:29 PM Richard Henderson < richard.hender...@linaro.org> wrote: > On 1/14/20 12:13 AM, shihpo.h...@sifive.com wrote: > > if (riscv_cpu_fp_enabled(env)) { > > -*flags |= TB_FLAGS_MSTATUS_FS; > > +*flags |= env->mstatus & MSTATUS_FS; > > } > >

[PATCH v2 3/3] target/riscv: update mstatus.SD when FS is set dirty

2020-01-14 Thread shihpo . hung
remove the check becuase SD bit should summarize FS and XS fields unconditionally. Signed-off-by: ShihPo Hung --- target/riscv/csr.c | 3 +-- target/riscv/translate.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/csr.c b/target/riscv/csr.c index

[PATCH v2 2/3] target/riscv: fsd/fsw doesn't dirty FP state

2020-01-14 Thread shihpo . hung
Signed-off-by: ShihPo Hung --- target/riscv/insn_trans/trans_rvd.inc.c | 1 - target/riscv/insn_trans/trans_rvf.inc.c | 1 - 2 files changed, 2 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvd.inc.c b/target/riscv/insn_trans/trans_rvd.inc.c index 393fa02..ea1044f 100644 --- a/target

[PATCH v2 1/3] target/riscv: Fix tb->flags FS status

2020-01-14 Thread shihpo . hung
ode in mark_fs_dirty in translate.c that handles initial and clean states is unreachable. This patch fixes it and is successfully tested with: libquantum Thanks to Richard for pointing out the actual bug. Suggested-by: Richard Henderson Signed-off-by: ShihPo Hung --- target/riscv/cpu.h | 2 +- 1 file chan

Re: [PATCH] target/riscv: Set mstatus.DS & FS correctly

2020-01-14 Thread ShihPo Hung
On Tue, Jan 14, 2020 at 10:32 AM Richard Henderson < richard.hender...@linaro.org> wrote: > On 1/9/20 11:05 PM, shihpo.h...@sifive.com wrote: > > Because ctx->mstatus_fs changes dynamically during runtime, we should > > remove the mstatus_fs check at the translation stage. > > This change is

[PATCH] target/riscv: Set mstatus.DS & FS correctly

2020-01-10 Thread shihpo . hung
eck at the translation stage. Signed-off-by: ShihPo Hung Cc: Palmer Dabbelt Cc: Alistair Francis Cc: Sagar Karandikar Cc: Bastian Koppelmann Cc: qemu-ri...@nongnu.org --- target/riscv/csr.c | 3 +-- target/riscv/insn_trans/trans_rvd.inc.c | 1 - target/riscv/insn_trans/trans_rvf.inc.c