Message ID | 20230428143621.142390-14-liweiwei@iscas.ac.cn (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | target/riscv: Fix PMP related problem | expand |
On Sat, Apr 29, 2023 at 12:38 AM Weiwei Li <liweiwei@iscas.ac.cn> wrote: > > Access will fails if access is partially inside the PMP entry. > However,only set ret = false doesn't really mean pmp violation > since pmp_hart_has_privs_default() may return true at the end of > pmp_hart_has_privs(). > > Signed-off-by: Weiwei Li <liweiwei@iscas.ac.cn> > Signed-off-by: Junqiang Wang <wangjunqiang@iscas.ac.cn> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > target/riscv/pmp.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c > index 317c28ba73..1ee8899d04 100644 > --- a/target/riscv/pmp.c > +++ b/target/riscv/pmp.c > @@ -327,8 +327,8 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr, > if ((s + e) == 1) { > qemu_log_mask(LOG_GUEST_ERROR, > "pmp violation - access is partially inside\n"); > - ret = false; > - break; > + *allowed_privs = 0; > + return false; > } > > /* fully inside */ > -- > 2.25.1 > >
diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index 317c28ba73..1ee8899d04 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -327,8 +327,8 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr, if ((s + e) == 1) { qemu_log_mask(LOG_GUEST_ERROR, "pmp violation - access is partially inside\n"); - ret = false; - break; + *allowed_privs = 0; + return false; } /* fully inside */