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>
This commit is contained in:
parent
ac1c229b61
commit
d79173b4b7
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue