summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Holland <[email protected]>2023-12-08 12:29:55 -0800
committerAnup Patel <[email protected]>2023-12-11 10:41:48 +0530
commit35cba9265514ab73cc3f1777f8ee179f6aa71cd5 (patch)
treea8d619d675844cbda1955ba2f3c92c1c2f1dbd63
parent6112d584d435d2d2f2685cfcd8321c389056636b (diff)
lib: sbi_tlb: Check tlb_range_flush_limit only once per request
The tlb_update() callback is called for each destination hart. Move the size check earlier, so it is executed only once. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Anup Patel <[email protected]>
-rw-r--r--lib/sbi/sbi_tlb.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/sbi/sbi_tlb.c b/lib/sbi/sbi_tlb.c
index dad95088..d3ed56df 100644
--- a/lib/sbi/sbi_tlb.c
+++ b/lib/sbi/sbi_tlb.c
@@ -328,16 +328,6 @@ static int tlb_update(struct sbi_scratch *scratch,
u32 curr_hartid = current_hartid();
/*
- * If address range to flush is too big then simply
- * upgrade it to flush all because we can only flush
- * 4KB at a time.
- */
- if (tinfo->size > tlb_range_flush_limit) {
- tinfo->start = 0;
- tinfo->size = SBI_TLB_FLUSH_ALL;
- }
-
- /*
* If the request is to queue a tlb flush entry for itself
* then just do a local flush and return;
*/
@@ -385,6 +375,16 @@ int sbi_tlb_request(ulong hmask, ulong hbase, struct sbi_tlb_info *tinfo)
if (!tinfo->local_fn)
return SBI_EINVAL;
+ /*
+ * If address range to flush is too big then simply
+ * upgrade it to flush all because we can only flush
+ * 4KB at a time.
+ */
+ if (tinfo->size > tlb_range_flush_limit) {
+ tinfo->start = 0;
+ tinfo->size = SBI_TLB_FLUSH_ALL;
+ }
+
tlb_pmu_incr_fw_ctr(tinfo);
return sbi_ipi_send_many(hmask, hbase, tlb_event, tinfo);