domain.h 2.6 KB

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