* [PATCH] target/riscv: Respect mseccfg.RLB bit for TOR mode PMP entry
@ 2025-02-10 15:37 Rob Bradford
2025-02-17 16:37 ` Daniel Henrique Barboza
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rob Bradford @ 2025-02-10 15:37 UTC (permalink / raw)
To: qemu-devel
Cc: Palmer Dabbelt, Bin Meng, Weiwei Li, Daniel Henrique Barboza,
qemu-riscv, Liu Zhiwei, Alistair Francis, Rob Bradford
When running in TOR mode (Top of Range) the next PMP entry controls
whether the entry is locked. However simply checking if the PMP_LOCK bit
is set is not sufficient with the Smepmp extension which now provides a
bit (mseccfg.RLB (Rule Lock Bypass)) to disregard the lock bits. In
order to respect this bit use the convenience pmp_is_locked() function
rather than directly checking PMP_LOCK since this function checks
mseccfg.RLB.
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
---
target/riscv/pmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
index a185c246d6..85ab270dad 100644
--- a/target/riscv/pmp.c
+++ b/target/riscv/pmp.c
@@ -524,7 +524,7 @@ void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index,
uint8_t pmp_cfg = env->pmp_state.pmp[addr_index + 1].cfg_reg;
is_next_cfg_tor = PMP_AMATCH_TOR == pmp_get_a_field(pmp_cfg);
- if (pmp_cfg & PMP_LOCK && is_next_cfg_tor) {
+ if (pmp_is_locked(env, addr_index + 1) && is_next_cfg_tor) {
qemu_log_mask(LOG_GUEST_ERROR,
"ignoring pmpaddr write - pmpcfg + 1 locked\n");
return;
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] target/riscv: Respect mseccfg.RLB bit for TOR mode PMP entry
2025-02-10 15:37 [PATCH] target/riscv: Respect mseccfg.RLB bit for TOR mode PMP entry Rob Bradford
@ 2025-02-17 16:37 ` Daniel Henrique Barboza
2025-02-18 2:16 ` Alistair Francis
2025-02-18 2:25 ` Alistair Francis
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Henrique Barboza @ 2025-02-17 16:37 UTC (permalink / raw)
To: Rob Bradford, qemu-devel
Cc: Palmer Dabbelt, Bin Meng, Weiwei Li, qemu-riscv, Liu Zhiwei,
Alistair Francis
On 2/10/25 12:37 PM, Rob Bradford wrote:
> When running in TOR mode (Top of Range) the next PMP entry controls
> whether the entry is locked. However simply checking if the PMP_LOCK bit
> is set is not sufficient with the Smepmp extension which now provides a
> bit (mseccfg.RLB (Rule Lock Bypass)) to disregard the lock bits. In
> order to respect this bit use the convenience pmp_is_locked() function
> rather than directly checking PMP_LOCK since this function checks
> mseccfg.RLB.
>
> Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
> ---
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> target/riscv/pmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
> index a185c246d6..85ab270dad 100644
> --- a/target/riscv/pmp.c
> +++ b/target/riscv/pmp.c
> @@ -524,7 +524,7 @@ void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index,
> uint8_t pmp_cfg = env->pmp_state.pmp[addr_index + 1].cfg_reg;
> is_next_cfg_tor = PMP_AMATCH_TOR == pmp_get_a_field(pmp_cfg);
>
> - if (pmp_cfg & PMP_LOCK && is_next_cfg_tor) {
> + if (pmp_is_locked(env, addr_index + 1) && is_next_cfg_tor) {
> qemu_log_mask(LOG_GUEST_ERROR,
> "ignoring pmpaddr write - pmpcfg + 1 locked\n");
> return;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target/riscv: Respect mseccfg.RLB bit for TOR mode PMP entry
2025-02-10 15:37 [PATCH] target/riscv: Respect mseccfg.RLB bit for TOR mode PMP entry Rob Bradford
2025-02-17 16:37 ` Daniel Henrique Barboza
@ 2025-02-18 2:16 ` Alistair Francis
2025-02-18 2:25 ` Alistair Francis
2 siblings, 0 replies; 4+ messages in thread
From: Alistair Francis @ 2025-02-18 2:16 UTC (permalink / raw)
To: Rob Bradford
Cc: qemu-devel, Palmer Dabbelt, Bin Meng, Weiwei Li,
Daniel Henrique Barboza, qemu-riscv, Liu Zhiwei, Alistair Francis
On Tue, Feb 11, 2025 at 1:38 AM Rob Bradford <rbradford@rivosinc.com> wrote:
>
> When running in TOR mode (Top of Range) the next PMP entry controls
> whether the entry is locked. However simply checking if the PMP_LOCK bit
> is set is not sufficient with the Smepmp extension which now provides a
> bit (mseccfg.RLB (Rule Lock Bypass)) to disregard the lock bits. In
> order to respect this bit use the convenience pmp_is_locked() function
> rather than directly checking PMP_LOCK since this function checks
> mseccfg.RLB.
>
> Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> target/riscv/pmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
> index a185c246d6..85ab270dad 100644
> --- a/target/riscv/pmp.c
> +++ b/target/riscv/pmp.c
> @@ -524,7 +524,7 @@ void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index,
> uint8_t pmp_cfg = env->pmp_state.pmp[addr_index + 1].cfg_reg;
> is_next_cfg_tor = PMP_AMATCH_TOR == pmp_get_a_field(pmp_cfg);
>
> - if (pmp_cfg & PMP_LOCK && is_next_cfg_tor) {
> + if (pmp_is_locked(env, addr_index + 1) && is_next_cfg_tor) {
> qemu_log_mask(LOG_GUEST_ERROR,
> "ignoring pmpaddr write - pmpcfg + 1 locked\n");
> return;
> --
> 2.48.1
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] target/riscv: Respect mseccfg.RLB bit for TOR mode PMP entry
2025-02-10 15:37 [PATCH] target/riscv: Respect mseccfg.RLB bit for TOR mode PMP entry Rob Bradford
2025-02-17 16:37 ` Daniel Henrique Barboza
2025-02-18 2:16 ` Alistair Francis
@ 2025-02-18 2:25 ` Alistair Francis
2 siblings, 0 replies; 4+ messages in thread
From: Alistair Francis @ 2025-02-18 2:25 UTC (permalink / raw)
To: Rob Bradford
Cc: qemu-devel, Palmer Dabbelt, Bin Meng, Weiwei Li,
Daniel Henrique Barboza, qemu-riscv, Liu Zhiwei, Alistair Francis
On Tue, Feb 11, 2025 at 1:38 AM Rob Bradford <rbradford@rivosinc.com> wrote:
>
> When running in TOR mode (Top of Range) the next PMP entry controls
> whether the entry is locked. However simply checking if the PMP_LOCK bit
> is set is not sufficient with the Smepmp extension which now provides a
> bit (mseccfg.RLB (Rule Lock Bypass)) to disregard the lock bits. In
> order to respect this bit use the convenience pmp_is_locked() function
> rather than directly checking PMP_LOCK since this function checks
> mseccfg.RLB.
>
> Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
Thanks!
Applied to riscv-to-apply.next
Alistair
> ---
> target/riscv/pmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
> index a185c246d6..85ab270dad 100644
> --- a/target/riscv/pmp.c
> +++ b/target/riscv/pmp.c
> @@ -524,7 +524,7 @@ void pmpaddr_csr_write(CPURISCVState *env, uint32_t addr_index,
> uint8_t pmp_cfg = env->pmp_state.pmp[addr_index + 1].cfg_reg;
> is_next_cfg_tor = PMP_AMATCH_TOR == pmp_get_a_field(pmp_cfg);
>
> - if (pmp_cfg & PMP_LOCK && is_next_cfg_tor) {
> + if (pmp_is_locked(env, addr_index + 1) && is_next_cfg_tor) {
> qemu_log_mask(LOG_GUEST_ERROR,
> "ignoring pmpaddr write - pmpcfg + 1 locked\n");
> return;
> --
> 2.48.1
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-18 2:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10 15:37 [PATCH] target/riscv: Respect mseccfg.RLB bit for TOR mode PMP entry Rob Bradford
2025-02-17 16:37 ` Daniel Henrique Barboza
2025-02-18 2:16 ` Alistair Francis
2025-02-18 2:25 ` Alistair Francis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.