[PATCH v4 0/2] Extend and configure PMP region count

Jay Chang posted 2 patches 5 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250522081236.4050-1-jay.chang@sifive.com
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
target/riscv/cpu.c                |  54 ++++++++++++-
target/riscv/cpu.h                |   3 +-
target/riscv/cpu_bits.h           |  60 ++++++++++++++
target/riscv/cpu_cfg_fields.h.inc |   1 +
target/riscv/csr.c                | 129 +++++++++++++++++++++++++++++-
target/riscv/machine.c            |   3 +-
target/riscv/pmp.c                |  28 ++++---
7 files changed, 262 insertions(+), 16 deletions(-)
[PATCH v4 0/2] Extend and configure PMP region count
Posted by Jay Chang 5 months, 3 weeks ago
The first patch extends the number of PMP regions supported up to 64,
following the RISC-V Privileged Specification (version >1.12), where
RV32 can have up to 64 PMP regions configured through 16 CSRs.

The second patch makes the PMP region count configurable via a new
CPU parameter `num-pmp-regions`. This allows platforms to adjust
the number of PMP regions without relying on a fixed default value.
If unspecified, the default remains 16 to preserve compatibility.

Change log:
  V4:
  * Changed `pmp_regions` type from `uint16_t` to `uint8_t`
  * Introduced `OLD_MAX_RISCV_PMPS` macro

Jay Chang (2):
  target/riscv: Extend PMP region up to 64
  target/riscv: Make PMP region count configurable

 target/riscv/cpu.c                |  54 ++++++++++++-
 target/riscv/cpu.h                |   3 +-
 target/riscv/cpu_bits.h           |  60 ++++++++++++++
 target/riscv/cpu_cfg_fields.h.inc |   1 +
 target/riscv/csr.c                | 129 +++++++++++++++++++++++++++++-
 target/riscv/machine.c            |   3 +-
 target/riscv/pmp.c                |  28 ++++---
 7 files changed, 262 insertions(+), 16 deletions(-)

-- 
2.48.1
Re: [PATCH v4 0/2] Extend and configure PMP region count
Posted by Alistair Francis 5 months, 2 weeks ago
On Thu, May 22, 2025 at 6:14 PM Jay Chang <jay.chang@sifive.com> wrote:
>
> The first patch extends the number of PMP regions supported up to 64,
> following the RISC-V Privileged Specification (version >1.12), where
> RV32 can have up to 64 PMP regions configured through 16 CSRs.
>
> The second patch makes the PMP region count configurable via a new
> CPU parameter `num-pmp-regions`. This allows platforms to adjust
> the number of PMP regions without relying on a fixed default value.
> If unspecified, the default remains 16 to preserve compatibility.
>
> Change log:
>   V4:
>   * Changed `pmp_regions` type from `uint16_t` to `uint8_t`
>   * Introduced `OLD_MAX_RISCV_PMPS` macro
>
> Jay Chang (2):
>   target/riscv: Extend PMP region up to 64
>   target/riscv: Make PMP region count configurable

Thanks!

Applied to riscv-to-apply.next

Alistair

>
>  target/riscv/cpu.c                |  54 ++++++++++++-
>  target/riscv/cpu.h                |   3 +-
>  target/riscv/cpu_bits.h           |  60 ++++++++++++++
>  target/riscv/cpu_cfg_fields.h.inc |   1 +
>  target/riscv/csr.c                | 129 +++++++++++++++++++++++++++++-
>  target/riscv/machine.c            |   3 +-
>  target/riscv/pmp.c                |  28 ++++---
>  7 files changed, 262 insertions(+), 16 deletions(-)
>
> --
> 2.48.1
>
>