Skip to content

lib: sbi: Flush cache entries after writing PMP CSRs

[email protected] opensbi 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesIn review
  2. v11 patch 7 repliesSuperseded

Changes in v2 from the cover letter

- Introduce sbi_hart_pmp_fence_vma
- Use sbi_hart_pmp_fence_vma when calling map_range/unmap_range in sbi_hart_protection to avoid performance issues caused by using sbi_hart_pmp_fence_all.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2lib: sbi: Introduce sbi_hart_pmp_fence_vmainclude/sbi/sbi_hart_pmp.h lib/sbi/sbi_hart_pmp.c platform/generic/eswin/eic770x.c+30 -50 replies
2/2lib: sbi: Flush cache entries after writing PMP CSRslib/sbi/sbi_hart_pmp.c+10 -12 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] lib: sbi: Flush cache entries after writing PMP CSRs

From: Chen Pei <[email protected]>

As the privileged specification states, after writing to the PMP CSRs, a SFENCE.VMA or HFENCE.GVMA instruction should be executed with rs1=x0 and rs2=x0 to flush all address translation cache entries.

The original implementation does not cover all possible cases. For example, the unconfigure and map_range/unmap_range functions of sbi_hart_protection calls pmp_set but does not execute the SFENCE.VMA instruction. This patch covers these cases, ensuring that dbtr, sse, and other modules can safely update pmpcfg.

Considering the performance issues caused by flush all address translation cache entries, sbi_hart_pmp_fence_vma is introduced to flush only the entries corresponding to a given address and size.

Changes in v2:
- Introduce sbi_hart_pmp_fence_vma
- Use sbi_hart_pmp_fence_vma when calling map_range/unmap_range in sbi_hart_protection to avoid performance issues caused by using sbi_hart_pmp_fence_all.

Chen Pei (2):
lib: sbi: Introduce sbi_hart_pmp_fence_vma
lib: sbi: Flush cache entries after writing PMP CSRs

 include/sbi/sbi_hart_pmp.h       |  3 ++-
 lib/sbi/sbi_hart_pmp.c           | 41 ++++++++++++++++++++++++++++----
 platform/generic/eswin/eic770x.c |  2 +-
 3 files changed, 40 insertions(+), 6 deletions(-)
Signature · 7 lines
2.50.1


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