>
> static int get_physical_address_spmp(CPURISCVState *env, int *prot, hwaddr
> addr,
> +                                    int size, int access_type,
> +                                    int mode)
> +{
> +    spmp_priv_t spmp_priv;
> +
> +    if (!riscv_cpu_cfg(env)->spmp) {
> +        *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
> +        return TRANSLATE_SUCCESS;
> +    }
> +
> +    if (!spmp_hart_has_privs(env, addr, size, 1 << access_type,
> &spmp_priv,
> +                            mode)) {
> +        *prot = 0;
> +        return TRANSLATE_SPMP_FAIL;
> +    }
> +
> +    *prot = spmp_priv_to_page_prot(spmp_priv);
> +
> +    return TRANSLATE_SUCCESS;
> +}
> +
> +

There is one extra blank


> @@ -1634,7 +1671,8 @@ static void raise_mmu_exception(CPURISCVState *env,
> target_ulong address,
>      case MMU_DATA_LOAD:
>          if (pmp_violation) {
>              cs->exception_index = RISCV_EXCP_LOAD_ACCESS_FAULT;
> -        } else if (two_stage && !first_stage) {
> +        } else if ((two_stage && !first_stage) ||
> +                    (env->virt_enabled && spmp_violation)) {
>
Nit: align the parameters.

>              cs->exception_index = RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT;
>          } else {
>              cs->exception_index = RISCV_EXCP_LOAD_PAGE_FAULT;
> @@ -1643,7 +1681,8 @@ static void raise_mmu_exception(CPURISCVState *env,
> target_ulong address,
>      case MMU_DATA_STORE:
>          if (pmp_violation) {
>              cs->exception_index = RISCV_EXCP_STORE_AMO_ACCESS_FAULT;
> -        } else if (two_stage && !first_stage) {
> +        } else if ((two_stage && !first_stage) ||
> +                    (env->virt_enabled && spmp_violation)) {
>
Nit: align the parameters.

Reply via email to