diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-09-07 15:50:33 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-09-16 09:05:25 +0530 |
commit | 7ccf6bf54c2d7db6331f3fa319ef4e7019108c28 (patch) | |
tree | 2e54824ef04c5c3dfcfd475e16c24f89e07112f9 /lib/sbi/sbi_hsm.c | |
parent | 6734304f8c759c782cab12ecfd6c20fb23b8ee44 (diff) |
lib: sbi: Allow specifying mode in sbi_hart_pmp_check_addr() API
We extend sbi_hart_pmp_check_addr() API so that users can specify
privilege mode of the address for checking PMP access permissions.
To achieve this, we end-up converting "unsigned long *size" parameter
to "unsigned long *log2len" for pmp_get() implementation so that we
can deal with regions of "1UL << __riscv_xlen" size in a special case
in sbi_hart_pmp_check_addr() implementation.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_hsm.c')
-rw-r--r-- | lib/sbi/sbi_hsm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index b430793..8c1b7b0 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -231,7 +231,7 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid, if (hstate != SBI_HART_STOPPED) return SBI_EINVAL; - rc = sbi_hart_pmp_check_addr(scratch, saddr, PMP_X); + rc = sbi_hart_pmp_check_addr(scratch, saddr, smode, PMP_X); if (rc) return rc; //TODO: We also need to check saddr for valid physical address as well. |