sbi_tlb.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2019 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Atish Patra <atish.patra@wdc.com>
  8. * Anup Patel <anup.patel@wdc.com>
  9. */
  10. #ifndef __SBI_TLB_H__
  11. #define __SBI_TLB_H__
  12. #include <sbi/sbi_types.h>
  13. #include <sbi/sbi_hartmask.h>
  14. /* clang-format off */
  15. #define SBI_TLB_FLUSH_ALL ((unsigned long)-1)
  16. /* clang-format on */
  17. #define SBI_TLB_FIFO_NUM_ENTRIES 8
  18. struct sbi_scratch;
  19. struct sbi_tlb_info {
  20. unsigned long start;
  21. unsigned long size;
  22. unsigned long asid;
  23. unsigned long vmid;
  24. void (*local_fn)(struct sbi_tlb_info *tinfo);
  25. struct sbi_hartmask smask;
  26. };
  27. void sbi_tlb_local_hfence_vvma(struct sbi_tlb_info *tinfo);
  28. void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info *tinfo);
  29. void sbi_tlb_local_sfence_vma(struct sbi_tlb_info *tinfo);
  30. void sbi_tlb_local_hfence_vvma_asid(struct sbi_tlb_info *tinfo);
  31. void sbi_tlb_local_hfence_gvma_vmid(struct sbi_tlb_info *tinfo);
  32. void sbi_tlb_local_sfence_vma_asid(struct sbi_tlb_info *tinfo);
  33. void sbi_tlb_local_fence_i(struct sbi_tlb_info *tinfo);
  34. #define SBI_TLB_INFO_INIT(__p, __start, __size, __asid, __vmid, __lfn, __src) \
  35. do { \
  36. (__p)->start = (__start); \
  37. (__p)->size = (__size); \
  38. (__p)->asid = (__asid); \
  39. (__p)->vmid = (__vmid); \
  40. (__p)->local_fn = (__lfn); \
  41. SBI_HARTMASK_INIT_EXCEPT(&(__p)->smask, (__src)); \
  42. } while (0)
  43. #define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info)
  44. int sbi_tlb_request(ulong hmask, ulong hbase, struct sbi_tlb_info *tinfo);
  45. int sbi_tlb_init(struct sbi_scratch *scratch, bool cold_boot);
  46. #endif