Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-24 Thread Wu, Fei
On 3/24/2023 9:02 AM, Wu, Fei wrote: > On 3/23/2023 11:53 PM, Richard Henderson wrote: >> On 3/22/23 19:44, Fei Wu wrote: >>> Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, >>> this assumption won't last as we are about to add more mmu_idx. >>> >>> Signed-off-by: Fei Wu

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-24 Thread Richard Henderson
On 3/23/23 18:20, Wu, Fei wrote: I lack some background here, why should tb_flags be preferred if env has the same info? Then for reading from tb_flags, we need to add it to tb_flags first. We read from tb_flags in translate because that proves we've added the data to tb_flags for the TB

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-24 Thread Wu, Fei
On 3/24/2023 10:37 AM, Richard Henderson wrote: > On 3/23/23 18:20, Wu, Fei wrote: >> I lack some background here, why should tb_flags be preferred if env has >> the same info? Then for reading from tb_flags, we need to add it to >> tb_flags first. > > We read from tb_flags in translate because

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-23 Thread Wu, Fei
On 3/24/2023 9:02 AM, Wu, Fei wrote: > On 3/23/2023 11:53 PM, Richard Henderson wrote: >> On 3/22/23 19:44, Fei Wu wrote: >>> Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, >>> this assumption won't last as we are about to add more mmu_idx. >>> >>> Signed-off-by: Fei Wu

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-23 Thread Wu, Fei
On 3/24/2023 12:07 AM, Richard Henderson wrote: > On 3/22/23 23:00, Wu, Fei wrote: +    ctx->priv = env->priv; >>> >>> This is not right. You should put env->priv into tb flags before you use >>> it in translation. >>> >> I see some other env usages in this function, when will env->priv and

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-23 Thread Wu, Fei
On 3/23/2023 11:53 PM, Richard Henderson wrote: > On 3/22/23 19:44, Fei Wu wrote: >> Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, >> this assumption won't last as we are about to add more mmu_idx. >> >> Signed-off-by: Fei Wu >> --- >>   target/riscv/cpu.h

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-23 Thread Richard Henderson
On 3/22/23 23:00, Wu, Fei wrote: +    ctx->priv = env->priv; This is not right. You should put env->priv into tb flags before you use it in translation. I see some other env usages in this function, when will env->priv and tb_flags.priv mismatch (assume we have recorded priv in tb_flags)?

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-23 Thread Richard Henderson
On 3/22/23 19:44, Fei Wu wrote: Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, this assumption won't last as we are about to add more mmu_idx. Signed-off-by: Fei Wu --- target/riscv/cpu.h | 1 - target/riscv/cpu_helper.c

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-23 Thread Wu, Fei
On 3/23/2023 2:59 PM, LIU Zhiwei wrote: > > On 2023/3/23 14:00, Wu, Fei wrote: >> On 3/23/2023 1:37 PM, LIU Zhiwei wrote: >>> On 2023/3/23 10:44, Fei Wu wrote: Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, this assumption won't last as we are about to add more

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-23 Thread LIU Zhiwei
On 2023/3/23 14:00, Wu, Fei wrote: On 3/23/2023 1:37 PM, LIU Zhiwei wrote: On 2023/3/23 10:44, Fei Wu wrote: Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, this assumption won't last as we are about to add more mmu_idx. For patch set has more than 1 patch, usually

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-23 Thread Wu, Fei
On 3/23/2023 2:00 PM, Wu, Fei wrote: > On 3/23/2023 1:37 PM, LIU Zhiwei wrote: >> >> On 2023/3/23 10:44, Fei Wu wrote: >>> Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, >>> this assumption won't last as we are about to add more mmu_idx. >> For patch set has more than 1

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-23 Thread Wu, Fei
On 3/23/2023 1:37 PM, LIU Zhiwei wrote: > > On 2023/3/23 10:44, Fei Wu wrote: >> Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, >> this assumption won't last as we are about to add more mmu_idx. > For patch set has more than 1 patch, usually add a cover letter. This is

Re: [PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-22 Thread LIU Zhiwei
On 2023/3/23 10:44, Fei Wu wrote: Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, this assumption won't last as we are about to add more mmu_idx. For patch set has more than 1 patch, usually add a cover letter. Signed-off-by: Fei Wu --- target/riscv/cpu.h

[PATCH v4 1/2] target/riscv: separate priv from mmu_idx

2023-03-22 Thread Fei Wu
Currently it's assumed the 2 low bits of mmu_idx map to privilege mode, this assumption won't last as we are about to add more mmu_idx. Signed-off-by: Fei Wu --- target/riscv/cpu.h | 1 - target/riscv/cpu_helper.c | 2 +-