| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ARC Cache Management |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) |
|---|
| 5 | 6 | * 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. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | |
|---|
| 12 | 9 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 113 | 110 | } |
|---|
| 114 | 111 | |
|---|
| 115 | 112 | READ_BCR(ARC_REG_CLUSTER_BCR, cbcr); |
|---|
| 116 | | - if (cbcr.c) |
|---|
| 113 | + if (cbcr.c) { |
|---|
| 117 | 114 | 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 { |
|---|
| 119 | 129 | ioc_enable = 0; |
|---|
| 130 | + } |
|---|
| 120 | 131 | |
|---|
| 121 | 132 | /* HS 2.0 didn't have AUX_VOL */ |
|---|
| 122 | 133 | if (cpuinfo_arc700[cpu].core.family > 0x51) { |
|---|
| .. | .. |
|---|
| 1158 | 1169 | if (!ioc_enable) |
|---|
| 1159 | 1170 | return; |
|---|
| 1160 | 1171 | |
|---|
| 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 | | - |
|---|
| 1174 | 1172 | /* Flush + invalidate + disable L1 dcache */ |
|---|
| 1175 | 1173 | __dc_disable(); |
|---|
| 1176 | 1174 | |
|---|
| .. | .. |
|---|
| 1294 | 1292 | /* |
|---|
| 1295 | 1293 | * In case of IOC (say IOC+SLC case), pointers above could still be set |
|---|
| 1296 | 1294 | * 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. |
|---|
| 1298 | 1296 | * arch_sync_dma_for_cpu() -> dma_cache_*() -> __dma_cache_*() |
|---|
| 1299 | 1297 | */ |
|---|
| 1300 | 1298 | } |
|---|