hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/arc/mm/cache.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * ARC Cache Management
34 *
45 * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
56 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118
129 #include <linux/module.h>
....@@ -113,10 +110,24 @@
113110 }
114111
115112 READ_BCR(ARC_REG_CLUSTER_BCR, cbcr);
116
- if (cbcr.c)
113
+ if (cbcr.c) {
117114 ioc_exists = 1;
118
- else
115
+
116
+ /*
117
+ * As for today we don't support both IOC and ZONE_HIGHMEM enabled
118
+ * simultaneously. This happens because as of today IOC aperture covers
119
+ * only ZONE_NORMAL (low mem) and any dma transactions outside this
120
+ * region won't be HW coherent.
121
+ * If we want to use both IOC and ZONE_HIGHMEM we can use
122
+ * bounce_buffer to handle dma transactions to HIGHMEM.
123
+ * Also it is possible to modify dma_direct cache ops or increase IOC
124
+ * aperture size if we are planning to use HIGHMEM without PAE.
125
+ */
126
+ if (IS_ENABLED(CONFIG_HIGHMEM) || is_pae40_enabled())
127
+ ioc_enable = 0;
128
+ } else {
119129 ioc_enable = 0;
130
+ }
120131
121132 /* HS 2.0 didn't have AUX_VOL */
122133 if (cpuinfo_arc700[cpu].core.family > 0x51) {
....@@ -1158,19 +1169,6 @@
11581169 if (!ioc_enable)
11591170 return;
11601171
1161
- /*
1162
- * As for today we don't support both IOC and ZONE_HIGHMEM enabled
1163
- * simultaneously. This happens because as of today IOC aperture covers
1164
- * only ZONE_NORMAL (low mem) and any dma transactions outside this
1165
- * region won't be HW coherent.
1166
- * If we want to use both IOC and ZONE_HIGHMEM we can use
1167
- * bounce_buffer to handle dma transactions to HIGHMEM.
1168
- * Also it is possible to modify dma_direct cache ops or increase IOC
1169
- * aperture size if we are planning to use HIGHMEM without PAE.
1170
- */
1171
- if (IS_ENABLED(CONFIG_HIGHMEM))
1172
- panic("IOC and HIGHMEM can't be used simultaneously");
1173
-
11741172 /* Flush + invalidate + disable L1 dcache */
11751173 __dc_disable();
11761174
....@@ -1294,7 +1292,7 @@
12941292 /*
12951293 * In case of IOC (say IOC+SLC case), pointers above could still be set
12961294 * but end up not being relevant as the first function in chain is not
1297
- * called at all for @dma_direct_ops
1295
+ * called at all for devices using coherent DMA.
12981296 * arch_sync_dma_for_cpu() -> dma_cache_*() -> __dma_cache_*()
12991297 */
13001298 }