aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-09-07 19:45:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-09-07 19:45:32 -0400
commit2c34a0e041a7063e6e3b3be8866a88975f3342d4 (patch)
tree6d80b12246a4f080a9431fda4bcbf4c6d7d396a7
parentecfe951f0c1b169ea4b7dd6f3a404dfedd795bc2 (diff)
parentdd45210b6dd4f1512eafcc41774154ebb762360f (diff)
Merge tag 'arc-4.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC updates from Vineet Gupta: - Fix for atomic_fetch_#op [Will Deacon] - Enable per device IOC [Eugeniy Paltsev] - Remove redundant gcc version checks [Masahiro Yamada] - Miscll platform config/DT updates [Alexey Brodkin] * tag 'arc-4.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARC: don't check for HIGHMEM pages in arch_dma_alloc ARC: IOC: panic if both IOC and ZONE_HIGHMEM enabled ARC: dma [IOC] Enable per device io coherency ARC: dma [IOC]: mark DMA devices connected as dma-coherent ARC: atomics: unbork atomic_fetch_##op() arc: remove redundant GCC version checks ARC: sort Kconfig ARC: cleanup show_faulting_vma() ARC: [plat-axs*]: Enable SWAP ARC: [plat-axs*/plat-hsdk]: Allow U-Boot to pass MAC-address to the kernel ARC: configs: cleanup
-rw-r--r--arch/arc/Kconfig10
-rw-r--r--arch/arc/Makefile10
-rw-r--r--arch/arc/boot/dts/axc003.dtsi26
-rw-r--r--arch/arc/boot/dts/axc003_idu.dtsi26
-rw-r--r--arch/arc/boot/dts/axs10x_mb.dtsi7
-rw-r--r--arch/arc/boot/dts/hsdk.dts11
-rw-r--r--arch/arc/configs/axs101_defconfig3
-rw-r--r--arch/arc/configs/axs103_defconfig3
-rw-r--r--arch/arc/configs/axs103_smp_defconfig3
-rw-r--r--arch/arc/configs/haps_hs_defconfig2
-rw-r--r--arch/arc/configs/haps_hs_smp_defconfig2
-rw-r--r--arch/arc/configs/hsdk_defconfig1
-rw-r--r--arch/arc/configs/nps_defconfig1
-rw-r--r--arch/arc/configs/nsim_700_defconfig2
-rw-r--r--arch/arc/configs/nsim_hs_defconfig2
-rw-r--r--arch/arc/configs/nsim_hs_smp_defconfig2
-rw-r--r--arch/arc/configs/nsimosci_defconfig2
-rw-r--r--arch/arc/configs/nsimosci_hs_defconfig2
-rw-r--r--arch/arc/configs/nsimosci_hs_smp_defconfig2
-rw-r--r--arch/arc/configs/tb10x_defconfig1
-rw-r--r--arch/arc/configs/vdk_hs38_defconfig2
-rw-r--r--arch/arc/configs/vdk_hs38_smp_defconfig1
-rw-r--r--arch/arc/include/asm/atomic.h2
-rw-r--r--arch/arc/include/asm/dma-mapping.h13
-rw-r--r--arch/arc/kernel/troubleshoot.c13
-rw-r--r--arch/arc/mm/cache.c36
-rw-r--r--arch/arc/mm/dma.c82
27 files changed, 154 insertions, 113 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 6d5eb8267e42..b4441b0764d7 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,6 +9,7 @@
9config ARC 9config ARC
10 def_bool y 10 def_bool y
11 select ARC_TIMERS 11 select ARC_TIMERS
12 select ARCH_HAS_PTE_SPECIAL
12 select ARCH_HAS_SYNC_DMA_FOR_CPU 13 select ARCH_HAS_SYNC_DMA_FOR_CPU
13 select ARCH_HAS_SYNC_DMA_FOR_DEVICE 14 select ARCH_HAS_SYNC_DMA_FOR_DEVICE
14 select ARCH_HAS_SG_CHAIN 15 select ARCH_HAS_SG_CHAIN
@@ -28,8 +29,12 @@ config ARC
28 select GENERIC_SMP_IDLE_THREAD 29 select GENERIC_SMP_IDLE_THREAD
29 select HAVE_ARCH_KGDB 30 select HAVE_ARCH_KGDB
30 select HAVE_ARCH_TRACEHOOK 31 select HAVE_ARCH_TRACEHOOK
32 select HAVE_DEBUG_STACKOVERFLOW
31 select HAVE_FUTEX_CMPXCHG if FUTEX 33 select HAVE_FUTEX_CMPXCHG if FUTEX
34 select HAVE_GENERIC_DMA_COHERENT
32 select HAVE_IOREMAP_PROT 35 select HAVE_IOREMAP_PROT
36 select HAVE_KERNEL_GZIP
37 select HAVE_KERNEL_LZMA
33 select HAVE_KPROBES 38 select HAVE_KPROBES
34 select HAVE_KRETPROBES 39 select HAVE_KRETPROBES
35 select HAVE_MEMBLOCK 40 select HAVE_MEMBLOCK
@@ -44,11 +49,6 @@ config ARC
44 select OF_EARLY_FLATTREE 49 select OF_EARLY_FLATTREE
45 select OF_RESERVED_MEM 50 select OF_RESERVED_MEM
46 select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING 51 select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING
47 select HAVE_DEBUG_STACKOVERFLOW
48 select HAVE_GENERIC_DMA_COHERENT
49 select HAVE_KERNEL_GZIP
50 select HAVE_KERNEL_LZMA
51 select ARCH_HAS_PTE_SPECIAL
52 52
53config ARCH_HAS_CACHE_LINE_SIZE 53config ARCH_HAS_CACHE_LINE_SIZE
54 def_bool y 54 def_bool y
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index fb026196aaab..99cce77ab98f 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -43,10 +43,7 @@ ifdef CONFIG_ARC_CURR_IN_REG
43LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h 43LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h
44endif 44endif
45 45
46upto_gcc44 := $(call cc-ifversion, -le, 0404, y) 46cflags-y += -fsection-anchors
47atleast_gcc44 := $(call cc-ifversion, -ge, 0404, y)
48
49cflags-$(atleast_gcc44) += -fsection-anchors
50 47
51cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock 48cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
52cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape 49cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
@@ -82,11 +79,6 @@ cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
82cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian 79cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
83ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB 80ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
84 81
85# STAR 9000518362: (fixed with binutils shipping with gcc 4.8)
86# arc-linux-uclibc-ld (buildroot) or arceb-elf32-ld (EZChip) don't accept
87# --build-id w/o "-marclinux". Default arc-elf32-ld is OK
88ldflags-$(upto_gcc44) += -marclinux
89
90LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name) 82LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
91 83
92# Modules with short calls might break for calls into builtin-kernel 84# Modules with short calls might break for calls into builtin-kernel
diff --git a/arch/arc/boot/dts/axc003.dtsi b/arch/arc/boot/dts/axc003.dtsi
index dc91c663bcc0..d75d65ddf8e3 100644
--- a/arch/arc/boot/dts/axc003.dtsi
+++ b/arch/arc/boot/dts/axc003.dtsi
@@ -94,6 +94,32 @@
94 }; 94 };
95 95
96 /* 96 /*
97 * Mark DMA peripherals connected via IOC port as dma-coherent. We do
98 * it via overlay because peripherals defined in axs10x_mb.dtsi are
99 * used for both AXS101 and AXS103 boards and only AXS103 has IOC (so
100 * only AXS103 board has HW-coherent DMA peripherals)
101 * We don't need to mark pgu@17000 as dma-coherent because it uses
102 * external DMA buffer located outside of IOC aperture.
103 */
104 axs10x_mb {
105 ethernet@0x18000 {
106 dma-coherent;
107 };
108
109 ehci@0x40000 {
110 dma-coherent;
111 };
112
113 ohci@0x60000 {
114 dma-coherent;
115 };
116
117 mmc@0x15000 {
118 dma-coherent;
119 };
120 };
121
122 /*
97 * The DW APB ICTL intc on MB is connected to CPU intc via a 123 * The DW APB ICTL intc on MB is connected to CPU intc via a
98 * DT "invisible" DW APB GPIO block, configured to simply pass thru 124 * DT "invisible" DW APB GPIO block, configured to simply pass thru
99 * interrupts - setup accordinly in platform init (plat-axs10x/ax10x.c) 125 * interrupts - setup accordinly in platform init (plat-axs10x/ax10x.c)
diff --git a/arch/arc/boot/dts/axc003_idu.dtsi b/arch/arc/boot/dts/axc003_idu.dtsi
index 69ff4895f2ba..a05bb737ea63 100644
--- a/arch/arc/boot/dts/axc003_idu.dtsi
+++ b/arch/arc/boot/dts/axc003_idu.dtsi
@@ -101,6 +101,32 @@
101 }; 101 };
102 102
103 /* 103 /*
104 * Mark DMA peripherals connected via IOC port as dma-coherent. We do
105 * it via overlay because peripherals defined in axs10x_mb.dtsi are
106 * used for both AXS101 and AXS103 boards and only AXS103 has IOC (so
107 * only AXS103 board has HW-coherent DMA peripherals)
108 * We don't need to mark pgu@17000 as dma-coherent because it uses
109 * external DMA buffer located outside of IOC aperture.
110 */
111 axs10x_mb {
112 ethernet@0x18000 {
113 dma-coherent;
114 };
115
116 ehci@0x40000 {
117 dma-coherent;
118 };
119
120 ohci@0x60000 {
121 dma-coherent;
122 };
123
124 mmc@0x15000 {
125 dma-coherent;
126 };
127 };
128
129 /*
104 * This INTC is actually connected to DW APB GPIO 130 * This INTC is actually connected to DW APB GPIO
105 * which acts as a wire between MB INTC and CPU INTC. 131 * which acts as a wire between MB INTC and CPU INTC.
106 * GPIO INTC is configured in platform init code 132 * GPIO INTC is configured in platform init code
diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi
index 47b74fbc403c..37bafd44e36d 100644
--- a/arch/arc/boot/dts/axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/axs10x_mb.dtsi
@@ -9,6 +9,10 @@
9 */ 9 */
10 10
11/ { 11/ {
12 aliases {
13 ethernet = &gmac;
14 };
15
12 axs10x_mb { 16 axs10x_mb {
13 compatible = "simple-bus"; 17 compatible = "simple-bus";
14 #address-cells = <1>; 18 #address-cells = <1>;
@@ -68,7 +72,7 @@
68 }; 72 };
69 }; 73 };
70 74
71 ethernet@0x18000 { 75 gmac: ethernet@0x18000 {
72 #interrupt-cells = <1>; 76 #interrupt-cells = <1>;
73 compatible = "snps,dwmac"; 77 compatible = "snps,dwmac";
74 reg = < 0x18000 0x2000 >; 78 reg = < 0x18000 0x2000 >;
@@ -81,6 +85,7 @@
81 max-speed = <100>; 85 max-speed = <100>;
82 resets = <&creg_rst 5>; 86 resets = <&creg_rst 5>;
83 reset-names = "stmmaceth"; 87 reset-names = "stmmaceth";
88 mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
84 }; 89 };
85 90
86 ehci@0x40000 { 91 ehci@0x40000 {
diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts
index 006aa3de5348..ef149f59929a 100644
--- a/arch/arc/boot/dts/hsdk.dts
+++ b/arch/arc/boot/dts/hsdk.dts
@@ -25,6 +25,10 @@
25 bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8 console=ttyS0,115200n8 debug print-fatal-signals=1"; 25 bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8 console=ttyS0,115200n8 debug print-fatal-signals=1";
26 }; 26 };
27 27
28 aliases {
29 ethernet = &gmac;
30 };
31
28 cpus { 32 cpus {
29 #address-cells = <1>; 33 #address-cells = <1>;
30 #size-cells = <0>; 34 #size-cells = <0>;
@@ -163,7 +167,7 @@
163 #clock-cells = <0>; 167 #clock-cells = <0>;
164 }; 168 };
165 169
166 ethernet@8000 { 170 gmac: ethernet@8000 {
167 #interrupt-cells = <1>; 171 #interrupt-cells = <1>;
168 compatible = "snps,dwmac"; 172 compatible = "snps,dwmac";
169 reg = <0x8000 0x2000>; 173 reg = <0x8000 0x2000>;
@@ -176,6 +180,8 @@
176 phy-handle = <&phy0>; 180 phy-handle = <&phy0>;
177 resets = <&cgu_rst HSDK_ETH_RESET>; 181 resets = <&cgu_rst HSDK_ETH_RESET>;
178 reset-names = "stmmaceth"; 182 reset-names = "stmmaceth";
183 mac-address = [00 00 00 00 00 00]; /* Filled in by U-Boot */
184 dma-coherent;
179 185
180 mdio { 186 mdio {
181 #address-cells = <1>; 187 #address-cells = <1>;
@@ -194,12 +200,14 @@
194 compatible = "snps,hsdk-v1.0-ohci", "generic-ohci"; 200 compatible = "snps,hsdk-v1.0-ohci", "generic-ohci";
195 reg = <0x60000 0x100>; 201 reg = <0x60000 0x100>;
196 interrupts = <15>; 202 interrupts = <15>;
203 dma-coherent;
197 }; 204 };
198 205
199 ehci@40000 { 206 ehci@40000 {
200 compatible = "snps,hsdk-v1.0-ehci", "generic-ehci"; 207 compatible = "snps,hsdk-v1.0-ehci", "generic-ehci";
201 reg = <0x40000 0x100>; 208 reg = <0x40000 0x100>;
202 interrupts = <15>; 209 interrupts = <15>;
210 dma-coherent;
203 }; 211 };
204 212
205 mmc@a000 { 213 mmc@a000 {
@@ -212,6 +220,7 @@
212 clock-names = "biu", "ciu"; 220 clock-names = "biu", "ciu";
213 interrupts = <12>; 221 interrupts = <12>;
214 bus-width = <4>; 222 bus-width = <4>;
223 dma-coherent;
215 }; 224 };
216 }; 225 };
217 226
diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig
index a635ea972304..41bc08be6a3b 100644
--- a/arch/arc/configs/axs101_defconfig
+++ b/arch/arc/configs/axs101_defconfig
@@ -1,5 +1,3 @@
1CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
5# CONFIG_CROSS_MEMORY_ATTACH is not set 3# CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -63,7 +61,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y
63CONFIG_MOUSE_SERIAL=y 61CONFIG_MOUSE_SERIAL=y
64CONFIG_MOUSE_SYNAPTICS_USB=y 62CONFIG_MOUSE_SYNAPTICS_USB=y
65# CONFIG_LEGACY_PTYS is not set 63# CONFIG_LEGACY_PTYS is not set
66# CONFIG_DEVKMEM is not set
67CONFIG_SERIAL_8250=y 64CONFIG_SERIAL_8250=y
68CONFIG_SERIAL_8250_CONSOLE=y 65CONFIG_SERIAL_8250_CONSOLE=y
69CONFIG_SERIAL_8250_DW=y 66CONFIG_SERIAL_8250_DW=y
diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig
index aa507e423075..1e1c4a8011b5 100644
--- a/arch/arc/configs/axs103_defconfig
+++ b/arch/arc/configs/axs103_defconfig
@@ -1,5 +1,3 @@
1CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
5# CONFIG_CROSS_MEMORY_ATTACH is not set 3# CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -64,7 +62,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y
64CONFIG_MOUSE_SERIAL=y 62CONFIG_MOUSE_SERIAL=y
65CONFIG_MOUSE_SYNAPTICS_USB=y 63CONFIG_MOUSE_SYNAPTICS_USB=y
66# CONFIG_LEGACY_PTYS is not set 64# CONFIG_LEGACY_PTYS is not set
67# CONFIG_DEVKMEM is not set
68CONFIG_SERIAL_8250=y 65CONFIG_SERIAL_8250=y
69CONFIG_SERIAL_8250_CONSOLE=y 66CONFIG_SERIAL_8250_CONSOLE=y
70CONFIG_SERIAL_8250_DW=y 67CONFIG_SERIAL_8250_DW=y
diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig
index eba07f468654..6b0c0cfd5c30 100644
--- a/arch/arc/configs/axs103_smp_defconfig
+++ b/arch/arc/configs/axs103_smp_defconfig
@@ -1,5 +1,3 @@
1CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
5# CONFIG_CROSS_MEMORY_ATTACH is not set 3# CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -65,7 +63,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y
65CONFIG_MOUSE_SERIAL=y 63CONFIG_MOUSE_SERIAL=y
66CONFIG_MOUSE_SYNAPTICS_USB=y 64CONFIG_MOUSE_SYNAPTICS_USB=y
67# CONFIG_LEGACY_PTYS is not set 65# CONFIG_LEGACY_PTYS is not set
68# CONFIG_DEVKMEM is not set
69CONFIG_SERIAL_8250=y 66CONFIG_SERIAL_8250=y
70CONFIG_SERIAL_8250_CONSOLE=y 67CONFIG_SERIAL_8250_CONSOLE=y
71CONFIG_SERIAL_8250_DW=y 68CONFIG_SERIAL_8250_DW=y
diff --git a/arch/arc/configs/haps_hs_defconfig b/arch/arc/configs/haps_hs_defconfig
index 098b19fbaa51..240dd2cd5148 100644
--- a/arch/arc/configs/haps_hs_defconfig
+++ b/arch/arc/configs/haps_hs_defconfig
@@ -1,4 +1,3 @@
1CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2# CONFIG_SWAP is not set 1# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
@@ -57,7 +56,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y
57# CONFIG_SERIO_SERPORT is not set 56# CONFIG_SERIO_SERPORT is not set
58CONFIG_SERIO_ARC_PS2=y 57CONFIG_SERIO_ARC_PS2=y
59# CONFIG_LEGACY_PTYS is not set 58# CONFIG_LEGACY_PTYS is not set
60# CONFIG_DEVKMEM is not set
61CONFIG_SERIAL_8250=y 59CONFIG_SERIAL_8250=y
62CONFIG_SERIAL_8250_CONSOLE=y 60CONFIG_SERIAL_8250_CONSOLE=y
63CONFIG_SERIAL_8250_NR_UARTS=1 61CONFIG_SERIAL_8250_NR_UARTS=1
diff --git a/arch/arc/configs/haps_hs_smp_defconfig b/arch/arc/configs/haps_hs_smp_defconfig
index 0104c404d897..14ae7e5acc7c 100644
--- a/arch/arc/configs/haps_hs_smp_defconfig
+++ b/arch/arc/configs/haps_hs_smp_defconfig
@@ -1,4 +1,3 @@
1CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2# CONFIG_SWAP is not set 1# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
@@ -60,7 +59,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y
60# CONFIG_SERIO_SERPORT is not set 59# CONFIG_SERIO_SERPORT is not set
61CONFIG_SERIO_ARC_PS2=y 60CONFIG_SERIO_ARC_PS2=y
62# CONFIG_LEGACY_PTYS is not set 61# CONFIG_LEGACY_PTYS is not set
63# CONFIG_DEVKMEM is not set
64CONFIG_SERIAL_8250=y 62CONFIG_SERIAL_8250=y
65CONFIG_SERIAL_8250_CONSOLE=y 63CONFIG_SERIAL_8250_CONSOLE=y
66CONFIG_SERIAL_8250_NR_UARTS=1 64CONFIG_SERIAL_8250_NR_UARTS=1
diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig
index 6491be0ddbc9..1dec2b4bc5e6 100644
--- a/arch/arc/configs/hsdk_defconfig
+++ b/arch/arc/configs/hsdk_defconfig
@@ -1,4 +1,3 @@
1CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3# CONFIG_CROSS_MEMORY_ATTACH is not set 2# CONFIG_CROSS_MEMORY_ATTACH is not set
4CONFIG_NO_HZ_IDLE=y 3CONFIG_NO_HZ_IDLE=y
diff --git a/arch/arc/configs/nps_defconfig b/arch/arc/configs/nps_defconfig
index 7c9c706ae7f6..31ba224bbfb4 100644
--- a/arch/arc/configs/nps_defconfig
+++ b/arch/arc/configs/nps_defconfig
@@ -59,7 +59,6 @@ CONFIG_NETCONSOLE=y
59# CONFIG_INPUT_MOUSE is not set 59# CONFIG_INPUT_MOUSE is not set
60# CONFIG_SERIO is not set 60# CONFIG_SERIO is not set
61# CONFIG_LEGACY_PTYS is not set 61# CONFIG_LEGACY_PTYS is not set
62# CONFIG_DEVKMEM is not set
63CONFIG_SERIAL_8250=y 62CONFIG_SERIAL_8250=y
64CONFIG_SERIAL_8250_CONSOLE=y 63CONFIG_SERIAL_8250_CONSOLE=y
65CONFIG_SERIAL_8250_NR_UARTS=1 64CONFIG_SERIAL_8250_NR_UARTS=1
diff --git a/arch/arc/configs/nsim_700_defconfig b/arch/arc/configs/nsim_700_defconfig
index 99e05cf63fca..8e0b8b134cd9 100644
--- a/arch/arc/configs/nsim_700_defconfig
+++ b/arch/arc/configs/nsim_700_defconfig
@@ -1,5 +1,4 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
@@ -44,7 +43,6 @@ CONFIG_LXT_PHY=y
44# CONFIG_INPUT_MOUSE is not set 43# CONFIG_INPUT_MOUSE is not set
45# CONFIG_SERIO is not set 44# CONFIG_SERIO is not set
46# CONFIG_LEGACY_PTYS is not set 45# CONFIG_LEGACY_PTYS is not set
47# CONFIG_DEVKMEM is not set
48CONFIG_SERIAL_ARC=y 46CONFIG_SERIAL_ARC=y
49CONFIG_SERIAL_ARC_CONSOLE=y 47CONFIG_SERIAL_ARC_CONSOLE=y
50# CONFIG_HW_RANDOM is not set 48# CONFIG_HW_RANDOM is not set
diff --git a/arch/arc/configs/nsim_hs_defconfig b/arch/arc/configs/nsim_hs_defconfig
index 0dc4f9b737e7..739b90e5e893 100644
--- a/arch/arc/configs/nsim_hs_defconfig
+++ b/arch/arc/configs/nsim_hs_defconfig
@@ -1,5 +1,4 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
@@ -45,7 +44,6 @@ CONFIG_DEVTMPFS=y
45# CONFIG_INPUT_MOUSE is not set 44# CONFIG_INPUT_MOUSE is not set
46# CONFIG_SERIO is not set 45# CONFIG_SERIO is not set
47# CONFIG_LEGACY_PTYS is not set 46# CONFIG_LEGACY_PTYS is not set
48# CONFIG_DEVKMEM is not set
49CONFIG_SERIAL_ARC=y 47CONFIG_SERIAL_ARC=y
50CONFIG_SERIAL_ARC_CONSOLE=y 48CONFIG_SERIAL_ARC_CONSOLE=y
51# CONFIG_HW_RANDOM is not set 49# CONFIG_HW_RANDOM is not set
diff --git a/arch/arc/configs/nsim_hs_smp_defconfig b/arch/arc/configs/nsim_hs_smp_defconfig
index be3c30a15e54..b5895bdf3a93 100644
--- a/arch/arc/configs/nsim_hs_smp_defconfig
+++ b/arch/arc/configs/nsim_hs_smp_defconfig
@@ -1,5 +1,4 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4# CONFIG_CROSS_MEMORY_ATTACH is not set 3# CONFIG_CROSS_MEMORY_ATTACH is not set
5CONFIG_HIGH_RES_TIMERS=y 4CONFIG_HIGH_RES_TIMERS=y
@@ -44,7 +43,6 @@ CONFIG_DEVTMPFS=y
44# CONFIG_INPUT_MOUSE is not set 43# CONFIG_INPUT_MOUSE is not set
45# CONFIG_SERIO is not set 44# CONFIG_SERIO is not set
46# CONFIG_LEGACY_PTYS is not set 45# CONFIG_LEGACY_PTYS is not set
47# CONFIG_DEVKMEM is not set
48CONFIG_SERIAL_ARC=y 46CONFIG_SERIAL_ARC=y
49CONFIG_SERIAL_ARC_CONSOLE=y 47CONFIG_SERIAL_ARC_CONSOLE=y
50# CONFIG_HW_RANDOM is not set 48# CONFIG_HW_RANDOM is not set
diff --git a/arch/arc/configs/nsimosci_defconfig b/arch/arc/configs/nsimosci_defconfig
index 3a74b9b21772..f14eeff7d308 100644
--- a/arch/arc/configs/nsimosci_defconfig
+++ b/arch/arc/configs/nsimosci_defconfig
@@ -1,5 +1,4 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
5# CONFIG_CROSS_MEMORY_ATTACH is not set 4# CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -48,7 +47,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y
48# CONFIG_SERIO_SERPORT is not set 47# CONFIG_SERIO_SERPORT is not set
49CONFIG_SERIO_ARC_PS2=y 48CONFIG_SERIO_ARC_PS2=y
50# CONFIG_LEGACY_PTYS is not set 49# CONFIG_LEGACY_PTYS is not set
51# CONFIG_DEVKMEM is not set
52CONFIG_SERIAL_8250=y 50CONFIG_SERIAL_8250=y
53CONFIG_SERIAL_8250_CONSOLE=y 51CONFIG_SERIAL_8250_CONSOLE=y
54CONFIG_SERIAL_8250_NR_UARTS=1 52CONFIG_SERIAL_8250_NR_UARTS=1
diff --git a/arch/arc/configs/nsimosci_hs_defconfig b/arch/arc/configs/nsimosci_hs_defconfig
index ea2834b4dc1d..025298a48305 100644
--- a/arch/arc/configs/nsimosci_hs_defconfig
+++ b/arch/arc/configs/nsimosci_hs_defconfig
@@ -1,5 +1,4 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
5# CONFIG_CROSS_MEMORY_ATTACH is not set 4# CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -47,7 +46,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y
47# CONFIG_SERIO_SERPORT is not set 46# CONFIG_SERIO_SERPORT is not set
48CONFIG_SERIO_ARC_PS2=y 47CONFIG_SERIO_ARC_PS2=y
49# CONFIG_LEGACY_PTYS is not set 48# CONFIG_LEGACY_PTYS is not set
50# CONFIG_DEVKMEM is not set
51CONFIG_SERIAL_8250=y 49CONFIG_SERIAL_8250=y
52CONFIG_SERIAL_8250_CONSOLE=y 50CONFIG_SERIAL_8250_CONSOLE=y
53CONFIG_SERIAL_8250_NR_UARTS=1 51CONFIG_SERIAL_8250_NR_UARTS=1
diff --git a/arch/arc/configs/nsimosci_hs_smp_defconfig b/arch/arc/configs/nsimosci_hs_smp_defconfig
index 80a5a1b4924b..df7b77b13b82 100644
--- a/arch/arc/configs/nsimosci_hs_smp_defconfig
+++ b/arch/arc/configs/nsimosci_hs_smp_defconfig
@@ -1,4 +1,3 @@
1CONFIG_DEFAULT_HOSTNAME="ARCLinux"
2# CONFIG_SWAP is not set 1# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4# CONFIG_CROSS_MEMORY_ATTACH is not set 3# CONFIG_CROSS_MEMORY_ATTACH is not set
@@ -58,7 +57,6 @@ CONFIG_MOUSE_PS2_TOUCHKIT=y
58# CONFIG_SERIO_SERPORT is not set 57# CONFIG_SERIO_SERPORT is not set
59CONFIG_SERIO_ARC_PS2=y 58CONFIG_SERIO_ARC_PS2=y
60# CONFIG_LEGACY_PTYS is not set 59# CONFIG_LEGACY_PTYS is not set
61# CONFIG_DEVKMEM is not set
62CONFIG_SERIAL_8250=y 60CONFIG_SERIAL_8250=y
63CONFIG_SERIAL_8250_CONSOLE=y 61CONFIG_SERIAL_8250_CONSOLE=y
64CONFIG_SERIAL_8250_NR_UARTS=1 62CONFIG_SERIAL_8250_NR_UARTS=1
diff --git a/arch/arc/configs/tb10x_defconfig b/arch/arc/configs/tb10x_defconfig
index 2cc87f909747..a7f65313f84a 100644
--- a/arch/arc/configs/tb10x_defconfig
+++ b/arch/arc/configs/tb10x_defconfig
@@ -57,7 +57,6 @@ CONFIG_STMMAC_ETH=y
57# CONFIG_SERIO is not set 57# CONFIG_SERIO is not set
58# CONFIG_VT is not set 58# CONFIG_VT is not set
59# CONFIG_LEGACY_PTYS is not set 59# CONFIG_LEGACY_PTYS is not set
60# CONFIG_DEVKMEM is not set
61CONFIG_SERIAL_8250=y 60CONFIG_SERIAL_8250=y
62CONFIG_SERIAL_8250_CONSOLE=y 61CONFIG_SERIAL_8250_CONSOLE=y
63CONFIG_SERIAL_8250_NR_UARTS=1 62CONFIG_SERIAL_8250_NR_UARTS=1
diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig
index f629493929ea..db47c3541f15 100644
--- a/arch/arc/configs/vdk_hs38_defconfig
+++ b/arch/arc/configs/vdk_hs38_defconfig
@@ -1,5 +1,4 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_CROSS_MEMORY_ATTACH is not set 2# CONFIG_CROSS_MEMORY_ATTACH is not set
4CONFIG_HIGH_RES_TIMERS=y 3CONFIG_HIGH_RES_TIMERS=y
5CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
@@ -53,7 +52,6 @@ CONFIG_NATIONAL_PHY=y
53CONFIG_MOUSE_PS2_TOUCHKIT=y 52CONFIG_MOUSE_PS2_TOUCHKIT=y
54CONFIG_SERIO_ARC_PS2=y 53CONFIG_SERIO_ARC_PS2=y
55# CONFIG_LEGACY_PTYS is not set 54# CONFIG_LEGACY_PTYS is not set
56# CONFIG_DEVKMEM is not set
57CONFIG_SERIAL_8250=y 55CONFIG_SERIAL_8250=y
58CONFIG_SERIAL_8250_CONSOLE=y 56CONFIG_SERIAL_8250_CONSOLE=y
59CONFIG_SERIAL_8250_DW=y 57CONFIG_SERIAL_8250_DW=y
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig
index 21f0ca26a05d..a8ac5e917d9a 100644
--- a/arch/arc/configs/vdk_hs38_smp_defconfig
+++ b/arch/arc/configs/vdk_hs38_smp_defconfig
@@ -1,5 +1,4 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_DEFAULT_HOSTNAME="ARCLinux"
3# CONFIG_CROSS_MEMORY_ATTACH is not set 2# CONFIG_CROSS_MEMORY_ATTACH is not set
4CONFIG_HIGH_RES_TIMERS=y 3CONFIG_HIGH_RES_TIMERS=y
5CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h
index 4e0072730241..158af079838d 100644
--- a/arch/arc/include/asm/atomic.h
+++ b/arch/arc/include/asm/atomic.h
@@ -84,7 +84,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \
84 "1: llock %[orig], [%[ctr]] \n" \ 84 "1: llock %[orig], [%[ctr]] \n" \
85 " " #asm_op " %[val], %[orig], %[i] \n" \ 85 " " #asm_op " %[val], %[orig], %[i] \n" \
86 " scond %[val], [%[ctr]] \n" \ 86 " scond %[val], [%[ctr]] \n" \
87 " \n" \ 87 " bnz 1b \n" \
88 : [val] "=&r" (val), \ 88 : [val] "=&r" (val), \
89 [orig] "=&r" (orig) \ 89 [orig] "=&r" (orig) \
90 : [ctr] "r" (&v->counter), \ 90 : [ctr] "r" (&v->counter), \
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h
new file mode 100644
index 000000000000..c946c0a83e76
--- /dev/null
+++ b/arch/arc/include/asm/dma-mapping.h
@@ -0,0 +1,13 @@
1// SPDX-License-Identifier: GPL-2.0
2// (C) 2018 Synopsys, Inc. (www.synopsys.com)
3
4#ifndef ASM_ARC_DMA_MAPPING_H
5#define ASM_ARC_DMA_MAPPING_H
6
7#include <asm-generic/dma-mapping.h>
8
9void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
10 const struct iommu_ops *iommu, bool coherent);
11#define arch_setup_dma_ops arch_setup_dma_ops
12
13#endif
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 783b20354f8b..e8d9fb452346 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -83,9 +83,6 @@ done:
83static void show_faulting_vma(unsigned long address, char *buf) 83static void show_faulting_vma(unsigned long address, char *buf)
84{ 84{
85 struct vm_area_struct *vma; 85 struct vm_area_struct *vma;
86 struct inode *inode;
87 unsigned long ino = 0;
88 dev_t dev = 0;
89 char *nm = buf; 86 char *nm = buf;
90 struct mm_struct *active_mm = current->active_mm; 87 struct mm_struct *active_mm = current->active_mm;
91 88
@@ -99,12 +96,10 @@ static void show_faulting_vma(unsigned long address, char *buf)
99 * if the container VMA is not found 96 * if the container VMA is not found
100 */ 97 */
101 if (vma && (vma->vm_start <= address)) { 98 if (vma && (vma->vm_start <= address)) {
102 struct file *file = vma->vm_file; 99 if (vma->vm_file) {
103 if (file) { 100 nm = file_path(vma->vm_file, buf, PAGE_SIZE - 1);
104 nm = file_path(file, buf, PAGE_SIZE - 1); 101 if (IS_ERR(nm))
105 inode = file_inode(vma->vm_file); 102 nm = "?";
106 dev = inode->i_sb->s_dev;
107 ino = inode->i_ino;
108 } 103 }
109 pr_info(" @off 0x%lx in [%s]\n" 104 pr_info(" @off 0x%lx in [%s]\n"
110 " VMA: 0x%08lx to 0x%08lx\n", 105 " VMA: 0x%08lx to 0x%08lx\n",
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
index 25c631942500..f2701c13a66b 100644
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -65,7 +65,7 @@ char *arc_cache_mumbojumbo(int c, char *buf, int len)
65 65
66 n += scnprintf(buf + n, len - n, "Peripherals\t: %#lx%s%s\n", 66 n += scnprintf(buf + n, len - n, "Peripherals\t: %#lx%s%s\n",
67 perip_base, 67 perip_base,
68 IS_AVAIL3(ioc_exists, ioc_enable, ", IO-Coherency ")); 68 IS_AVAIL3(ioc_exists, ioc_enable, ", IO-Coherency (per-device) "));
69 69
70 return buf; 70 return buf;
71} 71}
@@ -897,15 +897,6 @@ static void __dma_cache_wback_slc(phys_addr_t start, unsigned long sz)
897} 897}
898 898
899/* 899/*
900 * DMA ops for systems with IOC
901 * IOC hardware snoops all DMA traffic keeping the caches consistent with
902 * memory - eliding need for any explicit cache maintenance of DMA buffers
903 */
904static void __dma_cache_wback_inv_ioc(phys_addr_t start, unsigned long sz) {}
905static void __dma_cache_inv_ioc(phys_addr_t start, unsigned long sz) {}
906static void __dma_cache_wback_ioc(phys_addr_t start, unsigned long sz) {}
907
908/*
909 * Exported DMA API 900 * Exported DMA API
910 */ 901 */
911void dma_cache_wback_inv(phys_addr_t start, unsigned long sz) 902void dma_cache_wback_inv(phys_addr_t start, unsigned long sz)
@@ -1153,6 +1144,19 @@ noinline void __init arc_ioc_setup(void)
1153{ 1144{
1154 unsigned int ioc_base, mem_sz; 1145 unsigned int ioc_base, mem_sz;
1155 1146
1147 /*
1148 * As for today we don't support both IOC and ZONE_HIGHMEM enabled
1149 * simultaneously. This happens because as of today IOC aperture covers
1150 * only ZONE_NORMAL (low mem) and any dma transactions outside this
1151 * region won't be HW coherent.
1152 * If we want to use both IOC and ZONE_HIGHMEM we can use
1153 * bounce_buffer to handle dma transactions to HIGHMEM.
1154 * Also it is possible to modify dma_direct cache ops or increase IOC
1155 * aperture size if we are planning to use HIGHMEM without PAE.
1156 */
1157 if (IS_ENABLED(CONFIG_HIGHMEM))
1158 panic("IOC and HIGHMEM can't be used simultaneously");
1159
1156 /* Flush + invalidate + disable L1 dcache */ 1160 /* Flush + invalidate + disable L1 dcache */
1157 __dc_disable(); 1161 __dc_disable();
1158 1162
@@ -1264,11 +1268,7 @@ void __init arc_cache_init_master(void)
1264 if (is_isa_arcv2() && ioc_enable) 1268 if (is_isa_arcv2() && ioc_enable)
1265 arc_ioc_setup(); 1269 arc_ioc_setup();
1266 1270
1267 if (is_isa_arcv2() && ioc_enable) { 1271 if (is_isa_arcv2() && l2_line_sz && slc_enable) {
1268 __dma_cache_wback_inv = __dma_cache_wback_inv_ioc;
1269 __dma_cache_inv = __dma_cache_inv_ioc;
1270 __dma_cache_wback = __dma_cache_wback_ioc;
1271 } else if (is_isa_arcv2() && l2_line_sz && slc_enable) {
1272 __dma_cache_wback_inv = __dma_cache_wback_inv_slc; 1272 __dma_cache_wback_inv = __dma_cache_wback_inv_slc;
1273 __dma_cache_inv = __dma_cache_inv_slc; 1273 __dma_cache_inv = __dma_cache_inv_slc;
1274 __dma_cache_wback = __dma_cache_wback_slc; 1274 __dma_cache_wback = __dma_cache_wback_slc;
@@ -1277,6 +1277,12 @@ void __init arc_cache_init_master(void)
1277 __dma_cache_inv = __dma_cache_inv_l1; 1277 __dma_cache_inv = __dma_cache_inv_l1;
1278 __dma_cache_wback = __dma_cache_wback_l1; 1278 __dma_cache_wback = __dma_cache_wback_l1;
1279 } 1279 }
1280 /*
1281 * In case of IOC (say IOC+SLC case), pointers above could still be set
1282 * but end up not being relevant as the first function in chain is not
1283 * called at all for @dma_direct_ops
1284 * arch_sync_dma_for_cpu() -> dma_cache_*() -> __dma_cache_*()
1285 */
1280} 1286}
1281 1287
1282void __ref arc_cache_init(void) 1288void __ref arc_cache_init(void)
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index ec47e6079f5d..c75d5c3470e3 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -6,20 +6,17 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9/*
10 * DMA Coherent API Notes
11 *
12 * I/O is inherently non-coherent on ARC. So a coherent DMA buffer is
13 * implemented by accessing it using a kernel virtual address, with
14 * Cache bit off in the TLB entry.
15 *
16 * The default DMA address == Phy address which is 0x8000_0000 based.
17 */
18
19#include <linux/dma-noncoherent.h> 9#include <linux/dma-noncoherent.h>
20#include <asm/cache.h> 10#include <asm/cache.h>
21#include <asm/cacheflush.h> 11#include <asm/cacheflush.h>
22 12
13/*
14 * ARCH specific callbacks for generic noncoherent DMA ops (dma/noncoherent.c)
15 * - hardware IOC not available (or "dma-coherent" not set for device in DT)
16 * - But still handle both coherent and non-coherent requests from caller
17 *
18 * For DMA coherent hardware (IOC) generic code suffices
19 */
23void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, 20void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
24 gfp_t gfp, unsigned long attrs) 21 gfp_t gfp, unsigned long attrs)
25{ 22{
@@ -27,42 +24,29 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
27 struct page *page; 24 struct page *page;
28 phys_addr_t paddr; 25 phys_addr_t paddr;
29 void *kvaddr; 26 void *kvaddr;
30 int need_coh = 1, need_kvaddr = 0; 27 bool need_coh = !(attrs & DMA_ATTR_NON_CONSISTENT);
31
32 page = alloc_pages(gfp, order);
33 if (!page)
34 return NULL;
35 28
36 /* 29 /*
37 * IOC relies on all data (even coherent DMA data) being in cache 30 * __GFP_HIGHMEM flag is cleared by upper layer functions
38 * Thus allocate normal cached memory 31 * (in include/linux/dma-mapping.h) so we should never get a
39 * 32 * __GFP_HIGHMEM here.
40 * The gains with IOC are two pronged:
41 * -For streaming data, elides need for cache maintenance, saving
42 * cycles in flush code, and bus bandwidth as all the lines of a
43 * buffer need to be flushed out to memory
44 * -For coherent data, Read/Write to buffers terminate early in cache
45 * (vs. always going to memory - thus are faster)
46 */ 33 */
47 if ((is_isa_arcv2() && ioc_enable) || 34 BUG_ON(gfp & __GFP_HIGHMEM);
48 (attrs & DMA_ATTR_NON_CONSISTENT))
49 need_coh = 0;
50 35
51 /* 36 page = alloc_pages(gfp, order);
52 * - A coherent buffer needs MMU mapping to enforce non-cachability 37 if (!page)
53 * - A highmem page needs a virtual handle (hence MMU mapping) 38 return NULL;
54 * independent of cachability
55 */
56 if (PageHighMem(page) || need_coh)
57 need_kvaddr = 1;
58 39
59 /* This is linear addr (0x8000_0000 based) */ 40 /* This is linear addr (0x8000_0000 based) */
60 paddr = page_to_phys(page); 41 paddr = page_to_phys(page);
61 42
62 *dma_handle = paddr; 43 *dma_handle = paddr;
63 44
64 /* This is kernel Virtual address (0x7000_0000 based) */ 45 /*
65 if (need_kvaddr) { 46 * A coherent buffer needs MMU mapping to enforce non-cachability.
47 * kvaddr is kernel Virtual address (0x7000_0000 based).
48 */
49 if (need_coh) {
66 kvaddr = ioremap_nocache(paddr, size); 50 kvaddr = ioremap_nocache(paddr, size);
67 if (kvaddr == NULL) { 51 if (kvaddr == NULL) {
68 __free_pages(page, order); 52 __free_pages(page, order);
@@ -93,12 +77,8 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
93{ 77{
94 phys_addr_t paddr = dma_handle; 78 phys_addr_t paddr = dma_handle;
95 struct page *page = virt_to_page(paddr); 79 struct page *page = virt_to_page(paddr);
96 int is_non_coh = 1;
97
98 is_non_coh = (attrs & DMA_ATTR_NON_CONSISTENT) ||
99 (is_isa_arcv2() && ioc_enable);
100 80
101 if (PageHighMem(page) || !is_non_coh) 81 if (!(attrs & DMA_ATTR_NON_CONSISTENT))
102 iounmap((void __force __iomem *)vaddr); 82 iounmap((void __force __iomem *)vaddr);
103 83
104 __free_pages(page, get_order(size)); 84 __free_pages(page, get_order(size));
@@ -185,3 +165,23 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
185 break; 165 break;
186 } 166 }
187} 167}
168
169/*
170 * Plug in coherent or noncoherent dma ops
171 */
172void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
173 const struct iommu_ops *iommu, bool coherent)
174{
175 /*
176 * IOC hardware snoops all DMA traffic keeping the caches consistent
177 * with memory - eliding need for any explicit cache maintenance of
178 * DMA buffers - so we can use dma_direct cache ops.
179 */
180 if (is_isa_arcv2() && ioc_enable && coherent) {
181 set_dma_ops(dev, &dma_direct_ops);
182 dev_info(dev, "use dma_direct_ops cache ops\n");
183 } else {
184 set_dma_ops(dev, &dma_noncoherent_ops);
185 dev_info(dev, "use dma_noncoherent_ops cache ops\n");
186 }
187}