diff options
Diffstat (limited to 'arch')
127 files changed, 1217 insertions, 357 deletions
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index e8355f4d8b0c..032030361bef 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -38,6 +38,7 @@ dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb | |||
38 | dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb | 38 | dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb |
39 | dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb | 39 | dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb |
40 | # sama5d3 | 40 | # sama5d3 |
41 | dtb-$(CONFIG_ARCH_AT91) += at91-sama5d3_xplained.dtb | ||
41 | dtb-$(CONFIG_ARCH_AT91) += sama5d31ek.dtb | 42 | dtb-$(CONFIG_ARCH_AT91) += sama5d31ek.dtb |
42 | dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb | 43 | dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb |
43 | dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb | 44 | dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb |
diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts b/arch/arm/boot/dts/at91-sama5d3_xplained.dts new file mode 100644 index 000000000000..ce1375595e5f --- /dev/null +++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts | |||
@@ -0,0 +1,229 @@ | |||
1 | /* | ||
2 | * at91-sama5d3_xplained.dts - Device Tree file for the SAMA5D3 Xplained board | ||
3 | * | ||
4 | * Copyright (C) 2014 Atmel, | ||
5 | * 2014 Nicolas Ferre <nicolas.ferre@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | /dts-v1/; | ||
10 | #include "sama5d36.dtsi" | ||
11 | |||
12 | / { | ||
13 | model = "SAMA5D3 Xplained"; | ||
14 | compatible = "atmel,sama5d3-xplained", "atmel,sama5d3", "atmel,sama5"; | ||
15 | |||
16 | chosen { | ||
17 | bootargs = "console=ttyS0,115200"; | ||
18 | }; | ||
19 | |||
20 | memory { | ||
21 | reg = <0x20000000 0x10000000>; | ||
22 | }; | ||
23 | |||
24 | ahb { | ||
25 | apb { | ||
26 | mmc0: mmc@f0000000 { | ||
27 | pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_dat4_7 &pinctrl_mmc0_cd>; | ||
28 | status = "okay"; | ||
29 | slot@0 { | ||
30 | reg = <0>; | ||
31 | bus-width = <8>; | ||
32 | cd-gpios = <&pioE 0 GPIO_ACTIVE_LOW>; | ||
33 | }; | ||
34 | }; | ||
35 | |||
36 | spi0: spi@f0004000 { | ||
37 | cs-gpios = <&pioD 13 0>; | ||
38 | status = "okay"; | ||
39 | }; | ||
40 | |||
41 | can0: can@f000c000 { | ||
42 | status = "okay"; | ||
43 | }; | ||
44 | |||
45 | i2c0: i2c@f0014000 { | ||
46 | status = "okay"; | ||
47 | }; | ||
48 | |||
49 | i2c1: i2c@f0018000 { | ||
50 | status = "okay"; | ||
51 | }; | ||
52 | |||
53 | macb0: ethernet@f0028000 { | ||
54 | phy-mode = "rgmii"; | ||
55 | status = "okay"; | ||
56 | }; | ||
57 | |||
58 | usart0: serial@f001c000 { | ||
59 | status = "okay"; | ||
60 | }; | ||
61 | |||
62 | usart1: serial@f0020000 { | ||
63 | pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts_cts>; | ||
64 | status = "okay"; | ||
65 | }; | ||
66 | |||
67 | uart0: serial@f0024000 { | ||
68 | status = "okay"; | ||
69 | }; | ||
70 | |||
71 | mmc1: mmc@f8000000 { | ||
72 | pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3 &pinctrl_mmc1_cd>; | ||
73 | status = "okay"; | ||
74 | slot@0 { | ||
75 | reg = <0>; | ||
76 | bus-width = <4>; | ||
77 | cd-gpios = <&pioE 1 GPIO_ACTIVE_HIGH>; | ||
78 | }; | ||
79 | }; | ||
80 | |||
81 | spi1: spi@f8008000 { | ||
82 | cs-gpios = <&pioC 25 0>, <0>, <0>, <&pioD 16 0>; | ||
83 | status = "okay"; | ||
84 | }; | ||
85 | |||
86 | adc0: adc@f8018000 { | ||
87 | pinctrl-0 = < | ||
88 | &pinctrl_adc0_adtrg | ||
89 | &pinctrl_adc0_ad0 | ||
90 | &pinctrl_adc0_ad1 | ||
91 | &pinctrl_adc0_ad2 | ||
92 | &pinctrl_adc0_ad3 | ||
93 | &pinctrl_adc0_ad4 | ||
94 | &pinctrl_adc0_ad5 | ||
95 | &pinctrl_adc0_ad6 | ||
96 | &pinctrl_adc0_ad7 | ||
97 | &pinctrl_adc0_ad8 | ||
98 | &pinctrl_adc0_ad9 | ||
99 | >; | ||
100 | status = "okay"; | ||
101 | }; | ||
102 | |||
103 | i2c2: i2c@f801c000 { | ||
104 | dmas = <0>, <0>; /* Do not use DMA for i2c2 */ | ||
105 | status = "okay"; | ||
106 | }; | ||
107 | |||
108 | macb1: ethernet@f802c000 { | ||
109 | phy-mode = "rmii"; | ||
110 | status = "okay"; | ||
111 | }; | ||
112 | |||
113 | dbgu: serial@ffffee00 { | ||
114 | status = "okay"; | ||
115 | }; | ||
116 | |||
117 | pinctrl@fffff200 { | ||
118 | board { | ||
119 | pinctrl_mmc0_cd: mmc0_cd { | ||
120 | atmel,pins = | ||
121 | <AT91_PIOE 0 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; | ||
122 | }; | ||
123 | |||
124 | pinctrl_mmc1_cd: mmc1_cd { | ||
125 | atmel,pins = | ||
126 | <AT91_PIOE 1 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; | ||
127 | }; | ||
128 | |||
129 | pinctrl_usba_vbus: usba_vbus { | ||
130 | atmel,pins = | ||
131 | <AT91_PIOE 9 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PE9, conflicts with A9 */ | ||
132 | }; | ||
133 | }; | ||
134 | }; | ||
135 | |||
136 | pmc: pmc@fffffc00 { | ||
137 | main: mainck { | ||
138 | clock-frequency = <12000000>; | ||
139 | }; | ||
140 | }; | ||
141 | }; | ||
142 | |||
143 | nand0: nand@60000000 { | ||
144 | nand-bus-width = <8>; | ||
145 | nand-ecc-mode = "hw"; | ||
146 | atmel,has-pmecc; | ||
147 | atmel,pmecc-cap = <4>; | ||
148 | atmel,pmecc-sector-size = <512>; | ||
149 | nand-on-flash-bbt; | ||
150 | status = "okay"; | ||
151 | |||
152 | at91bootstrap@0 { | ||
153 | label = "at91bootstrap"; | ||
154 | reg = <0x0 0x40000>; | ||
155 | }; | ||
156 | |||
157 | bootloader@40000 { | ||
158 | label = "bootloader"; | ||
159 | reg = <0x40000 0x80000>; | ||
160 | }; | ||
161 | |||
162 | bootloaderenv@c0000 { | ||
163 | label = "bootloader env"; | ||
164 | reg = <0xc0000 0xc0000>; | ||
165 | }; | ||
166 | |||
167 | dtb@180000 { | ||
168 | label = "device tree"; | ||
169 | reg = <0x180000 0x80000>; | ||
170 | }; | ||
171 | |||
172 | kernel@200000 { | ||
173 | label = "kernel"; | ||
174 | reg = <0x200000 0x600000>; | ||
175 | }; | ||
176 | |||
177 | rootfs@800000 { | ||
178 | label = "rootfs"; | ||
179 | reg = <0x800000 0x0f800000>; | ||
180 | }; | ||
181 | }; | ||
182 | |||
183 | usb0: gadget@00500000 { | ||
184 | atmel,vbus-gpio = <&pioE 9 GPIO_ACTIVE_HIGH>; /* PE9, conflicts with A9 */ | ||
185 | pinctrl-names = "default"; | ||
186 | pinctrl-0 = <&pinctrl_usba_vbus>; | ||
187 | status = "okay"; | ||
188 | }; | ||
189 | |||
190 | usb1: ohci@00600000 { | ||
191 | num-ports = <3>; | ||
192 | atmel,vbus-gpio = <0 | ||
193 | &pioE 3 GPIO_ACTIVE_LOW | ||
194 | &pioE 4 GPIO_ACTIVE_LOW | ||
195 | >; | ||
196 | status = "okay"; | ||
197 | }; | ||
198 | |||
199 | usb2: ehci@00700000 { | ||
200 | status = "okay"; | ||
201 | }; | ||
202 | }; | ||
203 | |||
204 | gpio_keys { | ||
205 | compatible = "gpio-keys"; | ||
206 | |||
207 | bp3 { | ||
208 | label = "PB_USER"; | ||
209 | gpios = <&pioE 29 GPIO_ACTIVE_LOW>; | ||
210 | linux,code = <0x104>; | ||
211 | gpio-key,wakeup; | ||
212 | }; | ||
213 | }; | ||
214 | |||
215 | leds { | ||
216 | compatible = "gpio-leds"; | ||
217 | |||
218 | d2 { | ||
219 | label = "d2"; | ||
220 | gpios = <&pioE 23 GPIO_ACTIVE_LOW>; /* PE23, conflicts with A23, CTS2 */ | ||
221 | linux,default-trigger = "heartbeat"; | ||
222 | }; | ||
223 | |||
224 | d3 { | ||
225 | label = "d3"; | ||
226 | gpios = <&pioE 24 GPIO_ACTIVE_HIGH>; | ||
227 | }; | ||
228 | }; | ||
229 | }; | ||
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index 0042f73068b0..fece8665fb63 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi | |||
@@ -523,7 +523,7 @@ | |||
523 | }; | 523 | }; |
524 | 524 | ||
525 | i2c0: i2c@fff88000 { | 525 | i2c0: i2c@fff88000 { |
526 | compatible = "atmel,at91sam9263-i2c"; | 526 | compatible = "atmel,at91sam9260-i2c"; |
527 | reg = <0xfff88000 0x100>; | 527 | reg = <0xfff88000 0x100>; |
528 | interrupts = <13 IRQ_TYPE_LEVEL_HIGH 6>; | 528 | interrupts = <13 IRQ_TYPE_LEVEL_HIGH 6>; |
529 | #address-cells = <1>; | 529 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts index e9487f6f0166..924a6a6ffd0f 100644 --- a/arch/arm/boot/dts/at91sam9n12ek.dts +++ b/arch/arm/boot/dts/at91sam9n12ek.dts | |||
@@ -124,6 +124,10 @@ | |||
124 | nand-on-flash-bbt; | 124 | nand-on-flash-bbt; |
125 | status = "okay"; | 125 | status = "okay"; |
126 | }; | 126 | }; |
127 | |||
128 | usb0: ohci@00500000 { | ||
129 | status = "okay"; | ||
130 | }; | ||
127 | }; | 131 | }; |
128 | 132 | ||
129 | leds { | 133 | leds { |
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index 52447c17537a..3d5faf85f51b 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi | |||
@@ -1228,7 +1228,7 @@ | |||
1228 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | 1228 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; |
1229 | reg = <0x00600000 0x100000>; | 1229 | reg = <0x00600000 0x100000>; |
1230 | interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; | 1230 | interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; |
1231 | clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>, | 1231 | clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, |
1232 | <&uhpck>; | 1232 | <&uhpck>; |
1233 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; | 1233 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; |
1234 | status = "disabled"; | 1234 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/ste-href.dtsi b/arch/arm/boot/dts/ste-href.dtsi index 0c1e8d871ed1..6cb9b68e2188 100644 --- a/arch/arm/boot/dts/ste-href.dtsi +++ b/arch/arm/boot/dts/ste-href.dtsi | |||
@@ -188,7 +188,6 @@ | |||
188 | msp2: msp@80117000 { | 188 | msp2: msp@80117000 { |
189 | pinctrl-names = "default"; | 189 | pinctrl-names = "default"; |
190 | pinctrl-0 = <&msp2_default_mode>; | 190 | pinctrl-0 = <&msp2_default_mode>; |
191 | status = "okay"; | ||
192 | }; | 191 | }; |
193 | 192 | ||
194 | msp3: msp@80125000 { | 193 | msp3: msp@80125000 { |
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi index 040bb0eba152..10666ca8aee1 100644 --- a/arch/arm/boot/dts/sun4i-a10.dtsi +++ b/arch/arm/boot/dts/sun4i-a10.dtsi | |||
@@ -315,7 +315,7 @@ | |||
315 | ranges; | 315 | ranges; |
316 | 316 | ||
317 | emac: ethernet@01c0b000 { | 317 | emac: ethernet@01c0b000 { |
318 | compatible = "allwinner,sun4i-emac"; | 318 | compatible = "allwinner,sun4i-a10-emac"; |
319 | reg = <0x01c0b000 0x1000>; | 319 | reg = <0x01c0b000 0x1000>; |
320 | interrupts = <55>; | 320 | interrupts = <55>; |
321 | clocks = <&ahb_gates 17>; | 321 | clocks = <&ahb_gates 17>; |
@@ -323,7 +323,7 @@ | |||
323 | }; | 323 | }; |
324 | 324 | ||
325 | mdio@01c0b080 { | 325 | mdio@01c0b080 { |
326 | compatible = "allwinner,sun4i-mdio"; | 326 | compatible = "allwinner,sun4i-a10-mdio"; |
327 | reg = <0x01c0b080 0x14>; | 327 | reg = <0x01c0b080 0x14>; |
328 | status = "disabled"; | 328 | status = "disabled"; |
329 | #address-cells = <1>; | 329 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi index ea16054857a4..64961595e8d6 100644 --- a/arch/arm/boot/dts/sun5i-a10s.dtsi +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi | |||
@@ -278,7 +278,7 @@ | |||
278 | ranges; | 278 | ranges; |
279 | 279 | ||
280 | emac: ethernet@01c0b000 { | 280 | emac: ethernet@01c0b000 { |
281 | compatible = "allwinner,sun4i-emac"; | 281 | compatible = "allwinner,sun4i-a10-emac"; |
282 | reg = <0x01c0b000 0x1000>; | 282 | reg = <0x01c0b000 0x1000>; |
283 | interrupts = <55>; | 283 | interrupts = <55>; |
284 | clocks = <&ahb_gates 17>; | 284 | clocks = <&ahb_gates 17>; |
@@ -286,7 +286,7 @@ | |||
286 | }; | 286 | }; |
287 | 287 | ||
288 | mdio@01c0b080 { | 288 | mdio@01c0b080 { |
289 | compatible = "allwinner,sun4i-mdio"; | 289 | compatible = "allwinner,sun4i-a10-mdio"; |
290 | reg = <0x01c0b080 0x14>; | 290 | reg = <0x01c0b080 0x14>; |
291 | status = "disabled"; | 291 | status = "disabled"; |
292 | #address-cells = <1>; | 292 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index 119f066f0d98..9ff09484847b 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi | |||
@@ -340,7 +340,7 @@ | |||
340 | ranges; | 340 | ranges; |
341 | 341 | ||
342 | emac: ethernet@01c0b000 { | 342 | emac: ethernet@01c0b000 { |
343 | compatible = "allwinner,sun4i-emac"; | 343 | compatible = "allwinner,sun4i-a10-emac"; |
344 | reg = <0x01c0b000 0x1000>; | 344 | reg = <0x01c0b000 0x1000>; |
345 | interrupts = <0 55 4>; | 345 | interrupts = <0 55 4>; |
346 | clocks = <&ahb_gates 17>; | 346 | clocks = <&ahb_gates 17>; |
@@ -348,7 +348,7 @@ | |||
348 | }; | 348 | }; |
349 | 349 | ||
350 | mdio@01c0b080 { | 350 | mdio@01c0b080 { |
351 | compatible = "allwinner,sun4i-mdio"; | 351 | compatible = "allwinner,sun4i-a10-mdio"; |
352 | reg = <0x01c0b080 0x14>; | 352 | reg = <0x01c0b080 0x14>; |
353 | status = "disabled"; | 353 | status = "disabled"; |
354 | #address-cells = <1>; | 354 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi index 9104224124ee..1e156d9d0506 100644 --- a/arch/arm/boot/dts/tegra30-cardhu.dtsi +++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi | |||
@@ -28,7 +28,7 @@ | |||
28 | compatible = "nvidia,cardhu", "nvidia,tegra30"; | 28 | compatible = "nvidia,cardhu", "nvidia,tegra30"; |
29 | 29 | ||
30 | aliases { | 30 | aliases { |
31 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 31 | rtc0 = "/i2c@7000d000/tps65911@2d"; |
32 | rtc1 = "/rtc@7000e000"; | 32 | rtc1 = "/rtc@7000e000"; |
33 | }; | 33 | }; |
34 | 34 | ||
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 845bc745706b..ee6982976d66 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -29,6 +29,7 @@ CONFIG_ARCH_OMAP3=y | |||
29 | CONFIG_ARCH_OMAP4=y | 29 | CONFIG_ARCH_OMAP4=y |
30 | CONFIG_SOC_OMAP5=y | 30 | CONFIG_SOC_OMAP5=y |
31 | CONFIG_SOC_AM33XX=y | 31 | CONFIG_SOC_AM33XX=y |
32 | CONFIG_SOC_DRA7XX=y | ||
32 | CONFIG_SOC_AM43XX=y | 33 | CONFIG_SOC_AM43XX=y |
33 | CONFIG_ARCH_ROCKCHIP=y | 34 | CONFIG_ARCH_ROCKCHIP=y |
34 | CONFIG_ARCH_SOCFPGA=y | 35 | CONFIG_ARCH_SOCFPGA=y |
diff --git a/arch/arm/mach-hisi/Kconfig b/arch/arm/mach-hisi/Kconfig index 8f4649b301b2..1abae5f6a418 100644 --- a/arch/arm/mach-hisi/Kconfig +++ b/arch/arm/mach-hisi/Kconfig | |||
@@ -8,7 +8,7 @@ config ARCH_HI3xxx | |||
8 | select CLKSRC_OF | 8 | select CLKSRC_OF |
9 | select GENERIC_CLOCKEVENTS | 9 | select GENERIC_CLOCKEVENTS |
10 | select HAVE_ARM_SCU | 10 | select HAVE_ARM_SCU |
11 | select HAVE_ARM_TWD | 11 | select HAVE_ARM_TWD if SMP |
12 | select HAVE_SMP | 12 | select HAVE_SMP |
13 | select PINCTRL | 13 | select PINCTRL |
14 | select PINCTRL_SINGLE | 14 | select PINCTRL_SINGLE |
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index af2e582d2b74..4d677f442539 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c | |||
@@ -482,6 +482,9 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) | |||
482 | if (IS_ENABLED(CONFIG_PCI_IMX6)) | 482 | if (IS_ENABLED(CONFIG_PCI_IMX6)) |
483 | clk_set_parent(clk[lvds1_sel], clk[sata_ref]); | 483 | clk_set_parent(clk[lvds1_sel], clk[sata_ref]); |
484 | 484 | ||
485 | /* Set initial power mode */ | ||
486 | imx6q_set_lpm(WAIT_CLOCKED); | ||
487 | |||
485 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); | 488 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); |
486 | base = of_iomap(np, 0); | 489 | base = of_iomap(np, 0); |
487 | WARN_ON(!base); | 490 | WARN_ON(!base); |
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c index 3781a1853998..4c86f3035205 100644 --- a/arch/arm/mach-imx/clk-imx6sl.c +++ b/arch/arm/mach-imx/clk-imx6sl.c | |||
@@ -266,6 +266,9 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node) | |||
266 | /* Audio-related clocks configuration */ | 266 | /* Audio-related clocks configuration */ |
267 | clk_set_parent(clks[IMX6SL_CLK_SPDIF0_SEL], clks[IMX6SL_CLK_PLL3_PFD3]); | 267 | clk_set_parent(clks[IMX6SL_CLK_SPDIF0_SEL], clks[IMX6SL_CLK_PLL3_PFD3]); |
268 | 268 | ||
269 | /* Set initial power mode */ | ||
270 | imx6q_set_lpm(WAIT_CLOCKED); | ||
271 | |||
269 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-gpt"); | 272 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-gpt"); |
270 | base = of_iomap(np, 0); | 273 | base = of_iomap(np, 0); |
271 | WARN_ON(!base); | 274 | WARN_ON(!base); |
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c index 9d47adc078aa..7a9b98589db7 100644 --- a/arch/arm/mach-imx/pm-imx6q.c +++ b/arch/arm/mach-imx/pm-imx6q.c | |||
@@ -236,8 +236,6 @@ void __init imx6q_pm_init(void) | |||
236 | regmap_update_bits(gpr, IOMUXC_GPR1, IMX6Q_GPR1_GINT, | 236 | regmap_update_bits(gpr, IOMUXC_GPR1, IMX6Q_GPR1_GINT, |
237 | IMX6Q_GPR1_GINT); | 237 | IMX6Q_GPR1_GINT); |
238 | 238 | ||
239 | /* Set initial power mode */ | ||
240 | imx6q_set_lpm(WAIT_CLOCKED); | ||
241 | 239 | ||
242 | suspend_set_ops(&imx6q_pm_ops); | 240 | suspend_set_ops(&imx6q_pm_ops); |
243 | } | 241 | } |
diff --git a/arch/arm/mach-moxart/Kconfig b/arch/arm/mach-moxart/Kconfig index ba470d64493b..3795ae28a613 100644 --- a/arch/arm/mach-moxart/Kconfig +++ b/arch/arm/mach-moxart/Kconfig | |||
@@ -2,7 +2,6 @@ config ARCH_MOXART | |||
2 | bool "MOXA ART SoC" if ARCH_MULTI_V4T | 2 | bool "MOXA ART SoC" if ARCH_MULTI_V4T |
3 | select CPU_FA526 | 3 | select CPU_FA526 |
4 | select ARM_DMA_MEM_BUFFERABLE | 4 | select ARM_DMA_MEM_BUFFERABLE |
5 | select DMA_OF | ||
6 | select USE_OF | 5 | select USE_OF |
7 | select CLKSRC_OF | 6 | select CLKSRC_OF |
8 | select CLKSRC_MMIO | 7 | select CLKSRC_MMIO |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 9320252ca43a..0af7ca02314d 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -55,7 +55,7 @@ config SOC_OMAP5 | |||
55 | select ARM_GIC | 55 | select ARM_GIC |
56 | select CPU_V7 | 56 | select CPU_V7 |
57 | select HAVE_ARM_SCU if SMP | 57 | select HAVE_ARM_SCU if SMP |
58 | select HAVE_ARM_TWD if LOCAL_TIMERS | 58 | select HAVE_ARM_TWD if SMP |
59 | select HAVE_SMP | 59 | select HAVE_SMP |
60 | select HAVE_ARM_ARCH_TIMER | 60 | select HAVE_ARM_ARCH_TIMER |
61 | select ARM_ERRATA_798181 if SMP | 61 | select ARM_ERRATA_798181 if SMP |
diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c index c9f309ae88c5..8b90c4f2d430 100644 --- a/arch/arm/mach-pxa/am300epd.c +++ b/arch/arm/mach-pxa/am300epd.c | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #include <mach/gumstix.h> | 31 | #include <mach/gumstix.h> |
32 | #include <mach/mfp-pxa25x.h> | 32 | #include <mach/mfp-pxa25x.h> |
33 | #include <mach/irqs.h> | ||
33 | #include <linux/platform_data/video-pxafb.h> | 34 | #include <linux/platform_data/video-pxafb.h> |
34 | 35 | ||
35 | #include "generic.h" | 36 | #include "generic.h" |
diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h index 954641e6c8b1..1b0825911e62 100644 --- a/arch/arm/mach-pxa/include/mach/balloon3.h +++ b/arch/arm/mach-pxa/include/mach/balloon3.h | |||
@@ -14,6 +14,8 @@ | |||
14 | #ifndef ASM_ARCH_BALLOON3_H | 14 | #ifndef ASM_ARCH_BALLOON3_H |
15 | #define ASM_ARCH_BALLOON3_H | 15 | #define ASM_ARCH_BALLOON3_H |
16 | 16 | ||
17 | #include "irqs.h" /* PXA_NR_BUILTIN_GPIO */ | ||
18 | |||
17 | enum balloon3_features { | 19 | enum balloon3_features { |
18 | BALLOON3_FEATURE_OHCI, | 20 | BALLOON3_FEATURE_OHCI, |
19 | BALLOON3_FEATURE_MMC, | 21 | BALLOON3_FEATURE_MMC, |
diff --git a/arch/arm/mach-pxa/include/mach/corgi.h b/arch/arm/mach-pxa/include/mach/corgi.h index f3c3493b468d..c030d955bbd7 100644 --- a/arch/arm/mach-pxa/include/mach/corgi.h +++ b/arch/arm/mach-pxa/include/mach/corgi.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #ifndef __ASM_ARCH_CORGI_H | 13 | #ifndef __ASM_ARCH_CORGI_H |
14 | #define __ASM_ARCH_CORGI_H 1 | 14 | #define __ASM_ARCH_CORGI_H 1 |
15 | 15 | ||
16 | #include "irqs.h" /* PXA_NR_BUILTIN_GPIO */ | ||
16 | 17 | ||
17 | /* | 18 | /* |
18 | * Corgi (Non Standard) GPIO Definitions | 19 | * Corgi (Non Standard) GPIO Definitions |
diff --git a/arch/arm/mach-pxa/include/mach/csb726.h b/arch/arm/mach-pxa/include/mach/csb726.h index 2628e7b72116..00cfbbbf73f7 100644 --- a/arch/arm/mach-pxa/include/mach/csb726.h +++ b/arch/arm/mach-pxa/include/mach/csb726.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #ifndef CSB726_H | 11 | #ifndef CSB726_H |
12 | #define CSB726_H | 12 | #define CSB726_H |
13 | 13 | ||
14 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
15 | |||
14 | #define CSB726_GPIO_IRQ_LAN 52 | 16 | #define CSB726_GPIO_IRQ_LAN 52 |
15 | #define CSB726_GPIO_IRQ_SM501 53 | 17 | #define CSB726_GPIO_IRQ_SM501 53 |
16 | #define CSB726_GPIO_MMC_DETECT 100 | 18 | #define CSB726_GPIO_MMC_DETECT 100 |
diff --git a/arch/arm/mach-pxa/include/mach/gumstix.h b/arch/arm/mach-pxa/include/mach/gumstix.h index dba14b6503ad..f7df27bbb42e 100644 --- a/arch/arm/mach-pxa/include/mach/gumstix.h +++ b/arch/arm/mach-pxa/include/mach/gumstix.h | |||
@@ -6,6 +6,7 @@ | |||
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
9 | 10 | ||
10 | /* BTRESET - Reset line to Bluetooth module, active low signal. */ | 11 | /* BTRESET - Reset line to Bluetooth module, active low signal. */ |
11 | #define GPIO_GUMSTIX_BTRESET 7 | 12 | #define GPIO_GUMSTIX_BTRESET 7 |
diff --git a/arch/arm/mach-pxa/include/mach/idp.h b/arch/arm/mach-pxa/include/mach/idp.h index 22a96f87232b..7e63f4680271 100644 --- a/arch/arm/mach-pxa/include/mach/idp.h +++ b/arch/arm/mach-pxa/include/mach/idp.h | |||
@@ -23,6 +23,7 @@ | |||
23 | * IDP hardware. | 23 | * IDP hardware. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
26 | 27 | ||
27 | #define IDP_FLASH_PHYS (PXA_CS0_PHYS) | 28 | #define IDP_FLASH_PHYS (PXA_CS0_PHYS) |
28 | #define IDP_ALT_FLASH_PHYS (PXA_CS1_PHYS) | 29 | #define IDP_ALT_FLASH_PHYS (PXA_CS1_PHYS) |
diff --git a/arch/arm/mach-pxa/include/mach/palmld.h b/arch/arm/mach-pxa/include/mach/palmld.h index 2c4471336570..b184f296023b 100644 --- a/arch/arm/mach-pxa/include/mach/palmld.h +++ b/arch/arm/mach-pxa/include/mach/palmld.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #ifndef _INCLUDE_PALMLD_H_ | 13 | #ifndef _INCLUDE_PALMLD_H_ |
14 | #define _INCLUDE_PALMLD_H_ | 14 | #define _INCLUDE_PALMLD_H_ |
15 | 15 | ||
16 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
17 | |||
16 | /** HERE ARE GPIOs **/ | 18 | /** HERE ARE GPIOs **/ |
17 | 19 | ||
18 | /* GPIOs */ | 20 | /* GPIOs */ |
diff --git a/arch/arm/mach-pxa/include/mach/palmt5.h b/arch/arm/mach-pxa/include/mach/palmt5.h index 0bd4f036c72f..e342c5921405 100644 --- a/arch/arm/mach-pxa/include/mach/palmt5.h +++ b/arch/arm/mach-pxa/include/mach/palmt5.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #ifndef _INCLUDE_PALMT5_H_ | 15 | #ifndef _INCLUDE_PALMT5_H_ |
16 | #define _INCLUDE_PALMT5_H_ | 16 | #define _INCLUDE_PALMT5_H_ |
17 | 17 | ||
18 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
19 | |||
18 | /** HERE ARE GPIOs **/ | 20 | /** HERE ARE GPIOs **/ |
19 | 21 | ||
20 | /* GPIOs */ | 22 | /* GPIOs */ |
diff --git a/arch/arm/mach-pxa/include/mach/palmtc.h b/arch/arm/mach-pxa/include/mach/palmtc.h index c383a21680b6..81c727b3cfd2 100644 --- a/arch/arm/mach-pxa/include/mach/palmtc.h +++ b/arch/arm/mach-pxa/include/mach/palmtc.h | |||
@@ -16,6 +16,8 @@ | |||
16 | #ifndef _INCLUDE_PALMTC_H_ | 16 | #ifndef _INCLUDE_PALMTC_H_ |
17 | #define _INCLUDE_PALMTC_H_ | 17 | #define _INCLUDE_PALMTC_H_ |
18 | 18 | ||
19 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
20 | |||
19 | /** HERE ARE GPIOs **/ | 21 | /** HERE ARE GPIOs **/ |
20 | 22 | ||
21 | /* GPIOs */ | 23 | /* GPIOs */ |
diff --git a/arch/arm/mach-pxa/include/mach/palmtx.h b/arch/arm/mach-pxa/include/mach/palmtx.h index f2e530380253..92bc1f05300d 100644 --- a/arch/arm/mach-pxa/include/mach/palmtx.h +++ b/arch/arm/mach-pxa/include/mach/palmtx.h | |||
@@ -16,6 +16,8 @@ | |||
16 | #ifndef _INCLUDE_PALMTX_H_ | 16 | #ifndef _INCLUDE_PALMTX_H_ |
17 | #define _INCLUDE_PALMTX_H_ | 17 | #define _INCLUDE_PALMTX_H_ |
18 | 18 | ||
19 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
20 | |||
19 | /** HERE ARE GPIOs **/ | 21 | /** HERE ARE GPIOs **/ |
20 | 22 | ||
21 | /* GPIOs */ | 23 | /* GPIOs */ |
diff --git a/arch/arm/mach-pxa/include/mach/pcm027.h b/arch/arm/mach-pxa/include/mach/pcm027.h index 6bf28de228bd..86ebd7b6c960 100644 --- a/arch/arm/mach-pxa/include/mach/pcm027.h +++ b/arch/arm/mach-pxa/include/mach/pcm027.h | |||
@@ -23,6 +23,8 @@ | |||
23 | * Definitions of CPU card resources only | 23 | * Definitions of CPU card resources only |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
27 | |||
26 | /* phyCORE-PXA270 (PCM027) Interrupts */ | 28 | /* phyCORE-PXA270 (PCM027) Interrupts */ |
27 | #define PCM027_IRQ(x) (IRQ_BOARD_START + (x)) | 29 | #define PCM027_IRQ(x) (IRQ_BOARD_START + (x)) |
28 | #define PCM027_BTDET_IRQ PCM027_IRQ(0) | 30 | #define PCM027_BTDET_IRQ PCM027_IRQ(0) |
diff --git a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h index 0260aaa2fc17..7e544c14967e 100644 --- a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h +++ b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <mach/pcm027.h> | 22 | #include <mach/pcm027.h> |
23 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
23 | 24 | ||
24 | /* | 25 | /* |
25 | * definitions relevant only when the PCM-990 | 26 | * definitions relevant only when the PCM-990 |
diff --git a/arch/arm/mach-pxa/include/mach/poodle.h b/arch/arm/mach-pxa/include/mach/poodle.h index f32ff75dcca8..b56b19351a03 100644 --- a/arch/arm/mach-pxa/include/mach/poodle.h +++ b/arch/arm/mach-pxa/include/mach/poodle.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #ifndef __ASM_ARCH_POODLE_H | 15 | #ifndef __ASM_ARCH_POODLE_H |
16 | #define __ASM_ARCH_POODLE_H 1 | 16 | #define __ASM_ARCH_POODLE_H 1 |
17 | 17 | ||
18 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
19 | |||
18 | /* | 20 | /* |
19 | * GPIOs | 21 | * GPIOs |
20 | */ | 22 | */ |
diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h index 0bfe6507c95d..25c9f62e46aa 100644 --- a/arch/arm/mach-pxa/include/mach/spitz.h +++ b/arch/arm/mach-pxa/include/mach/spitz.h | |||
@@ -15,8 +15,8 @@ | |||
15 | #define __ASM_ARCH_SPITZ_H 1 | 15 | #define __ASM_ARCH_SPITZ_H 1 |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | #include "irqs.h" /* PXA_NR_BUILTIN_GPIO, PXA_GPIO_TO_IRQ */ | ||
18 | #include <linux/fb.h> | 19 | #include <linux/fb.h> |
19 | #include <linux/gpio.h> | ||
20 | 20 | ||
21 | /* Spitz/Akita GPIOs */ | 21 | /* Spitz/Akita GPIOs */ |
22 | 22 | ||
diff --git a/arch/arm/mach-pxa/include/mach/tosa.h b/arch/arm/mach-pxa/include/mach/tosa.h index 2bb0e862598c..0497d95cef25 100644 --- a/arch/arm/mach-pxa/include/mach/tosa.h +++ b/arch/arm/mach-pxa/include/mach/tosa.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #ifndef _ASM_ARCH_TOSA_H_ | 13 | #ifndef _ASM_ARCH_TOSA_H_ |
14 | #define _ASM_ARCH_TOSA_H_ 1 | 14 | #define _ASM_ARCH_TOSA_H_ 1 |
15 | 15 | ||
16 | #include "irqs.h" /* PXA_NR_BUILTIN_GPIO */ | ||
17 | |||
16 | /* TOSA Chip selects */ | 18 | /* TOSA Chip selects */ |
17 | #define TOSA_LCDC_PHYS PXA_CS4_PHYS | 19 | #define TOSA_LCDC_PHYS PXA_CS4_PHYS |
18 | /* Internel Scoop */ | 20 | /* Internel Scoop */ |
diff --git a/arch/arm/mach-pxa/include/mach/trizeps4.h b/arch/arm/mach-pxa/include/mach/trizeps4.h index d2ca01053f69..ae3ca013afab 100644 --- a/arch/arm/mach-pxa/include/mach/trizeps4.h +++ b/arch/arm/mach-pxa/include/mach/trizeps4.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #ifndef _TRIPEPS4_H_ | 10 | #ifndef _TRIPEPS4_H_ |
11 | #define _TRIPEPS4_H_ | 11 | #define _TRIPEPS4_H_ |
12 | 12 | ||
13 | #include "irqs.h" /* PXA_GPIO_TO_IRQ */ | ||
14 | |||
13 | /* physical memory regions */ | 15 | /* physical memory regions */ |
14 | #define TRIZEPS4_FLASH_PHYS (PXA_CS0_PHYS) /* Flash region */ | 16 | #define TRIZEPS4_FLASH_PHYS (PXA_CS0_PHYS) /* Flash region */ |
15 | #define TRIZEPS4_DISK_PHYS (PXA_CS1_PHYS) /* Disk On Chip region */ | 17 | #define TRIZEPS4_DISK_PHYS (PXA_CS1_PHYS) /* Disk On Chip region */ |
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index f70583fee59f..29997bde277d 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/mtd/physmap.h> | 38 | #include <linux/mtd/physmap.h> |
39 | #include <linux/usb/gpio_vbus.h> | 39 | #include <linux/usb/gpio_vbus.h> |
40 | #include <linux/reboot.h> | 40 | #include <linux/reboot.h> |
41 | #include <linux/regulator/fixed.h> | ||
41 | #include <linux/regulator/max1586.h> | 42 | #include <linux/regulator/max1586.h> |
42 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
43 | #include <linux/i2c/pxa-i2c.h> | 44 | #include <linux/i2c/pxa-i2c.h> |
@@ -714,6 +715,10 @@ static struct gpio global_gpios[] = { | |||
714 | { GPIO56_MT9M111_nOE, GPIOF_OUT_INIT_LOW, "Camera nOE" }, | 715 | { GPIO56_MT9M111_nOE, GPIOF_OUT_INIT_LOW, "Camera nOE" }, |
715 | }; | 716 | }; |
716 | 717 | ||
718 | static struct regulator_consumer_supply fixed_5v0_consumers[] = { | ||
719 | REGULATOR_SUPPLY("power", "pwm-backlight"), | ||
720 | }; | ||
721 | |||
717 | static void __init mioa701_machine_init(void) | 722 | static void __init mioa701_machine_init(void) |
718 | { | 723 | { |
719 | int rc; | 724 | int rc; |
@@ -753,6 +758,10 @@ static void __init mioa701_machine_init(void) | |||
753 | pxa_set_i2c_info(&i2c_pdata); | 758 | pxa_set_i2c_info(&i2c_pdata); |
754 | pxa27x_set_i2c_power_info(NULL); | 759 | pxa27x_set_i2c_power_info(NULL); |
755 | pxa_set_camera_info(&mioa701_pxacamera_platform_data); | 760 | pxa_set_camera_info(&mioa701_pxacamera_platform_data); |
761 | |||
762 | regulator_register_always_on(0, "fixed-5.0V", fixed_5v0_consumers, | ||
763 | ARRAY_SIZE(fixed_5v0_consumers), | ||
764 | 5000000); | ||
756 | } | 765 | } |
757 | 766 | ||
758 | static void mioa701_machine_exit(void) | 767 | static void mioa701_machine_exit(void) |
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 338640631e08..05fa505df585 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -8,7 +8,7 @@ config ARCH_SHMOBILE_MULTI | |||
8 | select CPU_V7 | 8 | select CPU_V7 |
9 | select GENERIC_CLOCKEVENTS | 9 | select GENERIC_CLOCKEVENTS |
10 | select HAVE_ARM_SCU if SMP | 10 | select HAVE_ARM_SCU if SMP |
11 | select HAVE_ARM_TWD if LOCAL_TIMERS | 11 | select HAVE_ARM_TWD if SMP |
12 | select HAVE_SMP | 12 | select HAVE_SMP |
13 | select ARM_GIC | 13 | select ARM_GIC |
14 | select MIGHT_HAVE_CACHE_L2X0 | 14 | select MIGHT_HAVE_CACHE_L2X0 |
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 1db2a5ca9ab8..8c09a8393fb6 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/of_irq.h> | 25 | #include <linux/of_irq.h> |
26 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
27 | #include <linux/of.h> | 27 | #include <linux/of.h> |
28 | #include <linux/memblock.h> | ||
28 | #include <linux/irqchip.h> | 29 | #include <linux/irqchip.h> |
29 | #include <linux/irqchip/arm-gic.h> | 30 | #include <linux/irqchip/arm-gic.h> |
30 | 31 | ||
@@ -41,6 +42,18 @@ | |||
41 | 42 | ||
42 | void __iomem *zynq_scu_base; | 43 | void __iomem *zynq_scu_base; |
43 | 44 | ||
45 | /** | ||
46 | * zynq_memory_init - Initialize special memory | ||
47 | * | ||
48 | * We need to stop things allocating the low memory as DMA can't work in | ||
49 | * the 1st 512K of memory. | ||
50 | */ | ||
51 | static void __init zynq_memory_init(void) | ||
52 | { | ||
53 | if (!__pa(PAGE_OFFSET)) | ||
54 | memblock_reserve(__pa(PAGE_OFFSET), __pa(swapper_pg_dir)); | ||
55 | } | ||
56 | |||
44 | static struct platform_device zynq_cpuidle_device = { | 57 | static struct platform_device zynq_cpuidle_device = { |
45 | .name = "cpuidle-zynq", | 58 | .name = "cpuidle-zynq", |
46 | }; | 59 | }; |
@@ -117,5 +130,6 @@ DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform") | |||
117 | .init_machine = zynq_init_machine, | 130 | .init_machine = zynq_init_machine, |
118 | .init_time = zynq_timer_init, | 131 | .init_time = zynq_timer_init, |
119 | .dt_compat = zynq_dt_match, | 132 | .dt_compat = zynq_dt_match, |
133 | .reserve = zynq_memory_init, | ||
120 | .restart = zynq_system_reset, | 134 | .restart = zynq_system_reset, |
121 | MACHINE_END | 135 | MACHINE_END |
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index dd4327f09ba4..27bbcfc7202a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -36,6 +36,7 @@ config ARM64 | |||
36 | select HAVE_GENERIC_DMA_COHERENT | 36 | select HAVE_GENERIC_DMA_COHERENT |
37 | select HAVE_HW_BREAKPOINT if PERF_EVENTS | 37 | select HAVE_HW_BREAKPOINT if PERF_EVENTS |
38 | select HAVE_MEMBLOCK | 38 | select HAVE_MEMBLOCK |
39 | select HAVE_PATA_PLATFORM | ||
39 | select HAVE_PERF_EVENTS | 40 | select HAVE_PERF_EVENTS |
40 | select IRQ_DOMAIN | 41 | select IRQ_DOMAIN |
41 | select MODULES_USE_ELF_RELA | 42 | select MODULES_USE_ELF_RELA |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 84139be62ae6..7959dd0ca5d5 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -1,4 +1,3 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | # CONFIG_LOCALVERSION_AUTO is not set | 1 | # CONFIG_LOCALVERSION_AUTO is not set |
3 | # CONFIG_SWAP is not set | 2 | # CONFIG_SWAP is not set |
4 | CONFIG_SYSVIPC=y | 3 | CONFIG_SYSVIPC=y |
@@ -19,6 +18,7 @@ CONFIG_BLK_DEV_INITRD=y | |||
19 | CONFIG_KALLSYMS_ALL=y | 18 | CONFIG_KALLSYMS_ALL=y |
20 | # CONFIG_COMPAT_BRK is not set | 19 | # CONFIG_COMPAT_BRK is not set |
21 | CONFIG_PROFILING=y | 20 | CONFIG_PROFILING=y |
21 | CONFIG_JUMP_LABEL=y | ||
22 | CONFIG_MODULES=y | 22 | CONFIG_MODULES=y |
23 | CONFIG_MODULE_UNLOAD=y | 23 | CONFIG_MODULE_UNLOAD=y |
24 | # CONFIG_BLK_DEV_BSG is not set | 24 | # CONFIG_BLK_DEV_BSG is not set |
@@ -27,6 +27,7 @@ CONFIG_ARCH_VEXPRESS=y | |||
27 | CONFIG_ARCH_XGENE=y | 27 | CONFIG_ARCH_XGENE=y |
28 | CONFIG_SMP=y | 28 | CONFIG_SMP=y |
29 | CONFIG_PREEMPT=y | 29 | CONFIG_PREEMPT=y |
30 | CONFIG_CMA=y | ||
30 | CONFIG_CMDLINE="console=ttyAMA0" | 31 | CONFIG_CMDLINE="console=ttyAMA0" |
31 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 32 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
32 | CONFIG_COMPAT=y | 33 | CONFIG_COMPAT=y |
@@ -42,14 +43,17 @@ CONFIG_IP_PNP_BOOTP=y | |||
42 | # CONFIG_WIRELESS is not set | 43 | # CONFIG_WIRELESS is not set |
43 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 44 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
44 | CONFIG_DEVTMPFS=y | 45 | CONFIG_DEVTMPFS=y |
45 | CONFIG_BLK_DEV=y | 46 | CONFIG_DMA_CMA=y |
46 | CONFIG_SCSI=y | 47 | CONFIG_SCSI=y |
47 | # CONFIG_SCSI_PROC_FS is not set | 48 | # CONFIG_SCSI_PROC_FS is not set |
48 | CONFIG_BLK_DEV_SD=y | 49 | CONFIG_BLK_DEV_SD=y |
49 | # CONFIG_SCSI_LOWLEVEL is not set | 50 | # CONFIG_SCSI_LOWLEVEL is not set |
51 | CONFIG_ATA=y | ||
52 | CONFIG_PATA_PLATFORM=y | ||
53 | CONFIG_PATA_OF_PLATFORM=y | ||
50 | CONFIG_NETDEVICES=y | 54 | CONFIG_NETDEVICES=y |
51 | CONFIG_MII=y | ||
52 | CONFIG_SMC91X=y | 55 | CONFIG_SMC91X=y |
56 | CONFIG_SMSC911X=y | ||
53 | # CONFIG_WLAN is not set | 57 | # CONFIG_WLAN is not set |
54 | CONFIG_INPUT_EVDEV=y | 58 | CONFIG_INPUT_EVDEV=y |
55 | # CONFIG_SERIO_I8042 is not set | 59 | # CONFIG_SERIO_I8042 is not set |
@@ -62,13 +66,19 @@ CONFIG_SERIAL_AMBA_PL011=y | |||
62 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | 66 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y |
63 | # CONFIG_HW_RANDOM is not set | 67 | # CONFIG_HW_RANDOM is not set |
64 | # CONFIG_HWMON is not set | 68 | # CONFIG_HWMON is not set |
69 | CONFIG_REGULATOR=y | ||
70 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
65 | CONFIG_FB=y | 71 | CONFIG_FB=y |
66 | # CONFIG_VGA_CONSOLE is not set | 72 | # CONFIG_VGA_CONSOLE is not set |
67 | CONFIG_FRAMEBUFFER_CONSOLE=y | 73 | CONFIG_FRAMEBUFFER_CONSOLE=y |
68 | CONFIG_LOGO=y | 74 | CONFIG_LOGO=y |
69 | # CONFIG_LOGO_LINUX_MONO is not set | 75 | # CONFIG_LOGO_LINUX_MONO is not set |
70 | # CONFIG_LOGO_LINUX_VGA16 is not set | 76 | # CONFIG_LOGO_LINUX_VGA16 is not set |
71 | # CONFIG_USB_SUPPORT is not set | 77 | CONFIG_USB=y |
78 | CONFIG_USB_ISP1760_HCD=y | ||
79 | CONFIG_USB_STORAGE=y | ||
80 | CONFIG_MMC=y | ||
81 | CONFIG_MMC_ARMMMCI=y | ||
72 | # CONFIG_IOMMU_SUPPORT is not set | 82 | # CONFIG_IOMMU_SUPPORT is not set |
73 | CONFIG_EXT2_FS=y | 83 | CONFIG_EXT2_FS=y |
74 | CONFIG_EXT3_FS=y | 84 | CONFIG_EXT3_FS=y |
diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h index 01de5aaa3edc..0237f0867e37 100644 --- a/arch/arm64/include/asm/atomic.h +++ b/arch/arm64/include/asm/atomic.h | |||
@@ -54,8 +54,7 @@ static inline void atomic_add(int i, atomic_t *v) | |||
54 | " stxr %w1, %w0, %2\n" | 54 | " stxr %w1, %w0, %2\n" |
55 | " cbnz %w1, 1b" | 55 | " cbnz %w1, 1b" |
56 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 56 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
57 | : "Ir" (i) | 57 | : "Ir" (i)); |
58 | : "cc"); | ||
59 | } | 58 | } |
60 | 59 | ||
61 | static inline int atomic_add_return(int i, atomic_t *v) | 60 | static inline int atomic_add_return(int i, atomic_t *v) |
@@ -64,14 +63,15 @@ static inline int atomic_add_return(int i, atomic_t *v) | |||
64 | int result; | 63 | int result; |
65 | 64 | ||
66 | asm volatile("// atomic_add_return\n" | 65 | asm volatile("// atomic_add_return\n" |
67 | "1: ldaxr %w0, %2\n" | 66 | "1: ldxr %w0, %2\n" |
68 | " add %w0, %w0, %w3\n" | 67 | " add %w0, %w0, %w3\n" |
69 | " stlxr %w1, %w0, %2\n" | 68 | " stlxr %w1, %w0, %2\n" |
70 | " cbnz %w1, 1b" | 69 | " cbnz %w1, 1b" |
71 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 70 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
72 | : "Ir" (i) | 71 | : "Ir" (i) |
73 | : "cc", "memory"); | 72 | : "memory"); |
74 | 73 | ||
74 | smp_mb(); | ||
75 | return result; | 75 | return result; |
76 | } | 76 | } |
77 | 77 | ||
@@ -86,8 +86,7 @@ static inline void atomic_sub(int i, atomic_t *v) | |||
86 | " stxr %w1, %w0, %2\n" | 86 | " stxr %w1, %w0, %2\n" |
87 | " cbnz %w1, 1b" | 87 | " cbnz %w1, 1b" |
88 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 88 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
89 | : "Ir" (i) | 89 | : "Ir" (i)); |
90 | : "cc"); | ||
91 | } | 90 | } |
92 | 91 | ||
93 | static inline int atomic_sub_return(int i, atomic_t *v) | 92 | static inline int atomic_sub_return(int i, atomic_t *v) |
@@ -96,14 +95,15 @@ static inline int atomic_sub_return(int i, atomic_t *v) | |||
96 | int result; | 95 | int result; |
97 | 96 | ||
98 | asm volatile("// atomic_sub_return\n" | 97 | asm volatile("// atomic_sub_return\n" |
99 | "1: ldaxr %w0, %2\n" | 98 | "1: ldxr %w0, %2\n" |
100 | " sub %w0, %w0, %w3\n" | 99 | " sub %w0, %w0, %w3\n" |
101 | " stlxr %w1, %w0, %2\n" | 100 | " stlxr %w1, %w0, %2\n" |
102 | " cbnz %w1, 1b" | 101 | " cbnz %w1, 1b" |
103 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 102 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
104 | : "Ir" (i) | 103 | : "Ir" (i) |
105 | : "cc", "memory"); | 104 | : "memory"); |
106 | 105 | ||
106 | smp_mb(); | ||
107 | return result; | 107 | return result; |
108 | } | 108 | } |
109 | 109 | ||
@@ -112,17 +112,20 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new) | |||
112 | unsigned long tmp; | 112 | unsigned long tmp; |
113 | int oldval; | 113 | int oldval; |
114 | 114 | ||
115 | smp_mb(); | ||
116 | |||
115 | asm volatile("// atomic_cmpxchg\n" | 117 | asm volatile("// atomic_cmpxchg\n" |
116 | "1: ldaxr %w1, %2\n" | 118 | "1: ldxr %w1, %2\n" |
117 | " cmp %w1, %w3\n" | 119 | " cmp %w1, %w3\n" |
118 | " b.ne 2f\n" | 120 | " b.ne 2f\n" |
119 | " stlxr %w0, %w4, %2\n" | 121 | " stxr %w0, %w4, %2\n" |
120 | " cbnz %w0, 1b\n" | 122 | " cbnz %w0, 1b\n" |
121 | "2:" | 123 | "2:" |
122 | : "=&r" (tmp), "=&r" (oldval), "+Q" (ptr->counter) | 124 | : "=&r" (tmp), "=&r" (oldval), "+Q" (ptr->counter) |
123 | : "Ir" (old), "r" (new) | 125 | : "Ir" (old), "r" (new) |
124 | : "cc", "memory"); | 126 | : "cc"); |
125 | 127 | ||
128 | smp_mb(); | ||
126 | return oldval; | 129 | return oldval; |
127 | } | 130 | } |
128 | 131 | ||
@@ -173,8 +176,7 @@ static inline void atomic64_add(u64 i, atomic64_t *v) | |||
173 | " stxr %w1, %0, %2\n" | 176 | " stxr %w1, %0, %2\n" |
174 | " cbnz %w1, 1b" | 177 | " cbnz %w1, 1b" |
175 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 178 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
176 | : "Ir" (i) | 179 | : "Ir" (i)); |
177 | : "cc"); | ||
178 | } | 180 | } |
179 | 181 | ||
180 | static inline long atomic64_add_return(long i, atomic64_t *v) | 182 | static inline long atomic64_add_return(long i, atomic64_t *v) |
@@ -183,14 +185,15 @@ static inline long atomic64_add_return(long i, atomic64_t *v) | |||
183 | unsigned long tmp; | 185 | unsigned long tmp; |
184 | 186 | ||
185 | asm volatile("// atomic64_add_return\n" | 187 | asm volatile("// atomic64_add_return\n" |
186 | "1: ldaxr %0, %2\n" | 188 | "1: ldxr %0, %2\n" |
187 | " add %0, %0, %3\n" | 189 | " add %0, %0, %3\n" |
188 | " stlxr %w1, %0, %2\n" | 190 | " stlxr %w1, %0, %2\n" |
189 | " cbnz %w1, 1b" | 191 | " cbnz %w1, 1b" |
190 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 192 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
191 | : "Ir" (i) | 193 | : "Ir" (i) |
192 | : "cc", "memory"); | 194 | : "memory"); |
193 | 195 | ||
196 | smp_mb(); | ||
194 | return result; | 197 | return result; |
195 | } | 198 | } |
196 | 199 | ||
@@ -205,8 +208,7 @@ static inline void atomic64_sub(u64 i, atomic64_t *v) | |||
205 | " stxr %w1, %0, %2\n" | 208 | " stxr %w1, %0, %2\n" |
206 | " cbnz %w1, 1b" | 209 | " cbnz %w1, 1b" |
207 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 210 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
208 | : "Ir" (i) | 211 | : "Ir" (i)); |
209 | : "cc"); | ||
210 | } | 212 | } |
211 | 213 | ||
212 | static inline long atomic64_sub_return(long i, atomic64_t *v) | 214 | static inline long atomic64_sub_return(long i, atomic64_t *v) |
@@ -215,14 +217,15 @@ static inline long atomic64_sub_return(long i, atomic64_t *v) | |||
215 | unsigned long tmp; | 217 | unsigned long tmp; |
216 | 218 | ||
217 | asm volatile("// atomic64_sub_return\n" | 219 | asm volatile("// atomic64_sub_return\n" |
218 | "1: ldaxr %0, %2\n" | 220 | "1: ldxr %0, %2\n" |
219 | " sub %0, %0, %3\n" | 221 | " sub %0, %0, %3\n" |
220 | " stlxr %w1, %0, %2\n" | 222 | " stlxr %w1, %0, %2\n" |
221 | " cbnz %w1, 1b" | 223 | " cbnz %w1, 1b" |
222 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 224 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
223 | : "Ir" (i) | 225 | : "Ir" (i) |
224 | : "cc", "memory"); | 226 | : "memory"); |
225 | 227 | ||
228 | smp_mb(); | ||
226 | return result; | 229 | return result; |
227 | } | 230 | } |
228 | 231 | ||
@@ -231,17 +234,20 @@ static inline long atomic64_cmpxchg(atomic64_t *ptr, long old, long new) | |||
231 | long oldval; | 234 | long oldval; |
232 | unsigned long res; | 235 | unsigned long res; |
233 | 236 | ||
237 | smp_mb(); | ||
238 | |||
234 | asm volatile("// atomic64_cmpxchg\n" | 239 | asm volatile("// atomic64_cmpxchg\n" |
235 | "1: ldaxr %1, %2\n" | 240 | "1: ldxr %1, %2\n" |
236 | " cmp %1, %3\n" | 241 | " cmp %1, %3\n" |
237 | " b.ne 2f\n" | 242 | " b.ne 2f\n" |
238 | " stlxr %w0, %4, %2\n" | 243 | " stxr %w0, %4, %2\n" |
239 | " cbnz %w0, 1b\n" | 244 | " cbnz %w0, 1b\n" |
240 | "2:" | 245 | "2:" |
241 | : "=&r" (res), "=&r" (oldval), "+Q" (ptr->counter) | 246 | : "=&r" (res), "=&r" (oldval), "+Q" (ptr->counter) |
242 | : "Ir" (old), "r" (new) | 247 | : "Ir" (old), "r" (new) |
243 | : "cc", "memory"); | 248 | : "cc"); |
244 | 249 | ||
250 | smp_mb(); | ||
245 | return oldval; | 251 | return oldval; |
246 | } | 252 | } |
247 | 253 | ||
@@ -253,11 +259,12 @@ static inline long atomic64_dec_if_positive(atomic64_t *v) | |||
253 | unsigned long tmp; | 259 | unsigned long tmp; |
254 | 260 | ||
255 | asm volatile("// atomic64_dec_if_positive\n" | 261 | asm volatile("// atomic64_dec_if_positive\n" |
256 | "1: ldaxr %0, %2\n" | 262 | "1: ldxr %0, %2\n" |
257 | " subs %0, %0, #1\n" | 263 | " subs %0, %0, #1\n" |
258 | " b.mi 2f\n" | 264 | " b.mi 2f\n" |
259 | " stlxr %w1, %0, %2\n" | 265 | " stlxr %w1, %0, %2\n" |
260 | " cbnz %w1, 1b\n" | 266 | " cbnz %w1, 1b\n" |
267 | " dmb ish\n" | ||
261 | "2:" | 268 | "2:" |
262 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) | 269 | : "=&r" (result), "=&r" (tmp), "+Q" (v->counter) |
263 | : | 270 | : |
diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index 78e20ba8806b..409ca370cfe2 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #define wfi() asm volatile("wfi" : : : "memory") | 25 | #define wfi() asm volatile("wfi" : : : "memory") |
26 | 26 | ||
27 | #define isb() asm volatile("isb" : : : "memory") | 27 | #define isb() asm volatile("isb" : : : "memory") |
28 | #define dsb() asm volatile("dsb sy" : : : "memory") | 28 | #define dsb(opt) asm volatile("dsb sy" : : : "memory") |
29 | 29 | ||
30 | #define mb() dsb() | 30 | #define mb() dsb() |
31 | #define rmb() asm volatile("dsb ld" : : : "memory") | 31 | #define rmb() asm volatile("dsb ld" : : : "memory") |
diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index fea9ee327206..889324981aa4 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h | |||
@@ -116,6 +116,7 @@ extern void flush_dcache_page(struct page *); | |||
116 | static inline void __flush_icache_all(void) | 116 | static inline void __flush_icache_all(void) |
117 | { | 117 | { |
118 | asm("ic ialluis"); | 118 | asm("ic ialluis"); |
119 | dsb(); | ||
119 | } | 120 | } |
120 | 121 | ||
121 | #define flush_dcache_mmap_lock(mapping) \ | 122 | #define flush_dcache_mmap_lock(mapping) \ |
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h index 56166d7f4a25..57c0fa7bf711 100644 --- a/arch/arm64/include/asm/cmpxchg.h +++ b/arch/arm64/include/asm/cmpxchg.h | |||
@@ -29,44 +29,45 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size | |||
29 | switch (size) { | 29 | switch (size) { |
30 | case 1: | 30 | case 1: |
31 | asm volatile("// __xchg1\n" | 31 | asm volatile("// __xchg1\n" |
32 | "1: ldaxrb %w0, %2\n" | 32 | "1: ldxrb %w0, %2\n" |
33 | " stlxrb %w1, %w3, %2\n" | 33 | " stlxrb %w1, %w3, %2\n" |
34 | " cbnz %w1, 1b\n" | 34 | " cbnz %w1, 1b\n" |
35 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u8 *)ptr) | 35 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u8 *)ptr) |
36 | : "r" (x) | 36 | : "r" (x) |
37 | : "cc", "memory"); | 37 | : "memory"); |
38 | break; | 38 | break; |
39 | case 2: | 39 | case 2: |
40 | asm volatile("// __xchg2\n" | 40 | asm volatile("// __xchg2\n" |
41 | "1: ldaxrh %w0, %2\n" | 41 | "1: ldxrh %w0, %2\n" |
42 | " stlxrh %w1, %w3, %2\n" | 42 | " stlxrh %w1, %w3, %2\n" |
43 | " cbnz %w1, 1b\n" | 43 | " cbnz %w1, 1b\n" |
44 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u16 *)ptr) | 44 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u16 *)ptr) |
45 | : "r" (x) | 45 | : "r" (x) |
46 | : "cc", "memory"); | 46 | : "memory"); |
47 | break; | 47 | break; |
48 | case 4: | 48 | case 4: |
49 | asm volatile("// __xchg4\n" | 49 | asm volatile("// __xchg4\n" |
50 | "1: ldaxr %w0, %2\n" | 50 | "1: ldxr %w0, %2\n" |
51 | " stlxr %w1, %w3, %2\n" | 51 | " stlxr %w1, %w3, %2\n" |
52 | " cbnz %w1, 1b\n" | 52 | " cbnz %w1, 1b\n" |
53 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u32 *)ptr) | 53 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u32 *)ptr) |
54 | : "r" (x) | 54 | : "r" (x) |
55 | : "cc", "memory"); | 55 | : "memory"); |
56 | break; | 56 | break; |
57 | case 8: | 57 | case 8: |
58 | asm volatile("// __xchg8\n" | 58 | asm volatile("// __xchg8\n" |
59 | "1: ldaxr %0, %2\n" | 59 | "1: ldxr %0, %2\n" |
60 | " stlxr %w1, %3, %2\n" | 60 | " stlxr %w1, %3, %2\n" |
61 | " cbnz %w1, 1b\n" | 61 | " cbnz %w1, 1b\n" |
62 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u64 *)ptr) | 62 | : "=&r" (ret), "=&r" (tmp), "+Q" (*(u64 *)ptr) |
63 | : "r" (x) | 63 | : "r" (x) |
64 | : "cc", "memory"); | 64 | : "memory"); |
65 | break; | 65 | break; |
66 | default: | 66 | default: |
67 | BUILD_BUG(); | 67 | BUILD_BUG(); |
68 | } | 68 | } |
69 | 69 | ||
70 | smp_mb(); | ||
70 | return ret; | 71 | return ret; |
71 | } | 72 | } |
72 | 73 | ||
diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h index 78834123a32e..c4a7f940b387 100644 --- a/arch/arm64/include/asm/esr.h +++ b/arch/arm64/include/asm/esr.h | |||
@@ -42,7 +42,7 @@ | |||
42 | #define ESR_EL1_EC_SP_ALIGN (0x26) | 42 | #define ESR_EL1_EC_SP_ALIGN (0x26) |
43 | #define ESR_EL1_EC_FP_EXC32 (0x28) | 43 | #define ESR_EL1_EC_FP_EXC32 (0x28) |
44 | #define ESR_EL1_EC_FP_EXC64 (0x2C) | 44 | #define ESR_EL1_EC_FP_EXC64 (0x2C) |
45 | #define ESR_EL1_EC_SERRROR (0x2F) | 45 | #define ESR_EL1_EC_SERROR (0x2F) |
46 | #define ESR_EL1_EC_BREAKPT_EL0 (0x30) | 46 | #define ESR_EL1_EC_BREAKPT_EL0 (0x30) |
47 | #define ESR_EL1_EC_BREAKPT_EL1 (0x31) | 47 | #define ESR_EL1_EC_BREAKPT_EL1 (0x31) |
48 | #define ESR_EL1_EC_SOFTSTP_EL0 (0x32) | 48 | #define ESR_EL1_EC_SOFTSTP_EL0 (0x32) |
diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h index 78cc3aba5d69..5f750dc96e0f 100644 --- a/arch/arm64/include/asm/futex.h +++ b/arch/arm64/include/asm/futex.h | |||
@@ -24,10 +24,11 @@ | |||
24 | 24 | ||
25 | #define __futex_atomic_op(insn, ret, oldval, uaddr, tmp, oparg) \ | 25 | #define __futex_atomic_op(insn, ret, oldval, uaddr, tmp, oparg) \ |
26 | asm volatile( \ | 26 | asm volatile( \ |
27 | "1: ldaxr %w1, %2\n" \ | 27 | "1: ldxr %w1, %2\n" \ |
28 | insn "\n" \ | 28 | insn "\n" \ |
29 | "2: stlxr %w3, %w0, %2\n" \ | 29 | "2: stlxr %w3, %w0, %2\n" \ |
30 | " cbnz %w3, 1b\n" \ | 30 | " cbnz %w3, 1b\n" \ |
31 | " dmb ish\n" \ | ||
31 | "3:\n" \ | 32 | "3:\n" \ |
32 | " .pushsection .fixup,\"ax\"\n" \ | 33 | " .pushsection .fixup,\"ax\"\n" \ |
33 | " .align 2\n" \ | 34 | " .align 2\n" \ |
@@ -40,7 +41,7 @@ | |||
40 | " .popsection\n" \ | 41 | " .popsection\n" \ |
41 | : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp) \ | 42 | : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp) \ |
42 | : "r" (oparg), "Ir" (-EFAULT) \ | 43 | : "r" (oparg), "Ir" (-EFAULT) \ |
43 | : "cc", "memory") | 44 | : "memory") |
44 | 45 | ||
45 | static inline int | 46 | static inline int |
46 | futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) | 47 | futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) |
@@ -111,11 +112,12 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
111 | return -EFAULT; | 112 | return -EFAULT; |
112 | 113 | ||
113 | asm volatile("// futex_atomic_cmpxchg_inatomic\n" | 114 | asm volatile("// futex_atomic_cmpxchg_inatomic\n" |
114 | "1: ldaxr %w1, %2\n" | 115 | "1: ldxr %w1, %2\n" |
115 | " sub %w3, %w1, %w4\n" | 116 | " sub %w3, %w1, %w4\n" |
116 | " cbnz %w3, 3f\n" | 117 | " cbnz %w3, 3f\n" |
117 | "2: stlxr %w3, %w5, %2\n" | 118 | "2: stlxr %w3, %w5, %2\n" |
118 | " cbnz %w3, 1b\n" | 119 | " cbnz %w3, 1b\n" |
120 | " dmb ish\n" | ||
119 | "3:\n" | 121 | "3:\n" |
120 | " .pushsection .fixup,\"ax\"\n" | 122 | " .pushsection .fixup,\"ax\"\n" |
121 | "4: mov %w0, %w6\n" | 123 | "4: mov %w0, %w6\n" |
@@ -127,7 +129,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
127 | " .popsection\n" | 129 | " .popsection\n" |
128 | : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp) | 130 | : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp) |
129 | : "r" (oldval), "r" (newval), "Ir" (-EFAULT) | 131 | : "r" (oldval), "r" (newval), "Ir" (-EFAULT) |
130 | : "cc", "memory"); | 132 | : "memory"); |
131 | 133 | ||
132 | *uval = val; | 134 | *uval = val; |
133 | return ret; | 135 | return ret; |
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index c98ef4771c73..0eb398655378 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h | |||
@@ -231,7 +231,7 @@ | |||
231 | #define ESR_EL2_EC_SP_ALIGN (0x26) | 231 | #define ESR_EL2_EC_SP_ALIGN (0x26) |
232 | #define ESR_EL2_EC_FP_EXC32 (0x28) | 232 | #define ESR_EL2_EC_FP_EXC32 (0x28) |
233 | #define ESR_EL2_EC_FP_EXC64 (0x2C) | 233 | #define ESR_EL2_EC_FP_EXC64 (0x2C) |
234 | #define ESR_EL2_EC_SERRROR (0x2F) | 234 | #define ESR_EL2_EC_SERROR (0x2F) |
235 | #define ESR_EL2_EC_BREAKPT (0x30) | 235 | #define ESR_EL2_EC_BREAKPT (0x30) |
236 | #define ESR_EL2_EC_BREAKPT_HYP (0x31) | 236 | #define ESR_EL2_EC_BREAKPT_HYP (0x31) |
237 | #define ESR_EL2_EC_SOFTSTP (0x32) | 237 | #define ESR_EL2_EC_SOFTSTP (0x32) |
diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index 3d5cf064d7a1..c45b7b1b7197 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h | |||
@@ -132,7 +132,7 @@ static inline void arch_write_lock(arch_rwlock_t *rw) | |||
132 | " cbnz %w0, 2b\n" | 132 | " cbnz %w0, 2b\n" |
133 | : "=&r" (tmp), "+Q" (rw->lock) | 133 | : "=&r" (tmp), "+Q" (rw->lock) |
134 | : "r" (0x80000000) | 134 | : "r" (0x80000000) |
135 | : "cc", "memory"); | 135 | : "memory"); |
136 | } | 136 | } |
137 | 137 | ||
138 | static inline int arch_write_trylock(arch_rwlock_t *rw) | 138 | static inline int arch_write_trylock(arch_rwlock_t *rw) |
@@ -146,7 +146,7 @@ static inline int arch_write_trylock(arch_rwlock_t *rw) | |||
146 | "1:\n" | 146 | "1:\n" |
147 | : "=&r" (tmp), "+Q" (rw->lock) | 147 | : "=&r" (tmp), "+Q" (rw->lock) |
148 | : "r" (0x80000000) | 148 | : "r" (0x80000000) |
149 | : "cc", "memory"); | 149 | : "memory"); |
150 | 150 | ||
151 | return !tmp; | 151 | return !tmp; |
152 | } | 152 | } |
@@ -187,7 +187,7 @@ static inline void arch_read_lock(arch_rwlock_t *rw) | |||
187 | " cbnz %w1, 2b\n" | 187 | " cbnz %w1, 2b\n" |
188 | : "=&r" (tmp), "=&r" (tmp2), "+Q" (rw->lock) | 188 | : "=&r" (tmp), "=&r" (tmp2), "+Q" (rw->lock) |
189 | : | 189 | : |
190 | : "cc", "memory"); | 190 | : "memory"); |
191 | } | 191 | } |
192 | 192 | ||
193 | static inline void arch_read_unlock(arch_rwlock_t *rw) | 193 | static inline void arch_read_unlock(arch_rwlock_t *rw) |
@@ -201,7 +201,7 @@ static inline void arch_read_unlock(arch_rwlock_t *rw) | |||
201 | " cbnz %w1, 1b\n" | 201 | " cbnz %w1, 1b\n" |
202 | : "=&r" (tmp), "=&r" (tmp2), "+Q" (rw->lock) | 202 | : "=&r" (tmp), "=&r" (tmp2), "+Q" (rw->lock) |
203 | : | 203 | : |
204 | : "cc", "memory"); | 204 | : "memory"); |
205 | } | 205 | } |
206 | 206 | ||
207 | static inline int arch_read_trylock(arch_rwlock_t *rw) | 207 | static inline int arch_read_trylock(arch_rwlock_t *rw) |
@@ -216,7 +216,7 @@ static inline int arch_read_trylock(arch_rwlock_t *rw) | |||
216 | "1:\n" | 216 | "1:\n" |
217 | : "=&r" (tmp), "+r" (tmp2), "+Q" (rw->lock) | 217 | : "=&r" (tmp), "+r" (tmp2), "+Q" (rw->lock) |
218 | : | 218 | : |
219 | : "cc", "memory"); | 219 | : "memory"); |
220 | 220 | ||
221 | return !tmp2; | 221 | return !tmp2; |
222 | } | 222 | } |
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 58125bf008d3..bb8eb8a78e67 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h | |||
@@ -399,7 +399,10 @@ __SYSCALL(374, compat_sys_sendmmsg) | |||
399 | __SYSCALL(375, sys_setns) | 399 | __SYSCALL(375, sys_setns) |
400 | __SYSCALL(376, compat_sys_process_vm_readv) | 400 | __SYSCALL(376, compat_sys_process_vm_readv) |
401 | __SYSCALL(377, compat_sys_process_vm_writev) | 401 | __SYSCALL(377, compat_sys_process_vm_writev) |
402 | __SYSCALL(378, sys_ni_syscall) /* 378 for kcmp */ | 402 | __SYSCALL(378, sys_kcmp) |
403 | __SYSCALL(379, sys_finit_module) | ||
404 | __SYSCALL(380, sys_sched_setattr) | ||
405 | __SYSCALL(381, sys_sched_getattr) | ||
403 | 406 | ||
404 | #define __NR_compat_syscalls 379 | 407 | #define __NR_compat_syscalls 379 |
405 | 408 | ||
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 495ab6f84a61..eaf54a30bedc 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h | |||
@@ -148,6 +148,15 @@ struct kvm_arch_memory_slot { | |||
148 | #define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) | 148 | #define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) |
149 | #define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) | 149 | #define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) |
150 | 150 | ||
151 | /* Device Control API: ARM VGIC */ | ||
152 | #define KVM_DEV_ARM_VGIC_GRP_ADDR 0 | ||
153 | #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1 | ||
154 | #define KVM_DEV_ARM_VGIC_GRP_CPU_REGS 2 | ||
155 | #define KVM_DEV_ARM_VGIC_CPUID_SHIFT 32 | ||
156 | #define KVM_DEV_ARM_VGIC_CPUID_MASK (0xffULL << KVM_DEV_ARM_VGIC_CPUID_SHIFT) | ||
157 | #define KVM_DEV_ARM_VGIC_OFFSET_SHIFT 0 | ||
158 | #define KVM_DEV_ARM_VGIC_OFFSET_MASK (0xffffffffULL << KVM_DEV_ARM_VGIC_OFFSET_SHIFT) | ||
159 | |||
151 | /* KVM_IRQ_LINE irq field index values */ | 160 | /* KVM_IRQ_LINE irq field index values */ |
152 | #define KVM_ARM_IRQ_TYPE_SHIFT 24 | 161 | #define KVM_ARM_IRQ_TYPE_SHIFT 24 |
153 | #define KVM_ARM_IRQ_TYPE_MASK 0xff | 162 | #define KVM_ARM_IRQ_TYPE_MASK 0xff |
diff --git a/arch/arm64/kernel/kuser32.S b/arch/arm64/kernel/kuser32.S index 63c48ffdf230..7787208e8cc6 100644 --- a/arch/arm64/kernel/kuser32.S +++ b/arch/arm64/kernel/kuser32.S | |||
@@ -38,12 +38,13 @@ __kuser_cmpxchg64: // 0xffff0f60 | |||
38 | .inst 0xe92d00f0 // push {r4, r5, r6, r7} | 38 | .inst 0xe92d00f0 // push {r4, r5, r6, r7} |
39 | .inst 0xe1c040d0 // ldrd r4, r5, [r0] | 39 | .inst 0xe1c040d0 // ldrd r4, r5, [r0] |
40 | .inst 0xe1c160d0 // ldrd r6, r7, [r1] | 40 | .inst 0xe1c160d0 // ldrd r6, r7, [r1] |
41 | .inst 0xe1b20e9f // 1: ldaexd r0, r1, [r2] | 41 | .inst 0xe1b20f9f // 1: ldrexd r0, r1, [r2] |
42 | .inst 0xe0303004 // eors r3, r0, r4 | 42 | .inst 0xe0303004 // eors r3, r0, r4 |
43 | .inst 0x00313005 // eoreqs r3, r1, r5 | 43 | .inst 0x00313005 // eoreqs r3, r1, r5 |
44 | .inst 0x01a23e96 // stlexdeq r3, r6, [r2] | 44 | .inst 0x01a23e96 // stlexdeq r3, r6, [r2] |
45 | .inst 0x03330001 // teqeq r3, #1 | 45 | .inst 0x03330001 // teqeq r3, #1 |
46 | .inst 0x0afffff9 // beq 1b | 46 | .inst 0x0afffff9 // beq 1b |
47 | .inst 0xf57ff05b // dmb ish | ||
47 | .inst 0xe2730000 // rsbs r0, r3, #0 | 48 | .inst 0xe2730000 // rsbs r0, r3, #0 |
48 | .inst 0xe8bd00f0 // pop {r4, r5, r6, r7} | 49 | .inst 0xe8bd00f0 // pop {r4, r5, r6, r7} |
49 | .inst 0xe12fff1e // bx lr | 50 | .inst 0xe12fff1e // bx lr |
@@ -55,11 +56,12 @@ __kuser_memory_barrier: // 0xffff0fa0 | |||
55 | 56 | ||
56 | .align 5 | 57 | .align 5 |
57 | __kuser_cmpxchg: // 0xffff0fc0 | 58 | __kuser_cmpxchg: // 0xffff0fc0 |
58 | .inst 0xe1923e9f // 1: ldaex r3, [r2] | 59 | .inst 0xe1923f9f // 1: ldrex r3, [r2] |
59 | .inst 0xe0533000 // subs r3, r3, r0 | 60 | .inst 0xe0533000 // subs r3, r3, r0 |
60 | .inst 0x01823e91 // stlexeq r3, r1, [r2] | 61 | .inst 0x01823e91 // stlexeq r3, r1, [r2] |
61 | .inst 0x03330001 // teqeq r3, #1 | 62 | .inst 0x03330001 // teqeq r3, #1 |
62 | .inst 0x0afffffa // beq 1b | 63 | .inst 0x0afffffa // beq 1b |
64 | .inst 0xf57ff05b // dmb ish | ||
63 | .inst 0xe2730000 // rsbs r0, r3, #0 | 65 | .inst 0xe2730000 // rsbs r0, r3, #0 |
64 | .inst 0xe12fff1e // bx lr | 66 | .inst 0xe12fff1e // bx lr |
65 | 67 | ||
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 65d40cf6945a..a7149cae1615 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c | |||
@@ -238,6 +238,8 @@ void update_vsyscall(struct timekeeper *tk) | |||
238 | vdso_data->use_syscall = use_syscall; | 238 | vdso_data->use_syscall = use_syscall; |
239 | vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec; | 239 | vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec; |
240 | vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec; | 240 | vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec; |
241 | vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; | ||
242 | vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; | ||
241 | 243 | ||
242 | if (!use_syscall) { | 244 | if (!use_syscall) { |
243 | vdso_data->cs_cycle_last = tk->clock->cycle_last; | 245 | vdso_data->cs_cycle_last = tk->clock->cycle_last; |
@@ -245,8 +247,6 @@ void update_vsyscall(struct timekeeper *tk) | |||
245 | vdso_data->xtime_clock_nsec = tk->xtime_nsec; | 247 | vdso_data->xtime_clock_nsec = tk->xtime_nsec; |
246 | vdso_data->cs_mult = tk->mult; | 248 | vdso_data->cs_mult = tk->mult; |
247 | vdso_data->cs_shift = tk->shift; | 249 | vdso_data->cs_shift = tk->shift; |
248 | vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; | ||
249 | vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; | ||
250 | } | 250 | } |
251 | 251 | ||
252 | smp_wmb(); | 252 | smp_wmb(); |
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index d8064af42e62..6d20b7d162d8 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile | |||
@@ -48,7 +48,7 @@ $(obj-vdso): %.o: %.S | |||
48 | 48 | ||
49 | # Actual build commands | 49 | # Actual build commands |
50 | quiet_cmd_vdsold = VDSOL $@ | 50 | quiet_cmd_vdsold = VDSOL $@ |
51 | cmd_vdsold = $(CC) $(c_flags) -Wl,-T $^ -o $@ | 51 | cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@ |
52 | quiet_cmd_vdsoas = VDSOA $@ | 52 | quiet_cmd_vdsoas = VDSOA $@ |
53 | cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $< | 53 | cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $< |
54 | 54 | ||
diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S index f0a6d10b5211..fe652ffd34c2 100644 --- a/arch/arm64/kernel/vdso/gettimeofday.S +++ b/arch/arm64/kernel/vdso/gettimeofday.S | |||
@@ -103,6 +103,8 @@ ENTRY(__kernel_clock_gettime) | |||
103 | bl __do_get_tspec | 103 | bl __do_get_tspec |
104 | seqcnt_check w9, 1b | 104 | seqcnt_check w9, 1b |
105 | 105 | ||
106 | mov x30, x2 | ||
107 | |||
106 | cmp w0, #CLOCK_MONOTONIC | 108 | cmp w0, #CLOCK_MONOTONIC |
107 | b.ne 6f | 109 | b.ne 6f |
108 | 110 | ||
@@ -118,6 +120,9 @@ ENTRY(__kernel_clock_gettime) | |||
118 | ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne | 120 | ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne |
119 | b.ne 8f | 121 | b.ne 8f |
120 | 122 | ||
123 | /* xtime_coarse_nsec is already right-shifted */ | ||
124 | mov x12, #0 | ||
125 | |||
121 | /* Get coarse timespec. */ | 126 | /* Get coarse timespec. */ |
122 | adr vdso_data, _vdso_data | 127 | adr vdso_data, _vdso_data |
123 | 3: seqcnt_acquire | 128 | 3: seqcnt_acquire |
@@ -156,7 +161,7 @@ ENTRY(__kernel_clock_gettime) | |||
156 | lsr x11, x11, x12 | 161 | lsr x11, x11, x12 |
157 | stp x10, x11, [x1, #TSPEC_TV_SEC] | 162 | stp x10, x11, [x1, #TSPEC_TV_SEC] |
158 | mov x0, xzr | 163 | mov x0, xzr |
159 | ret x2 | 164 | ret |
160 | 7: | 165 | 7: |
161 | mov x30, x2 | 166 | mov x30, x2 |
162 | 8: /* Syscall fallback. */ | 167 | 8: /* Syscall fallback. */ |
diff --git a/arch/arm64/lib/bitops.S b/arch/arm64/lib/bitops.S index e5db797790d3..7dac371cc9a2 100644 --- a/arch/arm64/lib/bitops.S +++ b/arch/arm64/lib/bitops.S | |||
@@ -46,11 +46,12 @@ ENTRY( \name ) | |||
46 | mov x2, #1 | 46 | mov x2, #1 |
47 | add x1, x1, x0, lsr #3 // Get word offset | 47 | add x1, x1, x0, lsr #3 // Get word offset |
48 | lsl x4, x2, x3 // Create mask | 48 | lsl x4, x2, x3 // Create mask |
49 | 1: ldaxr x2, [x1] | 49 | 1: ldxr x2, [x1] |
50 | lsr x0, x2, x3 // Save old value of bit | 50 | lsr x0, x2, x3 // Save old value of bit |
51 | \instr x2, x2, x4 // toggle bit | 51 | \instr x2, x2, x4 // toggle bit |
52 | stlxr w5, x2, [x1] | 52 | stlxr w5, x2, [x1] |
53 | cbnz w5, 1b | 53 | cbnz w5, 1b |
54 | dmb ish | ||
54 | and x0, x0, #1 | 55 | and x0, x0, #1 |
55 | 3: ret | 56 | 3: ret |
56 | ENDPROC(\name ) | 57 | ENDPROC(\name ) |
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 45b5ab54c9ee..fbd76785c5db 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
@@ -45,6 +45,7 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size, | |||
45 | if (IS_ENABLED(CONFIG_DMA_CMA)) { | 45 | if (IS_ENABLED(CONFIG_DMA_CMA)) { |
46 | struct page *page; | 46 | struct page *page; |
47 | 47 | ||
48 | size = PAGE_ALIGN(size); | ||
48 | page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT, | 49 | page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT, |
49 | get_order(size)); | 50 | get_order(size)); |
50 | if (!page) | 51 | if (!page) |
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index f557ebbe7013..f8dc7e8fce6f 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
@@ -203,10 +203,18 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, | |||
203 | do { | 203 | do { |
204 | next = pmd_addr_end(addr, end); | 204 | next = pmd_addr_end(addr, end); |
205 | /* try section mapping first */ | 205 | /* try section mapping first */ |
206 | if (((addr | next | phys) & ~SECTION_MASK) == 0) | 206 | if (((addr | next | phys) & ~SECTION_MASK) == 0) { |
207 | pmd_t old_pmd =*pmd; | ||
207 | set_pmd(pmd, __pmd(phys | prot_sect_kernel)); | 208 | set_pmd(pmd, __pmd(phys | prot_sect_kernel)); |
208 | else | 209 | /* |
210 | * Check for previous table entries created during | ||
211 | * boot (__create_page_tables) and flush them. | ||
212 | */ | ||
213 | if (!pmd_none(old_pmd)) | ||
214 | flush_tlb_all(); | ||
215 | } else { | ||
209 | alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys)); | 216 | alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys)); |
217 | } | ||
210 | phys += next - addr; | 218 | phys += next - addr; |
211 | } while (pmd++, addr = next, addr != end); | 219 | } while (pmd++, addr = next, addr != end); |
212 | } | 220 | } |
diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c index 7083cdada657..62c6101df260 100644 --- a/arch/arm64/mm/pgd.c +++ b/arch/arm64/mm/pgd.c | |||
@@ -32,17 +32,10 @@ | |||
32 | 32 | ||
33 | pgd_t *pgd_alloc(struct mm_struct *mm) | 33 | pgd_t *pgd_alloc(struct mm_struct *mm) |
34 | { | 34 | { |
35 | pgd_t *new_pgd; | ||
36 | |||
37 | if (PGD_SIZE == PAGE_SIZE) | 35 | if (PGD_SIZE == PAGE_SIZE) |
38 | new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL); | 36 | return (pgd_t *)get_zeroed_page(GFP_KERNEL); |
39 | else | 37 | else |
40 | new_pgd = kzalloc(PGD_SIZE, GFP_KERNEL); | 38 | return kzalloc(PGD_SIZE, GFP_KERNEL); |
41 | |||
42 | if (!new_pgd) | ||
43 | return NULL; | ||
44 | |||
45 | return new_pgd; | ||
46 | } | 39 | } |
47 | 40 | ||
48 | void pgd_free(struct mm_struct *mm, pgd_t *pgd) | 41 | void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h index afd45e0d552e..ae763d8bf55a 100644 --- a/arch/ia64/include/asm/unistd.h +++ b/arch/ia64/include/asm/unistd.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | 13 | ||
14 | #define NR_syscalls 312 /* length of syscall table */ | 14 | #define NR_syscalls 314 /* length of syscall table */ |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * The following defines stop scripts/checksyscalls.sh from complaining about | 17 | * The following defines stop scripts/checksyscalls.sh from complaining about |
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h index 34fd6fe46da1..715e85f858de 100644 --- a/arch/ia64/include/uapi/asm/unistd.h +++ b/arch/ia64/include/uapi/asm/unistd.h | |||
@@ -325,5 +325,7 @@ | |||
325 | #define __NR_process_vm_writev 1333 | 325 | #define __NR_process_vm_writev 1333 |
326 | #define __NR_accept4 1334 | 326 | #define __NR_accept4 1334 |
327 | #define __NR_finit_module 1335 | 327 | #define __NR_finit_module 1335 |
328 | #define __NR_sched_setattr 1336 | ||
329 | #define __NR_sched_getattr 1337 | ||
328 | 330 | ||
329 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ | 331 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ |
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index ddea607f948a..fa8d61a312a7 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -1773,6 +1773,8 @@ sys_call_table: | |||
1773 | data8 sys_process_vm_writev | 1773 | data8 sys_process_vm_writev |
1774 | data8 sys_accept4 | 1774 | data8 sys_accept4 |
1775 | data8 sys_finit_module // 1335 | 1775 | data8 sys_finit_module // 1335 |
1776 | data8 sys_sched_setattr | ||
1777 | data8 sys_sched_getattr | ||
1776 | 1778 | ||
1777 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls | 1779 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls |
1778 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ | 1780 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ |
diff --git a/arch/microblaze/include/asm/delay.h b/arch/microblaze/include/asm/delay.h index 05b7d39e4391..66fc24c24238 100644 --- a/arch/microblaze/include/asm/delay.h +++ b/arch/microblaze/include/asm/delay.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #ifndef _ASM_MICROBLAZE_DELAY_H | 13 | #ifndef _ASM_MICROBLAZE_DELAY_H |
14 | #define _ASM_MICROBLAZE_DELAY_H | 14 | #define _ASM_MICROBLAZE_DELAY_H |
15 | 15 | ||
16 | #include <linux/param.h> | ||
17 | |||
16 | extern inline void __delay(unsigned long loops) | 18 | extern inline void __delay(unsigned long loops) |
17 | { | 19 | { |
18 | asm volatile ("# __delay \n\t" \ | 20 | asm volatile ("# __delay \n\t" \ |
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h index a2cea7206077..3fbb7f1db3bc 100644 --- a/arch/microblaze/include/asm/io.h +++ b/arch/microblaze/include/asm/io.h | |||
@@ -89,6 +89,11 @@ static inline unsigned int readl(const volatile void __iomem *addr) | |||
89 | { | 89 | { |
90 | return le32_to_cpu(*(volatile unsigned int __force *)addr); | 90 | return le32_to_cpu(*(volatile unsigned int __force *)addr); |
91 | } | 91 | } |
92 | #define readq readq | ||
93 | static inline u64 readq(const volatile void __iomem *addr) | ||
94 | { | ||
95 | return le64_to_cpu(__raw_readq(addr)); | ||
96 | } | ||
92 | static inline void writeb(unsigned char v, volatile void __iomem *addr) | 97 | static inline void writeb(unsigned char v, volatile void __iomem *addr) |
93 | { | 98 | { |
94 | *(volatile unsigned char __force *)addr = v; | 99 | *(volatile unsigned char __force *)addr = v; |
@@ -101,6 +106,7 @@ static inline void writel(unsigned int v, volatile void __iomem *addr) | |||
101 | { | 106 | { |
102 | *(volatile unsigned int __force *)addr = cpu_to_le32(v); | 107 | *(volatile unsigned int __force *)addr = cpu_to_le32(v); |
103 | } | 108 | } |
109 | #define writeq(b, addr) __raw_writeq(cpu_to_le64(b), addr) | ||
104 | 110 | ||
105 | /* ioread and iowrite variants. thease are for now same as __raw_ | 111 | /* ioread and iowrite variants. thease are for now same as __raw_ |
106 | * variants of accessors. we might check for endianess in the feature | 112 | * variants of accessors. we might check for endianess in the feature |
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S index b7fb0438458c..17645b2e2f07 100644 --- a/arch/microblaze/kernel/head.S +++ b/arch/microblaze/kernel/head.S | |||
@@ -66,7 +66,7 @@ real_start: | |||
66 | mts rmsr, r0 | 66 | mts rmsr, r0 |
67 | /* Disable stack protection from bootloader */ | 67 | /* Disable stack protection from bootloader */ |
68 | mts rslr, r0 | 68 | mts rslr, r0 |
69 | addi r8, r0, 0xFFFFFFF | 69 | addi r8, r0, 0xFFFFFFFF |
70 | mts rshr, r8 | 70 | mts rshr, r8 |
71 | /* | 71 | /* |
72 | * According to Xilinx, msrclr instruction behaves like 'mfs rX,rpc' | 72 | * According to Xilinx, msrclr instruction behaves like 'mfs rX,rpc' |
diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c index 11f3ad20321c..5483906e0f86 100644 --- a/arch/mips/alchemy/devboards/db1000.c +++ b/arch/mips/alchemy/devboards/db1000.c | |||
@@ -534,13 +534,10 @@ static int __init db1000_dev_init(void) | |||
534 | s0 = AU1100_GPIO1_INT; | 534 | s0 = AU1100_GPIO1_INT; |
535 | s1 = AU1100_GPIO4_INT; | 535 | s1 = AU1100_GPIO4_INT; |
536 | 536 | ||
537 | gpio_request(19, "sd0_cd"); | ||
538 | gpio_request(20, "sd1_cd"); | ||
537 | gpio_direction_input(19); /* sd0 cd# */ | 539 | gpio_direction_input(19); /* sd0 cd# */ |
538 | gpio_direction_input(20); /* sd1 cd# */ | 540 | gpio_direction_input(20); /* sd1 cd# */ |
539 | gpio_direction_input(21); /* touch pendown# */ | ||
540 | gpio_direction_input(207); /* SPI MISO */ | ||
541 | gpio_direction_output(208, 0); /* SPI MOSI */ | ||
542 | gpio_direction_output(209, 1); /* SPI SCK */ | ||
543 | gpio_direction_output(210, 1); /* SPI CS# */ | ||
544 | 541 | ||
545 | /* spi_gpio on SSI0 pins */ | 542 | /* spi_gpio on SSI0 pins */ |
546 | pfc = __raw_readl((void __iomem *)SYS_PINFUNC); | 543 | pfc = __raw_readl((void __iomem *)SYS_PINFUNC); |
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h index cfe092fc720d..6b9749540edf 100644 --- a/arch/mips/include/asm/fpu.h +++ b/arch/mips/include/asm/fpu.h | |||
@@ -74,6 +74,8 @@ static inline int __enable_fpu(enum fpu_mode mode) | |||
74 | default: | 74 | default: |
75 | BUG(); | 75 | BUG(); |
76 | } | 76 | } |
77 | |||
78 | return SIGFPE; | ||
77 | } | 79 | } |
78 | 80 | ||
79 | #define __disable_fpu() \ | 81 | #define __disable_fpu() \ |
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h index 1dee279f9665..d6e154a9e6a5 100644 --- a/arch/mips/include/uapi/asm/unistd.h +++ b/arch/mips/include/uapi/asm/unistd.h | |||
@@ -369,16 +369,18 @@ | |||
369 | #define __NR_process_vm_writev (__NR_Linux + 346) | 369 | #define __NR_process_vm_writev (__NR_Linux + 346) |
370 | #define __NR_kcmp (__NR_Linux + 347) | 370 | #define __NR_kcmp (__NR_Linux + 347) |
371 | #define __NR_finit_module (__NR_Linux + 348) | 371 | #define __NR_finit_module (__NR_Linux + 348) |
372 | #define __NR_sched_setattr (__NR_Linux + 349) | ||
373 | #define __NR_sched_getattr (__NR_Linux + 350) | ||
372 | 374 | ||
373 | /* | 375 | /* |
374 | * Offset of the last Linux o32 flavoured syscall | 376 | * Offset of the last Linux o32 flavoured syscall |
375 | */ | 377 | */ |
376 | #define __NR_Linux_syscalls 348 | 378 | #define __NR_Linux_syscalls 350 |
377 | 379 | ||
378 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 380 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
379 | 381 | ||
380 | #define __NR_O32_Linux 4000 | 382 | #define __NR_O32_Linux 4000 |
381 | #define __NR_O32_Linux_syscalls 348 | 383 | #define __NR_O32_Linux_syscalls 350 |
382 | 384 | ||
383 | #if _MIPS_SIM == _MIPS_SIM_ABI64 | 385 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
384 | 386 | ||
@@ -695,16 +697,18 @@ | |||
695 | #define __NR_kcmp (__NR_Linux + 306) | 697 | #define __NR_kcmp (__NR_Linux + 306) |
696 | #define __NR_finit_module (__NR_Linux + 307) | 698 | #define __NR_finit_module (__NR_Linux + 307) |
697 | #define __NR_getdents64 (__NR_Linux + 308) | 699 | #define __NR_getdents64 (__NR_Linux + 308) |
700 | #define __NR_sched_setattr (__NR_Linux + 309) | ||
701 | #define __NR_sched_getattr (__NR_Linux + 310) | ||
698 | 702 | ||
699 | /* | 703 | /* |
700 | * Offset of the last Linux 64-bit flavoured syscall | 704 | * Offset of the last Linux 64-bit flavoured syscall |
701 | */ | 705 | */ |
702 | #define __NR_Linux_syscalls 308 | 706 | #define __NR_Linux_syscalls 310 |
703 | 707 | ||
704 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ | 708 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
705 | 709 | ||
706 | #define __NR_64_Linux 5000 | 710 | #define __NR_64_Linux 5000 |
707 | #define __NR_64_Linux_syscalls 308 | 711 | #define __NR_64_Linux_syscalls 310 |
708 | 712 | ||
709 | #if _MIPS_SIM == _MIPS_SIM_NABI32 | 713 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
710 | 714 | ||
@@ -1025,15 +1029,17 @@ | |||
1025 | #define __NR_process_vm_writev (__NR_Linux + 310) | 1029 | #define __NR_process_vm_writev (__NR_Linux + 310) |
1026 | #define __NR_kcmp (__NR_Linux + 311) | 1030 | #define __NR_kcmp (__NR_Linux + 311) |
1027 | #define __NR_finit_module (__NR_Linux + 312) | 1031 | #define __NR_finit_module (__NR_Linux + 312) |
1032 | #define __NR_sched_setattr (__NR_Linux + 313) | ||
1033 | #define __NR_sched_getattr (__NR_Linux + 314) | ||
1028 | 1034 | ||
1029 | /* | 1035 | /* |
1030 | * Offset of the last N32 flavoured syscall | 1036 | * Offset of the last N32 flavoured syscall |
1031 | */ | 1037 | */ |
1032 | #define __NR_Linux_syscalls 312 | 1038 | #define __NR_Linux_syscalls 314 |
1033 | 1039 | ||
1034 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ | 1040 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
1035 | 1041 | ||
1036 | #define __NR_N32_Linux 6000 | 1042 | #define __NR_N32_Linux 6000 |
1037 | #define __NR_N32_Linux_syscalls 312 | 1043 | #define __NR_N32_Linux_syscalls 314 |
1038 | 1044 | ||
1039 | #endif /* _UAPI_ASM_UNISTD_H */ | 1045 | #endif /* _UAPI_ASM_UNISTD_H */ |
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index e8e541b40d86..a5b14f48e1af 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -563,3 +563,5 @@ EXPORT(sys_call_table) | |||
563 | PTR sys_process_vm_writev | 563 | PTR sys_process_vm_writev |
564 | PTR sys_kcmp | 564 | PTR sys_kcmp |
565 | PTR sys_finit_module | 565 | PTR sys_finit_module |
566 | PTR sys_sched_setattr | ||
567 | PTR sys_sched_getattr /* 4350 */ | ||
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index 57e3742fec59..b56e254beb15 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
@@ -425,4 +425,6 @@ EXPORT(sys_call_table) | |||
425 | PTR sys_kcmp | 425 | PTR sys_kcmp |
426 | PTR sys_finit_module | 426 | PTR sys_finit_module |
427 | PTR sys_getdents64 | 427 | PTR sys_getdents64 |
428 | PTR sys_sched_setattr | ||
429 | PTR sys_sched_getattr /* 5310 */ | ||
428 | .size sys_call_table,.-sys_call_table | 430 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 2f48f5934399..f7e5b72cf481 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -418,4 +418,6 @@ EXPORT(sysn32_call_table) | |||
418 | PTR compat_sys_process_vm_writev /* 6310 */ | 418 | PTR compat_sys_process_vm_writev /* 6310 */ |
419 | PTR sys_kcmp | 419 | PTR sys_kcmp |
420 | PTR sys_finit_module | 420 | PTR sys_finit_module |
421 | PTR sys_sched_setattr | ||
422 | PTR sys_sched_getattr | ||
421 | .size sysn32_call_table,.-sysn32_call_table | 423 | .size sysn32_call_table,.-sysn32_call_table |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index f1acdb429f4f..6788727d91af 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -541,4 +541,6 @@ EXPORT(sys32_call_table) | |||
541 | PTR compat_sys_process_vm_writev | 541 | PTR compat_sys_process_vm_writev |
542 | PTR sys_kcmp | 542 | PTR sys_kcmp |
543 | PTR sys_finit_module | 543 | PTR sys_finit_module |
544 | PTR sys_sched_setattr | ||
545 | PTR sys_sched_getattr /* 4350 */ | ||
544 | .size sys32_call_table,.-sys32_call_table | 546 | .size sys32_call_table,.-sys32_call_table |
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c index 88d0962de65a..2bedafea3d94 100644 --- a/arch/parisc/hpux/fs.c +++ b/arch/parisc/hpux/fs.c | |||
@@ -33,22 +33,9 @@ | |||
33 | 33 | ||
34 | int hpux_execve(struct pt_regs *regs) | 34 | int hpux_execve(struct pt_regs *regs) |
35 | { | 35 | { |
36 | int error; | 36 | return do_execve(getname((const char __user *) regs->gr[26]), |
37 | struct filename *filename; | ||
38 | |||
39 | filename = getname((const char __user *) regs->gr[26]); | ||
40 | error = PTR_ERR(filename); | ||
41 | if (IS_ERR(filename)) | ||
42 | goto out; | ||
43 | |||
44 | error = do_execve(filename->name, | ||
45 | (const char __user *const __user *) regs->gr[25], | 37 | (const char __user *const __user *) regs->gr[25], |
46 | (const char __user *const __user *) regs->gr[24]); | 38 | (const char __user *const __user *) regs->gr[24]); |
47 | |||
48 | putname(filename); | ||
49 | |||
50 | out: | ||
51 | return error; | ||
52 | } | 39 | } |
53 | 40 | ||
54 | struct hpux_dirent { | 41 | struct hpux_dirent { |
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index e27e9ad6818e..150866b2a3fe 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h | |||
@@ -134,6 +134,7 @@ static inline int dma_supported(struct device *dev, u64 mask) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | extern int dma_set_mask(struct device *dev, u64 dma_mask); | 136 | extern int dma_set_mask(struct device *dev, u64 dma_mask); |
137 | extern int __dma_set_mask(struct device *dev, u64 dma_mask); | ||
137 | 138 | ||
138 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) | 139 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
139 | 140 | ||
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h index f7a8036579b5..42632c7a2a4e 100644 --- a/arch/powerpc/include/asm/iommu.h +++ b/arch/powerpc/include/asm/iommu.h | |||
@@ -77,6 +77,7 @@ struct iommu_table { | |||
77 | #ifdef CONFIG_IOMMU_API | 77 | #ifdef CONFIG_IOMMU_API |
78 | struct iommu_group *it_group; | 78 | struct iommu_group *it_group; |
79 | #endif | 79 | #endif |
80 | void (*set_bypass)(struct iommu_table *tbl, bool enable); | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | /* Pure 2^n version of get_order */ | 83 | /* Pure 2^n version of get_order */ |
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h index 4ee06fe15de4..d0e784e0ff48 100644 --- a/arch/powerpc/include/asm/sections.h +++ b/arch/powerpc/include/asm/sections.h | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #ifdef __powerpc64__ | 9 | #ifdef __powerpc64__ |
10 | 10 | ||
11 | extern char __start_interrupts[]; | ||
11 | extern char __end_interrupts[]; | 12 | extern char __end_interrupts[]; |
12 | 13 | ||
13 | extern char __prom_init_toc_start[]; | 14 | extern char __prom_init_toc_start[]; |
@@ -21,6 +22,17 @@ static inline int in_kernel_text(unsigned long addr) | |||
21 | return 0; | 22 | return 0; |
22 | } | 23 | } |
23 | 24 | ||
25 | static inline int overlaps_interrupt_vector_text(unsigned long start, | ||
26 | unsigned long end) | ||
27 | { | ||
28 | unsigned long real_start, real_end; | ||
29 | real_start = __start_interrupts - _stext; | ||
30 | real_end = __end_interrupts - _stext; | ||
31 | |||
32 | return start < (unsigned long)__va(real_end) && | ||
33 | (unsigned long)__va(real_start) < end; | ||
34 | } | ||
35 | |||
24 | static inline int overlaps_kernel_text(unsigned long start, unsigned long end) | 36 | static inline int overlaps_kernel_text(unsigned long start, unsigned long end) |
25 | { | 37 | { |
26 | return start < (unsigned long)__init_end && | 38 | return start < (unsigned long)__init_end && |
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c index 8032b97ccdcb..ee78f6e49d64 100644 --- a/arch/powerpc/kernel/dma.c +++ b/arch/powerpc/kernel/dma.c | |||
@@ -191,12 +191,10 @@ EXPORT_SYMBOL(dma_direct_ops); | |||
191 | 191 | ||
192 | #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) | 192 | #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) |
193 | 193 | ||
194 | int dma_set_mask(struct device *dev, u64 dma_mask) | 194 | int __dma_set_mask(struct device *dev, u64 dma_mask) |
195 | { | 195 | { |
196 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | 196 | struct dma_map_ops *dma_ops = get_dma_ops(dev); |
197 | 197 | ||
198 | if (ppc_md.dma_set_mask) | ||
199 | return ppc_md.dma_set_mask(dev, dma_mask); | ||
200 | if ((dma_ops != NULL) && (dma_ops->set_dma_mask != NULL)) | 198 | if ((dma_ops != NULL) && (dma_ops->set_dma_mask != NULL)) |
201 | return dma_ops->set_dma_mask(dev, dma_mask); | 199 | return dma_ops->set_dma_mask(dev, dma_mask); |
202 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) | 200 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) |
@@ -204,6 +202,12 @@ int dma_set_mask(struct device *dev, u64 dma_mask) | |||
204 | *dev->dma_mask = dma_mask; | 202 | *dev->dma_mask = dma_mask; |
205 | return 0; | 203 | return 0; |
206 | } | 204 | } |
205 | int dma_set_mask(struct device *dev, u64 dma_mask) | ||
206 | { | ||
207 | if (ppc_md.dma_set_mask) | ||
208 | return ppc_md.dma_set_mask(dev, dma_mask); | ||
209 | return __dma_set_mask(dev, dma_mask); | ||
210 | } | ||
207 | EXPORT_SYMBOL(dma_set_mask); | 211 | EXPORT_SYMBOL(dma_set_mask); |
208 | 212 | ||
209 | u64 dma_get_required_mask(struct device *dev) | 213 | u64 dma_get_required_mask(struct device *dev) |
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c index 7bb30dca4e19..fdc679d309ec 100644 --- a/arch/powerpc/kernel/eeh_driver.c +++ b/arch/powerpc/kernel/eeh_driver.c | |||
@@ -362,9 +362,13 @@ static void *eeh_rmv_device(void *data, void *userdata) | |||
362 | */ | 362 | */ |
363 | if (!dev || (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE)) | 363 | if (!dev || (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE)) |
364 | return NULL; | 364 | return NULL; |
365 | |||
365 | driver = eeh_pcid_get(dev); | 366 | driver = eeh_pcid_get(dev); |
366 | if (driver && driver->err_handler) | 367 | if (driver) { |
367 | return NULL; | 368 | eeh_pcid_put(dev); |
369 | if (driver->err_handler) | ||
370 | return NULL; | ||
371 | } | ||
368 | 372 | ||
369 | /* Remove it from PCI subsystem */ | 373 | /* Remove it from PCI subsystem */ |
370 | pr_debug("EEH: Removing %s without EEH sensitive driver\n", | 374 | pr_debug("EEH: Removing %s without EEH sensitive driver\n", |
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index d773dd440a45..88e3ec6e1d96 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c | |||
@@ -1088,6 +1088,14 @@ int iommu_take_ownership(struct iommu_table *tbl) | |||
1088 | memset(tbl->it_map, 0xff, sz); | 1088 | memset(tbl->it_map, 0xff, sz); |
1089 | iommu_clear_tces_and_put_pages(tbl, tbl->it_offset, tbl->it_size); | 1089 | iommu_clear_tces_and_put_pages(tbl, tbl->it_offset, tbl->it_size); |
1090 | 1090 | ||
1091 | /* | ||
1092 | * Disable iommu bypass, otherwise the user can DMA to all of | ||
1093 | * our physical memory via the bypass window instead of just | ||
1094 | * the pages that has been explicitly mapped into the iommu | ||
1095 | */ | ||
1096 | if (tbl->set_bypass) | ||
1097 | tbl->set_bypass(tbl, false); | ||
1098 | |||
1091 | return 0; | 1099 | return 0; |
1092 | } | 1100 | } |
1093 | EXPORT_SYMBOL_GPL(iommu_take_ownership); | 1101 | EXPORT_SYMBOL_GPL(iommu_take_ownership); |
@@ -1102,6 +1110,10 @@ void iommu_release_ownership(struct iommu_table *tbl) | |||
1102 | /* Restore bit#0 set by iommu_init_table() */ | 1110 | /* Restore bit#0 set by iommu_init_table() */ |
1103 | if (tbl->it_offset == 0) | 1111 | if (tbl->it_offset == 0) |
1104 | set_bit(0, tbl->it_map); | 1112 | set_bit(0, tbl->it_map); |
1113 | |||
1114 | /* The kernel owns the device now, we can restore the iommu bypass */ | ||
1115 | if (tbl->set_bypass) | ||
1116 | tbl->set_bypass(tbl, true); | ||
1105 | } | 1117 | } |
1106 | EXPORT_SYMBOL_GPL(iommu_release_ownership); | 1118 | EXPORT_SYMBOL_GPL(iommu_release_ownership); |
1107 | 1119 | ||
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 9729b23bfb0a..1d0848bba049 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -559,8 +559,13 @@ void exc_lvl_ctx_init(void) | |||
559 | #ifdef CONFIG_PPC64 | 559 | #ifdef CONFIG_PPC64 |
560 | cpu_nr = i; | 560 | cpu_nr = i; |
561 | #else | 561 | #else |
562 | #ifdef CONFIG_SMP | ||
562 | cpu_nr = get_hard_smp_processor_id(i); | 563 | cpu_nr = get_hard_smp_processor_id(i); |
564 | #else | ||
565 | cpu_nr = 0; | ||
563 | #endif | 566 | #endif |
567 | #endif | ||
568 | |||
564 | memset((void *)critirq_ctx[cpu_nr], 0, THREAD_SIZE); | 569 | memset((void *)critirq_ctx[cpu_nr], 0, THREAD_SIZE); |
565 | tp = critirq_ctx[cpu_nr]; | 570 | tp = critirq_ctx[cpu_nr]; |
566 | tp->cpu = cpu_nr; | 571 | tp->cpu = cpu_nr; |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index 75d4f7340da8..015ae55c1868 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
@@ -196,7 +196,9 @@ int overlaps_crashkernel(unsigned long start, unsigned long size) | |||
196 | 196 | ||
197 | /* Values we need to export to the second kernel via the device tree. */ | 197 | /* Values we need to export to the second kernel via the device tree. */ |
198 | static phys_addr_t kernel_end; | 198 | static phys_addr_t kernel_end; |
199 | static phys_addr_t crashk_base; | ||
199 | static phys_addr_t crashk_size; | 200 | static phys_addr_t crashk_size; |
201 | static unsigned long long mem_limit; | ||
200 | 202 | ||
201 | static struct property kernel_end_prop = { | 203 | static struct property kernel_end_prop = { |
202 | .name = "linux,kernel-end", | 204 | .name = "linux,kernel-end", |
@@ -207,7 +209,7 @@ static struct property kernel_end_prop = { | |||
207 | static struct property crashk_base_prop = { | 209 | static struct property crashk_base_prop = { |
208 | .name = "linux,crashkernel-base", | 210 | .name = "linux,crashkernel-base", |
209 | .length = sizeof(phys_addr_t), | 211 | .length = sizeof(phys_addr_t), |
210 | .value = &crashk_res.start, | 212 | .value = &crashk_base |
211 | }; | 213 | }; |
212 | 214 | ||
213 | static struct property crashk_size_prop = { | 215 | static struct property crashk_size_prop = { |
@@ -219,9 +221,11 @@ static struct property crashk_size_prop = { | |||
219 | static struct property memory_limit_prop = { | 221 | static struct property memory_limit_prop = { |
220 | .name = "linux,memory-limit", | 222 | .name = "linux,memory-limit", |
221 | .length = sizeof(unsigned long long), | 223 | .length = sizeof(unsigned long long), |
222 | .value = &memory_limit, | 224 | .value = &mem_limit, |
223 | }; | 225 | }; |
224 | 226 | ||
227 | #define cpu_to_be_ulong __PASTE(cpu_to_be, BITS_PER_LONG) | ||
228 | |||
225 | static void __init export_crashk_values(struct device_node *node) | 229 | static void __init export_crashk_values(struct device_node *node) |
226 | { | 230 | { |
227 | struct property *prop; | 231 | struct property *prop; |
@@ -237,8 +241,9 @@ static void __init export_crashk_values(struct device_node *node) | |||
237 | of_remove_property(node, prop); | 241 | of_remove_property(node, prop); |
238 | 242 | ||
239 | if (crashk_res.start != 0) { | 243 | if (crashk_res.start != 0) { |
244 | crashk_base = cpu_to_be_ulong(crashk_res.start), | ||
240 | of_add_property(node, &crashk_base_prop); | 245 | of_add_property(node, &crashk_base_prop); |
241 | crashk_size = resource_size(&crashk_res); | 246 | crashk_size = cpu_to_be_ulong(resource_size(&crashk_res)); |
242 | of_add_property(node, &crashk_size_prop); | 247 | of_add_property(node, &crashk_size_prop); |
243 | } | 248 | } |
244 | 249 | ||
@@ -246,6 +251,7 @@ static void __init export_crashk_values(struct device_node *node) | |||
246 | * memory_limit is required by the kexec-tools to limit the | 251 | * memory_limit is required by the kexec-tools to limit the |
247 | * crash regions to the actual memory used. | 252 | * crash regions to the actual memory used. |
248 | */ | 253 | */ |
254 | mem_limit = cpu_to_be_ulong(memory_limit); | ||
249 | of_update_property(node, &memory_limit_prop); | 255 | of_update_property(node, &memory_limit_prop); |
250 | } | 256 | } |
251 | 257 | ||
@@ -264,7 +270,7 @@ static int __init kexec_setup(void) | |||
264 | of_remove_property(node, prop); | 270 | of_remove_property(node, prop); |
265 | 271 | ||
266 | /* information needed by userspace when using default_machine_kexec */ | 272 | /* information needed by userspace when using default_machine_kexec */ |
267 | kernel_end = __pa(_end); | 273 | kernel_end = cpu_to_be_ulong(__pa(_end)); |
268 | of_add_property(node, &kernel_end_prop); | 274 | of_add_property(node, &kernel_end_prop); |
269 | 275 | ||
270 | export_crashk_values(node); | 276 | export_crashk_values(node); |
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index be4e6d648f60..59d229a2a3e0 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c | |||
@@ -369,6 +369,7 @@ void default_machine_kexec(struct kimage *image) | |||
369 | 369 | ||
370 | /* Values we need to export to the second kernel via the device tree. */ | 370 | /* Values we need to export to the second kernel via the device tree. */ |
371 | static unsigned long htab_base; | 371 | static unsigned long htab_base; |
372 | static unsigned long htab_size; | ||
372 | 373 | ||
373 | static struct property htab_base_prop = { | 374 | static struct property htab_base_prop = { |
374 | .name = "linux,htab-base", | 375 | .name = "linux,htab-base", |
@@ -379,7 +380,7 @@ static struct property htab_base_prop = { | |||
379 | static struct property htab_size_prop = { | 380 | static struct property htab_size_prop = { |
380 | .name = "linux,htab-size", | 381 | .name = "linux,htab-size", |
381 | .length = sizeof(unsigned long), | 382 | .length = sizeof(unsigned long), |
382 | .value = &htab_size_bytes, | 383 | .value = &htab_size, |
383 | }; | 384 | }; |
384 | 385 | ||
385 | static int __init export_htab_values(void) | 386 | static int __init export_htab_values(void) |
@@ -403,8 +404,9 @@ static int __init export_htab_values(void) | |||
403 | if (prop) | 404 | if (prop) |
404 | of_remove_property(node, prop); | 405 | of_remove_property(node, prop); |
405 | 406 | ||
406 | htab_base = __pa(htab_address); | 407 | htab_base = cpu_to_be64(__pa(htab_address)); |
407 | of_add_property(node, &htab_base_prop); | 408 | of_add_property(node, &htab_base_prop); |
409 | htab_size = cpu_to_be64(htab_size_bytes); | ||
408 | of_add_property(node, &htab_size_prop); | 410 | of_add_property(node, &htab_size_prop); |
409 | 411 | ||
410 | of_node_put(node); | 412 | of_node_put(node); |
diff --git a/arch/powerpc/kernel/reloc_64.S b/arch/powerpc/kernel/reloc_64.S index b47a0e1ab001..1482327cfeba 100644 --- a/arch/powerpc/kernel/reloc_64.S +++ b/arch/powerpc/kernel/reloc_64.S | |||
@@ -69,8 +69,8 @@ _GLOBAL(relocate) | |||
69 | * R_PPC64_RELATIVE ones. | 69 | * R_PPC64_RELATIVE ones. |
70 | */ | 70 | */ |
71 | mtctr r8 | 71 | mtctr r8 |
72 | 5: lwz r0,12(9) /* ELF64_R_TYPE(reloc->r_info) */ | 72 | 5: ld r0,8(9) /* ELF64_R_TYPE(reloc->r_info) */ |
73 | cmpwi r0,R_PPC64_RELATIVE | 73 | cmpdi r0,R_PPC64_RELATIVE |
74 | bne 6f | 74 | bne 6f |
75 | ld r6,0(r9) /* reloc->r_offset */ | 75 | ld r6,0(r9) /* reloc->r_offset */ |
76 | ld r0,16(r9) /* reloc->r_addend */ | 76 | ld r0,16(r9) /* reloc->r_addend */ |
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 2b0da27eaee4..04cc4fcca78b 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -247,7 +247,12 @@ static void __init exc_lvl_early_init(void) | |||
247 | /* interrupt stacks must be in lowmem, we get that for free on ppc32 | 247 | /* interrupt stacks must be in lowmem, we get that for free on ppc32 |
248 | * as the memblock is limited to lowmem by MEMBLOCK_REAL_LIMIT */ | 248 | * as the memblock is limited to lowmem by MEMBLOCK_REAL_LIMIT */ |
249 | for_each_possible_cpu(i) { | 249 | for_each_possible_cpu(i) { |
250 | #ifdef CONFIG_SMP | ||
250 | hw_cpu = get_hard_smp_processor_id(i); | 251 | hw_cpu = get_hard_smp_processor_id(i); |
252 | #else | ||
253 | hw_cpu = 0; | ||
254 | #endif | ||
255 | |||
251 | critirq_ctx[hw_cpu] = (struct thread_info *) | 256 | critirq_ctx[hw_cpu] = (struct thread_info *) |
252 | __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE)); | 257 | __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE)); |
253 | #ifdef CONFIG_BOOKE | 258 | #ifdef CONFIG_BOOKE |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index de6881259aef..d766d6ee33fe 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -207,6 +207,20 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, | |||
207 | if (overlaps_kernel_text(vaddr, vaddr + step)) | 207 | if (overlaps_kernel_text(vaddr, vaddr + step)) |
208 | tprot &= ~HPTE_R_N; | 208 | tprot &= ~HPTE_R_N; |
209 | 209 | ||
210 | /* | ||
211 | * If relocatable, check if it overlaps interrupt vectors that | ||
212 | * are copied down to real 0. For relocatable kernel | ||
213 | * (e.g. kdump case) we copy interrupt vectors down to real | ||
214 | * address 0. Mark that region as executable. This is | ||
215 | * because on p8 system with relocation on exception feature | ||
216 | * enabled, exceptions are raised with MMU (IR=DR=1) ON. Hence | ||
217 | * in order to execute the interrupt handlers in virtual | ||
218 | * mode the vector region need to be marked as executable. | ||
219 | */ | ||
220 | if ((PHYSICAL_START > MEMORY_START) && | ||
221 | overlaps_interrupt_vector_text(vaddr, vaddr + step)) | ||
222 | tprot &= ~HPTE_R_N; | ||
223 | |||
210 | hash = hpt_hash(vpn, shift, ssize); | 224 | hash = hpt_hash(vpn, shift, ssize); |
211 | hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); | 225 | hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); |
212 | 226 | ||
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 29b89e863d7c..67cf22083f4c 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
@@ -1147,6 +1147,9 @@ static void power_pmu_enable(struct pmu *pmu) | |||
1147 | mmcr0 = ebb_switch_in(ebb, cpuhw->mmcr[0]); | 1147 | mmcr0 = ebb_switch_in(ebb, cpuhw->mmcr[0]); |
1148 | 1148 | ||
1149 | mb(); | 1149 | mb(); |
1150 | if (cpuhw->bhrb_users) | ||
1151 | ppmu->config_bhrb(cpuhw->bhrb_filter); | ||
1152 | |||
1150 | write_mmcr0(cpuhw, mmcr0); | 1153 | write_mmcr0(cpuhw, mmcr0); |
1151 | 1154 | ||
1152 | /* | 1155 | /* |
@@ -1158,8 +1161,6 @@ static void power_pmu_enable(struct pmu *pmu) | |||
1158 | } | 1161 | } |
1159 | 1162 | ||
1160 | out: | 1163 | out: |
1161 | if (cpuhw->bhrb_users) | ||
1162 | ppmu->config_bhrb(cpuhw->bhrb_filter); | ||
1163 | 1164 | ||
1164 | local_irq_restore(flags); | 1165 | local_irq_restore(flags); |
1165 | } | 1166 | } |
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index a3f7abd2f13f..96cee20dcd34 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c | |||
@@ -25,6 +25,37 @@ | |||
25 | #define PM_BRU_FIN 0x10068 | 25 | #define PM_BRU_FIN 0x10068 |
26 | #define PM_BR_MPRED_CMPL 0x400f6 | 26 | #define PM_BR_MPRED_CMPL 0x400f6 |
27 | 27 | ||
28 | /* All L1 D cache load references counted at finish, gated by reject */ | ||
29 | #define PM_LD_REF_L1 0x100ee | ||
30 | /* Load Missed L1 */ | ||
31 | #define PM_LD_MISS_L1 0x3e054 | ||
32 | /* Store Missed L1 */ | ||
33 | #define PM_ST_MISS_L1 0x300f0 | ||
34 | /* L1 cache data prefetches */ | ||
35 | #define PM_L1_PREF 0x0d8b8 | ||
36 | /* Instruction fetches from L1 */ | ||
37 | #define PM_INST_FROM_L1 0x04080 | ||
38 | /* Demand iCache Miss */ | ||
39 | #define PM_L1_ICACHE_MISS 0x200fd | ||
40 | /* Instruction Demand sectors wriittent into IL1 */ | ||
41 | #define PM_L1_DEMAND_WRITE 0x0408c | ||
42 | /* Instruction prefetch written into IL1 */ | ||
43 | #define PM_IC_PREF_WRITE 0x0408e | ||
44 | /* The data cache was reloaded from local core's L3 due to a demand load */ | ||
45 | #define PM_DATA_FROM_L3 0x4c042 | ||
46 | /* Demand LD - L3 Miss (not L2 hit and not L3 hit) */ | ||
47 | #define PM_DATA_FROM_L3MISS 0x300fe | ||
48 | /* All successful D-side store dispatches for this thread */ | ||
49 | #define PM_L2_ST 0x17080 | ||
50 | /* All successful D-side store dispatches for this thread that were L2 Miss */ | ||
51 | #define PM_L2_ST_MISS 0x17082 | ||
52 | /* Total HW L3 prefetches(Load+store) */ | ||
53 | #define PM_L3_PREF_ALL 0x4e052 | ||
54 | /* Data PTEG reload */ | ||
55 | #define PM_DTLB_MISS 0x300fc | ||
56 | /* ITLB Reloaded */ | ||
57 | #define PM_ITLB_MISS 0x400fc | ||
58 | |||
28 | 59 | ||
29 | /* | 60 | /* |
30 | * Raw event encoding for POWER8: | 61 | * Raw event encoding for POWER8: |
@@ -557,6 +588,8 @@ static int power8_generic_events[] = { | |||
557 | [PERF_COUNT_HW_INSTRUCTIONS] = PM_INST_CMPL, | 588 | [PERF_COUNT_HW_INSTRUCTIONS] = PM_INST_CMPL, |
558 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BRU_FIN, | 589 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PM_BRU_FIN, |
559 | [PERF_COUNT_HW_BRANCH_MISSES] = PM_BR_MPRED_CMPL, | 590 | [PERF_COUNT_HW_BRANCH_MISSES] = PM_BR_MPRED_CMPL, |
591 | [PERF_COUNT_HW_CACHE_REFERENCES] = PM_LD_REF_L1, | ||
592 | [PERF_COUNT_HW_CACHE_MISSES] = PM_LD_MISS_L1, | ||
560 | }; | 593 | }; |
561 | 594 | ||
562 | static u64 power8_bhrb_filter_map(u64 branch_sample_type) | 595 | static u64 power8_bhrb_filter_map(u64 branch_sample_type) |
@@ -596,6 +629,116 @@ static void power8_config_bhrb(u64 pmu_bhrb_filter) | |||
596 | mtspr(SPRN_MMCRA, (mfspr(SPRN_MMCRA) | pmu_bhrb_filter)); | 629 | mtspr(SPRN_MMCRA, (mfspr(SPRN_MMCRA) | pmu_bhrb_filter)); |
597 | } | 630 | } |
598 | 631 | ||
632 | #define C(x) PERF_COUNT_HW_CACHE_##x | ||
633 | |||
634 | /* | ||
635 | * Table of generalized cache-related events. | ||
636 | * 0 means not supported, -1 means nonsensical, other values | ||
637 | * are event codes. | ||
638 | */ | ||
639 | static int power8_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { | ||
640 | [ C(L1D) ] = { | ||
641 | [ C(OP_READ) ] = { | ||
642 | [ C(RESULT_ACCESS) ] = PM_LD_REF_L1, | ||
643 | [ C(RESULT_MISS) ] = PM_LD_MISS_L1, | ||
644 | }, | ||
645 | [ C(OP_WRITE) ] = { | ||
646 | [ C(RESULT_ACCESS) ] = 0, | ||
647 | [ C(RESULT_MISS) ] = PM_ST_MISS_L1, | ||
648 | }, | ||
649 | [ C(OP_PREFETCH) ] = { | ||
650 | [ C(RESULT_ACCESS) ] = PM_L1_PREF, | ||
651 | [ C(RESULT_MISS) ] = 0, | ||
652 | }, | ||
653 | }, | ||
654 | [ C(L1I) ] = { | ||
655 | [ C(OP_READ) ] = { | ||
656 | [ C(RESULT_ACCESS) ] = PM_INST_FROM_L1, | ||
657 | [ C(RESULT_MISS) ] = PM_L1_ICACHE_MISS, | ||
658 | }, | ||
659 | [ C(OP_WRITE) ] = { | ||
660 | [ C(RESULT_ACCESS) ] = PM_L1_DEMAND_WRITE, | ||
661 | [ C(RESULT_MISS) ] = -1, | ||
662 | }, | ||
663 | [ C(OP_PREFETCH) ] = { | ||
664 | [ C(RESULT_ACCESS) ] = PM_IC_PREF_WRITE, | ||
665 | [ C(RESULT_MISS) ] = 0, | ||
666 | }, | ||
667 | }, | ||
668 | [ C(LL) ] = { | ||
669 | [ C(OP_READ) ] = { | ||
670 | [ C(RESULT_ACCESS) ] = PM_DATA_FROM_L3, | ||
671 | [ C(RESULT_MISS) ] = PM_DATA_FROM_L3MISS, | ||
672 | }, | ||
673 | [ C(OP_WRITE) ] = { | ||
674 | [ C(RESULT_ACCESS) ] = PM_L2_ST, | ||
675 | [ C(RESULT_MISS) ] = PM_L2_ST_MISS, | ||
676 | }, | ||
677 | [ C(OP_PREFETCH) ] = { | ||
678 | [ C(RESULT_ACCESS) ] = PM_L3_PREF_ALL, | ||
679 | [ C(RESULT_MISS) ] = 0, | ||
680 | }, | ||
681 | }, | ||
682 | [ C(DTLB) ] = { | ||
683 | [ C(OP_READ) ] = { | ||
684 | [ C(RESULT_ACCESS) ] = 0, | ||
685 | [ C(RESULT_MISS) ] = PM_DTLB_MISS, | ||
686 | }, | ||
687 | [ C(OP_WRITE) ] = { | ||
688 | [ C(RESULT_ACCESS) ] = -1, | ||
689 | [ C(RESULT_MISS) ] = -1, | ||
690 | }, | ||
691 | [ C(OP_PREFETCH) ] = { | ||
692 | [ C(RESULT_ACCESS) ] = -1, | ||
693 | [ C(RESULT_MISS) ] = -1, | ||
694 | }, | ||
695 | }, | ||
696 | [ C(ITLB) ] = { | ||
697 | [ C(OP_READ) ] = { | ||
698 | [ C(RESULT_ACCESS) ] = 0, | ||
699 | [ C(RESULT_MISS) ] = PM_ITLB_MISS, | ||
700 | }, | ||
701 | [ C(OP_WRITE) ] = { | ||
702 | [ C(RESULT_ACCESS) ] = -1, | ||
703 | [ C(RESULT_MISS) ] = -1, | ||
704 | }, | ||
705 | [ C(OP_PREFETCH) ] = { | ||
706 | [ C(RESULT_ACCESS) ] = -1, | ||
707 | [ C(RESULT_MISS) ] = -1, | ||
708 | }, | ||
709 | }, | ||
710 | [ C(BPU) ] = { | ||
711 | [ C(OP_READ) ] = { | ||
712 | [ C(RESULT_ACCESS) ] = PM_BRU_FIN, | ||
713 | [ C(RESULT_MISS) ] = PM_BR_MPRED_CMPL, | ||
714 | }, | ||
715 | [ C(OP_WRITE) ] = { | ||
716 | [ C(RESULT_ACCESS) ] = -1, | ||
717 | [ C(RESULT_MISS) ] = -1, | ||
718 | }, | ||
719 | [ C(OP_PREFETCH) ] = { | ||
720 | [ C(RESULT_ACCESS) ] = -1, | ||
721 | [ C(RESULT_MISS) ] = -1, | ||
722 | }, | ||
723 | }, | ||
724 | [ C(NODE) ] = { | ||
725 | [ C(OP_READ) ] = { | ||
726 | [ C(RESULT_ACCESS) ] = -1, | ||
727 | [ C(RESULT_MISS) ] = -1, | ||
728 | }, | ||
729 | [ C(OP_WRITE) ] = { | ||
730 | [ C(RESULT_ACCESS) ] = -1, | ||
731 | [ C(RESULT_MISS) ] = -1, | ||
732 | }, | ||
733 | [ C(OP_PREFETCH) ] = { | ||
734 | [ C(RESULT_ACCESS) ] = -1, | ||
735 | [ C(RESULT_MISS) ] = -1, | ||
736 | }, | ||
737 | }, | ||
738 | }; | ||
739 | |||
740 | #undef C | ||
741 | |||
599 | static struct power_pmu power8_pmu = { | 742 | static struct power_pmu power8_pmu = { |
600 | .name = "POWER8", | 743 | .name = "POWER8", |
601 | .n_counter = 6, | 744 | .n_counter = 6, |
@@ -611,6 +754,7 @@ static struct power_pmu power8_pmu = { | |||
611 | .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB | PPMU_EBB, | 754 | .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB | PPMU_EBB, |
612 | .n_generic = ARRAY_SIZE(power8_generic_events), | 755 | .n_generic = ARRAY_SIZE(power8_generic_events), |
613 | .generic_events = power8_generic_events, | 756 | .generic_events = power8_generic_events, |
757 | .cache_events = &power8_cache_events, | ||
614 | .attr_groups = power8_pmu_attr_groups, | 758 | .attr_groups = power8_pmu_attr_groups, |
615 | .bhrb_nr = 32, | 759 | .bhrb_nr = 32, |
616 | }; | 760 | }; |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 7d6dcc6d5fa9..3b2b4fb3585b 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/msi.h> | 23 | #include <linux/msi.h> |
24 | #include <linux/memblock.h> | ||
24 | 25 | ||
25 | #include <asm/sections.h> | 26 | #include <asm/sections.h> |
26 | #include <asm/io.h> | 27 | #include <asm/io.h> |
@@ -460,9 +461,39 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev | |||
460 | return; | 461 | return; |
461 | 462 | ||
462 | pe = &phb->ioda.pe_array[pdn->pe_number]; | 463 | pe = &phb->ioda.pe_array[pdn->pe_number]; |
464 | WARN_ON(get_dma_ops(&pdev->dev) != &dma_iommu_ops); | ||
463 | set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table); | 465 | set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table); |
464 | } | 466 | } |
465 | 467 | ||
468 | static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb, | ||
469 | struct pci_dev *pdev, u64 dma_mask) | ||
470 | { | ||
471 | struct pci_dn *pdn = pci_get_pdn(pdev); | ||
472 | struct pnv_ioda_pe *pe; | ||
473 | uint64_t top; | ||
474 | bool bypass = false; | ||
475 | |||
476 | if (WARN_ON(!pdn || pdn->pe_number == IODA_INVALID_PE)) | ||
477 | return -ENODEV;; | ||
478 | |||
479 | pe = &phb->ioda.pe_array[pdn->pe_number]; | ||
480 | if (pe->tce_bypass_enabled) { | ||
481 | top = pe->tce_bypass_base + memblock_end_of_DRAM() - 1; | ||
482 | bypass = (dma_mask >= top); | ||
483 | } | ||
484 | |||
485 | if (bypass) { | ||
486 | dev_info(&pdev->dev, "Using 64-bit DMA iommu bypass\n"); | ||
487 | set_dma_ops(&pdev->dev, &dma_direct_ops); | ||
488 | set_dma_offset(&pdev->dev, pe->tce_bypass_base); | ||
489 | } else { | ||
490 | dev_info(&pdev->dev, "Using 32-bit DMA via iommu\n"); | ||
491 | set_dma_ops(&pdev->dev, &dma_iommu_ops); | ||
492 | set_iommu_table_base(&pdev->dev, &pe->tce32_table); | ||
493 | } | ||
494 | return 0; | ||
495 | } | ||
496 | |||
466 | static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus) | 497 | static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus) |
467 | { | 498 | { |
468 | struct pci_dev *dev; | 499 | struct pci_dev *dev; |
@@ -657,6 +688,56 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, | |||
657 | __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs)); | 688 | __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs)); |
658 | } | 689 | } |
659 | 690 | ||
691 | static void pnv_pci_ioda2_set_bypass(struct iommu_table *tbl, bool enable) | ||
692 | { | ||
693 | struct pnv_ioda_pe *pe = container_of(tbl, struct pnv_ioda_pe, | ||
694 | tce32_table); | ||
695 | uint16_t window_id = (pe->pe_number << 1 ) + 1; | ||
696 | int64_t rc; | ||
697 | |||
698 | pe_info(pe, "%sabling 64-bit DMA bypass\n", enable ? "En" : "Dis"); | ||
699 | if (enable) { | ||
700 | phys_addr_t top = memblock_end_of_DRAM(); | ||
701 | |||
702 | top = roundup_pow_of_two(top); | ||
703 | rc = opal_pci_map_pe_dma_window_real(pe->phb->opal_id, | ||
704 | pe->pe_number, | ||
705 | window_id, | ||
706 | pe->tce_bypass_base, | ||
707 | top); | ||
708 | } else { | ||
709 | rc = opal_pci_map_pe_dma_window_real(pe->phb->opal_id, | ||
710 | pe->pe_number, | ||
711 | window_id, | ||
712 | pe->tce_bypass_base, | ||
713 | 0); | ||
714 | |||
715 | /* | ||
716 | * We might want to reset the DMA ops of all devices on | ||
717 | * this PE. However in theory, that shouldn't be necessary | ||
718 | * as this is used for VFIO/KVM pass-through and the device | ||
719 | * hasn't yet been returned to its kernel driver | ||
720 | */ | ||
721 | } | ||
722 | if (rc) | ||
723 | pe_err(pe, "OPAL error %lld configuring bypass window\n", rc); | ||
724 | else | ||
725 | pe->tce_bypass_enabled = enable; | ||
726 | } | ||
727 | |||
728 | static void pnv_pci_ioda2_setup_bypass_pe(struct pnv_phb *phb, | ||
729 | struct pnv_ioda_pe *pe) | ||
730 | { | ||
731 | /* TVE #1 is selected by PCI address bit 59 */ | ||
732 | pe->tce_bypass_base = 1ull << 59; | ||
733 | |||
734 | /* Install set_bypass callback for VFIO */ | ||
735 | pe->tce32_table.set_bypass = pnv_pci_ioda2_set_bypass; | ||
736 | |||
737 | /* Enable bypass by default */ | ||
738 | pnv_pci_ioda2_set_bypass(&pe->tce32_table, true); | ||
739 | } | ||
740 | |||
660 | static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, | 741 | static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, |
661 | struct pnv_ioda_pe *pe) | 742 | struct pnv_ioda_pe *pe) |
662 | { | 743 | { |
@@ -727,6 +808,8 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, | |||
727 | else | 808 | else |
728 | pnv_ioda_setup_bus_dma(pe, pe->pbus); | 809 | pnv_ioda_setup_bus_dma(pe, pe->pbus); |
729 | 810 | ||
811 | /* Also create a bypass window */ | ||
812 | pnv_pci_ioda2_setup_bypass_pe(phb, pe); | ||
730 | return; | 813 | return; |
731 | fail: | 814 | fail: |
732 | if (pe->tce32_seg >= 0) | 815 | if (pe->tce32_seg >= 0) |
@@ -1286,6 +1369,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, | |||
1286 | 1369 | ||
1287 | /* Setup TCEs */ | 1370 | /* Setup TCEs */ |
1288 | phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup; | 1371 | phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup; |
1372 | phb->dma_set_mask = pnv_pci_ioda_dma_set_mask; | ||
1289 | 1373 | ||
1290 | /* Setup shutdown function for kexec */ | 1374 | /* Setup shutdown function for kexec */ |
1291 | phb->shutdown = pnv_pci_ioda_shutdown; | 1375 | phb->shutdown = pnv_pci_ioda_shutdown; |
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index b555ebc57ef5..95633d79ef5d 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -634,6 +634,16 @@ static void pnv_pci_dma_dev_setup(struct pci_dev *pdev) | |||
634 | pnv_pci_dma_fallback_setup(hose, pdev); | 634 | pnv_pci_dma_fallback_setup(hose, pdev); |
635 | } | 635 | } |
636 | 636 | ||
637 | int pnv_pci_dma_set_mask(struct pci_dev *pdev, u64 dma_mask) | ||
638 | { | ||
639 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); | ||
640 | struct pnv_phb *phb = hose->private_data; | ||
641 | |||
642 | if (phb && phb->dma_set_mask) | ||
643 | return phb->dma_set_mask(phb, pdev, dma_mask); | ||
644 | return __dma_set_mask(&pdev->dev, dma_mask); | ||
645 | } | ||
646 | |||
637 | void pnv_pci_shutdown(void) | 647 | void pnv_pci_shutdown(void) |
638 | { | 648 | { |
639 | struct pci_controller *hose; | 649 | struct pci_controller *hose; |
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h index 13f1942a9a5f..cde169442775 100644 --- a/arch/powerpc/platforms/powernv/pci.h +++ b/arch/powerpc/platforms/powernv/pci.h | |||
@@ -54,7 +54,9 @@ struct pnv_ioda_pe { | |||
54 | struct iommu_table tce32_table; | 54 | struct iommu_table tce32_table; |
55 | phys_addr_t tce_inval_reg_phys; | 55 | phys_addr_t tce_inval_reg_phys; |
56 | 56 | ||
57 | /* XXX TODO: Add support for additional 64-bit iommus */ | 57 | /* 64-bit TCE bypass region */ |
58 | bool tce_bypass_enabled; | ||
59 | uint64_t tce_bypass_base; | ||
58 | 60 | ||
59 | /* MSIs. MVE index is identical for for 32 and 64 bit MSI | 61 | /* MSIs. MVE index is identical for for 32 and 64 bit MSI |
60 | * and -1 if not supported. (It's actually identical to the | 62 | * and -1 if not supported. (It's actually identical to the |
@@ -113,6 +115,8 @@ struct pnv_phb { | |||
113 | unsigned int hwirq, unsigned int virq, | 115 | unsigned int hwirq, unsigned int virq, |
114 | unsigned int is_64, struct msi_msg *msg); | 116 | unsigned int is_64, struct msi_msg *msg); |
115 | void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev); | 117 | void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev); |
118 | int (*dma_set_mask)(struct pnv_phb *phb, struct pci_dev *pdev, | ||
119 | u64 dma_mask); | ||
116 | void (*fixup_phb)(struct pci_controller *hose); | 120 | void (*fixup_phb)(struct pci_controller *hose); |
117 | u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn); | 121 | u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn); |
118 | void (*shutdown)(struct pnv_phb *phb); | 122 | void (*shutdown)(struct pnv_phb *phb); |
diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h index de6819be1f95..0051e108ef0f 100644 --- a/arch/powerpc/platforms/powernv/powernv.h +++ b/arch/powerpc/platforms/powernv/powernv.h | |||
@@ -7,12 +7,20 @@ extern void pnv_smp_init(void); | |||
7 | static inline void pnv_smp_init(void) { } | 7 | static inline void pnv_smp_init(void) { } |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | struct pci_dev; | ||
11 | |||
10 | #ifdef CONFIG_PCI | 12 | #ifdef CONFIG_PCI |
11 | extern void pnv_pci_init(void); | 13 | extern void pnv_pci_init(void); |
12 | extern void pnv_pci_shutdown(void); | 14 | extern void pnv_pci_shutdown(void); |
15 | extern int pnv_pci_dma_set_mask(struct pci_dev *pdev, u64 dma_mask); | ||
13 | #else | 16 | #else |
14 | static inline void pnv_pci_init(void) { } | 17 | static inline void pnv_pci_init(void) { } |
15 | static inline void pnv_pci_shutdown(void) { } | 18 | static inline void pnv_pci_shutdown(void) { } |
19 | |||
20 | static inline int pnv_pci_dma_set_mask(struct pci_dev *pdev, u64 dma_mask) | ||
21 | { | ||
22 | return -ENODEV; | ||
23 | } | ||
16 | #endif | 24 | #endif |
17 | 25 | ||
18 | extern void pnv_lpc_init(void); | 26 | extern void pnv_lpc_init(void); |
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index 21166f65c97c..110f4fbd319f 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/bug.h> | 28 | #include <linux/bug.h> |
29 | #include <linux/cpuidle.h> | 29 | #include <linux/cpuidle.h> |
30 | #include <linux/pci.h> | ||
30 | 31 | ||
31 | #include <asm/machdep.h> | 32 | #include <asm/machdep.h> |
32 | #include <asm/firmware.h> | 33 | #include <asm/firmware.h> |
@@ -141,6 +142,13 @@ static void pnv_progress(char *s, unsigned short hex) | |||
141 | { | 142 | { |
142 | } | 143 | } |
143 | 144 | ||
145 | static int pnv_dma_set_mask(struct device *dev, u64 dma_mask) | ||
146 | { | ||
147 | if (dev_is_pci(dev)) | ||
148 | return pnv_pci_dma_set_mask(to_pci_dev(dev), dma_mask); | ||
149 | return __dma_set_mask(dev, dma_mask); | ||
150 | } | ||
151 | |||
144 | static void pnv_shutdown(void) | 152 | static void pnv_shutdown(void) |
145 | { | 153 | { |
146 | /* Let the PCI code clear up IODA tables */ | 154 | /* Let the PCI code clear up IODA tables */ |
@@ -238,6 +246,7 @@ define_machine(powernv) { | |||
238 | .machine_shutdown = pnv_shutdown, | 246 | .machine_shutdown = pnv_shutdown, |
239 | .power_save = powernv_idle, | 247 | .power_save = powernv_idle, |
240 | .calibrate_decr = generic_calibrate_decr, | 248 | .calibrate_decr = generic_calibrate_decr, |
249 | .dma_set_mask = pnv_dma_set_mask, | ||
241 | #ifdef CONFIG_KEXEC | 250 | #ifdef CONFIG_KEXEC |
242 | .kexec_cpu_down = pnv_kexec_cpu_down, | 251 | .kexec_cpu_down = pnv_kexec_cpu_down, |
243 | #endif | 252 | #endif |
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index 37300f6ee244..80b1d57c306a 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig | |||
@@ -20,6 +20,7 @@ config PPC_PSERIES | |||
20 | select PPC_DOORBELL | 20 | select PPC_DOORBELL |
21 | select HAVE_CONTEXT_TRACKING | 21 | select HAVE_CONTEXT_TRACKING |
22 | select HOTPLUG_CPU if SMP | 22 | select HOTPLUG_CPU if SMP |
23 | select ARCH_RANDOM | ||
23 | default y | 24 | default y |
24 | 25 | ||
25 | config PPC_SPLPAR | 26 | config PPC_SPLPAR |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 8e639d7cbda7..972df0ffd4dc 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -430,8 +430,7 @@ static void pSeries_machine_kexec(struct kimage *image) | |||
430 | { | 430 | { |
431 | long rc; | 431 | long rc; |
432 | 432 | ||
433 | if (firmware_has_feature(FW_FEATURE_SET_MODE) && | 433 | if (firmware_has_feature(FW_FEATURE_SET_MODE)) { |
434 | (image->type != KEXEC_TYPE_CRASH)) { | ||
435 | rc = pSeries_disable_reloc_on_exc(); | 434 | rc = pSeries_disable_reloc_on_exc(); |
436 | if (rc != H_SUCCESS) | 435 | if (rc != H_SUCCESS) |
437 | pr_warning("Warning: Failed to disable relocation on " | 436 | pr_warning("Warning: Failed to disable relocation on " |
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 0e166ed4cd16..8209744b2829 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -886,25 +886,25 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type) | |||
886 | 886 | ||
887 | /* Default: read HW settings */ | 887 | /* Default: read HW settings */ |
888 | if (flow_type == IRQ_TYPE_DEFAULT) { | 888 | if (flow_type == IRQ_TYPE_DEFAULT) { |
889 | switch(vold & (MPIC_INFO(VECPRI_POLARITY_MASK) | | 889 | int vold_ps; |
890 | MPIC_INFO(VECPRI_SENSE_MASK))) { | 890 | |
891 | case MPIC_INFO(VECPRI_SENSE_EDGE) | | 891 | vold_ps = vold & (MPIC_INFO(VECPRI_POLARITY_MASK) | |
892 | MPIC_INFO(VECPRI_POLARITY_POSITIVE): | 892 | MPIC_INFO(VECPRI_SENSE_MASK)); |
893 | flow_type = IRQ_TYPE_EDGE_RISING; | 893 | |
894 | break; | 894 | if (vold_ps == (MPIC_INFO(VECPRI_SENSE_EDGE) | |
895 | case MPIC_INFO(VECPRI_SENSE_EDGE) | | 895 | MPIC_INFO(VECPRI_POLARITY_POSITIVE))) |
896 | MPIC_INFO(VECPRI_POLARITY_NEGATIVE): | 896 | flow_type = IRQ_TYPE_EDGE_RISING; |
897 | flow_type = IRQ_TYPE_EDGE_FALLING; | 897 | else if (vold_ps == (MPIC_INFO(VECPRI_SENSE_EDGE) | |
898 | break; | 898 | MPIC_INFO(VECPRI_POLARITY_NEGATIVE))) |
899 | case MPIC_INFO(VECPRI_SENSE_LEVEL) | | 899 | flow_type = IRQ_TYPE_EDGE_FALLING; |
900 | MPIC_INFO(VECPRI_POLARITY_POSITIVE): | 900 | else if (vold_ps == (MPIC_INFO(VECPRI_SENSE_LEVEL) | |
901 | flow_type = IRQ_TYPE_LEVEL_HIGH; | 901 | MPIC_INFO(VECPRI_POLARITY_POSITIVE))) |
902 | break; | 902 | flow_type = IRQ_TYPE_LEVEL_HIGH; |
903 | case MPIC_INFO(VECPRI_SENSE_LEVEL) | | 903 | else if (vold_ps == (MPIC_INFO(VECPRI_SENSE_LEVEL) | |
904 | MPIC_INFO(VECPRI_POLARITY_NEGATIVE): | 904 | MPIC_INFO(VECPRI_POLARITY_NEGATIVE))) |
905 | flow_type = IRQ_TYPE_LEVEL_LOW; | 905 | flow_type = IRQ_TYPE_LEVEL_LOW; |
906 | break; | 906 | else |
907 | } | 907 | WARN_ONCE(1, "mpic: unknown IRQ type %d\n", vold); |
908 | } | 908 | } |
909 | 909 | ||
910 | /* Apply to irq desc */ | 910 | /* Apply to irq desc */ |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index a90731b3d44a..b07909850f77 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -309,16 +309,23 @@ static void get_output_lock(void) | |||
309 | 309 | ||
310 | if (xmon_speaker == me) | 310 | if (xmon_speaker == me) |
311 | return; | 311 | return; |
312 | |||
312 | for (;;) { | 313 | for (;;) { |
313 | if (xmon_speaker == 0) { | 314 | last_speaker = cmpxchg(&xmon_speaker, 0, me); |
314 | last_speaker = cmpxchg(&xmon_speaker, 0, me); | 315 | if (last_speaker == 0) |
315 | if (last_speaker == 0) | 316 | return; |
316 | return; | 317 | |
317 | } | 318 | /* |
318 | timeout = 10000000; | 319 | * Wait a full second for the lock, we might be on a slow |
320 | * console, but check every 100us. | ||
321 | */ | ||
322 | timeout = 10000; | ||
319 | while (xmon_speaker == last_speaker) { | 323 | while (xmon_speaker == last_speaker) { |
320 | if (--timeout > 0) | 324 | if (--timeout > 0) { |
325 | udelay(100); | ||
321 | continue; | 326 | continue; |
327 | } | ||
328 | |||
322 | /* hostile takeover */ | 329 | /* hostile takeover */ |
323 | prev = cmpxchg(&xmon_speaker, last_speaker, me); | 330 | prev = cmpxchg(&xmon_speaker, last_speaker, me); |
324 | if (prev == last_speaker) | 331 | if (prev == last_speaker) |
@@ -397,7 +404,6 @@ static int xmon_core(struct pt_regs *regs, int fromipi) | |||
397 | } | 404 | } |
398 | 405 | ||
399 | xmon_fault_jmp[cpu] = recurse_jmp; | 406 | xmon_fault_jmp[cpu] = recurse_jmp; |
400 | cpumask_set_cpu(cpu, &cpus_in_xmon); | ||
401 | 407 | ||
402 | bp = NULL; | 408 | bp = NULL; |
403 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_64BIT)) == (MSR_IR|MSR_64BIT)) | 409 | if ((regs->msr & (MSR_IR|MSR_PR|MSR_64BIT)) == (MSR_IR|MSR_64BIT)) |
@@ -419,6 +425,8 @@ static int xmon_core(struct pt_regs *regs, int fromipi) | |||
419 | release_output_lock(); | 425 | release_output_lock(); |
420 | } | 426 | } |
421 | 427 | ||
428 | cpumask_set_cpu(cpu, &cpus_in_xmon); | ||
429 | |||
422 | waiting: | 430 | waiting: |
423 | secondary = 1; | 431 | secondary = 1; |
424 | while (secondary && !xmon_gate) { | 432 | while (secondary && !xmon_gate) { |
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index 4c4a1cef5208..47c8630c93cd 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c | |||
@@ -529,6 +529,7 @@ static int __init appldata_init(void) | |||
529 | { | 529 | { |
530 | int rc; | 530 | int rc; |
531 | 531 | ||
532 | init_virt_timer(&appldata_timer); | ||
532 | appldata_timer.function = appldata_timer_function; | 533 | appldata_timer.function = appldata_timer_function; |
533 | appldata_timer.data = (unsigned long) &appldata_work; | 534 | appldata_timer.data = (unsigned long) &appldata_work; |
534 | 535 | ||
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index b3feabd39f31..cf3c0089bef2 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/spinlock.h> | ||
28 | #include "crypt_s390.h" | 29 | #include "crypt_s390.h" |
29 | 30 | ||
30 | #define AES_KEYLEN_128 1 | 31 | #define AES_KEYLEN_128 1 |
@@ -32,6 +33,7 @@ | |||
32 | #define AES_KEYLEN_256 4 | 33 | #define AES_KEYLEN_256 4 |
33 | 34 | ||
34 | static u8 *ctrblk; | 35 | static u8 *ctrblk; |
36 | static DEFINE_SPINLOCK(ctrblk_lock); | ||
35 | static char keylen_flag; | 37 | static char keylen_flag; |
36 | 38 | ||
37 | struct s390_aes_ctx { | 39 | struct s390_aes_ctx { |
@@ -758,43 +760,67 @@ static int ctr_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | |||
758 | return aes_set_key(tfm, in_key, key_len); | 760 | return aes_set_key(tfm, in_key, key_len); |
759 | } | 761 | } |
760 | 762 | ||
763 | static unsigned int __ctrblk_init(u8 *ctrptr, unsigned int nbytes) | ||
764 | { | ||
765 | unsigned int i, n; | ||
766 | |||
767 | /* only use complete blocks, max. PAGE_SIZE */ | ||
768 | n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(AES_BLOCK_SIZE - 1); | ||
769 | for (i = AES_BLOCK_SIZE; i < n; i += AES_BLOCK_SIZE) { | ||
770 | memcpy(ctrptr + i, ctrptr + i - AES_BLOCK_SIZE, | ||
771 | AES_BLOCK_SIZE); | ||
772 | crypto_inc(ctrptr + i, AES_BLOCK_SIZE); | ||
773 | } | ||
774 | return n; | ||
775 | } | ||
776 | |||
761 | static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, | 777 | static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, |
762 | struct s390_aes_ctx *sctx, struct blkcipher_walk *walk) | 778 | struct s390_aes_ctx *sctx, struct blkcipher_walk *walk) |
763 | { | 779 | { |
764 | int ret = blkcipher_walk_virt_block(desc, walk, AES_BLOCK_SIZE); | 780 | int ret = blkcipher_walk_virt_block(desc, walk, AES_BLOCK_SIZE); |
765 | unsigned int i, n, nbytes; | 781 | unsigned int n, nbytes; |
766 | u8 buf[AES_BLOCK_SIZE]; | 782 | u8 buf[AES_BLOCK_SIZE], ctrbuf[AES_BLOCK_SIZE]; |
767 | u8 *out, *in; | 783 | u8 *out, *in, *ctrptr = ctrbuf; |
768 | 784 | ||
769 | if (!walk->nbytes) | 785 | if (!walk->nbytes) |
770 | return ret; | 786 | return ret; |
771 | 787 | ||
772 | memcpy(ctrblk, walk->iv, AES_BLOCK_SIZE); | 788 | if (spin_trylock(&ctrblk_lock)) |
789 | ctrptr = ctrblk; | ||
790 | |||
791 | memcpy(ctrptr, walk->iv, AES_BLOCK_SIZE); | ||
773 | while ((nbytes = walk->nbytes) >= AES_BLOCK_SIZE) { | 792 | while ((nbytes = walk->nbytes) >= AES_BLOCK_SIZE) { |
774 | out = walk->dst.virt.addr; | 793 | out = walk->dst.virt.addr; |
775 | in = walk->src.virt.addr; | 794 | in = walk->src.virt.addr; |
776 | while (nbytes >= AES_BLOCK_SIZE) { | 795 | while (nbytes >= AES_BLOCK_SIZE) { |
777 | /* only use complete blocks, max. PAGE_SIZE */ | 796 | if (ctrptr == ctrblk) |
778 | n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : | 797 | n = __ctrblk_init(ctrptr, nbytes); |
779 | nbytes & ~(AES_BLOCK_SIZE - 1); | 798 | else |
780 | for (i = AES_BLOCK_SIZE; i < n; i += AES_BLOCK_SIZE) { | 799 | n = AES_BLOCK_SIZE; |
781 | memcpy(ctrblk + i, ctrblk + i - AES_BLOCK_SIZE, | 800 | ret = crypt_s390_kmctr(func, sctx->key, out, in, |
782 | AES_BLOCK_SIZE); | 801 | n, ctrptr); |
783 | crypto_inc(ctrblk + i, AES_BLOCK_SIZE); | 802 | if (ret < 0 || ret != n) { |
784 | } | 803 | if (ctrptr == ctrblk) |
785 | ret = crypt_s390_kmctr(func, sctx->key, out, in, n, ctrblk); | 804 | spin_unlock(&ctrblk_lock); |
786 | if (ret < 0 || ret != n) | ||
787 | return -EIO; | 805 | return -EIO; |
806 | } | ||
788 | if (n > AES_BLOCK_SIZE) | 807 | if (n > AES_BLOCK_SIZE) |
789 | memcpy(ctrblk, ctrblk + n - AES_BLOCK_SIZE, | 808 | memcpy(ctrptr, ctrptr + n - AES_BLOCK_SIZE, |
790 | AES_BLOCK_SIZE); | 809 | AES_BLOCK_SIZE); |
791 | crypto_inc(ctrblk, AES_BLOCK_SIZE); | 810 | crypto_inc(ctrptr, AES_BLOCK_SIZE); |
792 | out += n; | 811 | out += n; |
793 | in += n; | 812 | in += n; |
794 | nbytes -= n; | 813 | nbytes -= n; |
795 | } | 814 | } |
796 | ret = blkcipher_walk_done(desc, walk, nbytes); | 815 | ret = blkcipher_walk_done(desc, walk, nbytes); |
797 | } | 816 | } |
817 | if (ctrptr == ctrblk) { | ||
818 | if (nbytes) | ||
819 | memcpy(ctrbuf, ctrptr, AES_BLOCK_SIZE); | ||
820 | else | ||
821 | memcpy(walk->iv, ctrptr, AES_BLOCK_SIZE); | ||
822 | spin_unlock(&ctrblk_lock); | ||
823 | } | ||
798 | /* | 824 | /* |
799 | * final block may be < AES_BLOCK_SIZE, copy only nbytes | 825 | * final block may be < AES_BLOCK_SIZE, copy only nbytes |
800 | */ | 826 | */ |
@@ -802,14 +828,15 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func, | |||
802 | out = walk->dst.virt.addr; | 828 | out = walk->dst.virt.addr; |
803 | in = walk->src.virt.addr; | 829 | in = walk->src.virt.addr; |
804 | ret = crypt_s390_kmctr(func, sctx->key, buf, in, | 830 | ret = crypt_s390_kmctr(func, sctx->key, buf, in, |
805 | AES_BLOCK_SIZE, ctrblk); | 831 | AES_BLOCK_SIZE, ctrbuf); |
806 | if (ret < 0 || ret != AES_BLOCK_SIZE) | 832 | if (ret < 0 || ret != AES_BLOCK_SIZE) |
807 | return -EIO; | 833 | return -EIO; |
808 | memcpy(out, buf, nbytes); | 834 | memcpy(out, buf, nbytes); |
809 | crypto_inc(ctrblk, AES_BLOCK_SIZE); | 835 | crypto_inc(ctrbuf, AES_BLOCK_SIZE); |
810 | ret = blkcipher_walk_done(desc, walk, 0); | 836 | ret = blkcipher_walk_done(desc, walk, 0); |
837 | memcpy(walk->iv, ctrbuf, AES_BLOCK_SIZE); | ||
811 | } | 838 | } |
812 | memcpy(walk->iv, ctrblk, AES_BLOCK_SIZE); | 839 | |
813 | return ret; | 840 | return ret; |
814 | } | 841 | } |
815 | 842 | ||
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c index 200f2a1b599d..0a5aac8a9412 100644 --- a/arch/s390/crypto/des_s390.c +++ b/arch/s390/crypto/des_s390.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #define DES3_KEY_SIZE (3 * DES_KEY_SIZE) | 25 | #define DES3_KEY_SIZE (3 * DES_KEY_SIZE) |
26 | 26 | ||
27 | static u8 *ctrblk; | 27 | static u8 *ctrblk; |
28 | static DEFINE_SPINLOCK(ctrblk_lock); | ||
28 | 29 | ||
29 | struct s390_des_ctx { | 30 | struct s390_des_ctx { |
30 | u8 iv[DES_BLOCK_SIZE]; | 31 | u8 iv[DES_BLOCK_SIZE]; |
@@ -105,29 +106,35 @@ static int ecb_desall_crypt(struct blkcipher_desc *desc, long func, | |||
105 | } | 106 | } |
106 | 107 | ||
107 | static int cbc_desall_crypt(struct blkcipher_desc *desc, long func, | 108 | static int cbc_desall_crypt(struct blkcipher_desc *desc, long func, |
108 | u8 *iv, struct blkcipher_walk *walk) | 109 | struct blkcipher_walk *walk) |
109 | { | 110 | { |
111 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
110 | int ret = blkcipher_walk_virt(desc, walk); | 112 | int ret = blkcipher_walk_virt(desc, walk); |
111 | unsigned int nbytes = walk->nbytes; | 113 | unsigned int nbytes = walk->nbytes; |
114 | struct { | ||
115 | u8 iv[DES_BLOCK_SIZE]; | ||
116 | u8 key[DES3_KEY_SIZE]; | ||
117 | } param; | ||
112 | 118 | ||
113 | if (!nbytes) | 119 | if (!nbytes) |
114 | goto out; | 120 | goto out; |
115 | 121 | ||
116 | memcpy(iv, walk->iv, DES_BLOCK_SIZE); | 122 | memcpy(param.iv, walk->iv, DES_BLOCK_SIZE); |
123 | memcpy(param.key, ctx->key, DES3_KEY_SIZE); | ||
117 | do { | 124 | do { |
118 | /* only use complete blocks */ | 125 | /* only use complete blocks */ |
119 | unsigned int n = nbytes & ~(DES_BLOCK_SIZE - 1); | 126 | unsigned int n = nbytes & ~(DES_BLOCK_SIZE - 1); |
120 | u8 *out = walk->dst.virt.addr; | 127 | u8 *out = walk->dst.virt.addr; |
121 | u8 *in = walk->src.virt.addr; | 128 | u8 *in = walk->src.virt.addr; |
122 | 129 | ||
123 | ret = crypt_s390_kmc(func, iv, out, in, n); | 130 | ret = crypt_s390_kmc(func, ¶m, out, in, n); |
124 | if (ret < 0 || ret != n) | 131 | if (ret < 0 || ret != n) |
125 | return -EIO; | 132 | return -EIO; |
126 | 133 | ||
127 | nbytes &= DES_BLOCK_SIZE - 1; | 134 | nbytes &= DES_BLOCK_SIZE - 1; |
128 | ret = blkcipher_walk_done(desc, walk, nbytes); | 135 | ret = blkcipher_walk_done(desc, walk, nbytes); |
129 | } while ((nbytes = walk->nbytes)); | 136 | } while ((nbytes = walk->nbytes)); |
130 | memcpy(walk->iv, iv, DES_BLOCK_SIZE); | 137 | memcpy(walk->iv, param.iv, DES_BLOCK_SIZE); |
131 | 138 | ||
132 | out: | 139 | out: |
133 | return ret; | 140 | return ret; |
@@ -179,22 +186,20 @@ static int cbc_des_encrypt(struct blkcipher_desc *desc, | |||
179 | struct scatterlist *dst, struct scatterlist *src, | 186 | struct scatterlist *dst, struct scatterlist *src, |
180 | unsigned int nbytes) | 187 | unsigned int nbytes) |
181 | { | 188 | { |
182 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
183 | struct blkcipher_walk walk; | 189 | struct blkcipher_walk walk; |
184 | 190 | ||
185 | blkcipher_walk_init(&walk, dst, src, nbytes); | 191 | blkcipher_walk_init(&walk, dst, src, nbytes); |
186 | return cbc_desall_crypt(desc, KMC_DEA_ENCRYPT, ctx->iv, &walk); | 192 | return cbc_desall_crypt(desc, KMC_DEA_ENCRYPT, &walk); |
187 | } | 193 | } |
188 | 194 | ||
189 | static int cbc_des_decrypt(struct blkcipher_desc *desc, | 195 | static int cbc_des_decrypt(struct blkcipher_desc *desc, |
190 | struct scatterlist *dst, struct scatterlist *src, | 196 | struct scatterlist *dst, struct scatterlist *src, |
191 | unsigned int nbytes) | 197 | unsigned int nbytes) |
192 | { | 198 | { |
193 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
194 | struct blkcipher_walk walk; | 199 | struct blkcipher_walk walk; |
195 | 200 | ||
196 | blkcipher_walk_init(&walk, dst, src, nbytes); | 201 | blkcipher_walk_init(&walk, dst, src, nbytes); |
197 | return cbc_desall_crypt(desc, KMC_DEA_DECRYPT, ctx->iv, &walk); | 202 | return cbc_desall_crypt(desc, KMC_DEA_DECRYPT, &walk); |
198 | } | 203 | } |
199 | 204 | ||
200 | static struct crypto_alg cbc_des_alg = { | 205 | static struct crypto_alg cbc_des_alg = { |
@@ -327,22 +332,20 @@ static int cbc_des3_encrypt(struct blkcipher_desc *desc, | |||
327 | struct scatterlist *dst, struct scatterlist *src, | 332 | struct scatterlist *dst, struct scatterlist *src, |
328 | unsigned int nbytes) | 333 | unsigned int nbytes) |
329 | { | 334 | { |
330 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
331 | struct blkcipher_walk walk; | 335 | struct blkcipher_walk walk; |
332 | 336 | ||
333 | blkcipher_walk_init(&walk, dst, src, nbytes); | 337 | blkcipher_walk_init(&walk, dst, src, nbytes); |
334 | return cbc_desall_crypt(desc, KMC_TDEA_192_ENCRYPT, ctx->iv, &walk); | 338 | return cbc_desall_crypt(desc, KMC_TDEA_192_ENCRYPT, &walk); |
335 | } | 339 | } |
336 | 340 | ||
337 | static int cbc_des3_decrypt(struct blkcipher_desc *desc, | 341 | static int cbc_des3_decrypt(struct blkcipher_desc *desc, |
338 | struct scatterlist *dst, struct scatterlist *src, | 342 | struct scatterlist *dst, struct scatterlist *src, |
339 | unsigned int nbytes) | 343 | unsigned int nbytes) |
340 | { | 344 | { |
341 | struct s390_des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); | ||
342 | struct blkcipher_walk walk; | 345 | struct blkcipher_walk walk; |
343 | 346 | ||
344 | blkcipher_walk_init(&walk, dst, src, nbytes); | 347 | blkcipher_walk_init(&walk, dst, src, nbytes); |
345 | return cbc_desall_crypt(desc, KMC_TDEA_192_DECRYPT, ctx->iv, &walk); | 348 | return cbc_desall_crypt(desc, KMC_TDEA_192_DECRYPT, &walk); |
346 | } | 349 | } |
347 | 350 | ||
348 | static struct crypto_alg cbc_des3_alg = { | 351 | static struct crypto_alg cbc_des3_alg = { |
@@ -366,54 +369,80 @@ static struct crypto_alg cbc_des3_alg = { | |||
366 | } | 369 | } |
367 | }; | 370 | }; |
368 | 371 | ||
372 | static unsigned int __ctrblk_init(u8 *ctrptr, unsigned int nbytes) | ||
373 | { | ||
374 | unsigned int i, n; | ||
375 | |||
376 | /* align to block size, max. PAGE_SIZE */ | ||
377 | n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(DES_BLOCK_SIZE - 1); | ||
378 | for (i = DES_BLOCK_SIZE; i < n; i += DES_BLOCK_SIZE) { | ||
379 | memcpy(ctrptr + i, ctrptr + i - DES_BLOCK_SIZE, DES_BLOCK_SIZE); | ||
380 | crypto_inc(ctrptr + i, DES_BLOCK_SIZE); | ||
381 | } | ||
382 | return n; | ||
383 | } | ||
384 | |||
369 | static int ctr_desall_crypt(struct blkcipher_desc *desc, long func, | 385 | static int ctr_desall_crypt(struct blkcipher_desc *desc, long func, |
370 | struct s390_des_ctx *ctx, struct blkcipher_walk *walk) | 386 | struct s390_des_ctx *ctx, |
387 | struct blkcipher_walk *walk) | ||
371 | { | 388 | { |
372 | int ret = blkcipher_walk_virt_block(desc, walk, DES_BLOCK_SIZE); | 389 | int ret = blkcipher_walk_virt_block(desc, walk, DES_BLOCK_SIZE); |
373 | unsigned int i, n, nbytes; | 390 | unsigned int n, nbytes; |
374 | u8 buf[DES_BLOCK_SIZE]; | 391 | u8 buf[DES_BLOCK_SIZE], ctrbuf[DES_BLOCK_SIZE]; |
375 | u8 *out, *in; | 392 | u8 *out, *in, *ctrptr = ctrbuf; |
393 | |||
394 | if (!walk->nbytes) | ||
395 | return ret; | ||
376 | 396 | ||
377 | memcpy(ctrblk, walk->iv, DES_BLOCK_SIZE); | 397 | if (spin_trylock(&ctrblk_lock)) |
398 | ctrptr = ctrblk; | ||
399 | |||
400 | memcpy(ctrptr, walk->iv, DES_BLOCK_SIZE); | ||
378 | while ((nbytes = walk->nbytes) >= DES_BLOCK_SIZE) { | 401 | while ((nbytes = walk->nbytes) >= DES_BLOCK_SIZE) { |
379 | out = walk->dst.virt.addr; | 402 | out = walk->dst.virt.addr; |
380 | in = walk->src.virt.addr; | 403 | in = walk->src.virt.addr; |
381 | while (nbytes >= DES_BLOCK_SIZE) { | 404 | while (nbytes >= DES_BLOCK_SIZE) { |
382 | /* align to block size, max. PAGE_SIZE */ | 405 | if (ctrptr == ctrblk) |
383 | n = (nbytes > PAGE_SIZE) ? PAGE_SIZE : | 406 | n = __ctrblk_init(ctrptr, nbytes); |
384 | nbytes & ~(DES_BLOCK_SIZE - 1); | 407 | else |
385 | for (i = DES_BLOCK_SIZE; i < n; i += DES_BLOCK_SIZE) { | 408 | n = DES_BLOCK_SIZE; |
386 | memcpy(ctrblk + i, ctrblk + i - DES_BLOCK_SIZE, | 409 | ret = crypt_s390_kmctr(func, ctx->key, out, in, |
387 | DES_BLOCK_SIZE); | 410 | n, ctrptr); |
388 | crypto_inc(ctrblk + i, DES_BLOCK_SIZE); | 411 | if (ret < 0 || ret != n) { |
389 | } | 412 | if (ctrptr == ctrblk) |
390 | ret = crypt_s390_kmctr(func, ctx->key, out, in, n, ctrblk); | 413 | spin_unlock(&ctrblk_lock); |
391 | if (ret < 0 || ret != n) | ||
392 | return -EIO; | 414 | return -EIO; |
415 | } | ||
393 | if (n > DES_BLOCK_SIZE) | 416 | if (n > DES_BLOCK_SIZE) |
394 | memcpy(ctrblk, ctrblk + n - DES_BLOCK_SIZE, | 417 | memcpy(ctrptr, ctrptr + n - DES_BLOCK_SIZE, |
395 | DES_BLOCK_SIZE); | 418 | DES_BLOCK_SIZE); |
396 | crypto_inc(ctrblk, DES_BLOCK_SIZE); | 419 | crypto_inc(ctrptr, DES_BLOCK_SIZE); |
397 | out += n; | 420 | out += n; |
398 | in += n; | 421 | in += n; |
399 | nbytes -= n; | 422 | nbytes -= n; |
400 | } | 423 | } |
401 | ret = blkcipher_walk_done(desc, walk, nbytes); | 424 | ret = blkcipher_walk_done(desc, walk, nbytes); |
402 | } | 425 | } |
403 | 426 | if (ctrptr == ctrblk) { | |
427 | if (nbytes) | ||
428 | memcpy(ctrbuf, ctrptr, DES_BLOCK_SIZE); | ||
429 | else | ||
430 | memcpy(walk->iv, ctrptr, DES_BLOCK_SIZE); | ||
431 | spin_unlock(&ctrblk_lock); | ||
432 | } | ||
404 | /* final block may be < DES_BLOCK_SIZE, copy only nbytes */ | 433 | /* final block may be < DES_BLOCK_SIZE, copy only nbytes */ |
405 | if (nbytes) { | 434 | if (nbytes) { |
406 | out = walk->dst.virt.addr; | 435 | out = walk->dst.virt.addr; |
407 | in = walk->src.virt.addr; | 436 | in = walk->src.virt.addr; |
408 | ret = crypt_s390_kmctr(func, ctx->key, buf, in, | 437 | ret = crypt_s390_kmctr(func, ctx->key, buf, in, |
409 | DES_BLOCK_SIZE, ctrblk); | 438 | DES_BLOCK_SIZE, ctrbuf); |
410 | if (ret < 0 || ret != DES_BLOCK_SIZE) | 439 | if (ret < 0 || ret != DES_BLOCK_SIZE) |
411 | return -EIO; | 440 | return -EIO; |
412 | memcpy(out, buf, nbytes); | 441 | memcpy(out, buf, nbytes); |
413 | crypto_inc(ctrblk, DES_BLOCK_SIZE); | 442 | crypto_inc(ctrbuf, DES_BLOCK_SIZE); |
414 | ret = blkcipher_walk_done(desc, walk, 0); | 443 | ret = blkcipher_walk_done(desc, walk, 0); |
444 | memcpy(walk->iv, ctrbuf, DES_BLOCK_SIZE); | ||
415 | } | 445 | } |
416 | memcpy(walk->iv, ctrblk, DES_BLOCK_SIZE); | ||
417 | return ret; | 446 | return ret; |
418 | } | 447 | } |
419 | 448 | ||
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S index b9e25ae2579c..d7c00507568a 100644 --- a/arch/s390/kernel/head64.S +++ b/arch/s390/kernel/head64.S | |||
@@ -59,7 +59,7 @@ ENTRY(startup_continue) | |||
59 | .quad 0 # cr12: tracing off | 59 | .quad 0 # cr12: tracing off |
60 | .quad 0 # cr13: home space segment table | 60 | .quad 0 # cr13: home space segment table |
61 | .quad 0xc0000000 # cr14: machine check handling off | 61 | .quad 0xc0000000 # cr14: machine check handling off |
62 | .quad 0 # cr15: linkage stack operations | 62 | .quad .Llinkage_stack # cr15: linkage stack operations |
63 | .Lpcmsk:.quad 0x0000000180000000 | 63 | .Lpcmsk:.quad 0x0000000180000000 |
64 | .L4malign:.quad 0xffffffffffc00000 | 64 | .L4malign:.quad 0xffffffffffc00000 |
65 | .Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 | 65 | .Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 |
@@ -67,12 +67,15 @@ ENTRY(startup_continue) | |||
67 | .Lparmaddr: | 67 | .Lparmaddr: |
68 | .quad PARMAREA | 68 | .quad PARMAREA |
69 | .align 64 | 69 | .align 64 |
70 | .Lduct: .long 0,0,0,0,.Lduald,0,0,0 | 70 | .Lduct: .long 0,.Laste,.Laste,0,.Lduald,0,0,0 |
71 | .long 0,0,0,0,0,0,0,0 | 71 | .long 0,0,0,0,0,0,0,0 |
72 | .Laste: .quad 0,0xffffffffffffffff,0,0,0,0,0,0 | ||
72 | .align 128 | 73 | .align 128 |
73 | .Lduald:.rept 8 | 74 | .Lduald:.rept 8 |
74 | .long 0x80000000,0,0,0 # invalid access-list entries | 75 | .long 0x80000000,0,0,0 # invalid access-list entries |
75 | .endr | 76 | .endr |
77 | .Llinkage_stack: | ||
78 | .long 0,0,0x89000000,0,0,0,0x8a000000,0 | ||
76 | 79 | ||
77 | ENTRY(_ehead) | 80 | ENTRY(_ehead) |
78 | 81 | ||
diff --git a/arch/s390/mm/page-states.c b/arch/s390/mm/page-states.c index a90d45e9dfb0..27c50f4d90cb 100644 --- a/arch/s390/mm/page-states.c +++ b/arch/s390/mm/page-states.c | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/gfp.h> | 13 | #include <linux/gfp.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <asm/setup.h> | ||
16 | #include <asm/ipl.h> | ||
15 | 17 | ||
16 | #define ESSA_SET_STABLE 1 | 18 | #define ESSA_SET_STABLE 1 |
17 | #define ESSA_SET_UNUSED 2 | 19 | #define ESSA_SET_UNUSED 2 |
@@ -41,6 +43,14 @@ void __init cmma_init(void) | |||
41 | 43 | ||
42 | if (!cmma_flag) | 44 | if (!cmma_flag) |
43 | return; | 45 | return; |
46 | /* | ||
47 | * Disable CMM for dump, otherwise the tprot based memory | ||
48 | * detection can fail because of unstable pages. | ||
49 | */ | ||
50 | if (OLDMEM_BASE || ipl_info.type == IPL_TYPE_FCP_DUMP) { | ||
51 | cmma_flag = 0; | ||
52 | return; | ||
53 | } | ||
44 | asm volatile( | 54 | asm volatile( |
45 | " .insn rrf,0xb9ab0000,%1,%1,0,0\n" | 55 | " .insn rrf,0xb9ab0000,%1,%1,0,0\n" |
46 | "0: la %0,0\n" | 56 | "0: la %0,0\n" |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 940e50ebfafa..0af5250d914f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -444,6 +444,7 @@ config X86_INTEL_MID | |||
444 | bool "Intel MID platform support" | 444 | bool "Intel MID platform support" |
445 | depends on X86_32 | 445 | depends on X86_32 |
446 | depends on X86_EXTENDED_PLATFORM | 446 | depends on X86_EXTENDED_PLATFORM |
447 | depends on X86_PLATFORM_DEVICES | ||
447 | depends on PCI | 448 | depends on PCI |
448 | depends on PCI_GOANY | 449 | depends on PCI_GOANY |
449 | depends on X86_IO_APIC | 450 | depends on X86_IO_APIC |
@@ -1051,9 +1052,9 @@ config MICROCODE_INTEL | |||
1051 | This options enables microcode patch loading support for Intel | 1052 | This options enables microcode patch loading support for Intel |
1052 | processors. | 1053 | processors. |
1053 | 1054 | ||
1054 | For latest news and information on obtaining all the required | 1055 | For the current Intel microcode data package go to |
1055 | Intel ingredients for this driver, check: | 1056 | <https://downloadcenter.intel.com> and search for |
1056 | <http://www.urbanmyth.org/microcode/>. | 1057 | 'Linux Processor Microcode Data File'. |
1057 | 1058 | ||
1058 | config MICROCODE_AMD | 1059 | config MICROCODE_AMD |
1059 | bool "AMD microcode loading support" | 1060 | bool "AMD microcode loading support" |
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 0f3621ed1db6..321a52ccf63a 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
@@ -184,6 +184,7 @@ config HAVE_MMIOTRACE_SUPPORT | |||
184 | config X86_DECODER_SELFTEST | 184 | config X86_DECODER_SELFTEST |
185 | bool "x86 instruction decoder selftest" | 185 | bool "x86 instruction decoder selftest" |
186 | depends on DEBUG_KERNEL && KPROBES | 186 | depends on DEBUG_KERNEL && KPROBES |
187 | depends on !COMPILE_TEST | ||
187 | ---help--- | 188 | ---help--- |
188 | Perform x86 instruction decoder selftests at build time. | 189 | Perform x86 instruction decoder selftests at build time. |
189 | This option is useful for checking the sanity of x86 instruction | 190 | This option is useful for checking the sanity of x86 instruction |
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h index a54ee1d054d9..aaac3b2fb746 100644 --- a/arch/x86/include/asm/amd_nb.h +++ b/arch/x86/include/asm/amd_nb.h | |||
@@ -19,7 +19,7 @@ extern int amd_cache_northbridges(void); | |||
19 | extern void amd_flush_garts(void); | 19 | extern void amd_flush_garts(void); |
20 | extern int amd_numa_init(void); | 20 | extern int amd_numa_init(void); |
21 | extern int amd_get_subcaches(int); | 21 | extern int amd_get_subcaches(int); |
22 | extern int amd_set_subcaches(int, int); | 22 | extern int amd_set_subcaches(int, unsigned long); |
23 | 23 | ||
24 | struct amd_l3_cache { | 24 | struct amd_l3_cache { |
25 | unsigned indices; | 25 | unsigned indices; |
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 3b978c472d08..3d6b9f81cc68 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -132,6 +132,8 @@ extern void __init efi_map_region_fixed(efi_memory_desc_t *md); | |||
132 | extern void efi_sync_low_kernel_mappings(void); | 132 | extern void efi_sync_low_kernel_mappings(void); |
133 | extern void efi_setup_page_tables(void); | 133 | extern void efi_setup_page_tables(void); |
134 | extern void __init old_map_region(efi_memory_desc_t *md); | 134 | extern void __init old_map_region(efi_memory_desc_t *md); |
135 | extern void __init runtime_code_page_mkexec(void); | ||
136 | extern void __init efi_runtime_mkexec(void); | ||
135 | 137 | ||
136 | struct efi_setup_data { | 138 | struct efi_setup_data { |
137 | u64 fw_vendor; | 139 | u64 fw_vendor; |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index bbc8b12fa443..5ad38ad07890 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -445,10 +445,20 @@ static inline int pte_same(pte_t a, pte_t b) | |||
445 | return a.pte == b.pte; | 445 | return a.pte == b.pte; |
446 | } | 446 | } |
447 | 447 | ||
448 | static inline int pteval_present(pteval_t pteval) | ||
449 | { | ||
450 | /* | ||
451 | * Yes Linus, _PAGE_PROTNONE == _PAGE_NUMA. Expressing it this | ||
452 | * way clearly states that the intent is that protnone and numa | ||
453 | * hinting ptes are considered present for the purposes of | ||
454 | * pagetable operations like zapping, protection changes, gup etc. | ||
455 | */ | ||
456 | return pteval & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_NUMA); | ||
457 | } | ||
458 | |||
448 | static inline int pte_present(pte_t a) | 459 | static inline int pte_present(pte_t a) |
449 | { | 460 | { |
450 | return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE | | 461 | return pteval_present(pte_flags(a)); |
451 | _PAGE_NUMA); | ||
452 | } | 462 | } |
453 | 463 | ||
454 | #define pte_accessible pte_accessible | 464 | #define pte_accessible pte_accessible |
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index e6d90babc245..04905bfc508b 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -62,7 +62,7 @@ static inline void __flush_tlb_all(void) | |||
62 | 62 | ||
63 | static inline void __flush_tlb_one(unsigned long addr) | 63 | static inline void __flush_tlb_one(unsigned long addr) |
64 | { | 64 | { |
65 | count_vm_event(NR_TLB_LOCAL_FLUSH_ONE); | 65 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ONE); |
66 | __flush_tlb_single(addr); | 66 | __flush_tlb_single(addr); |
67 | } | 67 | } |
68 | 68 | ||
@@ -93,13 +93,13 @@ static inline void __flush_tlb_one(unsigned long addr) | |||
93 | */ | 93 | */ |
94 | static inline void __flush_tlb_up(void) | 94 | static inline void __flush_tlb_up(void) |
95 | { | 95 | { |
96 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 96 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
97 | __flush_tlb(); | 97 | __flush_tlb(); |
98 | } | 98 | } |
99 | 99 | ||
100 | static inline void flush_tlb_all(void) | 100 | static inline void flush_tlb_all(void) |
101 | { | 101 | { |
102 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 102 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
103 | __flush_tlb_all(); | 103 | __flush_tlb_all(); |
104 | } | 104 | } |
105 | 105 | ||
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index 787e1bb5aafc..3e276eb23d1b 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h | |||
@@ -52,8 +52,7 @@ extern unsigned long set_phys_range_identity(unsigned long pfn_s, | |||
52 | extern int m2p_add_override(unsigned long mfn, struct page *page, | 52 | extern int m2p_add_override(unsigned long mfn, struct page *page, |
53 | struct gnttab_map_grant_ref *kmap_op); | 53 | struct gnttab_map_grant_ref *kmap_op); |
54 | extern int m2p_remove_override(struct page *page, | 54 | extern int m2p_remove_override(struct page *page, |
55 | struct gnttab_map_grant_ref *kmap_op, | 55 | struct gnttab_map_grant_ref *kmap_op); |
56 | unsigned long mfn); | ||
57 | extern struct page *m2p_find_override(unsigned long mfn); | 56 | extern struct page *m2p_find_override(unsigned long mfn); |
58 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); | 57 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); |
59 | 58 | ||
@@ -122,7 +121,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn) | |||
122 | pfn = m2p_find_override_pfn(mfn, ~0); | 121 | pfn = m2p_find_override_pfn(mfn, ~0); |
123 | } | 122 | } |
124 | 123 | ||
125 | /* | 124 | /* |
126 | * pfn is ~0 if there are no entries in the m2p for mfn or if the | 125 | * pfn is ~0 if there are no entries in the m2p for mfn or if the |
127 | * entry doesn't map back to the mfn and m2p_override doesn't have a | 126 | * entry doesn't map back to the mfn and m2p_override doesn't have a |
128 | * valid entry for it. | 127 | * valid entry for it. |
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index 59554dca96ec..dec8de4e1663 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c | |||
@@ -179,7 +179,7 @@ int amd_get_subcaches(int cpu) | |||
179 | return (mask >> (4 * cuid)) & 0xf; | 179 | return (mask >> (4 * cuid)) & 0xf; |
180 | } | 180 | } |
181 | 181 | ||
182 | int amd_set_subcaches(int cpu, int mask) | 182 | int amd_set_subcaches(int cpu, unsigned long mask) |
183 | { | 183 | { |
184 | static unsigned int reset, ban; | 184 | static unsigned int reset, ban; |
185 | struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu)); | 185 | struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu)); |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index d3153e281d72..c67ffa686064 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -767,10 +767,7 @@ static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size) | |||
767 | 767 | ||
768 | static void cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c) | 768 | static void cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c) |
769 | { | 769 | { |
770 | tlb_flushall_shift = 5; | 770 | tlb_flushall_shift = 6; |
771 | |||
772 | if (c->x86 <= 0x11) | ||
773 | tlb_flushall_shift = 4; | ||
774 | } | 771 | } |
775 | 772 | ||
776 | static void cpu_detect_tlb_amd(struct cpuinfo_x86 *c) | 773 | static void cpu_detect_tlb_amd(struct cpuinfo_x86 *c) |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 24b6fd10625a..8e28bf2fc3ef 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -284,8 +284,13 @@ static __always_inline void setup_smap(struct cpuinfo_x86 *c) | |||
284 | raw_local_save_flags(eflags); | 284 | raw_local_save_flags(eflags); |
285 | BUG_ON(eflags & X86_EFLAGS_AC); | 285 | BUG_ON(eflags & X86_EFLAGS_AC); |
286 | 286 | ||
287 | if (cpu_has(c, X86_FEATURE_SMAP)) | 287 | if (cpu_has(c, X86_FEATURE_SMAP)) { |
288 | #ifdef CONFIG_X86_SMAP | ||
288 | set_in_cr4(X86_CR4_SMAP); | 289 | set_in_cr4(X86_CR4_SMAP); |
290 | #else | ||
291 | clear_in_cr4(X86_CR4_SMAP); | ||
292 | #endif | ||
293 | } | ||
289 | } | 294 | } |
290 | 295 | ||
291 | /* | 296 | /* |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 3db61c644e44..5cd9bfabd645 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -640,21 +640,17 @@ static void intel_tlb_flushall_shift_set(struct cpuinfo_x86 *c) | |||
640 | case 0x61d: /* six-core 45 nm xeon "Dunnington" */ | 640 | case 0x61d: /* six-core 45 nm xeon "Dunnington" */ |
641 | tlb_flushall_shift = -1; | 641 | tlb_flushall_shift = -1; |
642 | break; | 642 | break; |
643 | case 0x63a: /* Ivybridge */ | ||
644 | tlb_flushall_shift = 2; | ||
645 | break; | ||
643 | case 0x61a: /* 45 nm nehalem, "Bloomfield" */ | 646 | case 0x61a: /* 45 nm nehalem, "Bloomfield" */ |
644 | case 0x61e: /* 45 nm nehalem, "Lynnfield" */ | 647 | case 0x61e: /* 45 nm nehalem, "Lynnfield" */ |
645 | case 0x625: /* 32 nm nehalem, "Clarkdale" */ | 648 | case 0x625: /* 32 nm nehalem, "Clarkdale" */ |
646 | case 0x62c: /* 32 nm nehalem, "Gulftown" */ | 649 | case 0x62c: /* 32 nm nehalem, "Gulftown" */ |
647 | case 0x62e: /* 45 nm nehalem-ex, "Beckton" */ | 650 | case 0x62e: /* 45 nm nehalem-ex, "Beckton" */ |
648 | case 0x62f: /* 32 nm Xeon E7 */ | 651 | case 0x62f: /* 32 nm Xeon E7 */ |
649 | tlb_flushall_shift = 6; | ||
650 | break; | ||
651 | case 0x62a: /* SandyBridge */ | 652 | case 0x62a: /* SandyBridge */ |
652 | case 0x62d: /* SandyBridge, "Romely-EP" */ | 653 | case 0x62d: /* SandyBridge, "Romely-EP" */ |
653 | tlb_flushall_shift = 5; | ||
654 | break; | ||
655 | case 0x63a: /* Ivybridge */ | ||
656 | tlb_flushall_shift = 1; | ||
657 | break; | ||
658 | default: | 654 | default: |
659 | tlb_flushall_shift = 6; | 655 | tlb_flushall_shift = 6; |
660 | } | 656 | } |
diff --git a/arch/x86/kernel/cpu/microcode/amd_early.c b/arch/x86/kernel/cpu/microcode/amd_early.c index 8384c0fa206f..617a9e284245 100644 --- a/arch/x86/kernel/cpu/microcode/amd_early.c +++ b/arch/x86/kernel/cpu/microcode/amd_early.c | |||
@@ -285,6 +285,15 @@ static void __init collect_cpu_sig_on_bsp(void *arg) | |||
285 | 285 | ||
286 | uci->cpu_sig.sig = cpuid_eax(0x00000001); | 286 | uci->cpu_sig.sig = cpuid_eax(0x00000001); |
287 | } | 287 | } |
288 | |||
289 | static void __init get_bsp_sig(void) | ||
290 | { | ||
291 | unsigned int bsp = boot_cpu_data.cpu_index; | ||
292 | struct ucode_cpu_info *uci = ucode_cpu_info + bsp; | ||
293 | |||
294 | if (!uci->cpu_sig.sig) | ||
295 | smp_call_function_single(bsp, collect_cpu_sig_on_bsp, NULL, 1); | ||
296 | } | ||
288 | #else | 297 | #else |
289 | void load_ucode_amd_ap(void) | 298 | void load_ucode_amd_ap(void) |
290 | { | 299 | { |
@@ -337,31 +346,37 @@ void load_ucode_amd_ap(void) | |||
337 | 346 | ||
338 | int __init save_microcode_in_initrd_amd(void) | 347 | int __init save_microcode_in_initrd_amd(void) |
339 | { | 348 | { |
349 | unsigned long cont; | ||
340 | enum ucode_state ret; | 350 | enum ucode_state ret; |
341 | u32 eax; | 351 | u32 eax; |
342 | 352 | ||
343 | #ifdef CONFIG_X86_32 | 353 | if (!container) |
344 | unsigned int bsp = boot_cpu_data.cpu_index; | 354 | return -EINVAL; |
345 | struct ucode_cpu_info *uci = ucode_cpu_info + bsp; | ||
346 | |||
347 | if (!uci->cpu_sig.sig) | ||
348 | smp_call_function_single(bsp, collect_cpu_sig_on_bsp, NULL, 1); | ||
349 | 355 | ||
356 | #ifdef CONFIG_X86_32 | ||
357 | get_bsp_sig(); | ||
358 | cont = (unsigned long)container; | ||
359 | #else | ||
350 | /* | 360 | /* |
351 | * Take into account the fact that the ramdisk might get relocated | 361 | * We need the physical address of the container for both bitness since |
352 | * and therefore we need to recompute the container's position in | 362 | * boot_params.hdr.ramdisk_image is a physical address. |
353 | * virtual memory space. | ||
354 | */ | 363 | */ |
355 | container = (u8 *)(__va((u32)relocated_ramdisk) + | 364 | cont = __pa(container); |
356 | ((u32)container - boot_params.hdr.ramdisk_image)); | ||
357 | #endif | 365 | #endif |
366 | |||
367 | /* | ||
368 | * Take into account the fact that the ramdisk might get relocated and | ||
369 | * therefore we need to recompute the container's position in virtual | ||
370 | * memory space. | ||
371 | */ | ||
372 | if (relocated_ramdisk) | ||
373 | container = (u8 *)(__va(relocated_ramdisk) + | ||
374 | (cont - boot_params.hdr.ramdisk_image)); | ||
375 | |||
358 | if (ucode_new_rev) | 376 | if (ucode_new_rev) |
359 | pr_info("microcode: updated early to new patch_level=0x%08x\n", | 377 | pr_info("microcode: updated early to new patch_level=0x%08x\n", |
360 | ucode_new_rev); | 378 | ucode_new_rev); |
361 | 379 | ||
362 | if (!container) | ||
363 | return -EINVAL; | ||
364 | |||
365 | eax = cpuid_eax(0x00000001); | 380 | eax = cpuid_eax(0x00000001); |
366 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); | 381 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); |
367 | 382 | ||
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index ce2d0a2c3e4f..0e25a1bc5ab5 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -683,7 +683,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock) | |||
683 | } | 683 | } |
684 | 684 | ||
685 | /* Flush all TLBs via a mov %cr3, %reg; mov %reg, %cr3 */ | 685 | /* Flush all TLBs via a mov %cr3, %reg; mov %reg, %cr3 */ |
686 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 686 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
687 | __flush_tlb(); | 687 | __flush_tlb(); |
688 | 688 | ||
689 | /* Save MTRR state */ | 689 | /* Save MTRR state */ |
@@ -697,7 +697,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock) | |||
697 | static void post_set(void) __releases(set_atomicity_lock) | 697 | static void post_set(void) __releases(set_atomicity_lock) |
698 | { | 698 | { |
699 | /* Flush TLBs (no need to flush caches - they are disabled) */ | 699 | /* Flush TLBs (no need to flush caches - they are disabled) */ |
700 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 700 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
701 | __flush_tlb(); | 701 | __flush_tlb(); |
702 | 702 | ||
703 | /* Intel (P6) standard MTRRs */ | 703 | /* Intel (P6) standard MTRRs */ |
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index d4bdd253fea7..e6253195a301 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -77,8 +77,7 @@ within(unsigned long addr, unsigned long start, unsigned long end) | |||
77 | return addr >= start && addr < end; | 77 | return addr >= start && addr < end; |
78 | } | 78 | } |
79 | 79 | ||
80 | static int | 80 | static unsigned long text_ip_addr(unsigned long ip) |
81 | do_ftrace_mod_code(unsigned long ip, const void *new_code) | ||
82 | { | 81 | { |
83 | /* | 82 | /* |
84 | * On x86_64, kernel text mappings are mapped read-only with | 83 | * On x86_64, kernel text mappings are mapped read-only with |
@@ -91,7 +90,7 @@ do_ftrace_mod_code(unsigned long ip, const void *new_code) | |||
91 | if (within(ip, (unsigned long)_text, (unsigned long)_etext)) | 90 | if (within(ip, (unsigned long)_text, (unsigned long)_etext)) |
92 | ip = (unsigned long)__va(__pa_symbol(ip)); | 91 | ip = (unsigned long)__va(__pa_symbol(ip)); |
93 | 92 | ||
94 | return probe_kernel_write((void *)ip, new_code, MCOUNT_INSN_SIZE); | 93 | return ip; |
95 | } | 94 | } |
96 | 95 | ||
97 | static const unsigned char *ftrace_nop_replace(void) | 96 | static const unsigned char *ftrace_nop_replace(void) |
@@ -123,8 +122,10 @@ ftrace_modify_code_direct(unsigned long ip, unsigned const char *old_code, | |||
123 | if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0) | 122 | if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0) |
124 | return -EINVAL; | 123 | return -EINVAL; |
125 | 124 | ||
125 | ip = text_ip_addr(ip); | ||
126 | |||
126 | /* replace the text with the new text */ | 127 | /* replace the text with the new text */ |
127 | if (do_ftrace_mod_code(ip, new_code)) | 128 | if (probe_kernel_write((void *)ip, new_code, MCOUNT_INSN_SIZE)) |
128 | return -EPERM; | 129 | return -EPERM; |
129 | 130 | ||
130 | sync_core(); | 131 | sync_core(); |
@@ -221,37 +222,51 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, | |||
221 | return -EINVAL; | 222 | return -EINVAL; |
222 | } | 223 | } |
223 | 224 | ||
224 | int ftrace_update_ftrace_func(ftrace_func_t func) | 225 | static unsigned long ftrace_update_func; |
226 | |||
227 | static int update_ftrace_func(unsigned long ip, void *new) | ||
225 | { | 228 | { |
226 | unsigned long ip = (unsigned long)(&ftrace_call); | 229 | unsigned char old[MCOUNT_INSN_SIZE]; |
227 | unsigned char old[MCOUNT_INSN_SIZE], *new; | ||
228 | int ret; | 230 | int ret; |
229 | 231 | ||
230 | memcpy(old, &ftrace_call, MCOUNT_INSN_SIZE); | 232 | memcpy(old, (void *)ip, MCOUNT_INSN_SIZE); |
231 | new = ftrace_call_replace(ip, (unsigned long)func); | 233 | |
234 | ftrace_update_func = ip; | ||
235 | /* Make sure the breakpoints see the ftrace_update_func update */ | ||
236 | smp_wmb(); | ||
232 | 237 | ||
233 | /* See comment above by declaration of modifying_ftrace_code */ | 238 | /* See comment above by declaration of modifying_ftrace_code */ |
234 | atomic_inc(&modifying_ftrace_code); | 239 | atomic_inc(&modifying_ftrace_code); |
235 | 240 | ||
236 | ret = ftrace_modify_code(ip, old, new); | 241 | ret = ftrace_modify_code(ip, old, new); |
237 | 242 | ||
243 | atomic_dec(&modifying_ftrace_code); | ||
244 | |||
245 | return ret; | ||
246 | } | ||
247 | |||
248 | int ftrace_update_ftrace_func(ftrace_func_t func) | ||
249 | { | ||
250 | unsigned long ip = (unsigned long)(&ftrace_call); | ||
251 | unsigned char *new; | ||
252 | int ret; | ||
253 | |||
254 | new = ftrace_call_replace(ip, (unsigned long)func); | ||
255 | ret = update_ftrace_func(ip, new); | ||
256 | |||
238 | /* Also update the regs callback function */ | 257 | /* Also update the regs callback function */ |
239 | if (!ret) { | 258 | if (!ret) { |
240 | ip = (unsigned long)(&ftrace_regs_call); | 259 | ip = (unsigned long)(&ftrace_regs_call); |
241 | memcpy(old, &ftrace_regs_call, MCOUNT_INSN_SIZE); | ||
242 | new = ftrace_call_replace(ip, (unsigned long)func); | 260 | new = ftrace_call_replace(ip, (unsigned long)func); |
243 | ret = ftrace_modify_code(ip, old, new); | 261 | ret = update_ftrace_func(ip, new); |
244 | } | 262 | } |
245 | 263 | ||
246 | atomic_dec(&modifying_ftrace_code); | ||
247 | |||
248 | return ret; | 264 | return ret; |
249 | } | 265 | } |
250 | 266 | ||
251 | static int is_ftrace_caller(unsigned long ip) | 267 | static int is_ftrace_caller(unsigned long ip) |
252 | { | 268 | { |
253 | if (ip == (unsigned long)(&ftrace_call) || | 269 | if (ip == ftrace_update_func) |
254 | ip == (unsigned long)(&ftrace_regs_call)) | ||
255 | return 1; | 270 | return 1; |
256 | 271 | ||
257 | return 0; | 272 | return 0; |
@@ -677,45 +692,41 @@ int __init ftrace_dyn_arch_init(void *data) | |||
677 | #ifdef CONFIG_DYNAMIC_FTRACE | 692 | #ifdef CONFIG_DYNAMIC_FTRACE |
678 | extern void ftrace_graph_call(void); | 693 | extern void ftrace_graph_call(void); |
679 | 694 | ||
680 | static int ftrace_mod_jmp(unsigned long ip, | 695 | static unsigned char *ftrace_jmp_replace(unsigned long ip, unsigned long addr) |
681 | int old_offset, int new_offset) | ||
682 | { | 696 | { |
683 | unsigned char code[MCOUNT_INSN_SIZE]; | 697 | static union ftrace_code_union calc; |
684 | 698 | ||
685 | if (probe_kernel_read(code, (void *)ip, MCOUNT_INSN_SIZE)) | 699 | /* Jmp not a call (ignore the .e8) */ |
686 | return -EFAULT; | 700 | calc.e8 = 0xe9; |
701 | calc.offset = ftrace_calc_offset(ip + MCOUNT_INSN_SIZE, addr); | ||
687 | 702 | ||
688 | if (code[0] != 0xe9 || old_offset != *(int *)(&code[1])) | 703 | /* |
689 | return -EINVAL; | 704 | * ftrace external locks synchronize the access to the static variable. |
705 | */ | ||
706 | return calc.code; | ||
707 | } | ||
690 | 708 | ||
691 | *(int *)(&code[1]) = new_offset; | 709 | static int ftrace_mod_jmp(unsigned long ip, void *func) |
710 | { | ||
711 | unsigned char *new; | ||
692 | 712 | ||
693 | if (do_ftrace_mod_code(ip, &code)) | 713 | new = ftrace_jmp_replace(ip, (unsigned long)func); |
694 | return -EPERM; | ||
695 | 714 | ||
696 | return 0; | 715 | return update_ftrace_func(ip, new); |
697 | } | 716 | } |
698 | 717 | ||
699 | int ftrace_enable_ftrace_graph_caller(void) | 718 | int ftrace_enable_ftrace_graph_caller(void) |
700 | { | 719 | { |
701 | unsigned long ip = (unsigned long)(&ftrace_graph_call); | 720 | unsigned long ip = (unsigned long)(&ftrace_graph_call); |
702 | int old_offset, new_offset; | ||
703 | 721 | ||
704 | old_offset = (unsigned long)(&ftrace_stub) - (ip + MCOUNT_INSN_SIZE); | 722 | return ftrace_mod_jmp(ip, &ftrace_graph_caller); |
705 | new_offset = (unsigned long)(&ftrace_graph_caller) - (ip + MCOUNT_INSN_SIZE); | ||
706 | |||
707 | return ftrace_mod_jmp(ip, old_offset, new_offset); | ||
708 | } | 723 | } |
709 | 724 | ||
710 | int ftrace_disable_ftrace_graph_caller(void) | 725 | int ftrace_disable_ftrace_graph_caller(void) |
711 | { | 726 | { |
712 | unsigned long ip = (unsigned long)(&ftrace_graph_call); | 727 | unsigned long ip = (unsigned long)(&ftrace_graph_call); |
713 | int old_offset, new_offset; | ||
714 | |||
715 | old_offset = (unsigned long)(&ftrace_graph_caller) - (ip + MCOUNT_INSN_SIZE); | ||
716 | new_offset = (unsigned long)(&ftrace_stub) - (ip + MCOUNT_INSN_SIZE); | ||
717 | 728 | ||
718 | return ftrace_mod_jmp(ip, old_offset, new_offset); | 729 | return ftrace_mod_jmp(ip, &ftrace_stub); |
719 | } | 730 | } |
720 | 731 | ||
721 | #endif /* !CONFIG_DYNAMIC_FTRACE */ | 732 | #endif /* !CONFIG_DYNAMIC_FTRACE */ |
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index dbb60878b744..d99f31d9a750 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c | |||
@@ -266,6 +266,14 @@ __visible void smp_trace_x86_platform_ipi(struct pt_regs *regs) | |||
266 | EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq); | 266 | EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq); |
267 | 267 | ||
268 | #ifdef CONFIG_HOTPLUG_CPU | 268 | #ifdef CONFIG_HOTPLUG_CPU |
269 | |||
270 | /* These two declarations are only used in check_irq_vectors_for_cpu_disable() | ||
271 | * below, which is protected by stop_machine(). Putting them on the stack | ||
272 | * results in a stack frame overflow. Dynamically allocating could result in a | ||
273 | * failure so declare these two cpumasks as global. | ||
274 | */ | ||
275 | static struct cpumask affinity_new, online_new; | ||
276 | |||
269 | /* | 277 | /* |
270 | * This cpu is going to be removed and its vectors migrated to the remaining | 278 | * This cpu is going to be removed and its vectors migrated to the remaining |
271 | * online cpus. Check to see if there are enough vectors in the remaining cpus. | 279 | * online cpus. Check to see if there are enough vectors in the remaining cpus. |
@@ -277,7 +285,6 @@ int check_irq_vectors_for_cpu_disable(void) | |||
277 | unsigned int this_cpu, vector, this_count, count; | 285 | unsigned int this_cpu, vector, this_count, count; |
278 | struct irq_desc *desc; | 286 | struct irq_desc *desc; |
279 | struct irq_data *data; | 287 | struct irq_data *data; |
280 | struct cpumask affinity_new, online_new; | ||
281 | 288 | ||
282 | this_cpu = smp_processor_id(); | 289 | this_cpu = smp_processor_id(); |
283 | cpumask_copy(&online_new, cpu_online_mask); | 290 | cpumask_copy(&online_new, cpu_online_mask); |
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index 04ee1e2e4c02..7c6acd4b8995 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
@@ -571,3 +571,40 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5, | |||
571 | quirk_amd_nb_node); | 571 | quirk_amd_nb_node); |
572 | 572 | ||
573 | #endif | 573 | #endif |
574 | |||
575 | #ifdef CONFIG_PCI | ||
576 | /* | ||
577 | * Processor does not ensure DRAM scrub read/write sequence | ||
578 | * is atomic wrt accesses to CC6 save state area. Therefore | ||
579 | * if a concurrent scrub read/write access is to same address | ||
580 | * the entry may appear as if it is not written. This quirk | ||
581 | * applies to Fam16h models 00h-0Fh | ||
582 | * | ||
583 | * See "Revision Guide" for AMD F16h models 00h-0fh, | ||
584 | * document 51810 rev. 3.04, Nov 2013 | ||
585 | */ | ||
586 | static void amd_disable_seq_and_redirect_scrub(struct pci_dev *dev) | ||
587 | { | ||
588 | u32 val; | ||
589 | |||
590 | /* | ||
591 | * Suggested workaround: | ||
592 | * set D18F3x58[4:0] = 00h and set D18F3x5C[0] = 0b | ||
593 | */ | ||
594 | pci_read_config_dword(dev, 0x58, &val); | ||
595 | if (val & 0x1F) { | ||
596 | val &= ~(0x1F); | ||
597 | pci_write_config_dword(dev, 0x58, val); | ||
598 | } | ||
599 | |||
600 | pci_read_config_dword(dev, 0x5C, &val); | ||
601 | if (val & BIT(0)) { | ||
602 | val &= ~BIT(0); | ||
603 | pci_write_config_dword(dev, 0x5c, val); | ||
604 | } | ||
605 | } | ||
606 | |||
607 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3, | ||
608 | amd_disable_seq_and_redirect_scrub); | ||
609 | |||
610 | #endif | ||
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 19e5adb49a27..acb3b606613e 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -209,7 +209,7 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc) | |||
209 | * dance when its actually needed. | 209 | * dance when its actually needed. |
210 | */ | 210 | */ |
211 | 211 | ||
212 | preempt_disable(); | 212 | preempt_disable_notrace(); |
213 | data = this_cpu_read(cyc2ns.head); | 213 | data = this_cpu_read(cyc2ns.head); |
214 | tail = this_cpu_read(cyc2ns.tail); | 214 | tail = this_cpu_read(cyc2ns.tail); |
215 | 215 | ||
@@ -229,7 +229,7 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc) | |||
229 | if (!--data->__count) | 229 | if (!--data->__count) |
230 | this_cpu_write(cyc2ns.tail, data); | 230 | this_cpu_write(cyc2ns.tail, data); |
231 | } | 231 | } |
232 | preempt_enable(); | 232 | preempt_enable_notrace(); |
233 | 233 | ||
234 | return ns; | 234 | return ns; |
235 | } | 235 | } |
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 9d591c895803..6dea040cc3a1 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -1001,6 +1001,12 @@ static int fault_in_kernel_space(unsigned long address) | |||
1001 | 1001 | ||
1002 | static inline bool smap_violation(int error_code, struct pt_regs *regs) | 1002 | static inline bool smap_violation(int error_code, struct pt_regs *regs) |
1003 | { | 1003 | { |
1004 | if (!IS_ENABLED(CONFIG_X86_SMAP)) | ||
1005 | return false; | ||
1006 | |||
1007 | if (!static_cpu_has(X86_FEATURE_SMAP)) | ||
1008 | return false; | ||
1009 | |||
1004 | if (error_code & PF_USER) | 1010 | if (error_code & PF_USER) |
1005 | return false; | 1011 | return false; |
1006 | 1012 | ||
@@ -1087,11 +1093,9 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
1087 | if (unlikely(error_code & PF_RSVD)) | 1093 | if (unlikely(error_code & PF_RSVD)) |
1088 | pgtable_bad(regs, error_code, address); | 1094 | pgtable_bad(regs, error_code, address); |
1089 | 1095 | ||
1090 | if (static_cpu_has(X86_FEATURE_SMAP)) { | 1096 | if (unlikely(smap_violation(error_code, regs))) { |
1091 | if (unlikely(smap_violation(error_code, regs))) { | 1097 | bad_area_nosemaphore(regs, error_code, address); |
1092 | bad_area_nosemaphore(regs, error_code, address); | 1098 | return; |
1093 | return; | ||
1094 | } | ||
1095 | } | 1099 | } |
1096 | 1100 | ||
1097 | /* | 1101 | /* |
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 81b2750f3666..27aa0455fab3 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c | |||
@@ -493,14 +493,6 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) | |||
493 | struct numa_memblk *mb = &mi->blk[i]; | 493 | struct numa_memblk *mb = &mi->blk[i]; |
494 | memblock_set_node(mb->start, mb->end - mb->start, | 494 | memblock_set_node(mb->start, mb->end - mb->start, |
495 | &memblock.memory, mb->nid); | 495 | &memblock.memory, mb->nid); |
496 | |||
497 | /* | ||
498 | * At this time, all memory regions reserved by memblock are | ||
499 | * used by the kernel. Set the nid in memblock.reserved will | ||
500 | * mark out all the nodes the kernel resides in. | ||
501 | */ | ||
502 | memblock_set_node(mb->start, mb->end - mb->start, | ||
503 | &memblock.reserved, mb->nid); | ||
504 | } | 496 | } |
505 | 497 | ||
506 | /* | 498 | /* |
@@ -565,10 +557,21 @@ static void __init numa_init_array(void) | |||
565 | static void __init numa_clear_kernel_node_hotplug(void) | 557 | static void __init numa_clear_kernel_node_hotplug(void) |
566 | { | 558 | { |
567 | int i, nid; | 559 | int i, nid; |
568 | nodemask_t numa_kernel_nodes; | 560 | nodemask_t numa_kernel_nodes = NODE_MASK_NONE; |
569 | unsigned long start, end; | 561 | unsigned long start, end; |
570 | struct memblock_type *type = &memblock.reserved; | 562 | struct memblock_type *type = &memblock.reserved; |
571 | 563 | ||
564 | /* | ||
565 | * At this time, all memory regions reserved by memblock are | ||
566 | * used by the kernel. Set the nid in memblock.reserved will | ||
567 | * mark out all the nodes the kernel resides in. | ||
568 | */ | ||
569 | for (i = 0; i < numa_meminfo.nr_blks; i++) { | ||
570 | struct numa_memblk *mb = &numa_meminfo.blk[i]; | ||
571 | memblock_set_node(mb->start, mb->end - mb->start, | ||
572 | &memblock.reserved, mb->nid); | ||
573 | } | ||
574 | |||
572 | /* Mark all kernel nodes. */ | 575 | /* Mark all kernel nodes. */ |
573 | for (i = 0; i < type->cnt; i++) | 576 | for (i = 0; i < type->cnt; i++) |
574 | node_set(type->regions[i].nid, numa_kernel_nodes); | 577 | node_set(type->regions[i].nid, numa_kernel_nodes); |
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c index 0342d27ca798..47b6436e41c2 100644 --- a/arch/x86/mm/numa_32.c +++ b/arch/x86/mm/numa_32.c | |||
@@ -52,6 +52,8 @@ void memory_present(int nid, unsigned long start, unsigned long end) | |||
52 | nid, start, end); | 52 | nid, start, end); |
53 | printk(KERN_DEBUG " Setting physnode_map array to node %d for pfns:\n", nid); | 53 | printk(KERN_DEBUG " Setting physnode_map array to node %d for pfns:\n", nid); |
54 | printk(KERN_DEBUG " "); | 54 | printk(KERN_DEBUG " "); |
55 | start = round_down(start, PAGES_PER_SECTION); | ||
56 | end = round_up(end, PAGES_PER_SECTION); | ||
55 | for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) { | 57 | for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) { |
56 | physnode_map[pfn / PAGES_PER_SECTION] = nid; | 58 | physnode_map[pfn / PAGES_PER_SECTION] = nid; |
57 | printk(KERN_CONT "%lx ", pfn); | 59 | printk(KERN_CONT "%lx ", pfn); |
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 1a25187e151e..1953e9c9391a 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c | |||
@@ -42,15 +42,25 @@ static __init inline int srat_disabled(void) | |||
42 | return acpi_numa < 0; | 42 | return acpi_numa < 0; |
43 | } | 43 | } |
44 | 44 | ||
45 | /* Callback for SLIT parsing */ | 45 | /* |
46 | * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for | ||
47 | * I/O localities since SRAT does not list them. I/O localities are | ||
48 | * not supported at this point. | ||
49 | */ | ||
46 | void __init acpi_numa_slit_init(struct acpi_table_slit *slit) | 50 | void __init acpi_numa_slit_init(struct acpi_table_slit *slit) |
47 | { | 51 | { |
48 | int i, j; | 52 | int i, j; |
49 | 53 | ||
50 | for (i = 0; i < slit->locality_count; i++) | 54 | for (i = 0; i < slit->locality_count; i++) { |
51 | for (j = 0; j < slit->locality_count; j++) | 55 | if (pxm_to_node(i) == NUMA_NO_NODE) |
56 | continue; | ||
57 | for (j = 0; j < slit->locality_count; j++) { | ||
58 | if (pxm_to_node(j) == NUMA_NO_NODE) | ||
59 | continue; | ||
52 | numa_set_distance(pxm_to_node(i), pxm_to_node(j), | 60 | numa_set_distance(pxm_to_node(i), pxm_to_node(j), |
53 | slit->entry[slit->locality_count * i + j]); | 61 | slit->entry[slit->locality_count * i + j]); |
62 | } | ||
63 | } | ||
54 | } | 64 | } |
55 | 65 | ||
56 | /* Callback for Proximity Domain -> x2APIC mapping */ | 66 | /* Callback for Proximity Domain -> x2APIC mapping */ |
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index ae699b3bbac8..dd8dda167a24 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c | |||
@@ -103,7 +103,7 @@ static void flush_tlb_func(void *info) | |||
103 | if (f->flush_mm != this_cpu_read(cpu_tlbstate.active_mm)) | 103 | if (f->flush_mm != this_cpu_read(cpu_tlbstate.active_mm)) |
104 | return; | 104 | return; |
105 | 105 | ||
106 | count_vm_event(NR_TLB_REMOTE_FLUSH_RECEIVED); | 106 | count_vm_tlb_event(NR_TLB_REMOTE_FLUSH_RECEIVED); |
107 | if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK) { | 107 | if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK) { |
108 | if (f->flush_end == TLB_FLUSH_ALL) | 108 | if (f->flush_end == TLB_FLUSH_ALL) |
109 | local_flush_tlb(); | 109 | local_flush_tlb(); |
@@ -131,7 +131,7 @@ void native_flush_tlb_others(const struct cpumask *cpumask, | |||
131 | info.flush_start = start; | 131 | info.flush_start = start; |
132 | info.flush_end = end; | 132 | info.flush_end = end; |
133 | 133 | ||
134 | count_vm_event(NR_TLB_REMOTE_FLUSH); | 134 | count_vm_tlb_event(NR_TLB_REMOTE_FLUSH); |
135 | if (is_uv_system()) { | 135 | if (is_uv_system()) { |
136 | unsigned int cpu; | 136 | unsigned int cpu; |
137 | 137 | ||
@@ -151,44 +151,19 @@ void flush_tlb_current_task(void) | |||
151 | 151 | ||
152 | preempt_disable(); | 152 | preempt_disable(); |
153 | 153 | ||
154 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 154 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
155 | local_flush_tlb(); | 155 | local_flush_tlb(); |
156 | if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids) | 156 | if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids) |
157 | flush_tlb_others(mm_cpumask(mm), mm, 0UL, TLB_FLUSH_ALL); | 157 | flush_tlb_others(mm_cpumask(mm), mm, 0UL, TLB_FLUSH_ALL); |
158 | preempt_enable(); | 158 | preempt_enable(); |
159 | } | 159 | } |
160 | 160 | ||
161 | /* | ||
162 | * It can find out the THP large page, or | ||
163 | * HUGETLB page in tlb_flush when THP disabled | ||
164 | */ | ||
165 | static inline unsigned long has_large_page(struct mm_struct *mm, | ||
166 | unsigned long start, unsigned long end) | ||
167 | { | ||
168 | pgd_t *pgd; | ||
169 | pud_t *pud; | ||
170 | pmd_t *pmd; | ||
171 | unsigned long addr = ALIGN(start, HPAGE_SIZE); | ||
172 | for (; addr < end; addr += HPAGE_SIZE) { | ||
173 | pgd = pgd_offset(mm, addr); | ||
174 | if (likely(!pgd_none(*pgd))) { | ||
175 | pud = pud_offset(pgd, addr); | ||
176 | if (likely(!pud_none(*pud))) { | ||
177 | pmd = pmd_offset(pud, addr); | ||
178 | if (likely(!pmd_none(*pmd))) | ||
179 | if (pmd_large(*pmd)) | ||
180 | return addr; | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, | 161 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, |
188 | unsigned long end, unsigned long vmflag) | 162 | unsigned long end, unsigned long vmflag) |
189 | { | 163 | { |
190 | unsigned long addr; | 164 | unsigned long addr; |
191 | unsigned act_entries, tlb_entries = 0; | 165 | unsigned act_entries, tlb_entries = 0; |
166 | unsigned long nr_base_pages; | ||
192 | 167 | ||
193 | preempt_disable(); | 168 | preempt_disable(); |
194 | if (current->active_mm != mm) | 169 | if (current->active_mm != mm) |
@@ -210,21 +185,20 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, | |||
210 | tlb_entries = tlb_lli_4k[ENTRIES]; | 185 | tlb_entries = tlb_lli_4k[ENTRIES]; |
211 | else | 186 | else |
212 | tlb_entries = tlb_lld_4k[ENTRIES]; | 187 | tlb_entries = tlb_lld_4k[ENTRIES]; |
188 | |||
213 | /* Assume all of TLB entries was occupied by this task */ | 189 | /* Assume all of TLB entries was occupied by this task */ |
214 | act_entries = mm->total_vm > tlb_entries ? tlb_entries : mm->total_vm; | 190 | act_entries = tlb_entries >> tlb_flushall_shift; |
191 | act_entries = mm->total_vm > act_entries ? act_entries : mm->total_vm; | ||
192 | nr_base_pages = (end - start) >> PAGE_SHIFT; | ||
215 | 193 | ||
216 | /* tlb_flushall_shift is on balance point, details in commit log */ | 194 | /* tlb_flushall_shift is on balance point, details in commit log */ |
217 | if ((end - start) >> PAGE_SHIFT > act_entries >> tlb_flushall_shift) { | 195 | if (nr_base_pages > act_entries) { |
218 | count_vm_event(NR_TLB_LOCAL_FLUSH_ALL); | 196 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL); |
219 | local_flush_tlb(); | 197 | local_flush_tlb(); |
220 | } else { | 198 | } else { |
221 | if (has_large_page(mm, start, end)) { | ||
222 | local_flush_tlb(); | ||
223 | goto flush_all; | ||
224 | } | ||
225 | /* flush range by one by one 'invlpg' */ | 199 | /* flush range by one by one 'invlpg' */ |
226 | for (addr = start; addr < end; addr += PAGE_SIZE) { | 200 | for (addr = start; addr < end; addr += PAGE_SIZE) { |
227 | count_vm_event(NR_TLB_LOCAL_FLUSH_ONE); | 201 | count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ONE); |
228 | __flush_tlb_single(addr); | 202 | __flush_tlb_single(addr); |
229 | } | 203 | } |
230 | 204 | ||
@@ -262,7 +236,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long start) | |||
262 | 236 | ||
263 | static void do_flush_tlb_all(void *info) | 237 | static void do_flush_tlb_all(void *info) |
264 | { | 238 | { |
265 | count_vm_event(NR_TLB_REMOTE_FLUSH_RECEIVED); | 239 | count_vm_tlb_event(NR_TLB_REMOTE_FLUSH_RECEIVED); |
266 | __flush_tlb_all(); | 240 | __flush_tlb_all(); |
267 | if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY) | 241 | if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY) |
268 | leave_mm(smp_processor_id()); | 242 | leave_mm(smp_processor_id()); |
@@ -270,7 +244,7 @@ static void do_flush_tlb_all(void *info) | |||
270 | 244 | ||
271 | void flush_tlb_all(void) | 245 | void flush_tlb_all(void) |
272 | { | 246 | { |
273 | count_vm_event(NR_TLB_REMOTE_FLUSH); | 247 | count_vm_tlb_event(NR_TLB_REMOTE_FLUSH); |
274 | on_each_cpu(do_flush_tlb_all, NULL, 1); | 248 | on_each_cpu(do_flush_tlb_all, NULL, 1); |
275 | } | 249 | } |
276 | 250 | ||
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c index 7145ec63c520..f15103dff4b4 100644 --- a/arch/x86/platform/efi/efi-bgrt.c +++ b/arch/x86/platform/efi/efi-bgrt.c | |||
@@ -42,14 +42,15 @@ void __init efi_bgrt_init(void) | |||
42 | 42 | ||
43 | if (bgrt_tab->header.length < sizeof(*bgrt_tab)) | 43 | if (bgrt_tab->header.length < sizeof(*bgrt_tab)) |
44 | return; | 44 | return; |
45 | if (bgrt_tab->version != 1) | 45 | if (bgrt_tab->version != 1 || bgrt_tab->status != 1) |
46 | return; | 46 | return; |
47 | if (bgrt_tab->image_type != 0 || !bgrt_tab->image_address) | 47 | if (bgrt_tab->image_type != 0 || !bgrt_tab->image_address) |
48 | return; | 48 | return; |
49 | 49 | ||
50 | image = efi_lookup_mapped_addr(bgrt_tab->image_address); | 50 | image = efi_lookup_mapped_addr(bgrt_tab->image_address); |
51 | if (!image) { | 51 | if (!image) { |
52 | image = ioremap(bgrt_tab->image_address, sizeof(bmp_header)); | 52 | image = early_memremap(bgrt_tab->image_address, |
53 | sizeof(bmp_header)); | ||
53 | ioremapped = true; | 54 | ioremapped = true; |
54 | if (!image) | 55 | if (!image) |
55 | return; | 56 | return; |
@@ -57,7 +58,7 @@ void __init efi_bgrt_init(void) | |||
57 | 58 | ||
58 | memcpy_fromio(&bmp_header, image, sizeof(bmp_header)); | 59 | memcpy_fromio(&bmp_header, image, sizeof(bmp_header)); |
59 | if (ioremapped) | 60 | if (ioremapped) |
60 | iounmap(image); | 61 | early_iounmap(image, sizeof(bmp_header)); |
61 | bgrt_image_size = bmp_header.size; | 62 | bgrt_image_size = bmp_header.size; |
62 | 63 | ||
63 | bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL); | 64 | bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL); |
@@ -65,7 +66,8 @@ void __init efi_bgrt_init(void) | |||
65 | return; | 66 | return; |
66 | 67 | ||
67 | if (ioremapped) { | 68 | if (ioremapped) { |
68 | image = ioremap(bgrt_tab->image_address, bmp_header.size); | 69 | image = early_memremap(bgrt_tab->image_address, |
70 | bmp_header.size); | ||
69 | if (!image) { | 71 | if (!image) { |
70 | kfree(bgrt_image); | 72 | kfree(bgrt_image); |
71 | bgrt_image = NULL; | 73 | bgrt_image = NULL; |
@@ -75,5 +77,5 @@ void __init efi_bgrt_init(void) | |||
75 | 77 | ||
76 | memcpy_fromio(bgrt_image, image, bgrt_image_size); | 78 | memcpy_fromio(bgrt_image, image, bgrt_image_size); |
77 | if (ioremapped) | 79 | if (ioremapped) |
78 | iounmap(image); | 80 | early_iounmap(image, bmp_header.size); |
79 | } | 81 | } |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index d62ec87a2b26..1a201ac7cef8 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -792,7 +792,7 @@ void __init efi_set_executable(efi_memory_desc_t *md, bool executable) | |||
792 | set_memory_nx(addr, npages); | 792 | set_memory_nx(addr, npages); |
793 | } | 793 | } |
794 | 794 | ||
795 | static void __init runtime_code_page_mkexec(void) | 795 | void __init runtime_code_page_mkexec(void) |
796 | { | 796 | { |
797 | efi_memory_desc_t *md; | 797 | efi_memory_desc_t *md; |
798 | void *p; | 798 | void *p; |
@@ -1069,8 +1069,7 @@ void __init efi_enter_virtual_mode(void) | |||
1069 | efi.update_capsule = virt_efi_update_capsule; | 1069 | efi.update_capsule = virt_efi_update_capsule; |
1070 | efi.query_capsule_caps = virt_efi_query_capsule_caps; | 1070 | efi.query_capsule_caps = virt_efi_query_capsule_caps; |
1071 | 1071 | ||
1072 | if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX)) | 1072 | efi_runtime_mkexec(); |
1073 | runtime_code_page_mkexec(); | ||
1074 | 1073 | ||
1075 | kfree(new_memmap); | 1074 | kfree(new_memmap); |
1076 | 1075 | ||
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c index 249b183cf417..0b74cdf7f816 100644 --- a/arch/x86/platform/efi/efi_32.c +++ b/arch/x86/platform/efi/efi_32.c | |||
@@ -77,3 +77,9 @@ void efi_call_phys_epilog(void) | |||
77 | 77 | ||
78 | local_irq_restore(efi_rt_eflags); | 78 | local_irq_restore(efi_rt_eflags); |
79 | } | 79 | } |
80 | |||
81 | void __init efi_runtime_mkexec(void) | ||
82 | { | ||
83 | if (__supported_pte_mask & _PAGE_NX) | ||
84 | runtime_code_page_mkexec(); | ||
85 | } | ||
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 6284f158a47d..0c2a234fef1e 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -233,3 +233,12 @@ void __init parse_efi_setup(u64 phys_addr, u32 data_len) | |||
233 | { | 233 | { |
234 | efi_setup = phys_addr + sizeof(struct setup_data); | 234 | efi_setup = phys_addr + sizeof(struct setup_data); |
235 | } | 235 | } |
236 | |||
237 | void __init efi_runtime_mkexec(void) | ||
238 | { | ||
239 | if (!efi_enabled(EFI_OLD_MEMMAP)) | ||
240 | return; | ||
241 | |||
242 | if (__supported_pte_mask & _PAGE_NX) | ||
243 | runtime_code_page_mkexec(); | ||
244 | } | ||
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index a4d7b647867f..201d09a7c46b 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1473,6 +1473,18 @@ static void xen_pvh_set_cr_flags(int cpu) | |||
1473 | * X86_CR0_TS, X86_CR0_PE, X86_CR0_ET are set by Xen for HVM guests | 1473 | * X86_CR0_TS, X86_CR0_PE, X86_CR0_ET are set by Xen for HVM guests |
1474 | * (which PVH shared codepaths), while X86_CR0_PG is for PVH. */ | 1474 | * (which PVH shared codepaths), while X86_CR0_PG is for PVH. */ |
1475 | write_cr0(read_cr0() | X86_CR0_MP | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM); | 1475 | write_cr0(read_cr0() | X86_CR0_MP | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM); |
1476 | |||
1477 | if (!cpu) | ||
1478 | return; | ||
1479 | /* | ||
1480 | * For BSP, PSE PGE are set in probe_page_size_mask(), for APs | ||
1481 | * set them here. For all, OSFXSR OSXMMEXCPT are set in fpu_init. | ||
1482 | */ | ||
1483 | if (cpu_has_pse) | ||
1484 | set_in_cr4(X86_CR4_PSE); | ||
1485 | |||
1486 | if (cpu_has_pge) | ||
1487 | set_in_cr4(X86_CR4_PGE); | ||
1476 | } | 1488 | } |
1477 | 1489 | ||
1478 | /* | 1490 | /* |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 2423ef04ffea..256282e7888b 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -365,7 +365,7 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr, | |||
365 | /* Assume pteval_t is equivalent to all the other *val_t types. */ | 365 | /* Assume pteval_t is equivalent to all the other *val_t types. */ |
366 | static pteval_t pte_mfn_to_pfn(pteval_t val) | 366 | static pteval_t pte_mfn_to_pfn(pteval_t val) |
367 | { | 367 | { |
368 | if (val & _PAGE_PRESENT) { | 368 | if (pteval_present(val)) { |
369 | unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; | 369 | unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; |
370 | unsigned long pfn = mfn_to_pfn(mfn); | 370 | unsigned long pfn = mfn_to_pfn(mfn); |
371 | 371 | ||
@@ -381,7 +381,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val) | |||
381 | 381 | ||
382 | static pteval_t pte_pfn_to_mfn(pteval_t val) | 382 | static pteval_t pte_pfn_to_mfn(pteval_t val) |
383 | { | 383 | { |
384 | if (val & _PAGE_PRESENT) { | 384 | if (pteval_present(val)) { |
385 | unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; | 385 | unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; |
386 | pteval_t flags = val & PTE_FLAGS_MASK; | 386 | pteval_t flags = val & PTE_FLAGS_MASK; |
387 | unsigned long mfn; | 387 | unsigned long mfn; |
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index 8009acbe41e4..696c694986d0 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -899,6 +899,13 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
899 | "m2p_add_override: pfn %lx not mapped", pfn)) | 899 | "m2p_add_override: pfn %lx not mapped", pfn)) |
900 | return -EINVAL; | 900 | return -EINVAL; |
901 | } | 901 | } |
902 | WARN_ON(PagePrivate(page)); | ||
903 | SetPagePrivate(page); | ||
904 | set_page_private(page, mfn); | ||
905 | page->index = pfn_to_mfn(pfn); | ||
906 | |||
907 | if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) | ||
908 | return -ENOMEM; | ||
902 | 909 | ||
903 | if (kmap_op != NULL) { | 910 | if (kmap_op != NULL) { |
904 | if (!PageHighMem(page)) { | 911 | if (!PageHighMem(page)) { |
@@ -937,16 +944,19 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
937 | } | 944 | } |
938 | EXPORT_SYMBOL_GPL(m2p_add_override); | 945 | EXPORT_SYMBOL_GPL(m2p_add_override); |
939 | int m2p_remove_override(struct page *page, | 946 | int m2p_remove_override(struct page *page, |
940 | struct gnttab_map_grant_ref *kmap_op, | 947 | struct gnttab_map_grant_ref *kmap_op) |
941 | unsigned long mfn) | ||
942 | { | 948 | { |
943 | unsigned long flags; | 949 | unsigned long flags; |
950 | unsigned long mfn; | ||
944 | unsigned long pfn; | 951 | unsigned long pfn; |
945 | unsigned long uninitialized_var(address); | 952 | unsigned long uninitialized_var(address); |
946 | unsigned level; | 953 | unsigned level; |
947 | pte_t *ptep = NULL; | 954 | pte_t *ptep = NULL; |
948 | 955 | ||
949 | pfn = page_to_pfn(page); | 956 | pfn = page_to_pfn(page); |
957 | mfn = get_phys_to_machine(pfn); | ||
958 | if (mfn == INVALID_P2M_ENTRY || !(mfn & FOREIGN_FRAME_BIT)) | ||
959 | return -EINVAL; | ||
950 | 960 | ||
951 | if (!PageHighMem(page)) { | 961 | if (!PageHighMem(page)) { |
952 | address = (unsigned long)__va(pfn << PAGE_SHIFT); | 962 | address = (unsigned long)__va(pfn << PAGE_SHIFT); |
@@ -960,7 +970,10 @@ int m2p_remove_override(struct page *page, | |||
960 | spin_lock_irqsave(&m2p_override_lock, flags); | 970 | spin_lock_irqsave(&m2p_override_lock, flags); |
961 | list_del(&page->lru); | 971 | list_del(&page->lru); |
962 | spin_unlock_irqrestore(&m2p_override_lock, flags); | 972 | spin_unlock_irqrestore(&m2p_override_lock, flags); |
973 | WARN_ON(!PagePrivate(page)); | ||
974 | ClearPagePrivate(page); | ||
963 | 975 | ||
976 | set_phys_to_machine(pfn, page->index); | ||
964 | if (kmap_op != NULL) { | 977 | if (kmap_op != NULL) { |
965 | if (!PageHighMem(page)) { | 978 | if (!PageHighMem(page)) { |
966 | struct multicall_space mcs; | 979 | struct multicall_space mcs; |