domain.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * arch/arm/include/asm/domain.h
  3. *
  4. * Copyright (C) 1999 Russell King.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_PROC_DOMAIN_H
  11. #define __ASM_PROC_DOMAIN_H
  12. /*
  13. * Domain numbers
  14. *
  15. * DOMAIN_IO - domain 2 includes all IO only
  16. * DOMAIN_USER - domain 1 includes all user memory only
  17. * DOMAIN_KERNEL - domain 0 includes all kernel memory only
  18. *
  19. * The domain numbering depends on whether we support 36 physical
  20. * address for I/O or not. Addresses above the 32 bit boundary can
  21. * only be mapped using supersections and supersections can only
  22. * be set for domain 0. We could just default to DOMAIN_IO as zero,
  23. * but there may be systems with supersection support and no 36-bit
  24. * addressing. In such cases, we want to map system memory with
  25. * supersections to reduce TLB misses and footprint.
  26. *
  27. * 36-bit addressing and supersections are only available on
  28. * CPUs based on ARMv6+ or the Intel XSC3 core.
  29. */
  30. #ifndef CONFIG_IO_36
  31. #define DOMAIN_KERNEL 0
  32. #define DOMAIN_TABLE 0
  33. #define DOMAIN_USER 1
  34. #define DOMAIN_IO 2
  35. #else
  36. #define DOMAIN_KERNEL 2
  37. #define DOMAIN_TABLE 2
  38. #define DOMAIN_USER 1
  39. #define DOMAIN_IO 0
  40. #endif
  41. /*
  42. * Domain types
  43. */
  44. #define DOMAIN_NOACCESS 0
  45. #define DOMAIN_CLIENT 1
  46. #ifdef CONFIG_CPU_USE_DOMAINS
  47. #define DOMAIN_MANAGER 3
  48. #else
  49. #define DOMAIN_MANAGER 1
  50. #endif
  51. #define domain_val(dom,type) ((type) << (2*(dom)))
  52. #ifndef __ASSEMBLY__
  53. #ifdef CONFIG_CPU_USE_DOMAINS
  54. #define set_domain(x) \
  55. do { \
  56. __asm__ __volatile__( \
  57. "mcr p15, 0, %0, c3, c0 @ set domain" \
  58. : : "r" (x)); \
  59. isb(); \
  60. } while (0)
  61. #define modify_domain(dom,type) \
  62. do { \
  63. struct thread_info *thread = current_thread_info(); \
  64. unsigned int domain = thread->cpu_domain; \
  65. domain &= ~domain_val(dom, DOMAIN_MANAGER); \
  66. thread->cpu_domain = domain | domain_val(dom, type); \
  67. set_domain(thread->cpu_domain); \
  68. } while (0)
  69. #else
  70. #define set_domain(x) do { } while (0)
  71. #define modify_domain(dom,type) do { } while (0)
  72. #endif
  73. /*
  74. * Generate the T (user) versions of the LDR/STR and related
  75. * instructions (inline assembly)
  76. */
  77. #ifdef CONFIG_CPU_USE_DOMAINS
  78. #define T(instr) #instr "t"
  79. #else
  80. #define T(instr) #instr
  81. #endif
  82. #else /* __ASSEMBLY__ */
  83. /*
  84. * Generate the T (user) versions of the LDR/STR and related
  85. * instructions
  86. */
  87. #ifdef CONFIG_CPU_USE_DOMAINS
  88. #define T(instr) instr ## t
  89. #else
  90. #define T(instr) instr
  91. #endif
  92. #endif /* __ASSEMBLY__ */
  93. #endif /* !__ASM_PROC_DOMAIN_H */