From: cp0613@linux.alibaba.com
To: opensbi@lists.infradead.org
Cc: anup@brainfault.org, samuel.holland@sifive.com,
guoren@kernel.org, Chen Pei <cp0613@linux.alibaba.com>
Subject: [PATCH v2 0/2] lib: sbi: Flush cache entries after writing PMP CSRs
Date: Thu, 26 Feb 2026 20:34:06 +0800 [thread overview]
Message-ID: <20260226123408.1597-1-cp0613@linux.alibaba.com> (raw)
From: Chen Pei <cp0613@linux.alibaba.com>
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(-)
--
2.50.1
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next reply other threads:[~2026-02-26 12:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 12:34 cp0613 [this message]
2026-02-26 12:34 ` [PATCH v2 1/2] lib: sbi: Introduce sbi_hart_pmp_fence_vma cp0613
2026-02-26 12:34 ` [PATCH v2 2/2] lib: sbi: Flush cache entries after writing PMP CSRs cp0613
2026-02-27 1:19 ` Guo Ren
2026-02-27 1:21 ` Guo Ren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260226123408.1597-1-cp0613@linux.alibaba.com \
--to=cp0613@linux.alibaba.com \
--cc=anup@brainfault.org \
--cc=guoren@kernel.org \
--cc=opensbi@lists.infradead.org \
--cc=samuel.holland@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox