From 416ceb3cd72db8d24373274316e2f5d5d3800bf3 Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Mon, 11 Dec 2023 13:26:49 +0530 Subject: lib: sbi_tlb: Reduce size of struct sbi_tlb_info Let us reduce the size of struct sbi_tlb_info by doing the following: 1) Change the data type of asid and vmid fields to uint16_t 2) Replace local_fn() function pointer with an enum Based on the above, the size of struct sbi_tlb_info is reduced by 16 bytes on RV64 and 4 bytes on RV32. Signed-off-by: Anup Patel --- include/sbi/sbi_tlb.h | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/sbi/sbi_tlb.h b/include/sbi/sbi_tlb.h index 55dcab08..2c50fe85 100644 --- a/include/sbi/sbi_tlb.h +++ b/include/sbi/sbi_tlb.h @@ -22,30 +22,33 @@ struct sbi_scratch; +enum sbi_tlb_type { + SBI_TLB_FENCE_I = 0, + SBI_TLB_SFENCE_VMA, + SBI_TLB_SFENCE_VMA_ASID, + SBI_TLB_HFENCE_GVMA_VMID, + SBI_TLB_HFENCE_GVMA, + SBI_TLB_HFENCE_VVMA_ASID, + SBI_TLB_HFENCE_VVMA, + SBI_TLB_TYPE_MAX, +}; + struct sbi_tlb_info { unsigned long start; unsigned long size; - unsigned long asid; - unsigned long vmid; - void (*local_fn)(struct sbi_tlb_info *tinfo); + uint16_t asid; + uint16_t vmid; + enum sbi_tlb_type type; struct sbi_hartmask smask; }; -void sbi_tlb_local_hfence_vvma(struct sbi_tlb_info *tinfo); -void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info *tinfo); -void sbi_tlb_local_sfence_vma(struct sbi_tlb_info *tinfo); -void sbi_tlb_local_hfence_vvma_asid(struct sbi_tlb_info *tinfo); -void sbi_tlb_local_hfence_gvma_vmid(struct sbi_tlb_info *tinfo); -void sbi_tlb_local_sfence_vma_asid(struct sbi_tlb_info *tinfo); -void sbi_tlb_local_fence_i(struct sbi_tlb_info *tinfo); - -#define SBI_TLB_INFO_INIT(__p, __start, __size, __asid, __vmid, __lfn, __src) \ +#define SBI_TLB_INFO_INIT(__p, __start, __size, __asid, __vmid, __type, __src) \ do { \ (__p)->start = (__start); \ (__p)->size = (__size); \ (__p)->asid = (__asid); \ (__p)->vmid = (__vmid); \ - (__p)->local_fn = (__lfn); \ + (__p)->type = (__type); \ SBI_HARTMASK_INIT_EXCEPT(&(__p)->smask, (__src)); \ } while (0) -- cgit v1.3.1