qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] target/riscv: Check PMP rules num before propagation


From: Alistair Francis
Subject: Re: [PATCH] target/riscv: Check PMP rules num before propagation
Date: Wed, 17 Nov 2021 10:03:10 +1000

On Wed, Nov 17, 2021 at 1:12 AM LIU Zhiwei <zhiwei_liu@c-sky.com> wrote:
>
> If PMP rules number is zero, it should not influence the TLB entry for
> M-mode program.

This doesn't sound right. From what I can tell if we have no rules
pmp_is_range_in_tlb() shouldn't have an effect on the tlb_size. What
error are you seeing?

Alistair

>
> Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
> ---
>  target/riscv/cpu_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
> index 9eeed38c7e..48da872d39 100644
> --- a/target/riscv/cpu_helper.c
> +++ b/target/riscv/cpu_helper.c
> @@ -376,7 +376,7 @@ static int get_physical_address_pmp(CPURISCVState *env, 
> int *prot,
>      }
>
>      *prot = pmp_priv_to_page_prot(pmp_priv);
> -    if (tlb_size != NULL) {
> +    if ((tlb_size != NULL) && pmp_get_num_rules(env)) {
>          if (pmp_is_range_in_tlb(env, addr & ~(*tlb_size - 1), 
> &tlb_size_pmp)) {
>              *tlb_size = tlb_size_pmp;
>          }
> --
> 2.25.1
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]