diff options
author | Anup Patel <apatel@ventanamicro.com> | 2023-12-11 13:26:49 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2023-12-19 15:56:37 +0530 |
commit | 416ceb3cd72db8d24373274316e2f5d5d3800bf3 (patch) | |
tree | 0cb575ec1544c80d8a7646ba4ae596708bf86723 /include | |
parent | 3daac8fb87a4d04fe8dfc0ff4a6ffb947107e1a9 (diff) | |
download | opensbi-416ceb3cd72db8d24373274316e2f5d5d3800bf3.zip opensbi-416ceb3cd72db8d24373274316e2f5d5d3800bf3.tar.gz opensbi-416ceb3cd72db8d24373274316e2f5d5d3800bf3.tar.bz2 |
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 <apatel@ventanamicro.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sbi/sbi_tlb.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/include/sbi/sbi_tlb.h b/include/sbi/sbi_tlb.h index 55dcab0..2c50fe8 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) |