domain.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. * We cannot use domain 0 for the kernel on QSD8x50 since the kernel domain
  34. * is set to manager mode when set_fs(KERNEL_DS) is called. Setting domain 0
  35. * to manager mode will disable the workaround for a cpu bug that can cause an
  36. * invalid fault status and/or tlb corruption (CONFIG_VERIFY_PERMISSION_FAULT).
  37. */
  38. #if !defined(CONFIG_IO_36) && !defined(CONFIG_VERIFY_PERMISSION_FAULT)
  39. #define DOMAIN_KERNEL 0
  40. #define DOMAIN_TABLE 0
  41. #define DOMAIN_USER 1
  42. #define DOMAIN_IO 2
  43. #else
  44. #define DOMAIN_KERNEL 2
  45. #define DOMAIN_TABLE 2
  46. #define DOMAIN_USER 1
  47. #define DOMAIN_IO 0
  48. #endif
  49. /*
  50. * Domain types
  51. */
  52. #define DOMAIN_NOACCESS 0
  53. #define DOMAIN_CLIENT 1
  54. #ifdef CONFIG_CPU_USE_DOMAINS
  55. #define DOMAIN_MANAGER 3
  56. #else
  57. #define DOMAIN_MANAGER 1
  58. #endif
  59. #define domain_val(dom,type) ((type) << (2*(dom)))
  60. #ifndef __ASSEMBLY__
  61. #ifdef CONFIG_CPU_USE_DOMAINS
  62. #define set_domain(x) \
  63. do { \
  64. __asm__ __volatile__( \
  65. "mcr p15, 0, %0, c3, c0 @ set domain" \
  66. : : "r" (x)); \
  67. isb(); \
  68. } while (0)
  69. #define modify_domain(dom,type) \
  70. do { \
  71. struct thread_info *thread = current_thread_info(); \
  72. unsigned int domain = thread->cpu_domain; \
  73. domain &= ~domain_val(dom, DOMAIN_MANAGER); \
  74. thread->cpu_domain = domain | domain_val(dom, type); \
  75. set_domain(thread->cpu_domain); \
  76. } while (0)
  77. #else
  78. #define set_domain(x) do { } while (0)
  79. #define modify_domain(dom,type) do { } while (0)
  80. #endif
  81. /*
  82. * Generate the T (user) versions of the LDR/STR and related
  83. * instructions (inline assembly)
  84. */
  85. #ifdef CONFIG_CPU_USE_DOMAINS
  86. #define TUSER(instr) #instr "t"
  87. #else
  88. #define TUSER(instr) #instr
  89. #endif
  90. #else /* __ASSEMBLY__ */
  91. /*
  92. * Generate the T (user) versions of the LDR/STR and related
  93. * instructions
  94. */
  95. #ifdef CONFIG_CPU_USE_DOMAINS
  96. #define TUSER(instr) instr ## t
  97. #else
  98. #define TUSER(instr) instr
  99. #endif
  100. #endif /* __ASSEMBLY__ */
  101. #endif /* !__ASM_PROC_DOMAIN_H */