Re: [PATCH 0/7] Make PMP encoding usable for non-hart PMPs

Anup Patel <[email protected]> Wed, 10 Jun 2026 18:05:57 +0530
Newsgroups org.infradead.lists.opensbi
Message-ID <CAAhSdy3Rj7dOUKm2D-5t6Vh0Naxatrz5reQj4YdhYZpebH503w@mail.gmail.com>
On Thu, Apr 30, 2026 at 10:25 AM Nicholas Piggin <[email protected]> wrote:
>
> The Tenstorrent RISC-V IOMMU implements PMPs with MMRs in the same
> format as specified in the RISC-V ISA for the hart CSRs. This series
> splits out the PMP encoding functions so it can be shared by both
> users.
>
> I moved this series out of the Tenstorrent Atlantis platform series
> that included IOMMU support, tried to do better at splitting it up,
> tidied and improved code.
>
> The new user of the API can be seen here for reference (will not
> quite compile with this new series):
>
> https://lore.kernel.org/opensbi/[email protected]/
>
> I will post that one out again after the base Atlantis platform and
> this series is merged.
>
> Thanks,
> Nick
>
> Nicholas Piggin (7):
>   lib: sbi: Introduce pmp_t type
>   lib: sbi: split PMP encoding and CSR access
>   lib: sbi: Move RISC-V PMP encoding functions to sbi_pmp.c
>   lib: sbi: Add PMP CSR read and write accessors
>   lib: sbi: Add pmp_is_enabled() helper
>   lib: sbi: Add hart_ prefix to PMP functions
>   lib: sbi: Move hart PMP functions to sbi_hart_pmp.c

The only minor comment is to use "sbi_" prefix for various
public functions in sbi_pmp.h and sbi_hart_pmp.h otherwise
this looks good to me. I will take care of it at the time of
merging.

Reviewed-by: Anup Patel <[email protected]>

Applied this series to the riscv/opensbi repo.

Thanks,
Anup

>
>  include/sbi/riscv_asm.h          |  12 ---
>  include/sbi/sbi_hart_pmp.h       |  12 +++
>  include/sbi/sbi_pmp.h            |  23 +++++
>  lib/sbi/objects.mk               |   1 +
>  lib/sbi/riscv_asm.c              | 162 +------------------------------
>  lib/sbi/sbi_hart_pmp.c           | 128 ++++++++++++++++++++++--
>  lib/sbi/sbi_pmp.c                | 105 ++++++++++++++++++++
>  platform/generic/eswin/eic770x.c |  36 +++----
>  8 files changed, 279 insertions(+), 200 deletions(-)
>  create mode 100644 include/sbi/sbi_pmp.h
>  create mode 100644 lib/sbi/sbi_pmp.c
>
> --
> 2.53.0
>
>
> --
> opensbi mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/opensbi

-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi