aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2020-02-04 15:09:14 -0800
committerAnup Patel <anup@brainfault.org>2020-02-05 10:37:11 +0530
commitd79173b4b7519b537cf64c984d27daa26aad23c0 (patch)
tree089a36255303e4a6254a61c8fc9cf3812549e2fa
parentac1c229b6124baf66b76982b2c82e4ca7ce9e2d5 (diff)
platform: Add an platform ops to return platform specific tlb flush limit
If a platform requires to perform a tlb full flush, they should set the tlb_range_flush_limit value to zero. However, corresponding platform API ignore the value and continue to return the default value. Add a platform ops to retrieve platform specific tlb range flush limit. The platform variable becomes redundant in presence of the platform ops. Take this opportunity to remove the variable as well. The default is still set to smallest page size in RISC-V (4KB), as there is no way to figure out a best value for all platforms. Individual platform should set it to the optimal value for their platform. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
-rw-r--r--include/sbi/sbi_platform.h15
-rw-r--r--platform/template/platform.c1
2 files changed, 7 insertions, 9 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h
index 0de8be4..ba1d95f 100644
--- a/include/sbi/sbi_platform.h
+++ b/include/sbi/sbi_platform.h
@@ -30,12 +30,10 @@
#define SBI_PLATFORM_HART_STACK_SIZE_OFFSET (0x54)
/** Offset of disabled_hart_mask in struct sbi_platform */
#define SBI_PLATFORM_DISABLED_HART_OFFSET (0x58)
-/** Offset of tlb_range_flush_limit in struct sbi_platform */
-#define SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_OFFSET (0x60)
/** Offset of platform_ops_addr in struct sbi_platform */
-#define SBI_PLATFORM_OPS_OFFSET (0x68)
+#define SBI_PLATFORM_OPS_OFFSET (0x60)
/** Offset of firmware_context in struct sbi_platform */
-#define SBI_PLATFORM_FIRMWARE_CONTEXT_OFFSET (0x68 + __SIZEOF_POINTER__)
+#define SBI_PLATFORM_FIRMWARE_CONTEXT_OFFSET (0x60 + __SIZEOF_POINTER__)
#define SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_DEFAULT (1UL << 12)
@@ -121,6 +119,9 @@ struct sbi_platform_operations {
/** Exit IPI for current HART */
void (*ipi_exit)(void);
+ /** Get tlb flush limit value **/
+ u64 (*get_tlbr_flush_limit)(void);
+
/** Get platform timer value */
u64 (*timer_value)(void);
/** Start platform timer event for current HART */
@@ -170,8 +171,6 @@ struct sbi_platform {
u32 hart_stack_size;
/** Mask representing the set of disabled HARTs */
u64 disabled_hart_mask;
- /* Maximum value of tlb flush range request*/
- u64 tlb_range_flush_limit;
/** Pointer to sbi platform operations */
unsigned long platform_ops_addr;
/** Pointer to system firmware specific context */
@@ -247,8 +246,8 @@ static inline bool sbi_platform_hart_disabled(const struct sbi_platform *plat,
*/
static inline u64 sbi_platform_tlbr_flush_limit(const struct sbi_platform *plat)
{
- if (plat && plat->tlb_range_flush_limit)
- return plat->tlb_range_flush_limit;
+ if (plat && sbi_platform_ops(plat)->get_tlbr_flush_limit)
+ return sbi_platform_ops(plat)->get_tlbr_flush_limit();
return SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_DEFAULT;
}
diff --git a/platform/template/platform.c b/platform/template/platform.c
index 1646c8c..f959a11 100644
--- a/platform/template/platform.c
+++ b/platform/template/platform.c
@@ -224,6 +224,5 @@ const struct sbi_platform platform = {
.hart_count = 1,
.hart_stack_size = 4096,
.disabled_hart_mask = 0,
- .tlb_range_flush_limit = 0,
.platform_ops_addr = (unsigned long)&platform_ops
};