kmem_layout.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Kernel virtual memory layout definitions.
  3. *
  4. * This file is subject to the terms and conditions of the GNU General
  5. * Public License. See the file "COPYING" in the main directory of
  6. * this archive for more details.
  7. *
  8. * Copyright (C) 2016 Cadence Design Systems Inc.
  9. */
  10. #ifndef _XTENSA_KMEM_LAYOUT_H
  11. #define _XTENSA_KMEM_LAYOUT_H
  12. #include <asm/core.h>
  13. #include <asm/types.h>
  14. #ifdef CONFIG_MMU
  15. /*
  16. * Fixed TLB translations in the processor.
  17. */
  18. #define XCHAL_PAGE_TABLE_VADDR __XTENSA_UL_CONST(0x80000000)
  19. #define XCHAL_PAGE_TABLE_SIZE __XTENSA_UL_CONST(0x00400000)
  20. #if defined(CONFIG_XTENSA_KSEG_MMU_V2)
  21. #define XCHAL_KSEG_CACHED_VADDR __XTENSA_UL_CONST(0xd0000000)
  22. #define XCHAL_KSEG_BYPASS_VADDR __XTENSA_UL_CONST(0xd8000000)
  23. #define XCHAL_KSEG_SIZE __XTENSA_UL_CONST(0x08000000)
  24. #define XCHAL_KSEG_ALIGNMENT __XTENSA_UL_CONST(0x08000000)
  25. #define XCHAL_KSEG_TLB_WAY 5
  26. #define XCHAL_KIO_TLB_WAY 6
  27. #elif defined(CONFIG_XTENSA_KSEG_256M)
  28. #define XCHAL_KSEG_CACHED_VADDR __XTENSA_UL_CONST(0xb0000000)
  29. #define XCHAL_KSEG_BYPASS_VADDR __XTENSA_UL_CONST(0xc0000000)
  30. #define XCHAL_KSEG_SIZE __XTENSA_UL_CONST(0x10000000)
  31. #define XCHAL_KSEG_ALIGNMENT __XTENSA_UL_CONST(0x10000000)
  32. #define XCHAL_KSEG_TLB_WAY 6
  33. #define XCHAL_KIO_TLB_WAY 6
  34. #elif defined(CONFIG_XTENSA_KSEG_512M)
  35. #define XCHAL_KSEG_CACHED_VADDR __XTENSA_UL_CONST(0xa0000000)
  36. #define XCHAL_KSEG_BYPASS_VADDR __XTENSA_UL_CONST(0xc0000000)
  37. #define XCHAL_KSEG_SIZE __XTENSA_UL_CONST(0x20000000)
  38. #define XCHAL_KSEG_ALIGNMENT __XTENSA_UL_CONST(0x10000000)
  39. #define XCHAL_KSEG_TLB_WAY 6
  40. #define XCHAL_KIO_TLB_WAY 6
  41. #else
  42. #error Unsupported KSEG configuration
  43. #endif
  44. #ifdef CONFIG_KSEG_PADDR
  45. #define XCHAL_KSEG_PADDR __XTENSA_UL_CONST(CONFIG_KSEG_PADDR)
  46. #else
  47. #define XCHAL_KSEG_PADDR __XTENSA_UL_CONST(0x00000000)
  48. #endif
  49. #if XCHAL_KSEG_PADDR & (XCHAL_KSEG_ALIGNMENT - 1)
  50. #error XCHAL_KSEG_PADDR is not properly aligned to XCHAL_KSEG_ALIGNMENT
  51. #endif
  52. #endif
  53. /* KIO definition */
  54. #if XCHAL_HAVE_PTP_MMU
  55. #define XCHAL_KIO_CACHED_VADDR 0xe0000000
  56. #define XCHAL_KIO_BYPASS_VADDR 0xf0000000
  57. #define XCHAL_KIO_DEFAULT_PADDR 0xf0000000
  58. #else
  59. #define XCHAL_KIO_BYPASS_VADDR XCHAL_KIO_PADDR
  60. #define XCHAL_KIO_DEFAULT_PADDR 0x90000000
  61. #endif
  62. #define XCHAL_KIO_SIZE 0x10000000
  63. #if (!XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY) && defined(CONFIG_USE_OF)
  64. #define XCHAL_KIO_PADDR xtensa_get_kio_paddr()
  65. #ifndef __ASSEMBLY__
  66. extern unsigned long xtensa_kio_paddr;
  67. static inline unsigned long xtensa_get_kio_paddr(void)
  68. {
  69. return xtensa_kio_paddr;
  70. }
  71. #endif
  72. #else
  73. #define XCHAL_KIO_PADDR XCHAL_KIO_DEFAULT_PADDR
  74. #endif
  75. /* KERNEL_STACK definition */
  76. #ifndef CONFIG_KASAN
  77. #define KERNEL_STACK_SHIFT 13
  78. #else
  79. #define KERNEL_STACK_SHIFT 15
  80. #endif
  81. #define KERNEL_STACK_SIZE (1 << KERNEL_STACK_SHIFT)
  82. #endif