forked from Mirrors/opensbi

In RISC-V, tlb flush happens at a page granularity. That's why OpenSBI also have a tlb range flush limit which decides the which tlb flush requests should be upgraded to full flush to avoid long delays. Currently, this is set to 1G which would result in a many sfence.vma execution in a tight loop for a large range. Change the threshold to 4k to speed things up. Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
53 lines
1.0 KiB
C
53 lines
1.0 KiB
C
/*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2019 Western Digital Corporation or its affiliates.
|
|
*
|
|
* Authors:
|
|
* Atish Patra <atish.patra@wdc.com>
|
|
* Anup Patel <anup.patel@wdc.com>
|
|
*/
|
|
|
|
#ifndef __SBI_TLB_H__
|
|
#define __SBI_TLB_H__
|
|
|
|
#include <sbi/sbi_types.h>
|
|
|
|
/* clang-format off */
|
|
|
|
#define SBI_TLB_FLUSH_ALL ((unsigned long)-1)
|
|
#define SBI_TLB_FLUSH_MAX_SIZE (1UL << 12)
|
|
|
|
/* clang-format on */
|
|
|
|
#define SBI_TLB_FIFO_NUM_ENTRIES 8
|
|
|
|
enum sbi_tlb_info_types {
|
|
SBI_TLB_FLUSH_VMA,
|
|
SBI_TLB_FLUSH_VMA_ASID,
|
|
SBI_TLB_FLUSH_VMA_VMID,
|
|
SBI_ITLB_FLUSH
|
|
};
|
|
|
|
struct sbi_scratch;
|
|
|
|
struct sbi_tlb_info {
|
|
unsigned long start;
|
|
unsigned long size;
|
|
unsigned long asid;
|
|
unsigned long type;
|
|
unsigned long shart_mask;
|
|
};
|
|
|
|
#define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info)
|
|
|
|
int sbi_tlb_fifo_update(struct sbi_scratch *scratch, u32 hartid, void *data);
|
|
|
|
void sbi_tlb_fifo_process(struct sbi_scratch *scratch);
|
|
|
|
int sbi_tlb_fifo_init(struct sbi_scratch *scratch, bool cold_boot);
|
|
|
|
void sbi_tlb_fifo_sync(struct sbi_scratch *scratch);
|
|
|
|
#endif
|