lib: sbi: Replace sbi_hart_pmp_xyz() and sbi_hart_map/unmap_addr()

The sbi_hart_pmp_xyz() and sbi_hart_map/unmap_addr() functions can
now be replaced by various sbi_hart_protection_xyz() functions.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Link: https://lore.kernel.org/r/20251209135235.423391-5-apatel@ventanamicro.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Anup Patel
2025-12-09 19:22:34 +05:30
committed by Anup Patel
parent b6da690ffb
commit 42139bb9b7
9 changed files with 58 additions and 83 deletions

View File

@@ -15,6 +15,7 @@
#include <sbi/sbi_error.h>
#include <sbi/sbi_fifo.h>
#include <sbi/sbi_hart.h>
#include <sbi/sbi_hart_protection.h>
#include <sbi/sbi_heap.h>
#include <sbi/sbi_hsm.h>
#include <sbi/sbi_ipi.h>
@@ -1036,7 +1037,7 @@ int sbi_sse_read_attrs(uint32_t event_id, uint32_t base_attr_id,
if (ret)
return ret;
sbi_hart_map_saddr(output_phys_lo, sizeof(unsigned long) * attr_count);
sbi_hart_protection_map_range(output_phys_lo, sizeof(unsigned long) * attr_count);
/*
* Copy all attributes at once since struct sse_event_attrs is matching
@@ -1049,7 +1050,7 @@ int sbi_sse_read_attrs(uint32_t event_id, uint32_t base_attr_id,
attrs = (unsigned long *)output_phys_lo;
copy_attrs(attrs, &e_attrs[base_attr_id], attr_count);
sbi_hart_unmap_saddr();
sbi_hart_protection_unmap_range(output_phys_lo, sizeof(unsigned long) * attr_count);
sse_event_put(e);
@@ -1064,7 +1065,7 @@ static int sse_write_attrs(struct sbi_sse_event *e, uint32_t base_attr_id,
uint32_t id, end_id = base_attr_id + attr_count;
unsigned long *attrs = (unsigned long *)input_phys;
sbi_hart_map_saddr(input_phys, sizeof(unsigned long) * attr_count);
sbi_hart_protection_map_range(input_phys, sizeof(unsigned long) * attr_count);
for (id = base_attr_id; id < end_id; id++) {
val = attrs[attr++];
@@ -1080,7 +1081,7 @@ static int sse_write_attrs(struct sbi_sse_event *e, uint32_t base_attr_id,
}
out:
sbi_hart_unmap_saddr();
sbi_hart_protection_unmap_range(input_phys, sizeof(unsigned long) * attr_count);
return ret;
}