|
45 | 45 | struct page *empty_zero_page;
|
46 | 46 | EXPORT_SYMBOL(empty_zero_page);
|
47 | 47 |
|
48 |
| -struct cachepolicy { |
49 |
| - const char policy[16]; |
50 |
| - u64 mair; |
51 |
| - u64 tcr; |
52 |
| -}; |
53 |
| - |
54 |
| -static struct cachepolicy cache_policies[] __initdata = { |
55 |
| - { |
56 |
| - .policy = "uncached", |
57 |
| - .mair = 0x44, /* inner, outer non-cacheable */ |
58 |
| - .tcr = TCR_IRGN_NC | TCR_ORGN_NC, |
59 |
| - }, { |
60 |
| - .policy = "writethrough", |
61 |
| - .mair = 0xaa, /* inner, outer write-through, read-allocate */ |
62 |
| - .tcr = TCR_IRGN_WT | TCR_ORGN_WT, |
63 |
| - }, { |
64 |
| - .policy = "writeback", |
65 |
| - .mair = 0xee, /* inner, outer write-back, read-allocate */ |
66 |
| - .tcr = TCR_IRGN_WBnWA | TCR_ORGN_WBnWA, |
67 |
| - } |
68 |
| -}; |
69 |
| - |
70 |
| -/* |
71 |
| - * These are useful for identifying cache coherency problems by allowing the |
72 |
| - * cache or the cache and writebuffer to be turned off. It changes the Normal |
73 |
| - * memory caching attributes in the MAIR_EL1 register. |
74 |
| - */ |
75 |
| -static int __init early_cachepolicy(char *p) |
76 |
| -{ |
77 |
| - int i; |
78 |
| - u64 tmp; |
79 |
| - |
80 |
| - for (i = 0; i < ARRAY_SIZE(cache_policies); i++) { |
81 |
| - int len = strlen(cache_policies[i].policy); |
82 |
| - |
83 |
| - if (memcmp(p, cache_policies[i].policy, len) == 0) |
84 |
| - break; |
85 |
| - } |
86 |
| - if (i == ARRAY_SIZE(cache_policies)) { |
87 |
| - pr_err("ERROR: unknown or unsupported cache policy: %s\n", p); |
88 |
| - return 0; |
89 |
| - } |
90 |
| - |
91 |
| - flush_cache_all(); |
92 |
| - |
93 |
| - /* |
94 |
| - * Modify MT_NORMAL attributes in MAIR_EL1. |
95 |
| - */ |
96 |
| - asm volatile( |
97 |
| - " mrs %0, mair_el1\n" |
98 |
| - " bfi %0, %1, %2, #8\n" |
99 |
| - " msr mair_el1, %0\n" |
100 |
| - " isb\n" |
101 |
| - : "=&r" (tmp) |
102 |
| - : "r" (cache_policies[i].mair), "i" (MT_NORMAL * 8)); |
103 |
| - |
104 |
| - /* |
105 |
| - * Modify TCR PTW cacheability attributes. |
106 |
| - */ |
107 |
| - asm volatile( |
108 |
| - " mrs %0, tcr_el1\n" |
109 |
| - " bic %0, %0, %2\n" |
110 |
| - " orr %0, %0, %1\n" |
111 |
| - " msr tcr_el1, %0\n" |
112 |
| - " isb\n" |
113 |
| - : "=&r" (tmp) |
114 |
| - : "r" (cache_policies[i].tcr), "r" (TCR_IRGN_MASK | TCR_ORGN_MASK)); |
115 |
| - |
116 |
| - flush_cache_all(); |
117 |
| - |
118 |
| - return 0; |
119 |
| -} |
120 |
| -early_param("cachepolicy", early_cachepolicy); |
121 |
| - |
122 | 48 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
|
123 | 49 | unsigned long size, pgprot_t vma_prot)
|
124 | 50 | {
|
|
0 commit comments