diff options
Diffstat (limited to 'arch')
367 files changed, 12124 insertions, 1207 deletions
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 03dc4c1a8736..d8f6a2ec3d4e 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -1187,7 +1187,7 @@ config DEBUG_UART_VIRT | |||
1187 | default 0xf1c28000 if DEBUG_SUNXI_UART0 | 1187 | default 0xf1c28000 if DEBUG_SUNXI_UART0 |
1188 | default 0xf1c28400 if DEBUG_SUNXI_UART1 | 1188 | default 0xf1c28400 if DEBUG_SUNXI_UART1 |
1189 | default 0xf1f02800 if DEBUG_SUNXI_R_UART | 1189 | default 0xf1f02800 if DEBUG_SUNXI_R_UART |
1190 | default 0xf2100000 if DEBUG_PXA_UART1 | 1190 | default 0xf6200000 if DEBUG_PXA_UART1 |
1191 | default 0xf4090000 if ARCH_LPC32XX | 1191 | default 0xf4090000 if ARCH_LPC32XX |
1192 | default 0xf4200000 if ARCH_GEMINI | 1192 | default 0xf4200000 if ARCH_GEMINI |
1193 | default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \ | 1193 | default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \ |
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 413fd94b5301..68be9017593d 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
@@ -397,8 +397,7 @@ dtb_check_done: | |||
397 | add sp, sp, r6 | 397 | add sp, sp, r6 |
398 | #endif | 398 | #endif |
399 | 399 | ||
400 | tst r4, #1 | 400 | bl cache_clean_flush |
401 | bleq cache_clean_flush | ||
402 | 401 | ||
403 | adr r0, BSYM(restart) | 402 | adr r0, BSYM(restart) |
404 | add r0, r0, r6 | 403 | add r0, r0, r6 |
@@ -1047,6 +1046,8 @@ cache_clean_flush: | |||
1047 | b call_cache_fn | 1046 | b call_cache_fn |
1048 | 1047 | ||
1049 | __armv4_mpu_cache_flush: | 1048 | __armv4_mpu_cache_flush: |
1049 | tst r4, #1 | ||
1050 | movne pc, lr | ||
1050 | mov r2, #1 | 1051 | mov r2, #1 |
1051 | mov r3, #0 | 1052 | mov r3, #0 |
1052 | mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache | 1053 | mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache |
@@ -1064,6 +1065,8 @@ __armv4_mpu_cache_flush: | |||
1064 | mov pc, lr | 1065 | mov pc, lr |
1065 | 1066 | ||
1066 | __fa526_cache_flush: | 1067 | __fa526_cache_flush: |
1068 | tst r4, #1 | ||
1069 | movne pc, lr | ||
1067 | mov r1, #0 | 1070 | mov r1, #0 |
1068 | mcr p15, 0, r1, c7, c14, 0 @ clean and invalidate D cache | 1071 | mcr p15, 0, r1, c7, c14, 0 @ clean and invalidate D cache |
1069 | mcr p15, 0, r1, c7, c5, 0 @ flush I cache | 1072 | mcr p15, 0, r1, c7, c5, 0 @ flush I cache |
@@ -1072,13 +1075,16 @@ __fa526_cache_flush: | |||
1072 | 1075 | ||
1073 | __armv6_mmu_cache_flush: | 1076 | __armv6_mmu_cache_flush: |
1074 | mov r1, #0 | 1077 | mov r1, #0 |
1075 | mcr p15, 0, r1, c7, c14, 0 @ clean+invalidate D | 1078 | tst r4, #1 |
1079 | mcreq p15, 0, r1, c7, c14, 0 @ clean+invalidate D | ||
1076 | mcr p15, 0, r1, c7, c5, 0 @ invalidate I+BTB | 1080 | mcr p15, 0, r1, c7, c5, 0 @ invalidate I+BTB |
1077 | mcr p15, 0, r1, c7, c15, 0 @ clean+invalidate unified | 1081 | mcreq p15, 0, r1, c7, c15, 0 @ clean+invalidate unified |
1078 | mcr p15, 0, r1, c7, c10, 4 @ drain WB | 1082 | mcr p15, 0, r1, c7, c10, 4 @ drain WB |
1079 | mov pc, lr | 1083 | mov pc, lr |
1080 | 1084 | ||
1081 | __armv7_mmu_cache_flush: | 1085 | __armv7_mmu_cache_flush: |
1086 | tst r4, #1 | ||
1087 | bne iflush | ||
1082 | mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1 | 1088 | mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1 |
1083 | tst r10, #0xf << 16 @ hierarchical cache (ARMv7) | 1089 | tst r10, #0xf << 16 @ hierarchical cache (ARMv7) |
1084 | mov r10, #0 | 1090 | mov r10, #0 |
@@ -1139,6 +1145,8 @@ iflush: | |||
1139 | mov pc, lr | 1145 | mov pc, lr |
1140 | 1146 | ||
1141 | __armv5tej_mmu_cache_flush: | 1147 | __armv5tej_mmu_cache_flush: |
1148 | tst r4, #1 | ||
1149 | movne pc, lr | ||
1142 | 1: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate D cache | 1150 | 1: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate D cache |
1143 | bne 1b | 1151 | bne 1b |
1144 | mcr p15, 0, r0, c7, c5, 0 @ flush I cache | 1152 | mcr p15, 0, r0, c7, c5, 0 @ flush I cache |
@@ -1146,6 +1154,8 @@ __armv5tej_mmu_cache_flush: | |||
1146 | mov pc, lr | 1154 | mov pc, lr |
1147 | 1155 | ||
1148 | __armv4_mmu_cache_flush: | 1156 | __armv4_mmu_cache_flush: |
1157 | tst r4, #1 | ||
1158 | movne pc, lr | ||
1149 | mov r2, #64*1024 @ default: 32K dcache size (*2) | 1159 | mov r2, #64*1024 @ default: 32K dcache size (*2) |
1150 | mov r11, #32 @ default: 32 byte line size | 1160 | mov r11, #32 @ default: 32 byte line size |
1151 | mrc p15, 0, r3, c0, c0, 1 @ read cache type | 1161 | mrc p15, 0, r3, c0, c0, 1 @ read cache type |
@@ -1179,6 +1189,8 @@ no_cache_id: | |||
1179 | 1189 | ||
1180 | __armv3_mmu_cache_flush: | 1190 | __armv3_mmu_cache_flush: |
1181 | __armv3_mpu_cache_flush: | 1191 | __armv3_mpu_cache_flush: |
1192 | tst r4, #1 | ||
1193 | movne pc, lr | ||
1182 | mov r1, #0 | 1194 | mov r1, #0 |
1183 | mcr p15, 0, r1, c7, c0, 0 @ invalidate whole cache v3 | 1195 | mcr p15, 0, r1, c7, c0, 0 @ invalidate whole cache v3 |
1184 | mov pc, lr | 1196 | mov pc, lr |
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index e2156a583de7..c4b968f0feb5 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts | |||
@@ -489,7 +489,7 @@ | |||
489 | reg = <0x00060000 0x00020000>; | 489 | reg = <0x00060000 0x00020000>; |
490 | }; | 490 | }; |
491 | partition@4 { | 491 | partition@4 { |
492 | label = "NAND.u-boot-spl"; | 492 | label = "NAND.u-boot-spl-os"; |
493 | reg = <0x00080000 0x00040000>; | 493 | reg = <0x00080000 0x00040000>; |
494 | }; | 494 | }; |
495 | partition@5 { | 495 | partition@5 { |
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts index e7ac47fa6615..a521ac0a7d5a 100644 --- a/arch/arm/boot/dts/am437x-gp-evm.dts +++ b/arch/arm/boot/dts/am437x-gp-evm.dts | |||
@@ -291,8 +291,8 @@ | |||
291 | dcdc3: regulator-dcdc3 { | 291 | dcdc3: regulator-dcdc3 { |
292 | compatible = "ti,tps65218-dcdc3"; | 292 | compatible = "ti,tps65218-dcdc3"; |
293 | regulator-name = "vdcdc3"; | 293 | regulator-name = "vdcdc3"; |
294 | regulator-min-microvolt = <1350000>; | 294 | regulator-min-microvolt = <1500000>; |
295 | regulator-max-microvolt = <1350000>; | 295 | regulator-max-microvolt = <1500000>; |
296 | regulator-boot-on; | 296 | regulator-boot-on; |
297 | regulator-always-on; | 297 | regulator-always-on; |
298 | }; | 298 | }; |
diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts b/arch/arm/boot/dts/am437x-sk-evm.dts index 859ff3d620ee..87aa4f3b8b3d 100644 --- a/arch/arm/boot/dts/am437x-sk-evm.dts +++ b/arch/arm/boot/dts/am437x-sk-evm.dts | |||
@@ -363,8 +363,8 @@ | |||
363 | dcdc3: regulator-dcdc3 { | 363 | dcdc3: regulator-dcdc3 { |
364 | compatible = "ti,tps65218-dcdc3"; | 364 | compatible = "ti,tps65218-dcdc3"; |
365 | regulator-name = "vdds_ddr"; | 365 | regulator-name = "vdds_ddr"; |
366 | regulator-min-microvolt = <1350000>; | 366 | regulator-min-microvolt = <1500000>; |
367 | regulator-max-microvolt = <1350000>; | 367 | regulator-max-microvolt = <1500000>; |
368 | regulator-boot-on; | 368 | regulator-boot-on; |
369 | regulator-always-on; | 369 | regulator-always-on; |
370 | }; | 370 | }; |
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts index ac3e4859935f..f7e9bba10bd6 100644 --- a/arch/arm/boot/dts/am43x-epos-evm.dts +++ b/arch/arm/boot/dts/am43x-epos-evm.dts | |||
@@ -358,8 +358,8 @@ | |||
358 | dcdc3: regulator-dcdc3 { | 358 | dcdc3: regulator-dcdc3 { |
359 | compatible = "ti,tps65218-dcdc3"; | 359 | compatible = "ti,tps65218-dcdc3"; |
360 | regulator-name = "vdcdc3"; | 360 | regulator-name = "vdcdc3"; |
361 | regulator-min-microvolt = <1350000>; | 361 | regulator-min-microvolt = <1500000>; |
362 | regulator-max-microvolt = <1350000>; | 362 | regulator-max-microvolt = <1500000>; |
363 | regulator-boot-on; | 363 | regulator-boot-on; |
364 | regulator-always-on; | 364 | regulator-always-on; |
365 | }; | 365 | }; |
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts index e51fcef884a4..60429ad1c5d8 100644 --- a/arch/arm/boot/dts/exynos5250-snow.dts +++ b/arch/arm/boot/dts/exynos5250-snow.dts | |||
@@ -624,4 +624,8 @@ | |||
624 | num-cs = <1>; | 624 | num-cs = <1>; |
625 | }; | 625 | }; |
626 | 626 | ||
627 | &usbdrd_dwc3 { | ||
628 | dr_mode = "host"; | ||
629 | }; | ||
630 | |||
627 | #include "cros-ec-keyboard.dtsi" | 631 | #include "cros-ec-keyboard.dtsi" |
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index f21b9aa00fbb..d55c1a2eb798 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi | |||
@@ -555,7 +555,7 @@ | |||
555 | #size-cells = <1>; | 555 | #size-cells = <1>; |
556 | ranges; | 556 | ranges; |
557 | 557 | ||
558 | dwc3 { | 558 | usbdrd_dwc3: dwc3 { |
559 | compatible = "synopsys,dwc3"; | 559 | compatible = "synopsys,dwc3"; |
560 | reg = <0x12000000 0x10000>; | 560 | reg = <0x12000000 0x10000>; |
561 | interrupts = <0 72 0>; | 561 | interrupts = <0 72 0>; |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 739fcf29c643..bc82a12d4c2c 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -668,6 +668,8 @@ | |||
668 | bank-width = <2>; | 668 | bank-width = <2>; |
669 | pinctrl-names = "default"; | 669 | pinctrl-names = "default"; |
670 | pinctrl-0 = <ðernet_pins>; | 670 | pinctrl-0 = <ðernet_pins>; |
671 | power-gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>; /* gpio86 */ | ||
672 | reset-gpios = <&gpio6 4 GPIO_ACTIVE_HIGH>; /* gpio164 */ | ||
671 | gpmc,device-width = <2>; | 673 | gpmc,device-width = <2>; |
672 | gpmc,sync-clk-ps = <0>; | 674 | gpmc,sync-clk-ps = <0>; |
673 | gpmc,cs-on-ns = <0>; | 675 | gpmc,cs-on-ns = <0>; |
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi index d46c213a17ad..eed697a6bd6b 100644 --- a/arch/arm/boot/dts/r8a7740.dtsi +++ b/arch/arm/boot/dts/r8a7740.dtsi | |||
@@ -433,7 +433,7 @@ | |||
433 | clocks = <&cpg_clocks R8A7740_CLK_S>, | 433 | clocks = <&cpg_clocks R8A7740_CLK_S>, |
434 | <&cpg_clocks R8A7740_CLK_S>, <&sub_clk>, | 434 | <&cpg_clocks R8A7740_CLK_S>, <&sub_clk>, |
435 | <&cpg_clocks R8A7740_CLK_B>, | 435 | <&cpg_clocks R8A7740_CLK_B>, |
436 | <&sub_clk>, <&sub_clk>, | 436 | <&cpg_clocks R8A7740_CLK_HPP>, <&sub_clk>, |
437 | <&cpg_clocks R8A7740_CLK_B>; | 437 | <&cpg_clocks R8A7740_CLK_B>; |
438 | #clock-cells = <1>; | 438 | #clock-cells = <1>; |
439 | renesas,clock-indices = < | 439 | renesas,clock-indices = < |
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi index d0e17733dc1a..e20affe156c1 100644 --- a/arch/arm/boot/dts/r8a7790.dtsi +++ b/arch/arm/boot/dts/r8a7790.dtsi | |||
@@ -666,9 +666,9 @@ | |||
666 | #clock-cells = <0>; | 666 | #clock-cells = <0>; |
667 | clock-output-names = "sd2"; | 667 | clock-output-names = "sd2"; |
668 | }; | 668 | }; |
669 | sd3_clk: sd3_clk@e615007c { | 669 | sd3_clk: sd3_clk@e615026c { |
670 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; | 670 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; |
671 | reg = <0 0xe615007c 0 4>; | 671 | reg = <0 0xe615026c 0 4>; |
672 | clocks = <&pll1_div2_clk>; | 672 | clocks = <&pll1_div2_clk>; |
673 | #clock-cells = <0>; | 673 | #clock-cells = <0>; |
674 | clock-output-names = "sd3"; | 674 | clock-output-names = "sd3"; |
diff --git a/arch/arm/boot/dts/sama5d31.dtsi b/arch/arm/boot/dts/sama5d31.dtsi index 7997dc9863ed..883878b32971 100644 --- a/arch/arm/boot/dts/sama5d31.dtsi +++ b/arch/arm/boot/dts/sama5d31.dtsi | |||
@@ -12,5 +12,5 @@ | |||
12 | #include "sama5d3_uart.dtsi" | 12 | #include "sama5d3_uart.dtsi" |
13 | 13 | ||
14 | / { | 14 | / { |
15 | compatible = "atmel,samad31", "atmel,sama5d3", "atmel,sama5"; | 15 | compatible = "atmel,sama5d31", "atmel,sama5d3", "atmel,sama5"; |
16 | }; | 16 | }; |
diff --git a/arch/arm/boot/dts/sama5d33.dtsi b/arch/arm/boot/dts/sama5d33.dtsi index 39f832253caf..4b4434aca351 100644 --- a/arch/arm/boot/dts/sama5d33.dtsi +++ b/arch/arm/boot/dts/sama5d33.dtsi | |||
@@ -10,5 +10,5 @@ | |||
10 | #include "sama5d3_gmac.dtsi" | 10 | #include "sama5d3_gmac.dtsi" |
11 | 11 | ||
12 | / { | 12 | / { |
13 | compatible = "atmel,samad33", "atmel,sama5d3", "atmel,sama5"; | 13 | compatible = "atmel,sama5d33", "atmel,sama5d3", "atmel,sama5"; |
14 | }; | 14 | }; |
diff --git a/arch/arm/boot/dts/sama5d34.dtsi b/arch/arm/boot/dts/sama5d34.dtsi index 89cda2c0da39..aa01573fdee9 100644 --- a/arch/arm/boot/dts/sama5d34.dtsi +++ b/arch/arm/boot/dts/sama5d34.dtsi | |||
@@ -12,5 +12,5 @@ | |||
12 | #include "sama5d3_mci2.dtsi" | 12 | #include "sama5d3_mci2.dtsi" |
13 | 13 | ||
14 | / { | 14 | / { |
15 | compatible = "atmel,samad34", "atmel,sama5d3", "atmel,sama5"; | 15 | compatible = "atmel,sama5d34", "atmel,sama5d3", "atmel,sama5"; |
16 | }; | 16 | }; |
diff --git a/arch/arm/boot/dts/sama5d35.dtsi b/arch/arm/boot/dts/sama5d35.dtsi index d20cd71b5f0e..16c39f4c96a4 100644 --- a/arch/arm/boot/dts/sama5d35.dtsi +++ b/arch/arm/boot/dts/sama5d35.dtsi | |||
@@ -14,5 +14,5 @@ | |||
14 | #include "sama5d3_tcb1.dtsi" | 14 | #include "sama5d3_tcb1.dtsi" |
15 | 15 | ||
16 | / { | 16 | / { |
17 | compatible = "atmel,samad35", "atmel,sama5d3", "atmel,sama5"; | 17 | compatible = "atmel,sama5d35", "atmel,sama5d3", "atmel,sama5"; |
18 | }; | 18 | }; |
diff --git a/arch/arm/boot/dts/sama5d36.dtsi b/arch/arm/boot/dts/sama5d36.dtsi index db58cad6acd3..e85139ef40af 100644 --- a/arch/arm/boot/dts/sama5d36.dtsi +++ b/arch/arm/boot/dts/sama5d36.dtsi | |||
@@ -16,5 +16,5 @@ | |||
16 | #include "sama5d3_uart.dtsi" | 16 | #include "sama5d3_uart.dtsi" |
17 | 17 | ||
18 | / { | 18 | / { |
19 | compatible = "atmel,samad36", "atmel,sama5d3", "atmel,sama5"; | 19 | compatible = "atmel,sama5d36", "atmel,sama5d3", "atmel,sama5"; |
20 | }; | 20 | }; |
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi index 962dc28dc37b..cfcd200b0c17 100644 --- a/arch/arm/boot/dts/sama5d3xcm.dtsi +++ b/arch/arm/boot/dts/sama5d3xcm.dtsi | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | / { | 10 | / { |
11 | compatible = "atmel,samad3xcm", "atmel,sama5d3", "atmel,sama5"; | 11 | compatible = "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; |
12 | 12 | ||
13 | chosen { | 13 | chosen { |
14 | bootargs = "console=ttyS0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs"; | 14 | bootargs = "console=ttyS0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs"; |
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index 543f895d18d3..2e652e2339e9 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi | |||
@@ -361,6 +361,10 @@ | |||
361 | clocks = <&ahb1_gates 6>; | 361 | clocks = <&ahb1_gates 6>; |
362 | resets = <&ahb1_rst 6>; | 362 | resets = <&ahb1_rst 6>; |
363 | #dma-cells = <1>; | 363 | #dma-cells = <1>; |
364 | |||
365 | /* DMA controller requires AHB1 clocked from PLL6 */ | ||
366 | assigned-clocks = <&ahb1_mux>; | ||
367 | assigned-clock-parents = <&pll6>; | ||
364 | }; | 368 | }; |
365 | 369 | ||
366 | mmc0: mmc@01c0f000 { | 370 | mmc0: mmc@01c0f000 { |
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts index 5c21d216515a..8b7aa0dcdc6e 100644 --- a/arch/arm/boot/dts/tegra114-dalmore.dts +++ b/arch/arm/boot/dts/tegra114-dalmore.dts | |||
@@ -15,6 +15,7 @@ | |||
15 | aliases { | 15 | aliases { |
16 | rtc0 = "/i2c@7000d000/tps65913@58"; | 16 | rtc0 = "/i2c@7000d000/tps65913@58"; |
17 | rtc1 = "/rtc@7000e000"; | 17 | rtc1 = "/rtc@7000e000"; |
18 | serial0 = &uartd; | ||
18 | }; | 19 | }; |
19 | 20 | ||
20 | memory { | 21 | memory { |
diff --git a/arch/arm/boot/dts/tegra114-roth.dts b/arch/arm/boot/dts/tegra114-roth.dts index c7c6825f11fb..38acf78d7815 100644 --- a/arch/arm/boot/dts/tegra114-roth.dts +++ b/arch/arm/boot/dts/tegra114-roth.dts | |||
@@ -15,6 +15,10 @@ | |||
15 | linux,initrd-end = <0x82800000>; | 15 | linux,initrd-end = <0x82800000>; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | aliases { | ||
19 | serial0 = &uartd; | ||
20 | }; | ||
21 | |||
18 | firmware { | 22 | firmware { |
19 | trusted-foundations { | 23 | trusted-foundations { |
20 | compatible = "tlm,trusted-foundations"; | 24 | compatible = "tlm,trusted-foundations"; |
@@ -916,8 +920,6 @@ | |||
916 | regulator-name = "vddio-sdmmc3"; | 920 | regulator-name = "vddio-sdmmc3"; |
917 | regulator-min-microvolt = <1800000>; | 921 | regulator-min-microvolt = <1800000>; |
918 | regulator-max-microvolt = <3300000>; | 922 | regulator-max-microvolt = <3300000>; |
919 | regulator-always-on; | ||
920 | regulator-boot-on; | ||
921 | }; | 923 | }; |
922 | 924 | ||
923 | ldousb { | 925 | ldousb { |
@@ -962,7 +964,7 @@ | |||
962 | sdhci@78000400 { | 964 | sdhci@78000400 { |
963 | status = "okay"; | 965 | status = "okay"; |
964 | bus-width = <4>; | 966 | bus-width = <4>; |
965 | vmmc-supply = <&vddio_sdmmc3>; | 967 | vqmmc-supply = <&vddio_sdmmc3>; |
966 | cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>; | 968 | cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>; |
967 | power-gpios = <&gpio TEGRA_GPIO(H, 0) GPIO_ACTIVE_HIGH>; | 969 | power-gpios = <&gpio TEGRA_GPIO(H, 0) GPIO_ACTIVE_HIGH>; |
968 | }; | 970 | }; |
@@ -971,7 +973,6 @@ | |||
971 | sdhci@78000600 { | 973 | sdhci@78000600 { |
972 | status = "okay"; | 974 | status = "okay"; |
973 | bus-width = <8>; | 975 | bus-width = <8>; |
974 | vmmc-supply = <&vdd_1v8>; | ||
975 | non-removable; | 976 | non-removable; |
976 | }; | 977 | }; |
977 | 978 | ||
diff --git a/arch/arm/boot/dts/tegra114-tn7.dts b/arch/arm/boot/dts/tegra114-tn7.dts index 963662145635..f91c2c9b2f94 100644 --- a/arch/arm/boot/dts/tegra114-tn7.dts +++ b/arch/arm/boot/dts/tegra114-tn7.dts | |||
@@ -15,6 +15,10 @@ | |||
15 | linux,initrd-end = <0x82800000>; | 15 | linux,initrd-end = <0x82800000>; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | aliases { | ||
19 | serial0 = &uartd; | ||
20 | }; | ||
21 | |||
18 | firmware { | 22 | firmware { |
19 | trusted-foundations { | 23 | trusted-foundations { |
20 | compatible = "tlm,trusted-foundations"; | 24 | compatible = "tlm,trusted-foundations"; |
@@ -240,7 +244,6 @@ | |||
240 | sdhci@78000600 { | 244 | sdhci@78000600 { |
241 | status = "okay"; | 245 | status = "okay"; |
242 | bus-width = <8>; | 246 | bus-width = <8>; |
243 | vmmc-supply = <&vdd_1v8>; | ||
244 | non-removable; | 247 | non-removable; |
245 | }; | 248 | }; |
246 | 249 | ||
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi index 2ca9c1807f72..222f3b3f4dd5 100644 --- a/arch/arm/boot/dts/tegra114.dtsi +++ b/arch/arm/boot/dts/tegra114.dtsi | |||
@@ -9,13 +9,6 @@ | |||
9 | compatible = "nvidia,tegra114"; | 9 | compatible = "nvidia,tegra114"; |
10 | interrupt-parent = <&gic>; | 10 | interrupt-parent = <&gic>; |
11 | 11 | ||
12 | aliases { | ||
13 | serial0 = &uarta; | ||
14 | serial1 = &uartb; | ||
15 | serial2 = &uartc; | ||
16 | serial3 = &uartd; | ||
17 | }; | ||
18 | |||
19 | host1x@50000000 { | 12 | host1x@50000000 { |
20 | compatible = "nvidia,tegra114-host1x", "simple-bus"; | 13 | compatible = "nvidia,tegra114-host1x", "simple-bus"; |
21 | reg = <0x50000000 0x00028000>; | 14 | reg = <0x50000000 0x00028000>; |
diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts index 029c9a021541..51b373ff1065 100644 --- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts +++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@0,7000d000/pmic@40"; | 11 | rtc0 = "/i2c@0,7000d000/pmic@40"; |
12 | rtc1 = "/rtc@0,7000e000"; | 12 | rtc1 = "/rtc@0,7000e000"; |
13 | serial0 = &uartd; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra124-nyan-big.dts b/arch/arm/boot/dts/tegra124-nyan-big.dts index 7d0784ce4c74..53181d310247 100644 --- a/arch/arm/boot/dts/tegra124-nyan-big.dts +++ b/arch/arm/boot/dts/tegra124-nyan-big.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@0,7000d000/pmic@40"; | 11 | rtc0 = "/i2c@0,7000d000/pmic@40"; |
12 | rtc1 = "/rtc@0,7000e000"; | 12 | rtc1 = "/rtc@0,7000e000"; |
13 | serial0 = &uarta; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra124-venice2.dts b/arch/arm/boot/dts/tegra124-venice2.dts index 13008858e967..5c3f7813360d 100644 --- a/arch/arm/boot/dts/tegra124-venice2.dts +++ b/arch/arm/boot/dts/tegra124-venice2.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@0,7000d000/pmic@40"; | 11 | rtc0 = "/i2c@0,7000d000/pmic@40"; |
12 | rtc1 = "/rtc@0,7000e000"; | 12 | rtc1 = "/rtc@0,7000e000"; |
13 | serial0 = &uarta; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi index 478c555ebd96..df2b06b29985 100644 --- a/arch/arm/boot/dts/tegra124.dtsi +++ b/arch/arm/boot/dts/tegra124.dtsi | |||
@@ -286,7 +286,7 @@ | |||
286 | * the APB DMA based serial driver, the comptible is | 286 | * the APB DMA based serial driver, the comptible is |
287 | * "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart". | 287 | * "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart". |
288 | */ | 288 | */ |
289 | serial@0,70006000 { | 289 | uarta: serial@0,70006000 { |
290 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; | 290 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; |
291 | reg = <0x0 0x70006000 0x0 0x40>; | 291 | reg = <0x0 0x70006000 0x0 0x40>; |
292 | reg-shift = <2>; | 292 | reg-shift = <2>; |
@@ -299,7 +299,7 @@ | |||
299 | status = "disabled"; | 299 | status = "disabled"; |
300 | }; | 300 | }; |
301 | 301 | ||
302 | serial@0,70006040 { | 302 | uartb: serial@0,70006040 { |
303 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; | 303 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; |
304 | reg = <0x0 0x70006040 0x0 0x40>; | 304 | reg = <0x0 0x70006040 0x0 0x40>; |
305 | reg-shift = <2>; | 305 | reg-shift = <2>; |
@@ -312,7 +312,7 @@ | |||
312 | status = "disabled"; | 312 | status = "disabled"; |
313 | }; | 313 | }; |
314 | 314 | ||
315 | serial@0,70006200 { | 315 | uartc: serial@0,70006200 { |
316 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; | 316 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; |
317 | reg = <0x0 0x70006200 0x0 0x40>; | 317 | reg = <0x0 0x70006200 0x0 0x40>; |
318 | reg-shift = <2>; | 318 | reg-shift = <2>; |
@@ -325,7 +325,7 @@ | |||
325 | status = "disabled"; | 325 | status = "disabled"; |
326 | }; | 326 | }; |
327 | 327 | ||
328 | serial@0,70006300 { | 328 | uartd: serial@0,70006300 { |
329 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; | 329 | compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; |
330 | reg = <0x0 0x70006300 0x0 0x40>; | 330 | reg = <0x0 0x70006300 0x0 0x40>; |
331 | reg-shift = <2>; | 331 | reg-shift = <2>; |
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts index a37279af687c..b926a07b9443 100644 --- a/arch/arm/boot/dts/tegra20-harmony.dts +++ b/arch/arm/boot/dts/tegra20-harmony.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 11 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uartd; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-iris-512.dts b/arch/arm/boot/dts/tegra20-iris-512.dts index 8cfb83f42e1f..1dd7d7bfdfcc 100644 --- a/arch/arm/boot/dts/tegra20-iris-512.dts +++ b/arch/arm/boot/dts/tegra20-iris-512.dts | |||
@@ -6,6 +6,11 @@ | |||
6 | model = "Toradex Colibri T20 512MB on Iris"; | 6 | model = "Toradex Colibri T20 512MB on Iris"; |
7 | compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20"; | 7 | compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20"; |
8 | 8 | ||
9 | aliases { | ||
10 | serial0 = &uarta; | ||
11 | serial1 = &uartd; | ||
12 | }; | ||
13 | |||
9 | host1x@50000000 { | 14 | host1x@50000000 { |
10 | hdmi@54280000 { | 15 | hdmi@54280000 { |
11 | status = "okay"; | 16 | status = "okay"; |
diff --git a/arch/arm/boot/dts/tegra20-medcom-wide.dts b/arch/arm/boot/dts/tegra20-medcom-wide.dts index 1b7c56b33aca..9b87526ab0b7 100644 --- a/arch/arm/boot/dts/tegra20-medcom-wide.dts +++ b/arch/arm/boot/dts/tegra20-medcom-wide.dts | |||
@@ -6,6 +6,10 @@ | |||
6 | model = "Avionic Design Medcom-Wide board"; | 6 | model = "Avionic Design Medcom-Wide board"; |
7 | compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20"; | 7 | compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20"; |
8 | 8 | ||
9 | aliases { | ||
10 | serial0 = &uartd; | ||
11 | }; | ||
12 | |||
9 | pwm@7000a000 { | 13 | pwm@7000a000 { |
10 | status = "okay"; | 14 | status = "okay"; |
11 | }; | 15 | }; |
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts index d4438e30de45..ed7e1009326c 100644 --- a/arch/arm/boot/dts/tegra20-paz00.dts +++ b/arch/arm/boot/dts/tegra20-paz00.dts | |||
@@ -10,6 +10,8 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 11 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uarta; | ||
14 | serial1 = &uartc; | ||
13 | }; | 15 | }; |
14 | 16 | ||
15 | memory { | 17 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts index a1d4bf9895d7..ea282c7c0ca5 100644 --- a/arch/arm/boot/dts/tegra20-seaboard.dts +++ b/arch/arm/boot/dts/tegra20-seaboard.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 11 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uartd; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi index 80e7d386ce34..13d4e6185275 100644 --- a/arch/arm/boot/dts/tegra20-tamonten.dtsi +++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi | |||
@@ -7,6 +7,7 @@ | |||
7 | aliases { | 7 | aliases { |
8 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 8 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
9 | rtc1 = "/rtc@7000e000"; | 9 | rtc1 = "/rtc@7000e000"; |
10 | serial0 = &uartd; | ||
10 | }; | 11 | }; |
11 | 12 | ||
12 | memory { | 13 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts index 5ad87979ab13..d99af4ef9c64 100644 --- a/arch/arm/boot/dts/tegra20-trimslice.dts +++ b/arch/arm/boot/dts/tegra20-trimslice.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000c500/rtc@56"; | 11 | rtc0 = "/i2c@7000c500/rtc@56"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uarta; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts index ca8484cccddc..04c58e9ca490 100644 --- a/arch/arm/boot/dts/tegra20-ventana.dts +++ b/arch/arm/boot/dts/tegra20-ventana.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/tps6586x@34"; | 11 | rtc0 = "/i2c@7000d000/tps6586x@34"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uartd; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts index 1843725785c9..340d81108df1 100644 --- a/arch/arm/boot/dts/tegra20-whistler.dts +++ b/arch/arm/boot/dts/tegra20-whistler.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | aliases { | 10 | aliases { |
11 | rtc0 = "/i2c@7000d000/max8907@3c"; | 11 | rtc0 = "/i2c@7000d000/max8907@3c"; |
12 | rtc1 = "/rtc@7000e000"; | 12 | rtc1 = "/rtc@7000e000"; |
13 | serial0 = &uarta; | ||
13 | }; | 14 | }; |
14 | 15 | ||
15 | memory { | 16 | memory { |
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi index 3b374c49d04d..8acf5d85c99d 100644 --- a/arch/arm/boot/dts/tegra20.dtsi +++ b/arch/arm/boot/dts/tegra20.dtsi | |||
@@ -9,14 +9,6 @@ | |||
9 | compatible = "nvidia,tegra20"; | 9 | compatible = "nvidia,tegra20"; |
10 | interrupt-parent = <&intc>; | 10 | interrupt-parent = <&intc>; |
11 | 11 | ||
12 | aliases { | ||
13 | serial0 = &uarta; | ||
14 | serial1 = &uartb; | ||
15 | serial2 = &uartc; | ||
16 | serial3 = &uartd; | ||
17 | serial4 = &uarte; | ||
18 | }; | ||
19 | |||
20 | host1x@50000000 { | 12 | host1x@50000000 { |
21 | compatible = "nvidia,tegra20-host1x", "simple-bus"; | 13 | compatible = "nvidia,tegra20-host1x", "simple-bus"; |
22 | reg = <0x50000000 0x00024000>; | 14 | reg = <0x50000000 0x00024000>; |
diff --git a/arch/arm/boot/dts/tegra30-apalis-eval.dts b/arch/arm/boot/dts/tegra30-apalis-eval.dts index 45d40f024585..6236bdecb48b 100644 --- a/arch/arm/boot/dts/tegra30-apalis-eval.dts +++ b/arch/arm/boot/dts/tegra30-apalis-eval.dts | |||
@@ -11,6 +11,10 @@ | |||
11 | rtc0 = "/i2c@7000c000/rtc@68"; | 11 | rtc0 = "/i2c@7000c000/rtc@68"; |
12 | rtc1 = "/i2c@7000d000/tps65911@2d"; | 12 | rtc1 = "/i2c@7000d000/tps65911@2d"; |
13 | rtc2 = "/rtc@7000e000"; | 13 | rtc2 = "/rtc@7000e000"; |
14 | serial0 = &uarta; | ||
15 | serial1 = &uartb; | ||
16 | serial2 = &uartc; | ||
17 | serial3 = &uartd; | ||
14 | }; | 18 | }; |
15 | 19 | ||
16 | pcie-controller@00003000 { | 20 | pcie-controller@00003000 { |
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts index cee8f2246fdb..6b157eeabcc5 100644 --- a/arch/arm/boot/dts/tegra30-beaver.dts +++ b/arch/arm/boot/dts/tegra30-beaver.dts | |||
@@ -9,6 +9,7 @@ | |||
9 | aliases { | 9 | aliases { |
10 | rtc0 = "/i2c@7000d000/tps65911@2d"; | 10 | rtc0 = "/i2c@7000d000/tps65911@2d"; |
11 | rtc1 = "/rtc@7000e000"; | 11 | rtc1 = "/rtc@7000e000"; |
12 | serial0 = &uarta; | ||
12 | }; | 13 | }; |
13 | 14 | ||
14 | memory { | 15 | memory { |
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi index 206379546244..a1b682ea01bd 100644 --- a/arch/arm/boot/dts/tegra30-cardhu.dtsi +++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi | |||
@@ -30,6 +30,8 @@ | |||
30 | aliases { | 30 | aliases { |
31 | rtc0 = "/i2c@7000d000/tps65911@2d"; | 31 | rtc0 = "/i2c@7000d000/tps65911@2d"; |
32 | rtc1 = "/rtc@7000e000"; | 32 | rtc1 = "/rtc@7000e000"; |
33 | serial0 = &uarta; | ||
34 | serial1 = &uartc; | ||
33 | }; | 35 | }; |
34 | 36 | ||
35 | memory { | 37 | memory { |
diff --git a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts index 7793abd5bef1..4d3ddc585641 100644 --- a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts +++ b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts | |||
@@ -10,6 +10,9 @@ | |||
10 | rtc0 = "/i2c@7000c000/rtc@68"; | 10 | rtc0 = "/i2c@7000c000/rtc@68"; |
11 | rtc1 = "/i2c@7000d000/tps65911@2d"; | 11 | rtc1 = "/i2c@7000d000/tps65911@2d"; |
12 | rtc2 = "/rtc@7000e000"; | 12 | rtc2 = "/rtc@7000e000"; |
13 | serial0 = &uarta; | ||
14 | serial1 = &uartb; | ||
15 | serial2 = &uartd; | ||
13 | }; | 16 | }; |
14 | 17 | ||
15 | host1x@50000000 { | 18 | host1x@50000000 { |
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index aa6ccea13d30..b270b9e3d455 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi | |||
@@ -9,14 +9,6 @@ | |||
9 | compatible = "nvidia,tegra30"; | 9 | compatible = "nvidia,tegra30"; |
10 | interrupt-parent = <&intc>; | 10 | interrupt-parent = <&intc>; |
11 | 11 | ||
12 | aliases { | ||
13 | serial0 = &uarta; | ||
14 | serial1 = &uartb; | ||
15 | serial2 = &uartc; | ||
16 | serial3 = &uartd; | ||
17 | serial4 = &uarte; | ||
18 | }; | ||
19 | |||
20 | pcie-controller@00003000 { | 12 | pcie-controller@00003000 { |
21 | compatible = "nvidia,tegra30-pcie"; | 13 | compatible = "nvidia,tegra30-pcie"; |
22 | device_type = "pci"; | 14 | device_type = "pci"; |
diff --git a/arch/arm/boot/dts/vf610-cosmic.dts b/arch/arm/boot/dts/vf610-cosmic.dts index 3fd1b74e1216..de1b453c2932 100644 --- a/arch/arm/boot/dts/vf610-cosmic.dts +++ b/arch/arm/boot/dts/vf610-cosmic.dts | |||
@@ -33,6 +33,13 @@ | |||
33 | 33 | ||
34 | }; | 34 | }; |
35 | 35 | ||
36 | &esdhc1 { | ||
37 | pinctrl-names = "default"; | ||
38 | pinctrl-0 = <&pinctrl_esdhc1>; | ||
39 | bus-width = <4>; | ||
40 | status = "okay"; | ||
41 | }; | ||
42 | |||
36 | &fec1 { | 43 | &fec1 { |
37 | phy-mode = "rmii"; | 44 | phy-mode = "rmii"; |
38 | pinctrl-names = "default"; | 45 | pinctrl-names = "default"; |
@@ -42,6 +49,18 @@ | |||
42 | 49 | ||
43 | &iomuxc { | 50 | &iomuxc { |
44 | vf610-cosmic { | 51 | vf610-cosmic { |
52 | pinctrl_esdhc1: esdhc1grp { | ||
53 | fsl,pins = < | ||
54 | VF610_PAD_PTA24__ESDHC1_CLK 0x31ef | ||
55 | VF610_PAD_PTA25__ESDHC1_CMD 0x31ef | ||
56 | VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef | ||
57 | VF610_PAD_PTA27__ESDHC1_DAT1 0x31ef | ||
58 | VF610_PAD_PTA28__ESDHC1_DATA2 0x31ef | ||
59 | VF610_PAD_PTA29__ESDHC1_DAT3 0x31ef | ||
60 | VF610_PAD_PTB28__GPIO_98 0x219d | ||
61 | >; | ||
62 | }; | ||
63 | |||
45 | pinctrl_fec1: fec1grp { | 64 | pinctrl_fec1: fec1grp { |
46 | fsl,pins = < | 65 | fsl,pins = < |
47 | VF610_PAD_PTC9__ENET_RMII1_MDC 0x30d2 | 66 | VF610_PAD_PTC9__ENET_RMII1_MDC 0x30d2 |
diff --git a/arch/arm/boot/dts/zynq-parallella.dts b/arch/arm/boot/dts/zynq-parallella.dts index e1f51ca127fe..0429bbd89fba 100644 --- a/arch/arm/boot/dts/zynq-parallella.dts +++ b/arch/arm/boot/dts/zynq-parallella.dts | |||
@@ -34,6 +34,10 @@ | |||
34 | }; | 34 | }; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | &clkc { | ||
38 | fclk-enable = <0xf>; | ||
39 | }; | ||
40 | |||
37 | &gem0 { | 41 | &gem0 { |
38 | status = "okay"; | 42 | status = "okay"; |
39 | phy-mode = "rgmii-id"; | 43 | phy-mode = "rgmii-id"; |
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index d86771abbf57..72041f002b7e 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/edma.h> | 28 | #include <linux/edma.h> |
29 | #include <linux/dma-mapping.h> | ||
29 | #include <linux/of_address.h> | 30 | #include <linux/of_address.h> |
30 | #include <linux/of_device.h> | 31 | #include <linux/of_device.h> |
31 | #include <linux/of_dma.h> | 32 | #include <linux/of_dma.h> |
@@ -1623,6 +1624,11 @@ static int edma_probe(struct platform_device *pdev) | |||
1623 | struct device_node *node = pdev->dev.of_node; | 1624 | struct device_node *node = pdev->dev.of_node; |
1624 | struct device *dev = &pdev->dev; | 1625 | struct device *dev = &pdev->dev; |
1625 | int ret; | 1626 | int ret; |
1627 | struct platform_device_info edma_dev_info = { | ||
1628 | .name = "edma-dma-engine", | ||
1629 | .dma_mask = DMA_BIT_MASK(32), | ||
1630 | .parent = &pdev->dev, | ||
1631 | }; | ||
1626 | 1632 | ||
1627 | if (node) { | 1633 | if (node) { |
1628 | /* Check if this is a second instance registered */ | 1634 | /* Check if this is a second instance registered */ |
@@ -1793,6 +1799,9 @@ static int edma_probe(struct platform_device *pdev) | |||
1793 | edma_write_array(j, EDMA_QRAE, i, 0x0); | 1799 | edma_write_array(j, EDMA_QRAE, i, 0x0); |
1794 | } | 1800 | } |
1795 | arch_num_cc++; | 1801 | arch_num_cc++; |
1802 | |||
1803 | edma_dev_info.id = j; | ||
1804 | platform_device_register_full(&edma_dev_info); | ||
1796 | } | 1805 | } |
1797 | 1806 | ||
1798 | return 0; | 1807 | return 0; |
diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig index 72058b8a6f4d..e21ef830a483 100644 --- a/arch/arm/configs/exynos_defconfig +++ b/arch/arm/configs/exynos_defconfig | |||
@@ -142,11 +142,13 @@ CONFIG_MMC_DW_IDMAC=y | |||
142 | CONFIG_MMC_DW_EXYNOS=y | 142 | CONFIG_MMC_DW_EXYNOS=y |
143 | CONFIG_RTC_CLASS=y | 143 | CONFIG_RTC_CLASS=y |
144 | CONFIG_RTC_DRV_MAX77686=y | 144 | CONFIG_RTC_DRV_MAX77686=y |
145 | CONFIG_RTC_DRV_MAX77802=y | ||
145 | CONFIG_RTC_DRV_S5M=y | 146 | CONFIG_RTC_DRV_S5M=y |
146 | CONFIG_RTC_DRV_S3C=y | 147 | CONFIG_RTC_DRV_S3C=y |
147 | CONFIG_DMADEVICES=y | 148 | CONFIG_DMADEVICES=y |
148 | CONFIG_PL330_DMA=y | 149 | CONFIG_PL330_DMA=y |
149 | CONFIG_COMMON_CLK_MAX77686=y | 150 | CONFIG_COMMON_CLK_MAX77686=y |
151 | CONFIG_COMMON_CLK_MAX77802=y | ||
150 | CONFIG_COMMON_CLK_S2MPS11=y | 152 | CONFIG_COMMON_CLK_S2MPS11=y |
151 | CONFIG_EXYNOS_IOMMU=y | 153 | CONFIG_EXYNOS_IOMMU=y |
152 | CONFIG_IIO=y | 154 | CONFIG_IIO=y |
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index e688741c89aa..e6b0007355f8 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig | |||
@@ -97,6 +97,7 @@ CONFIG_SERIAL_IMX_CONSOLE=y | |||
97 | # CONFIG_HW_RANDOM is not set | 97 | # CONFIG_HW_RANDOM is not set |
98 | CONFIG_I2C_CHARDEV=y | 98 | CONFIG_I2C_CHARDEV=y |
99 | CONFIG_I2C_IMX=y | 99 | CONFIG_I2C_IMX=y |
100 | CONFIG_SPI=y | ||
100 | CONFIG_SPI_IMX=y | 101 | CONFIG_SPI_IMX=y |
101 | CONFIG_SPI_SPIDEV=y | 102 | CONFIG_SPI_SPIDEV=y |
102 | CONFIG_GPIO_SYSFS=y | 103 | CONFIG_GPIO_SYSFS=y |
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 8fca6e276b69..6790f1b3f3a1 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig | |||
@@ -158,6 +158,7 @@ CONFIG_I2C_CHARDEV=y | |||
158 | CONFIG_I2C_ALGOPCF=m | 158 | CONFIG_I2C_ALGOPCF=m |
159 | CONFIG_I2C_ALGOPCA=m | 159 | CONFIG_I2C_ALGOPCA=m |
160 | CONFIG_I2C_IMX=y | 160 | CONFIG_I2C_IMX=y |
161 | CONFIG_SPI=y | ||
161 | CONFIG_SPI_IMX=y | 162 | CONFIG_SPI_IMX=y |
162 | CONFIG_GPIO_SYSFS=y | 163 | CONFIG_GPIO_SYSFS=y |
163 | CONFIG_GPIO_MC9S08DZ60=y | 164 | CONFIG_GPIO_MC9S08DZ60=y |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index f1dc7fc668f3..9d7a32f93fcf 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -217,6 +217,7 @@ CONFIG_I2C_CADENCE=y | |||
217 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | 217 | CONFIG_I2C_DESIGNWARE_PLATFORM=y |
218 | CONFIG_I2C_EXYNOS5=y | 218 | CONFIG_I2C_EXYNOS5=y |
219 | CONFIG_I2C_MV64XXX=y | 219 | CONFIG_I2C_MV64XXX=y |
220 | CONFIG_I2C_S3C2410=y | ||
220 | CONFIG_I2C_SIRF=y | 221 | CONFIG_I2C_SIRF=y |
221 | CONFIG_I2C_TEGRA=y | 222 | CONFIG_I2C_TEGRA=y |
222 | CONFIG_I2C_ST=y | 223 | CONFIG_I2C_ST=y |
@@ -235,6 +236,7 @@ CONFIG_SPI_TEGRA20_SLINK=y | |||
235 | CONFIG_SPI_XILINX=y | 236 | CONFIG_SPI_XILINX=y |
236 | CONFIG_PINCTRL_AS3722=y | 237 | CONFIG_PINCTRL_AS3722=y |
237 | CONFIG_PINCTRL_PALMAS=y | 238 | CONFIG_PINCTRL_PALMAS=y |
239 | CONFIG_PINCTRL_APQ8084=y | ||
238 | CONFIG_GPIO_SYSFS=y | 240 | CONFIG_GPIO_SYSFS=y |
239 | CONFIG_GPIO_GENERIC_PLATFORM=y | 241 | CONFIG_GPIO_GENERIC_PLATFORM=y |
240 | CONFIG_GPIO_DWAPB=y | 242 | CONFIG_GPIO_DWAPB=y |
@@ -411,6 +413,7 @@ CONFIG_NVEC_POWER=y | |||
411 | CONFIG_NVEC_PAZ00=y | 413 | CONFIG_NVEC_PAZ00=y |
412 | CONFIG_QCOM_GSBI=y | 414 | CONFIG_QCOM_GSBI=y |
413 | CONFIG_COMMON_CLK_QCOM=y | 415 | CONFIG_COMMON_CLK_QCOM=y |
416 | CONFIG_APQ_MMCC_8084=y | ||
414 | CONFIG_MSM_GCC_8660=y | 417 | CONFIG_MSM_GCC_8660=y |
415 | CONFIG_MSM_MMCC_8960=y | 418 | CONFIG_MSM_MMCC_8960=y |
416 | CONFIG_MSM_MMCC_8974=y | 419 | CONFIG_MSM_MMCC_8974=y |
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index 16e719c268dd..b3f86670d2eb 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig | |||
@@ -86,7 +86,6 @@ CONFIG_IP_PNP_DHCP=y | |||
86 | CONFIG_IP_PNP_BOOTP=y | 86 | CONFIG_IP_PNP_BOOTP=y |
87 | CONFIG_IP_PNP_RARP=y | 87 | CONFIG_IP_PNP_RARP=y |
88 | # CONFIG_INET_LRO is not set | 88 | # CONFIG_INET_LRO is not set |
89 | CONFIG_IPV6=y | ||
90 | CONFIG_NETFILTER=y | 89 | CONFIG_NETFILTER=y |
91 | CONFIG_CAN=m | 90 | CONFIG_CAN=m |
92 | CONFIG_CAN_C_CAN=m | 91 | CONFIG_CAN_C_CAN=m |
@@ -112,6 +111,7 @@ CONFIG_MTD_OOPS=y | |||
112 | CONFIG_MTD_CFI=y | 111 | CONFIG_MTD_CFI=y |
113 | CONFIG_MTD_CFI_INTELEXT=y | 112 | CONFIG_MTD_CFI_INTELEXT=y |
114 | CONFIG_MTD_NAND=y | 113 | CONFIG_MTD_NAND=y |
114 | CONFIG_MTD_NAND_ECC_BCH=y | ||
115 | CONFIG_MTD_NAND_OMAP2=y | 115 | CONFIG_MTD_NAND_OMAP2=y |
116 | CONFIG_MTD_ONENAND=y | 116 | CONFIG_MTD_ONENAND=y |
117 | CONFIG_MTD_ONENAND_VERIFY_WRITE=y | 117 | CONFIG_MTD_ONENAND_VERIFY_WRITE=y |
@@ -317,7 +317,7 @@ CONFIG_EXT4_FS=y | |||
317 | CONFIG_FANOTIFY=y | 317 | CONFIG_FANOTIFY=y |
318 | CONFIG_QUOTA=y | 318 | CONFIG_QUOTA=y |
319 | CONFIG_QFMT_V2=y | 319 | CONFIG_QFMT_V2=y |
320 | CONFIG_AUTOFS4_FS=y | 320 | CONFIG_AUTOFS4_FS=m |
321 | CONFIG_MSDOS_FS=y | 321 | CONFIG_MSDOS_FS=y |
322 | CONFIG_VFAT_FS=y | 322 | CONFIG_VFAT_FS=y |
323 | CONFIG_TMPFS=y | 323 | CONFIG_TMPFS=y |
diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig index d7a5855a5db8..a2956c3112f1 100644 --- a/arch/arm/configs/socfpga_defconfig +++ b/arch/arm/configs/socfpga_defconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
2 | CONFIG_FHANDLE=y | ||
3 | CONFIG_HIGH_RES_TIMERS=y | ||
3 | CONFIG_IKCONFIG=y | 4 | CONFIG_IKCONFIG=y |
4 | CONFIG_IKCONFIG_PROC=y | 5 | CONFIG_IKCONFIG_PROC=y |
5 | CONFIG_LOG_BUF_SHIFT=14 | 6 | CONFIG_LOG_BUF_SHIFT=14 |
@@ -11,23 +12,17 @@ CONFIG_PROFILING=y | |||
11 | CONFIG_OPROFILE=y | 12 | CONFIG_OPROFILE=y |
12 | CONFIG_MODULES=y | 13 | CONFIG_MODULES=y |
13 | CONFIG_MODULE_UNLOAD=y | 14 | CONFIG_MODULE_UNLOAD=y |
14 | CONFIG_HOTPLUG=y | ||
15 | # CONFIG_LBDAF is not set | 15 | # CONFIG_LBDAF is not set |
16 | # CONFIG_BLK_DEV_BSG is not set | 16 | # CONFIG_BLK_DEV_BSG is not set |
17 | # CONFIG_IOSCHED_DEADLINE is not set | 17 | # CONFIG_IOSCHED_DEADLINE is not set |
18 | # CONFIG_IOSCHED_CFQ is not set | 18 | # CONFIG_IOSCHED_CFQ is not set |
19 | CONFIG_ARCH_SOCFPGA=y | 19 | CONFIG_ARCH_SOCFPGA=y |
20 | CONFIG_MACH_SOCFPGA_CYCLONE5=y | ||
21 | CONFIG_ARM_THUMBEE=y | 20 | CONFIG_ARM_THUMBEE=y |
22 | # CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set | ||
23 | # CONFIG_CACHE_L2X0 is not set | ||
24 | CONFIG_HIGH_RES_TIMERS=y | ||
25 | CONFIG_SMP=y | 21 | CONFIG_SMP=y |
26 | CONFIG_NR_CPUS=2 | 22 | CONFIG_NR_CPUS=2 |
27 | CONFIG_AEABI=y | 23 | CONFIG_AEABI=y |
28 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 24 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
29 | CONFIG_ZBOOT_ROM_BSS=0x0 | 25 | CONFIG_ZBOOT_ROM_BSS=0x0 |
30 | CONFIG_CMDLINE="" | ||
31 | CONFIG_VFP=y | 26 | CONFIG_VFP=y |
32 | CONFIG_NEON=y | 27 | CONFIG_NEON=y |
33 | CONFIG_NET=y | 28 | CONFIG_NET=y |
@@ -41,38 +36,30 @@ CONFIG_IP_PNP=y | |||
41 | CONFIG_IP_PNP_DHCP=y | 36 | CONFIG_IP_PNP_DHCP=y |
42 | CONFIG_IP_PNP_BOOTP=y | 37 | CONFIG_IP_PNP_BOOTP=y |
43 | CONFIG_IP_PNP_RARP=y | 38 | CONFIG_IP_PNP_RARP=y |
39 | CONFIG_IPV6=y | ||
40 | CONFIG_NETWORK_PHY_TIMESTAMPING=y | ||
41 | CONFIG_VLAN_8021Q=y | ||
42 | CONFIG_VLAN_8021Q_GVRP=y | ||
44 | CONFIG_CAN=y | 43 | CONFIG_CAN=y |
45 | CONFIG_CAN_RAW=y | ||
46 | CONFIG_CAN_BCM=y | ||
47 | CONFIG_CAN_GW=y | ||
48 | CONFIG_CAN_DEV=y | ||
49 | CONFIG_CAN_CALC_BITTIMING=y | ||
50 | CONFIG_CAN_C_CAN=y | 44 | CONFIG_CAN_C_CAN=y |
51 | CONFIG_CAN_C_CAN_PLATFORM=y | 45 | CONFIG_CAN_C_CAN_PLATFORM=y |
52 | CONFIG_CAN_DEBUG_DEVICES=y | 46 | CONFIG_CAN_DEBUG_DEVICES=y |
53 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 47 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
54 | CONFIG_DEVTMPFS=y | 48 | CONFIG_DEVTMPFS=y |
55 | CONFIG_PROC_DEVICETREE=y | 49 | CONFIG_DEVTMPFS_MOUNT=y |
56 | CONFIG_BLK_DEV_RAM=y | 50 | CONFIG_BLK_DEV_RAM=y |
57 | CONFIG_BLK_DEV_RAM_COUNT=2 | 51 | CONFIG_BLK_DEV_RAM_COUNT=2 |
58 | CONFIG_BLK_DEV_RAM_SIZE=8192 | 52 | CONFIG_BLK_DEV_RAM_SIZE=8192 |
53 | CONFIG_SRAM=y | ||
59 | CONFIG_SCSI=y | 54 | CONFIG_SCSI=y |
60 | # CONFIG_SCSI_PROC_FS is not set | 55 | # CONFIG_SCSI_PROC_FS is not set |
61 | CONFIG_BLK_DEV_SD=y | 56 | CONFIG_BLK_DEV_SD=y |
62 | # CONFIG_SCSI_LOWLEVEL is not set | 57 | # CONFIG_SCSI_LOWLEVEL is not set |
63 | CONFIG_NETDEVICES=y | 58 | CONFIG_NETDEVICES=y |
64 | CONFIG_STMMAC_ETH=y | 59 | CONFIG_STMMAC_ETH=y |
60 | CONFIG_DWMAC_SOCFPGA=y | ||
65 | CONFIG_MICREL_PHY=y | 61 | CONFIG_MICREL_PHY=y |
66 | # CONFIG_STMMAC_PHY_ID_ZERO_WORKAROUND is not set | ||
67 | CONFIG_INPUT_EVDEV=y | 62 | CONFIG_INPUT_EVDEV=y |
68 | CONFIG_DWMAC_SOCFPGA=y | ||
69 | CONFIG_PPS=y | ||
70 | CONFIG_NETWORK_PHY_TIMESTAMPING=y | ||
71 | CONFIG_PTP_1588_CLOCK=y | ||
72 | CONFIG_VLAN_8021Q=y | ||
73 | CONFIG_VLAN_8021Q_GVRP=y | ||
74 | CONFIG_GARP=y | ||
75 | CONFIG_IPV6=y | ||
76 | # CONFIG_SERIO_SERPORT is not set | 63 | # CONFIG_SERIO_SERPORT is not set |
77 | CONFIG_SERIO_AMBAKMI=y | 64 | CONFIG_SERIO_AMBAKMI=y |
78 | CONFIG_LEGACY_PTY_COUNT=16 | 65 | CONFIG_LEGACY_PTY_COUNT=16 |
@@ -81,45 +68,43 @@ CONFIG_SERIAL_8250_CONSOLE=y | |||
81 | CONFIG_SERIAL_8250_NR_UARTS=2 | 68 | CONFIG_SERIAL_8250_NR_UARTS=2 |
82 | CONFIG_SERIAL_8250_RUNTIME_UARTS=2 | 69 | CONFIG_SERIAL_8250_RUNTIME_UARTS=2 |
83 | CONFIG_SERIAL_8250_DW=y | 70 | CONFIG_SERIAL_8250_DW=y |
71 | CONFIG_I2C=y | ||
72 | CONFIG_I2C_CHARDEV=y | ||
73 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | ||
84 | CONFIG_GPIOLIB=y | 74 | CONFIG_GPIOLIB=y |
85 | CONFIG_GPIO_SYSFS=y | 75 | CONFIG_GPIO_SYSFS=y |
86 | CONFIG_GPIO_DWAPB=y | 76 | CONFIG_GPIO_DWAPB=y |
87 | # CONFIG_RTC_HCTOSYS is not set | 77 | CONFIG_PMBUS=y |
78 | CONFIG_SENSORS_LTC2978=y | ||
79 | CONFIG_SENSORS_LTC2978_REGULATOR=y | ||
88 | CONFIG_WATCHDOG=y | 80 | CONFIG_WATCHDOG=y |
89 | CONFIG_DW_WATCHDOG=y | 81 | CONFIG_DW_WATCHDOG=y |
82 | CONFIG_REGULATOR=y | ||
83 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
84 | CONFIG_USB=y | ||
85 | CONFIG_USB_DWC2=y | ||
86 | CONFIG_USB_DWC2_HOST=y | ||
87 | CONFIG_MMC=y | ||
88 | CONFIG_MMC_DW=y | ||
90 | CONFIG_EXT2_FS=y | 89 | CONFIG_EXT2_FS=y |
91 | CONFIG_EXT2_FS_XATTR=y | 90 | CONFIG_EXT2_FS_XATTR=y |
92 | CONFIG_EXT2_FS_POSIX_ACL=y | 91 | CONFIG_EXT2_FS_POSIX_ACL=y |
93 | CONFIG_EXT3_FS=y | 92 | CONFIG_EXT3_FS=y |
94 | CONFIG_NFS_FS=y | 93 | CONFIG_EXT4_FS=y |
95 | CONFIG_ROOT_NFS=y | ||
96 | # CONFIG_DNOTIFY is not set | ||
97 | # CONFIG_INOTIFY_USER is not set | ||
98 | CONFIG_FHANDLE=y | ||
99 | CONFIG_VFAT_FS=y | 94 | CONFIG_VFAT_FS=y |
100 | CONFIG_NTFS_FS=y | 95 | CONFIG_NTFS_FS=y |
101 | CONFIG_NTFS_RW=y | 96 | CONFIG_NTFS_RW=y |
102 | CONFIG_TMPFS=y | 97 | CONFIG_TMPFS=y |
103 | CONFIG_JFFS2_FS=y | 98 | CONFIG_CONFIGFS_FS=y |
99 | CONFIG_NFS_FS=y | ||
100 | CONFIG_ROOT_NFS=y | ||
104 | CONFIG_NLS_CODEPAGE_437=y | 101 | CONFIG_NLS_CODEPAGE_437=y |
105 | CONFIG_NLS_ISO8859_1=y | 102 | CONFIG_NLS_ISO8859_1=y |
103 | CONFIG_PRINTK_TIME=y | ||
104 | CONFIG_DEBUG_INFO=y | ||
106 | CONFIG_MAGIC_SYSRQ=y | 105 | CONFIG_MAGIC_SYSRQ=y |
107 | CONFIG_DETECT_HUNG_TASK=y | 106 | CONFIG_DETECT_HUNG_TASK=y |
108 | # CONFIG_SCHED_DEBUG is not set | 107 | # CONFIG_SCHED_DEBUG is not set |
109 | CONFIG_DEBUG_INFO=y | ||
110 | CONFIG_ENABLE_DEFAULT_TRACERS=y | 108 | CONFIG_ENABLE_DEFAULT_TRACERS=y |
111 | CONFIG_DEBUG_USER=y | 109 | CONFIG_DEBUG_USER=y |
112 | CONFIG_XZ_DEC=y | 110 | CONFIG_XZ_DEC=y |
113 | CONFIG_I2C=y | ||
114 | CONFIG_I2C_DESIGNWARE_CORE=y | ||
115 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | ||
116 | CONFIG_I2C_CHARDEV=y | ||
117 | CONFIG_MMC=y | ||
118 | CONFIG_MMC_DW=y | ||
119 | CONFIG_PM=y | ||
120 | CONFIG_SUSPEND=y | ||
121 | CONFIG_MMC_UNSAFE_RESUME=y | ||
122 | CONFIG_USB=y | ||
123 | CONFIG_USB_DWC2=y | ||
124 | CONFIG_USB_DWC2_HOST=y | ||
125 | CONFIG_USB_DWC2_PLATFORM=y | ||
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index fc44d3761f9e..ce73ab635414 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
@@ -44,16 +44,6 @@ struct cpu_context_save { | |||
44 | __u32 extra[2]; /* Xscale 'acc' register, etc */ | 44 | __u32 extra[2]; /* Xscale 'acc' register, etc */ |
45 | }; | 45 | }; |
46 | 46 | ||
47 | struct arm_restart_block { | ||
48 | union { | ||
49 | /* For user cache flushing */ | ||
50 | struct { | ||
51 | unsigned long start; | ||
52 | unsigned long end; | ||
53 | } cache; | ||
54 | }; | ||
55 | }; | ||
56 | |||
57 | /* | 47 | /* |
58 | * low level task data that entry.S needs immediate access to. | 48 | * low level task data that entry.S needs immediate access to. |
59 | * __switch_to() assumes cpu_context follows immediately after cpu_domain. | 49 | * __switch_to() assumes cpu_context follows immediately after cpu_domain. |
@@ -79,7 +69,6 @@ struct thread_info { | |||
79 | unsigned long thumbee_state; /* ThumbEE Handler Base register */ | 69 | unsigned long thumbee_state; /* ThumbEE Handler Base register */ |
80 | #endif | 70 | #endif |
81 | struct restart_block restart_block; | 71 | struct restart_block restart_block; |
82 | struct arm_restart_block arm_restart_block; | ||
83 | }; | 72 | }; |
84 | 73 | ||
85 | #define INIT_THREAD_INFO(tsk) \ | 74 | #define INIT_THREAD_INFO(tsk) \ |
diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h index 3aaa75cae90c..705bb7620673 100644 --- a/arch/arm/include/uapi/asm/unistd.h +++ b/arch/arm/include/uapi/asm/unistd.h | |||
@@ -412,6 +412,7 @@ | |||
412 | #define __NR_seccomp (__NR_SYSCALL_BASE+383) | 412 | #define __NR_seccomp (__NR_SYSCALL_BASE+383) |
413 | #define __NR_getrandom (__NR_SYSCALL_BASE+384) | 413 | #define __NR_getrandom (__NR_SYSCALL_BASE+384) |
414 | #define __NR_memfd_create (__NR_SYSCALL_BASE+385) | 414 | #define __NR_memfd_create (__NR_SYSCALL_BASE+385) |
415 | #define __NR_bpf (__NR_SYSCALL_BASE+386) | ||
415 | 416 | ||
416 | /* | 417 | /* |
417 | * The following SWIs are ARM private. | 418 | * The following SWIs are ARM private. |
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 713e807621d2..2d2d6087b9b1 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | #include <linux/compiler.h> | ||
13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
14 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
15 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
@@ -39,10 +40,19 @@ | |||
39 | * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c | 40 | * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c |
40 | * (http://gcc.gnu.org/PR8896) and incorrect structure | 41 | * (http://gcc.gnu.org/PR8896) and incorrect structure |
41 | * initialisation in fs/jffs2/erase.c | 42 | * initialisation in fs/jffs2/erase.c |
43 | * GCC 4.8.0-4.8.2: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854 | ||
44 | * miscompiles find_get_entry(), and can result in EXT3 and EXT4 | ||
45 | * filesystem corruption (possibly other FS too). | ||
42 | */ | 46 | */ |
47 | #ifdef __GNUC__ | ||
43 | #if (__GNUC__ == 3 && __GNUC_MINOR__ < 3) | 48 | #if (__GNUC__ == 3 && __GNUC_MINOR__ < 3) |
44 | #error Your compiler is too buggy; it is known to miscompile kernels. | 49 | #error Your compiler is too buggy; it is known to miscompile kernels. |
45 | #error Known good compilers: 3.3 | 50 | #error Known good compilers: 3.3, 4.x |
51 | #endif | ||
52 | #if GCC_VERSION >= 40800 && GCC_VERSION < 40803 | ||
53 | #error Your compiler is too buggy; it is known to miscompile kernels | ||
54 | #error and result in filesystem corruption and oopses. | ||
55 | #endif | ||
46 | #endif | 56 | #endif |
47 | 57 | ||
48 | int main(void) | 58 | int main(void) |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 9f899d8fdcca..e51833f8cc38 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -395,6 +395,7 @@ | |||
395 | CALL(sys_seccomp) | 395 | CALL(sys_seccomp) |
396 | CALL(sys_getrandom) | 396 | CALL(sys_getrandom) |
397 | /* 385 */ CALL(sys_memfd_create) | 397 | /* 385 */ CALL(sys_memfd_create) |
398 | CALL(sys_bpf) | ||
398 | #ifndef syscalls_counted | 399 | #ifndef syscalls_counted |
399 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls | 400 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls |
400 | #define syscalls_counted | 401 | #define syscalls_counted |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 0c8b10801d36..9f5d81881eb6 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -533,8 +533,6 @@ static int bad_syscall(int n, struct pt_regs *regs) | |||
533 | return regs->ARM_r0; | 533 | return regs->ARM_r0; |
534 | } | 534 | } |
535 | 535 | ||
536 | static long do_cache_op_restart(struct restart_block *); | ||
537 | |||
538 | static inline int | 536 | static inline int |
539 | __do_cache_op(unsigned long start, unsigned long end) | 537 | __do_cache_op(unsigned long start, unsigned long end) |
540 | { | 538 | { |
@@ -543,24 +541,8 @@ __do_cache_op(unsigned long start, unsigned long end) | |||
543 | do { | 541 | do { |
544 | unsigned long chunk = min(PAGE_SIZE, end - start); | 542 | unsigned long chunk = min(PAGE_SIZE, end - start); |
545 | 543 | ||
546 | if (signal_pending(current)) { | 544 | if (fatal_signal_pending(current)) |
547 | struct thread_info *ti = current_thread_info(); | 545 | return 0; |
548 | |||
549 | ti->restart_block = (struct restart_block) { | ||
550 | .fn = do_cache_op_restart, | ||
551 | }; | ||
552 | |||
553 | ti->arm_restart_block = (struct arm_restart_block) { | ||
554 | { | ||
555 | .cache = { | ||
556 | .start = start, | ||
557 | .end = end, | ||
558 | }, | ||
559 | }, | ||
560 | }; | ||
561 | |||
562 | return -ERESTART_RESTARTBLOCK; | ||
563 | } | ||
564 | 546 | ||
565 | ret = flush_cache_user_range(start, start + chunk); | 547 | ret = flush_cache_user_range(start, start + chunk); |
566 | if (ret) | 548 | if (ret) |
@@ -573,15 +555,6 @@ __do_cache_op(unsigned long start, unsigned long end) | |||
573 | return 0; | 555 | return 0; |
574 | } | 556 | } |
575 | 557 | ||
576 | static long do_cache_op_restart(struct restart_block *unused) | ||
577 | { | ||
578 | struct arm_restart_block *restart_block; | ||
579 | |||
580 | restart_block = ¤t_thread_info()->arm_restart_block; | ||
581 | return __do_cache_op(restart_block->cache.start, | ||
582 | restart_block->cache.end); | ||
583 | } | ||
584 | |||
585 | static inline int | 558 | static inline int |
586 | do_cache_op(unsigned long start, unsigned long end, int flags) | 559 | do_cache_op(unsigned long start, unsigned long end, int flags) |
587 | { | 560 | { |
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 57a403a5c22b..8664ff17cbbe 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c | |||
@@ -197,7 +197,8 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, | |||
197 | pgd = pgdp + pgd_index(addr); | 197 | pgd = pgdp + pgd_index(addr); |
198 | do { | 198 | do { |
199 | next = kvm_pgd_addr_end(addr, end); | 199 | next = kvm_pgd_addr_end(addr, end); |
200 | unmap_puds(kvm, pgd, addr, next); | 200 | if (!pgd_none(*pgd)) |
201 | unmap_puds(kvm, pgd, addr, next); | ||
201 | } while (pgd++, addr = next, addr != end); | 202 | } while (pgd++, addr = next, addr != end); |
202 | } | 203 | } |
203 | 204 | ||
@@ -834,6 +835,11 @@ static bool kvm_is_write_fault(struct kvm_vcpu *vcpu) | |||
834 | return kvm_vcpu_dabt_iswrite(vcpu); | 835 | return kvm_vcpu_dabt_iswrite(vcpu); |
835 | } | 836 | } |
836 | 837 | ||
838 | static bool kvm_is_device_pfn(unsigned long pfn) | ||
839 | { | ||
840 | return !pfn_valid(pfn); | ||
841 | } | ||
842 | |||
837 | static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, | 843 | static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, |
838 | struct kvm_memory_slot *memslot, unsigned long hva, | 844 | struct kvm_memory_slot *memslot, unsigned long hva, |
839 | unsigned long fault_status) | 845 | unsigned long fault_status) |
@@ -904,7 +910,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, | |||
904 | if (is_error_pfn(pfn)) | 910 | if (is_error_pfn(pfn)) |
905 | return -EFAULT; | 911 | return -EFAULT; |
906 | 912 | ||
907 | if (kvm_is_mmio_pfn(pfn)) | 913 | if (kvm_is_device_pfn(pfn)) |
908 | mem_type = PAGE_S2_DEVICE; | 914 | mem_type = PAGE_S2_DEVICE; |
909 | 915 | ||
910 | spin_lock(&kvm->mmu_lock); | 916 | spin_lock(&kvm->mmu_lock); |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 21ab782cc8e9..06ecbafd01ee 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/i2c-gpio.h> | 19 | #include <linux/i2c-gpio.h> |
20 | #include <linux/atmel-mci.h> | 20 | #include <linux/atmel-mci.h> |
21 | #include <linux/platform_data/crypto-atmel.h> | 21 | #include <linux/platform_data/crypto-atmel.h> |
22 | #include <linux/platform_data/mmc-atmel-mci.h> | ||
22 | 23 | ||
23 | #include <linux/platform_data/at91_adc.h> | 24 | #include <linux/platform_data/at91_adc.h> |
24 | 25 | ||
@@ -30,7 +31,6 @@ | |||
30 | #include <mach/at91_matrix.h> | 31 | #include <mach/at91_matrix.h> |
31 | #include <mach/at91sam9_smc.h> | 32 | #include <mach/at91sam9_smc.h> |
32 | #include <linux/platform_data/dma-atmel.h> | 33 | #include <linux/platform_data/dma-atmel.h> |
33 | #include <mach/atmel-mci.h> | ||
34 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
35 | 35 | ||
36 | #include <media/atmel-isi.h> | 36 | #include <media/atmel-isi.h> |
diff --git a/arch/arm/mach-at91/include/mach/atmel-mci.h b/arch/arm/mach-at91/include/mach/atmel-mci.h deleted file mode 100644 index 3069e4135573..000000000000 --- a/arch/arm/mach-at91/include/mach/atmel-mci.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #ifndef __MACH_ATMEL_MCI_H | ||
2 | #define __MACH_ATMEL_MCI_H | ||
3 | |||
4 | #include <linux/platform_data/dma-atmel.h> | ||
5 | |||
6 | /** | ||
7 | * struct mci_dma_data - DMA data for MCI interface | ||
8 | */ | ||
9 | struct mci_dma_data { | ||
10 | struct at_dma_slave sdata; | ||
11 | }; | ||
12 | |||
13 | /* accessor macros */ | ||
14 | #define slave_data_ptr(s) (&(s)->sdata) | ||
15 | #define find_slave_dev(s) ((s)->sdata.dma_dev) | ||
16 | |||
17 | #endif /* __MACH_ATMEL_MCI_H */ | ||
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c index a17818475050..409637254594 100644 --- a/arch/arm/mach-imx/clk-vf610.c +++ b/arch/arm/mach-imx/clk-vf610.c | |||
@@ -58,8 +58,14 @@ | |||
58 | #define PFD_PLL1_BASE (anatop_base + 0x2b0) | 58 | #define PFD_PLL1_BASE (anatop_base + 0x2b0) |
59 | #define PFD_PLL2_BASE (anatop_base + 0x100) | 59 | #define PFD_PLL2_BASE (anatop_base + 0x100) |
60 | #define PFD_PLL3_BASE (anatop_base + 0xf0) | 60 | #define PFD_PLL3_BASE (anatop_base + 0xf0) |
61 | #define PLL1_CTRL (anatop_base + 0x270) | ||
62 | #define PLL2_CTRL (anatop_base + 0x30) | ||
61 | #define PLL3_CTRL (anatop_base + 0x10) | 63 | #define PLL3_CTRL (anatop_base + 0x10) |
64 | #define PLL4_CTRL (anatop_base + 0x70) | ||
65 | #define PLL5_CTRL (anatop_base + 0xe0) | ||
66 | #define PLL6_CTRL (anatop_base + 0xa0) | ||
62 | #define PLL7_CTRL (anatop_base + 0x20) | 67 | #define PLL7_CTRL (anatop_base + 0x20) |
68 | #define ANA_MISC1 (anatop_base + 0x160) | ||
63 | 69 | ||
64 | static void __iomem *anatop_base; | 70 | static void __iomem *anatop_base; |
65 | static void __iomem *ccm_base; | 71 | static void __iomem *ccm_base; |
@@ -67,25 +73,34 @@ static void __iomem *ccm_base; | |||
67 | /* sources for multiplexer clocks, this is used multiple times */ | 73 | /* sources for multiplexer clocks, this is used multiple times */ |
68 | static const char *fast_sels[] = { "firc", "fxosc", }; | 74 | static const char *fast_sels[] = { "firc", "fxosc", }; |
69 | static const char *slow_sels[] = { "sirc_32k", "sxosc", }; | 75 | static const char *slow_sels[] = { "sirc_32k", "sxosc", }; |
70 | static const char *pll1_sels[] = { "pll1_main", "pll1_pfd1", "pll1_pfd2", "pll1_pfd3", "pll1_pfd4", }; | 76 | static const char *pll1_sels[] = { "pll1_sys", "pll1_pfd1", "pll1_pfd2", "pll1_pfd3", "pll1_pfd4", }; |
71 | static const char *pll2_sels[] = { "pll2_main", "pll2_pfd1", "pll2_pfd2", "pll2_pfd3", "pll2_pfd4", }; | 77 | static const char *pll2_sels[] = { "pll2_bus", "pll2_pfd1", "pll2_pfd2", "pll2_pfd3", "pll2_pfd4", }; |
72 | static const char *sys_sels[] = { "fast_clk_sel", "slow_clk_sel", "pll2_pfd_sel", "pll2_main", "pll1_pfd_sel", "pll3_main", }; | 78 | static const char *pll_bypass_src_sels[] = { "fast_clk_sel", "lvds1_in", }; |
79 | static const char *pll1_bypass_sels[] = { "pll1", "pll1_bypass_src", }; | ||
80 | static const char *pll2_bypass_sels[] = { "pll2", "pll2_bypass_src", }; | ||
81 | static const char *pll3_bypass_sels[] = { "pll3", "pll3_bypass_src", }; | ||
82 | static const char *pll4_bypass_sels[] = { "pll4", "pll4_bypass_src", }; | ||
83 | static const char *pll5_bypass_sels[] = { "pll5", "pll5_bypass_src", }; | ||
84 | static const char *pll6_bypass_sels[] = { "pll6", "pll6_bypass_src", }; | ||
85 | static const char *pll7_bypass_sels[] = { "pll7", "pll7_bypass_src", }; | ||
86 | static const char *sys_sels[] = { "fast_clk_sel", "slow_clk_sel", "pll2_pfd_sel", "pll2_bus", "pll1_pfd_sel", "pll3_usb_otg", }; | ||
73 | static const char *ddr_sels[] = { "pll2_pfd2", "sys_sel", }; | 87 | static const char *ddr_sels[] = { "pll2_pfd2", "sys_sel", }; |
74 | static const char *rmii_sels[] = { "enet_ext", "audio_ext", "enet_50m", "enet_25m", }; | 88 | static const char *rmii_sels[] = { "enet_ext", "audio_ext", "enet_50m", "enet_25m", }; |
75 | static const char *enet_ts_sels[] = { "enet_ext", "fxosc", "audio_ext", "usb", "enet_ts", "enet_25m", "enet_50m", }; | 89 | static const char *enet_ts_sels[] = { "enet_ext", "fxosc", "audio_ext", "usb", "enet_ts", "enet_25m", "enet_50m", }; |
76 | static const char *esai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", }; | 90 | static const char *esai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_audio_div", }; |
77 | static const char *sai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", }; | 91 | static const char *sai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_audio_div", }; |
78 | static const char *nfc_sels[] = { "platform_bus", "pll1_pfd1", "pll3_pfd1", "pll3_pfd3", }; | 92 | static const char *nfc_sels[] = { "platform_bus", "pll1_pfd1", "pll3_pfd1", "pll3_pfd3", }; |
79 | static const char *qspi_sels[] = { "pll3_main", "pll3_pfd4", "pll2_pfd4", "pll1_pfd4", }; | 93 | static const char *qspi_sels[] = { "pll3_usb_otg", "pll3_pfd4", "pll2_pfd4", "pll1_pfd4", }; |
80 | static const char *esdhc_sels[] = { "pll3_main", "pll3_pfd3", "pll1_pfd3", "platform_bus", }; | 94 | static const char *esdhc_sels[] = { "pll3_usb_otg", "pll3_pfd3", "pll1_pfd3", "platform_bus", }; |
81 | static const char *dcu_sels[] = { "pll1_pfd2", "pll3_main", }; | 95 | static const char *dcu_sels[] = { "pll1_pfd2", "pll3_usb_otg", }; |
82 | static const char *gpu_sels[] = { "pll2_pfd2", "pll3_pfd2", }; | 96 | static const char *gpu_sels[] = { "pll2_pfd2", "pll3_pfd2", }; |
83 | static const char *vadc_sels[] = { "pll6_main_div", "pll3_main_div", "pll3_main", }; | 97 | static const char *vadc_sels[] = { "pll6_video_div", "pll3_usb_otg_div", "pll3_usb_otg", }; |
84 | /* FTM counter clock source, not module clock */ | 98 | /* FTM counter clock source, not module clock */ |
85 | static const char *ftm_ext_sels[] = {"sirc_128k", "sxosc", "fxosc_half", "audio_ext", }; | 99 | static const char *ftm_ext_sels[] = {"sirc_128k", "sxosc", "fxosc_half", "audio_ext", }; |
86 | static const char *ftm_fix_sels[] = { "sxosc", "ipg_bus", }; | 100 | static const char *ftm_fix_sels[] = { "sxosc", "ipg_bus", }; |
87 | 101 | ||
88 | static struct clk_div_table pll4_main_div_table[] = { | 102 | |
103 | static struct clk_div_table pll4_audio_div_table[] = { | ||
89 | { .val = 0, .div = 1 }, | 104 | { .val = 0, .div = 1 }, |
90 | { .val = 1, .div = 2 }, | 105 | { .val = 1, .div = 2 }, |
91 | { .val = 2, .div = 6 }, | 106 | { .val = 2, .div = 6 }, |
@@ -120,6 +135,9 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) | |||
120 | clk[VF610_CLK_AUDIO_EXT] = imx_obtain_fixed_clock("audio_ext", 0); | 135 | clk[VF610_CLK_AUDIO_EXT] = imx_obtain_fixed_clock("audio_ext", 0); |
121 | clk[VF610_CLK_ENET_EXT] = imx_obtain_fixed_clock("enet_ext", 0); | 136 | clk[VF610_CLK_ENET_EXT] = imx_obtain_fixed_clock("enet_ext", 0); |
122 | 137 | ||
138 | /* Clock source from external clock via LVDs PAD */ | ||
139 | clk[VF610_CLK_ANACLK1] = imx_obtain_fixed_clock("anaclk1", 0); | ||
140 | |||
123 | clk[VF610_CLK_FXOSC_HALF] = imx_clk_fixed_factor("fxosc_half", "fxosc", 1, 2); | 141 | clk[VF610_CLK_FXOSC_HALF] = imx_clk_fixed_factor("fxosc_half", "fxosc", 1, 2); |
124 | 142 | ||
125 | np = of_find_compatible_node(NULL, NULL, "fsl,vf610-anatop"); | 143 | np = of_find_compatible_node(NULL, NULL, "fsl,vf610-anatop"); |
@@ -133,31 +151,63 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) | |||
133 | clk[VF610_CLK_SLOW_CLK_SEL] = imx_clk_mux("slow_clk_sel", CCM_CCSR, 4, 1, slow_sels, ARRAY_SIZE(slow_sels)); | 151 | clk[VF610_CLK_SLOW_CLK_SEL] = imx_clk_mux("slow_clk_sel", CCM_CCSR, 4, 1, slow_sels, ARRAY_SIZE(slow_sels)); |
134 | clk[VF610_CLK_FASK_CLK_SEL] = imx_clk_mux("fast_clk_sel", CCM_CCSR, 5, 1, fast_sels, ARRAY_SIZE(fast_sels)); | 152 | clk[VF610_CLK_FASK_CLK_SEL] = imx_clk_mux("fast_clk_sel", CCM_CCSR, 5, 1, fast_sels, ARRAY_SIZE(fast_sels)); |
135 | 153 | ||
136 | clk[VF610_CLK_PLL1_MAIN] = imx_clk_fixed_factor("pll1_main", "fast_clk_sel", 22, 1); | 154 | clk[VF610_CLK_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", PLL1_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
137 | clk[VF610_CLK_PLL1_PFD1] = imx_clk_pfd("pll1_pfd1", "pll1_main", PFD_PLL1_BASE, 0); | 155 | clk[VF610_CLK_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", PLL2_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
138 | clk[VF610_CLK_PLL1_PFD2] = imx_clk_pfd("pll1_pfd2", "pll1_main", PFD_PLL1_BASE, 1); | 156 | clk[VF610_CLK_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", PLL3_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
139 | clk[VF610_CLK_PLL1_PFD3] = imx_clk_pfd("pll1_pfd3", "pll1_main", PFD_PLL1_BASE, 2); | 157 | clk[VF610_CLK_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", PLL4_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
140 | clk[VF610_CLK_PLL1_PFD4] = imx_clk_pfd("pll1_pfd4", "pll1_main", PFD_PLL1_BASE, 3); | 158 | clk[VF610_CLK_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", PLL5_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
141 | 159 | clk[VF610_CLK_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", PLL6_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); | |
142 | clk[VF610_CLK_PLL2_MAIN] = imx_clk_fixed_factor("pll2_main", "fast_clk_sel", 22, 1); | 160 | clk[VF610_CLK_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", PLL7_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
143 | clk[VF610_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1", "pll2_main", PFD_PLL2_BASE, 0); | 161 | |
144 | clk[VF610_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2", "pll2_main", PFD_PLL2_BASE, 1); | 162 | clk[VF610_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll1", "pll1_bypass_src", PLL1_CTRL, 0x1); |
145 | clk[VF610_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3", "pll2_main", PFD_PLL2_BASE, 2); | 163 | clk[VF610_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", PLL2_CTRL, 0x1); |
146 | clk[VF610_CLK_PLL2_PFD4] = imx_clk_pfd("pll2_pfd4", "pll2_main", PFD_PLL2_BASE, 3); | 164 | clk[VF610_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "pll3_bypass_src", PLL3_CTRL, 0x1); |
147 | 165 | clk[VF610_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", PLL4_CTRL, 0x7f); | |
148 | clk[VF610_CLK_PLL3_MAIN] = imx_clk_fixed_factor("pll3_main", "fast_clk_sel", 20, 1); | 166 | clk[VF610_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll5", "pll5_bypass_src", PLL5_CTRL, 0x3); |
149 | clk[VF610_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1", "pll3_main", PFD_PLL3_BASE, 0); | 167 | clk[VF610_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_AV, "pll6", "pll6_bypass_src", PLL6_CTRL, 0x7f); |
150 | clk[VF610_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2", "pll3_main", PFD_PLL3_BASE, 1); | 168 | clk[VF610_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "pll7_bypass_src", PLL7_CTRL, 0x1); |
151 | clk[VF610_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3", "pll3_main", PFD_PLL3_BASE, 2); | 169 | |
152 | clk[VF610_CLK_PLL3_PFD4] = imx_clk_pfd("pll3_pfd4", "pll3_main", PFD_PLL3_BASE, 3); | 170 | clk[VF610_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", PLL1_CTRL, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); |
153 | 171 | clk[VF610_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", PLL2_CTRL, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); | |
154 | clk[VF610_CLK_PLL4_MAIN] = imx_clk_fixed_factor("pll4_main", "fast_clk_sel", 25, 1); | 172 | clk[VF610_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", PLL3_CTRL, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); |
155 | /* Enet pll: fixed 50Mhz */ | 173 | clk[VF610_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", PLL4_CTRL, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); |
156 | clk[VF610_CLK_PLL5_MAIN] = imx_clk_fixed_factor("pll5_main", "fast_clk_sel", 125, 6); | 174 | clk[VF610_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", PLL5_CTRL, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); |
157 | /* pll6: default 960Mhz */ | 175 | clk[VF610_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", PLL6_CTRL, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); |
158 | clk[VF610_CLK_PLL6_MAIN] = imx_clk_fixed_factor("pll6_main", "fast_clk_sel", 40, 1); | 176 | clk[VF610_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", PLL7_CTRL, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); |
159 | /* pll7: USB1 PLL at 480MHz */ | 177 | |
160 | clk[VF610_CLK_PLL7_MAIN] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_main", "fast_clk_sel", PLL7_CTRL, 0x2); | 178 | /* Do not bypass PLLs initially */ |
179 | clk_set_parent(clk[VF610_PLL1_BYPASS], clk[VF610_CLK_PLL1]); | ||
180 | clk_set_parent(clk[VF610_PLL2_BYPASS], clk[VF610_CLK_PLL2]); | ||
181 | clk_set_parent(clk[VF610_PLL3_BYPASS], clk[VF610_CLK_PLL3]); | ||
182 | clk_set_parent(clk[VF610_PLL4_BYPASS], clk[VF610_CLK_PLL4]); | ||
183 | clk_set_parent(clk[VF610_PLL5_BYPASS], clk[VF610_CLK_PLL5]); | ||
184 | clk_set_parent(clk[VF610_PLL6_BYPASS], clk[VF610_CLK_PLL6]); | ||
185 | clk_set_parent(clk[VF610_PLL7_BYPASS], clk[VF610_CLK_PLL7]); | ||
186 | |||
187 | clk[VF610_CLK_PLL1_SYS] = imx_clk_gate("pll1_sys", "pll1_bypass", PLL1_CTRL, 13); | ||
188 | clk[VF610_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", PLL2_CTRL, 13); | ||
189 | clk[VF610_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", PLL3_CTRL, 13); | ||
190 | clk[VF610_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", PLL4_CTRL, 13); | ||
191 | clk[VF610_CLK_PLL5_ENET] = imx_clk_gate("pll5_enet", "pll5_bypass", PLL5_CTRL, 13); | ||
192 | clk[VF610_CLK_PLL6_VIDEO] = imx_clk_gate("pll6_video", "pll6_bypass", PLL6_CTRL, 13); | ||
193 | clk[VF610_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", PLL7_CTRL, 13); | ||
194 | |||
195 | clk[VF610_CLK_LVDS1_IN] = imx_clk_gate_exclusive("lvds1_in", "anaclk1", ANA_MISC1, 12, BIT(10)); | ||
196 | |||
197 | clk[VF610_CLK_PLL1_PFD1] = imx_clk_pfd("pll1_pfd1", "pll1_sys", PFD_PLL1_BASE, 0); | ||
198 | clk[VF610_CLK_PLL1_PFD2] = imx_clk_pfd("pll1_pfd2", "pll1_sys", PFD_PLL1_BASE, 1); | ||
199 | clk[VF610_CLK_PLL1_PFD3] = imx_clk_pfd("pll1_pfd3", "pll1_sys", PFD_PLL1_BASE, 2); | ||
200 | clk[VF610_CLK_PLL1_PFD4] = imx_clk_pfd("pll1_pfd4", "pll1_sys", PFD_PLL1_BASE, 3); | ||
201 | |||
202 | clk[VF610_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1", "pll2_bus", PFD_PLL2_BASE, 0); | ||
203 | clk[VF610_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2", "pll2_bus", PFD_PLL2_BASE, 1); | ||
204 | clk[VF610_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3", "pll2_bus", PFD_PLL2_BASE, 2); | ||
205 | clk[VF610_CLK_PLL2_PFD4] = imx_clk_pfd("pll2_pfd4", "pll2_bus", PFD_PLL2_BASE, 3); | ||
206 | |||
207 | clk[VF610_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1", "pll3_usb_otg", PFD_PLL3_BASE, 0); | ||
208 | clk[VF610_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2", "pll3_usb_otg", PFD_PLL3_BASE, 1); | ||
209 | clk[VF610_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3", "pll3_usb_otg", PFD_PLL3_BASE, 2); | ||
210 | clk[VF610_CLK_PLL3_PFD4] = imx_clk_pfd("pll3_pfd4", "pll3_usb_otg", PFD_PLL3_BASE, 3); | ||
161 | 211 | ||
162 | clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5); | 212 | clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5); |
163 | clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5); | 213 | clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5); |
@@ -167,12 +217,12 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) | |||
167 | clk[VF610_CLK_PLATFORM_BUS] = imx_clk_divider("platform_bus", "sys_bus", CCM_CACRR, 3, 3); | 217 | clk[VF610_CLK_PLATFORM_BUS] = imx_clk_divider("platform_bus", "sys_bus", CCM_CACRR, 3, 3); |
168 | clk[VF610_CLK_IPG_BUS] = imx_clk_divider("ipg_bus", "platform_bus", CCM_CACRR, 11, 2); | 218 | clk[VF610_CLK_IPG_BUS] = imx_clk_divider("ipg_bus", "platform_bus", CCM_CACRR, 11, 2); |
169 | 219 | ||
170 | clk[VF610_CLK_PLL3_MAIN_DIV] = imx_clk_divider("pll3_main_div", "pll3_main", CCM_CACRR, 20, 1); | 220 | clk[VF610_CLK_PLL3_MAIN_DIV] = imx_clk_divider("pll3_usb_otg_div", "pll3_usb_otg", CCM_CACRR, 20, 1); |
171 | clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_main_div", "pll4_main", 0, CCM_CACRR, 6, 3, 0, pll4_main_div_table, &imx_ccm_lock); | 221 | clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_audio_div", "pll4_audio", 0, CCM_CACRR, 6, 3, 0, pll4_audio_div_table, &imx_ccm_lock); |
172 | clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_main_div", "pll6_main", CCM_CACRR, 21, 1); | 222 | clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_video_div", "pll6_video", CCM_CACRR, 21, 1); |
173 | 223 | ||
174 | clk[VF610_CLK_USBPHY0] = imx_clk_gate("usbphy0", "pll3_main", PLL3_CTRL, 6); | 224 | clk[VF610_CLK_USBPHY0] = imx_clk_gate("usbphy0", "pll3_usb_otg", PLL3_CTRL, 6); |
175 | clk[VF610_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll7_main", PLL7_CTRL, 6); | 225 | clk[VF610_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll7_usb_host", PLL7_CTRL, 6); |
176 | 226 | ||
177 | clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(4)); | 227 | clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(4)); |
178 | clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(4)); | 228 | clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(4)); |
@@ -191,8 +241,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) | |||
191 | clk[VF610_CLK_QSPI1_X1_DIV] = imx_clk_divider("qspi1_x1", "qspi1_x2", CCM_CSCDR3, 11, 1); | 241 | clk[VF610_CLK_QSPI1_X1_DIV] = imx_clk_divider("qspi1_x1", "qspi1_x2", CCM_CSCDR3, 11, 1); |
192 | clk[VF610_CLK_QSPI1] = imx_clk_gate2("qspi1", "qspi1_x1", CCM_CCGR8, CCM_CCGRx_CGn(4)); | 242 | clk[VF610_CLK_QSPI1] = imx_clk_gate2("qspi1", "qspi1_x1", CCM_CCGR8, CCM_CCGRx_CGn(4)); |
193 | 243 | ||
194 | clk[VF610_CLK_ENET_50M] = imx_clk_fixed_factor("enet_50m", "pll5_main", 1, 10); | 244 | clk[VF610_CLK_ENET_50M] = imx_clk_fixed_factor("enet_50m", "pll5_enet", 1, 10); |
195 | clk[VF610_CLK_ENET_25M] = imx_clk_fixed_factor("enet_25m", "pll5_main", 1, 20); | 245 | clk[VF610_CLK_ENET_25M] = imx_clk_fixed_factor("enet_25m", "pll5_enet", 1, 20); |
196 | clk[VF610_CLK_ENET_SEL] = imx_clk_mux("enet_sel", CCM_CSCMR2, 4, 2, rmii_sels, 4); | 246 | clk[VF610_CLK_ENET_SEL] = imx_clk_mux("enet_sel", CCM_CSCMR2, 4, 2, rmii_sels, 4); |
197 | clk[VF610_CLK_ENET_TS_SEL] = imx_clk_mux("enet_ts_sel", CCM_CSCMR2, 0, 3, enet_ts_sels, 7); | 247 | clk[VF610_CLK_ENET_TS_SEL] = imx_clk_mux("enet_ts_sel", CCM_CSCMR2, 0, 3, enet_ts_sels, 7); |
198 | clk[VF610_CLK_ENET] = imx_clk_gate("enet", "enet_sel", CCM_CSCDR1, 24); | 248 | clk[VF610_CLK_ENET] = imx_clk_gate("enet", "enet_sel", CCM_CSCDR1, 24); |
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h index 559c69a47731..7d11979da030 100644 --- a/arch/arm/mach-ixp4xx/include/mach/io.h +++ b/arch/arm/mach-ixp4xx/include/mach/io.h | |||
@@ -76,7 +76,7 @@ static inline void __indirect_writeb(u8 value, volatile void __iomem *p) | |||
76 | u32 n, byte_enables, data; | 76 | u32 n, byte_enables, data; |
77 | 77 | ||
78 | if (!is_pci_memory(addr)) { | 78 | if (!is_pci_memory(addr)) { |
79 | __raw_writeb(value, addr); | 79 | __raw_writeb(value, p); |
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
@@ -141,7 +141,7 @@ static inline unsigned char __indirect_readb(const volatile void __iomem *p) | |||
141 | u32 n, byte_enables, data; | 141 | u32 n, byte_enables, data; |
142 | 142 | ||
143 | if (!is_pci_memory(addr)) | 143 | if (!is_pci_memory(addr)) |
144 | return __raw_readb(addr); | 144 | return __raw_readb(p); |
145 | 145 | ||
146 | n = addr % 4; | 146 | n = addr % 4; |
147 | byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL; | 147 | byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL; |
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index 6478626e3ff6..d0d39f150fab 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c | |||
@@ -188,7 +188,7 @@ static void __init thermal_quirk(void) | |||
188 | 188 | ||
189 | static void __init mvebu_dt_init(void) | 189 | static void __init mvebu_dt_init(void) |
190 | { | 190 | { |
191 | if (of_machine_is_compatible("plathome,openblocks-ax3-4")) | 191 | if (of_machine_is_compatible("marvell,armadaxp")) |
192 | i2c_quirk(); | 192 | i2c_quirk(); |
193 | if (of_machine_is_compatible("marvell,a375-db")) { | 193 | if (of_machine_is_compatible("marvell,a375-db")) { |
194 | external_abort_quirk(); | 194 | external_abort_quirk(); |
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c index 2bdc3233abe2..044b51185fcc 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c | |||
@@ -400,6 +400,8 @@ int __init coherency_init(void) | |||
400 | type == COHERENCY_FABRIC_TYPE_ARMADA_380) | 400 | type == COHERENCY_FABRIC_TYPE_ARMADA_380) |
401 | armada_375_380_coherency_init(np); | 401 | armada_375_380_coherency_init(np); |
402 | 402 | ||
403 | of_node_put(np); | ||
404 | |||
403 | return 0; | 405 | return 0; |
404 | } | 406 | } |
405 | 407 | ||
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index 97767a27ca9d..e0ad64fde20e 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c | |||
@@ -21,8 +21,10 @@ | |||
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
23 | #include <linux/usb/musb.h> | 23 | #include <linux/usb/musb.h> |
24 | #include <linux/mmc/host.h> | ||
24 | #include <linux/platform_data/spi-omap2-mcspi.h> | 25 | #include <linux/platform_data/spi-omap2-mcspi.h> |
25 | #include <linux/platform_data/mtd-onenand-omap2.h> | 26 | #include <linux/platform_data/mtd-onenand-omap2.h> |
27 | #include <linux/platform_data/mmc-omap.h> | ||
26 | #include <linux/mfd/menelaus.h> | 28 | #include <linux/mfd/menelaus.h> |
27 | #include <sound/tlv320aic3x.h> | 29 | #include <sound/tlv320aic3x.h> |
28 | 30 | ||
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index ddfc8df83c6a..3d5040f82e90 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
@@ -484,7 +484,7 @@ static struct omap_mux_partition *partition; | |||
484 | * Current flows to eMMC when eMMC is off and the data lines are pulled up, | 484 | * Current flows to eMMC when eMMC is off and the data lines are pulled up, |
485 | * so pull them down. N.B. we pull 8 lines because we are using 8 lines. | 485 | * so pull them down. N.B. we pull 8 lines because we are using 8 lines. |
486 | */ | 486 | */ |
487 | static void rx51_mmc2_remux(struct device *dev, int slot, int power_on) | 487 | static void rx51_mmc2_remux(struct device *dev, int power_on) |
488 | { | 488 | { |
489 | if (power_on) | 489 | if (power_on) |
490 | omap_mux_write_array(partition, rx51_mmc2_on_mux); | 490 | omap_mux_write_array(partition, rx51_mmc2_on_mux); |
@@ -500,7 +500,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { | |||
500 | .cover_only = true, | 500 | .cover_only = true, |
501 | .gpio_cd = 160, | 501 | .gpio_cd = 160, |
502 | .gpio_wp = -EINVAL, | 502 | .gpio_wp = -EINVAL, |
503 | .power_saving = true, | ||
504 | }, | 503 | }, |
505 | { | 504 | { |
506 | .name = "internal", | 505 | .name = "internal", |
@@ -510,7 +509,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { | |||
510 | .gpio_cd = -EINVAL, | 509 | .gpio_cd = -EINVAL, |
511 | .gpio_wp = -EINVAL, | 510 | .gpio_wp = -EINVAL, |
512 | .nonremovable = true, | 511 | .nonremovable = true, |
513 | .power_saving = true, | ||
514 | .remux = rx51_mmc2_remux, | 512 | .remux = rx51_mmc2_remux, |
515 | }, | 513 | }, |
516 | {} /* Terminator */ | 514 | {} /* Terminator */ |
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index 07d4c7b35754..dc6e79c4484a 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c | |||
@@ -14,14 +14,15 @@ | |||
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
17 | #include <linux/mmc/host.h> | ||
17 | #include <linux/platform_data/gpio-omap.h> | 18 | #include <linux/platform_data/gpio-omap.h> |
19 | #include <linux/platform_data/hsmmc-omap.h> | ||
18 | 20 | ||
19 | #include "soc.h" | 21 | #include "soc.h" |
20 | #include "omap_device.h" | 22 | #include "omap_device.h" |
21 | #include "omap-pm.h" | 23 | #include "omap-pm.h" |
22 | 24 | ||
23 | #include "mux.h" | 25 | #include "mux.h" |
24 | #include "mmc.h" | ||
25 | #include "hsmmc.h" | 26 | #include "hsmmc.h" |
26 | #include "control.h" | 27 | #include "control.h" |
27 | 28 | ||
@@ -32,25 +33,14 @@ static u16 control_devconf1_offset; | |||
32 | 33 | ||
33 | #define HSMMC_NAME_LEN 9 | 34 | #define HSMMC_NAME_LEN 9 |
34 | 35 | ||
35 | #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) | 36 | static void omap_hsmmc1_before_set_reg(struct device *dev, |
36 | 37 | int power_on, int vdd) | |
37 | static int hsmmc_get_context_loss(struct device *dev) | ||
38 | { | ||
39 | return omap_pm_get_dev_context_loss_count(dev); | ||
40 | } | ||
41 | |||
42 | #else | ||
43 | #define hsmmc_get_context_loss NULL | ||
44 | #endif | ||
45 | |||
46 | static void omap_hsmmc1_before_set_reg(struct device *dev, int slot, | ||
47 | int power_on, int vdd) | ||
48 | { | 38 | { |
49 | u32 reg, prog_io; | 39 | u32 reg, prog_io; |
50 | struct omap_mmc_platform_data *mmc = dev->platform_data; | 40 | struct omap_hsmmc_platform_data *mmc = dev->platform_data; |
51 | 41 | ||
52 | if (mmc->slots[0].remux) | 42 | if (mmc->remux) |
53 | mmc->slots[0].remux(dev, slot, power_on); | 43 | mmc->remux(dev, power_on); |
54 | 44 | ||
55 | /* | 45 | /* |
56 | * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the | 46 | * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the |
@@ -72,7 +62,7 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot, | |||
72 | omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1); | 62 | omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1); |
73 | } | 63 | } |
74 | 64 | ||
75 | if (mmc->slots[0].internal_clock) { | 65 | if (mmc->internal_clock) { |
76 | reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | 66 | reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); |
77 | reg |= OMAP2_MMCSDIO1ADPCLKISEL; | 67 | reg |= OMAP2_MMCSDIO1ADPCLKISEL; |
78 | omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0); | 68 | omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0); |
@@ -96,8 +86,7 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot, | |||
96 | } | 86 | } |
97 | } | 87 | } |
98 | 88 | ||
99 | static void omap_hsmmc1_after_set_reg(struct device *dev, int slot, | 89 | static void omap_hsmmc1_after_set_reg(struct device *dev, int power_on, int vdd) |
100 | int power_on, int vdd) | ||
101 | { | 90 | { |
102 | u32 reg; | 91 | u32 reg; |
103 | 92 | ||
@@ -120,34 +109,32 @@ static void omap_hsmmc1_after_set_reg(struct device *dev, int slot, | |||
120 | } | 109 | } |
121 | } | 110 | } |
122 | 111 | ||
123 | static void hsmmc2_select_input_clk_src(struct omap_mmc_platform_data *mmc) | 112 | static void hsmmc2_select_input_clk_src(struct omap_hsmmc_platform_data *mmc) |
124 | { | 113 | { |
125 | u32 reg; | 114 | u32 reg; |
126 | 115 | ||
127 | reg = omap_ctrl_readl(control_devconf1_offset); | 116 | reg = omap_ctrl_readl(control_devconf1_offset); |
128 | if (mmc->slots[0].internal_clock) | 117 | if (mmc->internal_clock) |
129 | reg |= OMAP2_MMCSDIO2ADPCLKISEL; | 118 | reg |= OMAP2_MMCSDIO2ADPCLKISEL; |
130 | else | 119 | else |
131 | reg &= ~OMAP2_MMCSDIO2ADPCLKISEL; | 120 | reg &= ~OMAP2_MMCSDIO2ADPCLKISEL; |
132 | omap_ctrl_writel(reg, control_devconf1_offset); | 121 | omap_ctrl_writel(reg, control_devconf1_offset); |
133 | } | 122 | } |
134 | 123 | ||
135 | static void hsmmc2_before_set_reg(struct device *dev, int slot, | 124 | static void hsmmc2_before_set_reg(struct device *dev, int power_on, int vdd) |
136 | int power_on, int vdd) | ||
137 | { | 125 | { |
138 | struct omap_mmc_platform_data *mmc = dev->platform_data; | 126 | struct omap_hsmmc_platform_data *mmc = dev->platform_data; |
139 | 127 | ||
140 | if (mmc->slots[0].remux) | 128 | if (mmc->remux) |
141 | mmc->slots[0].remux(dev, slot, power_on); | 129 | mmc->remux(dev, power_on); |
142 | 130 | ||
143 | if (power_on) | 131 | if (power_on) |
144 | hsmmc2_select_input_clk_src(mmc); | 132 | hsmmc2_select_input_clk_src(mmc); |
145 | } | 133 | } |
146 | 134 | ||
147 | static int am35x_hsmmc2_set_power(struct device *dev, int slot, | 135 | static int am35x_hsmmc2_set_power(struct device *dev, int power_on, int vdd) |
148 | int power_on, int vdd) | ||
149 | { | 136 | { |
150 | struct omap_mmc_platform_data *mmc = dev->platform_data; | 137 | struct omap_hsmmc_platform_data *mmc = dev->platform_data; |
151 | 138 | ||
152 | if (power_on) | 139 | if (power_on) |
153 | hsmmc2_select_input_clk_src(mmc); | 140 | hsmmc2_select_input_clk_src(mmc); |
@@ -155,23 +142,22 @@ static int am35x_hsmmc2_set_power(struct device *dev, int slot, | |||
155 | return 0; | 142 | return 0; |
156 | } | 143 | } |
157 | 144 | ||
158 | static int nop_mmc_set_power(struct device *dev, int slot, int power_on, | 145 | static int nop_mmc_set_power(struct device *dev, int power_on, int vdd) |
159 | int vdd) | ||
160 | { | 146 | { |
161 | return 0; | 147 | return 0; |
162 | } | 148 | } |
163 | 149 | ||
164 | static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, | 150 | static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data |
165 | int controller_nr) | 151 | *mmc_controller, int controller_nr) |
166 | { | 152 | { |
167 | if (gpio_is_valid(mmc_controller->slots[0].switch_pin) && | 153 | if (gpio_is_valid(mmc_controller->switch_pin) && |
168 | (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES)) | 154 | (mmc_controller->switch_pin < OMAP_MAX_GPIO_LINES)) |
169 | omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, | 155 | omap_mux_init_gpio(mmc_controller->switch_pin, |
170 | OMAP_PIN_INPUT_PULLUP); | 156 | OMAP_PIN_INPUT_PULLUP); |
171 | if (gpio_is_valid(mmc_controller->slots[0].gpio_wp) && | 157 | if (gpio_is_valid(mmc_controller->gpio_wp) && |
172 | (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES)) | 158 | (mmc_controller->gpio_wp < OMAP_MAX_GPIO_LINES)) |
173 | omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, | 159 | omap_mux_init_gpio(mmc_controller->gpio_wp, |
174 | OMAP_PIN_INPUT_PULLUP); | 160 | OMAP_PIN_INPUT_PULLUP); |
175 | if (cpu_is_omap34xx()) { | 161 | if (cpu_is_omap34xx()) { |
176 | if (controller_nr == 0) { | 162 | if (controller_nr == 0) { |
177 | omap_mux_init_signal("sdmmc1_clk", | 163 | omap_mux_init_signal("sdmmc1_clk", |
@@ -180,7 +166,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, | |||
180 | OMAP_PIN_INPUT_PULLUP); | 166 | OMAP_PIN_INPUT_PULLUP); |
181 | omap_mux_init_signal("sdmmc1_dat0", | 167 | omap_mux_init_signal("sdmmc1_dat0", |
182 | OMAP_PIN_INPUT_PULLUP); | 168 | OMAP_PIN_INPUT_PULLUP); |
183 | if (mmc_controller->slots[0].caps & | 169 | if (mmc_controller->caps & |
184 | (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { | 170 | (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { |
185 | omap_mux_init_signal("sdmmc1_dat1", | 171 | omap_mux_init_signal("sdmmc1_dat1", |
186 | OMAP_PIN_INPUT_PULLUP); | 172 | OMAP_PIN_INPUT_PULLUP); |
@@ -189,7 +175,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, | |||
189 | omap_mux_init_signal("sdmmc1_dat3", | 175 | omap_mux_init_signal("sdmmc1_dat3", |
190 | OMAP_PIN_INPUT_PULLUP); | 176 | OMAP_PIN_INPUT_PULLUP); |
191 | } | 177 | } |
192 | if (mmc_controller->slots[0].caps & | 178 | if (mmc_controller->caps & |
193 | MMC_CAP_8_BIT_DATA) { | 179 | MMC_CAP_8_BIT_DATA) { |
194 | omap_mux_init_signal("sdmmc1_dat4", | 180 | omap_mux_init_signal("sdmmc1_dat4", |
195 | OMAP_PIN_INPUT_PULLUP); | 181 | OMAP_PIN_INPUT_PULLUP); |
@@ -214,7 +200,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, | |||
214 | * For 8 wire configurations, Lines DAT4, 5, 6 and 7 | 200 | * For 8 wire configurations, Lines DAT4, 5, 6 and 7 |
215 | * need to be muxed in the board-*.c files | 201 | * need to be muxed in the board-*.c files |
216 | */ | 202 | */ |
217 | if (mmc_controller->slots[0].caps & | 203 | if (mmc_controller->caps & |
218 | (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { | 204 | (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { |
219 | omap_mux_init_signal("sdmmc2_dat1", | 205 | omap_mux_init_signal("sdmmc2_dat1", |
220 | OMAP_PIN_INPUT_PULLUP); | 206 | OMAP_PIN_INPUT_PULLUP); |
@@ -223,7 +209,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, | |||
223 | omap_mux_init_signal("sdmmc2_dat3", | 209 | omap_mux_init_signal("sdmmc2_dat3", |
224 | OMAP_PIN_INPUT_PULLUP); | 210 | OMAP_PIN_INPUT_PULLUP); |
225 | } | 211 | } |
226 | if (mmc_controller->slots[0].caps & | 212 | if (mmc_controller->caps & |
227 | MMC_CAP_8_BIT_DATA) { | 213 | MMC_CAP_8_BIT_DATA) { |
228 | omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4", | 214 | omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4", |
229 | OMAP_PIN_INPUT_PULLUP); | 215 | OMAP_PIN_INPUT_PULLUP); |
@@ -243,7 +229,7 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, | |||
243 | } | 229 | } |
244 | 230 | ||
245 | static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | 231 | static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, |
246 | struct omap_mmc_platform_data *mmc) | 232 | struct omap_hsmmc_platform_data *mmc) |
247 | { | 233 | { |
248 | char *hc_name; | 234 | char *hc_name; |
249 | 235 | ||
@@ -259,38 +245,22 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | |||
259 | else | 245 | else |
260 | snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i", | 246 | snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i", |
261 | c->mmc, 1); | 247 | c->mmc, 1); |
262 | mmc->slots[0].name = hc_name; | 248 | mmc->name = hc_name; |
263 | mmc->nr_slots = 1; | 249 | mmc->caps = c->caps; |
264 | mmc->slots[0].caps = c->caps; | 250 | mmc->internal_clock = !c->ext_clock; |
265 | mmc->slots[0].pm_caps = c->pm_caps; | ||
266 | mmc->slots[0].internal_clock = !c->ext_clock; | ||
267 | mmc->max_freq = c->max_freq; | ||
268 | mmc->reg_offset = 0; | 251 | mmc->reg_offset = 0; |
269 | mmc->get_context_loss_count = hsmmc_get_context_loss; | ||
270 | 252 | ||
271 | mmc->slots[0].switch_pin = c->gpio_cd; | 253 | mmc->switch_pin = c->gpio_cd; |
272 | mmc->slots[0].gpio_wp = c->gpio_wp; | 254 | mmc->gpio_wp = c->gpio_wp; |
273 | 255 | ||
274 | mmc->slots[0].remux = c->remux; | 256 | mmc->remux = c->remux; |
275 | mmc->slots[0].init_card = c->init_card; | 257 | mmc->init_card = c->init_card; |
276 | 258 | ||
277 | if (c->cover_only) | 259 | if (c->cover_only) |
278 | mmc->slots[0].cover = 1; | 260 | mmc->cover = 1; |
279 | 261 | ||
280 | if (c->nonremovable) | 262 | if (c->nonremovable) |
281 | mmc->slots[0].nonremovable = 1; | 263 | mmc->nonremovable = 1; |
282 | |||
283 | if (c->power_saving) | ||
284 | mmc->slots[0].power_saving = 1; | ||
285 | |||
286 | if (c->no_off) | ||
287 | mmc->slots[0].no_off = 1; | ||
288 | |||
289 | if (c->no_off_init) | ||
290 | mmc->slots[0].no_regulator_off_init = c->no_off_init; | ||
291 | |||
292 | if (c->vcc_aux_disable_is_sleep) | ||
293 | mmc->slots[0].vcc_aux_disable_is_sleep = 1; | ||
294 | 264 | ||
295 | /* | 265 | /* |
296 | * NOTE: MMC slots should have a Vcc regulator set up. | 266 | * NOTE: MMC slots should have a Vcc regulator set up. |
@@ -300,42 +270,42 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | |||
300 | * temporary HACK: ocr_mask instead of fixed supply | 270 | * temporary HACK: ocr_mask instead of fixed supply |
301 | */ | 271 | */ |
302 | if (soc_is_am35xx()) | 272 | if (soc_is_am35xx()) |
303 | mmc->slots[0].ocr_mask = MMC_VDD_165_195 | | 273 | mmc->ocr_mask = MMC_VDD_165_195 | |
304 | MMC_VDD_26_27 | | 274 | MMC_VDD_26_27 | |
305 | MMC_VDD_27_28 | | 275 | MMC_VDD_27_28 | |
306 | MMC_VDD_29_30 | | 276 | MMC_VDD_29_30 | |
307 | MMC_VDD_30_31 | | 277 | MMC_VDD_30_31 | |
308 | MMC_VDD_31_32; | 278 | MMC_VDD_31_32; |
309 | else | 279 | else |
310 | mmc->slots[0].ocr_mask = c->ocr_mask; | 280 | mmc->ocr_mask = c->ocr_mask; |
311 | 281 | ||
312 | if (!soc_is_am35xx()) | 282 | if (!soc_is_am35xx()) |
313 | mmc->slots[0].features |= HSMMC_HAS_PBIAS; | 283 | mmc->features |= HSMMC_HAS_PBIAS; |
314 | 284 | ||
315 | switch (c->mmc) { | 285 | switch (c->mmc) { |
316 | case 1: | 286 | case 1: |
317 | if (mmc->slots[0].features & HSMMC_HAS_PBIAS) { | 287 | if (mmc->features & HSMMC_HAS_PBIAS) { |
318 | /* on-chip level shifting via PBIAS0/PBIAS1 */ | 288 | /* on-chip level shifting via PBIAS0/PBIAS1 */ |
319 | mmc->slots[0].before_set_reg = | 289 | mmc->before_set_reg = |
320 | omap_hsmmc1_before_set_reg; | 290 | omap_hsmmc1_before_set_reg; |
321 | mmc->slots[0].after_set_reg = | 291 | mmc->after_set_reg = |
322 | omap_hsmmc1_after_set_reg; | 292 | omap_hsmmc1_after_set_reg; |
323 | } | 293 | } |
324 | 294 | ||
325 | if (soc_is_am35xx()) | 295 | if (soc_is_am35xx()) |
326 | mmc->slots[0].set_power = nop_mmc_set_power; | 296 | mmc->set_power = nop_mmc_set_power; |
327 | 297 | ||
328 | /* OMAP3630 HSMMC1 supports only 4-bit */ | 298 | /* OMAP3630 HSMMC1 supports only 4-bit */ |
329 | if (cpu_is_omap3630() && | 299 | if (cpu_is_omap3630() && |
330 | (c->caps & MMC_CAP_8_BIT_DATA)) { | 300 | (c->caps & MMC_CAP_8_BIT_DATA)) { |
331 | c->caps &= ~MMC_CAP_8_BIT_DATA; | 301 | c->caps &= ~MMC_CAP_8_BIT_DATA; |
332 | c->caps |= MMC_CAP_4_BIT_DATA; | 302 | c->caps |= MMC_CAP_4_BIT_DATA; |
333 | mmc->slots[0].caps = c->caps; | 303 | mmc->caps = c->caps; |
334 | } | 304 | } |
335 | break; | 305 | break; |
336 | case 2: | 306 | case 2: |
337 | if (soc_is_am35xx()) | 307 | if (soc_is_am35xx()) |
338 | mmc->slots[0].set_power = am35x_hsmmc2_set_power; | 308 | mmc->set_power = am35x_hsmmc2_set_power; |
339 | 309 | ||
340 | if (c->ext_clock) | 310 | if (c->ext_clock) |
341 | c->transceiver = 1; | 311 | c->transceiver = 1; |
@@ -343,17 +313,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | |||
343 | c->caps &= ~MMC_CAP_8_BIT_DATA; | 313 | c->caps &= ~MMC_CAP_8_BIT_DATA; |
344 | c->caps |= MMC_CAP_4_BIT_DATA; | 314 | c->caps |= MMC_CAP_4_BIT_DATA; |
345 | } | 315 | } |
346 | if (mmc->slots[0].features & HSMMC_HAS_PBIAS) { | 316 | if (mmc->features & HSMMC_HAS_PBIAS) { |
347 | /* off-chip level shifting, or none */ | 317 | /* off-chip level shifting, or none */ |
348 | mmc->slots[0].before_set_reg = hsmmc2_before_set_reg; | 318 | mmc->before_set_reg = hsmmc2_before_set_reg; |
349 | mmc->slots[0].after_set_reg = NULL; | 319 | mmc->after_set_reg = NULL; |
350 | } | 320 | } |
351 | break; | 321 | break; |
352 | case 3: | 322 | case 3: |
353 | case 4: | 323 | case 4: |
354 | case 5: | 324 | case 5: |
355 | mmc->slots[0].before_set_reg = NULL; | 325 | mmc->before_set_reg = NULL; |
356 | mmc->slots[0].after_set_reg = NULL; | 326 | mmc->after_set_reg = NULL; |
357 | break; | 327 | break; |
358 | default: | 328 | default: |
359 | pr_err("MMC%d configuration not supported!\n", c->mmc); | 329 | pr_err("MMC%d configuration not supported!\n", c->mmc); |
@@ -368,7 +338,7 @@ static int omap_hsmmc_done; | |||
368 | void omap_hsmmc_late_init(struct omap2_hsmmc_info *c) | 338 | void omap_hsmmc_late_init(struct omap2_hsmmc_info *c) |
369 | { | 339 | { |
370 | struct platform_device *pdev; | 340 | struct platform_device *pdev; |
371 | struct omap_mmc_platform_data *mmc_pdata; | 341 | struct omap_hsmmc_platform_data *mmc_pdata; |
372 | int res; | 342 | int res; |
373 | 343 | ||
374 | if (omap_hsmmc_done != 1) | 344 | if (omap_hsmmc_done != 1) |
@@ -388,8 +358,8 @@ void omap_hsmmc_late_init(struct omap2_hsmmc_info *c) | |||
388 | if (!mmc_pdata) | 358 | if (!mmc_pdata) |
389 | continue; | 359 | continue; |
390 | 360 | ||
391 | mmc_pdata->slots[0].switch_pin = c->gpio_cd; | 361 | mmc_pdata->switch_pin = c->gpio_cd; |
392 | mmc_pdata->slots[0].gpio_wp = c->gpio_wp; | 362 | mmc_pdata->gpio_wp = c->gpio_wp; |
393 | 363 | ||
394 | res = omap_device_register(pdev); | 364 | res = omap_device_register(pdev); |
395 | if (res) | 365 | if (res) |
@@ -408,12 +378,12 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo, | |||
408 | struct omap_device *od; | 378 | struct omap_device *od; |
409 | struct platform_device *pdev; | 379 | struct platform_device *pdev; |
410 | char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; | 380 | char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; |
411 | struct omap_mmc_platform_data *mmc_data; | 381 | struct omap_hsmmc_platform_data *mmc_data; |
412 | struct omap_mmc_dev_attr *mmc_dev_attr; | 382 | struct omap_hsmmc_dev_attr *mmc_dev_attr; |
413 | char *name; | 383 | char *name; |
414 | int res; | 384 | int res; |
415 | 385 | ||
416 | mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL); | 386 | mmc_data = kzalloc(sizeof(*mmc_data), GFP_KERNEL); |
417 | if (!mmc_data) { | 387 | if (!mmc_data) { |
418 | pr_err("Cannot allocate memory for mmc device!\n"); | 388 | pr_err("Cannot allocate memory for mmc device!\n"); |
419 | return; | 389 | return; |
@@ -463,7 +433,7 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo, | |||
463 | } | 433 | } |
464 | 434 | ||
465 | res = platform_device_add_data(pdev, mmc_data, | 435 | res = platform_device_add_data(pdev, mmc_data, |
466 | sizeof(struct omap_mmc_platform_data)); | 436 | sizeof(struct omap_hsmmc_platform_data)); |
467 | if (res) { | 437 | if (res) { |
468 | pr_err("Could not add pdata for %s\n", name); | 438 | pr_err("Could not add pdata for %s\n", name); |
469 | goto put_pdev; | 439 | goto put_pdev; |
@@ -489,7 +459,7 @@ put_pdev: | |||
489 | platform_device_put(pdev); | 459 | platform_device_put(pdev); |
490 | 460 | ||
491 | free_name: | 461 | free_name: |
492 | kfree(mmc_data->slots[0].name); | 462 | kfree(mmc_data->name); |
493 | 463 | ||
494 | free_mmc: | 464 | free_mmc: |
495 | kfree(mmc_data); | 465 | kfree(mmc_data); |
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h index 7f2e790e0929..148cd9b15499 100644 --- a/arch/arm/mach-omap2/hsmmc.h +++ b/arch/arm/mach-omap2/hsmmc.h | |||
@@ -12,25 +12,18 @@ struct omap2_hsmmc_info { | |||
12 | u8 mmc; /* controller 1/2/3 */ | 12 | u8 mmc; /* controller 1/2/3 */ |
13 | u32 caps; /* 4/8 wires and any additional host | 13 | u32 caps; /* 4/8 wires and any additional host |
14 | * capabilities OR'd (ref. linux/mmc/host.h) */ | 14 | * capabilities OR'd (ref. linux/mmc/host.h) */ |
15 | u32 pm_caps; /* PM capabilities */ | ||
16 | bool transceiver; /* MMC-2 option */ | 15 | bool transceiver; /* MMC-2 option */ |
17 | bool ext_clock; /* use external pin for input clock */ | 16 | bool ext_clock; /* use external pin for input clock */ |
18 | bool cover_only; /* No card detect - just cover switch */ | 17 | bool cover_only; /* No card detect - just cover switch */ |
19 | bool nonremovable; /* Nonremovable e.g. eMMC */ | 18 | bool nonremovable; /* Nonremovable e.g. eMMC */ |
20 | bool power_saving; /* Try to sleep or power off when possible */ | ||
21 | bool no_off; /* power_saving and power is not to go off */ | ||
22 | bool no_off_init; /* no power off when not in MMC sleep state */ | ||
23 | bool vcc_aux_disable_is_sleep; /* Regulator off remapped to sleep */ | ||
24 | bool deferred; /* mmc needs a deferred probe */ | 19 | bool deferred; /* mmc needs a deferred probe */ |
25 | int gpio_cd; /* or -EINVAL */ | 20 | int gpio_cd; /* or -EINVAL */ |
26 | int gpio_wp; /* or -EINVAL */ | 21 | int gpio_wp; /* or -EINVAL */ |
27 | char *name; /* or NULL for default */ | 22 | char *name; /* or NULL for default */ |
28 | struct platform_device *pdev; /* mmc controller instance */ | 23 | struct platform_device *pdev; /* mmc controller instance */ |
29 | int ocr_mask; /* temporary HACK */ | 24 | int ocr_mask; /* temporary HACK */ |
30 | int max_freq; /* maximum clock, if constrained by external | ||
31 | * circuitry, or 0 for default */ | ||
32 | /* Remux (pad configuration) when powering on/off */ | 25 | /* Remux (pad configuration) when powering on/off */ |
33 | void (*remux)(struct device *dev, int slot, int power_on); | 26 | void (*remux)(struct device *dev, int power_on); |
34 | /* init some special card */ | 27 | /* init some special card */ |
35 | void (*init_card)(struct mmc_card *card); | 28 | void (*init_card)(struct mmc_card *card); |
36 | }; | 29 | }; |
diff --git a/arch/arm/mach-omap2/mmc.h b/arch/arm/mach-omap2/mmc.h index 0cd4b089da9c..30d39b97e7dd 100644 --- a/arch/arm/mach-omap2/mmc.h +++ b/arch/arm/mach-omap2/mmc.h | |||
@@ -1,5 +1,3 @@ | |||
1 | #include <linux/mmc/host.h> | ||
2 | #include <linux/platform_data/mmc-omap.h> | ||
3 | 1 | ||
4 | #define OMAP24XX_NR_MMC 2 | 2 | #define OMAP24XX_NR_MMC 2 |
5 | #define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE | 3 | #define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE |
@@ -7,14 +5,6 @@ | |||
7 | 5 | ||
8 | #define OMAP4_MMC_REG_OFFSET 0x100 | 6 | #define OMAP4_MMC_REG_OFFSET 0x100 |
9 | 7 | ||
10 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) | ||
11 | void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data); | ||
12 | #else | ||
13 | static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data) | ||
14 | { | ||
15 | } | ||
16 | #endif | ||
17 | |||
18 | struct omap_hwmod; | 8 | struct omap_hwmod; |
19 | int omap_msdi_reset(struct omap_hwmod *oh); | 9 | int omap_msdi_reset(struct omap_hwmod *oh); |
20 | 10 | ||
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index 16b20cedc38d..b7cb44abe49b 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include "soc.h" | 36 | #include "soc.h" |
37 | #include "iomap.h" | 37 | #include "iomap.h" |
38 | #include "common.h" | 38 | #include "common.h" |
39 | #include "mmc.h" | ||
40 | #include "prminst44xx.h" | 39 | #include "prminst44xx.h" |
41 | #include "prcm_mpu44xx.h" | 40 | #include "prcm_mpu44xx.h" |
42 | #include "omap4-sar-layout.h" | 41 | #include "omap4-sar-layout.h" |
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index d22c30d3ccfa..8c58b71c2727 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c | |||
@@ -917,6 +917,10 @@ static int __init omap_device_late_idle(struct device *dev, void *data) | |||
917 | static int __init omap_device_late_init(void) | 917 | static int __init omap_device_late_init(void) |
918 | { | 918 | { |
919 | bus_for_each_dev(&platform_bus_type, NULL, NULL, omap_device_late_idle); | 919 | bus_for_each_dev(&platform_bus_type, NULL, NULL, omap_device_late_idle); |
920 | |||
921 | WARN(!of_have_populated_dt(), | ||
922 | "legacy booting deprecated, please update to boot with .dts\n"); | ||
923 | |||
920 | return 0; | 924 | return 0; |
921 | } | 925 | } |
922 | omap_late_initcall_sync(omap_device_late_init); | 926 | omap_late_initcall_sync(omap_device_late_init); |
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index c2555cb95e71..79127b35fe60 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c | |||
@@ -15,12 +15,12 @@ | |||
15 | 15 | ||
16 | #include <linux/i2c-omap.h> | 16 | #include <linux/i2c-omap.h> |
17 | #include <linux/platform_data/asoc-ti-mcbsp.h> | 17 | #include <linux/platform_data/asoc-ti-mcbsp.h> |
18 | #include <linux/platform_data/hsmmc-omap.h> | ||
18 | #include <linux/platform_data/spi-omap2-mcspi.h> | 19 | #include <linux/platform_data/spi-omap2-mcspi.h> |
19 | #include <linux/omap-dma.h> | 20 | #include <linux/omap-dma.h> |
20 | #include <plat/dmtimer.h> | 21 | #include <plat/dmtimer.h> |
21 | 22 | ||
22 | #include "omap_hwmod.h" | 23 | #include "omap_hwmod.h" |
23 | #include "mmc.h" | ||
24 | #include "l3_2xxx.h" | 24 | #include "l3_2xxx.h" |
25 | 25 | ||
26 | #include "soc.h" | 26 | #include "soc.h" |
@@ -372,7 +372,7 @@ static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = { | |||
372 | { .role = "dbck", .clk = "mmchsdb1_fck" }, | 372 | { .role = "dbck", .clk = "mmchsdb1_fck" }, |
373 | }; | 373 | }; |
374 | 374 | ||
375 | static struct omap_mmc_dev_attr mmc1_dev_attr = { | 375 | static struct omap_hsmmc_dev_attr mmc1_dev_attr = { |
376 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, | 376 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, |
377 | }; | 377 | }; |
378 | 378 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c index a579b89ce9b7..cabc5695b504 100644 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | |||
@@ -15,10 +15,10 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/platform_data/gpio-omap.h> | 17 | #include <linux/platform_data/gpio-omap.h> |
18 | #include <linux/platform_data/hsmmc-omap.h> | ||
18 | #include <linux/platform_data/spi-omap2-mcspi.h> | 19 | #include <linux/platform_data/spi-omap2-mcspi.h> |
19 | #include "omap_hwmod.h" | 20 | #include "omap_hwmod.h" |
20 | #include "i2c.h" | 21 | #include "i2c.h" |
21 | #include "mmc.h" | ||
22 | #include "wd_timer.h" | 22 | #include "wd_timer.h" |
23 | #include "cm33xx.h" | 23 | #include "cm33xx.h" |
24 | #include "prm33xx.h" | 24 | #include "prm33xx.h" |
@@ -836,7 +836,7 @@ static struct omap_hwmod_class am33xx_mmc_hwmod_class = { | |||
836 | }; | 836 | }; |
837 | 837 | ||
838 | /* mmc0 */ | 838 | /* mmc0 */ |
839 | static struct omap_mmc_dev_attr am33xx_mmc0_dev_attr = { | 839 | static struct omap_hsmmc_dev_attr am33xx_mmc0_dev_attr = { |
840 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, | 840 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, |
841 | }; | 841 | }; |
842 | 842 | ||
@@ -854,7 +854,7 @@ struct omap_hwmod am33xx_mmc0_hwmod = { | |||
854 | }; | 854 | }; |
855 | 855 | ||
856 | /* mmc1 */ | 856 | /* mmc1 */ |
857 | static struct omap_mmc_dev_attr am33xx_mmc1_dev_attr = { | 857 | static struct omap_hsmmc_dev_attr am33xx_mmc1_dev_attr = { |
858 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, | 858 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, |
859 | }; | 859 | }; |
860 | 860 | ||
@@ -872,7 +872,7 @@ struct omap_hwmod am33xx_mmc1_hwmod = { | |||
872 | }; | 872 | }; |
873 | 873 | ||
874 | /* mmc2 */ | 874 | /* mmc2 */ |
875 | static struct omap_mmc_dev_attr am33xx_mmc2_dev_attr = { | 875 | static struct omap_hsmmc_dev_attr am33xx_mmc2_dev_attr = { |
876 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, | 876 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, |
877 | }; | 877 | }; |
878 | struct omap_hwmod am33xx_mmc2_hwmod = { | 878 | struct omap_hwmod am33xx_mmc2_hwmod = { |
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c index 6b406ca4bd3b..0cf7b563dcd1 100644 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "prm33xx.h" | 27 | #include "prm33xx.h" |
28 | #include "prm-regbits-33xx.h" | 28 | #include "prm-regbits-33xx.h" |
29 | #include "i2c.h" | 29 | #include "i2c.h" |
30 | #include "mmc.h" | ||
31 | #include "wd_timer.h" | 30 | #include "wd_timer.h" |
32 | #include "omap_hwmod_33xx_43xx_common_data.h" | 31 | #include "omap_hwmod_33xx_43xx_common_data.h" |
33 | 32 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 2a78b093c0ce..11468eea3871 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/i2c-omap.h> | 18 | #include <linux/i2c-omap.h> |
19 | #include <linux/power/smartreflex.h> | 19 | #include <linux/power/smartreflex.h> |
20 | #include <linux/platform_data/gpio-omap.h> | 20 | #include <linux/platform_data/gpio-omap.h> |
21 | #include <linux/platform_data/hsmmc-omap.h> | ||
21 | 22 | ||
22 | #include <linux/omap-dma.h> | 23 | #include <linux/omap-dma.h> |
23 | #include "l3_3xxx.h" | 24 | #include "l3_3xxx.h" |
@@ -37,7 +38,6 @@ | |||
37 | #include "cm-regbits-34xx.h" | 38 | #include "cm-regbits-34xx.h" |
38 | 39 | ||
39 | #include "i2c.h" | 40 | #include "i2c.h" |
40 | #include "mmc.h" | ||
41 | #include "wd_timer.h" | 41 | #include "wd_timer.h" |
42 | #include "serial.h" | 42 | #include "serial.h" |
43 | 43 | ||
@@ -1786,12 +1786,12 @@ static struct omap_hwmod_opt_clk omap34xx_mmc1_opt_clks[] = { | |||
1786 | { .role = "dbck", .clk = "omap_32k_fck", }, | 1786 | { .role = "dbck", .clk = "omap_32k_fck", }, |
1787 | }; | 1787 | }; |
1788 | 1788 | ||
1789 | static struct omap_mmc_dev_attr mmc1_dev_attr = { | 1789 | static struct omap_hsmmc_dev_attr mmc1_dev_attr = { |
1790 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, | 1790 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, |
1791 | }; | 1791 | }; |
1792 | 1792 | ||
1793 | /* See 35xx errata 2.1.1.128 in SPRZ278F */ | 1793 | /* See 35xx errata 2.1.1.128 in SPRZ278F */ |
1794 | static struct omap_mmc_dev_attr mmc1_pre_es3_dev_attr = { | 1794 | static struct omap_hsmmc_dev_attr mmc1_pre_es3_dev_attr = { |
1795 | .flags = (OMAP_HSMMC_SUPPORTS_DUAL_VOLT | | 1795 | .flags = (OMAP_HSMMC_SUPPORTS_DUAL_VOLT | |
1796 | OMAP_HSMMC_BROKEN_MULTIBLOCK_READ), | 1796 | OMAP_HSMMC_BROKEN_MULTIBLOCK_READ), |
1797 | }; | 1797 | }; |
@@ -1854,7 +1854,7 @@ static struct omap_hwmod_opt_clk omap34xx_mmc2_opt_clks[] = { | |||
1854 | }; | 1854 | }; |
1855 | 1855 | ||
1856 | /* See 35xx errata 2.1.1.128 in SPRZ278F */ | 1856 | /* See 35xx errata 2.1.1.128 in SPRZ278F */ |
1857 | static struct omap_mmc_dev_attr mmc2_pre_es3_dev_attr = { | 1857 | static struct omap_hsmmc_dev_attr mmc2_pre_es3_dev_attr = { |
1858 | .flags = OMAP_HSMMC_BROKEN_MULTIBLOCK_READ, | 1858 | .flags = OMAP_HSMMC_BROKEN_MULTIBLOCK_READ, |
1859 | }; | 1859 | }; |
1860 | 1860 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 44e5634bba34..d8a3cf1c1787 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/platform_data/gpio-omap.h> | 24 | #include <linux/platform_data/gpio-omap.h> |
25 | #include <linux/platform_data/hsmmc-omap.h> | ||
25 | #include <linux/power/smartreflex.h> | 26 | #include <linux/power/smartreflex.h> |
26 | #include <linux/i2c-omap.h> | 27 | #include <linux/i2c-omap.h> |
27 | 28 | ||
@@ -39,7 +40,6 @@ | |||
39 | #include "prm44xx.h" | 40 | #include "prm44xx.h" |
40 | #include "prm-regbits-44xx.h" | 41 | #include "prm-regbits-44xx.h" |
41 | #include "i2c.h" | 42 | #include "i2c.h" |
42 | #include "mmc.h" | ||
43 | #include "wd_timer.h" | 43 | #include "wd_timer.h" |
44 | 44 | ||
45 | /* Base offset for all OMAP4 interrupts external to MPUSS */ | 45 | /* Base offset for all OMAP4 interrupts external to MPUSS */ |
@@ -1952,7 +1952,7 @@ static struct omap_hwmod_dma_info omap44xx_mmc1_sdma_reqs[] = { | |||
1952 | }; | 1952 | }; |
1953 | 1953 | ||
1954 | /* mmc1 dev_attr */ | 1954 | /* mmc1 dev_attr */ |
1955 | static struct omap_mmc_dev_attr mmc1_dev_attr = { | 1955 | static struct omap_hsmmc_dev_attr mmc1_dev_attr = { |
1956 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, | 1956 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, |
1957 | }; | 1957 | }; |
1958 | 1958 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index 1103aa0e0d29..5ec786a76d3c 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/platform_data/gpio-omap.h> | 21 | #include <linux/platform_data/gpio-omap.h> |
22 | #include <linux/platform_data/hsmmc-omap.h> | ||
22 | #include <linux/power/smartreflex.h> | 23 | #include <linux/power/smartreflex.h> |
23 | #include <linux/i2c-omap.h> | 24 | #include <linux/i2c-omap.h> |
24 | 25 | ||
@@ -33,7 +34,6 @@ | |||
33 | #include "cm2_54xx.h" | 34 | #include "cm2_54xx.h" |
34 | #include "prm54xx.h" | 35 | #include "prm54xx.h" |
35 | #include "i2c.h" | 36 | #include "i2c.h" |
36 | #include "mmc.h" | ||
37 | #include "wd_timer.h" | 37 | #include "wd_timer.h" |
38 | 38 | ||
39 | /* Base offset for all OMAP5 interrupts external to MPUSS */ | 39 | /* Base offset for all OMAP5 interrupts external to MPUSS */ |
@@ -1269,7 +1269,7 @@ static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { | |||
1269 | }; | 1269 | }; |
1270 | 1270 | ||
1271 | /* mmc1 dev_attr */ | 1271 | /* mmc1 dev_attr */ |
1272 | static struct omap_mmc_dev_attr mmc1_dev_attr = { | 1272 | static struct omap_hsmmc_dev_attr mmc1_dev_attr = { |
1273 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, | 1273 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, |
1274 | }; | 1274 | }; |
1275 | 1275 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c index 5684f112654b..711c97e90990 100644 --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/platform_data/gpio-omap.h> | 21 | #include <linux/platform_data/gpio-omap.h> |
22 | #include <linux/platform_data/hsmmc-omap.h> | ||
22 | #include <linux/power/smartreflex.h> | 23 | #include <linux/power/smartreflex.h> |
23 | #include <linux/i2c-omap.h> | 24 | #include <linux/i2c-omap.h> |
24 | 25 | ||
@@ -33,7 +34,6 @@ | |||
33 | #include "cm2_7xx.h" | 34 | #include "cm2_7xx.h" |
34 | #include "prm7xx.h" | 35 | #include "prm7xx.h" |
35 | #include "i2c.h" | 36 | #include "i2c.h" |
36 | #include "mmc.h" | ||
37 | #include "wd_timer.h" | 37 | #include "wd_timer.h" |
38 | #include "soc.h" | 38 | #include "soc.h" |
39 | 39 | ||
@@ -1301,7 +1301,7 @@ static struct omap_hwmod_opt_clk mmc1_opt_clks[] = { | |||
1301 | }; | 1301 | }; |
1302 | 1302 | ||
1303 | /* mmc1 dev_attr */ | 1303 | /* mmc1 dev_attr */ |
1304 | static struct omap_mmc_dev_attr mmc1_dev_attr = { | 1304 | static struct omap_hsmmc_dev_attr mmc1_dev_attr = { |
1305 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, | 1305 | .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, |
1306 | }; | 1306 | }; |
1307 | 1307 | ||
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index c95346c94829..cec9d6c6442c 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c | |||
@@ -252,9 +252,6 @@ static void __init nokia_n900_legacy_init(void) | |||
252 | platform_device_register(&omap3_rom_rng_device); | 252 | platform_device_register(&omap3_rom_rng_device); |
253 | 253 | ||
254 | } | 254 | } |
255 | |||
256 | /* Only on some development boards */ | ||
257 | gpio_request_one(164, GPIOF_OUT_INIT_LOW, "smc91x reset"); | ||
258 | } | 255 | } |
259 | 256 | ||
260 | static void __init omap3_tao3530_legacy_init(void) | 257 | static void __init omap3_tao3530_legacy_init(void) |
diff --git a/arch/arm/mach-pxa/include/mach/addr-map.h b/arch/arm/mach-pxa/include/mach/addr-map.h index bbf9df37ad4b..d28fe291233a 100644 --- a/arch/arm/mach-pxa/include/mach/addr-map.h +++ b/arch/arm/mach-pxa/include/mach/addr-map.h | |||
@@ -39,6 +39,11 @@ | |||
39 | #define DMEMC_SIZE 0x00100000 | 39 | #define DMEMC_SIZE 0x00100000 |
40 | 40 | ||
41 | /* | 41 | /* |
42 | * Reserved space for low level debug virtual addresses within | ||
43 | * 0xf6200000..0xf6201000 | ||
44 | */ | ||
45 | |||
46 | /* | ||
42 | * Internal Memory Controller (PXA27x and later) | 47 | * Internal Memory Controller (PXA27x and later) |
43 | */ | 48 | */ |
44 | #define IMEMC_PHYS 0x58000000 | 49 | #define IMEMC_PHYS 0x58000000 |
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c index 0794f0426e70..19df9cb30495 100644 --- a/arch/arm/mach-shmobile/clock-r8a7740.c +++ b/arch/arm/mach-shmobile/clock-r8a7740.c | |||
@@ -455,7 +455,7 @@ enum { | |||
455 | MSTP128, MSTP127, MSTP125, | 455 | MSTP128, MSTP127, MSTP125, |
456 | MSTP116, MSTP111, MSTP100, MSTP117, | 456 | MSTP116, MSTP111, MSTP100, MSTP117, |
457 | 457 | ||
458 | MSTP230, | 458 | MSTP230, MSTP229, |
459 | MSTP222, | 459 | MSTP222, |
460 | MSTP218, MSTP217, MSTP216, MSTP214, | 460 | MSTP218, MSTP217, MSTP216, MSTP214, |
461 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 461 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
@@ -474,11 +474,12 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
474 | [MSTP127] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 27, 0), /* CEU20 */ | 474 | [MSTP127] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 27, 0), /* CEU20 */ |
475 | [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ | 475 | [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ |
476 | [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ | 476 | [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ |
477 | [MSTP116] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ | 477 | [MSTP116] = SH_CLK_MSTP32(&div4_clks[DIV4_HPP], SMSTPCR1, 16, 0), /* IIC0 */ |
478 | [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */ | 478 | [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */ |
479 | [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ | 479 | [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ |
480 | 480 | ||
481 | [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */ | 481 | [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */ |
482 | [MSTP229] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 29, 0), /* INTCA */ | ||
482 | [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */ | 483 | [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */ |
483 | [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */ | 484 | [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */ |
484 | [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */ | 485 | [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */ |
@@ -575,6 +576,10 @@ static struct clk_lookup lookups[] = { | |||
575 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), | 576 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), |
576 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), | 577 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), |
577 | CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]), | 578 | CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]), |
579 | CLKDEV_DEV_ID("renesas_intc_irqpin.0", &mstp_clks[MSTP229]), | ||
580 | CLKDEV_DEV_ID("renesas_intc_irqpin.1", &mstp_clks[MSTP229]), | ||
581 | CLKDEV_DEV_ID("renesas_intc_irqpin.2", &mstp_clks[MSTP229]), | ||
582 | CLKDEV_DEV_ID("renesas_intc_irqpin.3", &mstp_clks[MSTP229]), | ||
578 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), | 583 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), |
579 | CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]), | 584 | CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]), |
580 | 585 | ||
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c index 126ddafad526..f62265200592 100644 --- a/arch/arm/mach-shmobile/clock-r8a7790.c +++ b/arch/arm/mach-shmobile/clock-r8a7790.c | |||
@@ -68,7 +68,7 @@ | |||
68 | 68 | ||
69 | #define SDCKCR 0xE6150074 | 69 | #define SDCKCR 0xE6150074 |
70 | #define SD2CKCR 0xE6150078 | 70 | #define SD2CKCR 0xE6150078 |
71 | #define SD3CKCR 0xE615007C | 71 | #define SD3CKCR 0xE615026C |
72 | #define MMC0CKCR 0xE6150240 | 72 | #define MMC0CKCR 0xE6150240 |
73 | #define MMC1CKCR 0xE6150244 | 73 | #define MMC1CKCR 0xE6150244 |
74 | #define SSPCKCR 0xE6150248 | 74 | #define SSPCKCR 0xE6150248 |
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index b7bd8e509668..328657d011d5 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/input.h> | 28 | #include <linux/input.h> |
29 | #include <linux/i2c/i2c-sh_mobile.h> | ||
29 | #include <linux/io.h> | 30 | #include <linux/io.h> |
30 | #include <linux/serial_sci.h> | 31 | #include <linux/serial_sci.h> |
31 | #include <linux/sh_dma.h> | 32 | #include <linux/sh_dma.h> |
@@ -192,11 +193,18 @@ static struct resource i2c4_resources[] = { | |||
192 | }, | 193 | }, |
193 | }; | 194 | }; |
194 | 195 | ||
196 | static struct i2c_sh_mobile_platform_data i2c_platform_data = { | ||
197 | .clks_per_count = 2, | ||
198 | }; | ||
199 | |||
195 | static struct platform_device i2c0_device = { | 200 | static struct platform_device i2c0_device = { |
196 | .name = "i2c-sh_mobile", | 201 | .name = "i2c-sh_mobile", |
197 | .id = 0, | 202 | .id = 0, |
198 | .resource = i2c0_resources, | 203 | .resource = i2c0_resources, |
199 | .num_resources = ARRAY_SIZE(i2c0_resources), | 204 | .num_resources = ARRAY_SIZE(i2c0_resources), |
205 | .dev = { | ||
206 | .platform_data = &i2c_platform_data, | ||
207 | }, | ||
200 | }; | 208 | }; |
201 | 209 | ||
202 | static struct platform_device i2c1_device = { | 210 | static struct platform_device i2c1_device = { |
@@ -204,6 +212,9 @@ static struct platform_device i2c1_device = { | |||
204 | .id = 1, | 212 | .id = 1, |
205 | .resource = i2c1_resources, | 213 | .resource = i2c1_resources, |
206 | .num_resources = ARRAY_SIZE(i2c1_resources), | 214 | .num_resources = ARRAY_SIZE(i2c1_resources), |
215 | .dev = { | ||
216 | .platform_data = &i2c_platform_data, | ||
217 | }, | ||
207 | }; | 218 | }; |
208 | 219 | ||
209 | static struct platform_device i2c2_device = { | 220 | static struct platform_device i2c2_device = { |
@@ -211,6 +222,9 @@ static struct platform_device i2c2_device = { | |||
211 | .id = 2, | 222 | .id = 2, |
212 | .resource = i2c2_resources, | 223 | .resource = i2c2_resources, |
213 | .num_resources = ARRAY_SIZE(i2c2_resources), | 224 | .num_resources = ARRAY_SIZE(i2c2_resources), |
225 | .dev = { | ||
226 | .platform_data = &i2c_platform_data, | ||
227 | }, | ||
214 | }; | 228 | }; |
215 | 229 | ||
216 | static struct platform_device i2c3_device = { | 230 | static struct platform_device i2c3_device = { |
@@ -218,6 +232,9 @@ static struct platform_device i2c3_device = { | |||
218 | .id = 3, | 232 | .id = 3, |
219 | .resource = i2c3_resources, | 233 | .resource = i2c3_resources, |
220 | .num_resources = ARRAY_SIZE(i2c3_resources), | 234 | .num_resources = ARRAY_SIZE(i2c3_resources), |
235 | .dev = { | ||
236 | .platform_data = &i2c_platform_data, | ||
237 | }, | ||
221 | }; | 238 | }; |
222 | 239 | ||
223 | static struct platform_device i2c4_device = { | 240 | static struct platform_device i2c4_device = { |
@@ -225,6 +242,9 @@ static struct platform_device i2c4_device = { | |||
225 | .id = 4, | 242 | .id = 4, |
226 | .resource = i2c4_resources, | 243 | .resource = i2c4_resources, |
227 | .num_resources = ARRAY_SIZE(i2c4_resources), | 244 | .num_resources = ARRAY_SIZE(i2c4_resources), |
245 | .dev = { | ||
246 | .platform_data = &i2c_platform_data, | ||
247 | }, | ||
228 | }; | 248 | }; |
229 | 249 | ||
230 | static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = { | 250 | static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = { |
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c index da7be13aecce..ab95f5391a2b 100644 --- a/arch/arm/mach-tegra/irq.c +++ b/arch/arm/mach-tegra/irq.c | |||
@@ -99,42 +99,42 @@ static inline void tegra_irq_write_mask(unsigned int irq, unsigned long reg) | |||
99 | 99 | ||
100 | static void tegra_mask(struct irq_data *d) | 100 | static void tegra_mask(struct irq_data *d) |
101 | { | 101 | { |
102 | if (d->irq < FIRST_LEGACY_IRQ) | 102 | if (d->hwirq < FIRST_LEGACY_IRQ) |
103 | return; | 103 | return; |
104 | 104 | ||
105 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_CLR); | 105 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IER_CLR); |
106 | } | 106 | } |
107 | 107 | ||
108 | static void tegra_unmask(struct irq_data *d) | 108 | static void tegra_unmask(struct irq_data *d) |
109 | { | 109 | { |
110 | if (d->irq < FIRST_LEGACY_IRQ) | 110 | if (d->hwirq < FIRST_LEGACY_IRQ) |
111 | return; | 111 | return; |
112 | 112 | ||
113 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_SET); | 113 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IER_SET); |
114 | } | 114 | } |
115 | 115 | ||
116 | static void tegra_ack(struct irq_data *d) | 116 | static void tegra_ack(struct irq_data *d) |
117 | { | 117 | { |
118 | if (d->irq < FIRST_LEGACY_IRQ) | 118 | if (d->hwirq < FIRST_LEGACY_IRQ) |
119 | return; | 119 | return; |
120 | 120 | ||
121 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR); | 121 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IEP_FIR_CLR); |
122 | } | 122 | } |
123 | 123 | ||
124 | static void tegra_eoi(struct irq_data *d) | 124 | static void tegra_eoi(struct irq_data *d) |
125 | { | 125 | { |
126 | if (d->irq < FIRST_LEGACY_IRQ) | 126 | if (d->hwirq < FIRST_LEGACY_IRQ) |
127 | return; | 127 | return; |
128 | 128 | ||
129 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR); | 129 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IEP_FIR_CLR); |
130 | } | 130 | } |
131 | 131 | ||
132 | static int tegra_retrigger(struct irq_data *d) | 132 | static int tegra_retrigger(struct irq_data *d) |
133 | { | 133 | { |
134 | if (d->irq < FIRST_LEGACY_IRQ) | 134 | if (d->hwirq < FIRST_LEGACY_IRQ) |
135 | return 0; | 135 | return 0; |
136 | 136 | ||
137 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_SET); | 137 | tegra_irq_write_mask(d->hwirq, ICTLR_CPU_IEP_FIR_SET); |
138 | 138 | ||
139 | return 1; | 139 | return 1; |
140 | } | 140 | } |
@@ -142,7 +142,7 @@ static int tegra_retrigger(struct irq_data *d) | |||
142 | #ifdef CONFIG_PM_SLEEP | 142 | #ifdef CONFIG_PM_SLEEP |
143 | static int tegra_set_wake(struct irq_data *d, unsigned int enable) | 143 | static int tegra_set_wake(struct irq_data *d, unsigned int enable) |
144 | { | 144 | { |
145 | u32 irq = d->irq; | 145 | u32 irq = d->hwirq; |
146 | u32 index, mask; | 146 | u32 index, mask; |
147 | 147 | ||
148 | if (irq < FIRST_LEGACY_IRQ || | 148 | if (irq < FIRST_LEGACY_IRQ || |
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index ae69809a9e47..7eb94e6fc376 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -798,6 +798,7 @@ config NEED_KUSER_HELPERS | |||
798 | 798 | ||
799 | config KUSER_HELPERS | 799 | config KUSER_HELPERS |
800 | bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS | 800 | bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS |
801 | depends on MMU | ||
801 | default y | 802 | default y |
802 | help | 803 | help |
803 | Warning: disabling this option may break user programs. | 804 | Warning: disabling this option may break user programs. |
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 55f9d6e0cc88..5e65ca8dea62 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
@@ -956,7 +956,7 @@ static u32 cache_id_part_number_from_dt; | |||
956 | * @associativity: variable to return the calculated associativity in | 956 | * @associativity: variable to return the calculated associativity in |
957 | * @max_way_size: the maximum size in bytes for the cache ways | 957 | * @max_way_size: the maximum size in bytes for the cache ways |
958 | */ | 958 | */ |
959 | static void __init l2x0_cache_size_of_parse(const struct device_node *np, | 959 | static int __init l2x0_cache_size_of_parse(const struct device_node *np, |
960 | u32 *aux_val, u32 *aux_mask, | 960 | u32 *aux_val, u32 *aux_mask, |
961 | u32 *associativity, | 961 | u32 *associativity, |
962 | u32 max_way_size) | 962 | u32 max_way_size) |
@@ -974,7 +974,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, | |||
974 | of_property_read_u32(np, "cache-line-size", &line_size); | 974 | of_property_read_u32(np, "cache-line-size", &line_size); |
975 | 975 | ||
976 | if (!cache_size || !sets) | 976 | if (!cache_size || !sets) |
977 | return; | 977 | return -ENODEV; |
978 | 978 | ||
979 | /* All these l2 caches have the same line = block size actually */ | 979 | /* All these l2 caches have the same line = block size actually */ |
980 | if (!line_size) { | 980 | if (!line_size) { |
@@ -1009,7 +1009,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, | |||
1009 | 1009 | ||
1010 | if (way_size > max_way_size) { | 1010 | if (way_size > max_way_size) { |
1011 | pr_err("L2C OF: set size %dKB is too large\n", way_size); | 1011 | pr_err("L2C OF: set size %dKB is too large\n", way_size); |
1012 | return; | 1012 | return -EINVAL; |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | pr_info("L2C OF: override cache size: %d bytes (%dKB)\n", | 1015 | pr_info("L2C OF: override cache size: %d bytes (%dKB)\n", |
@@ -1027,7 +1027,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, | |||
1027 | if (way_size_bits < 1 || way_size_bits > 6) { | 1027 | if (way_size_bits < 1 || way_size_bits > 6) { |
1028 | pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n", | 1028 | pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n", |
1029 | way_size); | 1029 | way_size); |
1030 | return; | 1030 | return -EINVAL; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | mask |= L2C_AUX_CTRL_WAY_SIZE_MASK; | 1033 | mask |= L2C_AUX_CTRL_WAY_SIZE_MASK; |
@@ -1036,6 +1036,8 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, | |||
1036 | *aux_val &= ~mask; | 1036 | *aux_val &= ~mask; |
1037 | *aux_val |= val; | 1037 | *aux_val |= val; |
1038 | *aux_mask &= ~mask; | 1038 | *aux_mask &= ~mask; |
1039 | |||
1040 | return 0; | ||
1039 | } | 1041 | } |
1040 | 1042 | ||
1041 | static void __init l2x0_of_parse(const struct device_node *np, | 1043 | static void __init l2x0_of_parse(const struct device_node *np, |
@@ -1046,6 +1048,7 @@ static void __init l2x0_of_parse(const struct device_node *np, | |||
1046 | u32 dirty = 0; | 1048 | u32 dirty = 0; |
1047 | u32 val = 0, mask = 0; | 1049 | u32 val = 0, mask = 0; |
1048 | u32 assoc; | 1050 | u32 assoc; |
1051 | int ret; | ||
1049 | 1052 | ||
1050 | of_property_read_u32(np, "arm,tag-latency", &tag); | 1053 | of_property_read_u32(np, "arm,tag-latency", &tag); |
1051 | if (tag) { | 1054 | if (tag) { |
@@ -1068,7 +1071,10 @@ static void __init l2x0_of_parse(const struct device_node *np, | |||
1068 | val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT; | 1071 | val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT; |
1069 | } | 1072 | } |
1070 | 1073 | ||
1071 | l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K); | 1074 | ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K); |
1075 | if (ret) | ||
1076 | return; | ||
1077 | |||
1072 | if (assoc > 8) { | 1078 | if (assoc > 8) { |
1073 | pr_err("l2x0 of: cache setting yield too high associativity\n"); | 1079 | pr_err("l2x0 of: cache setting yield too high associativity\n"); |
1074 | pr_err("l2x0 of: %d calculated, max 8\n", assoc); | 1080 | pr_err("l2x0 of: %d calculated, max 8\n", assoc); |
@@ -1125,6 +1131,7 @@ static void __init l2c310_of_parse(const struct device_node *np, | |||
1125 | u32 tag[3] = { 0, 0, 0 }; | 1131 | u32 tag[3] = { 0, 0, 0 }; |
1126 | u32 filter[2] = { 0, 0 }; | 1132 | u32 filter[2] = { 0, 0 }; |
1127 | u32 assoc; | 1133 | u32 assoc; |
1134 | int ret; | ||
1128 | 1135 | ||
1129 | of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); | 1136 | of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); |
1130 | if (tag[0] && tag[1] && tag[2]) | 1137 | if (tag[0] && tag[1] && tag[2]) |
@@ -1152,7 +1159,10 @@ static void __init l2c310_of_parse(const struct device_node *np, | |||
1152 | l2x0_base + L310_ADDR_FILTER_START); | 1159 | l2x0_base + L310_ADDR_FILTER_START); |
1153 | } | 1160 | } |
1154 | 1161 | ||
1155 | l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K); | 1162 | ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K); |
1163 | if (ret) | ||
1164 | return; | ||
1165 | |||
1156 | switch (assoc) { | 1166 | switch (assoc) { |
1157 | case 16: | 1167 | case 16: |
1158 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1168 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
@@ -1164,8 +1174,8 @@ static void __init l2c310_of_parse(const struct device_node *np, | |||
1164 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1174 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
1165 | break; | 1175 | break; |
1166 | default: | 1176 | default: |
1167 | pr_err("PL310 OF: cache setting yield illegal associativity\n"); | 1177 | pr_err("L2C-310 OF cache associativity %d invalid, only 8 or 16 permitted\n", |
1168 | pr_err("PL310 OF: %d calculated, only 8 and 16 legal\n", assoc); | 1178 | assoc); |
1169 | break; | 1179 | break; |
1170 | } | 1180 | } |
1171 | } | 1181 | } |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index c245d903927f..e8907117861e 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -1198,7 +1198,6 @@ __iommu_alloc_remap(struct page **pages, size_t size, gfp_t gfp, pgprot_t prot, | |||
1198 | { | 1198 | { |
1199 | return dma_common_pages_remap(pages, size, | 1199 | return dma_common_pages_remap(pages, size, |
1200 | VM_ARM_DMA_CONSISTENT | VM_USERMAP, prot, caller); | 1200 | VM_ARM_DMA_CONSISTENT | VM_USERMAP, prot, caller); |
1201 | return NULL; | ||
1202 | } | 1201 | } |
1203 | 1202 | ||
1204 | /* | 1203 | /* |
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c index 45aeaaca9052..e17ed00828d7 100644 --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c | |||
@@ -127,8 +127,11 @@ void *kmap_atomic_pfn(unsigned long pfn) | |||
127 | { | 127 | { |
128 | unsigned long vaddr; | 128 | unsigned long vaddr; |
129 | int idx, type; | 129 | int idx, type; |
130 | struct page *page = pfn_to_page(pfn); | ||
130 | 131 | ||
131 | pagefault_disable(); | 132 | pagefault_disable(); |
133 | if (!PageHighMem(page)) | ||
134 | return page_address(page); | ||
132 | 135 | ||
133 | type = kmap_atomic_idx_push(); | 136 | type = kmap_atomic_idx_push(); |
134 | idx = type + KM_TYPE_NR * smp_processor_id(); | 137 | idx = type + KM_TYPE_NR * smp_processor_id(); |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 92bba32d9230..9481f85c56e6 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -559,10 +559,10 @@ void __init mem_init(void) | |||
559 | #ifdef CONFIG_MODULES | 559 | #ifdef CONFIG_MODULES |
560 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" | 560 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" |
561 | #endif | 561 | #endif |
562 | " .text : 0x%p" " - 0x%p" " (%4d kB)\n" | 562 | " .text : 0x%p" " - 0x%p" " (%4td kB)\n" |
563 | " .init : 0x%p" " - 0x%p" " (%4d kB)\n" | 563 | " .init : 0x%p" " - 0x%p" " (%4td kB)\n" |
564 | " .data : 0x%p" " - 0x%p" " (%4d kB)\n" | 564 | " .data : 0x%p" " - 0x%p" " (%4td kB)\n" |
565 | " .bss : 0x%p" " - 0x%p" " (%4d kB)\n", | 565 | " .bss : 0x%p" " - 0x%p" " (%4td kB)\n", |
566 | 566 | ||
567 | MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + | 567 | MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + |
568 | (PAGE_SIZE)), | 568 | (PAGE_SIZE)), |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index b3a947863ac7..22ac2a6fbfe3 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -270,7 +270,6 @@ __v7_pj4b_setup: | |||
270 | /* Auxiliary Debug Modes Control 1 Register */ | 270 | /* Auxiliary Debug Modes Control 1 Register */ |
271 | #define PJ4B_STATIC_BP (1 << 2) /* Enable Static BP */ | 271 | #define PJ4B_STATIC_BP (1 << 2) /* Enable Static BP */ |
272 | #define PJ4B_INTER_PARITY (1 << 8) /* Disable Internal Parity Handling */ | 272 | #define PJ4B_INTER_PARITY (1 << 8) /* Disable Internal Parity Handling */ |
273 | #define PJ4B_BCK_OFF_STREX (1 << 5) /* Enable the back off of STREX instr */ | ||
274 | #define PJ4B_CLEAN_LINE (1 << 16) /* Disable data transfer for clean line */ | 273 | #define PJ4B_CLEAN_LINE (1 << 16) /* Disable data transfer for clean line */ |
275 | 274 | ||
276 | /* Auxiliary Debug Modes Control 2 Register */ | 275 | /* Auxiliary Debug Modes Control 2 Register */ |
@@ -293,7 +292,6 @@ __v7_pj4b_setup: | |||
293 | /* Auxiliary Debug Modes Control 1 Register */ | 292 | /* Auxiliary Debug Modes Control 1 Register */ |
294 | mrc p15, 1, r0, c15, c1, 1 | 293 | mrc p15, 1, r0, c15, c1, 1 |
295 | orr r0, r0, #PJ4B_CLEAN_LINE | 294 | orr r0, r0, #PJ4B_CLEAN_LINE |
296 | orr r0, r0, #PJ4B_BCK_OFF_STREX | ||
297 | orr r0, r0, #PJ4B_INTER_PARITY | 295 | orr r0, r0, #PJ4B_INTER_PARITY |
298 | bic r0, r0, #PJ4B_STATIC_BP | 296 | bic r0, r0, #PJ4B_STATIC_BP |
299 | mcr p15, 1, r0, c15, c1, 1 | 297 | mcr p15, 1, r0, c15, c1, 1 |
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S index 23259f104c66..afa2b3c4df4a 100644 --- a/arch/arm/mm/proc-xscale.S +++ b/arch/arm/mm/proc-xscale.S | |||
@@ -535,7 +535,7 @@ ENTRY(cpu_xscale_do_suspend) | |||
535 | mrc p15, 0, r5, c15, c1, 0 @ CP access reg | 535 | mrc p15, 0, r5, c15, c1, 0 @ CP access reg |
536 | mrc p15, 0, r6, c13, c0, 0 @ PID | 536 | mrc p15, 0, r6, c13, c0, 0 @ PID |
537 | mrc p15, 0, r7, c3, c0, 0 @ domain ID | 537 | mrc p15, 0, r7, c3, c0, 0 @ domain ID |
538 | mrc p15, 0, r8, c1, c1, 0 @ auxiliary control reg | 538 | mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg |
539 | mrc p15, 0, r9, c1, c0, 0 @ control reg | 539 | mrc p15, 0, r9, c1, c0, 0 @ control reg |
540 | bic r4, r4, #2 @ clear frequency change bit | 540 | bic r4, r4, #2 @ clear frequency change bit |
541 | stmia r0, {r4 - r9} @ store cp regs | 541 | stmia r0, {r4 - r9} @ store cp regs |
@@ -552,7 +552,7 @@ ENTRY(cpu_xscale_do_resume) | |||
552 | mcr p15, 0, r6, c13, c0, 0 @ PID | 552 | mcr p15, 0, r6, c13, c0, 0 @ PID |
553 | mcr p15, 0, r7, c3, c0, 0 @ domain ID | 553 | mcr p15, 0, r7, c3, c0, 0 @ domain ID |
554 | mcr p15, 0, r1, c2, c0, 0 @ translation table base addr | 554 | mcr p15, 0, r1, c2, c0, 0 @ translation table base addr |
555 | mcr p15, 0, r8, c1, c1, 0 @ auxiliary control reg | 555 | mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg |
556 | mov r0, r9 @ control register | 556 | mov r0, r9 @ control register |
557 | b cpu_resume_mmu | 557 | b cpu_resume_mmu |
558 | ENDPROC(cpu_xscale_do_resume) | 558 | ENDPROC(cpu_xscale_do_resume) |
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c index b61a3bcc2fa8..e048f6198d68 100644 --- a/arch/arm/plat-orion/gpio.c +++ b/arch/arm/plat-orion/gpio.c | |||
@@ -497,6 +497,34 @@ static void orion_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
497 | #define orion_gpio_dbg_show NULL | 497 | #define orion_gpio_dbg_show NULL |
498 | #endif | 498 | #endif |
499 | 499 | ||
500 | static void orion_gpio_unmask_irq(struct irq_data *d) | ||
501 | { | ||
502 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
503 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
504 | u32 reg_val; | ||
505 | u32 mask = d->mask; | ||
506 | |||
507 | irq_gc_lock(gc); | ||
508 | reg_val = irq_reg_readl(gc->reg_base + ct->regs.mask); | ||
509 | reg_val |= mask; | ||
510 | irq_reg_writel(reg_val, gc->reg_base + ct->regs.mask); | ||
511 | irq_gc_unlock(gc); | ||
512 | } | ||
513 | |||
514 | static void orion_gpio_mask_irq(struct irq_data *d) | ||
515 | { | ||
516 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
517 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
518 | u32 mask = d->mask; | ||
519 | u32 reg_val; | ||
520 | |||
521 | irq_gc_lock(gc); | ||
522 | reg_val = irq_reg_readl(gc->reg_base + ct->regs.mask); | ||
523 | reg_val &= ~mask; | ||
524 | irq_reg_writel(reg_val, gc->reg_base + ct->regs.mask); | ||
525 | irq_gc_unlock(gc); | ||
526 | } | ||
527 | |||
500 | void __init orion_gpio_init(struct device_node *np, | 528 | void __init orion_gpio_init(struct device_node *np, |
501 | int gpio_base, int ngpio, | 529 | int gpio_base, int ngpio, |
502 | void __iomem *base, int mask_offset, | 530 | void __iomem *base, int mask_offset, |
@@ -565,8 +593,8 @@ void __init orion_gpio_init(struct device_node *np, | |||
565 | ct = gc->chip_types; | 593 | ct = gc->chip_types; |
566 | ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF; | 594 | ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF; |
567 | ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW; | 595 | ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW; |
568 | ct->chip.irq_mask = irq_gc_mask_clr_bit; | 596 | ct->chip.irq_mask = orion_gpio_mask_irq; |
569 | ct->chip.irq_unmask = irq_gc_mask_set_bit; | 597 | ct->chip.irq_unmask = orion_gpio_unmask_irq; |
570 | ct->chip.irq_set_type = gpio_irq_set_type; | 598 | ct->chip.irq_set_type = gpio_irq_set_type; |
571 | ct->chip.name = ochip->chip.label; | 599 | ct->chip.name = ochip->chip.label; |
572 | 600 | ||
@@ -575,8 +603,8 @@ void __init orion_gpio_init(struct device_node *np, | |||
575 | ct->regs.ack = GPIO_EDGE_CAUSE_OFF; | 603 | ct->regs.ack = GPIO_EDGE_CAUSE_OFF; |
576 | ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; | 604 | ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; |
577 | ct->chip.irq_ack = irq_gc_ack_clr_bit; | 605 | ct->chip.irq_ack = irq_gc_ack_clr_bit; |
578 | ct->chip.irq_mask = irq_gc_mask_clr_bit; | 606 | ct->chip.irq_mask = orion_gpio_mask_irq; |
579 | ct->chip.irq_unmask = irq_gc_mask_set_bit; | 607 | ct->chip.irq_unmask = orion_gpio_unmask_irq; |
580 | ct->chip.irq_set_type = gpio_irq_set_type; | 608 | ct->chip.irq_set_type = gpio_irq_set_type; |
581 | ct->handler = handle_edge_irq; | 609 | ct->handler = handle_edge_irq; |
582 | ct->chip.name = ochip->chip.label; | 610 | ct->chip.name = ochip->chip.label; |
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi index 295c72d52a1f..f1ad9c2ab2e9 100644 --- a/arch/arm64/boot/dts/apm-storm.dtsi +++ b/arch/arm64/boot/dts/apm-storm.dtsi | |||
@@ -599,7 +599,7 @@ | |||
599 | compatible = "apm,xgene-enet"; | 599 | compatible = "apm,xgene-enet"; |
600 | status = "disabled"; | 600 | status = "disabled"; |
601 | reg = <0x0 0x17020000 0x0 0xd100>, | 601 | reg = <0x0 0x17020000 0x0 0xd100>, |
602 | <0x0 0X17030000 0x0 0X400>, | 602 | <0x0 0X17030000 0x0 0Xc300>, |
603 | <0x0 0X10000000 0x0 0X200>; | 603 | <0x0 0X10000000 0x0 0X200>; |
604 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; | 604 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; |
605 | interrupts = <0x0 0x3c 0x4>; | 605 | interrupts = <0x0 0x3c 0x4>; |
@@ -624,9 +624,9 @@ | |||
624 | sgenet0: ethernet@1f210000 { | 624 | sgenet0: ethernet@1f210000 { |
625 | compatible = "apm,xgene-enet"; | 625 | compatible = "apm,xgene-enet"; |
626 | status = "disabled"; | 626 | status = "disabled"; |
627 | reg = <0x0 0x1f210000 0x0 0x10000>, | 627 | reg = <0x0 0x1f210000 0x0 0xd100>, |
628 | <0x0 0x1f200000 0x0 0X10000>, | 628 | <0x0 0x1f200000 0x0 0Xc300>, |
629 | <0x0 0x1B000000 0x0 0X20000>; | 629 | <0x0 0x1B000000 0x0 0X200>; |
630 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; | 630 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; |
631 | interrupts = <0x0 0xA0 0x4>; | 631 | interrupts = <0x0 0xA0 0x4>; |
632 | dma-coherent; | 632 | dma-coherent; |
@@ -639,7 +639,7 @@ | |||
639 | compatible = "apm,xgene-enet"; | 639 | compatible = "apm,xgene-enet"; |
640 | status = "disabled"; | 640 | status = "disabled"; |
641 | reg = <0x0 0x1f610000 0x0 0xd100>, | 641 | reg = <0x0 0x1f610000 0x0 0xd100>, |
642 | <0x0 0x1f600000 0x0 0X400>, | 642 | <0x0 0x1f600000 0x0 0Xc300>, |
643 | <0x0 0x18000000 0x0 0X200>; | 643 | <0x0 0x18000000 0x0 0X200>; |
644 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; | 644 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; |
645 | interrupts = <0x0 0x60 0x4>; | 645 | interrupts = <0x0 0x60 0x4>; |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 4ce602c2c6de..dd301be89ecc 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -35,6 +35,9 @@ CONFIG_MODULE_UNLOAD=y | |||
35 | CONFIG_ARCH_THUNDER=y | 35 | CONFIG_ARCH_THUNDER=y |
36 | CONFIG_ARCH_VEXPRESS=y | 36 | CONFIG_ARCH_VEXPRESS=y |
37 | CONFIG_ARCH_XGENE=y | 37 | CONFIG_ARCH_XGENE=y |
38 | CONFIG_PCI=y | ||
39 | CONFIG_PCI_MSI=y | ||
40 | CONFIG_PCI_XGENE=y | ||
38 | CONFIG_SMP=y | 41 | CONFIG_SMP=y |
39 | CONFIG_PREEMPT=y | 42 | CONFIG_PREEMPT=y |
40 | CONFIG_KSM=y | 43 | CONFIG_KSM=y |
@@ -52,6 +55,7 @@ CONFIG_IP_PNP_DHCP=y | |||
52 | CONFIG_IP_PNP_BOOTP=y | 55 | CONFIG_IP_PNP_BOOTP=y |
53 | # CONFIG_INET_LRO is not set | 56 | # CONFIG_INET_LRO is not set |
54 | # CONFIG_IPV6 is not set | 57 | # CONFIG_IPV6 is not set |
58 | CONFIG_BPF_JIT=y | ||
55 | # CONFIG_WIRELESS is not set | 59 | # CONFIG_WIRELESS is not set |
56 | CONFIG_NET_9P=y | 60 | CONFIG_NET_9P=y |
57 | CONFIG_NET_9P_VIRTIO=y | 61 | CONFIG_NET_9P_VIRTIO=y |
@@ -65,16 +69,17 @@ CONFIG_VIRTIO_BLK=y | |||
65 | CONFIG_BLK_DEV_SD=y | 69 | CONFIG_BLK_DEV_SD=y |
66 | # CONFIG_SCSI_LOWLEVEL is not set | 70 | # CONFIG_SCSI_LOWLEVEL is not set |
67 | CONFIG_ATA=y | 71 | CONFIG_ATA=y |
72 | CONFIG_SATA_AHCI=y | ||
73 | CONFIG_SATA_AHCI_PLATFORM=y | ||
68 | CONFIG_AHCI_XGENE=y | 74 | CONFIG_AHCI_XGENE=y |
69 | CONFIG_PHY_XGENE=y | ||
70 | CONFIG_PATA_PLATFORM=y | 75 | CONFIG_PATA_PLATFORM=y |
71 | CONFIG_PATA_OF_PLATFORM=y | 76 | CONFIG_PATA_OF_PLATFORM=y |
72 | CONFIG_NETDEVICES=y | 77 | CONFIG_NETDEVICES=y |
73 | CONFIG_TUN=y | 78 | CONFIG_TUN=y |
74 | CONFIG_VIRTIO_NET=y | 79 | CONFIG_VIRTIO_NET=y |
80 | CONFIG_NET_XGENE=y | ||
75 | CONFIG_SMC91X=y | 81 | CONFIG_SMC91X=y |
76 | CONFIG_SMSC911X=y | 82 | CONFIG_SMSC911X=y |
77 | CONFIG_NET_XGENE=y | ||
78 | # CONFIG_WLAN is not set | 83 | # CONFIG_WLAN is not set |
79 | CONFIG_INPUT_EVDEV=y | 84 | CONFIG_INPUT_EVDEV=y |
80 | # CONFIG_SERIO_SERPORT is not set | 85 | # CONFIG_SERIO_SERPORT is not set |
@@ -87,6 +92,11 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | |||
87 | CONFIG_SERIAL_OF_PLATFORM=y | 92 | CONFIG_SERIAL_OF_PLATFORM=y |
88 | CONFIG_VIRTIO_CONSOLE=y | 93 | CONFIG_VIRTIO_CONSOLE=y |
89 | # CONFIG_HW_RANDOM is not set | 94 | # CONFIG_HW_RANDOM is not set |
95 | # CONFIG_HMC_DRV is not set | ||
96 | CONFIG_SPI=y | ||
97 | CONFIG_SPI_PL022=y | ||
98 | CONFIG_GPIO_PL061=y | ||
99 | CONFIG_GPIO_XGENE=y | ||
90 | # CONFIG_HWMON is not set | 100 | # CONFIG_HWMON is not set |
91 | CONFIG_REGULATOR=y | 101 | CONFIG_REGULATOR=y |
92 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | 102 | CONFIG_REGULATOR_FIXED_VOLTAGE=y |
@@ -97,13 +107,25 @@ CONFIG_LOGO=y | |||
97 | # CONFIG_LOGO_LINUX_MONO is not set | 107 | # CONFIG_LOGO_LINUX_MONO is not set |
98 | # CONFIG_LOGO_LINUX_VGA16 is not set | 108 | # CONFIG_LOGO_LINUX_VGA16 is not set |
99 | CONFIG_USB=y | 109 | CONFIG_USB=y |
110 | CONFIG_USB_EHCI_HCD=y | ||
111 | CONFIG_USB_EHCI_HCD_PLATFORM=y | ||
100 | CONFIG_USB_ISP1760_HCD=y | 112 | CONFIG_USB_ISP1760_HCD=y |
113 | CONFIG_USB_OHCI_HCD=y | ||
114 | CONFIG_USB_OHCI_HCD_PLATFORM=y | ||
101 | CONFIG_USB_STORAGE=y | 115 | CONFIG_USB_STORAGE=y |
116 | CONFIG_USB_ULPI=y | ||
102 | CONFIG_MMC=y | 117 | CONFIG_MMC=y |
103 | CONFIG_MMC_ARMMMCI=y | 118 | CONFIG_MMC_ARMMMCI=y |
119 | CONFIG_MMC_SDHCI=y | ||
120 | CONFIG_MMC_SDHCI_PLTFM=y | ||
121 | CONFIG_MMC_SPI=y | ||
122 | CONFIG_RTC_CLASS=y | ||
123 | CONFIG_RTC_DRV_EFI=y | ||
124 | CONFIG_RTC_DRV_XGENE=y | ||
104 | CONFIG_VIRTIO_BALLOON=y | 125 | CONFIG_VIRTIO_BALLOON=y |
105 | CONFIG_VIRTIO_MMIO=y | 126 | CONFIG_VIRTIO_MMIO=y |
106 | # CONFIG_IOMMU_SUPPORT is not set | 127 | # CONFIG_IOMMU_SUPPORT is not set |
128 | CONFIG_PHY_XGENE=y | ||
107 | CONFIG_EXT2_FS=y | 129 | CONFIG_EXT2_FS=y |
108 | CONFIG_EXT3_FS=y | 130 | CONFIG_EXT3_FS=y |
109 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 131 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index ccc7087d3c4e..a62cd077457b 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h | |||
@@ -142,7 +142,7 @@ static inline void *phys_to_virt(phys_addr_t x) | |||
142 | * virt_to_page(k) convert a _valid_ virtual address to struct page * | 142 | * virt_to_page(k) convert a _valid_ virtual address to struct page * |
143 | * virt_addr_valid(k) indicates whether a virtual address is valid | 143 | * virt_addr_valid(k) indicates whether a virtual address is valid |
144 | */ | 144 | */ |
145 | #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET | 145 | #define ARCH_PFN_OFFSET ((unsigned long)PHYS_PFN_OFFSET) |
146 | 146 | ||
147 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 147 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
148 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 148 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 812f19212b23..8893cebcea5b 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h | |||
@@ -793,3 +793,5 @@ __SYSCALL(__NR_seccomp, sys_seccomp) | |||
793 | __SYSCALL(__NR_getrandom, sys_getrandom) | 793 | __SYSCALL(__NR_getrandom, sys_getrandom) |
794 | #define __NR_memfd_create 385 | 794 | #define __NR_memfd_create 385 |
795 | __SYSCALL(__NR_memfd_create, sys_memfd_create) | 795 | __SYSCALL(__NR_memfd_create, sys_memfd_create) |
796 | #define __NR_bpf 386 | ||
797 | __SYSCALL(__NR_bpf, sys_bpf) | ||
diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S index a0016d3a17da..8ce9b0577442 100644 --- a/arch/arm64/kernel/efi-entry.S +++ b/arch/arm64/kernel/efi-entry.S | |||
@@ -54,10 +54,10 @@ ENTRY(efi_stub_entry) | |||
54 | b.eq efi_load_fail | 54 | b.eq efi_load_fail |
55 | 55 | ||
56 | /* | 56 | /* |
57 | * efi_entry() will have relocated the kernel image if necessary | 57 | * efi_entry() will have copied the kernel image if necessary and we |
58 | * and we return here with device tree address in x0 and the kernel | 58 | * return here with device tree address in x0 and the kernel entry |
59 | * entry point stored at *image_addr. Save those values in registers | 59 | * point stored at *image_addr. Save those values in registers which |
60 | * which are callee preserved. | 60 | * are callee preserved. |
61 | */ | 61 | */ |
62 | mov x20, x0 // DTB address | 62 | mov x20, x0 // DTB address |
63 | ldr x0, [sp, #16] // relocated _text address | 63 | ldr x0, [sp, #16] // relocated _text address |
@@ -65,8 +65,7 @@ ENTRY(efi_stub_entry) | |||
65 | add x21, x0, x21 | 65 | add x21, x0, x21 |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Flush dcache covering current runtime addresses | 68 | * Calculate size of the kernel Image (same for original and copy). |
69 | * of kernel text/data. Then flush all of icache. | ||
70 | */ | 69 | */ |
71 | adrp x1, _text | 70 | adrp x1, _text |
72 | add x1, x1, #:lo12:_text | 71 | add x1, x1, #:lo12:_text |
@@ -74,9 +73,24 @@ ENTRY(efi_stub_entry) | |||
74 | add x2, x2, #:lo12:_edata | 73 | add x2, x2, #:lo12:_edata |
75 | sub x1, x2, x1 | 74 | sub x1, x2, x1 |
76 | 75 | ||
76 | /* | ||
77 | * Flush the copied Image to the PoC, and ensure it is not shadowed by | ||
78 | * stale icache entries from before relocation. | ||
79 | */ | ||
77 | bl __flush_dcache_area | 80 | bl __flush_dcache_area |
78 | ic ialluis | 81 | ic ialluis |
79 | 82 | ||
83 | /* | ||
84 | * Ensure that the rest of this function (in the original Image) is | ||
85 | * visible when the caches are disabled. The I-cache can't have stale | ||
86 | * entries for the VA range of the current image, so no maintenance is | ||
87 | * necessary. | ||
88 | */ | ||
89 | adr x0, efi_stub_entry | ||
90 | adr x1, efi_stub_entry_end | ||
91 | sub x1, x1, x0 | ||
92 | bl __flush_dcache_area | ||
93 | |||
80 | /* Turn off Dcache and MMU */ | 94 | /* Turn off Dcache and MMU */ |
81 | mrs x0, CurrentEL | 95 | mrs x0, CurrentEL |
82 | cmp x0, #CurrentEL_EL2 | 96 | cmp x0, #CurrentEL_EL2 |
@@ -106,4 +120,5 @@ efi_load_fail: | |||
106 | ldp x29, x30, [sp], #32 | 120 | ldp x29, x30, [sp], #32 |
107 | ret | 121 | ret |
108 | 122 | ||
123 | efi_stub_entry_end: | ||
109 | ENDPROC(efi_stub_entry) | 124 | ENDPROC(efi_stub_entry) |
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c index 819e409029ce..7e9327a0986d 100644 --- a/arch/arm64/kernel/insn.c +++ b/arch/arm64/kernel/insn.c | |||
@@ -163,9 +163,10 @@ static int __kprobes aarch64_insn_patch_text_cb(void *arg) | |||
163 | * which ends with "dsb; isb" pair guaranteeing global | 163 | * which ends with "dsb; isb" pair guaranteeing global |
164 | * visibility. | 164 | * visibility. |
165 | */ | 165 | */ |
166 | atomic_set(&pp->cpu_count, -1); | 166 | /* Notify other processors with an additional increment. */ |
167 | atomic_inc(&pp->cpu_count); | ||
167 | } else { | 168 | } else { |
168 | while (atomic_read(&pp->cpu_count) != -1) | 169 | while (atomic_read(&pp->cpu_count) <= num_online_cpus()) |
169 | cpu_relax(); | 170 | cpu_relax(); |
170 | isb(); | 171 | isb(); |
171 | } | 172 | } |
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index 866c1c821860..663da771580a 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c | |||
@@ -528,7 +528,7 @@ static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index) | |||
528 | if (WARN_ON_ONCE(!index)) | 528 | if (WARN_ON_ONCE(!index)) |
529 | return -EINVAL; | 529 | return -EINVAL; |
530 | 530 | ||
531 | if (state->type == PSCI_POWER_STATE_TYPE_STANDBY) | 531 | if (state[index - 1].type == PSCI_POWER_STATE_TYPE_STANDBY) |
532 | ret = psci_ops.cpu_suspend(state[index - 1], 0); | 532 | ret = psci_ops.cpu_suspend(state[index - 1], 0); |
533 | else | 533 | else |
534 | ret = __cpu_suspend(index, psci_suspend_finisher); | 534 | ret = __cpu_suspend(index, psci_suspend_finisher); |
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 4cc3b719208e..3d7c2df89946 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c | |||
@@ -424,6 +424,11 @@ static const struct sys_reg_desc sys_reg_descs[] = { | |||
424 | /* VBAR_EL1 */ | 424 | /* VBAR_EL1 */ |
425 | { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b0000), Op2(0b000), | 425 | { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b0000), Op2(0b000), |
426 | NULL, reset_val, VBAR_EL1, 0 }, | 426 | NULL, reset_val, VBAR_EL1, 0 }, |
427 | |||
428 | /* ICC_SRE_EL1 */ | ||
429 | { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b1100), Op2(0b101), | ||
430 | trap_raz_wi }, | ||
431 | |||
427 | /* CONTEXTIDR_EL1 */ | 432 | /* CONTEXTIDR_EL1 */ |
428 | { Op0(0b11), Op1(0b000), CRn(0b1101), CRm(0b0000), Op2(0b001), | 433 | { Op0(0b11), Op1(0b000), CRn(0b1101), CRm(0b0000), Op2(0b001), |
429 | access_vm_reg, reset_val, CONTEXTIDR_EL1, 0 }, | 434 | access_vm_reg, reset_val, CONTEXTIDR_EL1, 0 }, |
@@ -690,6 +695,10 @@ static const struct sys_reg_desc cp15_regs[] = { | |||
690 | { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR }, | 695 | { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR }, |
691 | { Op1( 0), CRn(10), CRm( 3), Op2( 0), access_vm_reg, NULL, c10_AMAIR0 }, | 696 | { Op1( 0), CRn(10), CRm( 3), Op2( 0), access_vm_reg, NULL, c10_AMAIR0 }, |
692 | { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 }, | 697 | { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 }, |
698 | |||
699 | /* ICC_SRE */ | ||
700 | { Op1( 0), CRn(12), CRm(12), Op2( 5), trap_raz_wi }, | ||
701 | |||
693 | { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, | 702 | { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, |
694 | }; | 703 | }; |
695 | 704 | ||
diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S index 6e0ed93d51fe..c17967fdf5f6 100644 --- a/arch/arm64/lib/clear_user.S +++ b/arch/arm64/lib/clear_user.S | |||
@@ -46,7 +46,7 @@ USER(9f, strh wzr, [x0], #2 ) | |||
46 | sub x1, x1, #2 | 46 | sub x1, x1, #2 |
47 | 4: adds x1, x1, #1 | 47 | 4: adds x1, x1, #1 |
48 | b.mi 5f | 48 | b.mi 5f |
49 | strb wzr, [x0] | 49 | USER(9f, strb wzr, [x0] ) |
50 | 5: mov x0, #0 | 50 | 5: mov x0, #0 |
51 | ret | 51 | ret |
52 | ENDPROC(__clear_user) | 52 | ENDPROC(__clear_user) |
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 37b75602adf6..cc92cdb9994c 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
18 | #include <linux/usb/atmel_usba_udc.h> | 18 | #include <linux/usb/atmel_usba_udc.h> |
19 | 19 | ||
20 | #include <mach/atmel-mci.h> | 20 | #include <linux/platform_data/mmc-atmel-mci.h> |
21 | #include <linux/atmel-mci.h> | 21 | #include <linux/atmel-mci.h> |
22 | 22 | ||
23 | #include <asm/io.h> | 23 | #include <asm/io.h> |
diff --git a/arch/avr32/mach-at32ap/include/mach/atmel-mci.h b/arch/avr32/mach-at32ap/include/mach/atmel-mci.h deleted file mode 100644 index 11d7f4b28dc8..000000000000 --- a/arch/avr32/mach-at32ap/include/mach/atmel-mci.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #ifndef __MACH_ATMEL_MCI_H | ||
2 | #define __MACH_ATMEL_MCI_H | ||
3 | |||
4 | #include <linux/platform_data/dma-dw.h> | ||
5 | |||
6 | /** | ||
7 | * struct mci_dma_data - DMA data for MCI interface | ||
8 | */ | ||
9 | struct mci_dma_data { | ||
10 | struct dw_dma_slave sdata; | ||
11 | }; | ||
12 | |||
13 | /* accessor macros */ | ||
14 | #define slave_data_ptr(s) (&(s)->sdata) | ||
15 | #define find_slave_dev(s) ((s)->sdata.dma_dev) | ||
16 | |||
17 | #endif /* __MACH_ATMEL_MCI_H */ | ||
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index ec6b9acb6bea..dbe46f43884d 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -1563,7 +1563,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, | |||
1563 | 1563 | ||
1564 | for (i = 0; i < npages; i++) { | 1564 | for (i = 0; i < npages; i++) { |
1565 | pfn = gfn_to_pfn(kvm, base_gfn + i); | 1565 | pfn = gfn_to_pfn(kvm, base_gfn + i); |
1566 | if (!kvm_is_mmio_pfn(pfn)) { | 1566 | if (!kvm_is_reserved_pfn(pfn)) { |
1567 | kvm_set_pmt_entry(kvm, base_gfn + i, | 1567 | kvm_set_pmt_entry(kvm, base_gfn + i, |
1568 | pfn << PAGE_SHIFT, | 1568 | pfn << PAGE_SHIFT, |
1569 | _PAGE_AR_RWX | _PAGE_MA_WB); | 1569 | _PAGE_AR_RWX | _PAGE_MA_WB); |
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index 01a62161b08a..192b00f098f4 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c | |||
@@ -858,6 +858,24 @@ static struct platform_device *atari_netusbee_devices[] __initdata = { | |||
858 | }; | 858 | }; |
859 | #endif /* CONFIG_ATARI_ETHERNEC */ | 859 | #endif /* CONFIG_ATARI_ETHERNEC */ |
860 | 860 | ||
861 | #ifdef CONFIG_ATARI_SCSI | ||
862 | static const struct resource atari_scsi_st_rsrc[] __initconst = { | ||
863 | { | ||
864 | .flags = IORESOURCE_IRQ, | ||
865 | .start = IRQ_MFP_FSCSI, | ||
866 | .end = IRQ_MFP_FSCSI, | ||
867 | }, | ||
868 | }; | ||
869 | |||
870 | static const struct resource atari_scsi_tt_rsrc[] __initconst = { | ||
871 | { | ||
872 | .flags = IORESOURCE_IRQ, | ||
873 | .start = IRQ_TT_MFP_SCSI, | ||
874 | .end = IRQ_TT_MFP_SCSI, | ||
875 | }, | ||
876 | }; | ||
877 | #endif | ||
878 | |||
861 | int __init atari_platform_init(void) | 879 | int __init atari_platform_init(void) |
862 | { | 880 | { |
863 | int rv = 0; | 881 | int rv = 0; |
@@ -892,6 +910,15 @@ int __init atari_platform_init(void) | |||
892 | } | 910 | } |
893 | #endif | 911 | #endif |
894 | 912 | ||
913 | #ifdef CONFIG_ATARI_SCSI | ||
914 | if (ATARIHW_PRESENT(ST_SCSI)) | ||
915 | platform_device_register_simple("atari_scsi", -1, | ||
916 | atari_scsi_st_rsrc, ARRAY_SIZE(atari_scsi_st_rsrc)); | ||
917 | else if (ATARIHW_PRESENT(TT_SCSI)) | ||
918 | platform_device_register_simple("atari_scsi", -1, | ||
919 | atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc)); | ||
920 | #endif | ||
921 | |||
895 | return rv; | 922 | return rv; |
896 | } | 923 | } |
897 | 924 | ||
diff --git a/arch/m68k/atari/stdma.c b/arch/m68k/atari/stdma.c index ddbf43ca8858..e5a66596b116 100644 --- a/arch/m68k/atari/stdma.c +++ b/arch/m68k/atari/stdma.c | |||
@@ -59,6 +59,31 @@ static irqreturn_t stdma_int (int irq, void *dummy); | |||
59 | /************************* End of Prototypes **************************/ | 59 | /************************* End of Prototypes **************************/ |
60 | 60 | ||
61 | 61 | ||
62 | /** | ||
63 | * stdma_try_lock - attempt to acquire ST DMA interrupt "lock" | ||
64 | * @handler: interrupt handler to use after acquisition | ||
65 | * | ||
66 | * Returns !0 if lock was acquired; otherwise 0. | ||
67 | */ | ||
68 | |||
69 | int stdma_try_lock(irq_handler_t handler, void *data) | ||
70 | { | ||
71 | unsigned long flags; | ||
72 | |||
73 | local_irq_save(flags); | ||
74 | if (stdma_locked) { | ||
75 | local_irq_restore(flags); | ||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | stdma_locked = 1; | ||
80 | stdma_isr = handler; | ||
81 | stdma_isr_data = data; | ||
82 | local_irq_restore(flags); | ||
83 | return 1; | ||
84 | } | ||
85 | EXPORT_SYMBOL(stdma_try_lock); | ||
86 | |||
62 | 87 | ||
63 | /* | 88 | /* |
64 | * Function: void stdma_lock( isrfunc isr, void *data ) | 89 | * Function: void stdma_lock( isrfunc isr, void *data ) |
@@ -78,19 +103,10 @@ static irqreturn_t stdma_int (int irq, void *dummy); | |||
78 | 103 | ||
79 | void stdma_lock(irq_handler_t handler, void *data) | 104 | void stdma_lock(irq_handler_t handler, void *data) |
80 | { | 105 | { |
81 | unsigned long flags; | ||
82 | |||
83 | local_irq_save(flags); /* protect lock */ | ||
84 | |||
85 | /* Since the DMA is used for file system purposes, we | 106 | /* Since the DMA is used for file system purposes, we |
86 | have to sleep uninterruptible (there may be locked | 107 | have to sleep uninterruptible (there may be locked |
87 | buffers) */ | 108 | buffers) */ |
88 | wait_event(stdma_wait, !stdma_locked); | 109 | wait_event(stdma_wait, stdma_try_lock(handler, data)); |
89 | |||
90 | stdma_locked = 1; | ||
91 | stdma_isr = handler; | ||
92 | stdma_isr_data = data; | ||
93 | local_irq_restore(flags); | ||
94 | } | 110 | } |
95 | EXPORT_SYMBOL(stdma_lock); | 111 | EXPORT_SYMBOL(stdma_lock); |
96 | 112 | ||
@@ -122,22 +138,25 @@ void stdma_release(void) | |||
122 | EXPORT_SYMBOL(stdma_release); | 138 | EXPORT_SYMBOL(stdma_release); |
123 | 139 | ||
124 | 140 | ||
125 | /* | 141 | /** |
126 | * Function: int stdma_others_waiting( void ) | 142 | * stdma_is_locked_by - allow lock holder to check whether it needs to release. |
127 | * | 143 | * @handler: interrupt handler previously used to acquire lock. |
128 | * Purpose: Check if someone waits for the ST-DMA lock. | ||
129 | * | ||
130 | * Inputs: none | ||
131 | * | ||
132 | * Returns: 0 if no one is waiting, != 0 otherwise | ||
133 | * | 144 | * |
145 | * Returns !0 if locked for the given handler; 0 otherwise. | ||
134 | */ | 146 | */ |
135 | 147 | ||
136 | int stdma_others_waiting(void) | 148 | int stdma_is_locked_by(irq_handler_t handler) |
137 | { | 149 | { |
138 | return waitqueue_active(&stdma_wait); | 150 | unsigned long flags; |
151 | int result; | ||
152 | |||
153 | local_irq_save(flags); | ||
154 | result = stdma_locked && (stdma_isr == handler); | ||
155 | local_irq_restore(flags); | ||
156 | |||
157 | return result; | ||
139 | } | 158 | } |
140 | EXPORT_SYMBOL(stdma_others_waiting); | 159 | EXPORT_SYMBOL(stdma_is_locked_by); |
141 | 160 | ||
142 | 161 | ||
143 | /* | 162 | /* |
diff --git a/arch/m68k/include/asm/atari_stdma.h b/arch/m68k/include/asm/atari_stdma.h index 8e389b7fa70c..d24e34d870dc 100644 --- a/arch/m68k/include/asm/atari_stdma.h +++ b/arch/m68k/include/asm/atari_stdma.h | |||
@@ -8,11 +8,11 @@ | |||
8 | 8 | ||
9 | /***************************** Prototypes *****************************/ | 9 | /***************************** Prototypes *****************************/ |
10 | 10 | ||
11 | int stdma_try_lock(irq_handler_t, void *); | ||
11 | void stdma_lock(irq_handler_t handler, void *data); | 12 | void stdma_lock(irq_handler_t handler, void *data); |
12 | void stdma_release( void ); | 13 | void stdma_release( void ); |
13 | int stdma_others_waiting( void ); | ||
14 | int stdma_islocked( void ); | 14 | int stdma_islocked( void ); |
15 | void *stdma_locked_by( void ); | 15 | int stdma_is_locked_by(irq_handler_t); |
16 | void stdma_init( void ); | 16 | void stdma_init( void ); |
17 | 17 | ||
18 | /************************* End of Prototypes **************************/ | 18 | /************************* End of Prototypes **************************/ |
diff --git a/arch/m68k/include/asm/macintosh.h b/arch/m68k/include/asm/macintosh.h index d323b2c2d07d..29c7c6c3a5f2 100644 --- a/arch/m68k/include/asm/macintosh.h +++ b/arch/m68k/include/asm/macintosh.h | |||
@@ -53,6 +53,10 @@ struct mac_model | |||
53 | #define MAC_SCSI_QUADRA 2 | 53 | #define MAC_SCSI_QUADRA 2 |
54 | #define MAC_SCSI_QUADRA2 3 | 54 | #define MAC_SCSI_QUADRA2 3 |
55 | #define MAC_SCSI_QUADRA3 4 | 55 | #define MAC_SCSI_QUADRA3 4 |
56 | #define MAC_SCSI_IIFX 5 | ||
57 | #define MAC_SCSI_DUO 6 | ||
58 | #define MAC_SCSI_CCL 7 | ||
59 | #define MAC_SCSI_LATE 8 | ||
56 | 60 | ||
57 | #define MAC_IDE_NONE 0 | 61 | #define MAC_IDE_NONE 0 |
58 | #define MAC_IDE_QUADRA 1 | 62 | #define MAC_IDE_QUADRA 1 |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 4ef7a54813e6..75e75d7b1702 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <uapi/asm/unistd.h> | 4 | #include <uapi/asm/unistd.h> |
5 | 5 | ||
6 | 6 | ||
7 | #define NR_syscalls 354 | 7 | #define NR_syscalls 355 |
8 | 8 | ||
9 | #define __ARCH_WANT_OLD_READDIR | 9 | #define __ARCH_WANT_OLD_READDIR |
10 | #define __ARCH_WANT_OLD_STAT | 10 | #define __ARCH_WANT_OLD_STAT |
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h index b419c6b7ac37..2c1bec9a14b6 100644 --- a/arch/m68k/include/uapi/asm/unistd.h +++ b/arch/m68k/include/uapi/asm/unistd.h | |||
@@ -359,5 +359,6 @@ | |||
359 | #define __NR_renameat2 351 | 359 | #define __NR_renameat2 351 |
360 | #define __NR_getrandom 352 | 360 | #define __NR_getrandom 352 |
361 | #define __NR_memfd_create 353 | 361 | #define __NR_memfd_create 353 |
362 | #define __NR_bpf 354 | ||
362 | 363 | ||
363 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ | 364 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ |
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index 05b46c2b08b8..2ca219e184cd 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
@@ -374,4 +374,5 @@ ENTRY(sys_call_table) | |||
374 | .long sys_renameat2 | 374 | .long sys_renameat2 |
375 | .long sys_getrandom | 375 | .long sys_getrandom |
376 | .long sys_memfd_create | 376 | .long sys_memfd_create |
377 | .long sys_bpf | ||
377 | 378 | ||
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index a471eab1a4dd..e9c3756139fc 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -278,7 +278,7 @@ static struct mac_model mac_data_table[] = { | |||
278 | .name = "IIfx", | 278 | .name = "IIfx", |
279 | .adb_type = MAC_ADB_IOP, | 279 | .adb_type = MAC_ADB_IOP, |
280 | .via_type = MAC_VIA_IICI, | 280 | .via_type = MAC_VIA_IICI, |
281 | .scsi_type = MAC_SCSI_OLD, | 281 | .scsi_type = MAC_SCSI_IIFX, |
282 | .scc_type = MAC_SCC_IOP, | 282 | .scc_type = MAC_SCC_IOP, |
283 | .nubus_type = MAC_NUBUS, | 283 | .nubus_type = MAC_NUBUS, |
284 | .floppy_type = MAC_FLOPPY_SWIM_IOP, | 284 | .floppy_type = MAC_FLOPPY_SWIM_IOP, |
@@ -329,7 +329,7 @@ static struct mac_model mac_data_table[] = { | |||
329 | .name = "Color Classic", | 329 | .name = "Color Classic", |
330 | .adb_type = MAC_ADB_CUDA, | 330 | .adb_type = MAC_ADB_CUDA, |
331 | .via_type = MAC_VIA_IICI, | 331 | .via_type = MAC_VIA_IICI, |
332 | .scsi_type = MAC_SCSI_OLD, | 332 | .scsi_type = MAC_SCSI_CCL, |
333 | .scc_type = MAC_SCC_II, | 333 | .scc_type = MAC_SCC_II, |
334 | .nubus_type = MAC_NUBUS, | 334 | .nubus_type = MAC_NUBUS, |
335 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 335 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -338,7 +338,7 @@ static struct mac_model mac_data_table[] = { | |||
338 | .name = "Color Classic II", | 338 | .name = "Color Classic II", |
339 | .adb_type = MAC_ADB_CUDA, | 339 | .adb_type = MAC_ADB_CUDA, |
340 | .via_type = MAC_VIA_IICI, | 340 | .via_type = MAC_VIA_IICI, |
341 | .scsi_type = MAC_SCSI_OLD, | 341 | .scsi_type = MAC_SCSI_CCL, |
342 | .scc_type = MAC_SCC_II, | 342 | .scc_type = MAC_SCC_II, |
343 | .nubus_type = MAC_NUBUS, | 343 | .nubus_type = MAC_NUBUS, |
344 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 344 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -526,7 +526,7 @@ static struct mac_model mac_data_table[] = { | |||
526 | .name = "Performa 520", | 526 | .name = "Performa 520", |
527 | .adb_type = MAC_ADB_CUDA, | 527 | .adb_type = MAC_ADB_CUDA, |
528 | .via_type = MAC_VIA_IICI, | 528 | .via_type = MAC_VIA_IICI, |
529 | .scsi_type = MAC_SCSI_OLD, | 529 | .scsi_type = MAC_SCSI_CCL, |
530 | .scc_type = MAC_SCC_II, | 530 | .scc_type = MAC_SCC_II, |
531 | .nubus_type = MAC_NUBUS, | 531 | .nubus_type = MAC_NUBUS, |
532 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 532 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -535,7 +535,7 @@ static struct mac_model mac_data_table[] = { | |||
535 | .name = "Performa 550", | 535 | .name = "Performa 550", |
536 | .adb_type = MAC_ADB_CUDA, | 536 | .adb_type = MAC_ADB_CUDA, |
537 | .via_type = MAC_VIA_IICI, | 537 | .via_type = MAC_VIA_IICI, |
538 | .scsi_type = MAC_SCSI_OLD, | 538 | .scsi_type = MAC_SCSI_CCL, |
539 | .scc_type = MAC_SCC_II, | 539 | .scc_type = MAC_SCC_II, |
540 | .nubus_type = MAC_NUBUS, | 540 | .nubus_type = MAC_NUBUS, |
541 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 541 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -567,7 +567,7 @@ static struct mac_model mac_data_table[] = { | |||
567 | .name = "TV", | 567 | .name = "TV", |
568 | .adb_type = MAC_ADB_CUDA, | 568 | .adb_type = MAC_ADB_CUDA, |
569 | .via_type = MAC_VIA_IICI, | 569 | .via_type = MAC_VIA_IICI, |
570 | .scsi_type = MAC_SCSI_OLD, | 570 | .scsi_type = MAC_SCSI_CCL, |
571 | .scc_type = MAC_SCC_II, | 571 | .scc_type = MAC_SCC_II, |
572 | .nubus_type = MAC_NUBUS, | 572 | .nubus_type = MAC_NUBUS, |
573 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 573 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -712,7 +712,7 @@ static struct mac_model mac_data_table[] = { | |||
712 | .name = "PowerBook 190", | 712 | .name = "PowerBook 190", |
713 | .adb_type = MAC_ADB_PB2, | 713 | .adb_type = MAC_ADB_PB2, |
714 | .via_type = MAC_VIA_QUADRA, | 714 | .via_type = MAC_VIA_QUADRA, |
715 | .scsi_type = MAC_SCSI_OLD, | 715 | .scsi_type = MAC_SCSI_LATE, |
716 | .ide_type = MAC_IDE_BABOON, | 716 | .ide_type = MAC_IDE_BABOON, |
717 | .scc_type = MAC_SCC_QUADRA, | 717 | .scc_type = MAC_SCC_QUADRA, |
718 | .nubus_type = MAC_NUBUS, | 718 | .nubus_type = MAC_NUBUS, |
@@ -722,7 +722,7 @@ static struct mac_model mac_data_table[] = { | |||
722 | .name = "PowerBook 520", | 722 | .name = "PowerBook 520", |
723 | .adb_type = MAC_ADB_PB2, | 723 | .adb_type = MAC_ADB_PB2, |
724 | .via_type = MAC_VIA_QUADRA, | 724 | .via_type = MAC_VIA_QUADRA, |
725 | .scsi_type = MAC_SCSI_OLD, | 725 | .scsi_type = MAC_SCSI_LATE, |
726 | .scc_type = MAC_SCC_QUADRA, | 726 | .scc_type = MAC_SCC_QUADRA, |
727 | .ether_type = MAC_ETHER_SONIC, | 727 | .ether_type = MAC_ETHER_SONIC, |
728 | .nubus_type = MAC_NUBUS, | 728 | .nubus_type = MAC_NUBUS, |
@@ -740,7 +740,7 @@ static struct mac_model mac_data_table[] = { | |||
740 | .name = "PowerBook Duo 210", | 740 | .name = "PowerBook Duo 210", |
741 | .adb_type = MAC_ADB_PB2, | 741 | .adb_type = MAC_ADB_PB2, |
742 | .via_type = MAC_VIA_IICI, | 742 | .via_type = MAC_VIA_IICI, |
743 | .scsi_type = MAC_SCSI_OLD, | 743 | .scsi_type = MAC_SCSI_DUO, |
744 | .scc_type = MAC_SCC_QUADRA, | 744 | .scc_type = MAC_SCC_QUADRA, |
745 | .nubus_type = MAC_NUBUS, | 745 | .nubus_type = MAC_NUBUS, |
746 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 746 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -749,7 +749,7 @@ static struct mac_model mac_data_table[] = { | |||
749 | .name = "PowerBook Duo 230", | 749 | .name = "PowerBook Duo 230", |
750 | .adb_type = MAC_ADB_PB2, | 750 | .adb_type = MAC_ADB_PB2, |
751 | .via_type = MAC_VIA_IICI, | 751 | .via_type = MAC_VIA_IICI, |
752 | .scsi_type = MAC_SCSI_OLD, | 752 | .scsi_type = MAC_SCSI_DUO, |
753 | .scc_type = MAC_SCC_QUADRA, | 753 | .scc_type = MAC_SCC_QUADRA, |
754 | .nubus_type = MAC_NUBUS, | 754 | .nubus_type = MAC_NUBUS, |
755 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 755 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -758,7 +758,7 @@ static struct mac_model mac_data_table[] = { | |||
758 | .name = "PowerBook Duo 250", | 758 | .name = "PowerBook Duo 250", |
759 | .adb_type = MAC_ADB_PB2, | 759 | .adb_type = MAC_ADB_PB2, |
760 | .via_type = MAC_VIA_IICI, | 760 | .via_type = MAC_VIA_IICI, |
761 | .scsi_type = MAC_SCSI_OLD, | 761 | .scsi_type = MAC_SCSI_DUO, |
762 | .scc_type = MAC_SCC_QUADRA, | 762 | .scc_type = MAC_SCC_QUADRA, |
763 | .nubus_type = MAC_NUBUS, | 763 | .nubus_type = MAC_NUBUS, |
764 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 764 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -767,7 +767,7 @@ static struct mac_model mac_data_table[] = { | |||
767 | .name = "PowerBook Duo 270c", | 767 | .name = "PowerBook Duo 270c", |
768 | .adb_type = MAC_ADB_PB2, | 768 | .adb_type = MAC_ADB_PB2, |
769 | .via_type = MAC_VIA_IICI, | 769 | .via_type = MAC_VIA_IICI, |
770 | .scsi_type = MAC_SCSI_OLD, | 770 | .scsi_type = MAC_SCSI_DUO, |
771 | .scc_type = MAC_SCC_QUADRA, | 771 | .scc_type = MAC_SCC_QUADRA, |
772 | .nubus_type = MAC_NUBUS, | 772 | .nubus_type = MAC_NUBUS, |
773 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 773 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -776,7 +776,7 @@ static struct mac_model mac_data_table[] = { | |||
776 | .name = "PowerBook Duo 280", | 776 | .name = "PowerBook Duo 280", |
777 | .adb_type = MAC_ADB_PB2, | 777 | .adb_type = MAC_ADB_PB2, |
778 | .via_type = MAC_VIA_IICI, | 778 | .via_type = MAC_VIA_IICI, |
779 | .scsi_type = MAC_SCSI_OLD, | 779 | .scsi_type = MAC_SCSI_DUO, |
780 | .scc_type = MAC_SCC_QUADRA, | 780 | .scc_type = MAC_SCC_QUADRA, |
781 | .nubus_type = MAC_NUBUS, | 781 | .nubus_type = MAC_NUBUS, |
782 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 782 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -785,7 +785,7 @@ static struct mac_model mac_data_table[] = { | |||
785 | .name = "PowerBook Duo 280c", | 785 | .name = "PowerBook Duo 280c", |
786 | .adb_type = MAC_ADB_PB2, | 786 | .adb_type = MAC_ADB_PB2, |
787 | .via_type = MAC_VIA_IICI, | 787 | .via_type = MAC_VIA_IICI, |
788 | .scsi_type = MAC_SCSI_OLD, | 788 | .scsi_type = MAC_SCSI_DUO, |
789 | .scc_type = MAC_SCC_QUADRA, | 789 | .scc_type = MAC_SCC_QUADRA, |
790 | .nubus_type = MAC_NUBUS, | 790 | .nubus_type = MAC_NUBUS, |
791 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, | 791 | .floppy_type = MAC_FLOPPY_SWIM_ADDR2, |
@@ -929,6 +929,70 @@ static struct platform_device swim_pdev = { | |||
929 | .resource = &swim_rsrc, | 929 | .resource = &swim_rsrc, |
930 | }; | 930 | }; |
931 | 931 | ||
932 | static const struct resource mac_scsi_iifx_rsrc[] __initconst = { | ||
933 | { | ||
934 | .flags = IORESOURCE_IRQ, | ||
935 | .start = IRQ_MAC_SCSI, | ||
936 | .end = IRQ_MAC_SCSI, | ||
937 | }, { | ||
938 | .flags = IORESOURCE_MEM, | ||
939 | .start = 0x50008000, | ||
940 | .end = 0x50009FFF, | ||
941 | }, | ||
942 | }; | ||
943 | |||
944 | static const struct resource mac_scsi_duo_rsrc[] __initconst = { | ||
945 | { | ||
946 | .flags = IORESOURCE_MEM, | ||
947 | .start = 0xFEE02000, | ||
948 | .end = 0xFEE03FFF, | ||
949 | }, | ||
950 | }; | ||
951 | |||
952 | static const struct resource mac_scsi_old_rsrc[] __initconst = { | ||
953 | { | ||
954 | .flags = IORESOURCE_IRQ, | ||
955 | .start = IRQ_MAC_SCSI, | ||
956 | .end = IRQ_MAC_SCSI, | ||
957 | }, { | ||
958 | .flags = IORESOURCE_MEM, | ||
959 | .start = 0x50010000, | ||
960 | .end = 0x50011FFF, | ||
961 | }, { | ||
962 | .flags = IORESOURCE_MEM, | ||
963 | .start = 0x50006000, | ||
964 | .end = 0x50007FFF, | ||
965 | }, | ||
966 | }; | ||
967 | |||
968 | static const struct resource mac_scsi_late_rsrc[] __initconst = { | ||
969 | { | ||
970 | .flags = IORESOURCE_IRQ, | ||
971 | .start = IRQ_MAC_SCSI, | ||
972 | .end = IRQ_MAC_SCSI, | ||
973 | }, { | ||
974 | .flags = IORESOURCE_MEM, | ||
975 | .start = 0x50010000, | ||
976 | .end = 0x50011FFF, | ||
977 | }, | ||
978 | }; | ||
979 | |||
980 | static const struct resource mac_scsi_ccl_rsrc[] __initconst = { | ||
981 | { | ||
982 | .flags = IORESOURCE_IRQ, | ||
983 | .start = IRQ_MAC_SCSI, | ||
984 | .end = IRQ_MAC_SCSI, | ||
985 | }, { | ||
986 | .flags = IORESOURCE_MEM, | ||
987 | .start = 0x50F10000, | ||
988 | .end = 0x50F11FFF, | ||
989 | }, { | ||
990 | .flags = IORESOURCE_MEM, | ||
991 | .start = 0x50F06000, | ||
992 | .end = 0x50F07FFF, | ||
993 | }, | ||
994 | }; | ||
995 | |||
932 | static struct platform_device esp_0_pdev = { | 996 | static struct platform_device esp_0_pdev = { |
933 | .name = "mac_esp", | 997 | .name = "mac_esp", |
934 | .id = 0, | 998 | .id = 0, |
@@ -1000,6 +1064,60 @@ int __init mac_platform_init(void) | |||
1000 | (macintosh_config->ident == MAC_MODEL_Q950)) | 1064 | (macintosh_config->ident == MAC_MODEL_Q950)) |
1001 | platform_device_register(&esp_1_pdev); | 1065 | platform_device_register(&esp_1_pdev); |
1002 | break; | 1066 | break; |
1067 | case MAC_SCSI_IIFX: | ||
1068 | /* Addresses from The Guide to Mac Family Hardware. | ||
1069 | * $5000 8000 - $5000 9FFF: SCSI DMA | ||
1070 | * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA) | ||
1071 | * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk) | ||
1072 | * The SCSI DMA custom IC embeds the 53C80 core. mac_scsi does | ||
1073 | * not make use of its DMA or hardware handshaking logic. | ||
1074 | */ | ||
1075 | platform_device_register_simple("mac_scsi", 0, | ||
1076 | mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc)); | ||
1077 | break; | ||
1078 | case MAC_SCSI_DUO: | ||
1079 | /* Addresses from the Duo Dock II Developer Note. | ||
1080 | * $FEE0 2000 - $FEE0 3FFF: normal mode | ||
1081 | * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ | ||
1082 | * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ | ||
1083 | * The NetBSD code indicates that both 5380 chips share | ||
1084 | * an IRQ (?) which would need careful handling (see mac_esp). | ||
1085 | */ | ||
1086 | platform_device_register_simple("mac_scsi", 1, | ||
1087 | mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc)); | ||
1088 | /* fall through */ | ||
1089 | case MAC_SCSI_OLD: | ||
1090 | /* Addresses from Developer Notes for Duo System, | ||
1091 | * PowerBook 180 & 160, 140 & 170, Macintosh IIsi | ||
1092 | * and also from The Guide to Mac Family Hardware for | ||
1093 | * SE/30, II, IIx, IIcx, IIci. | ||
1094 | * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ | ||
1095 | * $5001 0000 - $5001 1FFF: normal mode | ||
1096 | * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ | ||
1097 | * GMFH says that $5000 0000 - $50FF FFFF "wraps | ||
1098 | * $5000 0000 - $5001 FFFF eight times" (!) | ||
1099 | * mess.org says IIci and Color Classic do not alias | ||
1100 | * I/O address space. | ||
1101 | */ | ||
1102 | platform_device_register_simple("mac_scsi", 0, | ||
1103 | mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc)); | ||
1104 | break; | ||
1105 | case MAC_SCSI_LATE: | ||
1106 | /* PDMA logic in 68040 PowerBooks is somehow different to | ||
1107 | * '030 models. It's probably more like Quadras (see mac_esp). | ||
1108 | */ | ||
1109 | platform_device_register_simple("mac_scsi", 0, | ||
1110 | mac_scsi_late_rsrc, ARRAY_SIZE(mac_scsi_late_rsrc)); | ||
1111 | break; | ||
1112 | case MAC_SCSI_CCL: | ||
1113 | /* Addresses from the Color Classic Developer Note. | ||
1114 | * $50F0 6000 - $50F0 7FFF: SCSI handshake | ||
1115 | * $50F1 0000 - $50F1 1FFF: SCSI | ||
1116 | * $50F1 2000 - $50F1 3FFF: SCSI DMA | ||
1117 | */ | ||
1118 | platform_device_register_simple("mac_scsi", 0, | ||
1119 | mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc)); | ||
1120 | break; | ||
1003 | } | 1121 | } |
1004 | 1122 | ||
1005 | /* | 1123 | /* |
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c index acaff6a49e35..b09a3cb29b68 100644 --- a/arch/m68k/mm/init.c +++ b/arch/m68k/mm/init.c | |||
@@ -94,7 +94,6 @@ void __init paging_init(void) | |||
94 | high_memory = (void *) end_mem; | 94 | high_memory = (void *) end_mem; |
95 | 95 | ||
96 | empty_zero_page = alloc_bootmem_pages(PAGE_SIZE); | 96 | empty_zero_page = alloc_bootmem_pages(PAGE_SIZE); |
97 | memset(empty_zero_page, 0, PAGE_SIZE); | ||
98 | 97 | ||
99 | /* | 98 | /* |
100 | * Set up SFC/DFC registers (user data space). | 99 | * Set up SFC/DFC registers (user data space). |
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c index f59ec58083f8..a8b942bf7163 100644 --- a/arch/m68k/sun3/config.c +++ b/arch/m68k/sun3/config.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/console.h> | 16 | #include <linux/console.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/bootmem.h> | 18 | #include <linux/bootmem.h> |
19 | #include <linux/platform_device.h> | ||
19 | 20 | ||
20 | #include <asm/oplib.h> | 21 | #include <asm/oplib.h> |
21 | #include <asm/setup.h> | 22 | #include <asm/setup.h> |
@@ -27,6 +28,7 @@ | |||
27 | #include <asm/sun3mmu.h> | 28 | #include <asm/sun3mmu.h> |
28 | #include <asm/rtc.h> | 29 | #include <asm/rtc.h> |
29 | #include <asm/machdep.h> | 30 | #include <asm/machdep.h> |
31 | #include <asm/machines.h> | ||
30 | #include <asm/idprom.h> | 32 | #include <asm/idprom.h> |
31 | #include <asm/intersil.h> | 33 | #include <asm/intersil.h> |
32 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
@@ -169,3 +171,61 @@ static void __init sun3_sched_init(irq_handler_t timer_routine) | |||
169 | intersil_clear(); | 171 | intersil_clear(); |
170 | } | 172 | } |
171 | 173 | ||
174 | #ifdef CONFIG_SUN3_SCSI | ||
175 | |||
176 | static const struct resource sun3_scsi_vme_rsrc[] __initconst = { | ||
177 | { | ||
178 | .flags = IORESOURCE_IRQ, | ||
179 | .start = SUN3_VEC_VMESCSI0, | ||
180 | .end = SUN3_VEC_VMESCSI0, | ||
181 | }, { | ||
182 | .flags = IORESOURCE_MEM, | ||
183 | .start = 0xff200000, | ||
184 | .end = 0xff200021, | ||
185 | }, { | ||
186 | .flags = IORESOURCE_IRQ, | ||
187 | .start = SUN3_VEC_VMESCSI1, | ||
188 | .end = SUN3_VEC_VMESCSI1, | ||
189 | }, { | ||
190 | .flags = IORESOURCE_MEM, | ||
191 | .start = 0xff204000, | ||
192 | .end = 0xff204021, | ||
193 | }, | ||
194 | }; | ||
195 | |||
196 | /* | ||
197 | * Int: level 2 autovector | ||
198 | * IO: type 1, base 0x00140000, 5 bits phys space: A<4..0> | ||
199 | */ | ||
200 | static const struct resource sun3_scsi_rsrc[] __initconst = { | ||
201 | { | ||
202 | .flags = IORESOURCE_IRQ, | ||
203 | .start = 2, | ||
204 | .end = 2, | ||
205 | }, { | ||
206 | .flags = IORESOURCE_MEM, | ||
207 | .start = 0x00140000, | ||
208 | .end = 0x0014001f, | ||
209 | }, | ||
210 | }; | ||
211 | |||
212 | int __init sun3_platform_init(void) | ||
213 | { | ||
214 | switch (idprom->id_machtype) { | ||
215 | case SM_SUN3 | SM_3_160: | ||
216 | case SM_SUN3 | SM_3_260: | ||
217 | platform_device_register_simple("sun3_scsi_vme", -1, | ||
218 | sun3_scsi_vme_rsrc, ARRAY_SIZE(sun3_scsi_vme_rsrc)); | ||
219 | break; | ||
220 | case SM_SUN3 | SM_3_50: | ||
221 | case SM_SUN3 | SM_3_60: | ||
222 | platform_device_register_simple("sun3_scsi", -1, | ||
223 | sun3_scsi_rsrc, ARRAY_SIZE(sun3_scsi_rsrc)); | ||
224 | break; | ||
225 | } | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | arch_initcall(sun3_platform_init); | ||
230 | |||
231 | #endif | ||
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 6feded3b0c4c..a7736fa0580c 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -129,6 +129,10 @@ endmenu | |||
129 | 129 | ||
130 | menu "Kernel features" | 130 | menu "Kernel features" |
131 | 131 | ||
132 | config NR_CPUS | ||
133 | int | ||
134 | default "1" | ||
135 | |||
132 | config ADVANCED_OPTIONS | 136 | config ADVANCED_OPTIONS |
133 | bool "Prompt for advanced kernel configuration options" | 137 | bool "Prompt for advanced kernel configuration options" |
134 | help | 138 | help |
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index ea4b233647c1..0a53362d5548 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h | |||
@@ -38,6 +38,6 @@ | |||
38 | 38 | ||
39 | #endif /* __ASSEMBLY__ */ | 39 | #endif /* __ASSEMBLY__ */ |
40 | 40 | ||
41 | #define __NR_syscalls 387 | 41 | #define __NR_syscalls 388 |
42 | 42 | ||
43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ | 43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/microblaze/include/uapi/asm/unistd.h b/arch/microblaze/include/uapi/asm/unistd.h index 1c2380bf8fe6..c712677f8a2a 100644 --- a/arch/microblaze/include/uapi/asm/unistd.h +++ b/arch/microblaze/include/uapi/asm/unistd.h | |||
@@ -402,5 +402,6 @@ | |||
402 | #define __NR_seccomp 384 | 402 | #define __NR_seccomp 384 |
403 | #define __NR_getrandom 385 | 403 | #define __NR_getrandom 385 |
404 | #define __NR_memfd_create 386 | 404 | #define __NR_memfd_create 386 |
405 | #define __NR_bpf 387 | ||
405 | 406 | ||
406 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ | 407 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index de59ee1d7010..0166e890486c 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
@@ -387,3 +387,4 @@ ENTRY(sys_call_table) | |||
387 | .long sys_seccomp | 387 | .long sys_seccomp |
388 | .long sys_getrandom /* 385 */ | 388 | .long sys_getrandom /* 385 */ |
389 | .long sys_memfd_create | 389 | .long sys_memfd_create |
390 | .long sys_bpf | ||
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index 9037914f6985..b30e41c0c033 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -660,8 +660,13 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
660 | res = &hose->mem_resources[memno++]; | 660 | res = &hose->mem_resources[memno++]; |
661 | break; | 661 | break; |
662 | } | 662 | } |
663 | if (res != NULL) | 663 | if (res != NULL) { |
664 | of_pci_range_to_resource(&range, dev, res); | 664 | res->name = dev->full_name; |
665 | res->flags = range.flags; | ||
666 | res->start = range.cpu_addr; | ||
667 | res->end = range.cpu_addr + range.size - 1; | ||
668 | res->parent = res->child = res->sibling = NULL; | ||
669 | } | ||
665 | } | 670 | } |
666 | 671 | ||
667 | /* If there's an ISA hole and the pci_mem_offset is -not- matching | 672 | /* If there's an ISA hole and the pci_mem_offset is -not- matching |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index f43aa536c517..9536ef912f59 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -2101,9 +2101,17 @@ config 64BIT_PHYS_ADDR | |||
2101 | config ARCH_PHYS_ADDR_T_64BIT | 2101 | config ARCH_PHYS_ADDR_T_64BIT |
2102 | def_bool 64BIT_PHYS_ADDR | 2102 | def_bool 64BIT_PHYS_ADDR |
2103 | 2103 | ||
2104 | choice | ||
2105 | prompt "SmartMIPS or microMIPS ASE support" | ||
2106 | |||
2107 | config CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS | ||
2108 | bool "None" | ||
2109 | help | ||
2110 | Select this if you want neither microMIPS nor SmartMIPS support | ||
2111 | |||
2104 | config CPU_HAS_SMARTMIPS | 2112 | config CPU_HAS_SMARTMIPS |
2105 | depends on SYS_SUPPORTS_SMARTMIPS | 2113 | depends on SYS_SUPPORTS_SMARTMIPS |
2106 | bool "Support for the SmartMIPS ASE" | 2114 | bool "SmartMIPS" |
2107 | help | 2115 | help |
2108 | SmartMIPS is a extension of the MIPS32 architecture aimed at | 2116 | SmartMIPS is a extension of the MIPS32 architecture aimed at |
2109 | increased security at both hardware and software level for | 2117 | increased security at both hardware and software level for |
@@ -2115,11 +2123,13 @@ config CPU_HAS_SMARTMIPS | |||
2115 | 2123 | ||
2116 | config CPU_MICROMIPS | 2124 | config CPU_MICROMIPS |
2117 | depends on SYS_SUPPORTS_MICROMIPS | 2125 | depends on SYS_SUPPORTS_MICROMIPS |
2118 | bool "Build kernel using microMIPS ISA" | 2126 | bool "microMIPS" |
2119 | help | 2127 | help |
2120 | When this option is enabled the kernel will be built using the | 2128 | When this option is enabled the kernel will be built using the |
2121 | microMIPS ISA | 2129 | microMIPS ISA |
2122 | 2130 | ||
2131 | endchoice | ||
2132 | |||
2123 | config CPU_HAS_MSA | 2133 | config CPU_HAS_MSA |
2124 | bool "Support for the MIPS SIMD Architecture (EXPERIMENTAL)" | 2134 | bool "Support for the MIPS SIMD Architecture (EXPERIMENTAL)" |
2125 | depends on CPU_SUPPORTS_MSA | 2135 | depends on CPU_SUPPORTS_MSA |
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 23cb94806fbc..58076472bdd8 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
@@ -93,6 +93,15 @@ LDFLAGS_vmlinux += -G 0 -static -n -nostdlib | |||
93 | KBUILD_AFLAGS_MODULE += -mlong-calls | 93 | KBUILD_AFLAGS_MODULE += -mlong-calls |
94 | KBUILD_CFLAGS_MODULE += -mlong-calls | 94 | KBUILD_CFLAGS_MODULE += -mlong-calls |
95 | 95 | ||
96 | # | ||
97 | # pass -msoft-float to GAS if it supports it. However on newer binutils | ||
98 | # (specifically newer than 2.24.51.20140728) we then also need to explicitly | ||
99 | # set ".set hardfloat" in all files which manipulate floating point registers. | ||
100 | # | ||
101 | ifneq ($(call as-option,-Wa$(comma)-msoft-float,),) | ||
102 | cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float | ||
103 | endif | ||
104 | |||
96 | cflags-y += -ffreestanding | 105 | cflags-y += -ffreestanding |
97 | 106 | ||
98 | # | 107 | # |
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index 741734049675..2bc4aa95944e 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c | |||
@@ -809,6 +809,7 @@ static struct irq_chip octeon_irq_chip_ciu_gpio_v2 = { | |||
809 | .irq_set_type = octeon_irq_ciu_gpio_set_type, | 809 | .irq_set_type = octeon_irq_ciu_gpio_set_type, |
810 | #ifdef CONFIG_SMP | 810 | #ifdef CONFIG_SMP |
811 | .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, | 811 | .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, |
812 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, | ||
812 | #endif | 813 | #endif |
813 | .flags = IRQCHIP_SET_TYPE_MASKED, | 814 | .flags = IRQCHIP_SET_TYPE_MASKED, |
814 | }; | 815 | }; |
@@ -823,6 +824,7 @@ static struct irq_chip octeon_irq_chip_ciu_gpio = { | |||
823 | .irq_set_type = octeon_irq_ciu_gpio_set_type, | 824 | .irq_set_type = octeon_irq_ciu_gpio_set_type, |
824 | #ifdef CONFIG_SMP | 825 | #ifdef CONFIG_SMP |
825 | .irq_set_affinity = octeon_irq_ciu_set_affinity, | 826 | .irq_set_affinity = octeon_irq_ciu_set_affinity, |
827 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, | ||
826 | #endif | 828 | #endif |
827 | .flags = IRQCHIP_SET_TYPE_MASKED, | 829 | .flags = IRQCHIP_SET_TYPE_MASKED, |
828 | }; | 830 | }; |
diff --git a/arch/mips/include/asm/asmmacro-32.h b/arch/mips/include/asm/asmmacro-32.h index e38c2811d4e2..cdac7b3eeaf7 100644 --- a/arch/mips/include/asm/asmmacro-32.h +++ b/arch/mips/include/asm/asmmacro-32.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <asm/mipsregs.h> | 13 | #include <asm/mipsregs.h> |
14 | 14 | ||
15 | .macro fpu_save_single thread tmp=t0 | 15 | .macro fpu_save_single thread tmp=t0 |
16 | .set push | ||
17 | SET_HARDFLOAT | ||
16 | cfc1 \tmp, fcr31 | 18 | cfc1 \tmp, fcr31 |
17 | swc1 $f0, THREAD_FPR0_LS64(\thread) | 19 | swc1 $f0, THREAD_FPR0_LS64(\thread) |
18 | swc1 $f1, THREAD_FPR1_LS64(\thread) | 20 | swc1 $f1, THREAD_FPR1_LS64(\thread) |
@@ -47,9 +49,12 @@ | |||
47 | swc1 $f30, THREAD_FPR30_LS64(\thread) | 49 | swc1 $f30, THREAD_FPR30_LS64(\thread) |
48 | swc1 $f31, THREAD_FPR31_LS64(\thread) | 50 | swc1 $f31, THREAD_FPR31_LS64(\thread) |
49 | sw \tmp, THREAD_FCR31(\thread) | 51 | sw \tmp, THREAD_FCR31(\thread) |
52 | .set pop | ||
50 | .endm | 53 | .endm |
51 | 54 | ||
52 | .macro fpu_restore_single thread tmp=t0 | 55 | .macro fpu_restore_single thread tmp=t0 |
56 | .set push | ||
57 | SET_HARDFLOAT | ||
53 | lw \tmp, THREAD_FCR31(\thread) | 58 | lw \tmp, THREAD_FCR31(\thread) |
54 | lwc1 $f0, THREAD_FPR0_LS64(\thread) | 59 | lwc1 $f0, THREAD_FPR0_LS64(\thread) |
55 | lwc1 $f1, THREAD_FPR1_LS64(\thread) | 60 | lwc1 $f1, THREAD_FPR1_LS64(\thread) |
@@ -84,6 +89,7 @@ | |||
84 | lwc1 $f30, THREAD_FPR30_LS64(\thread) | 89 | lwc1 $f30, THREAD_FPR30_LS64(\thread) |
85 | lwc1 $f31, THREAD_FPR31_LS64(\thread) | 90 | lwc1 $f31, THREAD_FPR31_LS64(\thread) |
86 | ctc1 \tmp, fcr31 | 91 | ctc1 \tmp, fcr31 |
92 | .set pop | ||
87 | .endm | 93 | .endm |
88 | 94 | ||
89 | .macro cpu_save_nonscratch thread | 95 | .macro cpu_save_nonscratch thread |
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h index cd9a98bc8f60..6caf8766b80f 100644 --- a/arch/mips/include/asm/asmmacro.h +++ b/arch/mips/include/asm/asmmacro.h | |||
@@ -57,6 +57,8 @@ | |||
57 | #endif /* CONFIG_CPU_MIPSR2 */ | 57 | #endif /* CONFIG_CPU_MIPSR2 */ |
58 | 58 | ||
59 | .macro fpu_save_16even thread tmp=t0 | 59 | .macro fpu_save_16even thread tmp=t0 |
60 | .set push | ||
61 | SET_HARDFLOAT | ||
60 | cfc1 \tmp, fcr31 | 62 | cfc1 \tmp, fcr31 |
61 | sdc1 $f0, THREAD_FPR0_LS64(\thread) | 63 | sdc1 $f0, THREAD_FPR0_LS64(\thread) |
62 | sdc1 $f2, THREAD_FPR2_LS64(\thread) | 64 | sdc1 $f2, THREAD_FPR2_LS64(\thread) |
@@ -75,11 +77,13 @@ | |||
75 | sdc1 $f28, THREAD_FPR28_LS64(\thread) | 77 | sdc1 $f28, THREAD_FPR28_LS64(\thread) |
76 | sdc1 $f30, THREAD_FPR30_LS64(\thread) | 78 | sdc1 $f30, THREAD_FPR30_LS64(\thread) |
77 | sw \tmp, THREAD_FCR31(\thread) | 79 | sw \tmp, THREAD_FCR31(\thread) |
80 | .set pop | ||
78 | .endm | 81 | .endm |
79 | 82 | ||
80 | .macro fpu_save_16odd thread | 83 | .macro fpu_save_16odd thread |
81 | .set push | 84 | .set push |
82 | .set mips64r2 | 85 | .set mips64r2 |
86 | SET_HARDFLOAT | ||
83 | sdc1 $f1, THREAD_FPR1_LS64(\thread) | 87 | sdc1 $f1, THREAD_FPR1_LS64(\thread) |
84 | sdc1 $f3, THREAD_FPR3_LS64(\thread) | 88 | sdc1 $f3, THREAD_FPR3_LS64(\thread) |
85 | sdc1 $f5, THREAD_FPR5_LS64(\thread) | 89 | sdc1 $f5, THREAD_FPR5_LS64(\thread) |
@@ -110,6 +114,8 @@ | |||
110 | .endm | 114 | .endm |
111 | 115 | ||
112 | .macro fpu_restore_16even thread tmp=t0 | 116 | .macro fpu_restore_16even thread tmp=t0 |
117 | .set push | ||
118 | SET_HARDFLOAT | ||
113 | lw \tmp, THREAD_FCR31(\thread) | 119 | lw \tmp, THREAD_FCR31(\thread) |
114 | ldc1 $f0, THREAD_FPR0_LS64(\thread) | 120 | ldc1 $f0, THREAD_FPR0_LS64(\thread) |
115 | ldc1 $f2, THREAD_FPR2_LS64(\thread) | 121 | ldc1 $f2, THREAD_FPR2_LS64(\thread) |
@@ -133,6 +139,7 @@ | |||
133 | .macro fpu_restore_16odd thread | 139 | .macro fpu_restore_16odd thread |
134 | .set push | 140 | .set push |
135 | .set mips64r2 | 141 | .set mips64r2 |
142 | SET_HARDFLOAT | ||
136 | ldc1 $f1, THREAD_FPR1_LS64(\thread) | 143 | ldc1 $f1, THREAD_FPR1_LS64(\thread) |
137 | ldc1 $f3, THREAD_FPR3_LS64(\thread) | 144 | ldc1 $f3, THREAD_FPR3_LS64(\thread) |
138 | ldc1 $f5, THREAD_FPR5_LS64(\thread) | 145 | ldc1 $f5, THREAD_FPR5_LS64(\thread) |
@@ -277,6 +284,7 @@ | |||
277 | .macro cfcmsa rd, cs | 284 | .macro cfcmsa rd, cs |
278 | .set push | 285 | .set push |
279 | .set noat | 286 | .set noat |
287 | SET_HARDFLOAT | ||
280 | .insn | 288 | .insn |
281 | .word CFC_MSA_INSN | (\cs << 11) | 289 | .word CFC_MSA_INSN | (\cs << 11) |
282 | move \rd, $1 | 290 | move \rd, $1 |
@@ -286,6 +294,7 @@ | |||
286 | .macro ctcmsa cd, rs | 294 | .macro ctcmsa cd, rs |
287 | .set push | 295 | .set push |
288 | .set noat | 296 | .set noat |
297 | SET_HARDFLOAT | ||
289 | move $1, \rs | 298 | move $1, \rs |
290 | .word CTC_MSA_INSN | (\cd << 6) | 299 | .word CTC_MSA_INSN | (\cd << 6) |
291 | .set pop | 300 | .set pop |
@@ -294,6 +303,7 @@ | |||
294 | .macro ld_d wd, off, base | 303 | .macro ld_d wd, off, base |
295 | .set push | 304 | .set push |
296 | .set noat | 305 | .set noat |
306 | SET_HARDFLOAT | ||
297 | add $1, \base, \off | 307 | add $1, \base, \off |
298 | .word LDD_MSA_INSN | (\wd << 6) | 308 | .word LDD_MSA_INSN | (\wd << 6) |
299 | .set pop | 309 | .set pop |
@@ -302,6 +312,7 @@ | |||
302 | .macro st_d wd, off, base | 312 | .macro st_d wd, off, base |
303 | .set push | 313 | .set push |
304 | .set noat | 314 | .set noat |
315 | SET_HARDFLOAT | ||
305 | add $1, \base, \off | 316 | add $1, \base, \off |
306 | .word STD_MSA_INSN | (\wd << 6) | 317 | .word STD_MSA_INSN | (\wd << 6) |
307 | .set pop | 318 | .set pop |
@@ -310,6 +321,7 @@ | |||
310 | .macro copy_u_w rd, ws, n | 321 | .macro copy_u_w rd, ws, n |
311 | .set push | 322 | .set push |
312 | .set noat | 323 | .set noat |
324 | SET_HARDFLOAT | ||
313 | .insn | 325 | .insn |
314 | .word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11) | 326 | .word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11) |
315 | /* move triggers an assembler bug... */ | 327 | /* move triggers an assembler bug... */ |
@@ -320,6 +332,7 @@ | |||
320 | .macro copy_u_d rd, ws, n | 332 | .macro copy_u_d rd, ws, n |
321 | .set push | 333 | .set push |
322 | .set noat | 334 | .set noat |
335 | SET_HARDFLOAT | ||
323 | .insn | 336 | .insn |
324 | .word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11) | 337 | .word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11) |
325 | /* move triggers an assembler bug... */ | 338 | /* move triggers an assembler bug... */ |
@@ -330,6 +343,7 @@ | |||
330 | .macro insert_w wd, n, rs | 343 | .macro insert_w wd, n, rs |
331 | .set push | 344 | .set push |
332 | .set noat | 345 | .set noat |
346 | SET_HARDFLOAT | ||
333 | /* move triggers an assembler bug... */ | 347 | /* move triggers an assembler bug... */ |
334 | or $1, \rs, zero | 348 | or $1, \rs, zero |
335 | .word INSERT_W_MSA_INSN | (\n << 16) | (\wd << 6) | 349 | .word INSERT_W_MSA_INSN | (\n << 16) | (\wd << 6) |
@@ -339,6 +353,7 @@ | |||
339 | .macro insert_d wd, n, rs | 353 | .macro insert_d wd, n, rs |
340 | .set push | 354 | .set push |
341 | .set noat | 355 | .set noat |
356 | SET_HARDFLOAT | ||
342 | /* move triggers an assembler bug... */ | 357 | /* move triggers an assembler bug... */ |
343 | or $1, \rs, zero | 358 | or $1, \rs, zero |
344 | .word INSERT_D_MSA_INSN | (\n << 16) | (\wd << 6) | 359 | .word INSERT_D_MSA_INSN | (\n << 16) | (\wd << 6) |
@@ -381,6 +396,7 @@ | |||
381 | st_d 31, THREAD_FPR31, \thread | 396 | st_d 31, THREAD_FPR31, \thread |
382 | .set push | 397 | .set push |
383 | .set noat | 398 | .set noat |
399 | SET_HARDFLOAT | ||
384 | cfcmsa $1, MSA_CSR | 400 | cfcmsa $1, MSA_CSR |
385 | sw $1, THREAD_MSA_CSR(\thread) | 401 | sw $1, THREAD_MSA_CSR(\thread) |
386 | .set pop | 402 | .set pop |
@@ -389,6 +405,7 @@ | |||
389 | .macro msa_restore_all thread | 405 | .macro msa_restore_all thread |
390 | .set push | 406 | .set push |
391 | .set noat | 407 | .set noat |
408 | SET_HARDFLOAT | ||
392 | lw $1, THREAD_MSA_CSR(\thread) | 409 | lw $1, THREAD_MSA_CSR(\thread) |
393 | ctcmsa MSA_CSR, $1 | 410 | ctcmsa MSA_CSR, $1 |
394 | .set pop | 411 | .set pop |
@@ -441,6 +458,7 @@ | |||
441 | .macro msa_init_all_upper | 458 | .macro msa_init_all_upper |
442 | .set push | 459 | .set push |
443 | .set noat | 460 | .set noat |
461 | SET_HARDFLOAT | ||
444 | not $1, zero | 462 | not $1, zero |
445 | msa_init_upper 0 | 463 | msa_init_upper 0 |
446 | .set pop | 464 | .set pop |
diff --git a/arch/mips/include/asm/fpregdef.h b/arch/mips/include/asm/fpregdef.h index 429481f9028d..f184ba088532 100644 --- a/arch/mips/include/asm/fpregdef.h +++ b/arch/mips/include/asm/fpregdef.h | |||
@@ -14,6 +14,20 @@ | |||
14 | 14 | ||
15 | #include <asm/sgidefs.h> | 15 | #include <asm/sgidefs.h> |
16 | 16 | ||
17 | /* | ||
18 | * starting with binutils 2.24.51.20140729, MIPS binutils warn about mixing | ||
19 | * hardfloat and softfloat object files. The kernel build uses soft-float by | ||
20 | * default, so we also need to pass -msoft-float along to GAS if it supports it. | ||
21 | * But this in turn causes assembler errors in files which access hardfloat | ||
22 | * registers. We detect if GAS supports "-msoft-float" in the Makefile and | ||
23 | * explicitly put ".set hardfloat" where floating point registers are touched. | ||
24 | */ | ||
25 | #ifdef GAS_HAS_SET_HARDFLOAT | ||
26 | #define SET_HARDFLOAT .set hardfloat | ||
27 | #else | ||
28 | #define SET_HARDFLOAT | ||
29 | #endif | ||
30 | |||
17 | #if _MIPS_SIM == _MIPS_SIM_ABI32 | 31 | #if _MIPS_SIM == _MIPS_SIM_ABI32 |
18 | 32 | ||
19 | /* | 33 | /* |
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h index 4d0aeda68397..dd562414cd5e 100644 --- a/arch/mips/include/asm/fpu.h +++ b/arch/mips/include/asm/fpu.h | |||
@@ -145,8 +145,8 @@ static inline void lose_fpu(int save) | |||
145 | if (is_msa_enabled()) { | 145 | if (is_msa_enabled()) { |
146 | if (save) { | 146 | if (save) { |
147 | save_msa(current); | 147 | save_msa(current); |
148 | asm volatile("cfc1 %0, $31" | 148 | current->thread.fpu.fcr31 = |
149 | : "=r"(current->thread.fpu.fcr31)); | 149 | read_32bit_cp1_register(CP1_STATUS); |
150 | } | 150 | } |
151 | disable_msa(); | 151 | disable_msa(); |
152 | clear_thread_flag(TIF_USEDMSA); | 152 | clear_thread_flag(TIF_USEDMSA); |
diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h index e194f957ca8c..fdbff44e5482 100644 --- a/arch/mips/include/asm/jump_label.h +++ b/arch/mips/include/asm/jump_label.h | |||
@@ -20,9 +20,15 @@ | |||
20 | #define WORD_INSN ".word" | 20 | #define WORD_INSN ".word" |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifdef CONFIG_CPU_MICROMIPS | ||
24 | #define NOP_INSN "nop32" | ||
25 | #else | ||
26 | #define NOP_INSN "nop" | ||
27 | #endif | ||
28 | |||
23 | static __always_inline bool arch_static_branch(struct static_key *key) | 29 | static __always_inline bool arch_static_branch(struct static_key *key) |
24 | { | 30 | { |
25 | asm_volatile_goto("1:\tnop\n\t" | 31 | asm_volatile_goto("1:\t" NOP_INSN "\n\t" |
26 | "nop\n\t" | 32 | "nop\n\t" |
27 | ".pushsection __jump_table, \"aw\"\n\t" | 33 | ".pushsection __jump_table, \"aw\"\n\t" |
28 | WORD_INSN " 1b, %l[l_yes], %0\n\t" | 34 | WORD_INSN " 1b, %l[l_yes], %0\n\t" |
diff --git a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h index 7d28f95b0512..6d69332f21ec 100644 --- a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h | |||
@@ -41,10 +41,8 @@ | |||
41 | #define cpu_has_mcheck 0 | 41 | #define cpu_has_mcheck 0 |
42 | #define cpu_has_mdmx 0 | 42 | #define cpu_has_mdmx 0 |
43 | #define cpu_has_mips16 0 | 43 | #define cpu_has_mips16 0 |
44 | #define cpu_has_mips32r1 0 | ||
45 | #define cpu_has_mips32r2 0 | 44 | #define cpu_has_mips32r2 0 |
46 | #define cpu_has_mips3d 0 | 45 | #define cpu_has_mips3d 0 |
47 | #define cpu_has_mips64r1 0 | ||
48 | #define cpu_has_mips64r2 0 | 46 | #define cpu_has_mips64r2 0 |
49 | #define cpu_has_mipsmt 0 | 47 | #define cpu_has_mipsmt 0 |
50 | #define cpu_has_prefetch 0 | 48 | #define cpu_has_prefetch 0 |
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index cf3b580c3df6..22a135ac91de 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -661,6 +661,8 @@ | |||
661 | #define MIPS_CONF6_SYND (_ULCAST_(1) << 13) | 661 | #define MIPS_CONF6_SYND (_ULCAST_(1) << 13) |
662 | /* proAptiv FTLB on/off bit */ | 662 | /* proAptiv FTLB on/off bit */ |
663 | #define MIPS_CONF6_FTLBEN (_ULCAST_(1) << 15) | 663 | #define MIPS_CONF6_FTLBEN (_ULCAST_(1) << 15) |
664 | /* FTLB probability bits */ | ||
665 | #define MIPS_CONF6_FTLBP_SHIFT (16) | ||
664 | 666 | ||
665 | #define MIPS_CONF7_WII (_ULCAST_(1) << 31) | 667 | #define MIPS_CONF7_WII (_ULCAST_(1) << 31) |
666 | 668 | ||
@@ -1324,7 +1326,7 @@ do { \ | |||
1324 | /* | 1326 | /* |
1325 | * Macros to access the floating point coprocessor control registers | 1327 | * Macros to access the floating point coprocessor control registers |
1326 | */ | 1328 | */ |
1327 | #define read_32bit_cp1_register(source) \ | 1329 | #define _read_32bit_cp1_register(source, gas_hardfloat) \ |
1328 | ({ \ | 1330 | ({ \ |
1329 | int __res; \ | 1331 | int __res; \ |
1330 | \ | 1332 | \ |
@@ -1334,12 +1336,21 @@ do { \ | |||
1334 | " # gas fails to assemble cfc1 for some archs, \n" \ | 1336 | " # gas fails to assemble cfc1 for some archs, \n" \ |
1335 | " # like Octeon. \n" \ | 1337 | " # like Octeon. \n" \ |
1336 | " .set mips1 \n" \ | 1338 | " .set mips1 \n" \ |
1339 | " "STR(gas_hardfloat)" \n" \ | ||
1337 | " cfc1 %0,"STR(source)" \n" \ | 1340 | " cfc1 %0,"STR(source)" \n" \ |
1338 | " .set pop \n" \ | 1341 | " .set pop \n" \ |
1339 | : "=r" (__res)); \ | 1342 | : "=r" (__res)); \ |
1340 | __res; \ | 1343 | __res; \ |
1341 | }) | 1344 | }) |
1342 | 1345 | ||
1346 | #ifdef GAS_HAS_SET_HARDFLOAT | ||
1347 | #define read_32bit_cp1_register(source) \ | ||
1348 | _read_32bit_cp1_register(source, .set hardfloat) | ||
1349 | #else | ||
1350 | #define read_32bit_cp1_register(source) \ | ||
1351 | _read_32bit_cp1_register(source, ) | ||
1352 | #endif | ||
1353 | |||
1343 | #ifdef HAVE_AS_DSP | 1354 | #ifdef HAVE_AS_DSP |
1344 | #define rddsp(mask) \ | 1355 | #define rddsp(mask) \ |
1345 | ({ \ | 1356 | ({ \ |
diff --git a/arch/mips/include/asm/r4kcache.h b/arch/mips/include/asm/r4kcache.h index 4520adc8699b..cd6e0afc6833 100644 --- a/arch/mips/include/asm/r4kcache.h +++ b/arch/mips/include/asm/r4kcache.h | |||
@@ -257,7 +257,11 @@ static inline void protected_flush_icache_line(unsigned long addr) | |||
257 | */ | 257 | */ |
258 | static inline void protected_writeback_dcache_line(unsigned long addr) | 258 | static inline void protected_writeback_dcache_line(unsigned long addr) |
259 | { | 259 | { |
260 | #ifdef CONFIG_EVA | ||
261 | protected_cachee_op(Hit_Writeback_Inv_D, addr); | ||
262 | #else | ||
260 | protected_cache_op(Hit_Writeback_Inv_D, addr); | 263 | protected_cache_op(Hit_Writeback_Inv_D, addr); |
264 | #endif | ||
261 | } | 265 | } |
262 | 266 | ||
263 | static inline void protected_writeback_scache_line(unsigned long addr) | 267 | static inline void protected_writeback_scache_line(unsigned long addr) |
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index a10951090234..22a5624e2fd2 100644 --- a/arch/mips/include/asm/uaccess.h +++ b/arch/mips/include/asm/uaccess.h | |||
@@ -301,7 +301,8 @@ do { \ | |||
301 | __get_kernel_common((x), size, __gu_ptr); \ | 301 | __get_kernel_common((x), size, __gu_ptr); \ |
302 | else \ | 302 | else \ |
303 | __get_user_common((x), size, __gu_ptr); \ | 303 | __get_user_common((x), size, __gu_ptr); \ |
304 | } \ | 304 | } else \ |
305 | (x) = 0; \ | ||
305 | \ | 306 | \ |
306 | __gu_err; \ | 307 | __gu_err; \ |
307 | }) | 308 | }) |
@@ -316,6 +317,7 @@ do { \ | |||
316 | " .insn \n" \ | 317 | " .insn \n" \ |
317 | " .section .fixup,\"ax\" \n" \ | 318 | " .section .fixup,\"ax\" \n" \ |
318 | "3: li %0, %4 \n" \ | 319 | "3: li %0, %4 \n" \ |
320 | " move %1, $0 \n" \ | ||
319 | " j 2b \n" \ | 321 | " j 2b \n" \ |
320 | " .previous \n" \ | 322 | " .previous \n" \ |
321 | " .section __ex_table,\"a\" \n" \ | 323 | " .section __ex_table,\"a\" \n" \ |
@@ -630,6 +632,7 @@ do { \ | |||
630 | " .insn \n" \ | 632 | " .insn \n" \ |
631 | " .section .fixup,\"ax\" \n" \ | 633 | " .section .fixup,\"ax\" \n" \ |
632 | "3: li %0, %4 \n" \ | 634 | "3: li %0, %4 \n" \ |
635 | " move %1, $0 \n" \ | ||
633 | " j 2b \n" \ | 636 | " j 2b \n" \ |
634 | " .previous \n" \ | 637 | " .previous \n" \ |
635 | " .section __ex_table,\"a\" \n" \ | 638 | " .section __ex_table,\"a\" \n" \ |
@@ -773,10 +776,11 @@ extern void __put_user_unaligned_unknown(void); | |||
773 | "jal\t" #destination "\n\t" | 776 | "jal\t" #destination "\n\t" |
774 | #endif | 777 | #endif |
775 | 778 | ||
776 | #ifndef CONFIG_CPU_DADDI_WORKAROUNDS | 779 | #if defined(CONFIG_CPU_DADDI_WORKAROUNDS) || (defined(CONFIG_EVA) && \ |
777 | #define DADDI_SCRATCH "$0" | 780 | defined(CONFIG_CPU_HAS_PREFETCH)) |
778 | #else | ||
779 | #define DADDI_SCRATCH "$3" | 781 | #define DADDI_SCRATCH "$3" |
782 | #else | ||
783 | #define DADDI_SCRATCH "$0" | ||
780 | #endif | 784 | #endif |
781 | 785 | ||
782 | extern size_t __copy_user(void *__to, const void *__from, size_t __n); | 786 | extern size_t __copy_user(void *__to, const void *__from, size_t __n); |
@@ -1418,7 +1422,7 @@ static inline long __strnlen_user(const char __user *s, long n) | |||
1418 | } | 1422 | } |
1419 | 1423 | ||
1420 | /* | 1424 | /* |
1421 | * strlen_user: - Get the size of a string in user space. | 1425 | * strnlen_user: - Get the size of a string in user space. |
1422 | * @str: The string to measure. | 1426 | * @str: The string to measure. |
1423 | * | 1427 | * |
1424 | * Context: User context only. This function may sleep. | 1428 | * Context: User context only. This function may sleep. |
@@ -1427,9 +1431,7 @@ static inline long __strnlen_user(const char __user *s, long n) | |||
1427 | * | 1431 | * |
1428 | * Returns the size of the string INCLUDING the terminating NUL. | 1432 | * Returns the size of the string INCLUDING the terminating NUL. |
1429 | * On exception, returns 0. | 1433 | * On exception, returns 0. |
1430 | * | 1434 | * If the string is too long, returns a value greater than @n. |
1431 | * If there is a limit on the length of a valid string, you may wish to | ||
1432 | * consider using strnlen_user() instead. | ||
1433 | */ | 1435 | */ |
1434 | static inline long strnlen_user(const char __user *s, long n) | 1436 | static inline long strnlen_user(const char __user *s, long n) |
1435 | { | 1437 | { |
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h index fdb4923777d1..d001bb1ad177 100644 --- a/arch/mips/include/uapi/asm/unistd.h +++ b/arch/mips/include/uapi/asm/unistd.h | |||
@@ -375,16 +375,17 @@ | |||
375 | #define __NR_seccomp (__NR_Linux + 352) | 375 | #define __NR_seccomp (__NR_Linux + 352) |
376 | #define __NR_getrandom (__NR_Linux + 353) | 376 | #define __NR_getrandom (__NR_Linux + 353) |
377 | #define __NR_memfd_create (__NR_Linux + 354) | 377 | #define __NR_memfd_create (__NR_Linux + 354) |
378 | #define __NR_bpf (__NR_Linux + 355) | ||
378 | 379 | ||
379 | /* | 380 | /* |
380 | * Offset of the last Linux o32 flavoured syscall | 381 | * Offset of the last Linux o32 flavoured syscall |
381 | */ | 382 | */ |
382 | #define __NR_Linux_syscalls 354 | 383 | #define __NR_Linux_syscalls 355 |
383 | 384 | ||
384 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 385 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
385 | 386 | ||
386 | #define __NR_O32_Linux 4000 | 387 | #define __NR_O32_Linux 4000 |
387 | #define __NR_O32_Linux_syscalls 354 | 388 | #define __NR_O32_Linux_syscalls 355 |
388 | 389 | ||
389 | #if _MIPS_SIM == _MIPS_SIM_ABI64 | 390 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
390 | 391 | ||
@@ -707,16 +708,17 @@ | |||
707 | #define __NR_seccomp (__NR_Linux + 312) | 708 | #define __NR_seccomp (__NR_Linux + 312) |
708 | #define __NR_getrandom (__NR_Linux + 313) | 709 | #define __NR_getrandom (__NR_Linux + 313) |
709 | #define __NR_memfd_create (__NR_Linux + 314) | 710 | #define __NR_memfd_create (__NR_Linux + 314) |
711 | #define __NR_bpf (__NR_Linux + 315) | ||
710 | 712 | ||
711 | /* | 713 | /* |
712 | * Offset of the last Linux 64-bit flavoured syscall | 714 | * Offset of the last Linux 64-bit flavoured syscall |
713 | */ | 715 | */ |
714 | #define __NR_Linux_syscalls 314 | 716 | #define __NR_Linux_syscalls 315 |
715 | 717 | ||
716 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ | 718 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
717 | 719 | ||
718 | #define __NR_64_Linux 5000 | 720 | #define __NR_64_Linux 5000 |
719 | #define __NR_64_Linux_syscalls 314 | 721 | #define __NR_64_Linux_syscalls 315 |
720 | 722 | ||
721 | #if _MIPS_SIM == _MIPS_SIM_NABI32 | 723 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
722 | 724 | ||
@@ -1043,15 +1045,16 @@ | |||
1043 | #define __NR_seccomp (__NR_Linux + 316) | 1045 | #define __NR_seccomp (__NR_Linux + 316) |
1044 | #define __NR_getrandom (__NR_Linux + 317) | 1046 | #define __NR_getrandom (__NR_Linux + 317) |
1045 | #define __NR_memfd_create (__NR_Linux + 318) | 1047 | #define __NR_memfd_create (__NR_Linux + 318) |
1048 | #define __NR_bpf (__NR_Linux + 319) | ||
1046 | 1049 | ||
1047 | /* | 1050 | /* |
1048 | * Offset of the last N32 flavoured syscall | 1051 | * Offset of the last N32 flavoured syscall |
1049 | */ | 1052 | */ |
1050 | #define __NR_Linux_syscalls 318 | 1053 | #define __NR_Linux_syscalls 319 |
1051 | 1054 | ||
1052 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ | 1055 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
1053 | 1056 | ||
1054 | #define __NR_N32_Linux 6000 | 1057 | #define __NR_N32_Linux 6000 |
1055 | #define __NR_N32_Linux_syscalls 318 | 1058 | #define __NR_N32_Linux_syscalls 319 |
1056 | 1059 | ||
1057 | #endif /* _UAPI_ASM_UNISTD_H */ | 1060 | #endif /* _UAPI_ASM_UNISTD_H */ |
diff --git a/arch/mips/kernel/bmips_vec.S b/arch/mips/kernel/bmips_vec.S index 290c23b51678..86495072a922 100644 --- a/arch/mips/kernel/bmips_vec.S +++ b/arch/mips/kernel/bmips_vec.S | |||
@@ -208,7 +208,6 @@ bmips_reset_nmi_vec_end: | |||
208 | END(bmips_reset_nmi_vec) | 208 | END(bmips_reset_nmi_vec) |
209 | 209 | ||
210 | .set pop | 210 | .set pop |
211 | .previous | ||
212 | 211 | ||
213 | /*********************************************************************** | 212 | /*********************************************************************** |
214 | * CPU1 warm restart vector (used for second and subsequent boots). | 213 | * CPU1 warm restart vector (used for second and subsequent boots). |
@@ -281,5 +280,3 @@ LEAF(bmips_enable_xks01) | |||
281 | jr ra | 280 | jr ra |
282 | 281 | ||
283 | END(bmips_enable_xks01) | 282 | END(bmips_enable_xks01) |
284 | |||
285 | .previous | ||
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c index 7b2df224f041..4d7d99d601cc 100644 --- a/arch/mips/kernel/branch.c +++ b/arch/mips/kernel/branch.c | |||
@@ -144,7 +144,7 @@ int __mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
144 | case mm_bc1t_op: | 144 | case mm_bc1t_op: |
145 | preempt_disable(); | 145 | preempt_disable(); |
146 | if (is_fpu_owner()) | 146 | if (is_fpu_owner()) |
147 | asm volatile("cfc1\t%0,$31" : "=r" (fcr31)); | 147 | fcr31 = read_32bit_cp1_register(CP1_STATUS); |
148 | else | 148 | else |
149 | fcr31 = current->thread.fpu.fcr31; | 149 | fcr31 = current->thread.fpu.fcr31; |
150 | preempt_enable(); | 150 | preempt_enable(); |
@@ -562,11 +562,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, | |||
562 | case cop1_op: | 562 | case cop1_op: |
563 | preempt_disable(); | 563 | preempt_disable(); |
564 | if (is_fpu_owner()) | 564 | if (is_fpu_owner()) |
565 | asm volatile( | 565 | fcr31 = read_32bit_cp1_register(CP1_STATUS); |
566 | ".set push\n" | ||
567 | "\t.set mips1\n" | ||
568 | "\tcfc1\t%0,$31\n" | ||
569 | "\t.set pop" : "=r" (fcr31)); | ||
570 | else | 566 | else |
571 | fcr31 = current->thread.fpu.fcr31; | 567 | fcr31 = current->thread.fpu.fcr31; |
572 | preempt_enable(); | 568 | preempt_enable(); |
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S index e6e97d2a5c9e..0384b05ab5a0 100644 --- a/arch/mips/kernel/cps-vec.S +++ b/arch/mips/kernel/cps-vec.S | |||
@@ -229,6 +229,7 @@ LEAF(mips_cps_core_init) | |||
229 | nop | 229 | nop |
230 | 230 | ||
231 | .set push | 231 | .set push |
232 | .set mips32r2 | ||
232 | .set mt | 233 | .set mt |
233 | 234 | ||
234 | /* Only allow 1 TC per VPE to execute... */ | 235 | /* Only allow 1 TC per VPE to execute... */ |
@@ -345,6 +346,7 @@ LEAF(mips_cps_boot_vpes) | |||
345 | nop | 346 | nop |
346 | 347 | ||
347 | .set push | 348 | .set push |
349 | .set mips32r2 | ||
348 | .set mt | 350 | .set mt |
349 | 351 | ||
350 | 1: /* Enter VPE configuration state */ | 352 | 1: /* Enter VPE configuration state */ |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 94c4a0c0a577..dc49cf30c2db 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -193,6 +193,32 @@ static void set_isa(struct cpuinfo_mips *c, unsigned int isa) | |||
193 | static char unknown_isa[] = KERN_ERR \ | 193 | static char unknown_isa[] = KERN_ERR \ |
194 | "Unsupported ISA type, c0.config0: %d."; | 194 | "Unsupported ISA type, c0.config0: %d."; |
195 | 195 | ||
196 | static unsigned int calculate_ftlb_probability(struct cpuinfo_mips *c) | ||
197 | { | ||
198 | |||
199 | unsigned int probability = c->tlbsize / c->tlbsizevtlb; | ||
200 | |||
201 | /* | ||
202 | * 0 = All TLBWR instructions go to FTLB | ||
203 | * 1 = 15:1: For every 16 TBLWR instructions, 15 go to the | ||
204 | * FTLB and 1 goes to the VTLB. | ||
205 | * 2 = 7:1: As above with 7:1 ratio. | ||
206 | * 3 = 3:1: As above with 3:1 ratio. | ||
207 | * | ||
208 | * Use the linear midpoint as the probability threshold. | ||
209 | */ | ||
210 | if (probability >= 12) | ||
211 | return 1; | ||
212 | else if (probability >= 6) | ||
213 | return 2; | ||
214 | else | ||
215 | /* | ||
216 | * So FTLB is less than 4 times bigger than VTLB. | ||
217 | * A 3:1 ratio can still be useful though. | ||
218 | */ | ||
219 | return 3; | ||
220 | } | ||
221 | |||
196 | static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) | 222 | static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) |
197 | { | 223 | { |
198 | unsigned int config6; | 224 | unsigned int config6; |
@@ -203,9 +229,14 @@ static void set_ftlb_enable(struct cpuinfo_mips *c, int enable) | |||
203 | case CPU_P5600: | 229 | case CPU_P5600: |
204 | /* proAptiv & related cores use Config6 to enable the FTLB */ | 230 | /* proAptiv & related cores use Config6 to enable the FTLB */ |
205 | config6 = read_c0_config6(); | 231 | config6 = read_c0_config6(); |
232 | /* Clear the old probability value */ | ||
233 | config6 &= ~(3 << MIPS_CONF6_FTLBP_SHIFT); | ||
206 | if (enable) | 234 | if (enable) |
207 | /* Enable FTLB */ | 235 | /* Enable FTLB */ |
208 | write_c0_config6(config6 | MIPS_CONF6_FTLBEN); | 236 | write_c0_config6(config6 | |
237 | (calculate_ftlb_probability(c) | ||
238 | << MIPS_CONF6_FTLBP_SHIFT) | ||
239 | | MIPS_CONF6_FTLBEN); | ||
209 | else | 240 | else |
210 | /* Disable FTLB */ | 241 | /* Disable FTLB */ |
211 | write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN); | 242 | write_c0_config6(config6 & ~MIPS_CONF6_FTLBEN); |
@@ -757,31 +788,34 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
757 | c->cputype = CPU_LOONGSON2; | 788 | c->cputype = CPU_LOONGSON2; |
758 | __cpu_name[cpu] = "ICT Loongson-2"; | 789 | __cpu_name[cpu] = "ICT Loongson-2"; |
759 | set_elf_platform(cpu, "loongson2e"); | 790 | set_elf_platform(cpu, "loongson2e"); |
791 | set_isa(c, MIPS_CPU_ISA_III); | ||
760 | break; | 792 | break; |
761 | case PRID_REV_LOONGSON2F: | 793 | case PRID_REV_LOONGSON2F: |
762 | c->cputype = CPU_LOONGSON2; | 794 | c->cputype = CPU_LOONGSON2; |
763 | __cpu_name[cpu] = "ICT Loongson-2"; | 795 | __cpu_name[cpu] = "ICT Loongson-2"; |
764 | set_elf_platform(cpu, "loongson2f"); | 796 | set_elf_platform(cpu, "loongson2f"); |
797 | set_isa(c, MIPS_CPU_ISA_III); | ||
765 | break; | 798 | break; |
766 | case PRID_REV_LOONGSON3A: | 799 | case PRID_REV_LOONGSON3A: |
767 | c->cputype = CPU_LOONGSON3; | 800 | c->cputype = CPU_LOONGSON3; |
768 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
769 | __cpu_name[cpu] = "ICT Loongson-3"; | 801 | __cpu_name[cpu] = "ICT Loongson-3"; |
770 | set_elf_platform(cpu, "loongson3a"); | 802 | set_elf_platform(cpu, "loongson3a"); |
803 | set_isa(c, MIPS_CPU_ISA_M64R1); | ||
771 | break; | 804 | break; |
772 | case PRID_REV_LOONGSON3B_R1: | 805 | case PRID_REV_LOONGSON3B_R1: |
773 | case PRID_REV_LOONGSON3B_R2: | 806 | case PRID_REV_LOONGSON3B_R2: |
774 | c->cputype = CPU_LOONGSON3; | 807 | c->cputype = CPU_LOONGSON3; |
775 | __cpu_name[cpu] = "ICT Loongson-3"; | 808 | __cpu_name[cpu] = "ICT Loongson-3"; |
776 | set_elf_platform(cpu, "loongson3b"); | 809 | set_elf_platform(cpu, "loongson3b"); |
810 | set_isa(c, MIPS_CPU_ISA_M64R1); | ||
777 | break; | 811 | break; |
778 | } | 812 | } |
779 | 813 | ||
780 | set_isa(c, MIPS_CPU_ISA_III); | ||
781 | c->options = R4K_OPTS | | 814 | c->options = R4K_OPTS | |
782 | MIPS_CPU_FPU | MIPS_CPU_LLSC | | 815 | MIPS_CPU_FPU | MIPS_CPU_LLSC | |
783 | MIPS_CPU_32FPR; | 816 | MIPS_CPU_32FPR; |
784 | c->tlbsize = 64; | 817 | c->tlbsize = 64; |
818 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
785 | break; | 819 | break; |
786 | case PRID_IMP_LOONGSON_32: /* Loongson-1 */ | 820 | case PRID_IMP_LOONGSON_32: /* Loongson-1 */ |
787 | decode_configs(c); | 821 | decode_configs(c); |
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S index ac35e12cb1f3..a5e26dd90592 100644 --- a/arch/mips/kernel/genex.S +++ b/arch/mips/kernel/genex.S | |||
@@ -358,6 +358,7 @@ NESTED(nmi_handler, PT_SIZE, sp) | |||
358 | .set push | 358 | .set push |
359 | /* gas fails to assemble cfc1 for some archs (octeon).*/ \ | 359 | /* gas fails to assemble cfc1 for some archs (octeon).*/ \ |
360 | .set mips1 | 360 | .set mips1 |
361 | SET_HARDFLOAT | ||
361 | cfc1 a1, fcr31 | 362 | cfc1 a1, fcr31 |
362 | li a2, ~(0x3f << 12) | 363 | li a2, ~(0x3f << 12) |
363 | and a2, a1 | 364 | and a2, a1 |
diff --git a/arch/mips/kernel/jump_label.c b/arch/mips/kernel/jump_label.c index 6001610cfe55..dda800e9e731 100644 --- a/arch/mips/kernel/jump_label.c +++ b/arch/mips/kernel/jump_label.c | |||
@@ -18,31 +18,53 @@ | |||
18 | 18 | ||
19 | #ifdef HAVE_JUMP_LABEL | 19 | #ifdef HAVE_JUMP_LABEL |
20 | 20 | ||
21 | #define J_RANGE_MASK ((1ul << 28) - 1) | 21 | /* |
22 | * Define parameters for the standard MIPS and the microMIPS jump | ||
23 | * instruction encoding respectively: | ||
24 | * | ||
25 | * - the ISA bit of the target, either 0 or 1 respectively, | ||
26 | * | ||
27 | * - the amount the jump target address is shifted right to fit in the | ||
28 | * immediate field of the machine instruction, either 2 or 1, | ||
29 | * | ||
30 | * - the mask determining the size of the jump region relative to the | ||
31 | * delay-slot instruction, either 256MB or 128MB, | ||
32 | * | ||
33 | * - the jump target alignment, either 4 or 2 bytes. | ||
34 | */ | ||
35 | #define J_ISA_BIT IS_ENABLED(CONFIG_CPU_MICROMIPS) | ||
36 | #define J_RANGE_SHIFT (2 - J_ISA_BIT) | ||
37 | #define J_RANGE_MASK ((1ul << (26 + J_RANGE_SHIFT)) - 1) | ||
38 | #define J_ALIGN_MASK ((1ul << J_RANGE_SHIFT) - 1) | ||
22 | 39 | ||
23 | void arch_jump_label_transform(struct jump_entry *e, | 40 | void arch_jump_label_transform(struct jump_entry *e, |
24 | enum jump_label_type type) | 41 | enum jump_label_type type) |
25 | { | 42 | { |
43 | union mips_instruction *insn_p; | ||
26 | union mips_instruction insn; | 44 | union mips_instruction insn; |
27 | union mips_instruction *insn_p = | ||
28 | (union mips_instruction *)(unsigned long)e->code; | ||
29 | 45 | ||
30 | /* Jump only works within a 256MB aligned region. */ | 46 | insn_p = (union mips_instruction *)msk_isa16_mode(e->code); |
31 | BUG_ON((e->target & ~J_RANGE_MASK) != (e->code & ~J_RANGE_MASK)); | 47 | |
48 | /* Jump only works within an aligned region its delay slot is in. */ | ||
49 | BUG_ON((e->target & ~J_RANGE_MASK) != ((e->code + 4) & ~J_RANGE_MASK)); | ||
32 | 50 | ||
33 | /* Target must have 4 byte alignment. */ | 51 | /* Target must have the right alignment and ISA must be preserved. */ |
34 | BUG_ON((e->target & 3) != 0); | 52 | BUG_ON((e->target & J_ALIGN_MASK) != J_ISA_BIT); |
35 | 53 | ||
36 | if (type == JUMP_LABEL_ENABLE) { | 54 | if (type == JUMP_LABEL_ENABLE) { |
37 | insn.j_format.opcode = j_op; | 55 | insn.j_format.opcode = J_ISA_BIT ? mm_j32_op : j_op; |
38 | insn.j_format.target = (e->target & J_RANGE_MASK) >> 2; | 56 | insn.j_format.target = e->target >> J_RANGE_SHIFT; |
39 | } else { | 57 | } else { |
40 | insn.word = 0; /* nop */ | 58 | insn.word = 0; /* nop */ |
41 | } | 59 | } |
42 | 60 | ||
43 | get_online_cpus(); | 61 | get_online_cpus(); |
44 | mutex_lock(&text_mutex); | 62 | mutex_lock(&text_mutex); |
45 | *insn_p = insn; | 63 | if (IS_ENABLED(CONFIG_CPU_MICROMIPS)) { |
64 | insn_p->halfword[0] = insn.word >> 16; | ||
65 | insn_p->halfword[1] = insn.word; | ||
66 | } else | ||
67 | *insn_p = insn; | ||
46 | 68 | ||
47 | flush_icache_range((unsigned long)insn_p, | 69 | flush_icache_range((unsigned long)insn_p, |
48 | (unsigned long)insn_p + sizeof(*insn_p)); | 70 | (unsigned long)insn_p + sizeof(*insn_p)); |
diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S index f31063dbdaeb..5ce3b746cedc 100644 --- a/arch/mips/kernel/r2300_fpu.S +++ b/arch/mips/kernel/r2300_fpu.S | |||
@@ -28,6 +28,8 @@ | |||
28 | .set mips1 | 28 | .set mips1 |
29 | /* Save floating point context */ | 29 | /* Save floating point context */ |
30 | LEAF(_save_fp_context) | 30 | LEAF(_save_fp_context) |
31 | .set push | ||
32 | SET_HARDFLOAT | ||
31 | li v0, 0 # assume success | 33 | li v0, 0 # assume success |
32 | cfc1 t1,fcr31 | 34 | cfc1 t1,fcr31 |
33 | EX(swc1 $f0,(SC_FPREGS+0)(a0)) | 35 | EX(swc1 $f0,(SC_FPREGS+0)(a0)) |
@@ -65,6 +67,7 @@ LEAF(_save_fp_context) | |||
65 | EX(sw t1,(SC_FPC_CSR)(a0)) | 67 | EX(sw t1,(SC_FPC_CSR)(a0)) |
66 | cfc1 t0,$0 # implementation/version | 68 | cfc1 t0,$0 # implementation/version |
67 | jr ra | 69 | jr ra |
70 | .set pop | ||
68 | .set nomacro | 71 | .set nomacro |
69 | EX(sw t0,(SC_FPC_EIR)(a0)) | 72 | EX(sw t0,(SC_FPC_EIR)(a0)) |
70 | .set macro | 73 | .set macro |
@@ -80,6 +83,8 @@ LEAF(_save_fp_context) | |||
80 | * stack frame which might have been changed by the user. | 83 | * stack frame which might have been changed by the user. |
81 | */ | 84 | */ |
82 | LEAF(_restore_fp_context) | 85 | LEAF(_restore_fp_context) |
86 | .set push | ||
87 | SET_HARDFLOAT | ||
83 | li v0, 0 # assume success | 88 | li v0, 0 # assume success |
84 | EX(lw t0,(SC_FPC_CSR)(a0)) | 89 | EX(lw t0,(SC_FPC_CSR)(a0)) |
85 | EX(lwc1 $f0,(SC_FPREGS+0)(a0)) | 90 | EX(lwc1 $f0,(SC_FPREGS+0)(a0)) |
@@ -116,6 +121,7 @@ LEAF(_restore_fp_context) | |||
116 | EX(lwc1 $f31,(SC_FPREGS+248)(a0)) | 121 | EX(lwc1 $f31,(SC_FPREGS+248)(a0)) |
117 | jr ra | 122 | jr ra |
118 | ctc1 t0,fcr31 | 123 | ctc1 t0,fcr31 |
124 | .set pop | ||
119 | END(_restore_fp_context) | 125 | END(_restore_fp_context) |
120 | .set reorder | 126 | .set reorder |
121 | 127 | ||
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S index 20b7b040e76f..435ea652f5fa 100644 --- a/arch/mips/kernel/r2300_switch.S +++ b/arch/mips/kernel/r2300_switch.S | |||
@@ -120,6 +120,9 @@ LEAF(_restore_fp) | |||
120 | 120 | ||
121 | #define FPU_DEFAULT 0x00000000 | 121 | #define FPU_DEFAULT 0x00000000 |
122 | 122 | ||
123 | .set push | ||
124 | SET_HARDFLOAT | ||
125 | |||
123 | LEAF(_init_fpu) | 126 | LEAF(_init_fpu) |
124 | mfc0 t0, CP0_STATUS | 127 | mfc0 t0, CP0_STATUS |
125 | li t1, ST0_CU1 | 128 | li t1, ST0_CU1 |
@@ -165,3 +168,5 @@ LEAF(_init_fpu) | |||
165 | mtc1 t0, $f31 | 168 | mtc1 t0, $f31 |
166 | jr ra | 169 | jr ra |
167 | END(_init_fpu) | 170 | END(_init_fpu) |
171 | |||
172 | .set pop | ||
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S index 8352523568e6..6c160c67984c 100644 --- a/arch/mips/kernel/r4k_fpu.S +++ b/arch/mips/kernel/r4k_fpu.S | |||
@@ -19,8 +19,12 @@ | |||
19 | #include <asm/asm-offsets.h> | 19 | #include <asm/asm-offsets.h> |
20 | #include <asm/regdef.h> | 20 | #include <asm/regdef.h> |
21 | 21 | ||
22 | /* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */ | ||
23 | #undef fp | ||
24 | |||
22 | .macro EX insn, reg, src | 25 | .macro EX insn, reg, src |
23 | .set push | 26 | .set push |
27 | SET_HARDFLOAT | ||
24 | .set nomacro | 28 | .set nomacro |
25 | .ex\@: \insn \reg, \src | 29 | .ex\@: \insn \reg, \src |
26 | .set pop | 30 | .set pop |
@@ -33,12 +37,17 @@ | |||
33 | .set arch=r4000 | 37 | .set arch=r4000 |
34 | 38 | ||
35 | LEAF(_save_fp_context) | 39 | LEAF(_save_fp_context) |
40 | .set push | ||
41 | SET_HARDFLOAT | ||
36 | cfc1 t1, fcr31 | 42 | cfc1 t1, fcr31 |
43 | .set pop | ||
37 | 44 | ||
38 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) | 45 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) |
39 | .set push | 46 | .set push |
47 | SET_HARDFLOAT | ||
40 | #ifdef CONFIG_CPU_MIPS32_R2 | 48 | #ifdef CONFIG_CPU_MIPS32_R2 |
41 | .set mips64r2 | 49 | .set mips32r2 |
50 | .set fp=64 | ||
42 | mfc0 t0, CP0_STATUS | 51 | mfc0 t0, CP0_STATUS |
43 | sll t0, t0, 5 | 52 | sll t0, t0, 5 |
44 | bgez t0, 1f # skip storing odd if FR=0 | 53 | bgez t0, 1f # skip storing odd if FR=0 |
@@ -64,6 +73,8 @@ LEAF(_save_fp_context) | |||
64 | 1: .set pop | 73 | 1: .set pop |
65 | #endif | 74 | #endif |
66 | 75 | ||
76 | .set push | ||
77 | SET_HARDFLOAT | ||
67 | /* Store the 16 even double precision registers */ | 78 | /* Store the 16 even double precision registers */ |
68 | EX sdc1 $f0, SC_FPREGS+0(a0) | 79 | EX sdc1 $f0, SC_FPREGS+0(a0) |
69 | EX sdc1 $f2, SC_FPREGS+16(a0) | 80 | EX sdc1 $f2, SC_FPREGS+16(a0) |
@@ -84,11 +95,14 @@ LEAF(_save_fp_context) | |||
84 | EX sw t1, SC_FPC_CSR(a0) | 95 | EX sw t1, SC_FPC_CSR(a0) |
85 | jr ra | 96 | jr ra |
86 | li v0, 0 # success | 97 | li v0, 0 # success |
98 | .set pop | ||
87 | END(_save_fp_context) | 99 | END(_save_fp_context) |
88 | 100 | ||
89 | #ifdef CONFIG_MIPS32_COMPAT | 101 | #ifdef CONFIG_MIPS32_COMPAT |
90 | /* Save 32-bit process floating point context */ | 102 | /* Save 32-bit process floating point context */ |
91 | LEAF(_save_fp_context32) | 103 | LEAF(_save_fp_context32) |
104 | .set push | ||
105 | SET_HARDFLOAT | ||
92 | cfc1 t1, fcr31 | 106 | cfc1 t1, fcr31 |
93 | 107 | ||
94 | mfc0 t0, CP0_STATUS | 108 | mfc0 t0, CP0_STATUS |
@@ -134,6 +148,7 @@ LEAF(_save_fp_context32) | |||
134 | EX sw t1, SC32_FPC_CSR(a0) | 148 | EX sw t1, SC32_FPC_CSR(a0) |
135 | cfc1 t0, $0 # implementation/version | 149 | cfc1 t0, $0 # implementation/version |
136 | EX sw t0, SC32_FPC_EIR(a0) | 150 | EX sw t0, SC32_FPC_EIR(a0) |
151 | .set pop | ||
137 | 152 | ||
138 | jr ra | 153 | jr ra |
139 | li v0, 0 # success | 154 | li v0, 0 # success |
@@ -150,8 +165,10 @@ LEAF(_restore_fp_context) | |||
150 | 165 | ||
151 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) | 166 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) |
152 | .set push | 167 | .set push |
168 | SET_HARDFLOAT | ||
153 | #ifdef CONFIG_CPU_MIPS32_R2 | 169 | #ifdef CONFIG_CPU_MIPS32_R2 |
154 | .set mips64r2 | 170 | .set mips32r2 |
171 | .set fp=64 | ||
155 | mfc0 t0, CP0_STATUS | 172 | mfc0 t0, CP0_STATUS |
156 | sll t0, t0, 5 | 173 | sll t0, t0, 5 |
157 | bgez t0, 1f # skip loading odd if FR=0 | 174 | bgez t0, 1f # skip loading odd if FR=0 |
@@ -175,6 +192,8 @@ LEAF(_restore_fp_context) | |||
175 | EX ldc1 $f31, SC_FPREGS+248(a0) | 192 | EX ldc1 $f31, SC_FPREGS+248(a0) |
176 | 1: .set pop | 193 | 1: .set pop |
177 | #endif | 194 | #endif |
195 | .set push | ||
196 | SET_HARDFLOAT | ||
178 | EX ldc1 $f0, SC_FPREGS+0(a0) | 197 | EX ldc1 $f0, SC_FPREGS+0(a0) |
179 | EX ldc1 $f2, SC_FPREGS+16(a0) | 198 | EX ldc1 $f2, SC_FPREGS+16(a0) |
180 | EX ldc1 $f4, SC_FPREGS+32(a0) | 199 | EX ldc1 $f4, SC_FPREGS+32(a0) |
@@ -192,6 +211,7 @@ LEAF(_restore_fp_context) | |||
192 | EX ldc1 $f28, SC_FPREGS+224(a0) | 211 | EX ldc1 $f28, SC_FPREGS+224(a0) |
193 | EX ldc1 $f30, SC_FPREGS+240(a0) | 212 | EX ldc1 $f30, SC_FPREGS+240(a0) |
194 | ctc1 t1, fcr31 | 213 | ctc1 t1, fcr31 |
214 | .set pop | ||
195 | jr ra | 215 | jr ra |
196 | li v0, 0 # success | 216 | li v0, 0 # success |
197 | END(_restore_fp_context) | 217 | END(_restore_fp_context) |
@@ -199,6 +219,8 @@ LEAF(_restore_fp_context) | |||
199 | #ifdef CONFIG_MIPS32_COMPAT | 219 | #ifdef CONFIG_MIPS32_COMPAT |
200 | LEAF(_restore_fp_context32) | 220 | LEAF(_restore_fp_context32) |
201 | /* Restore an o32 sigcontext. */ | 221 | /* Restore an o32 sigcontext. */ |
222 | .set push | ||
223 | SET_HARDFLOAT | ||
202 | EX lw t1, SC32_FPC_CSR(a0) | 224 | EX lw t1, SC32_FPC_CSR(a0) |
203 | 225 | ||
204 | mfc0 t0, CP0_STATUS | 226 | mfc0 t0, CP0_STATUS |
@@ -242,6 +264,7 @@ LEAF(_restore_fp_context32) | |||
242 | ctc1 t1, fcr31 | 264 | ctc1 t1, fcr31 |
243 | jr ra | 265 | jr ra |
244 | li v0, 0 # success | 266 | li v0, 0 # success |
267 | .set pop | ||
245 | END(_restore_fp_context32) | 268 | END(_restore_fp_context32) |
246 | #endif | 269 | #endif |
247 | 270 | ||
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S index 4c4ec1812420..64591e671878 100644 --- a/arch/mips/kernel/r4k_switch.S +++ b/arch/mips/kernel/r4k_switch.S | |||
@@ -22,6 +22,9 @@ | |||
22 | 22 | ||
23 | #include <asm/asmmacro.h> | 23 | #include <asm/asmmacro.h> |
24 | 24 | ||
25 | /* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */ | ||
26 | #undef fp | ||
27 | |||
25 | /* | 28 | /* |
26 | * Offset to the current process status flags, the first 32 bytes of the | 29 | * Offset to the current process status flags, the first 32 bytes of the |
27 | * stack are not used. | 30 | * stack are not used. |
@@ -65,8 +68,12 @@ | |||
65 | bgtz a3, 1f | 68 | bgtz a3, 1f |
66 | 69 | ||
67 | /* Save 128b MSA vector context + scalar FP control & status. */ | 70 | /* Save 128b MSA vector context + scalar FP control & status. */ |
71 | .set push | ||
72 | SET_HARDFLOAT | ||
68 | cfc1 t1, fcr31 | 73 | cfc1 t1, fcr31 |
69 | msa_save_all a0 | 74 | msa_save_all a0 |
75 | .set pop /* SET_HARDFLOAT */ | ||
76 | |||
70 | sw t1, THREAD_FCR31(a0) | 77 | sw t1, THREAD_FCR31(a0) |
71 | b 2f | 78 | b 2f |
72 | 79 | ||
@@ -161,6 +168,9 @@ LEAF(_init_msa_upper) | |||
161 | 168 | ||
162 | #define FPU_DEFAULT 0x00000000 | 169 | #define FPU_DEFAULT 0x00000000 |
163 | 170 | ||
171 | .set push | ||
172 | SET_HARDFLOAT | ||
173 | |||
164 | LEAF(_init_fpu) | 174 | LEAF(_init_fpu) |
165 | mfc0 t0, CP0_STATUS | 175 | mfc0 t0, CP0_STATUS |
166 | li t1, ST0_CU1 | 176 | li t1, ST0_CU1 |
@@ -232,7 +242,8 @@ LEAF(_init_fpu) | |||
232 | 242 | ||
233 | #ifdef CONFIG_CPU_MIPS32_R2 | 243 | #ifdef CONFIG_CPU_MIPS32_R2 |
234 | .set push | 244 | .set push |
235 | .set mips64r2 | 245 | .set mips32r2 |
246 | .set fp=64 | ||
236 | sll t0, t0, 5 # is Status.FR set? | 247 | sll t0, t0, 5 # is Status.FR set? |
237 | bgez t0, 1f # no: skip setting upper 32b | 248 | bgez t0, 1f # no: skip setting upper 32b |
238 | 249 | ||
@@ -291,3 +302,5 @@ LEAF(_init_fpu) | |||
291 | #endif | 302 | #endif |
292 | jr ra | 303 | jr ra |
293 | END(_init_fpu) | 304 | END(_init_fpu) |
305 | |||
306 | .set pop /* SET_HARDFLOAT */ | ||
diff --git a/arch/mips/kernel/r6000_fpu.S b/arch/mips/kernel/r6000_fpu.S index da0fbe46d83b..47077380c15c 100644 --- a/arch/mips/kernel/r6000_fpu.S +++ b/arch/mips/kernel/r6000_fpu.S | |||
@@ -18,6 +18,9 @@ | |||
18 | 18 | ||
19 | .set noreorder | 19 | .set noreorder |
20 | .set mips2 | 20 | .set mips2 |
21 | .set push | ||
22 | SET_HARDFLOAT | ||
23 | |||
21 | /* Save floating point context */ | 24 | /* Save floating point context */ |
22 | LEAF(_save_fp_context) | 25 | LEAF(_save_fp_context) |
23 | mfc0 t0,CP0_STATUS | 26 | mfc0 t0,CP0_STATUS |
@@ -85,3 +88,5 @@ | |||
85 | 1: jr ra | 88 | 1: jr ra |
86 | nop | 89 | nop |
87 | END(_restore_fp_context) | 90 | END(_restore_fp_context) |
91 | |||
92 | .set pop /* SET_HARDFLOAT */ | ||
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c index 31b1b763cb29..c5c4fd54d797 100644 --- a/arch/mips/kernel/rtlx.c +++ b/arch/mips/kernel/rtlx.c | |||
@@ -94,12 +94,12 @@ int rtlx_open(int index, int can_sleep) | |||
94 | int ret = 0; | 94 | int ret = 0; |
95 | 95 | ||
96 | if (index >= RTLX_CHANNELS) { | 96 | if (index >= RTLX_CHANNELS) { |
97 | pr_debug(KERN_DEBUG "rtlx_open index out of range\n"); | 97 | pr_debug("rtlx_open index out of range\n"); |
98 | return -ENOSYS; | 98 | return -ENOSYS; |
99 | } | 99 | } |
100 | 100 | ||
101 | if (atomic_inc_return(&channel_wqs[index].in_open) > 1) { | 101 | if (atomic_inc_return(&channel_wqs[index].in_open) > 1) { |
102 | pr_debug(KERN_DEBUG "rtlx_open channel %d already opened\n", index); | 102 | pr_debug("rtlx_open channel %d already opened\n", index); |
103 | ret = -EBUSY; | 103 | ret = -EBUSY; |
104 | goto out_fail; | 104 | goto out_fail; |
105 | } | 105 | } |
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index 744cd10ba599..00cad1005a16 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -579,3 +579,4 @@ EXPORT(sys_call_table) | |||
579 | PTR sys_seccomp | 579 | PTR sys_seccomp |
580 | PTR sys_getrandom | 580 | PTR sys_getrandom |
581 | PTR sys_memfd_create | 581 | PTR sys_memfd_create |
582 | PTR sys_bpf /* 4355 */ | ||
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index 002b1bc09c38..5251565e344b 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
@@ -434,4 +434,5 @@ EXPORT(sys_call_table) | |||
434 | PTR sys_seccomp | 434 | PTR sys_seccomp |
435 | PTR sys_getrandom | 435 | PTR sys_getrandom |
436 | PTR sys_memfd_create | 436 | PTR sys_memfd_create |
437 | PTR sys_bpf /* 5315 */ | ||
437 | .size sys_call_table,.-sys_call_table | 438 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index ca6cbbe9805b..77e74398b828 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -427,4 +427,5 @@ EXPORT(sysn32_call_table) | |||
427 | PTR sys_seccomp | 427 | PTR sys_seccomp |
428 | PTR sys_getrandom | 428 | PTR sys_getrandom |
429 | PTR sys_memfd_create | 429 | PTR sys_memfd_create |
430 | PTR sys_bpf | ||
430 | .size sysn32_call_table,.-sysn32_call_table | 431 | .size sysn32_call_table,.-sysn32_call_table |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 9e10d11fbb84..6f8db9f728e8 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -564,4 +564,5 @@ EXPORT(sys32_call_table) | |||
564 | PTR sys_seccomp | 564 | PTR sys_seccomp |
565 | PTR sys_getrandom | 565 | PTR sys_getrandom |
566 | PTR sys_memfd_create | 566 | PTR sys_memfd_create |
567 | PTR sys_bpf /* 4355 */ | ||
567 | .size sys32_call_table,.-sys32_call_table | 568 | .size sys32_call_table,.-sys32_call_table |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index b3b8f0d9d4a7..f3b635f86c39 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -485,7 +485,7 @@ static void __init bootmem_init(void) | |||
485 | * NOTE: historically plat_mem_setup did the entire platform initialization. | 485 | * NOTE: historically plat_mem_setup did the entire platform initialization. |
486 | * This was rather impractical because it meant plat_mem_setup had to | 486 | * This was rather impractical because it meant plat_mem_setup had to |
487 | * get away without any kind of memory allocator. To keep old code from | 487 | * get away without any kind of memory allocator. To keep old code from |
488 | * breaking plat_setup was just renamed to plat_setup and a second platform | 488 | * breaking plat_setup was just renamed to plat_mem_setup and a second platform |
489 | * initialization hook for anything else was introduced. | 489 | * initialization hook for anything else was introduced. |
490 | */ | 490 | */ |
491 | 491 | ||
@@ -493,7 +493,7 @@ static int usermem __initdata; | |||
493 | 493 | ||
494 | static int __init early_parse_mem(char *p) | 494 | static int __init early_parse_mem(char *p) |
495 | { | 495 | { |
496 | unsigned long start, size; | 496 | phys_t start, size; |
497 | 497 | ||
498 | /* | 498 | /* |
499 | * If a user specifies memory size, we | 499 | * If a user specifies memory size, we |
@@ -683,7 +683,8 @@ static void __init arch_mem_init(char **cmdline_p) | |||
683 | dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); | 683 | dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); |
684 | /* Tell bootmem about cma reserved memblock section */ | 684 | /* Tell bootmem about cma reserved memblock section */ |
685 | for_each_memblock(reserved, reg) | 685 | for_each_memblock(reserved, reg) |
686 | reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); | 686 | if (reg->size != 0) |
687 | reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); | ||
687 | } | 688 | } |
688 | 689 | ||
689 | static void __init resource_init(void) | 690 | static void __init resource_init(void) |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 1d57605e4615..16f1e4f2bf3c 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -658,13 +658,13 @@ static int signal_setup(void) | |||
658 | save_fp_context = _save_fp_context; | 658 | save_fp_context = _save_fp_context; |
659 | restore_fp_context = _restore_fp_context; | 659 | restore_fp_context = _restore_fp_context; |
660 | } else { | 660 | } else { |
661 | save_fp_context = copy_fp_from_sigcontext; | 661 | save_fp_context = copy_fp_to_sigcontext; |
662 | restore_fp_context = copy_fp_to_sigcontext; | 662 | restore_fp_context = copy_fp_from_sigcontext; |
663 | } | 663 | } |
664 | #endif /* CONFIG_SMP */ | 664 | #endif /* CONFIG_SMP */ |
665 | #else | 665 | #else |
666 | save_fp_context = copy_fp_from_sigcontext;; | 666 | save_fp_context = copy_fp_to_sigcontext; |
667 | restore_fp_context = copy_fp_to_sigcontext; | 667 | restore_fp_context = copy_fp_from_sigcontext; |
668 | #endif | 668 | #endif |
669 | 669 | ||
670 | return 0; | 670 | return 0; |
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S index c17ef80cf65a..5d3238af9b5c 100644 --- a/arch/mips/lib/memcpy.S +++ b/arch/mips/lib/memcpy.S | |||
@@ -503,6 +503,7 @@ | |||
503 | STOREB(t0, NBYTES-2(dst), .Ls_exc_p1\@) | 503 | STOREB(t0, NBYTES-2(dst), .Ls_exc_p1\@) |
504 | .Ldone\@: | 504 | .Ldone\@: |
505 | jr ra | 505 | jr ra |
506 | nop | ||
506 | .if __memcpy == 1 | 507 | .if __memcpy == 1 |
507 | END(memcpy) | 508 | END(memcpy) |
508 | .set __memcpy, 0 | 509 | .set __memcpy, 0 |
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c index 91615c2ef0cf..1ef365ab3cd3 100644 --- a/arch/mips/lib/r3k_dump_tlb.c +++ b/arch/mips/lib/r3k_dump_tlb.c | |||
@@ -34,7 +34,7 @@ static void dump_tlb(int first, int last) | |||
34 | entrylo0 = read_c0_entrylo0(); | 34 | entrylo0 = read_c0_entrylo0(); |
35 | 35 | ||
36 | /* Unused entries have a virtual address of KSEG0. */ | 36 | /* Unused entries have a virtual address of KSEG0. */ |
37 | if ((entryhi & 0xffffe000) != 0x80000000 | 37 | if ((entryhi & 0xfffff000) != 0x80000000 |
38 | && (entryhi & 0xfc0) == asid) { | 38 | && (entryhi & 0xfc0) == asid) { |
39 | /* | 39 | /* |
40 | * Only print entries in use | 40 | * Only print entries in use |
@@ -43,7 +43,7 @@ static void dump_tlb(int first, int last) | |||
43 | 43 | ||
44 | printk("va=%08lx asid=%08lx" | 44 | printk("va=%08lx asid=%08lx" |
45 | " [pa=%06lx n=%d d=%d v=%d g=%d]", | 45 | " [pa=%06lx n=%d d=%d v=%d g=%d]", |
46 | (entryhi & 0xffffe000), | 46 | (entryhi & 0xfffff000), |
47 | entryhi & 0xfc0, | 47 | entryhi & 0xfc0, |
48 | entrylo0 & PAGE_MASK, | 48 | entrylo0 & PAGE_MASK, |
49 | (entrylo0 & (1 << 11)) ? 1 : 0, | 49 | (entrylo0 & (1 << 11)) ? 1 : 0, |
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S index f3af6995e2a6..7d12c0dded3d 100644 --- a/arch/mips/lib/strnlen_user.S +++ b/arch/mips/lib/strnlen_user.S | |||
@@ -40,9 +40,11 @@ FEXPORT(__strnlen_\func\()_nocheck_asm) | |||
40 | .else | 40 | .else |
41 | EX(lbe, t0, (v0), .Lfault\@) | 41 | EX(lbe, t0, (v0), .Lfault\@) |
42 | .endif | 42 | .endif |
43 | PTR_ADDIU v0, 1 | 43 | .set noreorder |
44 | bnez t0, 1b | 44 | bnez t0, 1b |
45 | 1: PTR_SUBU v0, a0 | 45 | 1: PTR_ADDIU v0, 1 |
46 | .set reorder | ||
47 | PTR_SUBU v0, a0 | ||
46 | jr ra | 48 | jr ra |
47 | END(__strnlen_\func\()_asm) | 49 | END(__strnlen_\func\()_asm) |
48 | 50 | ||
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile index 0bb9cc9dc621..d87e03330b29 100644 --- a/arch/mips/loongson/common/Makefile +++ b/arch/mips/loongson/common/Makefile | |||
@@ -11,7 +11,8 @@ obj-$(CONFIG_PCI) += pci.o | |||
11 | # Serial port support | 11 | # Serial port support |
12 | # | 12 | # |
13 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 13 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
14 | obj-$(CONFIG_SERIAL_8250) += serial.o | 14 | loongson-serial-$(CONFIG_SERIAL_8250) := serial.o |
15 | obj-y += $(loongson-serial-m) $(loongson-serial-y) | ||
15 | obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o | 16 | obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o |
16 | obj-$(CONFIG_LOONGSON_MC146818) += rtc.o | 17 | obj-$(CONFIG_LOONGSON_MC146818) += rtc.o |
17 | 18 | ||
diff --git a/arch/mips/loongson/loongson-3/numa.c b/arch/mips/loongson/loongson-3/numa.c index 37ed184398c6..42323bcc5d28 100644 --- a/arch/mips/loongson/loongson-3/numa.c +++ b/arch/mips/loongson/loongson-3/numa.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | static struct node_data prealloc__node_data[MAX_NUMNODES]; | 34 | static struct node_data prealloc__node_data[MAX_NUMNODES]; |
35 | unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; | 35 | unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; |
36 | EXPORT_SYMBOL(__node_distances); | ||
36 | struct node_data *__node_data[MAX_NUMNODES]; | 37 | struct node_data *__node_data[MAX_NUMNODES]; |
37 | EXPORT_SYMBOL(__node_data); | 38 | EXPORT_SYMBOL(__node_data); |
38 | 39 | ||
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 51a0fde4bec1..cac529a405b8 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -584,11 +584,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
584 | if (insn.i_format.rs == bc_op) { | 584 | if (insn.i_format.rs == bc_op) { |
585 | preempt_disable(); | 585 | preempt_disable(); |
586 | if (is_fpu_owner()) | 586 | if (is_fpu_owner()) |
587 | asm volatile( | 587 | fcr31 = read_32bit_cp1_register(CP1_STATUS); |
588 | ".set push\n" | ||
589 | "\t.set mips1\n" | ||
590 | "\tcfc1\t%0,$31\n" | ||
591 | "\t.set pop" : "=r" (fcr31)); | ||
592 | else | 588 | else |
593 | fcr31 = current->thread.fpu.fcr31; | 589 | fcr31 = current->thread.fpu.fcr31; |
594 | preempt_enable(); | 590 | preempt_enable(); |
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index fa6ebd4bc9e9..c3917e251f59 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c | |||
@@ -299,6 +299,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) | |||
299 | 299 | ||
300 | local_irq_save(flags); | 300 | local_irq_save(flags); |
301 | 301 | ||
302 | htw_stop(); | ||
302 | pid = read_c0_entryhi() & ASID_MASK; | 303 | pid = read_c0_entryhi() & ASID_MASK; |
303 | address &= (PAGE_MASK << 1); | 304 | address &= (PAGE_MASK << 1); |
304 | write_c0_entryhi(address | pid); | 305 | write_c0_entryhi(address | pid); |
@@ -346,6 +347,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) | |||
346 | tlb_write_indexed(); | 347 | tlb_write_indexed(); |
347 | } | 348 | } |
348 | tlbw_use_hazard(); | 349 | tlbw_use_hazard(); |
350 | htw_start(); | ||
349 | flush_itlb_vm(vma); | 351 | flush_itlb_vm(vma); |
350 | local_irq_restore(flags); | 352 | local_irq_restore(flags); |
351 | } | 353 | } |
@@ -422,6 +424,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
422 | 424 | ||
423 | local_irq_save(flags); | 425 | local_irq_save(flags); |
424 | /* Save old context and create impossible VPN2 value */ | 426 | /* Save old context and create impossible VPN2 value */ |
427 | htw_stop(); | ||
425 | old_ctx = read_c0_entryhi(); | 428 | old_ctx = read_c0_entryhi(); |
426 | old_pagemask = read_c0_pagemask(); | 429 | old_pagemask = read_c0_pagemask(); |
427 | wired = read_c0_wired(); | 430 | wired = read_c0_wired(); |
@@ -443,6 +446,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1, | |||
443 | 446 | ||
444 | write_c0_entryhi(old_ctx); | 447 | write_c0_entryhi(old_ctx); |
445 | write_c0_pagemask(old_pagemask); | 448 | write_c0_pagemask(old_pagemask); |
449 | htw_start(); | ||
446 | out: | 450 | out: |
447 | local_irq_restore(flags); | 451 | local_irq_restore(flags); |
448 | return ret; | 452 | return ret; |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index b5f228e7eae6..e3328a96e809 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -1872,8 +1872,16 @@ build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l, | |||
1872 | uasm_l_smp_pgtable_change(l, *p); | 1872 | uasm_l_smp_pgtable_change(l, *p); |
1873 | #endif | 1873 | #endif |
1874 | iPTE_LW(p, wr.r1, wr.r2); /* get even pte */ | 1874 | iPTE_LW(p, wr.r1, wr.r2); /* get even pte */ |
1875 | if (!m4kc_tlbp_war()) | 1875 | if (!m4kc_tlbp_war()) { |
1876 | build_tlb_probe_entry(p); | 1876 | build_tlb_probe_entry(p); |
1877 | if (cpu_has_htw) { | ||
1878 | /* race condition happens, leaving */ | ||
1879 | uasm_i_ehb(p); | ||
1880 | uasm_i_mfc0(p, wr.r3, C0_INDEX); | ||
1881 | uasm_il_bltz(p, r, wr.r3, label_leave); | ||
1882 | uasm_i_nop(p); | ||
1883 | } | ||
1884 | } | ||
1877 | return wr; | 1885 | return wr; |
1878 | } | 1886 | } |
1879 | 1887 | ||
diff --git a/arch/mips/mti-sead3/sead3-leds.c b/arch/mips/mti-sead3/sead3-leds.c index 20102a6d4141..c427c5778186 100644 --- a/arch/mips/mti-sead3/sead3-leds.c +++ b/arch/mips/mti-sead3/sead3-leds.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. | 6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. |
7 | */ | 7 | */ |
8 | #include <linux/module.h> | 8 | #include <linux/init.h> |
9 | #include <linux/leds.h> | 9 | #include <linux/leds.h> |
10 | #include <linux/platform_device.h> | 10 | #include <linux/platform_device.h> |
11 | 11 | ||
@@ -76,8 +76,4 @@ static int __init led_init(void) | |||
76 | return platform_device_register(&fled_device); | 76 | return platform_device_register(&fled_device); |
77 | } | 77 | } |
78 | 78 | ||
79 | module_init(led_init); | 79 | device_initcall(led_init); |
80 | |||
81 | MODULE_AUTHOR("Chris Dearman <chris@mips.com>"); | ||
82 | MODULE_LICENSE("GPL"); | ||
83 | MODULE_DESCRIPTION("LED probe driver for SEAD-3"); | ||
diff --git a/arch/mips/netlogic/xlp/Makefile b/arch/mips/netlogic/xlp/Makefile index be358a8050c5..6b43af0a34d9 100644 --- a/arch/mips/netlogic/xlp/Makefile +++ b/arch/mips/netlogic/xlp/Makefile | |||
@@ -1,6 +1,10 @@ | |||
1 | obj-y += setup.o nlm_hal.o cop2-ex.o dt.o | 1 | obj-y += setup.o nlm_hal.o cop2-ex.o dt.o |
2 | obj-$(CONFIG_SMP) += wakeup.o | 2 | obj-$(CONFIG_SMP) += wakeup.o |
3 | obj-$(CONFIG_USB) += usb-init.o | 3 | ifdef CONFIG_USB |
4 | obj-$(CONFIG_USB) += usb-init-xlp2.o | 4 | obj-y += usb-init.o |
5 | obj-$(CONFIG_SATA_AHCI) += ahci-init.o | 5 | obj-y += usb-init-xlp2.o |
6 | obj-$(CONFIG_SATA_AHCI) += ahci-init-xlp2.o | 6 | endif |
7 | ifdef CONFIG_SATA_AHCI | ||
8 | obj-y += ahci-init.o | ||
9 | obj-y += ahci-init-xlp2.o | ||
10 | endif | ||
diff --git a/arch/mips/oprofile/backtrace.c b/arch/mips/oprofile/backtrace.c index 6854ed5097d2..83a1dfd8f0e3 100644 --- a/arch/mips/oprofile/backtrace.c +++ b/arch/mips/oprofile/backtrace.c | |||
@@ -92,7 +92,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame, | |||
92 | /* This marks the end of the previous function, | 92 | /* This marks the end of the previous function, |
93 | which means we overran. */ | 93 | which means we overran. */ |
94 | break; | 94 | break; |
95 | stack_size = (unsigned) stack_adjustment; | 95 | stack_size = (unsigned long) stack_adjustment; |
96 | } else if (is_ra_save_ins(&ip)) { | 96 | } else if (is_ra_save_ins(&ip)) { |
97 | int ra_slot = ip.i_format.simmediate; | 97 | int ra_slot = ip.i_format.simmediate; |
98 | if (ra_slot < 0) | 98 | if (ra_slot < 0) |
diff --git a/arch/mips/pci/msi-xlp.c b/arch/mips/pci/msi-xlp.c index fa374fe3746b..f7ac3edda1b2 100644 --- a/arch/mips/pci/msi-xlp.c +++ b/arch/mips/pci/msi-xlp.c | |||
@@ -443,10 +443,8 @@ static int xlp_setup_msix(uint64_t lnkbase, int node, int link, | |||
443 | msg.data = 0xc00 | msixvec; | 443 | msg.data = 0xc00 | msixvec; |
444 | 444 | ||
445 | ret = irq_set_msi_desc(xirq, desc); | 445 | ret = irq_set_msi_desc(xirq, desc); |
446 | if (ret < 0) { | 446 | if (ret < 0) |
447 | destroy_irq(xirq); | ||
448 | return ret; | 447 | return ret; |
449 | } | ||
450 | 448 | ||
451 | write_msi_msg(xirq, &msg); | 449 | write_msi_msg(xirq, &msg); |
452 | return 0; | 450 | return 0; |
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index a95c00f5fb96..a304bcc37e4f 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c | |||
@@ -107,6 +107,7 @@ static void router_recurse(klrou_t *router_a, klrou_t *router_b, int depth) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; | 109 | unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; |
110 | EXPORT_SYMBOL(__node_distances); | ||
110 | 111 | ||
111 | static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) | 112 | static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) |
112 | { | 113 | { |
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig new file mode 100644 index 000000000000..2361acf6d2b1 --- /dev/null +++ b/arch/nios2/Kconfig | |||
@@ -0,0 +1,206 @@ | |||
1 | config NIOS2 | ||
2 | def_bool y | ||
3 | select ARCH_WANT_OPTIONAL_GPIOLIB | ||
4 | select CLKSRC_OF | ||
5 | select GENERIC_ATOMIC64 | ||
6 | select GENERIC_CLOCKEVENTS | ||
7 | select GENERIC_CPU_DEVICES | ||
8 | select GENERIC_IRQ_PROBE | ||
9 | select GENERIC_IRQ_SHOW | ||
10 | select HAVE_ARCH_TRACEHOOK | ||
11 | select IRQ_DOMAIN | ||
12 | select MODULES_USE_ELF_RELA | ||
13 | select OF | ||
14 | select OF_EARLY_FLATTREE | ||
15 | select SOC_BUS | ||
16 | select SPARSE_IRQ | ||
17 | select USB_ARCH_HAS_HCD if USB_SUPPORT | ||
18 | |||
19 | config GENERIC_CSUM | ||
20 | def_bool y | ||
21 | |||
22 | config GENERIC_HWEIGHT | ||
23 | def_bool y | ||
24 | |||
25 | config GENERIC_CALIBRATE_DELAY | ||
26 | def_bool y | ||
27 | |||
28 | config NO_IOPORT_MAP | ||
29 | def_bool y | ||
30 | |||
31 | config HAS_DMA | ||
32 | def_bool y | ||
33 | |||
34 | config FPU | ||
35 | def_bool n | ||
36 | |||
37 | config SWAP | ||
38 | def_bool n | ||
39 | |||
40 | config RWSEM_GENERIC_SPINLOCK | ||
41 | def_bool y | ||
42 | |||
43 | config TRACE_IRQFLAGS_SUPPORT | ||
44 | def_bool n | ||
45 | |||
46 | source "init/Kconfig" | ||
47 | |||
48 | menu "Kernel features" | ||
49 | |||
50 | source "kernel/Kconfig.preempt" | ||
51 | |||
52 | source "kernel/Kconfig.freezer" | ||
53 | |||
54 | source "kernel/Kconfig.hz" | ||
55 | |||
56 | source "mm/Kconfig" | ||
57 | |||
58 | config FORCE_MAX_ZONEORDER | ||
59 | int "Maximum zone order" | ||
60 | range 9 20 | ||
61 | default "11" | ||
62 | help | ||
63 | The kernel memory allocator divides physically contiguous memory | ||
64 | blocks into "zones", where each zone is a power of two number of | ||
65 | pages. This option selects the largest power of two that the kernel | ||
66 | keeps in the memory allocator. If you need to allocate very large | ||
67 | blocks of physically contiguous memory, then you may need to | ||
68 | increase this value. | ||
69 | |||
70 | This config option is actually maximum order plus one. For example, | ||
71 | a value of 11 means that the largest free memory block is 2^10 pages. | ||
72 | |||
73 | endmenu | ||
74 | |||
75 | source "arch/nios2/platform/Kconfig.platform" | ||
76 | |||
77 | menu "Processor type and features" | ||
78 | |||
79 | config MMU | ||
80 | def_bool y | ||
81 | |||
82 | config NR_CPUS | ||
83 | int | ||
84 | default "1" | ||
85 | |||
86 | config NIOS2_ALIGNMENT_TRAP | ||
87 | bool "Catch alignment trap" | ||
88 | default y | ||
89 | help | ||
90 | Nios II CPUs cannot fetch/store data which is not bus aligned, | ||
91 | i.e., a 2 or 4 byte fetch must start at an address divisible by | ||
92 | 2 or 4. Any non-aligned load/store instructions will be trapped and | ||
93 | emulated in software if you say Y here, which has a performance | ||
94 | impact. | ||
95 | |||
96 | comment "Boot options" | ||
97 | |||
98 | config CMDLINE_BOOL | ||
99 | bool "Default bootloader kernel arguments" | ||
100 | default y | ||
101 | |||
102 | config CMDLINE | ||
103 | string "Default kernel command string" | ||
104 | default "" | ||
105 | depends on CMDLINE_BOOL | ||
106 | help | ||
107 | On some platforms, there is currently no way for the boot loader to | ||
108 | pass arguments to the kernel. For these platforms, you can supply | ||
109 | some command-line options at build time by entering them here. In | ||
110 | other cases you can specify kernel args so that you don't have | ||
111 | to set them up in board prom initialization routines. | ||
112 | |||
113 | config CMDLINE_FORCE | ||
114 | bool "Force default kernel command string" | ||
115 | depends on CMDLINE_BOOL | ||
116 | help | ||
117 | Set this to have arguments from the default kernel command string | ||
118 | override those passed by the boot loader. | ||
119 | |||
120 | config NIOS2_CMDLINE_IGNORE_DTB | ||
121 | bool "Ignore kernel command string from DTB" | ||
122 | depends on CMDLINE_BOOL | ||
123 | depends on !CMDLINE_FORCE | ||
124 | default y | ||
125 | help | ||
126 | Set this to ignore the bootargs property from the devicetree's | ||
127 | chosen node and fall back to CMDLINE if nothing is passed. | ||
128 | |||
129 | config NIOS2_PASS_CMDLINE | ||
130 | bool "Passed kernel command line from u-boot" | ||
131 | default n | ||
132 | help | ||
133 | Use bootargs env variable from u-boot for kernel command line. | ||
134 | will override "Default kernel command string". | ||
135 | Say N if you are unsure. | ||
136 | |||
137 | endmenu | ||
138 | |||
139 | menu "Advanced setup" | ||
140 | |||
141 | config ADVANCED_OPTIONS | ||
142 | bool "Prompt for advanced kernel configuration options" | ||
143 | help | ||
144 | |||
145 | comment "Default settings for advanced configuration options are used" | ||
146 | depends on !ADVANCED_OPTIONS | ||
147 | |||
148 | config NIOS2_KERNEL_MMU_REGION_BASE_BOOL | ||
149 | bool "Set custom kernel MMU region base address" | ||
150 | depends on ADVANCED_OPTIONS | ||
151 | help | ||
152 | This option allows you to set the virtual address of the kernel MMU region. | ||
153 | |||
154 | Say N here unless you know what you are doing. | ||
155 | |||
156 | config NIOS2_KERNEL_MMU_REGION_BASE | ||
157 | hex "Virtual base address of the kernel MMU region " if NIOS2_KERNEL_MMU_REGION_BASE_BOOL | ||
158 | default "0x80000000" | ||
159 | help | ||
160 | This option allows you to set the virtual base address of the kernel MMU region. | ||
161 | |||
162 | config NIOS2_KERNEL_REGION_BASE_BOOL | ||
163 | bool "Set custom kernel region base address" | ||
164 | depends on ADVANCED_OPTIONS | ||
165 | help | ||
166 | This option allows you to set the virtual address of the kernel region. | ||
167 | |||
168 | Say N here unless you know what you are doing. | ||
169 | |||
170 | config NIOS2_KERNEL_REGION_BASE | ||
171 | hex "Virtual base address of the kernel region " if NIOS2_KERNEL_REGION_BASE_BOOL | ||
172 | default "0xc0000000" | ||
173 | |||
174 | config NIOS2_IO_REGION_BASE_BOOL | ||
175 | bool "Set custom I/O region base address" | ||
176 | depends on ADVANCED_OPTIONS | ||
177 | help | ||
178 | This option allows you to set the virtual address of the I/O region. | ||
179 | |||
180 | Say N here unless you know what you are doing. | ||
181 | |||
182 | config NIOS2_IO_REGION_BASE | ||
183 | hex "Virtual base address of the I/O region" if NIOS2_IO_REGION_BASE_BOOL | ||
184 | default "0xe0000000" | ||
185 | |||
186 | endmenu | ||
187 | |||
188 | menu "Executable file formats" | ||
189 | |||
190 | source "fs/Kconfig.binfmt" | ||
191 | |||
192 | endmenu | ||
193 | |||
194 | source "net/Kconfig" | ||
195 | |||
196 | source "drivers/Kconfig" | ||
197 | |||
198 | source "fs/Kconfig" | ||
199 | |||
200 | source "arch/nios2/Kconfig.debug" | ||
201 | |||
202 | source "security/Kconfig" | ||
203 | |||
204 | source "crypto/Kconfig" | ||
205 | |||
206 | source "lib/Kconfig" | ||
diff --git a/arch/nios2/Kconfig.debug b/arch/nios2/Kconfig.debug new file mode 100644 index 000000000000..8d4e6bacd997 --- /dev/null +++ b/arch/nios2/Kconfig.debug | |||
@@ -0,0 +1,17 @@ | |||
1 | menu "Kernel hacking" | ||
2 | |||
3 | config TRACE_IRQFLAGS_SUPPORT | ||
4 | def_bool y | ||
5 | |||
6 | source "lib/Kconfig.debug" | ||
7 | |||
8 | config DEBUG_STACK_USAGE | ||
9 | bool "Enable stack utilization instrumentation" | ||
10 | depends on DEBUG_KERNEL | ||
11 | help | ||
12 | Enables the display of the minimum amount of free stack which each | ||
13 | task has ever had available in the sysrq-T and sysrq-P debug output. | ||
14 | |||
15 | This option will slow down process creation somewhat. | ||
16 | |||
17 | endmenu | ||
diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile new file mode 100644 index 000000000000..e142c9ee51fa --- /dev/null +++ b/arch/nios2/Makefile | |||
@@ -0,0 +1,73 @@ | |||
1 | # | ||
2 | # This file is subject to the terms and conditions of the GNU General Public | ||
3 | # License. See the file "COPYING" in the main directory of this archive | ||
4 | # for more details. | ||
5 | # | ||
6 | # Copyright (C) 2013 Altera Corporation | ||
7 | # Copyright (C) 1994, 95, 96, 2003 by Wind River Systems | ||
8 | # Written by Fredrik Markstrom | ||
9 | # | ||
10 | # This file is included by the global makefile so that you can add your own | ||
11 | # architecture-specific flags and dependencies. Remember to do have actions | ||
12 | # for "archclean" cleaning up for this architecture. | ||
13 | # | ||
14 | # Nios2 port by Wind River Systems Inc trough: | ||
15 | # fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
16 | |||
17 | UTS_SYSNAME = Linux | ||
18 | |||
19 | export MMU | ||
20 | |||
21 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | ||
22 | |||
23 | KBUILD_CFLAGS += -pipe -D__linux__ -D__ELF__ | ||
24 | KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MUL_SUPPORT),-mhw-mul,-mno-hw-mul) | ||
25 | KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx) | ||
26 | KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div) | ||
27 | KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,) | ||
28 | |||
29 | KBUILD_CFLAGS += -fno-optimize-sibling-calls | ||
30 | KBUILD_CFLAGS += -DUTS_SYSNAME=\"$(UTS_SYSNAME)\" | ||
31 | KBUILD_CFLAGS += -fno-builtin | ||
32 | KBUILD_CFLAGS += -G 0 | ||
33 | |||
34 | head-y := arch/nios2/kernel/head.o | ||
35 | libs-y += arch/nios2/lib/ $(LIBGCC) | ||
36 | core-y += arch/nios2/kernel/ arch/nios2/mm/ | ||
37 | core-y += arch/nios2/platform/ | ||
38 | |||
39 | INSTALL_PATH ?= /tftpboot | ||
40 | nios2-boot := arch/$(ARCH)/boot | ||
41 | BOOT_TARGETS = vmImage zImage | ||
42 | PHONY += $(BOOT_TARGETS) install | ||
43 | KBUILD_IMAGE := $(nios2-boot)/vmImage | ||
44 | |||
45 | ifneq ($(CONFIG_NIOS2_DTB_SOURCE),"") | ||
46 | core-y += $(nios2-boot)/ | ||
47 | endif | ||
48 | |||
49 | all: vmImage | ||
50 | |||
51 | archclean: | ||
52 | $(Q)$(MAKE) $(clean)=$(nios2-boot) | ||
53 | |||
54 | %.dtb: | ||
55 | $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@ | ||
56 | |||
57 | dtbs: | ||
58 | $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@ | ||
59 | |||
60 | $(BOOT_TARGETS): vmlinux | ||
61 | $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@ | ||
62 | |||
63 | install: | ||
64 | $(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install | ||
65 | |||
66 | define archhelp | ||
67 | echo '* vmImage - Kernel-only image for U-Boot ($(KBUILD_IMAGE))' | ||
68 | echo ' install - Install kernel using' | ||
69 | echo ' (your) ~/bin/$(INSTALLKERNEL) or' | ||
70 | echo ' (distribution) /sbin/$(INSTALLKERNEL) or' | ||
71 | echo ' install to $$(INSTALL_PATH)' | ||
72 | echo ' dtbs - Build device tree blobs for enabled boards' | ||
73 | endef | ||
diff --git a/arch/nios2/boot/Makefile b/arch/nios2/boot/Makefile new file mode 100644 index 000000000000..59392dc0bdcb --- /dev/null +++ b/arch/nios2/boot/Makefile | |||
@@ -0,0 +1,52 @@ | |||
1 | # | ||
2 | # arch/nios2/boot/Makefile | ||
3 | # | ||
4 | # This file is subject to the terms and conditions of the GNU General Public | ||
5 | # License. See the file "COPYING" in the main directory of this archive | ||
6 | # for more details. | ||
7 | # | ||
8 | |||
9 | UIMAGE_LOADADDR = $(shell $(NM) vmlinux | awk '$$NF == "_stext" {print $$1}') | ||
10 | UIMAGE_ENTRYADDR = $(shell $(NM) vmlinux | awk '$$NF == "_start" {print $$1}') | ||
11 | UIMAGE_COMPRESSION = gzip | ||
12 | |||
13 | OBJCOPYFLAGS_vmlinux.bin := -O binary | ||
14 | |||
15 | targets += vmlinux.bin vmlinux.gz vmImage | ||
16 | |||
17 | $(obj)/vmlinux.bin: vmlinux FORCE | ||
18 | $(call if_changed,objcopy) | ||
19 | |||
20 | $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE | ||
21 | $(call if_changed,gzip) | ||
22 | |||
23 | $(obj)/vmImage: $(obj)/vmlinux.gz | ||
24 | $(call if_changed,uimage) | ||
25 | @$(kecho) 'Kernel: $@ is ready' | ||
26 | |||
27 | # Rule to build device tree blobs | ||
28 | DTB_SRC := $(patsubst "%",%,$(CONFIG_NIOS2_DTB_SOURCE)) | ||
29 | |||
30 | # Make sure the generated dtb gets removed during clean | ||
31 | extra-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += system.dtb | ||
32 | |||
33 | $(obj)/system.dtb: $(DTB_SRC) FORCE | ||
34 | $(call cmd,dtc) | ||
35 | |||
36 | # Ensure system.dtb exists | ||
37 | $(obj)/linked_dtb.o: $(obj)/system.dtb | ||
38 | |||
39 | obj-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += linked_dtb.o | ||
40 | |||
41 | targets += $(dtb-y) | ||
42 | |||
43 | # Rule to build device tree blobs with make command | ||
44 | $(obj)/%.dtb: $(src)/dts/%.dts FORCE | ||
45 | $(call if_changed_dep,dtc) | ||
46 | |||
47 | $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) | ||
48 | |||
49 | clean-files := *.dtb | ||
50 | |||
51 | install: | ||
52 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" | ||
diff --git a/arch/nios2/boot/dts/3c120_devboard.dts b/arch/nios2/boot/dts/3c120_devboard.dts new file mode 100644 index 000000000000..31c51f9a2f09 --- /dev/null +++ b/arch/nios2/boot/dts/3c120_devboard.dts | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | * This file is generated by sopc2dts. | ||
18 | */ | ||
19 | |||
20 | /dts-v1/; | ||
21 | |||
22 | / { | ||
23 | model = "altr,qsys_ghrd_3c120"; | ||
24 | compatible = "altr,qsys_ghrd_3c120"; | ||
25 | #address-cells = <1>; | ||
26 | #size-cells = <1>; | ||
27 | |||
28 | cpus { | ||
29 | #address-cells = <1>; | ||
30 | #size-cells = <0>; | ||
31 | |||
32 | cpu: cpu@0x0 { | ||
33 | device_type = "cpu"; | ||
34 | compatible = "altr,nios2-1.0"; | ||
35 | reg = <0x00000000>; | ||
36 | interrupt-controller; | ||
37 | #interrupt-cells = <1>; | ||
38 | clock-frequency = <125000000>; | ||
39 | dcache-line-size = <32>; | ||
40 | icache-line-size = <32>; | ||
41 | dcache-size = <32768>; | ||
42 | icache-size = <32768>; | ||
43 | altr,implementation = "fast"; | ||
44 | altr,pid-num-bits = <8>; | ||
45 | altr,tlb-num-ways = <16>; | ||
46 | altr,tlb-num-entries = <128>; | ||
47 | altr,tlb-ptr-sz = <7>; | ||
48 | altr,has-div = <1>; | ||
49 | altr,has-mul = <1>; | ||
50 | altr,reset-addr = <0xc2800000>; | ||
51 | altr,fast-tlb-miss-addr = <0xc7fff400>; | ||
52 | altr,exception-addr = <0xd0000020>; | ||
53 | altr,has-initda = <1>; | ||
54 | altr,has-mmu = <1>; | ||
55 | }; | ||
56 | }; | ||
57 | |||
58 | memory@0 { | ||
59 | device_type = "memory"; | ||
60 | reg = <0x10000000 0x08000000>, | ||
61 | <0x07fff400 0x00000400>; | ||
62 | }; | ||
63 | |||
64 | sopc@0 { | ||
65 | device_type = "soc"; | ||
66 | ranges; | ||
67 | #address-cells = <1>; | ||
68 | #size-cells = <1>; | ||
69 | compatible = "altr,avalon", "simple-bus"; | ||
70 | bus-frequency = <125000000>; | ||
71 | |||
72 | pb_cpu_to_io: bridge@0x8000000 { | ||
73 | compatible = "simple-bus"; | ||
74 | reg = <0x08000000 0x00800000>; | ||
75 | #address-cells = <1>; | ||
76 | #size-cells = <1>; | ||
77 | ranges = <0x00002000 0x08002000 0x00002000>, | ||
78 | <0x00004000 0x08004000 0x00000400>, | ||
79 | <0x00004400 0x08004400 0x00000040>, | ||
80 | <0x00004800 0x08004800 0x00000040>, | ||
81 | <0x00004c80 0x08004c80 0x00000020>, | ||
82 | <0x00004d50 0x08004d50 0x00000008>, | ||
83 | <0x00008000 0x08008000 0x00000020>, | ||
84 | <0x00400000 0x08400000 0x00000020>; | ||
85 | |||
86 | timer_1ms: timer@0x400000 { | ||
87 | compatible = "altr,timer-1.0"; | ||
88 | reg = <0x00400000 0x00000020>; | ||
89 | interrupt-parent = <&cpu>; | ||
90 | interrupts = <11>; | ||
91 | clock-frequency = <125000000>; | ||
92 | }; | ||
93 | |||
94 | timer_0: timer@0x8000 { | ||
95 | compatible = "altr,timer-1.0"; | ||
96 | reg = < 0x00008000 0x00000020 >; | ||
97 | interrupt-parent = < &cpu >; | ||
98 | interrupts = < 5 >; | ||
99 | clock-frequency = < 125000000 >; | ||
100 | }; | ||
101 | |||
102 | jtag_uart: serial@0x4d50 { | ||
103 | compatible = "altr,juart-1.0"; | ||
104 | reg = <0x00004d50 0x00000008>; | ||
105 | interrupt-parent = <&cpu>; | ||
106 | interrupts = <1>; | ||
107 | }; | ||
108 | |||
109 | tse_mac: ethernet@0x4000 { | ||
110 | compatible = "altr,tse-1.0"; | ||
111 | reg = <0x00004000 0x00000400>, | ||
112 | <0x00004400 0x00000040>, | ||
113 | <0x00004800 0x00000040>, | ||
114 | <0x00002000 0x00002000>; | ||
115 | reg-names = "control_port", "rx_csr", "tx_csr", "s1"; | ||
116 | interrupt-parent = <&cpu>; | ||
117 | interrupts = <2 3>; | ||
118 | interrupt-names = "rx_irq", "tx_irq"; | ||
119 | rx-fifo-depth = <8192>; | ||
120 | tx-fifo-depth = <8192>; | ||
121 | max-frame-size = <1518>; | ||
122 | local-mac-address = [ 00 00 00 00 00 00 ]; | ||
123 | phy-mode = "rgmii-id"; | ||
124 | phy-handle = <&phy0>; | ||
125 | tse_mac_mdio: mdio { | ||
126 | compatible = "altr,tse-mdio"; | ||
127 | #address-cells = <1>; | ||
128 | #size-cells = <0>; | ||
129 | phy0: ethernet-phy@18 { | ||
130 | reg = <18>; | ||
131 | device_type = "ethernet-phy"; | ||
132 | }; | ||
133 | }; | ||
134 | }; | ||
135 | |||
136 | uart: serial@0x4c80 { | ||
137 | compatible = "altr,uart-1.0"; | ||
138 | reg = <0x00004c80 0x00000020>; | ||
139 | interrupt-parent = <&cpu>; | ||
140 | interrupts = <10>; | ||
141 | current-speed = <115200>; | ||
142 | clock-frequency = <62500000>; | ||
143 | }; | ||
144 | }; | ||
145 | |||
146 | cfi_flash_64m: flash@0x0 { | ||
147 | compatible = "cfi-flash"; | ||
148 | reg = <0x00000000 0x04000000>; | ||
149 | bank-width = <2>; | ||
150 | device-width = <1>; | ||
151 | #address-cells = <1>; | ||
152 | #size-cells = <1>; | ||
153 | |||
154 | partition@800000 { | ||
155 | reg = <0x00800000 0x01e00000>; | ||
156 | label = "JFFS2 Filesystem"; | ||
157 | }; | ||
158 | }; | ||
159 | }; | ||
160 | |||
161 | chosen { | ||
162 | bootargs = "debug console=ttyJ0,115200"; | ||
163 | }; | ||
164 | }; | ||
diff --git a/arch/nios2/boot/install.sh b/arch/nios2/boot/install.sh new file mode 100644 index 000000000000..3cb3f468bc51 --- /dev/null +++ b/arch/nios2/boot/install.sh | |||
@@ -0,0 +1,52 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # This file is subject to the terms and conditions of the GNU General Public | ||
4 | # License. See the file "COPYING" in the main directory of this archive | ||
5 | # for more details. | ||
6 | # | ||
7 | # Copyright (C) 1995 by Linus Torvalds | ||
8 | # | ||
9 | # Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin | ||
10 | # | ||
11 | # "make install" script for nios2 architecture | ||
12 | # | ||
13 | # Arguments: | ||
14 | # $1 - kernel version | ||
15 | # $2 - kernel image file | ||
16 | # $3 - kernel map file | ||
17 | # $4 - default install path (blank if root directory) | ||
18 | # | ||
19 | |||
20 | verify () { | ||
21 | if [ ! -f "$1" ]; then | ||
22 | echo "" 1>&2 | ||
23 | echo " *** Missing file: $1" 1>&2 | ||
24 | echo ' *** You need to run "make" before "make install".' 1>&2 | ||
25 | echo "" 1>&2 | ||
26 | exit 1 | ||
27 | fi | ||
28 | } | ||
29 | |||
30 | # Make sure the files actually exist | ||
31 | verify "$2" | ||
32 | verify "$3" | ||
33 | |||
34 | # User may have a custom install script | ||
35 | |||
36 | if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi | ||
37 | if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi | ||
38 | |||
39 | # Default install - same as make zlilo | ||
40 | |||
41 | if [ -f $4/vmlinuz ]; then | ||
42 | mv $4/vmlinuz $4/vmlinuz.old | ||
43 | fi | ||
44 | |||
45 | if [ -f $4/System.map ]; then | ||
46 | mv $4/System.map $4/System.old | ||
47 | fi | ||
48 | |||
49 | cat $2 > $4/vmlinuz | ||
50 | cp $3 $4/System.map | ||
51 | |||
52 | sync | ||
diff --git a/arch/nios2/boot/linked_dtb.S b/arch/nios2/boot/linked_dtb.S new file mode 100644 index 000000000000..071f922db338 --- /dev/null +++ b/arch/nios2/boot/linked_dtb.S | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Thomas Chou <thomas@wytron.com.tw> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | .section .dtb.init.rodata,"a" | ||
19 | .incbin "arch/nios2/boot/system.dtb" | ||
diff --git a/arch/nios2/configs/3c120_defconfig b/arch/nios2/configs/3c120_defconfig new file mode 100644 index 000000000000..87541f0a5d6e --- /dev/null +++ b/arch/nios2/configs/3c120_defconfig | |||
@@ -0,0 +1,77 @@ | |||
1 | CONFIG_SYSVIPC=y | ||
2 | CONFIG_NO_HZ_IDLE=y | ||
3 | CONFIG_BSD_PROCESS_ACCT=y | ||
4 | CONFIG_LOG_BUF_SHIFT=14 | ||
5 | CONFIG_SYSCTL_SYSCALL=y | ||
6 | # CONFIG_ELF_CORE is not set | ||
7 | # CONFIG_EPOLL is not set | ||
8 | # CONFIG_SIGNALFD is not set | ||
9 | # CONFIG_TIMERFD is not set | ||
10 | # CONFIG_EVENTFD is not set | ||
11 | # CONFIG_SHMEM is not set | ||
12 | # CONFIG_AIO is not set | ||
13 | CONFIG_EMBEDDED=y | ||
14 | CONFIG_SLAB=y | ||
15 | CONFIG_MODULES=y | ||
16 | CONFIG_MODULE_UNLOAD=y | ||
17 | CONFIG_NIOS2_MEM_BASE=0x10000000 | ||
18 | CONFIG_NIOS2_HW_MUL_SUPPORT=y | ||
19 | CONFIG_NIOS2_HW_DIV_SUPPORT=y | ||
20 | CONFIG_CUSTOM_CACHE_SETTINGS=y | ||
21 | CONFIG_NIOS2_DCACHE_SIZE=0x8000 | ||
22 | CONFIG_NIOS2_ICACHE_SIZE=0x8000 | ||
23 | # CONFIG_NIOS2_CMDLINE_IGNORE_DTB is not set | ||
24 | CONFIG_NIOS2_PASS_CMDLINE=y | ||
25 | CONFIG_NET=y | ||
26 | CONFIG_PACKET=y | ||
27 | CONFIG_UNIX=y | ||
28 | CONFIG_INET=y | ||
29 | CONFIG_IP_MULTICAST=y | ||
30 | CONFIG_IP_PNP=y | ||
31 | CONFIG_IP_PNP_DHCP=y | ||
32 | CONFIG_IP_PNP_BOOTP=y | ||
33 | CONFIG_IP_PNP_RARP=y | ||
34 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
35 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
36 | # CONFIG_INET_XFRM_MODE_BEET is not set | ||
37 | # CONFIG_INET_LRO is not set | ||
38 | # CONFIG_IPV6 is not set | ||
39 | # CONFIG_WIRELESS is not set | ||
40 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
41 | CONFIG_DEVTMPFS=y | ||
42 | CONFIG_DEVTMPFS_MOUNT=y | ||
43 | # CONFIG_FW_LOADER is not set | ||
44 | CONFIG_MTD=y | ||
45 | CONFIG_MTD_CMDLINE_PARTS=y | ||
46 | CONFIG_MTD_BLOCK=y | ||
47 | CONFIG_MTD_CFI=y | ||
48 | CONFIG_MTD_CFI_INTELEXT=y | ||
49 | CONFIG_MTD_CFI_AMDSTD=y | ||
50 | CONFIG_MTD_PHYSMAP_OF=y | ||
51 | CONFIG_BLK_DEV_LOOP=y | ||
52 | CONFIG_NETDEVICES=y | ||
53 | CONFIG_ALTERA_TSE=y | ||
54 | CONFIG_MARVELL_PHY=y | ||
55 | # CONFIG_WLAN is not set | ||
56 | # CONFIG_INPUT_MOUSE is not set | ||
57 | # CONFIG_SERIO_SERPORT is not set | ||
58 | # CONFIG_VT is not set | ||
59 | CONFIG_SERIAL_ALTERA_JTAGUART=y | ||
60 | CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE=y | ||
61 | CONFIG_SERIAL_ALTERA_UART=y | ||
62 | # CONFIG_HW_RANDOM is not set | ||
63 | # CONFIG_HWMON is not set | ||
64 | # CONFIG_USB_SUPPORT is not set | ||
65 | CONFIG_NEW_LEDS=y | ||
66 | CONFIG_LEDS_CLASS=y | ||
67 | CONFIG_LEDS_TRIGGERS=y | ||
68 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | ||
69 | # CONFIG_DNOTIFY is not set | ||
70 | # CONFIG_INOTIFY_USER is not set | ||
71 | CONFIG_JFFS2_FS=y | ||
72 | CONFIG_NFS_FS=y | ||
73 | CONFIG_NFS_V3_ACL=y | ||
74 | CONFIG_ROOT_NFS=y | ||
75 | CONFIG_SUNRPC_DEBUG=y | ||
76 | CONFIG_DEBUG_INFO=y | ||
77 | # CONFIG_ENABLE_WARN_DEPRECATED is not set | ||
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild new file mode 100644 index 000000000000..bb160be0dc28 --- /dev/null +++ b/arch/nios2/include/asm/Kbuild | |||
@@ -0,0 +1,66 @@ | |||
1 | generic-y += atomic.h | ||
2 | generic-y += auxvec.h | ||
3 | generic-y += barrier.h | ||
4 | generic-y += bitops.h | ||
5 | generic-y += bitsperlong.h | ||
6 | generic-y += bug.h | ||
7 | generic-y += bugs.h | ||
8 | generic-y += clkdev.h | ||
9 | generic-y += cputime.h | ||
10 | generic-y += current.h | ||
11 | generic-y += device.h | ||
12 | generic-y += div64.h | ||
13 | generic-y += dma.h | ||
14 | generic-y += emergency-restart.h | ||
15 | generic-y += errno.h | ||
16 | generic-y += exec.h | ||
17 | generic-y += fb.h | ||
18 | generic-y += fcntl.h | ||
19 | generic-y += ftrace.h | ||
20 | generic-y += futex.h | ||
21 | generic-y += hardirq.h | ||
22 | generic-y += hash.h | ||
23 | generic-y += hw_irq.h | ||
24 | generic-y += ioctl.h | ||
25 | generic-y += ioctls.h | ||
26 | generic-y += ipcbuf.h | ||
27 | generic-y += irq_regs.h | ||
28 | generic-y += irq_work.h | ||
29 | generic-y += kdebug.h | ||
30 | generic-y += kmap_types.h | ||
31 | generic-y += kvm_para.h | ||
32 | generic-y += local.h | ||
33 | generic-y += mcs_spinlock.h | ||
34 | generic-y += mman.h | ||
35 | generic-y += module.h | ||
36 | generic-y += msgbuf.h | ||
37 | generic-y += param.h | ||
38 | generic-y += pci.h | ||
39 | generic-y += percpu.h | ||
40 | generic-y += poll.h | ||
41 | generic-y += posix_types.h | ||
42 | generic-y += preempt.h | ||
43 | generic-y += resource.h | ||
44 | generic-y += scatterlist.h | ||
45 | generic-y += sections.h | ||
46 | generic-y += segment.h | ||
47 | generic-y += sembuf.h | ||
48 | generic-y += serial.h | ||
49 | generic-y += shmbuf.h | ||
50 | generic-y += shmparam.h | ||
51 | generic-y += siginfo.h | ||
52 | generic-y += signal.h | ||
53 | generic-y += socket.h | ||
54 | generic-y += sockios.h | ||
55 | generic-y += spinlock.h | ||
56 | generic-y += stat.h | ||
57 | generic-y += statfs.h | ||
58 | generic-y += termbits.h | ||
59 | generic-y += termios.h | ||
60 | generic-y += topology.h | ||
61 | generic-y += trace_clock.h | ||
62 | generic-y += types.h | ||
63 | generic-y += unaligned.h | ||
64 | generic-y += user.h | ||
65 | generic-y += vga.h | ||
66 | generic-y += xor.h | ||
diff --git a/arch/nios2/include/asm/asm-macros.h b/arch/nios2/include/asm/asm-macros.h new file mode 100644 index 000000000000..29fa2e4d7b00 --- /dev/null +++ b/arch/nios2/include/asm/asm-macros.h | |||
@@ -0,0 +1,309 @@ | |||
1 | /* | ||
2 | * Macro used to simplify coding multi-line assembler. | ||
3 | * Some of the bit test macro can simplify down to one line | ||
4 | * depending on the mask value. | ||
5 | * | ||
6 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
7 | * | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, but | ||
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
18 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
19 | * details. | ||
20 | * | ||
21 | */ | ||
22 | #ifndef _ASM_NIOS2_ASMMACROS_H | ||
23 | #define _ASM_NIOS2_ASMMACROS_H | ||
24 | /* | ||
25 | * ANDs reg2 with mask and places the result in reg1. | ||
26 | * | ||
27 | * You cannnot use the same register for reg1 & reg2. | ||
28 | */ | ||
29 | |||
30 | .macro ANDI32 reg1, reg2, mask | ||
31 | .if \mask & 0xffff | ||
32 | .if \mask & 0xffff0000 | ||
33 | movhi \reg1, %hi(\mask) | ||
34 | movui \reg1, %lo(\mask) | ||
35 | and \reg1, \reg1, \reg2 | ||
36 | .else | ||
37 | andi \reg1, \reg2, %lo(\mask) | ||
38 | .endif | ||
39 | .else | ||
40 | andhi \reg1, \reg2, %hi(\mask) | ||
41 | .endif | ||
42 | .endm | ||
43 | |||
44 | /* | ||
45 | * ORs reg2 with mask and places the result in reg1. | ||
46 | * | ||
47 | * It is safe to use the same register for reg1 & reg2. | ||
48 | */ | ||
49 | |||
50 | .macro ORI32 reg1, reg2, mask | ||
51 | .if \mask & 0xffff | ||
52 | .if \mask & 0xffff0000 | ||
53 | orhi \reg1, \reg2, %hi(\mask) | ||
54 | ori \reg1, \reg2, %lo(\mask) | ||
55 | .else | ||
56 | ori \reg1, \reg2, %lo(\mask) | ||
57 | .endif | ||
58 | .else | ||
59 | orhi \reg1, \reg2, %hi(\mask) | ||
60 | .endif | ||
61 | .endm | ||
62 | |||
63 | /* | ||
64 | * XORs reg2 with mask and places the result in reg1. | ||
65 | * | ||
66 | * It is safe to use the same register for reg1 & reg2. | ||
67 | */ | ||
68 | |||
69 | .macro XORI32 reg1, reg2, mask | ||
70 | .if \mask & 0xffff | ||
71 | .if \mask & 0xffff0000 | ||
72 | xorhi \reg1, \reg2, %hi(\mask) | ||
73 | xori \reg1, \reg1, %lo(\mask) | ||
74 | .else | ||
75 | xori \reg1, \reg2, %lo(\mask) | ||
76 | .endif | ||
77 | .else | ||
78 | xorhi \reg1, \reg2, %hi(\mask) | ||
79 | .endif | ||
80 | .endm | ||
81 | |||
82 | /* | ||
83 | * This is a support macro for BTBZ & BTBNZ. It checks | ||
84 | * the bit to make sure it is valid 32 value. | ||
85 | * | ||
86 | * It is safe to use the same register for reg1 & reg2. | ||
87 | */ | ||
88 | |||
89 | .macro BT reg1, reg2, bit | ||
90 | .if \bit > 31 | ||
91 | .err | ||
92 | .else | ||
93 | .if \bit < 16 | ||
94 | andi \reg1, \reg2, (1 << \bit) | ||
95 | .else | ||
96 | andhi \reg1, \reg2, (1 << (\bit - 16)) | ||
97 | .endif | ||
98 | .endif | ||
99 | .endm | ||
100 | |||
101 | /* | ||
102 | * Tests the bit in reg2 and branches to label if the | ||
103 | * bit is zero. The result of the bit test is stored in reg1. | ||
104 | * | ||
105 | * It is safe to use the same register for reg1 & reg2. | ||
106 | */ | ||
107 | |||
108 | .macro BTBZ reg1, reg2, bit, label | ||
109 | BT \reg1, \reg2, \bit | ||
110 | beq \reg1, r0, \label | ||
111 | .endm | ||
112 | |||
113 | /* | ||
114 | * Tests the bit in reg2 and branches to label if the | ||
115 | * bit is non-zero. The result of the bit test is stored in reg1. | ||
116 | * | ||
117 | * It is safe to use the same register for reg1 & reg2. | ||
118 | */ | ||
119 | |||
120 | .macro BTBNZ reg1, reg2, bit, label | ||
121 | BT \reg1, \reg2, \bit | ||
122 | bne \reg1, r0, \label | ||
123 | .endm | ||
124 | |||
125 | /* | ||
126 | * Tests the bit in reg2 and then compliments the bit in reg2. | ||
127 | * The result of the bit test is stored in reg1. | ||
128 | * | ||
129 | * It is NOT safe to use the same register for reg1 & reg2. | ||
130 | */ | ||
131 | |||
132 | .macro BTC reg1, reg2, bit | ||
133 | .if \bit > 31 | ||
134 | .err | ||
135 | .else | ||
136 | .if \bit < 16 | ||
137 | andi \reg1, \reg2, (1 << \bit) | ||
138 | xori \reg2, \reg2, (1 << \bit) | ||
139 | .else | ||
140 | andhi \reg1, \reg2, (1 << (\bit - 16)) | ||
141 | xorhi \reg2, \reg2, (1 << (\bit - 16)) | ||
142 | .endif | ||
143 | .endif | ||
144 | .endm | ||
145 | |||
146 | /* | ||
147 | * Tests the bit in reg2 and then sets the bit in reg2. | ||
148 | * The result of the bit test is stored in reg1. | ||
149 | * | ||
150 | * It is NOT safe to use the same register for reg1 & reg2. | ||
151 | */ | ||
152 | |||
153 | .macro BTS reg1, reg2, bit | ||
154 | .if \bit > 31 | ||
155 | .err | ||
156 | .else | ||
157 | .if \bit < 16 | ||
158 | andi \reg1, \reg2, (1 << \bit) | ||
159 | ori \reg2, \reg2, (1 << \bit) | ||
160 | .else | ||
161 | andhi \reg1, \reg2, (1 << (\bit - 16)) | ||
162 | orhi \reg2, \reg2, (1 << (\bit - 16)) | ||
163 | .endif | ||
164 | .endif | ||
165 | .endm | ||
166 | |||
167 | /* | ||
168 | * Tests the bit in reg2 and then resets the bit in reg2. | ||
169 | * The result of the bit test is stored in reg1. | ||
170 | * | ||
171 | * It is NOT safe to use the same register for reg1 & reg2. | ||
172 | */ | ||
173 | |||
174 | .macro BTR reg1, reg2, bit | ||
175 | .if \bit > 31 | ||
176 | .err | ||
177 | .else | ||
178 | .if \bit < 16 | ||
179 | andi \reg1, \reg2, (1 << \bit) | ||
180 | andi \reg2, \reg2, %lo(~(1 << \bit)) | ||
181 | .else | ||
182 | andhi \reg1, \reg2, (1 << (\bit - 16)) | ||
183 | andhi \reg2, \reg2, %lo(~(1 << (\bit - 16))) | ||
184 | .endif | ||
185 | .endif | ||
186 | .endm | ||
187 | |||
188 | /* | ||
189 | * Tests the bit in reg2 and then compliments the bit in reg2. | ||
190 | * The result of the bit test is stored in reg1. If the | ||
191 | * original bit was zero it branches to label. | ||
192 | * | ||
193 | * It is NOT safe to use the same register for reg1 & reg2. | ||
194 | */ | ||
195 | |||
196 | .macro BTCBZ reg1, reg2, bit, label | ||
197 | BTC \reg1, \reg2, \bit | ||
198 | beq \reg1, r0, \label | ||
199 | .endm | ||
200 | |||
201 | /* | ||
202 | * Tests the bit in reg2 and then compliments the bit in reg2. | ||
203 | * The result of the bit test is stored in reg1. If the | ||
204 | * original bit was non-zero it branches to label. | ||
205 | * | ||
206 | * It is NOT safe to use the same register for reg1 & reg2. | ||
207 | */ | ||
208 | |||
209 | .macro BTCBNZ reg1, reg2, bit, label | ||
210 | BTC \reg1, \reg2, \bit | ||
211 | bne \reg1, r0, \label | ||
212 | .endm | ||
213 | |||
214 | /* | ||
215 | * Tests the bit in reg2 and then sets the bit in reg2. | ||
216 | * The result of the bit test is stored in reg1. If the | ||
217 | * original bit was zero it branches to label. | ||
218 | * | ||
219 | * It is NOT safe to use the same register for reg1 & reg2. | ||
220 | */ | ||
221 | |||
222 | .macro BTSBZ reg1, reg2, bit, label | ||
223 | BTS \reg1, \reg2, \bit | ||
224 | beq \reg1, r0, \label | ||
225 | .endm | ||
226 | |||
227 | /* | ||
228 | * Tests the bit in reg2 and then sets the bit in reg2. | ||
229 | * The result of the bit test is stored in reg1. If the | ||
230 | * original bit was non-zero it branches to label. | ||
231 | * | ||
232 | * It is NOT safe to use the same register for reg1 & reg2. | ||
233 | */ | ||
234 | |||
235 | .macro BTSBNZ reg1, reg2, bit, label | ||
236 | BTS \reg1, \reg2, \bit | ||
237 | bne \reg1, r0, \label | ||
238 | .endm | ||
239 | |||
240 | /* | ||
241 | * Tests the bit in reg2 and then resets the bit in reg2. | ||
242 | * The result of the bit test is stored in reg1. If the | ||
243 | * original bit was zero it branches to label. | ||
244 | * | ||
245 | * It is NOT safe to use the same register for reg1 & reg2. | ||
246 | */ | ||
247 | |||
248 | .macro BTRBZ reg1, reg2, bit, label | ||
249 | BTR \reg1, \reg2, \bit | ||
250 | bne \reg1, r0, \label | ||
251 | .endm | ||
252 | |||
253 | /* | ||
254 | * Tests the bit in reg2 and then resets the bit in reg2. | ||
255 | * The result of the bit test is stored in reg1. If the | ||
256 | * original bit was non-zero it branches to label. | ||
257 | * | ||
258 | * It is NOT safe to use the same register for reg1 & reg2. | ||
259 | */ | ||
260 | |||
261 | .macro BTRBNZ reg1, reg2, bit, label | ||
262 | BTR \reg1, \reg2, \bit | ||
263 | bne \reg1, r0, \label | ||
264 | .endm | ||
265 | |||
266 | /* | ||
267 | * Tests the bits in mask against reg2 stores the result in reg1. | ||
268 | * If the all the bits in the mask are zero it branches to label. | ||
269 | * | ||
270 | * It is safe to use the same register for reg1 & reg2. | ||
271 | */ | ||
272 | |||
273 | .macro TSTBZ reg1, reg2, mask, label | ||
274 | ANDI32 \reg1, \reg2, \mask | ||
275 | beq \reg1, r0, \label | ||
276 | .endm | ||
277 | |||
278 | /* | ||
279 | * Tests the bits in mask against reg2 stores the result in reg1. | ||
280 | * If the any of the bits in the mask are 1 it branches to label. | ||
281 | * | ||
282 | * It is safe to use the same register for reg1 & reg2. | ||
283 | */ | ||
284 | |||
285 | .macro TSTBNZ reg1, reg2, mask, label | ||
286 | ANDI32 \reg1, \reg2, \mask | ||
287 | bne \reg1, r0, \label | ||
288 | .endm | ||
289 | |||
290 | /* | ||
291 | * Pushes reg onto the stack. | ||
292 | */ | ||
293 | |||
294 | .macro PUSH reg | ||
295 | addi sp, sp, -4 | ||
296 | stw \reg, 0(sp) | ||
297 | .endm | ||
298 | |||
299 | /* | ||
300 | * Pops the top of the stack into reg. | ||
301 | */ | ||
302 | |||
303 | .macro POP reg | ||
304 | ldw \reg, 0(sp) | ||
305 | addi sp, sp, 4 | ||
306 | .endm | ||
307 | |||
308 | |||
309 | #endif /* _ASM_NIOS2_ASMMACROS_H */ | ||
diff --git a/arch/nios2/include/asm/asm-offsets.h b/arch/nios2/include/asm/asm-offsets.h new file mode 100644 index 000000000000..5b9f5e04a058 --- /dev/null +++ b/arch/nios2/include/asm/asm-offsets.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #include <generated/asm-offsets.h> | ||
diff --git a/arch/nios2/include/asm/cache.h b/arch/nios2/include/asm/cache.h new file mode 100644 index 000000000000..2293cf57e307 --- /dev/null +++ b/arch/nios2/include/asm/cache.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
3 | * | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
14 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
15 | * details. | ||
16 | */ | ||
17 | |||
18 | #ifndef _ASM_NIOS2_CACHE_H | ||
19 | #define _ASM_NIOS2_CACHE_H | ||
20 | |||
21 | #define NIOS2_DCACHE_SIZE CONFIG_NIOS2_DCACHE_SIZE | ||
22 | #define NIOS2_ICACHE_SIZE CONFIG_NIOS2_ICACHE_SIZE | ||
23 | #define NIOS2_DCACHE_LINE_SIZE CONFIG_NIOS2_DCACHE_LINE_SIZE | ||
24 | #define NIOS2_ICACHE_LINE_SHIFT 5 | ||
25 | #define NIOS2_ICACHE_LINE_SIZE (1 << NIOS2_ICACHE_LINE_SHIFT) | ||
26 | |||
27 | /* bytes per L1 cache line */ | ||
28 | #define L1_CACHE_SHIFT NIOS2_ICACHE_LINE_SHIFT | ||
29 | #define L1_CACHE_BYTES NIOS2_ICACHE_LINE_SIZE | ||
30 | |||
31 | #define ARCH_DMA_MINALIGN L1_CACHE_BYTES | ||
32 | |||
33 | #define __cacheline_aligned | ||
34 | #define ____cacheline_aligned | ||
35 | |||
36 | #endif | ||
diff --git a/arch/nios2/include/asm/cacheflush.h b/arch/nios2/include/asm/cacheflush.h new file mode 100644 index 000000000000..52abba973dc2 --- /dev/null +++ b/arch/nios2/include/asm/cacheflush.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003 Microtronix Datacom Ltd. | ||
3 | * Copyright (C) 2000-2002 Greg Ungerer <gerg@snapgear.com> | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_CACHEFLUSH_H | ||
11 | #define _ASM_NIOS2_CACHEFLUSH_H | ||
12 | |||
13 | #include <linux/mm_types.h> | ||
14 | |||
15 | /* | ||
16 | * This flag is used to indicate that the page pointed to by a pte is clean | ||
17 | * and does not require cleaning before returning it to the user. | ||
18 | */ | ||
19 | #define PG_dcache_clean PG_arch_1 | ||
20 | |||
21 | struct mm_struct; | ||
22 | |||
23 | extern void flush_cache_all(void); | ||
24 | extern void flush_cache_mm(struct mm_struct *mm); | ||
25 | extern void flush_cache_dup_mm(struct mm_struct *mm); | ||
26 | extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, | ||
27 | unsigned long end); | ||
28 | extern void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, | ||
29 | unsigned long pfn); | ||
30 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 | ||
31 | extern void flush_dcache_page(struct page *page); | ||
32 | |||
33 | extern void flush_icache_range(unsigned long start, unsigned long end); | ||
34 | extern void flush_icache_page(struct vm_area_struct *vma, struct page *page); | ||
35 | |||
36 | #define flush_cache_vmap(start, end) flush_dcache_range(start, end) | ||
37 | #define flush_cache_vunmap(start, end) flush_dcache_range(start, end) | ||
38 | |||
39 | extern void copy_to_user_page(struct vm_area_struct *vma, struct page *page, | ||
40 | unsigned long user_vaddr, | ||
41 | void *dst, void *src, int len); | ||
42 | extern void copy_from_user_page(struct vm_area_struct *vma, struct page *page, | ||
43 | unsigned long user_vaddr, | ||
44 | void *dst, void *src, int len); | ||
45 | |||
46 | extern void flush_dcache_range(unsigned long start, unsigned long end); | ||
47 | extern void invalidate_dcache_range(unsigned long start, unsigned long end); | ||
48 | |||
49 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
50 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
51 | |||
52 | #endif /* _ASM_NIOS2_CACHEFLUSH_H */ | ||
diff --git a/arch/nios2/include/asm/checksum.h b/arch/nios2/include/asm/checksum.h new file mode 100644 index 000000000000..6bc1f0d5df7b --- /dev/null +++ b/arch/nios2/include/asm/checksum.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS_CHECKSUM_H | ||
11 | #define _ASM_NIOS_CHECKSUM_H | ||
12 | |||
13 | /* Take these from lib/checksum.c */ | ||
14 | extern __wsum csum_partial(const void *buff, int len, __wsum sum); | ||
15 | extern __wsum csum_partial_copy(const void *src, void *dst, int len, | ||
16 | __wsum sum); | ||
17 | extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, | ||
18 | int len, __wsum sum, int *csum_err); | ||
19 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ | ||
20 | csum_partial_copy((src), (dst), (len), (sum)) | ||
21 | |||
22 | extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); | ||
23 | extern __sum16 ip_compute_csum(const void *buff, int len); | ||
24 | |||
25 | /* | ||
26 | * Fold a partial checksum | ||
27 | */ | ||
28 | static inline __sum16 csum_fold(__wsum sum) | ||
29 | { | ||
30 | __asm__ __volatile__( | ||
31 | "add %0, %1, %0\n" | ||
32 | "cmpltu r8, %0, %1\n" | ||
33 | "srli %0, %0, 16\n" | ||
34 | "add %0, %0, r8\n" | ||
35 | "nor %0, %0, %0\n" | ||
36 | : "=r" (sum) | ||
37 | : "r" (sum << 16), "0" (sum) | ||
38 | : "r8"); | ||
39 | return (__force __sum16) sum; | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | * computes the checksum of the TCP/UDP pseudo-header | ||
44 | * returns a 16-bit checksum, already complemented | ||
45 | */ | ||
46 | #define csum_tcpudp_nofold csum_tcpudp_nofold | ||
47 | static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, | ||
48 | unsigned short len, | ||
49 | unsigned short proto, | ||
50 | __wsum sum) | ||
51 | { | ||
52 | __asm__ __volatile__( | ||
53 | "add %0, %1, %0\n" | ||
54 | "cmpltu r8, %0, %1\n" | ||
55 | "add %0, %0, r8\n" /* add carry */ | ||
56 | "add %0, %2, %0\n" | ||
57 | "cmpltu r8, %0, %2\n" | ||
58 | "add %0, %0, r8\n" /* add carry */ | ||
59 | "add %0, %3, %0\n" | ||
60 | "cmpltu r8, %0, %3\n" | ||
61 | "add %0, %0, r8\n" /* add carry */ | ||
62 | : "=r" (sum), "=r" (saddr) | ||
63 | : "r" (daddr), "r" ((ntohs(len) << 16) + (proto * 256)), | ||
64 | "0" (sum), | ||
65 | "1" (saddr) | ||
66 | : "r8"); | ||
67 | |||
68 | return sum; | ||
69 | } | ||
70 | |||
71 | static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, | ||
72 | unsigned short len, | ||
73 | unsigned short proto, __wsum sum) | ||
74 | { | ||
75 | return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); | ||
76 | } | ||
77 | |||
78 | #endif /* _ASM_NIOS_CHECKSUM_H */ | ||
diff --git a/arch/nios2/include/asm/cmpxchg.h b/arch/nios2/include/asm/cmpxchg.h new file mode 100644 index 000000000000..85938711542d --- /dev/null +++ b/arch/nios2/include/asm/cmpxchg.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_NIOS2_CMPXCHG_H | ||
10 | #define _ASM_NIOS2_CMPXCHG_H | ||
11 | |||
12 | #include <linux/irqflags.h> | ||
13 | |||
14 | #define xchg(ptr, x) \ | ||
15 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | ||
16 | |||
17 | struct __xchg_dummy { unsigned long a[100]; }; | ||
18 | #define __xg(x) ((volatile struct __xchg_dummy *)(x)) | ||
19 | |||
20 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, | ||
21 | int size) | ||
22 | { | ||
23 | unsigned long tmp, flags; | ||
24 | |||
25 | local_irq_save(flags); | ||
26 | |||
27 | switch (size) { | ||
28 | case 1: | ||
29 | __asm__ __volatile__( | ||
30 | "ldb %0, %2\n" | ||
31 | "stb %1, %2\n" | ||
32 | : "=&r" (tmp) | ||
33 | : "r" (x), "m" (*__xg(ptr)) | ||
34 | : "memory"); | ||
35 | break; | ||
36 | case 2: | ||
37 | __asm__ __volatile__( | ||
38 | "ldh %0, %2\n" | ||
39 | "sth %1, %2\n" | ||
40 | : "=&r" (tmp) | ||
41 | : "r" (x), "m" (*__xg(ptr)) | ||
42 | : "memory"); | ||
43 | break; | ||
44 | case 4: | ||
45 | __asm__ __volatile__( | ||
46 | "ldw %0, %2\n" | ||
47 | "stw %1, %2\n" | ||
48 | : "=&r" (tmp) | ||
49 | : "r" (x), "m" (*__xg(ptr)) | ||
50 | : "memory"); | ||
51 | break; | ||
52 | } | ||
53 | |||
54 | local_irq_restore(flags); | ||
55 | return tmp; | ||
56 | } | ||
57 | |||
58 | #include <asm-generic/cmpxchg.h> | ||
59 | #include <asm-generic/cmpxchg-local.h> | ||
60 | |||
61 | #endif /* _ASM_NIOS2_CMPXCHG_H */ | ||
diff --git a/arch/nios2/include/asm/cpuinfo.h b/arch/nios2/include/asm/cpuinfo.h new file mode 100644 index 000000000000..e88fcae464d9 --- /dev/null +++ b/arch/nios2/include/asm/cpuinfo.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef _ASM_NIOS2_CPUINFO_H | ||
20 | #define _ASM_NIOS2_CPUINFO_H | ||
21 | |||
22 | #include <linux/types.h> | ||
23 | |||
24 | struct cpuinfo { | ||
25 | /* Core CPU configuration */ | ||
26 | char cpu_impl[12]; | ||
27 | u32 cpu_clock_freq; | ||
28 | u32 mmu; | ||
29 | u32 has_div; | ||
30 | u32 has_mul; | ||
31 | u32 has_mulx; | ||
32 | |||
33 | /* CPU caches */ | ||
34 | u32 icache_line_size; | ||
35 | u32 icache_size; | ||
36 | u32 dcache_line_size; | ||
37 | u32 dcache_size; | ||
38 | |||
39 | /* TLB */ | ||
40 | u32 tlb_pid_num_bits; /* number of bits used for the PID in TLBMISC */ | ||
41 | u32 tlb_num_ways; | ||
42 | u32 tlb_num_ways_log2; | ||
43 | u32 tlb_num_entries; | ||
44 | u32 tlb_num_lines; | ||
45 | u32 tlb_ptr_sz; | ||
46 | |||
47 | /* Addresses */ | ||
48 | u32 reset_addr; | ||
49 | u32 exception_addr; | ||
50 | u32 fast_tlb_miss_exc_addr; | ||
51 | }; | ||
52 | |||
53 | extern struct cpuinfo cpuinfo; | ||
54 | |||
55 | extern void setup_cpuinfo(void); | ||
56 | |||
57 | #endif /* _ASM_NIOS2_CPUINFO_H */ | ||
diff --git a/arch/nios2/include/asm/delay.h b/arch/nios2/include/asm/delay.h new file mode 100644 index 000000000000..098e49bf3aa3 --- /dev/null +++ b/arch/nios2/include/asm/delay.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Altera Corporation | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_DELAY_H | ||
11 | #define _ASM_NIOS2_DELAY_H | ||
12 | |||
13 | #include <asm-generic/delay.h> | ||
14 | |||
15 | /* Undefined functions to get compile-time errors */ | ||
16 | extern void __bad_udelay(void); | ||
17 | extern void __bad_ndelay(void); | ||
18 | |||
19 | extern unsigned long loops_per_jiffy; | ||
20 | |||
21 | #endif /* _ASM_NIOS2_DELAY_H */ | ||
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h new file mode 100644 index 000000000000..b5567233f7f1 --- /dev/null +++ b/arch/nios2/include/asm/dma-mapping.h | |||
@@ -0,0 +1,140 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2009 Wind River Systems Inc | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General | ||
6 | * Public License. See the file COPYING in the main directory of this | ||
7 | * archive for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_DMA_MAPPING_H | ||
11 | #define _ASM_NIOS2_DMA_MAPPING_H | ||
12 | |||
13 | #include <linux/scatterlist.h> | ||
14 | #include <linux/cache.h> | ||
15 | #include <asm/cacheflush.h> | ||
16 | |||
17 | static inline void __dma_sync_for_device(void *vaddr, size_t size, | ||
18 | enum dma_data_direction direction) | ||
19 | { | ||
20 | switch (direction) { | ||
21 | case DMA_FROM_DEVICE: | ||
22 | invalidate_dcache_range((unsigned long)vaddr, | ||
23 | (unsigned long)(vaddr + size)); | ||
24 | break; | ||
25 | case DMA_TO_DEVICE: | ||
26 | /* | ||
27 | * We just need to flush the caches here , but Nios2 flush | ||
28 | * instruction will do both writeback and invalidate. | ||
29 | */ | ||
30 | case DMA_BIDIRECTIONAL: /* flush and invalidate */ | ||
31 | flush_dcache_range((unsigned long)vaddr, | ||
32 | (unsigned long)(vaddr + size)); | ||
33 | break; | ||
34 | default: | ||
35 | BUG(); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | static inline void __dma_sync_for_cpu(void *vaddr, size_t size, | ||
40 | enum dma_data_direction direction) | ||
41 | { | ||
42 | switch (direction) { | ||
43 | case DMA_BIDIRECTIONAL: | ||
44 | case DMA_FROM_DEVICE: | ||
45 | invalidate_dcache_range((unsigned long)vaddr, | ||
46 | (unsigned long)(vaddr + size)); | ||
47 | break; | ||
48 | case DMA_TO_DEVICE: | ||
49 | break; | ||
50 | default: | ||
51 | BUG(); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
56 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
57 | |||
58 | void *dma_alloc_coherent(struct device *dev, size_t size, | ||
59 | dma_addr_t *dma_handle, gfp_t flag); | ||
60 | |||
61 | void dma_free_coherent(struct device *dev, size_t size, | ||
62 | void *vaddr, dma_addr_t dma_handle); | ||
63 | |||
64 | static inline dma_addr_t dma_map_single(struct device *dev, void *ptr, | ||
65 | size_t size, | ||
66 | enum dma_data_direction direction) | ||
67 | { | ||
68 | BUG_ON(!valid_dma_direction(direction)); | ||
69 | __dma_sync_for_device(ptr, size, direction); | ||
70 | return virt_to_phys(ptr); | ||
71 | } | ||
72 | |||
73 | static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, | ||
74 | size_t size, enum dma_data_direction direction) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
79 | enum dma_data_direction direction); | ||
80 | extern dma_addr_t dma_map_page(struct device *dev, struct page *page, | ||
81 | unsigned long offset, size_t size, enum dma_data_direction direction); | ||
82 | extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address, | ||
83 | size_t size, enum dma_data_direction direction); | ||
84 | extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, | ||
85 | int nhwentries, enum dma_data_direction direction); | ||
86 | extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, | ||
87 | size_t size, enum dma_data_direction direction); | ||
88 | extern void dma_sync_single_for_device(struct device *dev, | ||
89 | dma_addr_t dma_handle, size_t size, enum dma_data_direction direction); | ||
90 | extern void dma_sync_single_range_for_cpu(struct device *dev, | ||
91 | dma_addr_t dma_handle, unsigned long offset, size_t size, | ||
92 | enum dma_data_direction direction); | ||
93 | extern void dma_sync_single_range_for_device(struct device *dev, | ||
94 | dma_addr_t dma_handle, unsigned long offset, size_t size, | ||
95 | enum dma_data_direction direction); | ||
96 | extern void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, | ||
97 | int nelems, enum dma_data_direction direction); | ||
98 | extern void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | ||
99 | int nelems, enum dma_data_direction direction); | ||
100 | |||
101 | static inline int dma_supported(struct device *dev, u64 mask) | ||
102 | { | ||
103 | return 1; | ||
104 | } | ||
105 | |||
106 | static inline int dma_set_mask(struct device *dev, u64 mask) | ||
107 | { | ||
108 | if (!dev->dma_mask || !dma_supported(dev, mask)) | ||
109 | return -EIO; | ||
110 | |||
111 | *dev->dma_mask = mask; | ||
112 | |||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | ||
117 | { | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * dma_alloc_noncoherent() returns non-cacheable memory, so there's no need to | ||
123 | * do any flushing here. | ||
124 | */ | ||
125 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | ||
126 | enum dma_data_direction direction) | ||
127 | { | ||
128 | } | ||
129 | |||
130 | /* drivers/base/dma-mapping.c */ | ||
131 | extern int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, | ||
132 | void *cpu_addr, dma_addr_t dma_addr, size_t size); | ||
133 | extern int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt, | ||
134 | void *cpu_addr, dma_addr_t dma_addr, | ||
135 | size_t size); | ||
136 | |||
137 | #define dma_mmap_coherent(d, v, c, h, s) dma_common_mmap(d, v, c, h, s) | ||
138 | #define dma_get_sgtable(d, t, v, h, s) dma_common_get_sgtable(d, t, v, h, s) | ||
139 | |||
140 | #endif /* _ASM_NIOS2_DMA_MAPPING_H */ | ||
diff --git a/arch/nios2/include/asm/elf.h b/arch/nios2/include/asm/elf.h new file mode 100644 index 000000000000..b7d655dff731 --- /dev/null +++ b/arch/nios2/include/asm/elf.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef _ASM_NIOS2_ELF_H | ||
20 | #define _ASM_NIOS2_ELF_H | ||
21 | |||
22 | #include <uapi/asm/elf.h> | ||
23 | |||
24 | /* | ||
25 | * This is used to ensure we don't load something for the wrong architecture. | ||
26 | */ | ||
27 | #define elf_check_arch(x) ((x)->e_machine == EM_ALTERA_NIOS2) | ||
28 | |||
29 | #define ELF_PLAT_INIT(_r, load_addr) | ||
30 | |||
31 | #define CORE_DUMP_USE_REGSET | ||
32 | #define ELF_EXEC_PAGESIZE 4096 | ||
33 | |||
34 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | ||
35 | use of this is to invoke "./ld.so someprog" to test out a new version of | ||
36 | the loader. We need to make sure that it is out of the way of the program | ||
37 | that it will "exec", and that there is sufficient room for the brk. */ | ||
38 | |||
39 | #define ELF_ET_DYN_BASE 0xD0000000UL | ||
40 | |||
41 | /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is | ||
42 | now struct_user_regs, they are different) */ | ||
43 | |||
44 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 | ||
45 | struct linux_binprm; | ||
46 | extern int arch_setup_additional_pages(struct linux_binprm *bprm, | ||
47 | int uses_interp); | ||
48 | #define ELF_CORE_COPY_REGS(pr_reg, regs) \ | ||
49 | { do { \ | ||
50 | /* Bleech. */ \ | ||
51 | pr_reg[0] = regs->r8; \ | ||
52 | pr_reg[1] = regs->r9; \ | ||
53 | pr_reg[2] = regs->r10; \ | ||
54 | pr_reg[3] = regs->r11; \ | ||
55 | pr_reg[4] = regs->r12; \ | ||
56 | pr_reg[5] = regs->r13; \ | ||
57 | pr_reg[6] = regs->r14; \ | ||
58 | pr_reg[7] = regs->r15; \ | ||
59 | pr_reg[8] = regs->r1; \ | ||
60 | pr_reg[9] = regs->r2; \ | ||
61 | pr_reg[10] = regs->r3; \ | ||
62 | pr_reg[11] = regs->r4; \ | ||
63 | pr_reg[12] = regs->r5; \ | ||
64 | pr_reg[13] = regs->r6; \ | ||
65 | pr_reg[14] = regs->r7; \ | ||
66 | pr_reg[15] = regs->orig_r2; \ | ||
67 | pr_reg[16] = regs->ra; \ | ||
68 | pr_reg[17] = regs->fp; \ | ||
69 | pr_reg[18] = regs->sp; \ | ||
70 | pr_reg[19] = regs->gp; \ | ||
71 | pr_reg[20] = regs->estatus; \ | ||
72 | pr_reg[21] = regs->ea; \ | ||
73 | pr_reg[22] = regs->orig_r7; \ | ||
74 | { \ | ||
75 | struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \ | ||
76 | pr_reg[23] = sw->r16; \ | ||
77 | pr_reg[24] = sw->r17; \ | ||
78 | pr_reg[25] = sw->r18; \ | ||
79 | pr_reg[26] = sw->r19; \ | ||
80 | pr_reg[27] = sw->r20; \ | ||
81 | pr_reg[28] = sw->r21; \ | ||
82 | pr_reg[29] = sw->r22; \ | ||
83 | pr_reg[30] = sw->r23; \ | ||
84 | pr_reg[31] = sw->fp; \ | ||
85 | pr_reg[32] = sw->gp; \ | ||
86 | pr_reg[33] = sw->ra; \ | ||
87 | } \ | ||
88 | } while (0); } | ||
89 | |||
90 | /* This yields a mask that user programs can use to figure out what | ||
91 | instruction set this cpu supports. */ | ||
92 | |||
93 | #define ELF_HWCAP (0) | ||
94 | |||
95 | /* This yields a string that ld.so will use to load implementation | ||
96 | specific libraries for optimization. This is more specific in | ||
97 | intent than poking at uname or /proc/cpuinfo. */ | ||
98 | |||
99 | #define ELF_PLATFORM (NULL) | ||
100 | |||
101 | #endif /* _ASM_NIOS2_ELF_H */ | ||
diff --git a/arch/nios2/include/asm/entry.h b/arch/nios2/include/asm/entry.h new file mode 100644 index 000000000000..cf37f55efbc2 --- /dev/null +++ b/arch/nios2/include/asm/entry.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_ENTRY_H | ||
11 | #define _ASM_NIOS2_ENTRY_H | ||
12 | |||
13 | #ifdef __ASSEMBLY__ | ||
14 | |||
15 | #include <asm/processor.h> | ||
16 | #include <asm/registers.h> | ||
17 | #include <asm/asm-offsets.h> | ||
18 | |||
19 | /* | ||
20 | * Standard Nios2 interrupt entry and exit macros. | ||
21 | * Must be called with interrupts disabled. | ||
22 | */ | ||
23 | .macro SAVE_ALL | ||
24 | rdctl r24, estatus | ||
25 | andi r24, r24, ESTATUS_EU | ||
26 | beq r24, r0, 1f /* In supervisor mode, already on kernel stack */ | ||
27 | |||
28 | movia r24, _current_thread /* Switch to current kernel stack */ | ||
29 | ldw r24, 0(r24) /* using the thread_info */ | ||
30 | addi r24, r24, THREAD_SIZE-PT_REGS_SIZE | ||
31 | stw sp, PT_SP(r24) /* Save user stack before changing */ | ||
32 | mov sp, r24 | ||
33 | br 2f | ||
34 | |||
35 | 1 : mov r24, sp | ||
36 | addi sp, sp, -PT_REGS_SIZE /* Backup the kernel stack pointer */ | ||
37 | stw r24, PT_SP(sp) | ||
38 | 2 : stw r1, PT_R1(sp) | ||
39 | stw r2, PT_R2(sp) | ||
40 | stw r3, PT_R3(sp) | ||
41 | stw r4, PT_R4(sp) | ||
42 | stw r5, PT_R5(sp) | ||
43 | stw r6, PT_R6(sp) | ||
44 | stw r7, PT_R7(sp) | ||
45 | stw r8, PT_R8(sp) | ||
46 | stw r9, PT_R9(sp) | ||
47 | stw r10, PT_R10(sp) | ||
48 | stw r11, PT_R11(sp) | ||
49 | stw r12, PT_R12(sp) | ||
50 | stw r13, PT_R13(sp) | ||
51 | stw r14, PT_R14(sp) | ||
52 | stw r15, PT_R15(sp) | ||
53 | stw r2, PT_ORIG_R2(sp) | ||
54 | stw r7, PT_ORIG_R7(sp) | ||
55 | |||
56 | stw ra, PT_RA(sp) | ||
57 | stw fp, PT_FP(sp) | ||
58 | stw gp, PT_GP(sp) | ||
59 | rdctl r24, estatus | ||
60 | stw r24, PT_ESTATUS(sp) | ||
61 | stw ea, PT_EA(sp) | ||
62 | .endm | ||
63 | |||
64 | .macro RESTORE_ALL | ||
65 | ldw r1, PT_R1(sp) /* Restore registers */ | ||
66 | ldw r2, PT_R2(sp) | ||
67 | ldw r3, PT_R3(sp) | ||
68 | ldw r4, PT_R4(sp) | ||
69 | ldw r5, PT_R5(sp) | ||
70 | ldw r6, PT_R6(sp) | ||
71 | ldw r7, PT_R7(sp) | ||
72 | ldw r8, PT_R8(sp) | ||
73 | ldw r9, PT_R9(sp) | ||
74 | ldw r10, PT_R10(sp) | ||
75 | ldw r11, PT_R11(sp) | ||
76 | ldw r12, PT_R12(sp) | ||
77 | ldw r13, PT_R13(sp) | ||
78 | ldw r14, PT_R14(sp) | ||
79 | ldw r15, PT_R15(sp) | ||
80 | ldw ra, PT_RA(sp) | ||
81 | ldw fp, PT_FP(sp) | ||
82 | ldw gp, PT_GP(sp) | ||
83 | ldw r24, PT_ESTATUS(sp) | ||
84 | wrctl estatus, r24 | ||
85 | ldw ea, PT_EA(sp) | ||
86 | ldw sp, PT_SP(sp) /* Restore sp last */ | ||
87 | .endm | ||
88 | |||
89 | .macro SAVE_SWITCH_STACK | ||
90 | addi sp, sp, -SWITCH_STACK_SIZE | ||
91 | stw r16, SW_R16(sp) | ||
92 | stw r17, SW_R17(sp) | ||
93 | stw r18, SW_R18(sp) | ||
94 | stw r19, SW_R19(sp) | ||
95 | stw r20, SW_R20(sp) | ||
96 | stw r21, SW_R21(sp) | ||
97 | stw r22, SW_R22(sp) | ||
98 | stw r23, SW_R23(sp) | ||
99 | stw fp, SW_FP(sp) | ||
100 | stw gp, SW_GP(sp) | ||
101 | stw ra, SW_RA(sp) | ||
102 | .endm | ||
103 | |||
104 | .macro RESTORE_SWITCH_STACK | ||
105 | ldw r16, SW_R16(sp) | ||
106 | ldw r17, SW_R17(sp) | ||
107 | ldw r18, SW_R18(sp) | ||
108 | ldw r19, SW_R19(sp) | ||
109 | ldw r20, SW_R20(sp) | ||
110 | ldw r21, SW_R21(sp) | ||
111 | ldw r22, SW_R22(sp) | ||
112 | ldw r23, SW_R23(sp) | ||
113 | ldw fp, SW_FP(sp) | ||
114 | ldw gp, SW_GP(sp) | ||
115 | ldw ra, SW_RA(sp) | ||
116 | addi sp, sp, SWITCH_STACK_SIZE | ||
117 | .endm | ||
118 | |||
119 | #endif /* __ASSEMBLY__ */ | ||
120 | #endif /* _ASM_NIOS2_ENTRY_H */ | ||
diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h new file mode 100644 index 000000000000..9102bfd3fa1c --- /dev/null +++ b/arch/nios2/include/asm/io.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Altera Corporation | ||
3 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_NIOS2_IO_H | ||
12 | #define _ASM_NIOS2_IO_H | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <asm/pgtable-bits.h> | ||
16 | |||
17 | /* PCI is not supported in nios2, set this to 0. */ | ||
18 | #define IO_SPACE_LIMIT 0 | ||
19 | |||
20 | #define readb_relaxed(addr) readb(addr) | ||
21 | #define readw_relaxed(addr) readw(addr) | ||
22 | #define readl_relaxed(addr) readl(addr) | ||
23 | |||
24 | #define writeb_relaxed(x, addr) writeb(x, addr) | ||
25 | #define writew_relaxed(x, addr) writew(x, addr) | ||
26 | #define writel_relaxed(x, addr) writel(x, addr) | ||
27 | |||
28 | extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, | ||
29 | unsigned long cacheflag); | ||
30 | extern void __iounmap(void __iomem *addr); | ||
31 | |||
32 | static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) | ||
33 | { | ||
34 | return __ioremap(physaddr, size, 0); | ||
35 | } | ||
36 | |||
37 | static inline void __iomem *ioremap_nocache(unsigned long physaddr, | ||
38 | unsigned long size) | ||
39 | { | ||
40 | return __ioremap(physaddr, size, 0); | ||
41 | } | ||
42 | |||
43 | static inline void iounmap(void __iomem *addr) | ||
44 | { | ||
45 | __iounmap(addr); | ||
46 | } | ||
47 | |||
48 | /* Pages to physical address... */ | ||
49 | #define page_to_phys(page) virt_to_phys(page_to_virt(page)) | ||
50 | #define page_to_bus(page) page_to_virt(page) | ||
51 | |||
52 | /* Macros used for converting between virtual and physical mappings. */ | ||
53 | #define phys_to_virt(vaddr) \ | ||
54 | ((void *)((unsigned long)(vaddr) | CONFIG_NIOS2_KERNEL_REGION_BASE)) | ||
55 | /* Clear top 3 bits */ | ||
56 | #define virt_to_phys(vaddr) \ | ||
57 | ((unsigned long)((unsigned long)(vaddr) & ~0xE0000000)) | ||
58 | |||
59 | #include <asm-generic/io.h> | ||
60 | |||
61 | #endif /* _ASM_NIOS2_IO_H */ | ||
diff --git a/arch/nios2/include/asm/irq.h b/arch/nios2/include/asm/irq.h new file mode 100644 index 000000000000..8e40fd94a36c --- /dev/null +++ b/arch/nios2/include/asm/irq.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #ifndef _ASM_NIOS2_IRQ_H | ||
21 | #define _ASM_NIOS2_IRQ_H | ||
22 | |||
23 | #define NIOS2_CPU_NR_IRQS 32 | ||
24 | |||
25 | #include <asm-generic/irq.h> | ||
26 | #include <linux/irqdomain.h> | ||
27 | |||
28 | #endif | ||
diff --git a/arch/nios2/include/asm/irqflags.h b/arch/nios2/include/asm/irqflags.h new file mode 100644 index 000000000000..75ab92e639f8 --- /dev/null +++ b/arch/nios2/include/asm/irqflags.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | #ifndef _ASM_IRQFLAGS_H | ||
19 | #define _ASM_IRQFLAGS_H | ||
20 | |||
21 | #include <asm/registers.h> | ||
22 | |||
23 | static inline unsigned long arch_local_save_flags(void) | ||
24 | { | ||
25 | return RDCTL(CTL_STATUS); | ||
26 | } | ||
27 | |||
28 | /* | ||
29 | * This will restore ALL status register flags, not only the interrupt | ||
30 | * mask flag. | ||
31 | */ | ||
32 | static inline void arch_local_irq_restore(unsigned long flags) | ||
33 | { | ||
34 | WRCTL(CTL_STATUS, flags); | ||
35 | } | ||
36 | |||
37 | static inline void arch_local_irq_disable(void) | ||
38 | { | ||
39 | unsigned long flags; | ||
40 | |||
41 | flags = arch_local_save_flags(); | ||
42 | arch_local_irq_restore(flags & ~STATUS_PIE); | ||
43 | } | ||
44 | |||
45 | static inline void arch_local_irq_enable(void) | ||
46 | { | ||
47 | unsigned long flags; | ||
48 | |||
49 | flags = arch_local_save_flags(); | ||
50 | arch_local_irq_restore(flags | STATUS_PIE); | ||
51 | } | ||
52 | |||
53 | static inline int arch_irqs_disabled_flags(unsigned long flags) | ||
54 | { | ||
55 | return (flags & STATUS_PIE) == 0; | ||
56 | } | ||
57 | |||
58 | static inline int arch_irqs_disabled(void) | ||
59 | { | ||
60 | return arch_irqs_disabled_flags(arch_local_save_flags()); | ||
61 | } | ||
62 | |||
63 | static inline unsigned long arch_local_irq_save(void) | ||
64 | { | ||
65 | unsigned long flags; | ||
66 | |||
67 | flags = arch_local_save_flags(); | ||
68 | arch_local_irq_restore(flags & ~STATUS_PIE); | ||
69 | return flags; | ||
70 | } | ||
71 | |||
72 | #endif /* _ASM_IRQFLAGS_H */ | ||
diff --git a/arch/nios2/include/asm/linkage.h b/arch/nios2/include/asm/linkage.h new file mode 100644 index 000000000000..e0c6decd7d58 --- /dev/null +++ b/arch/nios2/include/asm/linkage.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw> | ||
3 | * | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
14 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
15 | * details. | ||
16 | */ | ||
17 | |||
18 | #ifndef _ASM_NIOS2_LINKAGE_H | ||
19 | #define _ASM_NIOS2_LINKAGE_H | ||
20 | |||
21 | /* This file is required by include/linux/linkage.h */ | ||
22 | #define __ALIGN .align 4 | ||
23 | #define __ALIGN_STR ".align 4" | ||
24 | |||
25 | #endif | ||
diff --git a/arch/nios2/include/asm/mmu.h b/arch/nios2/include/asm/mmu.h new file mode 100644 index 000000000000..d9c0b1010f26 --- /dev/null +++ b/arch/nios2/include/asm/mmu.h | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_MMU_H | ||
11 | #define _ASM_NIOS2_MMU_H | ||
12 | |||
13 | /* Default "unsigned long" context */ | ||
14 | typedef unsigned long mm_context_t; | ||
15 | |||
16 | #endif /* _ASM_NIOS2_MMU_H */ | ||
diff --git a/arch/nios2/include/asm/mmu_context.h b/arch/nios2/include/asm/mmu_context.h new file mode 100644 index 000000000000..294b4b1f81d4 --- /dev/null +++ b/arch/nios2/include/asm/mmu_context.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 1996, 1997, 1998, 1999 by Ralf Baechle | ||
4 | * Copyright (C) 1999 Silicon Graphics, Inc. | ||
5 | * | ||
6 | * based on MIPS asm/mmu_context.h | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | |||
13 | #ifndef _ASM_NIOS2_MMU_CONTEXT_H | ||
14 | #define _ASM_NIOS2_MMU_CONTEXT_H | ||
15 | |||
16 | #include <asm-generic/mm_hooks.h> | ||
17 | |||
18 | extern void mmu_context_init(void); | ||
19 | extern unsigned long get_pid_from_context(mm_context_t *ctx); | ||
20 | |||
21 | /* | ||
22 | * For the fast tlb miss handlers, we keep a pointer to the current pgd. | ||
23 | * processor. | ||
24 | */ | ||
25 | extern pgd_t *pgd_current; | ||
26 | |||
27 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | /* | ||
32 | * Initialize the context related info for a new mm_struct instance. | ||
33 | * | ||
34 | * Set all new contexts to 0, that way the generation will never match | ||
35 | * the currently running generation when this context is switched in. | ||
36 | */ | ||
37 | static inline int init_new_context(struct task_struct *tsk, | ||
38 | struct mm_struct *mm) | ||
39 | { | ||
40 | mm->context = 0; | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | /* | ||
45 | * Destroy context related info for an mm_struct that is about | ||
46 | * to be put to rest. | ||
47 | */ | ||
48 | static inline void destroy_context(struct mm_struct *mm) | ||
49 | { | ||
50 | } | ||
51 | |||
52 | void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
53 | struct task_struct *tsk); | ||
54 | |||
55 | static inline void deactivate_mm(struct task_struct *tsk, | ||
56 | struct mm_struct *mm) | ||
57 | { | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * After we have set current->mm to a new value, this activates | ||
62 | * the context for the new mm so we see the new mappings. | ||
63 | */ | ||
64 | void activate_mm(struct mm_struct *prev, struct mm_struct *next); | ||
65 | |||
66 | #endif /* _ASM_NIOS2_MMU_CONTEXT_H */ | ||
diff --git a/arch/nios2/include/asm/mutex.h b/arch/nios2/include/asm/mutex.h new file mode 100644 index 000000000000..ff6101aa2c71 --- /dev/null +++ b/arch/nios2/include/asm/mutex.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/mutex-dec.h> | |||
diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h new file mode 100644 index 000000000000..4b32d6fd9d98 --- /dev/null +++ b/arch/nios2/include/asm/page.h | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
4 | * | ||
5 | * MMU support based on asm/page.h from mips which is: | ||
6 | * | ||
7 | * Copyright (C) 1994 - 1999, 2000, 03 Ralf Baechle | ||
8 | * Copyright (C) 1999, 2000 Silicon Graphics, Inc. | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef _ASM_NIOS2_PAGE_H | ||
16 | #define _ASM_NIOS2_PAGE_H | ||
17 | |||
18 | #include <linux/pfn.h> | ||
19 | #include <linux/const.h> | ||
20 | |||
21 | /* | ||
22 | * PAGE_SHIFT determines the page size | ||
23 | */ | ||
24 | #define PAGE_SHIFT 12 | ||
25 | #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) | ||
26 | #define PAGE_MASK (~(PAGE_SIZE - 1)) | ||
27 | |||
28 | /* | ||
29 | * PAGE_OFFSET -- the first address of the first page of memory. | ||
30 | */ | ||
31 | #define PAGE_OFFSET \ | ||
32 | (CONFIG_NIOS2_MEM_BASE + CONFIG_NIOS2_KERNEL_REGION_BASE) | ||
33 | |||
34 | #ifndef __ASSEMBLY__ | ||
35 | |||
36 | /* | ||
37 | * This gives the physical RAM offset. | ||
38 | */ | ||
39 | #define PHYS_OFFSET CONFIG_NIOS2_MEM_BASE | ||
40 | |||
41 | /* | ||
42 | * It's normally defined only for FLATMEM config but it's | ||
43 | * used in our early mem init code for all memory models. | ||
44 | * So always define it. | ||
45 | */ | ||
46 | #define ARCH_PFN_OFFSET PFN_UP(PHYS_OFFSET) | ||
47 | |||
48 | #define clear_page(page) memset((page), 0, PAGE_SIZE) | ||
49 | #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) | ||
50 | |||
51 | struct page; | ||
52 | |||
53 | extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page); | ||
54 | extern void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, | ||
55 | struct page *to); | ||
56 | |||
57 | /* | ||
58 | * These are used to make use of C type-checking. | ||
59 | */ | ||
60 | typedef struct page *pgtable_t; | ||
61 | typedef struct { unsigned long pte; } pte_t; | ||
62 | typedef struct { unsigned long pgd; } pgd_t; | ||
63 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
64 | |||
65 | #define pte_val(x) ((x).pte) | ||
66 | #define pgd_val(x) ((x).pgd) | ||
67 | #define pgprot_val(x) ((x).pgprot) | ||
68 | |||
69 | #define __pte(x) ((pte_t) { (x) }) | ||
70 | #define __pgd(x) ((pgd_t) { (x) }) | ||
71 | #define __pgprot(x) ((pgprot_t) { (x) }) | ||
72 | |||
73 | extern unsigned long memory_start; | ||
74 | extern unsigned long memory_end; | ||
75 | extern unsigned long memory_size; | ||
76 | |||
77 | extern struct page *mem_map; | ||
78 | |||
79 | #endif /* !__ASSEMBLY__ */ | ||
80 | |||
81 | # define __pa(x) \ | ||
82 | ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET) | ||
83 | # define __va(x) \ | ||
84 | ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET)) | ||
85 | |||
86 | #define page_to_virt(page) \ | ||
87 | ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) | ||
88 | |||
89 | # define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | ||
90 | # define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && \ | ||
91 | (pfn) < max_mapnr) | ||
92 | |||
93 | # define virt_to_page(vaddr) pfn_to_page(PFN_DOWN(virt_to_phys(vaddr))) | ||
94 | # define virt_addr_valid(vaddr) pfn_valid(PFN_DOWN(virt_to_phys(vaddr))) | ||
95 | |||
96 | # define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ | ||
97 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
98 | |||
99 | # define UNCAC_ADDR(addr) \ | ||
100 | ((void *)((unsigned)(addr) | CONFIG_NIOS2_IO_REGION_BASE)) | ||
101 | # define CAC_ADDR(addr) \ | ||
102 | ((void *)(((unsigned)(addr) & ~CONFIG_NIOS2_IO_REGION_BASE) | \ | ||
103 | CONFIG_NIOS2_KERNEL_REGION_BASE)) | ||
104 | |||
105 | #include <asm-generic/memory_model.h> | ||
106 | |||
107 | #include <asm-generic/getorder.h> | ||
108 | |||
109 | #endif /* _ASM_NIOS2_PAGE_H */ | ||
diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h new file mode 100644 index 000000000000..6e2985e0a7b9 --- /dev/null +++ b/arch/nios2/include/asm/pgalloc.h | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 1994 - 2001, 2003 by Ralf Baechle | ||
7 | * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_PGALLOC_H | ||
11 | #define _ASM_NIOS2_PGALLOC_H | ||
12 | |||
13 | #include <linux/mm.h> | ||
14 | |||
15 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, | ||
16 | pte_t *pte) | ||
17 | { | ||
18 | set_pmd(pmd, __pmd((unsigned long)pte)); | ||
19 | } | ||
20 | |||
21 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | ||
22 | pgtable_t pte) | ||
23 | { | ||
24 | set_pmd(pmd, __pmd((unsigned long)page_address(pte))); | ||
25 | } | ||
26 | #define pmd_pgtable(pmd) pmd_page(pmd) | ||
27 | |||
28 | /* | ||
29 | * Initialize a new pmd table with invalid pointers. | ||
30 | */ | ||
31 | extern void pmd_init(unsigned long page, unsigned long pagetable); | ||
32 | |||
33 | extern pgd_t *pgd_alloc(struct mm_struct *mm); | ||
34 | |||
35 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | ||
36 | { | ||
37 | free_pages((unsigned long)pgd, PGD_ORDER); | ||
38 | } | ||
39 | |||
40 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | ||
41 | unsigned long address) | ||
42 | { | ||
43 | pte_t *pte; | ||
44 | |||
45 | pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, | ||
46 | PTE_ORDER); | ||
47 | |||
48 | return pte; | ||
49 | } | ||
50 | |||
51 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm, | ||
52 | unsigned long address) | ||
53 | { | ||
54 | struct page *pte; | ||
55 | |||
56 | pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER); | ||
57 | if (pte) { | ||
58 | if (!pgtable_page_ctor(pte)) { | ||
59 | __free_page(pte); | ||
60 | return NULL; | ||
61 | } | ||
62 | clear_highpage(pte); | ||
63 | } | ||
64 | return pte; | ||
65 | } | ||
66 | |||
67 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
68 | { | ||
69 | free_pages((unsigned long)pte, PTE_ORDER); | ||
70 | } | ||
71 | |||
72 | static inline void pte_free(struct mm_struct *mm, struct page *pte) | ||
73 | { | ||
74 | pgtable_page_dtor(pte); | ||
75 | __free_pages(pte, PTE_ORDER); | ||
76 | } | ||
77 | |||
78 | #define __pte_free_tlb(tlb, pte, addr) \ | ||
79 | do { \ | ||
80 | pgtable_page_dtor(pte); \ | ||
81 | tlb_remove_page((tlb), (pte)); \ | ||
82 | } while (0) | ||
83 | |||
84 | #define check_pgt_cache() do { } while (0) | ||
85 | |||
86 | #endif /* _ASM_NIOS2_PGALLOC_H */ | ||
diff --git a/arch/nios2/include/asm/pgtable-bits.h b/arch/nios2/include/asm/pgtable-bits.h new file mode 100644 index 000000000000..ce9e7069aa96 --- /dev/null +++ b/arch/nios2/include/asm/pgtable-bits.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2009 Wind River Systems Inc | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_PGTABLE_BITS_H | ||
11 | #define _ASM_NIOS2_PGTABLE_BITS_H | ||
12 | |||
13 | /* | ||
14 | * These are actual hardware defined protection bits in the tlbacc register | ||
15 | * which looks like this: | ||
16 | * | ||
17 | * 31 30 ... 26 25 24 23 22 21 20 19 18 ... 1 0 | ||
18 | * ignored........ C R W X G PFN............ | ||
19 | */ | ||
20 | #define _PAGE_GLOBAL (1<<20) | ||
21 | #define _PAGE_EXEC (1<<21) | ||
22 | #define _PAGE_WRITE (1<<22) | ||
23 | #define _PAGE_READ (1<<23) | ||
24 | #define _PAGE_CACHED (1<<24) /* C: data access cacheable */ | ||
25 | |||
26 | /* | ||
27 | * Software defined bits. They are ignored by the hardware and always read back | ||
28 | * as zero, but can be written as non-zero. | ||
29 | */ | ||
30 | #define _PAGE_PRESENT (1<<25) /* PTE contains a translation */ | ||
31 | #define _PAGE_ACCESSED (1<<26) /* page referenced */ | ||
32 | #define _PAGE_DIRTY (1<<27) /* dirty page */ | ||
33 | #define _PAGE_FILE (1<<28) /* PTE used for file mapping or swap */ | ||
34 | |||
35 | #endif /* _ASM_NIOS2_PGTABLE_BITS_H */ | ||
diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h new file mode 100644 index 000000000000..ccbaffd47671 --- /dev/null +++ b/arch/nios2/include/asm/pgtable.h | |||
@@ -0,0 +1,310 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2009 Wind River Systems Inc | ||
4 | * | ||
5 | * Based on asm/pgtable-32.h from mips which is: | ||
6 | * | ||
7 | * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 2003 Ralf Baechle | ||
8 | * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc. | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef _ASM_NIOS2_PGTABLE_H | ||
16 | #define _ASM_NIOS2_PGTABLE_H | ||
17 | |||
18 | #include <linux/io.h> | ||
19 | #include <linux/bug.h> | ||
20 | #include <asm/page.h> | ||
21 | #include <asm/cacheflush.h> | ||
22 | #include <asm/tlbflush.h> | ||
23 | |||
24 | #include <asm/pgtable-bits.h> | ||
25 | #include <asm-generic/pgtable-nopmd.h> | ||
26 | |||
27 | #define FIRST_USER_ADDRESS 0 | ||
28 | |||
29 | #define VMALLOC_START CONFIG_NIOS2_KERNEL_MMU_REGION_BASE | ||
30 | #define VMALLOC_END (CONFIG_NIOS2_KERNEL_REGION_BASE - 1) | ||
31 | |||
32 | struct mm_struct; | ||
33 | |||
34 | /* Helper macro */ | ||
35 | #define MKP(x, w, r) __pgprot(_PAGE_PRESENT | _PAGE_CACHED | \ | ||
36 | ((x) ? _PAGE_EXEC : 0) | \ | ||
37 | ((r) ? _PAGE_READ : 0) | \ | ||
38 | ((w) ? _PAGE_WRITE : 0)) | ||
39 | /* | ||
40 | * These are the macros that generic kernel code needs | ||
41 | * (to populate protection_map[]) | ||
42 | */ | ||
43 | |||
44 | /* Remove W bit on private pages for COW support */ | ||
45 | #define __P000 MKP(0, 0, 0) | ||
46 | #define __P001 MKP(0, 0, 1) | ||
47 | #define __P010 MKP(0, 0, 0) /* COW */ | ||
48 | #define __P011 MKP(0, 0, 1) /* COW */ | ||
49 | #define __P100 MKP(1, 0, 0) | ||
50 | #define __P101 MKP(1, 0, 1) | ||
51 | #define __P110 MKP(1, 0, 0) /* COW */ | ||
52 | #define __P111 MKP(1, 0, 1) /* COW */ | ||
53 | |||
54 | /* Shared pages can have exact HW mapping */ | ||
55 | #define __S000 MKP(0, 0, 0) | ||
56 | #define __S001 MKP(0, 0, 1) | ||
57 | #define __S010 MKP(0, 1, 0) | ||
58 | #define __S011 MKP(0, 1, 1) | ||
59 | #define __S100 MKP(1, 0, 0) | ||
60 | #define __S101 MKP(1, 0, 1) | ||
61 | #define __S110 MKP(1, 1, 0) | ||
62 | #define __S111 MKP(1, 1, 1) | ||
63 | |||
64 | /* Used all over the kernel */ | ||
65 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CACHED | _PAGE_READ | \ | ||
66 | _PAGE_WRITE | _PAGE_EXEC | _PAGE_GLOBAL) | ||
67 | |||
68 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_CACHED | _PAGE_READ | \ | ||
69 | _PAGE_WRITE | _PAGE_ACCESSED) | ||
70 | |||
71 | #define PAGE_COPY MKP(0, 0, 1) | ||
72 | |||
73 | #define PGD_ORDER 0 | ||
74 | #define PTE_ORDER 0 | ||
75 | |||
76 | #define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t)) | ||
77 | #define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) | ||
78 | |||
79 | #define USER_PTRS_PER_PGD \ | ||
80 | (CONFIG_NIOS2_KERNEL_MMU_REGION_BASE / PGDIR_SIZE) | ||
81 | |||
82 | #define PGDIR_SHIFT 22 | ||
83 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
84 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
85 | |||
86 | /* | ||
87 | * ZERO_PAGE is a global shared page that is always zero: used | ||
88 | * for zero-mapped memory areas etc.. | ||
89 | */ | ||
90 | extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | ||
91 | #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) | ||
92 | |||
93 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | ||
94 | extern pte_t invalid_pte_table[PAGE_SIZE/sizeof(pte_t)]; | ||
95 | |||
96 | /* | ||
97 | * (pmds are folded into puds so this doesn't get actually called, | ||
98 | * but the define is needed for a generic inline function.) | ||
99 | */ | ||
100 | static inline void set_pmd(pmd_t *pmdptr, pmd_t pmdval) | ||
101 | { | ||
102 | pmdptr->pud.pgd.pgd = pmdval.pud.pgd.pgd; | ||
103 | } | ||
104 | |||
105 | /* to find an entry in a page-table-directory */ | ||
106 | #define pgd_index(addr) (((addr) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) | ||
107 | #define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) | ||
108 | |||
109 | static inline int pte_write(pte_t pte) \ | ||
110 | { return pte_val(pte) & _PAGE_WRITE; } | ||
111 | static inline int pte_dirty(pte_t pte) \ | ||
112 | { return pte_val(pte) & _PAGE_DIRTY; } | ||
113 | static inline int pte_young(pte_t pte) \ | ||
114 | { return pte_val(pte) & _PAGE_ACCESSED; } | ||
115 | static inline int pte_file(pte_t pte) \ | ||
116 | { return pte_val(pte) & _PAGE_FILE; } | ||
117 | static inline int pte_special(pte_t pte) { return 0; } | ||
118 | |||
119 | #define pgprot_noncached pgprot_noncached | ||
120 | |||
121 | static inline pgprot_t pgprot_noncached(pgprot_t _prot) | ||
122 | { | ||
123 | unsigned long prot = pgprot_val(_prot); | ||
124 | |||
125 | prot &= ~_PAGE_CACHED; | ||
126 | |||
127 | return __pgprot(prot); | ||
128 | } | ||
129 | |||
130 | static inline int pte_none(pte_t pte) | ||
131 | { | ||
132 | return !(pte_val(pte) & ~(_PAGE_GLOBAL|0xf)); | ||
133 | } | ||
134 | |||
135 | static inline int pte_present(pte_t pte) \ | ||
136 | { return pte_val(pte) & _PAGE_PRESENT; } | ||
137 | |||
138 | /* | ||
139 | * The following only work if pte_present() is true. | ||
140 | * Undefined behaviour if not.. | ||
141 | */ | ||
142 | static inline pte_t pte_wrprotect(pte_t pte) | ||
143 | { | ||
144 | pte_val(pte) &= ~_PAGE_WRITE; | ||
145 | return pte; | ||
146 | } | ||
147 | |||
148 | static inline pte_t pte_mkclean(pte_t pte) | ||
149 | { | ||
150 | pte_val(pte) &= ~_PAGE_DIRTY; | ||
151 | return pte; | ||
152 | } | ||
153 | |||
154 | static inline pte_t pte_mkold(pte_t pte) | ||
155 | { | ||
156 | pte_val(pte) &= ~_PAGE_ACCESSED; | ||
157 | return pte; | ||
158 | } | ||
159 | |||
160 | static inline pte_t pte_mkwrite(pte_t pte) | ||
161 | { | ||
162 | pte_val(pte) |= _PAGE_WRITE; | ||
163 | return pte; | ||
164 | } | ||
165 | |||
166 | static inline pte_t pte_mkdirty(pte_t pte) | ||
167 | { | ||
168 | pte_val(pte) |= _PAGE_DIRTY; | ||
169 | return pte; | ||
170 | } | ||
171 | |||
172 | static inline pte_t pte_mkspecial(pte_t pte) { return pte; } | ||
173 | |||
174 | static inline pte_t pte_mkyoung(pte_t pte) | ||
175 | { | ||
176 | pte_val(pte) |= _PAGE_ACCESSED; | ||
177 | return pte; | ||
178 | } | ||
179 | |||
180 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
181 | { | ||
182 | const unsigned long mask = _PAGE_READ | _PAGE_WRITE | _PAGE_EXEC; | ||
183 | |||
184 | pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); | ||
185 | return pte; | ||
186 | } | ||
187 | |||
188 | static inline int pmd_present(pmd_t pmd) | ||
189 | { | ||
190 | return (pmd_val(pmd) != (unsigned long) invalid_pte_table) | ||
191 | && (pmd_val(pmd) != 0UL); | ||
192 | } | ||
193 | |||
194 | static inline void pmd_clear(pmd_t *pmdp) | ||
195 | { | ||
196 | pmd_val(*pmdp) = (unsigned long) invalid_pte_table; | ||
197 | } | ||
198 | |||
199 | #define pte_pfn(pte) (pte_val(pte) & 0xfffff) | ||
200 | #define pfn_pte(pfn, prot) (__pte(pfn | pgprot_val(prot))) | ||
201 | #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) | ||
202 | |||
203 | /* | ||
204 | * Store a linux PTE into the linux page table. | ||
205 | */ | ||
206 | static inline void set_pte(pte_t *ptep, pte_t pteval) | ||
207 | { | ||
208 | *ptep = pteval; | ||
209 | } | ||
210 | |||
211 | static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | ||
212 | pte_t *ptep, pte_t pteval) | ||
213 | { | ||
214 | unsigned long paddr = page_to_virt(pte_page(pteval)); | ||
215 | |||
216 | flush_dcache_range(paddr, paddr + PAGE_SIZE); | ||
217 | set_pte(ptep, pteval); | ||
218 | } | ||
219 | |||
220 | static inline int pmd_none(pmd_t pmd) | ||
221 | { | ||
222 | return (pmd_val(pmd) == | ||
223 | (unsigned long) invalid_pte_table) || (pmd_val(pmd) == 0UL); | ||
224 | } | ||
225 | |||
226 | #define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) | ||
227 | |||
228 | static inline void pte_clear(struct mm_struct *mm, | ||
229 | unsigned long addr, pte_t *ptep) | ||
230 | { | ||
231 | pte_t null; | ||
232 | |||
233 | pte_val(null) = (addr >> PAGE_SHIFT) & 0xf; | ||
234 | |||
235 | set_pte_at(mm, addr, ptep, null); | ||
236 | flush_tlb_one(addr); | ||
237 | } | ||
238 | |||
239 | /* | ||
240 | * Conversion functions: convert a page and protection to a page entry, | ||
241 | * and a page entry and page directory to the page they refer to. | ||
242 | */ | ||
243 | #define mk_pte(page, prot) (pfn_pte(page_to_pfn(page), prot)) | ||
244 | |||
245 | #define pte_unmap(pte) do { } while (0) | ||
246 | |||
247 | /* | ||
248 | * Conversion functions: convert a page and protection to a page entry, | ||
249 | * and a page entry and page directory to the page they refer to. | ||
250 | */ | ||
251 | #define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd)) | ||
252 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) | ||
253 | #define pmd_page_vaddr(pmd) pmd_val(pmd) | ||
254 | |||
255 | #define pte_offset_map(dir, addr) \ | ||
256 | ((pte_t *) page_address(pmd_page(*dir)) + \ | ||
257 | (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) | ||
258 | |||
259 | /* to find an entry in a kernel page-table-directory */ | ||
260 | #define pgd_offset_k(addr) pgd_offset(&init_mm, addr) | ||
261 | |||
262 | /* Get the address to the PTE for a vaddr in specific directory */ | ||
263 | #define pte_offset_kernel(dir, addr) \ | ||
264 | ((pte_t *) pmd_page_vaddr(*(dir)) + \ | ||
265 | (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) | ||
266 | |||
267 | #define pte_ERROR(e) \ | ||
268 | pr_err("%s:%d: bad pte %08lx.\n", \ | ||
269 | __FILE__, __LINE__, pte_val(e)) | ||
270 | #define pgd_ERROR(e) \ | ||
271 | pr_err("%s:%d: bad pgd %08lx.\n", \ | ||
272 | __FILE__, __LINE__, pgd_val(e)) | ||
273 | |||
274 | /* | ||
275 | * Encode and decode a swap entry (must be !pte_none(pte) && !pte_present(pte) | ||
276 | * && !pte_file(pte)): | ||
277 | * | ||
278 | * 31 30 29 28 27 26 25 24 23 22 21 20 19 18 ... 1 0 | ||
279 | * 0 0 0 0 type. 0 0 0 0 0 0 offset......... | ||
280 | * | ||
281 | * This gives us up to 2**2 = 4 swap files and 2**20 * 4K = 4G per swap file. | ||
282 | * | ||
283 | * Note that the offset field is always non-zero, thus !pte_none(pte) is always | ||
284 | * true. | ||
285 | */ | ||
286 | #define __swp_type(swp) (((swp).val >> 26) & 0x3) | ||
287 | #define __swp_offset(swp) ((swp).val & 0xfffff) | ||
288 | #define __swp_entry(type, off) ((swp_entry_t) { (((type) & 0x3) << 26) \ | ||
289 | | ((off) & 0xfffff) }) | ||
290 | #define __swp_entry_to_pte(swp) ((pte_t) { (swp).val }) | ||
291 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | ||
292 | |||
293 | /* Encode and decode a nonlinear file mapping entry */ | ||
294 | #define PTE_FILE_MAX_BITS 25 | ||
295 | #define pte_to_pgoff(pte) (pte_val(pte) & 0x1ffffff) | ||
296 | #define pgoff_to_pte(off) __pte(((off) & 0x1ffffff) | _PAGE_FILE) | ||
297 | |||
298 | #define kern_addr_valid(addr) (1) | ||
299 | |||
300 | #include <asm-generic/pgtable.h> | ||
301 | |||
302 | #define pgtable_cache_init() do { } while (0) | ||
303 | |||
304 | extern void __init paging_init(void); | ||
305 | extern void __init mmu_init(void); | ||
306 | |||
307 | extern void update_mmu_cache(struct vm_area_struct *vma, | ||
308 | unsigned long address, pte_t *pte); | ||
309 | |||
310 | #endif /* _ASM_NIOS2_PGTABLE_H */ | ||
diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h new file mode 100644 index 000000000000..3bd349473b06 --- /dev/null +++ b/arch/nios2/include/asm/processor.h | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
5 | * Copyright (C) 2001 Ken Hill (khill@microtronix.com) | ||
6 | * Vic Phillips (vic@microtronix.com) | ||
7 | * | ||
8 | * based on SPARC asm/processor_32.h which is: | ||
9 | * | ||
10 | * Copyright (C) 1994 David S. Miller | ||
11 | * | ||
12 | * This file is subject to the terms and conditions of the GNU General Public | ||
13 | * License. See the file "COPYING" in the main directory of this archive | ||
14 | * for more details. | ||
15 | */ | ||
16 | |||
17 | #ifndef _ASM_NIOS2_PROCESSOR_H | ||
18 | #define _ASM_NIOS2_PROCESSOR_H | ||
19 | |||
20 | #include <asm/ptrace.h> | ||
21 | #include <asm/registers.h> | ||
22 | #include <asm/page.h> | ||
23 | |||
24 | #define NIOS2_FLAG_KTHREAD 0x00000001 /* task is a kernel thread */ | ||
25 | |||
26 | #define NIOS2_OP_NOP 0x1883a | ||
27 | #define NIOS2_OP_BREAK 0x3da03a | ||
28 | |||
29 | #ifdef __KERNEL__ | ||
30 | |||
31 | #define STACK_TOP TASK_SIZE | ||
32 | #define STACK_TOP_MAX STACK_TOP | ||
33 | |||
34 | #endif /* __KERNEL__ */ | ||
35 | |||
36 | /* Kuser helpers is mapped to this user space address */ | ||
37 | #define KUSER_BASE 0x1000 | ||
38 | #define KUSER_SIZE (PAGE_SIZE) | ||
39 | #ifndef __ASSEMBLY__ | ||
40 | |||
41 | /* | ||
42 | * Default implementation of macro that returns current | ||
43 | * instruction pointer ("program counter"). | ||
44 | */ | ||
45 | #define current_text_addr() ({ __label__ _l; _l: &&_l; }) | ||
46 | |||
47 | # define TASK_SIZE 0x7FFF0000UL | ||
48 | # define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3)) | ||
49 | |||
50 | /* The Nios processor specific thread struct. */ | ||
51 | struct thread_struct { | ||
52 | struct pt_regs *kregs; | ||
53 | |||
54 | /* Context switch saved kernel state. */ | ||
55 | unsigned long ksp; | ||
56 | unsigned long kpsr; | ||
57 | }; | ||
58 | |||
59 | #define INIT_MMAP \ | ||
60 | { &init_mm, (0), (0), __pgprot(0x0), VM_READ | VM_WRITE | VM_EXEC } | ||
61 | |||
62 | # define INIT_THREAD { \ | ||
63 | .kregs = NULL, \ | ||
64 | .ksp = 0, \ | ||
65 | .kpsr = 0, \ | ||
66 | } | ||
67 | |||
68 | extern void start_thread(struct pt_regs *regs, unsigned long pc, | ||
69 | unsigned long sp); | ||
70 | |||
71 | struct task_struct; | ||
72 | |||
73 | /* Free all resources held by a thread. */ | ||
74 | static inline void release_thread(struct task_struct *dead_task) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | /* Free current thread data structures etc.. */ | ||
79 | static inline void exit_thread(void) | ||
80 | { | ||
81 | } | ||
82 | |||
83 | /* Return saved PC of a blocked thread. */ | ||
84 | #define thread_saved_pc(tsk) ((tsk)->thread.kregs->ea) | ||
85 | |||
86 | extern unsigned long get_wchan(struct task_struct *p); | ||
87 | |||
88 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
89 | #define prepare_to_copy(tsk) do { } while (0) | ||
90 | |||
91 | #define task_pt_regs(p) \ | ||
92 | ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1) | ||
93 | |||
94 | /* Used by procfs */ | ||
95 | #define KSTK_EIP(tsk) ((tsk)->thread.kregs->ea) | ||
96 | #define KSTK_ESP(tsk) ((tsk)->thread.kregs->sp) | ||
97 | |||
98 | #define cpu_relax() barrier() | ||
99 | #define cpu_relax_lowlatency() cpu_relax() | ||
100 | |||
101 | #endif /* __ASSEMBLY__ */ | ||
102 | |||
103 | #endif /* _ASM_NIOS2_PROCESSOR_H */ | ||
diff --git a/arch/nios2/include/asm/ptrace.h b/arch/nios2/include/asm/ptrace.h new file mode 100644 index 000000000000..20fb1cf2dab6 --- /dev/null +++ b/arch/nios2/include/asm/ptrace.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
5 | * | ||
6 | * based on m68k asm/processor.h | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | |||
13 | #ifndef _ASM_NIOS2_PTRACE_H | ||
14 | #define _ASM_NIOS2_PTRACE_H | ||
15 | |||
16 | #include <uapi/asm/ptrace.h> | ||
17 | |||
18 | #ifndef __ASSEMBLY__ | ||
19 | #define user_mode(regs) (((regs)->estatus & ESTATUS_EU)) | ||
20 | |||
21 | #define instruction_pointer(regs) ((regs)->ra) | ||
22 | #define profile_pc(regs) instruction_pointer(regs) | ||
23 | #define user_stack_pointer(regs) ((regs)->sp) | ||
24 | extern void show_regs(struct pt_regs *); | ||
25 | |||
26 | #define current_pt_regs() \ | ||
27 | ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE)\ | ||
28 | - 1) | ||
29 | |||
30 | int do_syscall_trace_enter(void); | ||
31 | void do_syscall_trace_exit(void); | ||
32 | #endif /* __ASSEMBLY__ */ | ||
33 | #endif /* _ASM_NIOS2_PTRACE_H */ | ||
diff --git a/arch/nios2/include/asm/registers.h b/arch/nios2/include/asm/registers.h new file mode 100644 index 000000000000..615bce19b546 --- /dev/null +++ b/arch/nios2/include/asm/registers.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef _ASM_NIOS2_REGISTERS_H | ||
20 | #define _ASM_NIOS2_REGISTERS_H | ||
21 | |||
22 | #ifndef __ASSEMBLY__ | ||
23 | #include <asm/cpuinfo.h> | ||
24 | #endif | ||
25 | |||
26 | /* control register numbers */ | ||
27 | #define CTL_STATUS 0 | ||
28 | #define CTL_ESTATUS 1 | ||
29 | #define CTL_BSTATUS 2 | ||
30 | #define CTL_IENABLE 3 | ||
31 | #define CTL_IPENDING 4 | ||
32 | #define CTL_CPUID 5 | ||
33 | #define CTL_RSV1 6 | ||
34 | #define CTL_EXCEPTION 7 | ||
35 | #define CTL_PTEADDR 8 | ||
36 | #define CTL_TLBACC 9 | ||
37 | #define CTL_TLBMISC 10 | ||
38 | #define CTL_RSV2 11 | ||
39 | #define CTL_BADADDR 12 | ||
40 | #define CTL_CONFIG 13 | ||
41 | #define CTL_MPUBASE 14 | ||
42 | #define CTL_MPUACC 15 | ||
43 | |||
44 | /* access control registers using GCC builtins */ | ||
45 | #define RDCTL(r) __builtin_rdctl(r) | ||
46 | #define WRCTL(r, v) __builtin_wrctl(r, v) | ||
47 | |||
48 | /* status register bits */ | ||
49 | #define STATUS_PIE (1 << 0) /* processor interrupt enable */ | ||
50 | #define STATUS_U (1 << 1) /* user mode */ | ||
51 | #define STATUS_EH (1 << 2) /* Exception mode */ | ||
52 | |||
53 | /* estatus register bits */ | ||
54 | #define ESTATUS_EPIE (1 << 0) /* processor interrupt enable */ | ||
55 | #define ESTATUS_EU (1 << 1) /* user mode */ | ||
56 | #define ESTATUS_EH (1 << 2) /* Exception mode */ | ||
57 | |||
58 | /* tlbmisc register bits */ | ||
59 | #define TLBMISC_PID_SHIFT 4 | ||
60 | #ifndef __ASSEMBLY__ | ||
61 | #define TLBMISC_PID_MASK ((1UL << cpuinfo.tlb_pid_num_bits) - 1) | ||
62 | #endif | ||
63 | #define TLBMISC_WAY_MASK 0xf | ||
64 | #define TLBMISC_WAY_SHIFT 20 | ||
65 | |||
66 | #define TLBMISC_PID (TLBMISC_PID_MASK << TLBMISC_PID_SHIFT) /* TLB PID */ | ||
67 | #define TLBMISC_WE (1 << 18) /* TLB write enable */ | ||
68 | #define TLBMISC_RD (1 << 19) /* TLB read */ | ||
69 | #define TLBMISC_WAY (TLBMISC_WAY_MASK << TLBMISC_WAY_SHIFT) /* TLB way */ | ||
70 | |||
71 | #endif /* _ASM_NIOS2_REGISTERS_H */ | ||
diff --git a/arch/nios2/include/asm/setup.h b/arch/nios2/include/asm/setup.h new file mode 100644 index 000000000000..dcbf8cf1a344 --- /dev/null +++ b/arch/nios2/include/asm/setup.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef _ASM_NIOS2_SETUP_H | ||
20 | #define _ASM_NIOS2_SETUP_H | ||
21 | |||
22 | #include <asm-generic/setup.h> | ||
23 | |||
24 | #ifndef __ASSEMBLY__ | ||
25 | #ifdef __KERNEL__ | ||
26 | |||
27 | extern char exception_handler_hook[]; | ||
28 | extern char fast_handler[]; | ||
29 | extern char fast_handler_end[]; | ||
30 | |||
31 | extern void pagetable_init(void); | ||
32 | |||
33 | extern void setup_early_printk(void); | ||
34 | |||
35 | #endif/* __KERNEL__ */ | ||
36 | #endif /* __ASSEMBLY__ */ | ||
37 | |||
38 | #endif /* _ASM_NIOS2_SETUP_H */ | ||
diff --git a/arch/nios2/include/asm/signal.h b/arch/nios2/include/asm/signal.h new file mode 100644 index 000000000000..bbcf11eecb01 --- /dev/null +++ b/arch/nios2/include/asm/signal.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright Altera Corporation (C) 2013. All rights reserved | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | */ | ||
17 | #ifndef _NIOS2_SIGNAL_H | ||
18 | #define _NIOS2_SIGNAL_H | ||
19 | |||
20 | #include <uapi/asm/signal.h> | ||
21 | |||
22 | #endif /* _NIOS2_SIGNAL_H */ | ||
diff --git a/arch/nios2/include/asm/string.h b/arch/nios2/include/asm/string.h new file mode 100644 index 000000000000..14dd570d64f7 --- /dev/null +++ b/arch/nios2/include/asm/string.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_NIOS2_STRING_H | ||
10 | #define _ASM_NIOS2_STRING_H | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #define __HAVE_ARCH_MEMSET | ||
15 | #define __HAVE_ARCH_MEMCPY | ||
16 | #define __HAVE_ARCH_MEMMOVE | ||
17 | |||
18 | extern void *memset(void *s, int c, size_t count); | ||
19 | extern void *memcpy(void *d, const void *s, size_t count); | ||
20 | extern void *memmove(void *d, const void *s, size_t count); | ||
21 | |||
22 | #endif /* __KERNEL__ */ | ||
23 | |||
24 | #endif /* _ASM_NIOS2_STRING_H */ | ||
diff --git a/arch/nios2/include/asm/switch_to.h b/arch/nios2/include/asm/switch_to.h new file mode 100644 index 000000000000..c47b3f4afbcd --- /dev/null +++ b/arch/nios2/include/asm/switch_to.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | #ifndef _ASM_NIOS2_SWITCH_TO_H | ||
9 | #define _ASM_NIOS2_SWITCH_TO_H | ||
10 | |||
11 | /* | ||
12 | * switch_to(n) should switch tasks to task ptr, first checking that | ||
13 | * ptr isn't the current task, in which case it does nothing. This | ||
14 | * also clears the TS-flag if the task we switched to has used the | ||
15 | * math co-processor latest. | ||
16 | */ | ||
17 | #define switch_to(prev, next, last) \ | ||
18 | { \ | ||
19 | void *_last; \ | ||
20 | __asm__ __volatile__ ( \ | ||
21 | "mov r4, %1\n" \ | ||
22 | "mov r5, %2\n" \ | ||
23 | "call resume\n" \ | ||
24 | "mov %0,r4\n" \ | ||
25 | : "=r" (_last) \ | ||
26 | : "r" (prev), "r" (next) \ | ||
27 | : "r4", "r5", "r7", "r8", "ra"); \ | ||
28 | (last) = _last; \ | ||
29 | } | ||
30 | |||
31 | #endif /* _ASM_NIOS2_SWITCH_TO_H */ | ||
diff --git a/arch/nios2/include/asm/syscall.h b/arch/nios2/include/asm/syscall.h new file mode 100644 index 000000000000..9de220854c4a --- /dev/null +++ b/arch/nios2/include/asm/syscall.h | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * Copyright Altera Corporation (C) <2014>. All rights reserved | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASM_NIOS2_SYSCALL_H__ | ||
18 | #define __ASM_NIOS2_SYSCALL_H__ | ||
19 | |||
20 | #include <linux/err.h> | ||
21 | #include <linux/sched.h> | ||
22 | |||
23 | static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) | ||
24 | { | ||
25 | return regs->r2; | ||
26 | } | ||
27 | |||
28 | static inline void syscall_rollback(struct task_struct *task, | ||
29 | struct pt_regs *regs) | ||
30 | { | ||
31 | regs->r2 = regs->orig_r2; | ||
32 | regs->r7 = regs->orig_r7; | ||
33 | } | ||
34 | |||
35 | static inline long syscall_get_error(struct task_struct *task, | ||
36 | struct pt_regs *regs) | ||
37 | { | ||
38 | return regs->r7 ? regs->r2 : 0; | ||
39 | } | ||
40 | |||
41 | static inline long syscall_get_return_value(struct task_struct *task, | ||
42 | struct pt_regs *regs) | ||
43 | { | ||
44 | return regs->r2; | ||
45 | } | ||
46 | |||
47 | static inline void syscall_set_return_value(struct task_struct *task, | ||
48 | struct pt_regs *regs, int error, long val) | ||
49 | { | ||
50 | if (error) { | ||
51 | /* error < 0, but nios2 uses > 0 return value */ | ||
52 | regs->r2 = -error; | ||
53 | regs->r7 = 1; | ||
54 | } else { | ||
55 | regs->r2 = val; | ||
56 | regs->r7 = 0; | ||
57 | } | ||
58 | } | ||
59 | |||
60 | static inline void syscall_get_arguments(struct task_struct *task, | ||
61 | struct pt_regs *regs, unsigned int i, unsigned int n, | ||
62 | unsigned long *args) | ||
63 | { | ||
64 | BUG_ON(i + n > 6); | ||
65 | |||
66 | switch (i) { | ||
67 | case 0: | ||
68 | if (!n--) | ||
69 | break; | ||
70 | *args++ = regs->r4; | ||
71 | case 1: | ||
72 | if (!n--) | ||
73 | break; | ||
74 | *args++ = regs->r5; | ||
75 | case 2: | ||
76 | if (!n--) | ||
77 | break; | ||
78 | *args++ = regs->r6; | ||
79 | case 3: | ||
80 | if (!n--) | ||
81 | break; | ||
82 | *args++ = regs->r7; | ||
83 | case 4: | ||
84 | if (!n--) | ||
85 | break; | ||
86 | *args++ = regs->r8; | ||
87 | case 5: | ||
88 | if (!n--) | ||
89 | break; | ||
90 | *args++ = regs->r9; | ||
91 | case 6: | ||
92 | if (!n--) | ||
93 | break; | ||
94 | default: | ||
95 | BUG(); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | static inline void syscall_set_arguments(struct task_struct *task, | ||
100 | struct pt_regs *regs, unsigned int i, unsigned int n, | ||
101 | const unsigned long *args) | ||
102 | { | ||
103 | BUG_ON(i + n > 6); | ||
104 | |||
105 | switch (i) { | ||
106 | case 0: | ||
107 | if (!n--) | ||
108 | break; | ||
109 | regs->r4 = *args++; | ||
110 | case 1: | ||
111 | if (!n--) | ||
112 | break; | ||
113 | regs->r5 = *args++; | ||
114 | case 2: | ||
115 | if (!n--) | ||
116 | break; | ||
117 | regs->r6 = *args++; | ||
118 | case 3: | ||
119 | if (!n--) | ||
120 | break; | ||
121 | regs->r7 = *args++; | ||
122 | case 4: | ||
123 | if (!n--) | ||
124 | break; | ||
125 | regs->r8 = *args++; | ||
126 | case 5: | ||
127 | if (!n--) | ||
128 | break; | ||
129 | regs->r9 = *args++; | ||
130 | case 6: | ||
131 | if (!n) | ||
132 | break; | ||
133 | default: | ||
134 | BUG(); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | #endif | ||
diff --git a/arch/nios2/include/asm/syscalls.h b/arch/nios2/include/asm/syscalls.h new file mode 100644 index 000000000000..0245d780351b --- /dev/null +++ b/arch/nios2/include/asm/syscalls.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright Altera Corporation (C) 2013. All rights reserved | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | */ | ||
17 | #ifndef __ASM_NIOS2_SYSCALLS_H | ||
18 | #define __ASM_NIOS2_SYSCALLS_H | ||
19 | |||
20 | int sys_cacheflush(unsigned long addr, unsigned long len, | ||
21 | unsigned int op); | ||
22 | |||
23 | #include <asm-generic/syscalls.h> | ||
24 | |||
25 | #endif /* __ASM_NIOS2_SYSCALLS_H */ | ||
diff --git a/arch/nios2/include/asm/thread_info.h b/arch/nios2/include/asm/thread_info.h new file mode 100644 index 000000000000..1f266575beb5 --- /dev/null +++ b/arch/nios2/include/asm/thread_info.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | * NiosII low-level thread information | ||
3 | * | ||
4 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
5 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
6 | * | ||
7 | * Based on asm/thread_info_no.h from m68k which is: | ||
8 | * | ||
9 | * Copyright (C) 2002 David Howells <dhowells@redhat.com> | ||
10 | * | ||
11 | * This file is subject to the terms and conditions of the GNU General Public | ||
12 | * License. See the file "COPYING" in the main directory of this archive | ||
13 | * for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef _ASM_NIOS2_THREAD_INFO_H | ||
17 | #define _ASM_NIOS2_THREAD_INFO_H | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | |||
21 | /* | ||
22 | * Size of the kernel stack for each process. | ||
23 | */ | ||
24 | #define THREAD_SIZE_ORDER 1 | ||
25 | #define THREAD_SIZE 8192 /* 2 * PAGE_SIZE */ | ||
26 | |||
27 | #ifndef __ASSEMBLY__ | ||
28 | |||
29 | typedef struct { | ||
30 | unsigned long seg; | ||
31 | } mm_segment_t; | ||
32 | |||
33 | /* | ||
34 | * low level task data that entry.S needs immediate access to | ||
35 | * - this struct should fit entirely inside of one cache line | ||
36 | * - this struct shares the supervisor stack pages | ||
37 | * - if the contents of this structure are changed, the assembly constants | ||
38 | * must also be changed | ||
39 | */ | ||
40 | struct thread_info { | ||
41 | struct task_struct *task; /* main task structure */ | ||
42 | struct exec_domain *exec_domain; /* execution domain */ | ||
43 | unsigned long flags; /* low level flags */ | ||
44 | __u32 cpu; /* current CPU */ | ||
45 | int preempt_count; /* 0 => preemptable,<0 => BUG */ | ||
46 | mm_segment_t addr_limit; /* thread address space: | ||
47 | 0-0x7FFFFFFF for user-thead | ||
48 | 0-0xFFFFFFFF for kernel-thread | ||
49 | */ | ||
50 | struct restart_block restart_block; | ||
51 | struct pt_regs *regs; | ||
52 | }; | ||
53 | |||
54 | /* | ||
55 | * macros/functions for gaining access to the thread information structure | ||
56 | * | ||
57 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
58 | */ | ||
59 | #define INIT_THREAD_INFO(tsk) \ | ||
60 | { \ | ||
61 | .task = &tsk, \ | ||
62 | .exec_domain = &default_exec_domain, \ | ||
63 | .flags = 0, \ | ||
64 | .cpu = 0, \ | ||
65 | .preempt_count = INIT_PREEMPT_COUNT, \ | ||
66 | .addr_limit = KERNEL_DS, \ | ||
67 | .restart_block = { \ | ||
68 | .fn = do_no_restart_syscall, \ | ||
69 | }, \ | ||
70 | } | ||
71 | |||
72 | #define init_thread_info (init_thread_union.thread_info) | ||
73 | #define init_stack (init_thread_union.stack) | ||
74 | |||
75 | /* how to get the thread information struct from C */ | ||
76 | static inline struct thread_info *current_thread_info(void) | ||
77 | { | ||
78 | register unsigned long sp asm("sp"); | ||
79 | |||
80 | return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); | ||
81 | } | ||
82 | #endif /* !__ASSEMBLY__ */ | ||
83 | |||
84 | /* | ||
85 | * thread information flags | ||
86 | * - these are process state flags that various assembly files may need to | ||
87 | * access | ||
88 | * - pending work-to-be-done flags are in LSW | ||
89 | * - other flags in MSW | ||
90 | */ | ||
91 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
92 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
93 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
94 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
95 | #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ | ||
96 | #define TIF_SECCOMP 5 /* secure computing */ | ||
97 | #define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */ | ||
98 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ | ||
99 | |||
100 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling | ||
101 | TIF_NEED_RESCHED */ | ||
102 | |||
103 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | ||
104 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | ||
105 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | ||
106 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | ||
107 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) | ||
108 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) | ||
109 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) | ||
110 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
111 | |||
112 | /* work to do on interrupt/exception return */ | ||
113 | #define _TIF_WORK_MASK 0x0000FFFE | ||
114 | |||
115 | /* work to do on any return to u-space */ | ||
116 | # define _TIF_ALLWORK_MASK 0x0000FFFF | ||
117 | |||
118 | #endif /* __KERNEL__ */ | ||
119 | |||
120 | #endif /* _ASM_NIOS2_THREAD_INFO_H */ | ||
diff --git a/arch/nios2/include/asm/timex.h b/arch/nios2/include/asm/timex.h new file mode 100644 index 000000000000..2f2abb28ec2f --- /dev/null +++ b/arch/nios2/include/asm/timex.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* Copyright Altera Corporation (C) 2014. All rights reserved. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License, version 2, | ||
5 | * as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef _ASM_NIOS2_TIMEX_H | ||
18 | #define _ASM_NIOS2_TIMEX_H | ||
19 | |||
20 | typedef unsigned long cycles_t; | ||
21 | |||
22 | extern cycles_t get_cycles(void); | ||
23 | |||
24 | #endif | ||
diff --git a/arch/nios2/include/asm/tlb.h b/arch/nios2/include/asm/tlb.h new file mode 100644 index 000000000000..d3bc648e08b5 --- /dev/null +++ b/arch/nios2/include/asm/tlb.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2009 Wind River Systems Inc | ||
4 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_NIOS2_TLB_H | ||
12 | #define _ASM_NIOS2_TLB_H | ||
13 | |||
14 | #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) | ||
15 | |||
16 | extern void set_mmu_pid(unsigned long pid); | ||
17 | |||
18 | /* | ||
19 | * NiosII doesn't need any special per-pte or per-vma handling, except | ||
20 | * we need to flush cache for the area to be unmapped. | ||
21 | */ | ||
22 | #define tlb_start_vma(tlb, vma) \ | ||
23 | do { \ | ||
24 | if (!tlb->fullmm) \ | ||
25 | flush_cache_range(vma, vma->vm_start, vma->vm_end); \ | ||
26 | } while (0) | ||
27 | |||
28 | #define tlb_end_vma(tlb, vma) do { } while (0) | ||
29 | #define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) | ||
30 | |||
31 | #include <linux/pagemap.h> | ||
32 | #include <asm-generic/tlb.h> | ||
33 | |||
34 | #endif /* _ASM_NIOS2_TLB_H */ | ||
diff --git a/arch/nios2/include/asm/tlbflush.h b/arch/nios2/include/asm/tlbflush.h new file mode 100644 index 000000000000..e19652fca1c6 --- /dev/null +++ b/arch/nios2/include/asm/tlbflush.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef _ASM_NIOS2_TLBFLUSH_H | ||
20 | #define _ASM_NIOS2_TLBFLUSH_H | ||
21 | |||
22 | struct mm_struct; | ||
23 | |||
24 | /* | ||
25 | * TLB flushing: | ||
26 | * | ||
27 | * - flush_tlb_all() flushes all processes TLB entries | ||
28 | * - flush_tlb_mm(mm) flushes the specified mm context TLB entries | ||
29 | * - flush_tlb_page(vma, vmaddr) flushes one page | ||
30 | * - flush_tlb_range(vma, start, end) flushes a range of pages | ||
31 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | ||
32 | */ | ||
33 | extern void flush_tlb_all(void); | ||
34 | extern void flush_tlb_mm(struct mm_struct *mm); | ||
35 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | ||
36 | unsigned long end); | ||
37 | extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); | ||
38 | extern void flush_tlb_one(unsigned long vaddr); | ||
39 | |||
40 | static inline void flush_tlb_page(struct vm_area_struct *vma, | ||
41 | unsigned long addr) | ||
42 | { | ||
43 | flush_tlb_one(addr); | ||
44 | } | ||
45 | |||
46 | #endif /* _ASM_NIOS2_TLBFLUSH_H */ | ||
diff --git a/arch/nios2/include/asm/traps.h b/arch/nios2/include/asm/traps.h new file mode 100644 index 000000000000..82a48473280d --- /dev/null +++ b/arch/nios2/include/asm/traps.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_TRAPS_H | ||
11 | #define _ASM_NIOS2_TRAPS_H | ||
12 | |||
13 | #define TRAP_ID_SYSCALL 0 | ||
14 | |||
15 | #ifndef __ASSEMBLY__ | ||
16 | void _exception(int signo, struct pt_regs *regs, int code, unsigned long addr); | ||
17 | #endif | ||
18 | |||
19 | #endif /* _ASM_NIOS2_TRAPS_H */ | ||
diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h new file mode 100644 index 000000000000..acedc0a2860e --- /dev/null +++ b/arch/nios2/include/asm/uaccess.h | |||
@@ -0,0 +1,231 @@ | |||
1 | /* | ||
2 | * User space memory access functions for Nios II | ||
3 | * | ||
4 | * Copyright (C) 2010-2011, Tobias Klauser <tklauser@distanz.ch> | ||
5 | * Copyright (C) 2009, Wind River Systems Inc | ||
6 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | |||
13 | #ifndef _ASM_NIOS2_UACCESS_H | ||
14 | #define _ASM_NIOS2_UACCESS_H | ||
15 | |||
16 | #include <linux/errno.h> | ||
17 | #include <linux/thread_info.h> | ||
18 | #include <linux/string.h> | ||
19 | |||
20 | #include <asm/page.h> | ||
21 | |||
22 | #define VERIFY_READ 0 | ||
23 | #define VERIFY_WRITE 1 | ||
24 | |||
25 | /* | ||
26 | * The exception table consists of pairs of addresses: the first is the | ||
27 | * address of an instruction that is allowed to fault, and the second is | ||
28 | * the address at which the program should continue. No registers are | ||
29 | * modified, so it is entirely up to the continuation code to figure out | ||
30 | * what to do. | ||
31 | * | ||
32 | * All the routines below use bits of fixup code that are out of line | ||
33 | * with the main instruction path. This means when everything is well, | ||
34 | * we don't even have to jump over them. Further, they do not intrude | ||
35 | * on our cache or tlb entries. | ||
36 | */ | ||
37 | struct exception_table_entry { | ||
38 | unsigned long insn; | ||
39 | unsigned long fixup; | ||
40 | }; | ||
41 | |||
42 | extern int fixup_exception(struct pt_regs *regs); | ||
43 | |||
44 | /* | ||
45 | * Segment stuff | ||
46 | */ | ||
47 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | ||
48 | #define USER_DS MAKE_MM_SEG(0x80000000UL) | ||
49 | #define KERNEL_DS MAKE_MM_SEG(0) | ||
50 | |||
51 | #define get_ds() (KERNEL_DS) | ||
52 | |||
53 | #define get_fs() (current_thread_info()->addr_limit) | ||
54 | #define set_fs(seg) (current_thread_info()->addr_limit = (seg)) | ||
55 | |||
56 | #define segment_eq(a, b) ((a).seg == (b).seg) | ||
57 | |||
58 | #define __access_ok(addr, len) \ | ||
59 | (((signed long)(((long)get_fs().seg) & \ | ||
60 | ((long)(addr) | (((long)(addr)) + (len)) | (len)))) == 0) | ||
61 | |||
62 | #define access_ok(type, addr, len) \ | ||
63 | likely(__access_ok((unsigned long)(addr), (unsigned long)(len))) | ||
64 | |||
65 | # define __EX_TABLE_SECTION ".section __ex_table,\"a\"\n" | ||
66 | |||
67 | /* | ||
68 | * Zero Userspace | ||
69 | */ | ||
70 | |||
71 | static inline unsigned long __must_check __clear_user(void __user *to, | ||
72 | unsigned long n) | ||
73 | { | ||
74 | __asm__ __volatile__ ( | ||
75 | "1: stb zero, 0(%1)\n" | ||
76 | " addi %0, %0, -1\n" | ||
77 | " addi %1, %1, 1\n" | ||
78 | " bne %0, zero, 1b\n" | ||
79 | "2:\n" | ||
80 | __EX_TABLE_SECTION | ||
81 | ".word 1b, 2b\n" | ||
82 | ".previous\n" | ||
83 | : "=r" (n), "=r" (to) | ||
84 | : "0" (n), "1" (to) | ||
85 | ); | ||
86 | |||
87 | return n; | ||
88 | } | ||
89 | |||
90 | static inline unsigned long __must_check clear_user(void __user *to, | ||
91 | unsigned long n) | ||
92 | { | ||
93 | if (!access_ok(VERIFY_WRITE, to, n)) | ||
94 | return n; | ||
95 | return __clear_user(to, n); | ||
96 | } | ||
97 | |||
98 | extern long __copy_from_user(void *to, const void __user *from, | ||
99 | unsigned long n); | ||
100 | extern long __copy_to_user(void __user *to, const void *from, unsigned long n); | ||
101 | |||
102 | static inline long copy_from_user(void *to, const void __user *from, | ||
103 | unsigned long n) | ||
104 | { | ||
105 | if (!access_ok(VERIFY_READ, from, n)) | ||
106 | return n; | ||
107 | return __copy_from_user(to, from, n); | ||
108 | } | ||
109 | |||
110 | static inline long copy_to_user(void __user *to, const void *from, | ||
111 | unsigned long n) | ||
112 | { | ||
113 | if (!access_ok(VERIFY_WRITE, to, n)) | ||
114 | return n; | ||
115 | return __copy_to_user(to, from, n); | ||
116 | } | ||
117 | |||
118 | extern long strncpy_from_user(char *__to, const char __user *__from, | ||
119 | long __len); | ||
120 | extern long strnlen_user(const char __user *s, long n); | ||
121 | |||
122 | #define __copy_from_user_inatomic __copy_from_user | ||
123 | #define __copy_to_user_inatomic __copy_to_user | ||
124 | |||
125 | /* Optimized macros */ | ||
126 | #define __get_user_asm(val, insn, addr, err) \ | ||
127 | { \ | ||
128 | __asm__ __volatile__( \ | ||
129 | " movi %0, %3\n" \ | ||
130 | "1: " insn " %1, 0(%2)\n" \ | ||
131 | " movi %0, 0\n" \ | ||
132 | "2:\n" \ | ||
133 | " .section __ex_table,\"a\"\n" \ | ||
134 | " .word 1b, 2b\n" \ | ||
135 | " .previous" \ | ||
136 | : "=&r" (err), "=r" (val) \ | ||
137 | : "r" (addr), "i" (-EFAULT)); \ | ||
138 | } | ||
139 | |||
140 | #define __get_user_unknown(val, size, ptr, err) do { \ | ||
141 | err = 0; \ | ||
142 | if (copy_from_user(&(val), ptr, size)) { \ | ||
143 | err = -EFAULT; \ | ||
144 | } \ | ||
145 | } while (0) | ||
146 | |||
147 | #define __get_user_common(val, size, ptr, err) \ | ||
148 | do { \ | ||
149 | switch (size) { \ | ||
150 | case 1: \ | ||
151 | __get_user_asm(val, "ldbu", ptr, err); \ | ||
152 | break; \ | ||
153 | case 2: \ | ||
154 | __get_user_asm(val, "ldhu", ptr, err); \ | ||
155 | break; \ | ||
156 | case 4: \ | ||
157 | __get_user_asm(val, "ldw", ptr, err); \ | ||
158 | break; \ | ||
159 | default: \ | ||
160 | __get_user_unknown(val, size, ptr, err); \ | ||
161 | break; \ | ||
162 | } \ | ||
163 | } while (0) | ||
164 | |||
165 | #define __get_user(x, ptr) \ | ||
166 | ({ \ | ||
167 | long __gu_err = -EFAULT; \ | ||
168 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ | ||
169 | unsigned long __gu_val; \ | ||
170 | __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ | ||
171 | (x) = (__typeof__(x))__gu_val; \ | ||
172 | __gu_err; \ | ||
173 | }) | ||
174 | |||
175 | #define get_user(x, ptr) \ | ||
176 | ({ \ | ||
177 | long __gu_err = -EFAULT; \ | ||
178 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ | ||
179 | unsigned long __gu_val = 0; \ | ||
180 | if (access_ok(VERIFY_READ, __gu_ptr, sizeof(*__gu_ptr))) \ | ||
181 | __get_user_common(__gu_val, sizeof(*__gu_ptr), \ | ||
182 | __gu_ptr, __gu_err); \ | ||
183 | (x) = (__typeof__(x))__gu_val; \ | ||
184 | __gu_err; \ | ||
185 | }) | ||
186 | |||
187 | #define __put_user_asm(val, insn, ptr, err) \ | ||
188 | { \ | ||
189 | __asm__ __volatile__( \ | ||
190 | " movi %0, %3\n" \ | ||
191 | "1: " insn " %1, 0(%2)\n" \ | ||
192 | " movi %0, 0\n" \ | ||
193 | "2:\n" \ | ||
194 | " .section __ex_table,\"a\"\n" \ | ||
195 | " .word 1b, 2b\n" \ | ||
196 | " .previous\n" \ | ||
197 | : "=&r" (err) \ | ||
198 | : "r" (val), "r" (ptr), "i" (-EFAULT)); \ | ||
199 | } | ||
200 | |||
201 | #define put_user(x, ptr) \ | ||
202 | ({ \ | ||
203 | long __pu_err = -EFAULT; \ | ||
204 | __typeof__(*(ptr)) __user *__pu_ptr = (ptr); \ | ||
205 | __typeof__(*(ptr)) __pu_val = (__typeof(*ptr))(x); \ | ||
206 | if (access_ok(VERIFY_WRITE, __pu_ptr, sizeof(*__pu_ptr))) { \ | ||
207 | switch (sizeof(*__pu_ptr)) { \ | ||
208 | case 1: \ | ||
209 | __put_user_asm(__pu_val, "stb", __pu_ptr, __pu_err); \ | ||
210 | break; \ | ||
211 | case 2: \ | ||
212 | __put_user_asm(__pu_val, "sth", __pu_ptr, __pu_err); \ | ||
213 | break; \ | ||
214 | case 4: \ | ||
215 | __put_user_asm(__pu_val, "stw", __pu_ptr, __pu_err); \ | ||
216 | break; \ | ||
217 | default: \ | ||
218 | /* XXX: This looks wrong... */ \ | ||
219 | __pu_err = 0; \ | ||
220 | if (copy_to_user(__pu_ptr, &(__pu_val), \ | ||
221 | sizeof(*__pu_ptr))) \ | ||
222 | __pu_err = -EFAULT; \ | ||
223 | break; \ | ||
224 | } \ | ||
225 | } \ | ||
226 | __pu_err; \ | ||
227 | }) | ||
228 | |||
229 | #define __put_user(x, ptr) put_user(x, ptr) | ||
230 | |||
231 | #endif /* _ASM_NIOS2_UACCESS_H */ | ||
diff --git a/arch/nios2/include/asm/ucontext.h b/arch/nios2/include/asm/ucontext.h new file mode 100644 index 000000000000..2c87614b0f6e --- /dev/null +++ b/arch/nios2/include/asm/ucontext.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_UCONTEXT_H | ||
11 | #define _ASM_NIOS2_UCONTEXT_H | ||
12 | |||
13 | typedef int greg_t; | ||
14 | #define NGREG 32 | ||
15 | typedef greg_t gregset_t[NGREG]; | ||
16 | |||
17 | struct mcontext { | ||
18 | int version; | ||
19 | gregset_t gregs; | ||
20 | }; | ||
21 | |||
22 | #define MCONTEXT_VERSION 2 | ||
23 | |||
24 | struct ucontext { | ||
25 | unsigned long uc_flags; | ||
26 | struct ucontext *uc_link; | ||
27 | stack_t uc_stack; | ||
28 | struct mcontext uc_mcontext; | ||
29 | sigset_t uc_sigmask; /* mask last for extensibility */ | ||
30 | }; | ||
31 | |||
32 | #endif | ||
diff --git a/arch/nios2/include/uapi/asm/Kbuild b/arch/nios2/include/uapi/asm/Kbuild new file mode 100644 index 000000000000..4f07ca3f8d10 --- /dev/null +++ b/arch/nios2/include/uapi/asm/Kbuild | |||
@@ -0,0 +1,4 @@ | |||
1 | include include/uapi/asm-generic/Kbuild.asm | ||
2 | |||
3 | header-y += elf.h | ||
4 | header-y += ucontext.h | ||
diff --git a/arch/nios2/include/uapi/asm/byteorder.h b/arch/nios2/include/uapi/asm/byteorder.h new file mode 100644 index 000000000000..3ab5dc20d757 --- /dev/null +++ b/arch/nios2/include/uapi/asm/byteorder.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef _ASM_NIOS2_BYTEORDER_H | ||
18 | #define _ASM_NIOS2_BYTEORDER_H | ||
19 | |||
20 | #include <linux/byteorder/little_endian.h> | ||
21 | |||
22 | #endif | ||
diff --git a/arch/nios2/include/uapi/asm/elf.h b/arch/nios2/include/uapi/asm/elf.h new file mode 100644 index 000000000000..a5b91ae5cf56 --- /dev/null +++ b/arch/nios2/include/uapi/asm/elf.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | |||
20 | #ifndef _UAPI_ASM_NIOS2_ELF_H | ||
21 | #define _UAPI_ASM_NIOS2_ELF_H | ||
22 | |||
23 | #include <linux/ptrace.h> | ||
24 | |||
25 | /* Relocation types */ | ||
26 | #define R_NIOS2_NONE 0 | ||
27 | #define R_NIOS2_S16 1 | ||
28 | #define R_NIOS2_U16 2 | ||
29 | #define R_NIOS2_PCREL16 3 | ||
30 | #define R_NIOS2_CALL26 4 | ||
31 | #define R_NIOS2_IMM5 5 | ||
32 | #define R_NIOS2_CACHE_OPX 6 | ||
33 | #define R_NIOS2_IMM6 7 | ||
34 | #define R_NIOS2_IMM8 8 | ||
35 | #define R_NIOS2_HI16 9 | ||
36 | #define R_NIOS2_LO16 10 | ||
37 | #define R_NIOS2_HIADJ16 11 | ||
38 | #define R_NIOS2_BFD_RELOC_32 12 | ||
39 | #define R_NIOS2_BFD_RELOC_16 13 | ||
40 | #define R_NIOS2_BFD_RELOC_8 14 | ||
41 | #define R_NIOS2_GPREL 15 | ||
42 | #define R_NIOS2_GNU_VTINHERIT 16 | ||
43 | #define R_NIOS2_GNU_VTENTRY 17 | ||
44 | #define R_NIOS2_UJMP 18 | ||
45 | #define R_NIOS2_CJMP 19 | ||
46 | #define R_NIOS2_CALLR 20 | ||
47 | #define R_NIOS2_ALIGN 21 | ||
48 | /* Keep this the last entry. */ | ||
49 | #define R_NIOS2_NUM 22 | ||
50 | |||
51 | typedef unsigned long elf_greg_t; | ||
52 | |||
53 | #define ELF_NGREG \ | ||
54 | ((sizeof(struct pt_regs) + sizeof(struct switch_stack)) / \ | ||
55 | sizeof(elf_greg_t)) | ||
56 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
57 | |||
58 | typedef unsigned long elf_fpregset_t; | ||
59 | |||
60 | /* | ||
61 | * These are used to set parameters in the core dumps. | ||
62 | */ | ||
63 | #define ELF_CLASS ELFCLASS32 | ||
64 | #define ELF_DATA ELFDATA2LSB | ||
65 | #define ELF_ARCH EM_ALTERA_NIOS2 | ||
66 | |||
67 | #endif /* _UAPI_ASM_NIOS2_ELF_H */ | ||
diff --git a/arch/nios2/include/uapi/asm/ptrace.h b/arch/nios2/include/uapi/asm/ptrace.h new file mode 100644 index 000000000000..e83a7c9d1c36 --- /dev/null +++ b/arch/nios2/include/uapi/asm/ptrace.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
4 | * | ||
5 | * based on m68k asm/processor.h | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | |||
12 | #ifndef _UAPI_ASM_NIOS2_PTRACE_H | ||
13 | #define _UAPI_ASM_NIOS2_PTRACE_H | ||
14 | |||
15 | #ifndef __ASSEMBLY__ | ||
16 | |||
17 | /* | ||
18 | * Register numbers used by 'ptrace' system call interface. | ||
19 | */ | ||
20 | |||
21 | /* GP registers */ | ||
22 | #define PTR_R0 0 | ||
23 | #define PTR_R1 1 | ||
24 | #define PTR_R2 2 | ||
25 | #define PTR_R3 3 | ||
26 | #define PTR_R4 4 | ||
27 | #define PTR_R5 5 | ||
28 | #define PTR_R6 6 | ||
29 | #define PTR_R7 7 | ||
30 | #define PTR_R8 8 | ||
31 | #define PTR_R9 9 | ||
32 | #define PTR_R10 10 | ||
33 | #define PTR_R11 11 | ||
34 | #define PTR_R12 12 | ||
35 | #define PTR_R13 13 | ||
36 | #define PTR_R14 14 | ||
37 | #define PTR_R15 15 | ||
38 | #define PTR_R16 16 | ||
39 | #define PTR_R17 17 | ||
40 | #define PTR_R18 18 | ||
41 | #define PTR_R19 19 | ||
42 | #define PTR_R20 20 | ||
43 | #define PTR_R21 21 | ||
44 | #define PTR_R22 22 | ||
45 | #define PTR_R23 23 | ||
46 | #define PTR_R24 24 | ||
47 | #define PTR_R25 25 | ||
48 | #define PTR_GP 26 | ||
49 | #define PTR_SP 27 | ||
50 | #define PTR_FP 28 | ||
51 | #define PTR_EA 29 | ||
52 | #define PTR_BA 30 | ||
53 | #define PTR_RA 31 | ||
54 | /* Control registers */ | ||
55 | #define PTR_PC 32 | ||
56 | #define PTR_STATUS 33 | ||
57 | #define PTR_ESTATUS 34 | ||
58 | #define PTR_BSTATUS 35 | ||
59 | #define PTR_IENABLE 36 | ||
60 | #define PTR_IPENDING 37 | ||
61 | #define PTR_CPUID 38 | ||
62 | #define PTR_CTL6 39 | ||
63 | #define PTR_CTL7 40 | ||
64 | #define PTR_PTEADDR 41 | ||
65 | #define PTR_TLBACC 42 | ||
66 | #define PTR_TLBMISC 43 | ||
67 | |||
68 | #define NUM_PTRACE_REG (PTR_TLBMISC + 1) | ||
69 | |||
70 | /* this struct defines the way the registers are stored on the | ||
71 | stack during a system call. | ||
72 | |||
73 | There is a fake_regs in setup.c that has to match pt_regs.*/ | ||
74 | |||
75 | struct pt_regs { | ||
76 | unsigned long r8; /* r8-r15 Caller-saved GP registers */ | ||
77 | unsigned long r9; | ||
78 | unsigned long r10; | ||
79 | unsigned long r11; | ||
80 | unsigned long r12; | ||
81 | unsigned long r13; | ||
82 | unsigned long r14; | ||
83 | unsigned long r15; | ||
84 | unsigned long r1; /* Assembler temporary */ | ||
85 | unsigned long r2; /* Retval LS 32bits */ | ||
86 | unsigned long r3; /* Retval MS 32bits */ | ||
87 | unsigned long r4; /* r4-r7 Register arguments */ | ||
88 | unsigned long r5; | ||
89 | unsigned long r6; | ||
90 | unsigned long r7; | ||
91 | unsigned long orig_r2; /* Copy of r2 ?? */ | ||
92 | unsigned long ra; /* Return address */ | ||
93 | unsigned long fp; /* Frame pointer */ | ||
94 | unsigned long sp; /* Stack pointer */ | ||
95 | unsigned long gp; /* Global pointer */ | ||
96 | unsigned long estatus; | ||
97 | unsigned long ea; /* Exception return address (pc) */ | ||
98 | unsigned long orig_r7; | ||
99 | }; | ||
100 | |||
101 | /* | ||
102 | * This is the extended stack used by signal handlers and the context | ||
103 | * switcher: it's pushed after the normal "struct pt_regs". | ||
104 | */ | ||
105 | struct switch_stack { | ||
106 | unsigned long r16; /* r16-r23 Callee-saved GP registers */ | ||
107 | unsigned long r17; | ||
108 | unsigned long r18; | ||
109 | unsigned long r19; | ||
110 | unsigned long r20; | ||
111 | unsigned long r21; | ||
112 | unsigned long r22; | ||
113 | unsigned long r23; | ||
114 | unsigned long fp; | ||
115 | unsigned long gp; | ||
116 | unsigned long ra; | ||
117 | }; | ||
118 | |||
119 | #endif /* __ASSEMBLY__ */ | ||
120 | #endif /* _UAPI_ASM_NIOS2_PTRACE_H */ | ||
diff --git a/arch/nios2/include/uapi/asm/sigcontext.h b/arch/nios2/include/uapi/asm/sigcontext.h new file mode 100644 index 000000000000..7b8bb41867d4 --- /dev/null +++ b/arch/nios2/include/uapi/asm/sigcontext.h | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, Microtronix Datacom Ltd. | ||
3 | * | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
14 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
15 | * details. | ||
16 | */ | ||
17 | |||
18 | #ifndef _ASM_NIOS2_SIGCONTEXT_H | ||
19 | #define _ASM_NIOS2_SIGCONTEXT_H | ||
20 | |||
21 | #include <asm/ptrace.h> | ||
22 | |||
23 | struct sigcontext { | ||
24 | struct pt_regs regs; | ||
25 | unsigned long sc_mask; /* old sigmask */ | ||
26 | }; | ||
27 | |||
28 | #endif | ||
diff --git a/arch/nios2/include/uapi/asm/signal.h b/arch/nios2/include/uapi/asm/signal.h new file mode 100644 index 000000000000..f29ee6314481 --- /dev/null +++ b/arch/nios2/include/uapi/asm/signal.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Copyright Altera Corporation (C) 2013. All rights reserved | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | */ | ||
17 | #ifndef _ASM_NIOS2_SIGNAL_H | ||
18 | #define _ASM_NIOS2_SIGNAL_H | ||
19 | |||
20 | #define SA_RESTORER 0x04000000 | ||
21 | #include <asm-generic/signal.h> | ||
22 | |||
23 | #endif /* _ASM_NIOS2_SIGNAL_H */ | ||
diff --git a/arch/nios2/include/uapi/asm/swab.h b/arch/nios2/include/uapi/asm/swab.h new file mode 100644 index 000000000000..b4e22ebaeb17 --- /dev/null +++ b/arch/nios2/include/uapi/asm/swab.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2011 Pyramid Technical Consultants, Inc. | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General | ||
6 | * Public License. See the file COPYING in the main directory of this | ||
7 | * archive for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_NIOS2_SWAB_H | ||
11 | #define _ASM_NIOS2_SWAB_H | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <asm-generic/swab.h> | ||
15 | |||
16 | #ifdef CONFIG_NIOS2_CI_SWAB_SUPPORT | ||
17 | #ifdef __GNUC__ | ||
18 | |||
19 | #define __nios2_swab(x) \ | ||
20 | __builtin_custom_ini(CONFIG_NIOS2_CI_SWAB_NO, (x)) | ||
21 | |||
22 | static inline __attribute__((const)) __u16 __arch_swab16(__u16 x) | ||
23 | { | ||
24 | return (__u16) __nios2_swab(((__u32) x) << 16); | ||
25 | } | ||
26 | #define __arch_swab16 __arch_swab16 | ||
27 | |||
28 | static inline __attribute__((const)) __u32 __arch_swab32(__u32 x) | ||
29 | { | ||
30 | return (__u32) __nios2_swab(x); | ||
31 | } | ||
32 | #define __arch_swab32 __arch_swab32 | ||
33 | |||
34 | #endif /* __GNUC__ */ | ||
35 | #endif /* CONFIG_NIOS2_CI_SWAB_SUPPORT */ | ||
36 | |||
37 | #endif /* _ASM_NIOS2_SWAB_H */ | ||
diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..c4bf79510461 --- /dev/null +++ b/arch/nios2/include/uapi/asm/unistd.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #define sys_mmap2 sys_mmap_pgoff | ||
19 | |||
20 | /* Use the standard ABI for syscalls */ | ||
21 | #include <asm-generic/unistd.h> | ||
22 | |||
23 | /* Additional Nios II specific syscalls. */ | ||
24 | #define __NR_cacheflush (__NR_arch_specific_syscall) | ||
25 | __SYSCALL(__NR_cacheflush, sys_cacheflush) | ||
diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile new file mode 100644 index 000000000000..8ae76823ff93 --- /dev/null +++ b/arch/nios2/kernel/Makefile | |||
@@ -0,0 +1,24 @@ | |||
1 | # | ||
2 | # Makefile for the nios2 linux kernel. | ||
3 | # | ||
4 | |||
5 | extra-y += head.o | ||
6 | extra-y += vmlinux.lds | ||
7 | |||
8 | obj-y += cpuinfo.o | ||
9 | obj-y += entry.o | ||
10 | obj-y += insnemu.o | ||
11 | obj-y += irq.o | ||
12 | obj-y += nios2_ksyms.o | ||
13 | obj-y += process.o | ||
14 | obj-y += prom.o | ||
15 | obj-y += ptrace.o | ||
16 | obj-y += setup.o | ||
17 | obj-y += signal.o | ||
18 | obj-y += sys_nios2.o | ||
19 | obj-y += syscall_table.o | ||
20 | obj-y += time.o | ||
21 | obj-y += traps.o | ||
22 | |||
23 | obj-$(CONFIG_MODULES) += module.o | ||
24 | obj-$(CONFIG_NIOS2_ALIGNMENT_TRAP) += misaligned.o | ||
diff --git a/arch/nios2/kernel/asm-offsets.c b/arch/nios2/kernel/asm-offsets.c new file mode 100644 index 000000000000..c3ee73c18b71 --- /dev/null +++ b/arch/nios2/kernel/asm-offsets.c | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #include <linux/stddef.h> | ||
20 | #include <linux/sched.h> | ||
21 | #include <linux/kernel_stat.h> | ||
22 | #include <linux/ptrace.h> | ||
23 | #include <linux/hardirq.h> | ||
24 | #include <linux/thread_info.h> | ||
25 | #include <linux/kbuild.h> | ||
26 | |||
27 | int main(void) | ||
28 | { | ||
29 | /* struct task_struct */ | ||
30 | OFFSET(TASK_THREAD, task_struct, thread); | ||
31 | BLANK(); | ||
32 | |||
33 | /* struct thread_struct */ | ||
34 | OFFSET(THREAD_KSP, thread_struct, ksp); | ||
35 | OFFSET(THREAD_KPSR, thread_struct, kpsr); | ||
36 | BLANK(); | ||
37 | |||
38 | /* struct pt_regs */ | ||
39 | OFFSET(PT_ORIG_R2, pt_regs, orig_r2); | ||
40 | OFFSET(PT_ORIG_R7, pt_regs, orig_r7); | ||
41 | |||
42 | OFFSET(PT_R1, pt_regs, r1); | ||
43 | OFFSET(PT_R2, pt_regs, r2); | ||
44 | OFFSET(PT_R3, pt_regs, r3); | ||
45 | OFFSET(PT_R4, pt_regs, r4); | ||
46 | OFFSET(PT_R5, pt_regs, r5); | ||
47 | OFFSET(PT_R6, pt_regs, r6); | ||
48 | OFFSET(PT_R7, pt_regs, r7); | ||
49 | OFFSET(PT_R8, pt_regs, r8); | ||
50 | OFFSET(PT_R9, pt_regs, r9); | ||
51 | OFFSET(PT_R10, pt_regs, r10); | ||
52 | OFFSET(PT_R11, pt_regs, r11); | ||
53 | OFFSET(PT_R12, pt_regs, r12); | ||
54 | OFFSET(PT_R13, pt_regs, r13); | ||
55 | OFFSET(PT_R14, pt_regs, r14); | ||
56 | OFFSET(PT_R15, pt_regs, r15); | ||
57 | OFFSET(PT_EA, pt_regs, ea); | ||
58 | OFFSET(PT_RA, pt_regs, ra); | ||
59 | OFFSET(PT_FP, pt_regs, fp); | ||
60 | OFFSET(PT_SP, pt_regs, sp); | ||
61 | OFFSET(PT_GP, pt_regs, gp); | ||
62 | OFFSET(PT_ESTATUS, pt_regs, estatus); | ||
63 | DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs)); | ||
64 | BLANK(); | ||
65 | |||
66 | /* struct switch_stack */ | ||
67 | OFFSET(SW_R16, switch_stack, r16); | ||
68 | OFFSET(SW_R17, switch_stack, r17); | ||
69 | OFFSET(SW_R18, switch_stack, r18); | ||
70 | OFFSET(SW_R19, switch_stack, r19); | ||
71 | OFFSET(SW_R20, switch_stack, r20); | ||
72 | OFFSET(SW_R21, switch_stack, r21); | ||
73 | OFFSET(SW_R22, switch_stack, r22); | ||
74 | OFFSET(SW_R23, switch_stack, r23); | ||
75 | OFFSET(SW_FP, switch_stack, fp); | ||
76 | OFFSET(SW_GP, switch_stack, gp); | ||
77 | OFFSET(SW_RA, switch_stack, ra); | ||
78 | DEFINE(SWITCH_STACK_SIZE, sizeof(struct switch_stack)); | ||
79 | BLANK(); | ||
80 | |||
81 | /* struct thread_info */ | ||
82 | OFFSET(TI_FLAGS, thread_info, flags); | ||
83 | OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count); | ||
84 | BLANK(); | ||
85 | |||
86 | return 0; | ||
87 | } | ||
diff --git a/arch/nios2/kernel/cpuinfo.c b/arch/nios2/kernel/cpuinfo.c new file mode 100644 index 000000000000..51d5bb90d3e5 --- /dev/null +++ b/arch/nios2/kernel/cpuinfo.c | |||
@@ -0,0 +1,197 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * | ||
5 | * Based on cpuinfo.c from microblaze | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/delay.h> | ||
25 | #include <linux/seq_file.h> | ||
26 | #include <linux/string.h> | ||
27 | #include <linux/of.h> | ||
28 | #include <asm/cpuinfo.h> | ||
29 | |||
30 | struct cpuinfo cpuinfo; | ||
31 | |||
32 | #define err_cpu(x) \ | ||
33 | pr_err("ERROR: Nios II " x " different for kernel and DTS\n") | ||
34 | |||
35 | static inline u32 fcpu(struct device_node *cpu, const char *n) | ||
36 | { | ||
37 | u32 val = 0; | ||
38 | |||
39 | of_property_read_u32(cpu, n, &val); | ||
40 | |||
41 | return val; | ||
42 | } | ||
43 | |||
44 | static inline u32 fcpu_has(struct device_node *cpu, const char *n) | ||
45 | { | ||
46 | return of_get_property(cpu, n, NULL) ? 1 : 0; | ||
47 | } | ||
48 | |||
49 | void __init setup_cpuinfo(void) | ||
50 | { | ||
51 | struct device_node *cpu; | ||
52 | const char *str; | ||
53 | int len; | ||
54 | |||
55 | cpu = of_find_node_by_type(NULL, "cpu"); | ||
56 | if (!cpu) | ||
57 | panic("%s: No CPU found in devicetree!\n", __func__); | ||
58 | |||
59 | if (!fcpu_has(cpu, "altr,has-initda")) | ||
60 | panic("initda instruction is unimplemented. Please update your " | ||
61 | "hardware system to have more than 4-byte line data " | ||
62 | "cache\n"); | ||
63 | |||
64 | cpuinfo.cpu_clock_freq = fcpu(cpu, "clock-frequency"); | ||
65 | |||
66 | str = of_get_property(cpu, "altr,implementation", &len); | ||
67 | if (str) | ||
68 | strlcpy(cpuinfo.cpu_impl, str, sizeof(cpuinfo.cpu_impl)); | ||
69 | else | ||
70 | strcpy(cpuinfo.cpu_impl, "<unknown>"); | ||
71 | |||
72 | cpuinfo.has_div = fcpu_has(cpu, "altr,has-div"); | ||
73 | cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul"); | ||
74 | cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx"); | ||
75 | |||
76 | if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div) | ||
77 | err_cpu("DIV"); | ||
78 | |||
79 | if (IS_ENABLED(CONFIG_NIOS2_HW_MUL_SUPPORT) && !cpuinfo.has_mul) | ||
80 | err_cpu("MUL"); | ||
81 | |||
82 | if (IS_ENABLED(CONFIG_NIOS2_HW_MULX_SUPPORT) && !cpuinfo.has_mulx) | ||
83 | err_cpu("MULX"); | ||
84 | |||
85 | cpuinfo.tlb_num_ways = fcpu(cpu, "altr,tlb-num-ways"); | ||
86 | if (!cpuinfo.tlb_num_ways) | ||
87 | panic("altr,tlb-num-ways can't be 0. Please check your hardware " | ||
88 | "system\n"); | ||
89 | cpuinfo.icache_line_size = fcpu(cpu, "icache-line-size"); | ||
90 | cpuinfo.icache_size = fcpu(cpu, "icache-size"); | ||
91 | if (CONFIG_NIOS2_ICACHE_SIZE != cpuinfo.icache_size) | ||
92 | pr_warn("Warning: icache size configuration mismatch " | ||
93 | "(0x%x vs 0x%x) of CONFIG_NIOS2_ICACHE_SIZE vs " | ||
94 | "device tree icache-size\n", | ||
95 | CONFIG_NIOS2_ICACHE_SIZE, cpuinfo.icache_size); | ||
96 | |||
97 | cpuinfo.dcache_line_size = fcpu(cpu, "dcache-line-size"); | ||
98 | if (CONFIG_NIOS2_DCACHE_LINE_SIZE != cpuinfo.dcache_line_size) | ||
99 | pr_warn("Warning: dcache line size configuration mismatch " | ||
100 | "(0x%x vs 0x%x) of CONFIG_NIOS2_DCACHE_LINE_SIZE vs " | ||
101 | "device tree dcache-line-size\n", | ||
102 | CONFIG_NIOS2_DCACHE_LINE_SIZE, cpuinfo.dcache_line_size); | ||
103 | cpuinfo.dcache_size = fcpu(cpu, "dcache-size"); | ||
104 | if (CONFIG_NIOS2_DCACHE_SIZE != cpuinfo.dcache_size) | ||
105 | pr_warn("Warning: dcache size configuration mismatch " | ||
106 | "(0x%x vs 0x%x) of CONFIG_NIOS2_DCACHE_SIZE vs " | ||
107 | "device tree dcache-size\n", | ||
108 | CONFIG_NIOS2_DCACHE_SIZE, cpuinfo.dcache_size); | ||
109 | |||
110 | cpuinfo.tlb_pid_num_bits = fcpu(cpu, "altr,pid-num-bits"); | ||
111 | cpuinfo.tlb_num_ways_log2 = ilog2(cpuinfo.tlb_num_ways); | ||
112 | cpuinfo.tlb_num_entries = fcpu(cpu, "altr,tlb-num-entries"); | ||
113 | cpuinfo.tlb_num_lines = cpuinfo.tlb_num_entries / cpuinfo.tlb_num_ways; | ||
114 | cpuinfo.tlb_ptr_sz = fcpu(cpu, "altr,tlb-ptr-sz"); | ||
115 | |||
116 | cpuinfo.reset_addr = fcpu(cpu, "altr,reset-addr"); | ||
117 | cpuinfo.exception_addr = fcpu(cpu, "altr,exception-addr"); | ||
118 | cpuinfo.fast_tlb_miss_exc_addr = fcpu(cpu, "altr,fast-tlb-miss-addr"); | ||
119 | } | ||
120 | |||
121 | #ifdef CONFIG_PROC_FS | ||
122 | |||
123 | /* | ||
124 | * Get CPU information for use by the procfs. | ||
125 | */ | ||
126 | static int show_cpuinfo(struct seq_file *m, void *v) | ||
127 | { | ||
128 | int count = 0; | ||
129 | const u32 clockfreq = cpuinfo.cpu_clock_freq; | ||
130 | |||
131 | count = seq_printf(m, | ||
132 | "CPU:\t\tNios II/%s\n" | ||
133 | "MMU:\t\t%s\n" | ||
134 | "FPU:\t\tnone\n" | ||
135 | "Clocking:\t%u.%02u MHz\n" | ||
136 | "BogoMips:\t%lu.%02lu\n" | ||
137 | "Calibration:\t%lu loops\n", | ||
138 | cpuinfo.cpu_impl, | ||
139 | cpuinfo.mmu ? "present" : "none", | ||
140 | clockfreq / 1000000, (clockfreq / 100000) % 10, | ||
141 | (loops_per_jiffy * HZ) / 500000, | ||
142 | ((loops_per_jiffy * HZ) / 5000) % 100, | ||
143 | (loops_per_jiffy * HZ)); | ||
144 | |||
145 | count += seq_printf(m, | ||
146 | "HW:\n" | ||
147 | " MUL:\t\t%s\n" | ||
148 | " MULX:\t\t%s\n" | ||
149 | " DIV:\t\t%s\n", | ||
150 | cpuinfo.has_mul ? "yes" : "no", | ||
151 | cpuinfo.has_mulx ? "yes" : "no", | ||
152 | cpuinfo.has_div ? "yes" : "no"); | ||
153 | |||
154 | count += seq_printf(m, | ||
155 | "Icache:\t\t%ukB, line length: %u\n", | ||
156 | cpuinfo.icache_size >> 10, | ||
157 | cpuinfo.icache_line_size); | ||
158 | |||
159 | count += seq_printf(m, | ||
160 | "Dcache:\t\t%ukB, line length: %u\n", | ||
161 | cpuinfo.dcache_size >> 10, | ||
162 | cpuinfo.dcache_line_size); | ||
163 | |||
164 | count += seq_printf(m, | ||
165 | "TLB:\t\t%u ways, %u entries, %u PID bits\n", | ||
166 | cpuinfo.tlb_num_ways, | ||
167 | cpuinfo.tlb_num_entries, | ||
168 | cpuinfo.tlb_pid_num_bits); | ||
169 | |||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | static void *cpuinfo_start(struct seq_file *m, loff_t *pos) | ||
174 | { | ||
175 | unsigned long i = *pos; | ||
176 | |||
177 | return i < num_possible_cpus() ? (void *) (i + 1) : NULL; | ||
178 | } | ||
179 | |||
180 | static void *cpuinfo_next(struct seq_file *m, void *v, loff_t *pos) | ||
181 | { | ||
182 | ++*pos; | ||
183 | return cpuinfo_start(m, pos); | ||
184 | } | ||
185 | |||
186 | static void cpuinfo_stop(struct seq_file *m, void *v) | ||
187 | { | ||
188 | } | ||
189 | |||
190 | const struct seq_operations cpuinfo_op = { | ||
191 | .start = cpuinfo_start, | ||
192 | .next = cpuinfo_next, | ||
193 | .stop = cpuinfo_stop, | ||
194 | .show = show_cpuinfo | ||
195 | }; | ||
196 | |||
197 | #endif /* CONFIG_PROC_FS */ | ||
diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S new file mode 100644 index 000000000000..83bca17d1008 --- /dev/null +++ b/arch/nios2/kernel/entry.S | |||
@@ -0,0 +1,555 @@ | |||
1 | /* | ||
2 | * linux/arch/nios2/kernel/entry.S | ||
3 | * | ||
4 | * Copyright (C) 2013-2014 Altera Corporation | ||
5 | * Copyright (C) 2009, Wind River Systems Inc | ||
6 | * | ||
7 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
8 | * | ||
9 | * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) | ||
10 | * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>, | ||
11 | * Kenneth Albanowski <kjahds@kjahds.com>, | ||
12 | * Copyright (C) 2000 Lineo Inc. (www.lineo.com) | ||
13 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
14 | * | ||
15 | * This file is subject to the terms and conditions of the GNU General Public | ||
16 | * License. See the file "COPYING" in the main directory of this archive | ||
17 | * for more details. | ||
18 | * | ||
19 | * Linux/m68k support by Hamish Macdonald | ||
20 | * | ||
21 | * 68060 fixes by Jesper Skov | ||
22 | * ColdFire support by Greg Ungerer (gerg@snapgear.com) | ||
23 | * 5307 fixes by David W. Miller | ||
24 | * linux 2.4 support David McCullough <davidm@snapgear.com> | ||
25 | */ | ||
26 | |||
27 | #include <linux/sys.h> | ||
28 | #include <linux/linkage.h> | ||
29 | #include <asm/asm-offsets.h> | ||
30 | #include <asm/asm-macros.h> | ||
31 | #include <asm/thread_info.h> | ||
32 | #include <asm/errno.h> | ||
33 | #include <asm/setup.h> | ||
34 | #include <asm/entry.h> | ||
35 | #include <asm/unistd.h> | ||
36 | #include <asm/processor.h> | ||
37 | |||
38 | .macro GET_THREAD_INFO reg | ||
39 | .if THREAD_SIZE & 0xffff0000 | ||
40 | andhi \reg, sp, %hi(~(THREAD_SIZE-1)) | ||
41 | .else | ||
42 | addi \reg, r0, %lo(~(THREAD_SIZE-1)) | ||
43 | and \reg, \reg, sp | ||
44 | .endif | ||
45 | .endm | ||
46 | |||
47 | .macro kuser_cmpxchg_check | ||
48 | /* | ||
49 | * Make sure our user space atomic helper is restarted if it was | ||
50 | * interrupted in a critical region. | ||
51 | * ea-4 = address of interrupted insn (ea must be preserved). | ||
52 | * sp = saved regs. | ||
53 | * cmpxchg_ldw = first critical insn, cmpxchg_stw = last critical insn. | ||
54 | * If ea <= cmpxchg_stw and ea > cmpxchg_ldw then saved EA is set to | ||
55 | * cmpxchg_ldw + 4. | ||
56 | */ | ||
57 | /* et = cmpxchg_stw + 4 */ | ||
58 | movui et, (KUSER_BASE + 4 + (cmpxchg_stw - __kuser_helper_start)) | ||
59 | bgtu ea, et, 1f | ||
60 | |||
61 | subi et, et, (cmpxchg_stw - cmpxchg_ldw) /* et = cmpxchg_ldw + 4 */ | ||
62 | bltu ea, et, 1f | ||
63 | stw et, PT_EA(sp) /* fix up EA */ | ||
64 | mov ea, et | ||
65 | 1: | ||
66 | .endm | ||
67 | |||
68 | .section .rodata | ||
69 | .align 4 | ||
70 | exception_table: | ||
71 | .word unhandled_exception /* 0 - Reset */ | ||
72 | .word unhandled_exception /* 1 - Processor-only Reset */ | ||
73 | .word external_interrupt /* 2 - Interrupt */ | ||
74 | .word handle_trap /* 3 - Trap Instruction */ | ||
75 | |||
76 | .word instruction_trap /* 4 - Unimplemented instruction */ | ||
77 | .word handle_illegal /* 5 - Illegal instruction */ | ||
78 | .word handle_unaligned /* 6 - Misaligned data access */ | ||
79 | .word handle_unaligned /* 7 - Misaligned destination address */ | ||
80 | |||
81 | .word handle_diverror /* 8 - Division error */ | ||
82 | .word protection_exception_ba /* 9 - Supervisor-only instr. address */ | ||
83 | .word protection_exception_instr /* 10 - Supervisor only instruction */ | ||
84 | .word protection_exception_ba /* 11 - Supervisor only data address */ | ||
85 | |||
86 | .word unhandled_exception /* 12 - Double TLB miss (data) */ | ||
87 | .word protection_exception_pte /* 13 - TLB permission violation (x) */ | ||
88 | .word protection_exception_pte /* 14 - TLB permission violation (r) */ | ||
89 | .word protection_exception_pte /* 15 - TLB permission violation (w) */ | ||
90 | |||
91 | .word unhandled_exception /* 16 - MPU region violation */ | ||
92 | |||
93 | trap_table: | ||
94 | .word handle_system_call /* 0 */ | ||
95 | .word instruction_trap /* 1 */ | ||
96 | .word instruction_trap /* 2 */ | ||
97 | .word instruction_trap /* 3 */ | ||
98 | .word instruction_trap /* 4 */ | ||
99 | .word instruction_trap /* 5 */ | ||
100 | .word instruction_trap /* 6 */ | ||
101 | .word instruction_trap /* 7 */ | ||
102 | .word instruction_trap /* 8 */ | ||
103 | .word instruction_trap /* 9 */ | ||
104 | .word instruction_trap /* 10 */ | ||
105 | .word instruction_trap /* 11 */ | ||
106 | .word instruction_trap /* 12 */ | ||
107 | .word instruction_trap /* 13 */ | ||
108 | .word instruction_trap /* 14 */ | ||
109 | .word instruction_trap /* 15 */ | ||
110 | .word instruction_trap /* 16 */ | ||
111 | .word instruction_trap /* 17 */ | ||
112 | .word instruction_trap /* 18 */ | ||
113 | .word instruction_trap /* 19 */ | ||
114 | .word instruction_trap /* 20 */ | ||
115 | .word instruction_trap /* 21 */ | ||
116 | .word instruction_trap /* 22 */ | ||
117 | .word instruction_trap /* 23 */ | ||
118 | .word instruction_trap /* 24 */ | ||
119 | .word instruction_trap /* 25 */ | ||
120 | .word instruction_trap /* 26 */ | ||
121 | .word instruction_trap /* 27 */ | ||
122 | .word instruction_trap /* 28 */ | ||
123 | .word instruction_trap /* 29 */ | ||
124 | .word instruction_trap /* 30 */ | ||
125 | .word handle_breakpoint /* 31 */ | ||
126 | |||
127 | .text | ||
128 | .set noat | ||
129 | .set nobreak | ||
130 | |||
131 | ENTRY(inthandler) | ||
132 | SAVE_ALL | ||
133 | |||
134 | kuser_cmpxchg_check | ||
135 | |||
136 | /* Clear EH bit before we get a new excpetion in the kernel | ||
137 | * and after we have saved it to the exception frame. This is done | ||
138 | * whether it's trap, tlb-miss or interrupt. If we don't do this | ||
139 | * estatus is not updated the next exception. | ||
140 | */ | ||
141 | rdctl r24, status | ||
142 | movi r9, %lo(~STATUS_EH) | ||
143 | and r24, r24, r9 | ||
144 | wrctl status, r24 | ||
145 | |||
146 | /* Read cause and vector and branch to the associated handler */ | ||
147 | mov r4, sp | ||
148 | rdctl r5, exception | ||
149 | movia r9, exception_table | ||
150 | add r24, r9, r5 | ||
151 | ldw r24, 0(r24) | ||
152 | jmp r24 | ||
153 | |||
154 | |||
155 | /*********************************************************************** | ||
156 | * Handle traps | ||
157 | *********************************************************************** | ||
158 | */ | ||
159 | ENTRY(handle_trap) | ||
160 | ldw r24, -4(ea) /* instruction that caused the exception */ | ||
161 | srli r24, r24, 4 | ||
162 | andi r24, r24, 0x7c | ||
163 | movia r9,trap_table | ||
164 | add r24, r24, r9 | ||
165 | ldw r24, 0(r24) | ||
166 | jmp r24 | ||
167 | |||
168 | |||
169 | /*********************************************************************** | ||
170 | * Handle system calls | ||
171 | *********************************************************************** | ||
172 | */ | ||
173 | ENTRY(handle_system_call) | ||
174 | /* Enable interrupts */ | ||
175 | rdctl r10, status | ||
176 | ori r10, r10, STATUS_PIE | ||
177 | wrctl status, r10 | ||
178 | |||
179 | /* Reload registers destroyed by common code. */ | ||
180 | ldw r4, PT_R4(sp) | ||
181 | ldw r5, PT_R5(sp) | ||
182 | |||
183 | local_restart: | ||
184 | /* Check that the requested system call is within limits */ | ||
185 | movui r1, __NR_syscalls | ||
186 | bgeu r2, r1, ret_invsyscall | ||
187 | slli r1, r2, 2 | ||
188 | movhi r11, %hiadj(sys_call_table) | ||
189 | add r1, r1, r11 | ||
190 | ldw r1, %lo(sys_call_table)(r1) | ||
191 | beq r1, r0, ret_invsyscall | ||
192 | |||
193 | /* Check if we are being traced */ | ||
194 | GET_THREAD_INFO r11 | ||
195 | ldw r11,TI_FLAGS(r11) | ||
196 | BTBNZ r11,r11,TIF_SYSCALL_TRACE,traced_system_call | ||
197 | |||
198 | /* Execute the system call */ | ||
199 | callr r1 | ||
200 | |||
201 | /* If the syscall returns a negative result: | ||
202 | * Set r7 to 1 to indicate error, | ||
203 | * Negate r2 to get a positive error code | ||
204 | * If the syscall returns zero or a positive value: | ||
205 | * Set r7 to 0. | ||
206 | * The sigreturn system calls will skip the code below by | ||
207 | * adding to register ra. To avoid destroying registers | ||
208 | */ | ||
209 | translate_rc_and_ret: | ||
210 | movi r1, 0 | ||
211 | bge r2, zero, 3f | ||
212 | sub r2, zero, r2 | ||
213 | movi r1, 1 | ||
214 | 3: | ||
215 | stw r2, PT_R2(sp) | ||
216 | stw r1, PT_R7(sp) | ||
217 | end_translate_rc_and_ret: | ||
218 | |||
219 | ret_from_exception: | ||
220 | ldw r1, PT_ESTATUS(sp) | ||
221 | /* if so, skip resched, signals */ | ||
222 | TSTBNZ r1, r1, ESTATUS_EU, Luser_return | ||
223 | |||
224 | restore_all: | ||
225 | rdctl r10, status /* disable intrs */ | ||
226 | andi r10, r10, %lo(~STATUS_PIE) | ||
227 | wrctl status, r10 | ||
228 | RESTORE_ALL | ||
229 | eret | ||
230 | |||
231 | /* If the syscall number was invalid return ENOSYS */ | ||
232 | ret_invsyscall: | ||
233 | movi r2, -ENOSYS | ||
234 | br translate_rc_and_ret | ||
235 | |||
236 | /* This implements the same as above, except it calls | ||
237 | * do_syscall_trace_enter and do_syscall_trace_exit before and after the | ||
238 | * syscall in order for utilities like strace and gdb to work. | ||
239 | */ | ||
240 | traced_system_call: | ||
241 | SAVE_SWITCH_STACK | ||
242 | call do_syscall_trace_enter | ||
243 | RESTORE_SWITCH_STACK | ||
244 | |||
245 | /* Create system call register arguments. The 5th and 6th | ||
246 | arguments on stack are already in place at the beginning | ||
247 | of pt_regs. */ | ||
248 | ldw r2, PT_R2(sp) | ||
249 | ldw r4, PT_R4(sp) | ||
250 | ldw r5, PT_R5(sp) | ||
251 | ldw r6, PT_R6(sp) | ||
252 | ldw r7, PT_R7(sp) | ||
253 | |||
254 | /* Fetch the syscall function, we don't need to check the boundaries | ||
255 | * since this is already done. | ||
256 | */ | ||
257 | slli r1, r2, 2 | ||
258 | movhi r11,%hiadj(sys_call_table) | ||
259 | add r1, r1, r11 | ||
260 | ldw r1, %lo(sys_call_table)(r1) | ||
261 | |||
262 | callr r1 | ||
263 | |||
264 | /* If the syscall returns a negative result: | ||
265 | * Set r7 to 1 to indicate error, | ||
266 | * Negate r2 to get a positive error code | ||
267 | * If the syscall returns zero or a positive value: | ||
268 | * Set r7 to 0. | ||
269 | * The sigreturn system calls will skip the code below by | ||
270 | * adding to register ra. To avoid destroying registers | ||
271 | */ | ||
272 | translate_rc_and_ret2: | ||
273 | movi r1, 0 | ||
274 | bge r2, zero, 4f | ||
275 | sub r2, zero, r2 | ||
276 | movi r1, 1 | ||
277 | 4: | ||
278 | stw r2, PT_R2(sp) | ||
279 | stw r1, PT_R7(sp) | ||
280 | end_translate_rc_and_ret2: | ||
281 | SAVE_SWITCH_STACK | ||
282 | call do_syscall_trace_exit | ||
283 | RESTORE_SWITCH_STACK | ||
284 | br ret_from_exception | ||
285 | |||
286 | Luser_return: | ||
287 | GET_THREAD_INFO r11 /* get thread_info pointer */ | ||
288 | ldw r10, TI_FLAGS(r11) /* get thread_info->flags */ | ||
289 | ANDI32 r11, r10, _TIF_WORK_MASK | ||
290 | beq r11, r0, restore_all /* Nothing to do */ | ||
291 | BTBZ r1, r10, TIF_NEED_RESCHED, Lsignal_return | ||
292 | |||
293 | /* Reschedule work */ | ||
294 | call schedule | ||
295 | br ret_from_exception | ||
296 | |||
297 | Lsignal_return: | ||
298 | ANDI32 r1, r10, _TIF_SIGPENDING | _TIF_NOTIFY_RESUME | ||
299 | beq r1, r0, restore_all | ||
300 | mov r4, sp /* pt_regs */ | ||
301 | SAVE_SWITCH_STACK | ||
302 | call do_notify_resume | ||
303 | beq r2, r0, no_work_pending | ||
304 | RESTORE_SWITCH_STACK | ||
305 | /* prepare restart syscall here without leaving kernel */ | ||
306 | ldw r2, PT_R2(sp) /* reload syscall number in r2 */ | ||
307 | ldw r4, PT_R4(sp) /* reload syscall arguments r4-r9 */ | ||
308 | ldw r5, PT_R5(sp) | ||
309 | ldw r6, PT_R6(sp) | ||
310 | ldw r7, PT_R7(sp) | ||
311 | ldw r8, PT_R8(sp) | ||
312 | ldw r9, PT_R9(sp) | ||
313 | br local_restart /* restart syscall */ | ||
314 | |||
315 | no_work_pending: | ||
316 | RESTORE_SWITCH_STACK | ||
317 | br ret_from_exception | ||
318 | |||
319 | /*********************************************************************** | ||
320 | * Handle external interrupts. | ||
321 | *********************************************************************** | ||
322 | */ | ||
323 | /* | ||
324 | * This is the generic interrupt handler (for all hardware interrupt | ||
325 | * sources). It figures out the vector number and calls the appropriate | ||
326 | * interrupt service routine directly. | ||
327 | */ | ||
328 | external_interrupt: | ||
329 | rdctl r12, ipending | ||
330 | rdctl r9, ienable | ||
331 | and r12, r12, r9 | ||
332 | /* skip if no interrupt is pending */ | ||
333 | beq r12, r0, ret_from_interrupt | ||
334 | |||
335 | movi r24, -1 | ||
336 | stw r24, PT_ORIG_R2(sp) | ||
337 | |||
338 | /* | ||
339 | * Process an external hardware interrupt. | ||
340 | */ | ||
341 | |||
342 | addi ea, ea, -4 /* re-issue the interrupted instruction */ | ||
343 | stw ea, PT_EA(sp) | ||
344 | 2: movi r4, %lo(-1) /* Start from bit position 0, | ||
345 | highest priority */ | ||
346 | /* This is the IRQ # for handler call */ | ||
347 | 1: andi r10, r12, 1 /* Isolate bit we are interested in */ | ||
348 | srli r12, r12, 1 /* shift count is costly without hardware | ||
349 | multiplier */ | ||
350 | addi r4, r4, 1 | ||
351 | beq r10, r0, 1b | ||
352 | mov r5, sp /* Setup pt_regs pointer for handler call */ | ||
353 | call do_IRQ | ||
354 | rdctl r12, ipending /* check again if irq still pending */ | ||
355 | rdctl r9, ienable /* Isolate possible interrupts */ | ||
356 | and r12, r12, r9 | ||
357 | bne r12, r0, 2b | ||
358 | /* br ret_from_interrupt */ /* fall through to ret_from_interrupt */ | ||
359 | |||
360 | ENTRY(ret_from_interrupt) | ||
361 | ldw r1, PT_ESTATUS(sp) /* check if returning to kernel */ | ||
362 | TSTBNZ r1, r1, ESTATUS_EU, Luser_return | ||
363 | |||
364 | #ifdef CONFIG_PREEMPT | ||
365 | GET_THREAD_INFO r1 | ||
366 | ldw r4, TI_PREEMPT_COUNT(r1) | ||
367 | bne r4, r0, restore_all | ||
368 | |||
369 | need_resched: | ||
370 | ldw r4, TI_FLAGS(r1) /* ? Need resched set */ | ||
371 | BTBZ r10, r4, TIF_NEED_RESCHED, restore_all | ||
372 | ldw r4, PT_ESTATUS(sp) /* ? Interrupts off */ | ||
373 | andi r10, r4, ESTATUS_EPIE | ||
374 | beq r10, r0, restore_all | ||
375 | movia r4, PREEMPT_ACTIVE | ||
376 | stw r4, TI_PREEMPT_COUNT(r1) | ||
377 | rdctl r10, status /* enable intrs again */ | ||
378 | ori r10, r10 ,STATUS_PIE | ||
379 | wrctl status, r10 | ||
380 | PUSH r1 | ||
381 | call schedule | ||
382 | POP r1 | ||
383 | mov r4, r0 | ||
384 | stw r4, TI_PREEMPT_COUNT(r1) | ||
385 | rdctl r10, status /* disable intrs */ | ||
386 | andi r10, r10, %lo(~STATUS_PIE) | ||
387 | wrctl status, r10 | ||
388 | br need_resched | ||
389 | #else | ||
390 | br restore_all | ||
391 | #endif | ||
392 | |||
393 | /*********************************************************************** | ||
394 | * A few syscall wrappers | ||
395 | *********************************************************************** | ||
396 | */ | ||
397 | /* | ||
398 | * int clone(unsigned long clone_flags, unsigned long newsp, | ||
399 | * int __user * parent_tidptr, int __user * child_tidptr, | ||
400 | * int tls_val) | ||
401 | */ | ||
402 | ENTRY(sys_clone) | ||
403 | SAVE_SWITCH_STACK | ||
404 | addi sp, sp, -4 | ||
405 | stw r7, 0(sp) /* Pass 5th arg thru stack */ | ||
406 | mov r7, r6 /* 4th arg is 3rd of clone() */ | ||
407 | mov r6, zero /* 3rd arg always 0 */ | ||
408 | call do_fork | ||
409 | addi sp, sp, 4 | ||
410 | RESTORE_SWITCH_STACK | ||
411 | ret | ||
412 | |||
413 | ENTRY(sys_rt_sigreturn) | ||
414 | SAVE_SWITCH_STACK | ||
415 | mov r4, sp | ||
416 | call do_rt_sigreturn | ||
417 | RESTORE_SWITCH_STACK | ||
418 | addi ra, ra, (end_translate_rc_and_ret - translate_rc_and_ret) | ||
419 | ret | ||
420 | |||
421 | /*********************************************************************** | ||
422 | * A few other wrappers and stubs | ||
423 | *********************************************************************** | ||
424 | */ | ||
425 | protection_exception_pte: | ||
426 | rdctl r6, pteaddr | ||
427 | slli r6, r6, 10 | ||
428 | call do_page_fault | ||
429 | br ret_from_exception | ||
430 | |||
431 | protection_exception_ba: | ||
432 | rdctl r6, badaddr | ||
433 | call do_page_fault | ||
434 | br ret_from_exception | ||
435 | |||
436 | protection_exception_instr: | ||
437 | call handle_supervisor_instr | ||
438 | br ret_from_exception | ||
439 | |||
440 | handle_breakpoint: | ||
441 | call breakpoint_c | ||
442 | br ret_from_exception | ||
443 | |||
444 | #ifdef CONFIG_NIOS2_ALIGNMENT_TRAP | ||
445 | handle_unaligned: | ||
446 | SAVE_SWITCH_STACK | ||
447 | call handle_unaligned_c | ||
448 | RESTORE_SWITCH_STACK | ||
449 | br ret_from_exception | ||
450 | #else | ||
451 | handle_unaligned: | ||
452 | call handle_unaligned_c | ||
453 | br ret_from_exception | ||
454 | #endif | ||
455 | |||
456 | handle_illegal: | ||
457 | call handle_illegal_c | ||
458 | br ret_from_exception | ||
459 | |||
460 | handle_diverror: | ||
461 | call handle_diverror_c | ||
462 | br ret_from_exception | ||
463 | |||
464 | /* | ||
465 | * Beware - when entering resume, prev (the current task) is | ||
466 | * in r4, next (the new task) is in r5, don't change these | ||
467 | * registers. | ||
468 | */ | ||
469 | ENTRY(resume) | ||
470 | |||
471 | rdctl r7, status /* save thread status reg */ | ||
472 | stw r7, TASK_THREAD + THREAD_KPSR(r4) | ||
473 | |||
474 | andi r7, r7, %lo(~STATUS_PIE) /* disable interrupts */ | ||
475 | wrctl status, r7 | ||
476 | |||
477 | SAVE_SWITCH_STACK | ||
478 | stw sp, TASK_THREAD + THREAD_KSP(r4)/* save kernel stack pointer */ | ||
479 | ldw sp, TASK_THREAD + THREAD_KSP(r5)/* restore new thread stack */ | ||
480 | movia r24, _current_thread /* save thread */ | ||
481 | GET_THREAD_INFO r1 | ||
482 | stw r1, 0(r24) | ||
483 | RESTORE_SWITCH_STACK | ||
484 | |||
485 | ldw r7, TASK_THREAD + THREAD_KPSR(r5)/* restore thread status reg */ | ||
486 | wrctl status, r7 | ||
487 | ret | ||
488 | |||
489 | ENTRY(ret_from_fork) | ||
490 | call schedule_tail | ||
491 | br ret_from_exception | ||
492 | |||
493 | ENTRY(ret_from_kernel_thread) | ||
494 | call schedule_tail | ||
495 | mov r4,r17 /* arg */ | ||
496 | callr r16 /* function */ | ||
497 | br ret_from_exception | ||
498 | |||
499 | /* | ||
500 | * Kernel user helpers. | ||
501 | * | ||
502 | * Each segment is 64-byte aligned and will be mapped to the <User space>. | ||
503 | * New segments (if ever needed) must be added after the existing ones. | ||
504 | * This mechanism should be used only for things that are really small and | ||
505 | * justified, and not be abused freely. | ||
506 | * | ||
507 | */ | ||
508 | |||
509 | /* Filling pads with undefined instructions. */ | ||
510 | .macro kuser_pad sym size | ||
511 | .if ((. - \sym) & 3) | ||
512 | .rept (4 - (. - \sym) & 3) | ||
513 | .byte 0 | ||
514 | .endr | ||
515 | .endif | ||
516 | .rept ((\size - (. - \sym)) / 4) | ||
517 | .word 0xdeadbeef | ||
518 | .endr | ||
519 | .endm | ||
520 | |||
521 | .align 6 | ||
522 | .globl __kuser_helper_start | ||
523 | __kuser_helper_start: | ||
524 | |||
525 | __kuser_helper_version: /* @ 0x1000 */ | ||
526 | .word ((__kuser_helper_end - __kuser_helper_start) >> 6) | ||
527 | |||
528 | __kuser_cmpxchg: /* @ 0x1004 */ | ||
529 | /* | ||
530 | * r4 pointer to exchange variable | ||
531 | * r5 old value | ||
532 | * r6 new value | ||
533 | */ | ||
534 | cmpxchg_ldw: | ||
535 | ldw r2, 0(r4) /* load current value */ | ||
536 | sub r2, r2, r5 /* compare with old value */ | ||
537 | bne r2, zero, cmpxchg_ret | ||
538 | |||
539 | /* We had a match, store the new value */ | ||
540 | cmpxchg_stw: | ||
541 | stw r6, 0(r4) | ||
542 | cmpxchg_ret: | ||
543 | ret | ||
544 | |||
545 | kuser_pad __kuser_cmpxchg, 64 | ||
546 | |||
547 | .globl __kuser_sigtramp | ||
548 | __kuser_sigtramp: | ||
549 | movi r2, __NR_rt_sigreturn | ||
550 | trap | ||
551 | |||
552 | kuser_pad __kuser_sigtramp, 64 | ||
553 | |||
554 | .globl __kuser_helper_end | ||
555 | __kuser_helper_end: | ||
diff --git a/arch/nios2/kernel/head.S b/arch/nios2/kernel/head.S new file mode 100644 index 000000000000..372ce4a33018 --- /dev/null +++ b/arch/nios2/kernel/head.S | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Wind River Systems Inc | ||
3 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
4 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
5 | * Copyright (C) 2001 Vic Phillips, Microtronix Datacom Ltd. | ||
6 | * | ||
7 | * Based on head.S for Altera's Excalibur development board with nios processor | ||
8 | * | ||
9 | * Based on the following from the Excalibur sdk distribution: | ||
10 | * NA_MemoryMap.s, NR_JumpToStart.s, NR_Setup.s, NR_CWPManager.s | ||
11 | * | ||
12 | * This file is subject to the terms and conditions of the GNU General Public | ||
13 | * License. See the file "COPYING" in the main directory of this archive | ||
14 | * for more details. | ||
15 | */ | ||
16 | |||
17 | #include <linux/init.h> | ||
18 | #include <linux/linkage.h> | ||
19 | #include <asm/thread_info.h> | ||
20 | #include <asm/processor.h> | ||
21 | #include <asm/cache.h> | ||
22 | #include <asm/page.h> | ||
23 | #include <asm/asm-offsets.h> | ||
24 | #include <asm/asm-macros.h> | ||
25 | |||
26 | /* | ||
27 | * ZERO_PAGE is a special page that is used for zero-initialized | ||
28 | * data and COW. | ||
29 | */ | ||
30 | .data | ||
31 | .global empty_zero_page | ||
32 | .align 12 | ||
33 | empty_zero_page: | ||
34 | .space PAGE_SIZE | ||
35 | |||
36 | /* | ||
37 | * This global variable is used as an extension to the nios' | ||
38 | * STATUS register to emulate a user/supervisor mode. | ||
39 | */ | ||
40 | .data | ||
41 | .align 2 | ||
42 | .set noat | ||
43 | |||
44 | .global _current_thread | ||
45 | _current_thread: | ||
46 | .long 0 | ||
47 | /* | ||
48 | * Input(s): passed from u-boot | ||
49 | * r4 - Optional pointer to a board information structure. | ||
50 | * r5 - Optional pointer to the physical starting address of the init RAM | ||
51 | * disk. | ||
52 | * r6 - Optional pointer to the physical ending address of the init RAM | ||
53 | * disk. | ||
54 | * r7 - Optional pointer to the physical starting address of any kernel | ||
55 | * command-line parameters. | ||
56 | */ | ||
57 | |||
58 | /* | ||
59 | * First executable code - detected and jumped to by the ROM bootstrap | ||
60 | * if the code resides in flash (looks for "Nios" at offset 0x0c from | ||
61 | * the potential executable image). | ||
62 | */ | ||
63 | __HEAD | ||
64 | ENTRY(_start) | ||
65 | wrctl status, r0 /* Disable interrupts */ | ||
66 | |||
67 | /* Initialize all cache lines within the instruction cache */ | ||
68 | movia r1, NIOS2_ICACHE_SIZE | ||
69 | movui r2, NIOS2_ICACHE_LINE_SIZE | ||
70 | |||
71 | icache_init: | ||
72 | initi r1 | ||
73 | sub r1, r1, r2 | ||
74 | bgt r1, r0, icache_init | ||
75 | br 1f | ||
76 | |||
77 | /* | ||
78 | * This is the default location for the exception handler. Code in jump | ||
79 | * to our handler | ||
80 | */ | ||
81 | ENTRY(exception_handler_hook) | ||
82 | movia r24, inthandler | ||
83 | jmp r24 | ||
84 | |||
85 | ENTRY(fast_handler) | ||
86 | nextpc et | ||
87 | helper: | ||
88 | stw r3, r3save - helper(et) | ||
89 | |||
90 | rdctl r3 , pteaddr | ||
91 | srli r3, r3, 12 | ||
92 | slli r3, r3, 2 | ||
93 | movia et, pgd_current | ||
94 | |||
95 | ldw et, 0(et) | ||
96 | add r3, et, r3 | ||
97 | ldw et, 0(r3) | ||
98 | |||
99 | rdctl r3, pteaddr | ||
100 | andi r3, r3, 0xfff | ||
101 | add et, r3, et | ||
102 | ldw et, 0(et) | ||
103 | wrctl tlbacc, et | ||
104 | nextpc et | ||
105 | helper2: | ||
106 | ldw r3, r3save - helper2(et) | ||
107 | subi ea, ea, 4 | ||
108 | eret | ||
109 | r3save: | ||
110 | .word 0x0 | ||
111 | ENTRY(fast_handler_end) | ||
112 | |||
113 | 1: | ||
114 | /* | ||
115 | * After the instruction cache is initialized, the data cache must | ||
116 | * also be initialized. | ||
117 | */ | ||
118 | movia r1, NIOS2_DCACHE_SIZE | ||
119 | movui r2, NIOS2_DCACHE_LINE_SIZE | ||
120 | |||
121 | dcache_init: | ||
122 | initd 0(r1) | ||
123 | sub r1, r1, r2 | ||
124 | bgt r1, r0, dcache_init | ||
125 | |||
126 | nextpc r1 /* Find out where we are */ | ||
127 | chkadr: | ||
128 | movia r2, chkadr | ||
129 | beq r1, r2,finish_move /* We are running in RAM done */ | ||
130 | addi r1, r1,(_start - chkadr) /* Source */ | ||
131 | movia r2, _start /* Destination */ | ||
132 | movia r3, __bss_start /* End of copy */ | ||
133 | |||
134 | loop_move: /* r1: src, r2: dest, r3: last dest */ | ||
135 | ldw r8, 0(r1) /* load a word from [r1] */ | ||
136 | stw r8, 0(r2) /* store a word to dest [r2] */ | ||
137 | flushd 0(r2) /* Flush cache for safety */ | ||
138 | addi r1, r1, 4 /* inc the src addr */ | ||
139 | addi r2, r2, 4 /* inc the dest addr */ | ||
140 | blt r2, r3, loop_move | ||
141 | |||
142 | movia r1, finish_move /* VMA(_start)->l1 */ | ||
143 | jmp r1 /* jmp to _start */ | ||
144 | |||
145 | finish_move: | ||
146 | |||
147 | /* Mask off all possible interrupts */ | ||
148 | wrctl ienable, r0 | ||
149 | |||
150 | /* Clear .bss */ | ||
151 | movia r2, __bss_start | ||
152 | movia r1, __bss_stop | ||
153 | 1: | ||
154 | stb r0, 0(r2) | ||
155 | addi r2, r2, 1 | ||
156 | bne r1, r2, 1b | ||
157 | |||
158 | movia r1, init_thread_union /* set stack at top of the task union */ | ||
159 | addi sp, r1, THREAD_SIZE | ||
160 | movia r2, _current_thread /* Remember current thread */ | ||
161 | stw r1, 0(r2) | ||
162 | |||
163 | movia r1, nios2_boot_init /* save args r4-r7 passed from u-boot */ | ||
164 | callr r1 | ||
165 | |||
166 | movia r1, start_kernel /* call start_kernel as a subroutine */ | ||
167 | callr r1 | ||
168 | |||
169 | /* If we return from start_kernel, break to the oci debugger and | ||
170 | * buggered we are. | ||
171 | */ | ||
172 | break | ||
173 | |||
174 | /* End of startup code */ | ||
175 | .set at | ||
diff --git a/arch/nios2/kernel/insnemu.S b/arch/nios2/kernel/insnemu.S new file mode 100644 index 000000000000..1c6b651e770d --- /dev/null +++ b/arch/nios2/kernel/insnemu.S | |||
@@ -0,0 +1,592 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003-2013 Altera Corporation | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | |||
20 | #include <linux/linkage.h> | ||
21 | #include <asm/entry.h> | ||
22 | |||
23 | .set noat | ||
24 | .set nobreak | ||
25 | |||
26 | /* | ||
27 | * Explicitly allow the use of r1 (the assembler temporary register) | ||
28 | * within this code. This register is normally reserved for the use of | ||
29 | * the compiler. | ||
30 | */ | ||
31 | |||
32 | ENTRY(instruction_trap) | ||
33 | ldw r1, PT_R1(sp) // Restore registers | ||
34 | ldw r2, PT_R2(sp) | ||
35 | ldw r3, PT_R3(sp) | ||
36 | ldw r4, PT_R4(sp) | ||
37 | ldw r5, PT_R5(sp) | ||
38 | ldw r6, PT_R6(sp) | ||
39 | ldw r7, PT_R7(sp) | ||
40 | ldw r8, PT_R8(sp) | ||
41 | ldw r9, PT_R9(sp) | ||
42 | ldw r10, PT_R10(sp) | ||
43 | ldw r11, PT_R11(sp) | ||
44 | ldw r12, PT_R12(sp) | ||
45 | ldw r13, PT_R13(sp) | ||
46 | ldw r14, PT_R14(sp) | ||
47 | ldw r15, PT_R15(sp) | ||
48 | ldw ra, PT_RA(sp) | ||
49 | ldw fp, PT_FP(sp) | ||
50 | ldw gp, PT_GP(sp) | ||
51 | ldw et, PT_ESTATUS(sp) | ||
52 | wrctl estatus, et | ||
53 | ldw ea, PT_EA(sp) | ||
54 | ldw et, PT_SP(sp) /* backup sp in et */ | ||
55 | |||
56 | addi sp, sp, PT_REGS_SIZE | ||
57 | |||
58 | /* INSTRUCTION EMULATION | ||
59 | * --------------------- | ||
60 | * | ||
61 | * Nios II processors generate exceptions for unimplemented instructions. | ||
62 | * The routines below emulate these instructions. Depending on the | ||
63 | * processor core, the only instructions that might need to be emulated | ||
64 | * are div, divu, mul, muli, mulxss, mulxsu, and mulxuu. | ||
65 | * | ||
66 | * The emulations match the instructions, except for the following | ||
67 | * limitations: | ||
68 | * | ||
69 | * 1) The emulation routines do not emulate the use of the exception | ||
70 | * temporary register (et) as a source operand because the exception | ||
71 | * handler already has modified it. | ||
72 | * | ||
73 | * 2) The routines do not emulate the use of the stack pointer (sp) or | ||
74 | * the exception return address register (ea) as a destination because | ||
75 | * modifying these registers crashes the exception handler or the | ||
76 | * interrupted routine. | ||
77 | * | ||
78 | * Detailed Design | ||
79 | * --------------- | ||
80 | * | ||
81 | * The emulation routines expect the contents of integer registers r0-r31 | ||
82 | * to be on the stack at addresses sp, 4(sp), 8(sp), ... 124(sp). The | ||
83 | * routines retrieve source operands from the stack and modify the | ||
84 | * destination register's value on the stack prior to the end of the | ||
85 | * exception handler. Then all registers except the destination register | ||
86 | * are restored to their previous values. | ||
87 | * | ||
88 | * The instruction that causes the exception is found at address -4(ea). | ||
89 | * The instruction's OP and OPX fields identify the operation to be | ||
90 | * performed. | ||
91 | * | ||
92 | * One instruction, muli, is an I-type instruction that is identified by | ||
93 | * an OP field of 0x24. | ||
94 | * | ||
95 | * muli AAAAA,BBBBB,IIIIIIIIIIIIIIII,-0x24- | ||
96 | * 27 22 6 0 <-- LSB of field | ||
97 | * | ||
98 | * The remaining emulated instructions are R-type and have an OP field | ||
99 | * of 0x3a. Their OPX fields identify them. | ||
100 | * | ||
101 | * R-type AAAAA,BBBBB,CCCCC,XXXXXX,NNNNN,-0x3a- | ||
102 | * 27 22 17 11 6 0 <-- LSB of field | ||
103 | * | ||
104 | * | ||
105 | * Opcode Encoding. muli is identified by its OP value. Then OPX & 0x02 | ||
106 | * is used to differentiate between the division opcodes and the | ||
107 | * remaining multiplication opcodes. | ||
108 | * | ||
109 | * Instruction OP OPX OPX & 0x02 | ||
110 | * ----------- ---- ---- ---------- | ||
111 | * muli 0x24 | ||
112 | * divu 0x3a 0x24 0 | ||
113 | * div 0x3a 0x25 0 | ||
114 | * mul 0x3a 0x27 != 0 | ||
115 | * mulxuu 0x3a 0x07 != 0 | ||
116 | * mulxsu 0x3a 0x17 != 0 | ||
117 | * mulxss 0x3a 0x1f != 0 | ||
118 | */ | ||
119 | |||
120 | |||
121 | /* | ||
122 | * Save everything on the stack to make it easy for the emulation | ||
123 | * routines to retrieve the source register operands. | ||
124 | */ | ||
125 | |||
126 | addi sp, sp, -128 | ||
127 | stw zero, 0(sp) /* Save zero on stack to avoid special case for r0. */ | ||
128 | stw r1, 4(sp) | ||
129 | stw r2, 8(sp) | ||
130 | stw r3, 12(sp) | ||
131 | stw r4, 16(sp) | ||
132 | stw r5, 20(sp) | ||
133 | stw r6, 24(sp) | ||
134 | stw r7, 28(sp) | ||
135 | stw r8, 32(sp) | ||
136 | stw r9, 36(sp) | ||
137 | stw r10, 40(sp) | ||
138 | stw r11, 44(sp) | ||
139 | stw r12, 48(sp) | ||
140 | stw r13, 52(sp) | ||
141 | stw r14, 56(sp) | ||
142 | stw r15, 60(sp) | ||
143 | stw r16, 64(sp) | ||
144 | stw r17, 68(sp) | ||
145 | stw r18, 72(sp) | ||
146 | stw r19, 76(sp) | ||
147 | stw r20, 80(sp) | ||
148 | stw r21, 84(sp) | ||
149 | stw r22, 88(sp) | ||
150 | stw r23, 92(sp) | ||
151 | /* Don't bother to save et. It's already been changed. */ | ||
152 | rdctl r5, estatus | ||
153 | stw r5, 100(sp) | ||
154 | |||
155 | stw gp, 104(sp) | ||
156 | stw et, 108(sp) /* et contains previous sp value. */ | ||
157 | stw fp, 112(sp) | ||
158 | stw ea, 116(sp) | ||
159 | stw ra, 120(sp) | ||
160 | |||
161 | |||
162 | /* | ||
163 | * Split the instruction into its fields. We need 4*A, 4*B, and 4*C as | ||
164 | * offsets to the stack pointer for access to the stored register values. | ||
165 | */ | ||
166 | ldw r2,-4(ea) /* r2 = AAAAA,BBBBB,IIIIIIIIIIIIIIII,PPPPPP */ | ||
167 | roli r3, r2, 7 /* r3 = BBB,IIIIIIIIIIIIIIII,PPPPPP,AAAAA,BB */ | ||
168 | roli r4, r3, 3 /* r4 = IIIIIIIIIIIIIIII,PPPPPP,AAAAA,BBBBB */ | ||
169 | roli r5, r4, 2 /* r5 = IIIIIIIIIIIIII,PPPPPP,AAAAA,BBBBB,II */ | ||
170 | srai r4, r4, 16 /* r4 = (sign-extended) IMM16 */ | ||
171 | roli r6, r5, 5 /* r6 = XXXX,NNNNN,PPPPPP,AAAAA,BBBBB,CCCCC,XX */ | ||
172 | andi r2, r2, 0x3f /* r2 = 00000000000000000000000000,PPPPPP */ | ||
173 | andi r3, r3, 0x7c /* r3 = 0000000000000000000000000,AAAAA,00 */ | ||
174 | andi r5, r5, 0x7c /* r5 = 0000000000000000000000000,BBBBB,00 */ | ||
175 | andi r6, r6, 0x7c /* r6 = 0000000000000000000000000,CCCCC,00 */ | ||
176 | |||
177 | /* Now | ||
178 | * r2 = OP | ||
179 | * r3 = 4*A | ||
180 | * r4 = IMM16 (sign extended) | ||
181 | * r5 = 4*B | ||
182 | * r6 = 4*C | ||
183 | */ | ||
184 | |||
185 | /* | ||
186 | * Get the operands. | ||
187 | * | ||
188 | * It is necessary to check for muli because it uses an I-type | ||
189 | * instruction format, while the other instructions are have an R-type | ||
190 | * format. | ||
191 | * | ||
192 | * Prepare for either multiplication or division loop. | ||
193 | * They both loop 32 times. | ||
194 | */ | ||
195 | movi r14, 32 | ||
196 | |||
197 | add r3, r3, sp /* r3 = address of A-operand. */ | ||
198 | ldw r3, 0(r3) /* r3 = A-operand. */ | ||
199 | movi r7, 0x24 /* muli opcode (I-type instruction format) */ | ||
200 | beq r2, r7, mul_immed /* muli doesn't use the B register as a source */ | ||
201 | |||
202 | add r5, r5, sp /* r5 = address of B-operand. */ | ||
203 | ldw r5, 0(r5) /* r5 = B-operand. */ | ||
204 | /* r4 = SSSSSSSSSSSSSSSS,-----IMM16------ */ | ||
205 | /* IMM16 not needed, align OPX portion */ | ||
206 | /* r4 = SSSSSSSSSSSSSSSS,CCCCC,-OPX--,00000 */ | ||
207 | srli r4, r4, 5 /* r4 = 00000,SSSSSSSSSSSSSSSS,CCCCC,-OPX-- */ | ||
208 | andi r4, r4, 0x3f /* r4 = 00000000000000000000000000,-OPX-- */ | ||
209 | |||
210 | /* Now | ||
211 | * r2 = OP | ||
212 | * r3 = src1 | ||
213 | * r5 = src2 | ||
214 | * r4 = OPX (no longer can be muli) | ||
215 | * r6 = 4*C | ||
216 | */ | ||
217 | |||
218 | |||
219 | /* | ||
220 | * Multiply or Divide? | ||
221 | */ | ||
222 | andi r7, r4, 0x02 /* For R-type multiply instructions, | ||
223 | OPX & 0x02 != 0 */ | ||
224 | bne r7, zero, multiply | ||
225 | |||
226 | |||
227 | /* DIVISION | ||
228 | * | ||
229 | * Divide an unsigned dividend by an unsigned divisor using | ||
230 | * a shift-and-subtract algorithm. The example below shows | ||
231 | * 43 div 7 = 6 for 8-bit integers. This classic algorithm uses a | ||
232 | * single register to store both the dividend and the quotient, | ||
233 | * allowing both values to be shifted with a single instruction. | ||
234 | * | ||
235 | * remainder dividend:quotient | ||
236 | * --------- ----------------- | ||
237 | * initialize 00000000 00101011: | ||
238 | * shift 00000000 0101011:_ | ||
239 | * remainder >= divisor? no 00000000 0101011:0 | ||
240 | * shift 00000000 101011:0_ | ||
241 | * remainder >= divisor? no 00000000 101011:00 | ||
242 | * shift 00000001 01011:00_ | ||
243 | * remainder >= divisor? no 00000001 01011:000 | ||
244 | * shift 00000010 1011:000_ | ||
245 | * remainder >= divisor? no 00000010 1011:0000 | ||
246 | * shift 00000101 011:0000_ | ||
247 | * remainder >= divisor? no 00000101 011:00000 | ||
248 | * shift 00001010 11:00000_ | ||
249 | * remainder >= divisor? yes 00001010 11:000001 | ||
250 | * remainder -= divisor - 00000111 | ||
251 | * ---------- | ||
252 | * 00000011 11:000001 | ||
253 | * shift 00000111 1:000001_ | ||
254 | * remainder >= divisor? yes 00000111 1:0000011 | ||
255 | * remainder -= divisor - 00000111 | ||
256 | * ---------- | ||
257 | * 00000000 1:0000011 | ||
258 | * shift 00000001 :0000011_ | ||
259 | * remainder >= divisor? no 00000001 :00000110 | ||
260 | * | ||
261 | * The quotient is 00000110. | ||
262 | */ | ||
263 | |||
264 | divide: | ||
265 | /* | ||
266 | * Prepare for division by assuming the result | ||
267 | * is unsigned, and storing its "sign" as 0. | ||
268 | */ | ||
269 | movi r17, 0 | ||
270 | |||
271 | |||
272 | /* Which division opcode? */ | ||
273 | xori r7, r4, 0x25 /* OPX of div */ | ||
274 | bne r7, zero, unsigned_division | ||
275 | |||
276 | |||
277 | /* | ||
278 | * OPX is div. Determine and store the sign of the quotient. | ||
279 | * Then take the absolute value of both operands. | ||
280 | */ | ||
281 | xor r17, r3, r5 /* MSB contains sign of quotient */ | ||
282 | bge r3,zero,dividend_is_nonnegative | ||
283 | sub r3, zero, r3 /* -r3 */ | ||
284 | dividend_is_nonnegative: | ||
285 | bge r5, zero, divisor_is_nonnegative | ||
286 | sub r5, zero, r5 /* -r5 */ | ||
287 | divisor_is_nonnegative: | ||
288 | |||
289 | |||
290 | unsigned_division: | ||
291 | /* Initialize the unsigned-division loop. */ | ||
292 | movi r13, 0 /* remainder = 0 */ | ||
293 | |||
294 | /* Now | ||
295 | * r3 = dividend : quotient | ||
296 | * r4 = 0x25 for div, 0x24 for divu | ||
297 | * r5 = divisor | ||
298 | * r13 = remainder | ||
299 | * r14 = loop counter (already initialized to 32) | ||
300 | * r17 = MSB contains sign of quotient | ||
301 | */ | ||
302 | |||
303 | |||
304 | /* | ||
305 | * for (count = 32; count > 0; --count) | ||
306 | * { | ||
307 | */ | ||
308 | divide_loop: | ||
309 | |||
310 | /* | ||
311 | * Division: | ||
312 | * | ||
313 | * (remainder:dividend:quotient) <<= 1; | ||
314 | */ | ||
315 | slli r13, r13, 1 | ||
316 | cmplt r7, r3, zero /* r7 = MSB of r3 */ | ||
317 | or r13, r13, r7 | ||
318 | slli r3, r3, 1 | ||
319 | |||
320 | |||
321 | /* | ||
322 | * if (remainder >= divisor) | ||
323 | * { | ||
324 | * set LSB of quotient | ||
325 | * remainder -= divisor; | ||
326 | * } | ||
327 | */ | ||
328 | bltu r13, r5, div_skip | ||
329 | ori r3, r3, 1 | ||
330 | sub r13, r13, r5 | ||
331 | div_skip: | ||
332 | |||
333 | /* | ||
334 | * } | ||
335 | */ | ||
336 | subi r14, r14, 1 | ||
337 | bne r14, zero, divide_loop | ||
338 | |||
339 | |||
340 | /* Now | ||
341 | * r3 = quotient | ||
342 | * r4 = 0x25 for div, 0x24 for divu | ||
343 | * r6 = 4*C | ||
344 | * r17 = MSB contains sign of quotient | ||
345 | */ | ||
346 | |||
347 | |||
348 | /* | ||
349 | * Conditionally negate signed quotient. If quotient is unsigned, | ||
350 | * the sign already is initialized to 0. | ||
351 | */ | ||
352 | bge r17, zero, quotient_is_nonnegative | ||
353 | sub r3, zero, r3 /* -r3 */ | ||
354 | quotient_is_nonnegative: | ||
355 | |||
356 | |||
357 | /* | ||
358 | * Final quotient is in r3. | ||
359 | */ | ||
360 | add r6, r6, sp | ||
361 | stw r3, 0(r6) /* write quotient to stack */ | ||
362 | br restore_registers | ||
363 | |||
364 | |||
365 | |||
366 | |||
367 | /* MULTIPLICATION | ||
368 | * | ||
369 | * A "product" is the number that one gets by summing a "multiplicand" | ||
370 | * several times. The "multiplier" specifies the number of copies of the | ||
371 | * multiplicand that are summed. | ||
372 | * | ||
373 | * Actual multiplication algorithms don't use repeated addition, however. | ||
374 | * Shift-and-add algorithms get the same answer as repeated addition, and | ||
375 | * they are faster. To compute the lower half of a product (pppp below) | ||
376 | * one shifts the product left before adding in each of the partial | ||
377 | * products (a * mmmm) through (d * mmmm). | ||
378 | * | ||
379 | * To compute the upper half of a product (PPPP below), one adds in the | ||
380 | * partial products (d * mmmm) through (a * mmmm), each time following | ||
381 | * the add by a right shift of the product. | ||
382 | * | ||
383 | * mmmm | ||
384 | * * abcd | ||
385 | * ------ | ||
386 | * #### = d * mmmm | ||
387 | * #### = c * mmmm | ||
388 | * #### = b * mmmm | ||
389 | * #### = a * mmmm | ||
390 | * -------- | ||
391 | * PPPPpppp | ||
392 | * | ||
393 | * The example above shows 4 partial products. Computing actual Nios II | ||
394 | * products requires 32 partials. | ||
395 | * | ||
396 | * It is possible to compute the result of mulxsu from the result of | ||
397 | * mulxuu because the only difference between the results of these two | ||
398 | * opcodes is the value of the partial product associated with the sign | ||
399 | * bit of rA. | ||
400 | * | ||
401 | * mulxsu = mulxuu - (rA < 0) ? rB : 0; | ||
402 | * | ||
403 | * It is possible to compute the result of mulxss from the result of | ||
404 | * mulxsu because the only difference between the results of these two | ||
405 | * opcodes is the value of the partial product associated with the sign | ||
406 | * bit of rB. | ||
407 | * | ||
408 | * mulxss = mulxsu - (rB < 0) ? rA : 0; | ||
409 | * | ||
410 | */ | ||
411 | |||
412 | mul_immed: | ||
413 | /* Opcode is muli. Change it into mul for remainder of algorithm. */ | ||
414 | mov r6, r5 /* Field B is dest register, not field C. */ | ||
415 | mov r5, r4 /* Field IMM16 is src2, not field B. */ | ||
416 | movi r4, 0x27 /* OPX of mul is 0x27 */ | ||
417 | |||
418 | multiply: | ||
419 | /* Initialize the multiplication loop. */ | ||
420 | movi r9, 0 /* mul_product = 0 */ | ||
421 | movi r10, 0 /* mulxuu_product = 0 */ | ||
422 | mov r11, r5 /* save original multiplier for mulxsu and mulxss */ | ||
423 | mov r12, r5 /* mulxuu_multiplier (will be shifted) */ | ||
424 | movi r16, 1 /* used to create "rori B,A,1" from "ror B,A,r16" */ | ||
425 | |||
426 | /* Now | ||
427 | * r3 = multiplicand | ||
428 | * r5 = mul_multiplier | ||
429 | * r6 = 4 * dest_register (used later as offset to sp) | ||
430 | * r7 = temp | ||
431 | * r9 = mul_product | ||
432 | * r10 = mulxuu_product | ||
433 | * r11 = original multiplier | ||
434 | * r12 = mulxuu_multiplier | ||
435 | * r14 = loop counter (already initialized) | ||
436 | * r16 = 1 | ||
437 | */ | ||
438 | |||
439 | |||
440 | /* | ||
441 | * for (count = 32; count > 0; --count) | ||
442 | * { | ||
443 | */ | ||
444 | multiply_loop: | ||
445 | |||
446 | /* | ||
447 | * mul_product <<= 1; | ||
448 | * lsb = multiplier & 1; | ||
449 | */ | ||
450 | slli r9, r9, 1 | ||
451 | andi r7, r12, 1 | ||
452 | |||
453 | /* | ||
454 | * if (lsb == 1) | ||
455 | * { | ||
456 | * mulxuu_product += multiplicand; | ||
457 | * } | ||
458 | */ | ||
459 | beq r7, zero, mulx_skip | ||
460 | add r10, r10, r3 | ||
461 | cmpltu r7, r10, r3 /* Save the carry from the MSB of mulxuu_product. */ | ||
462 | ror r7, r7, r16 /* r7 = 0x80000000 on carry, or else 0x00000000 */ | ||
463 | mulx_skip: | ||
464 | |||
465 | /* | ||
466 | * if (MSB of mul_multiplier == 1) | ||
467 | * { | ||
468 | * mul_product += multiplicand; | ||
469 | * } | ||
470 | */ | ||
471 | bge r5, zero, mul_skip | ||
472 | add r9, r9, r3 | ||
473 | mul_skip: | ||
474 | |||
475 | /* | ||
476 | * mulxuu_product >>= 1; logical shift | ||
477 | * mul_multiplier <<= 1; done with MSB | ||
478 | * mulx_multiplier >>= 1; done with LSB | ||
479 | */ | ||
480 | srli r10, r10, 1 | ||
481 | or r10, r10, r7 /* OR in the saved carry bit. */ | ||
482 | slli r5, r5, 1 | ||
483 | srli r12, r12, 1 | ||
484 | |||
485 | |||
486 | /* | ||
487 | * } | ||
488 | */ | ||
489 | subi r14, r14, 1 | ||
490 | bne r14, zero, multiply_loop | ||
491 | |||
492 | |||
493 | /* | ||
494 | * Multiply emulation loop done. | ||
495 | */ | ||
496 | |||
497 | /* Now | ||
498 | * r3 = multiplicand | ||
499 | * r4 = OPX | ||
500 | * r6 = 4 * dest_register (used later as offset to sp) | ||
501 | * r7 = temp | ||
502 | * r9 = mul_product | ||
503 | * r10 = mulxuu_product | ||
504 | * r11 = original multiplier | ||
505 | */ | ||
506 | |||
507 | |||
508 | /* Calculate address for result from 4 * dest_register */ | ||
509 | add r6, r6, sp | ||
510 | |||
511 | |||
512 | /* | ||
513 | * Select/compute the result based on OPX. | ||
514 | */ | ||
515 | |||
516 | |||
517 | /* OPX == mul? Then store. */ | ||
518 | xori r7, r4, 0x27 | ||
519 | beq r7, zero, store_product | ||
520 | |||
521 | /* It's one of the mulx.. opcodes. Move over the result. */ | ||
522 | mov r9, r10 | ||
523 | |||
524 | /* OPX == mulxuu? Then store. */ | ||
525 | xori r7, r4, 0x07 | ||
526 | beq r7, zero, store_product | ||
527 | |||
528 | /* Compute mulxsu | ||
529 | * | ||
530 | * mulxsu = mulxuu - (rA < 0) ? rB : 0; | ||
531 | */ | ||
532 | bge r3, zero, mulxsu_skip | ||
533 | sub r9, r9, r11 | ||
534 | mulxsu_skip: | ||
535 | |||
536 | /* OPX == mulxsu? Then store. */ | ||
537 | xori r7, r4, 0x17 | ||
538 | beq r7, zero, store_product | ||
539 | |||
540 | /* Compute mulxss | ||
541 | * | ||
542 | * mulxss = mulxsu - (rB < 0) ? rA : 0; | ||
543 | */ | ||
544 | bge r11,zero,mulxss_skip | ||
545 | sub r9, r9, r3 | ||
546 | mulxss_skip: | ||
547 | /* At this point, assume that OPX is mulxss, so store*/ | ||
548 | |||
549 | |||
550 | store_product: | ||
551 | stw r9, 0(r6) | ||
552 | |||
553 | |||
554 | restore_registers: | ||
555 | /* No need to restore r0. */ | ||
556 | ldw r5, 100(sp) | ||
557 | wrctl estatus, r5 | ||
558 | |||
559 | ldw r1, 4(sp) | ||
560 | ldw r2, 8(sp) | ||
561 | ldw r3, 12(sp) | ||
562 | ldw r4, 16(sp) | ||
563 | ldw r5, 20(sp) | ||
564 | ldw r6, 24(sp) | ||
565 | ldw r7, 28(sp) | ||
566 | ldw r8, 32(sp) | ||
567 | ldw r9, 36(sp) | ||
568 | ldw r10, 40(sp) | ||
569 | ldw r11, 44(sp) | ||
570 | ldw r12, 48(sp) | ||
571 | ldw r13, 52(sp) | ||
572 | ldw r14, 56(sp) | ||
573 | ldw r15, 60(sp) | ||
574 | ldw r16, 64(sp) | ||
575 | ldw r17, 68(sp) | ||
576 | ldw r18, 72(sp) | ||
577 | ldw r19, 76(sp) | ||
578 | ldw r20, 80(sp) | ||
579 | ldw r21, 84(sp) | ||
580 | ldw r22, 88(sp) | ||
581 | ldw r23, 92(sp) | ||
582 | /* Does not need to restore et */ | ||
583 | ldw gp, 104(sp) | ||
584 | |||
585 | ldw fp, 112(sp) | ||
586 | ldw ea, 116(sp) | ||
587 | ldw ra, 120(sp) | ||
588 | ldw sp, 108(sp) /* last restore sp */ | ||
589 | eret | ||
590 | |||
591 | .set at | ||
592 | .set break | ||
diff --git a/arch/nios2/kernel/irq.c b/arch/nios2/kernel/irq.c new file mode 100644 index 000000000000..f5b74ae69b5b --- /dev/null +++ b/arch/nios2/kernel/irq.c | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * Copyright (C) 2008 Thomas Chou <thomas@wytron.com.tw> | ||
5 | * | ||
6 | * based on irq.c from m68k which is: | ||
7 | * | ||
8 | * Copyright (C) 2007 Greg Ungerer <gerg@snapgear.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #include <linux/init.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/of.h> | ||
28 | |||
29 | static u32 ienable; | ||
30 | |||
31 | asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs) | ||
32 | { | ||
33 | struct pt_regs *oldregs = set_irq_regs(regs); | ||
34 | int irq; | ||
35 | |||
36 | irq_enter(); | ||
37 | irq = irq_find_mapping(NULL, hwirq); | ||
38 | generic_handle_irq(irq); | ||
39 | irq_exit(); | ||
40 | |||
41 | set_irq_regs(oldregs); | ||
42 | } | ||
43 | |||
44 | static void chip_unmask(struct irq_data *d) | ||
45 | { | ||
46 | ienable |= (1 << d->hwirq); | ||
47 | WRCTL(CTL_IENABLE, ienable); | ||
48 | } | ||
49 | |||
50 | static void chip_mask(struct irq_data *d) | ||
51 | { | ||
52 | ienable &= ~(1 << d->hwirq); | ||
53 | WRCTL(CTL_IENABLE, ienable); | ||
54 | } | ||
55 | |||
56 | static struct irq_chip m_irq_chip = { | ||
57 | .name = "NIOS2-INTC", | ||
58 | .irq_unmask = chip_unmask, | ||
59 | .irq_mask = chip_mask, | ||
60 | }; | ||
61 | |||
62 | static int irq_map(struct irq_domain *h, unsigned int virq, | ||
63 | irq_hw_number_t hw_irq_num) | ||
64 | { | ||
65 | irq_set_chip_and_handler(virq, &m_irq_chip, handle_level_irq); | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static struct irq_domain_ops irq_ops = { | ||
71 | .map = irq_map, | ||
72 | .xlate = irq_domain_xlate_onecell, | ||
73 | }; | ||
74 | |||
75 | void __init init_IRQ(void) | ||
76 | { | ||
77 | struct irq_domain *domain; | ||
78 | struct device_node *node; | ||
79 | |||
80 | node = of_find_compatible_node(NULL, NULL, "altr,nios2-1.0"); | ||
81 | if (!node) | ||
82 | node = of_find_compatible_node(NULL, NULL, "altr,nios2-1.1"); | ||
83 | |||
84 | BUG_ON(!node); | ||
85 | |||
86 | domain = irq_domain_add_linear(node, NIOS2_CPU_NR_IRQS, &irq_ops, NULL); | ||
87 | BUG_ON(!domain); | ||
88 | |||
89 | irq_set_default_host(domain); | ||
90 | of_node_put(node); | ||
91 | /* Load the initial ienable value */ | ||
92 | ienable = RDCTL(CTL_IENABLE); | ||
93 | } | ||
diff --git a/arch/nios2/kernel/misaligned.c b/arch/nios2/kernel/misaligned.c new file mode 100644 index 000000000000..4e5907a0cabe --- /dev/null +++ b/arch/nios2/kernel/misaligned.c | |||
@@ -0,0 +1,256 @@ | |||
1 | /* | ||
2 | * linux/arch/nios2/kernel/misaligned.c | ||
3 | * | ||
4 | * basic emulation for mis-aligned accesses on the NIOS II cpu | ||
5 | * modelled after the version for arm in arm/alignment.c | ||
6 | * | ||
7 | * Brad Parker <brad@heeltoe.com> | ||
8 | * Copyright (C) 2010 Ambient Corporation | ||
9 | * Copyright (c) 2010 Altera Corporation, San Jose, California, USA. | ||
10 | * Copyright (c) 2010 Arrow Electronics, Inc. | ||
11 | * | ||
12 | * This file is subject to the terms and conditions of the GNU General | ||
13 | * Public License. See the file COPYING in the main directory of | ||
14 | * this archive for more details. | ||
15 | */ | ||
16 | |||
17 | #include <linux/errno.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/proc_fs.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/uaccess.h> | ||
23 | #include <linux/seq_file.h> | ||
24 | |||
25 | #include <asm/traps.h> | ||
26 | #include <asm/unaligned.h> | ||
27 | |||
28 | /* instructions we emulate */ | ||
29 | #define INST_LDHU 0x0b | ||
30 | #define INST_STH 0x0d | ||
31 | #define INST_LDH 0x0f | ||
32 | #define INST_STW 0x15 | ||
33 | #define INST_LDW 0x17 | ||
34 | |||
35 | static unsigned long ma_user, ma_kern, ma_skipped, ma_half, ma_word; | ||
36 | |||
37 | static unsigned int ma_usermode; | ||
38 | #define UM_WARN 0x01 | ||
39 | #define UM_FIXUP 0x02 | ||
40 | #define UM_SIGNAL 0x04 | ||
41 | #define KM_WARN 0x08 | ||
42 | |||
43 | /* see arch/nios2/include/asm/ptrace.h */ | ||
44 | static u8 sys_stack_frame_reg_offset[] = { | ||
45 | /* struct pt_regs */ | ||
46 | 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 0, | ||
47 | /* struct switch_stack */ | ||
48 | 16, 17, 18, 19, 20, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 0 | ||
49 | }; | ||
50 | |||
51 | static int reg_offsets[32]; | ||
52 | |||
53 | static inline u32 get_reg_val(struct pt_regs *fp, int reg) | ||
54 | { | ||
55 | u8 *p = ((u8 *)fp) + reg_offsets[reg]; | ||
56 | |||
57 | return *(u32 *)p; | ||
58 | } | ||
59 | |||
60 | static inline void put_reg_val(struct pt_regs *fp, int reg, u32 val) | ||
61 | { | ||
62 | u8 *p = ((u8 *)fp) + reg_offsets[reg]; | ||
63 | *(u32 *)p = val; | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * (mis)alignment handler | ||
68 | */ | ||
69 | asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause) | ||
70 | { | ||
71 | u32 isn, addr, val; | ||
72 | int in_kernel; | ||
73 | u8 a, b, d0, d1, d2, d3; | ||
74 | u16 imm16; | ||
75 | unsigned int fault; | ||
76 | |||
77 | /* back up one instruction */ | ||
78 | fp->ea -= 4; | ||
79 | |||
80 | if (fixup_exception(fp)) { | ||
81 | ma_skipped++; | ||
82 | return; | ||
83 | } | ||
84 | |||
85 | in_kernel = !user_mode(fp); | ||
86 | |||
87 | isn = *(unsigned long *)(fp->ea); | ||
88 | |||
89 | fault = 0; | ||
90 | |||
91 | /* do fixup if in kernel or mode turned on */ | ||
92 | if (in_kernel || (ma_usermode & UM_FIXUP)) { | ||
93 | /* decompose instruction */ | ||
94 | a = (isn >> 27) & 0x1f; | ||
95 | b = (isn >> 22) & 0x1f; | ||
96 | imm16 = (isn >> 6) & 0xffff; | ||
97 | addr = get_reg_val(fp, a) + imm16; | ||
98 | |||
99 | /* do fixup to saved registers */ | ||
100 | switch (isn & 0x3f) { | ||
101 | case INST_LDHU: | ||
102 | fault |= __get_user(d0, (u8 *)(addr+0)); | ||
103 | fault |= __get_user(d1, (u8 *)(addr+1)); | ||
104 | val = (d1 << 8) | d0; | ||
105 | put_reg_val(fp, b, val); | ||
106 | ma_half++; | ||
107 | break; | ||
108 | case INST_STH: | ||
109 | val = get_reg_val(fp, b); | ||
110 | d1 = val >> 8; | ||
111 | d0 = val >> 0; | ||
112 | |||
113 | pr_debug("sth: ra=%d (%08x) rb=%d (%08x), imm16 %04x addr %08x val %08x\n", | ||
114 | a, get_reg_val(fp, a), | ||
115 | b, get_reg_val(fp, b), | ||
116 | imm16, addr, val); | ||
117 | |||
118 | if (in_kernel) { | ||
119 | *(u8 *)(addr+0) = d0; | ||
120 | *(u8 *)(addr+1) = d1; | ||
121 | } else { | ||
122 | fault |= __put_user(d0, (u8 *)(addr+0)); | ||
123 | fault |= __put_user(d1, (u8 *)(addr+1)); | ||
124 | } | ||
125 | ma_half++; | ||
126 | break; | ||
127 | case INST_LDH: | ||
128 | fault |= __get_user(d0, (u8 *)(addr+0)); | ||
129 | fault |= __get_user(d1, (u8 *)(addr+1)); | ||
130 | val = (short)((d1 << 8) | d0); | ||
131 | put_reg_val(fp, b, val); | ||
132 | ma_half++; | ||
133 | break; | ||
134 | case INST_STW: | ||
135 | val = get_reg_val(fp, b); | ||
136 | d3 = val >> 24; | ||
137 | d2 = val >> 16; | ||
138 | d1 = val >> 8; | ||
139 | d0 = val >> 0; | ||
140 | if (in_kernel) { | ||
141 | *(u8 *)(addr+0) = d0; | ||
142 | *(u8 *)(addr+1) = d1; | ||
143 | *(u8 *)(addr+2) = d2; | ||
144 | *(u8 *)(addr+3) = d3; | ||
145 | } else { | ||
146 | fault |= __put_user(d0, (u8 *)(addr+0)); | ||
147 | fault |= __put_user(d1, (u8 *)(addr+1)); | ||
148 | fault |= __put_user(d2, (u8 *)(addr+2)); | ||
149 | fault |= __put_user(d3, (u8 *)(addr+3)); | ||
150 | } | ||
151 | ma_word++; | ||
152 | break; | ||
153 | case INST_LDW: | ||
154 | fault |= __get_user(d0, (u8 *)(addr+0)); | ||
155 | fault |= __get_user(d1, (u8 *)(addr+1)); | ||
156 | fault |= __get_user(d2, (u8 *)(addr+2)); | ||
157 | fault |= __get_user(d3, (u8 *)(addr+3)); | ||
158 | val = (d3 << 24) | (d2 << 16) | (d1 << 8) | d0; | ||
159 | put_reg_val(fp, b, val); | ||
160 | ma_word++; | ||
161 | break; | ||
162 | } | ||
163 | } | ||
164 | |||
165 | addr = RDCTL(CTL_BADADDR); | ||
166 | cause >>= 2; | ||
167 | |||
168 | if (fault) { | ||
169 | if (in_kernel) { | ||
170 | pr_err("fault during kernel misaligned fixup @ %#lx; addr 0x%08x; isn=0x%08x\n", | ||
171 | fp->ea, (unsigned int)addr, | ||
172 | (unsigned int)isn); | ||
173 | } else { | ||
174 | pr_err("fault during user misaligned fixup @ %#lx; isn=%08x addr=0x%08x sp=0x%08lx pid=%d\n", | ||
175 | fp->ea, | ||
176 | (unsigned int)isn, addr, fp->sp, | ||
177 | current->pid); | ||
178 | |||
179 | _exception(SIGSEGV, fp, SEGV_MAPERR, fp->ea); | ||
180 | return; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | /* | ||
185 | * kernel mode - | ||
186 | * note exception and skip bad instruction (return) | ||
187 | */ | ||
188 | if (in_kernel) { | ||
189 | ma_kern++; | ||
190 | fp->ea += 4; | ||
191 | |||
192 | if (ma_usermode & KM_WARN) { | ||
193 | pr_err("kernel unaligned access @ %#lx; BADADDR 0x%08x; cause=%d, isn=0x%08x\n", | ||
194 | fp->ea, | ||
195 | (unsigned int)addr, cause, | ||
196 | (unsigned int)isn); | ||
197 | /* show_regs(fp); */ | ||
198 | } | ||
199 | |||
200 | return; | ||
201 | } | ||
202 | |||
203 | ma_user++; | ||
204 | |||
205 | /* | ||
206 | * user mode - | ||
207 | * possibly warn, | ||
208 | * possibly send SIGBUS signal to process | ||
209 | */ | ||
210 | if (ma_usermode & UM_WARN) { | ||
211 | pr_err("user unaligned access @ %#lx; isn=0x%08lx ea=0x%08lx ra=0x%08lx sp=0x%08lx\n", | ||
212 | (unsigned long)addr, (unsigned long)isn, | ||
213 | fp->ea, fp->ra, fp->sp); | ||
214 | } | ||
215 | |||
216 | if (ma_usermode & UM_SIGNAL) | ||
217 | _exception(SIGBUS, fp, BUS_ADRALN, fp->ea); | ||
218 | else | ||
219 | fp->ea += 4; /* else advance */ | ||
220 | } | ||
221 | |||
222 | static void __init misaligned_calc_reg_offsets(void) | ||
223 | { | ||
224 | int i, r, offset; | ||
225 | |||
226 | /* pre-calc offsets of registers on sys call stack frame */ | ||
227 | offset = 0; | ||
228 | |||
229 | /* struct pt_regs */ | ||
230 | for (i = 0; i < 16; i++) { | ||
231 | r = sys_stack_frame_reg_offset[i]; | ||
232 | reg_offsets[r] = offset; | ||
233 | offset += 4; | ||
234 | } | ||
235 | |||
236 | /* struct switch_stack */ | ||
237 | offset = -sizeof(struct switch_stack); | ||
238 | for (i = 16; i < 32; i++) { | ||
239 | r = sys_stack_frame_reg_offset[i]; | ||
240 | reg_offsets[r] = offset; | ||
241 | offset += 4; | ||
242 | } | ||
243 | } | ||
244 | |||
245 | |||
246 | static int __init misaligned_init(void) | ||
247 | { | ||
248 | /* default mode - silent fix */ | ||
249 | ma_usermode = UM_FIXUP | KM_WARN; | ||
250 | |||
251 | misaligned_calc_reg_offsets(); | ||
252 | |||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | fs_initcall(misaligned_init); | ||
diff --git a/arch/nios2/kernel/module.c b/arch/nios2/kernel/module.c new file mode 100644 index 000000000000..cc924a38f22a --- /dev/null +++ b/arch/nios2/kernel/module.c | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * Kernel module support for Nios II. | ||
3 | * | ||
4 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
5 | * Written by Wentao Xu <xuwentao@microtronix.com> | ||
6 | * Copyright (C) 2001, 2003 Rusty Russell | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General | ||
9 | * Public License. See the file COPYING in the main directory of this | ||
10 | * archive for more details. | ||
11 | */ | ||
12 | |||
13 | #include <linux/moduleloader.h> | ||
14 | #include <linux/elf.h> | ||
15 | #include <linux/mm.h> | ||
16 | #include <linux/vmalloc.h> | ||
17 | #include <linux/slab.h> | ||
18 | #include <linux/fs.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/kernel.h> | ||
21 | |||
22 | #include <asm/pgtable.h> | ||
23 | #include <asm/cacheflush.h> | ||
24 | |||
25 | /* | ||
26 | * Modules should NOT be allocated with kmalloc for (obvious) reasons. | ||
27 | * But we do it for now to avoid relocation issues. CALL26/PCREL26 cannot reach | ||
28 | * from 0x80000000 (vmalloc area) to 0xc00000000 (kernel) (kmalloc returns | ||
29 | * addresses in 0xc0000000) | ||
30 | */ | ||
31 | void *module_alloc(unsigned long size) | ||
32 | { | ||
33 | if (size == 0) | ||
34 | return NULL; | ||
35 | return kmalloc(size, GFP_KERNEL); | ||
36 | } | ||
37 | |||
38 | /* Free memory returned from module_alloc */ | ||
39 | void module_free(struct module *mod, void *module_region) | ||
40 | { | ||
41 | kfree(module_region); | ||
42 | } | ||
43 | |||
44 | int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | ||
45 | unsigned int symindex, unsigned int relsec, | ||
46 | struct module *mod) | ||
47 | { | ||
48 | unsigned int i; | ||
49 | Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; | ||
50 | |||
51 | pr_debug("Applying relocate section %u to %u\n", relsec, | ||
52 | sechdrs[relsec].sh_info); | ||
53 | |||
54 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) { | ||
55 | /* This is where to make the change */ | ||
56 | uint32_t word; | ||
57 | uint32_t *loc | ||
58 | = ((void *)sechdrs[sechdrs[relsec].sh_info].sh_addr | ||
59 | + rela[i].r_offset); | ||
60 | /* This is the symbol it is referring to. Note that all | ||
61 | undefined symbols have been resolved. */ | ||
62 | Elf32_Sym *sym | ||
63 | = ((Elf32_Sym *)sechdrs[symindex].sh_addr | ||
64 | + ELF32_R_SYM(rela[i].r_info)); | ||
65 | uint32_t v = sym->st_value + rela[i].r_addend; | ||
66 | |||
67 | pr_debug("reltype %d 0x%x name:<%s>\n", | ||
68 | ELF32_R_TYPE(rela[i].r_info), | ||
69 | rela[i].r_offset, strtab + sym->st_name); | ||
70 | |||
71 | switch (ELF32_R_TYPE(rela[i].r_info)) { | ||
72 | case R_NIOS2_NONE: | ||
73 | break; | ||
74 | case R_NIOS2_BFD_RELOC_32: | ||
75 | *loc += v; | ||
76 | break; | ||
77 | case R_NIOS2_PCREL16: | ||
78 | v -= (uint32_t)loc + 4; | ||
79 | if ((int32_t)v > 0x7fff || | ||
80 | (int32_t)v < -(int32_t)0x8000) { | ||
81 | pr_err("module %s: relocation overflow\n", | ||
82 | mod->name); | ||
83 | return -ENOEXEC; | ||
84 | } | ||
85 | word = *loc; | ||
86 | *loc = ((((word >> 22) << 16) | (v & 0xffff)) << 6) | | ||
87 | (word & 0x3f); | ||
88 | break; | ||
89 | case R_NIOS2_CALL26: | ||
90 | if (v & 3) { | ||
91 | pr_err("module %s: dangerous relocation\n", | ||
92 | mod->name); | ||
93 | return -ENOEXEC; | ||
94 | } | ||
95 | if ((v >> 28) != ((uint32_t)loc >> 28)) { | ||
96 | pr_err("module %s: relocation overflow\n", | ||
97 | mod->name); | ||
98 | return -ENOEXEC; | ||
99 | } | ||
100 | *loc = (*loc & 0x3f) | ((v >> 2) << 6); | ||
101 | break; | ||
102 | case R_NIOS2_HI16: | ||
103 | word = *loc; | ||
104 | *loc = ((((word >> 22) << 16) | | ||
105 | ((v >> 16) & 0xffff)) << 6) | (word & 0x3f); | ||
106 | break; | ||
107 | case R_NIOS2_LO16: | ||
108 | word = *loc; | ||
109 | *loc = ((((word >> 22) << 16) | (v & 0xffff)) << 6) | | ||
110 | (word & 0x3f); | ||
111 | break; | ||
112 | case R_NIOS2_HIADJ16: | ||
113 | { | ||
114 | Elf32_Addr word2; | ||
115 | |||
116 | word = *loc; | ||
117 | word2 = ((v >> 16) + ((v >> 15) & 1)) & 0xffff; | ||
118 | *loc = ((((word >> 22) << 16) | word2) << 6) | | ||
119 | (word & 0x3f); | ||
120 | } | ||
121 | break; | ||
122 | |||
123 | default: | ||
124 | pr_err("module %s: Unknown reloc: %u\n", | ||
125 | mod->name, ELF32_R_TYPE(rela[i].r_info)); | ||
126 | return -ENOEXEC; | ||
127 | } | ||
128 | } | ||
129 | |||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, | ||
134 | struct module *me) | ||
135 | { | ||
136 | flush_cache_all(); | ||
137 | return 0; | ||
138 | } | ||
diff --git a/arch/nios2/kernel/nios2_ksyms.c b/arch/nios2/kernel/nios2_ksyms.c new file mode 100644 index 000000000000..bf2f55d10a4d --- /dev/null +++ b/arch/nios2/kernel/nios2_ksyms.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file COPYING in the main directory of this | ||
6 | * archive for more details. | ||
7 | */ | ||
8 | |||
9 | #include <linux/export.h> | ||
10 | #include <linux/string.h> | ||
11 | |||
12 | /* string functions */ | ||
13 | |||
14 | EXPORT_SYMBOL(memcpy); | ||
15 | EXPORT_SYMBOL(memset); | ||
16 | EXPORT_SYMBOL(memmove); | ||
17 | |||
18 | /* | ||
19 | * libgcc functions - functions that are used internally by the | ||
20 | * compiler... (prototypes are not correct though, but that | ||
21 | * doesn't really matter since they're not versioned). | ||
22 | */ | ||
23 | #define DECLARE_EXPORT(name) extern void name(void); EXPORT_SYMBOL(name) | ||
24 | |||
25 | DECLARE_EXPORT(__gcc_bcmp); | ||
26 | DECLARE_EXPORT(__divsi3); | ||
27 | DECLARE_EXPORT(__moddi3); | ||
28 | DECLARE_EXPORT(__modsi3); | ||
29 | DECLARE_EXPORT(__udivmoddi4); | ||
30 | DECLARE_EXPORT(__udivsi3); | ||
31 | DECLARE_EXPORT(__umoddi3); | ||
32 | DECLARE_EXPORT(__umodsi3); | ||
33 | DECLARE_EXPORT(__muldi3); | ||
diff --git a/arch/nios2/kernel/process.c b/arch/nios2/kernel/process.c new file mode 100644 index 000000000000..0e075b5ad2a5 --- /dev/null +++ b/arch/nios2/kernel/process.c | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * Architecture-dependent parts of process handling. | ||
3 | * | ||
4 | * Copyright (C) 2013 Altera Corporation | ||
5 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
6 | * Copyright (C) 2009 Wind River Systems Inc | ||
7 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
8 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/export.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/tick.h> | ||
18 | #include <linux/uaccess.h> | ||
19 | |||
20 | #include <asm/unistd.h> | ||
21 | #include <asm/traps.h> | ||
22 | #include <asm/cpuinfo.h> | ||
23 | |||
24 | asmlinkage void ret_from_fork(void); | ||
25 | asmlinkage void ret_from_kernel_thread(void); | ||
26 | |||
27 | void (*pm_power_off)(void) = NULL; | ||
28 | EXPORT_SYMBOL(pm_power_off); | ||
29 | |||
30 | void arch_cpu_idle(void) | ||
31 | { | ||
32 | local_irq_enable(); | ||
33 | } | ||
34 | |||
35 | /* | ||
36 | * The development boards have no way to pull a board reset. Just jump to the | ||
37 | * cpu reset address and let the boot loader or the code in head.S take care of | ||
38 | * resetting peripherals. | ||
39 | */ | ||
40 | void machine_restart(char *__unused) | ||
41 | { | ||
42 | pr_notice("Machine restart (%08x)...\n", cpuinfo.reset_addr); | ||
43 | local_irq_disable(); | ||
44 | __asm__ __volatile__ ( | ||
45 | "jmp %0\n\t" | ||
46 | : | ||
47 | : "r" (cpuinfo.reset_addr) | ||
48 | : "r4"); | ||
49 | } | ||
50 | |||
51 | void machine_halt(void) | ||
52 | { | ||
53 | pr_notice("Machine halt...\n"); | ||
54 | local_irq_disable(); | ||
55 | for (;;) | ||
56 | ; | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | * There is no way to power off the development boards. So just spin for now. If | ||
61 | * we ever have a way of resetting a board using a GPIO we should add that here. | ||
62 | */ | ||
63 | void machine_power_off(void) | ||
64 | { | ||
65 | pr_notice("Machine power off...\n"); | ||
66 | local_irq_disable(); | ||
67 | for (;;) | ||
68 | ; | ||
69 | } | ||
70 | |||
71 | void show_regs(struct pt_regs *regs) | ||
72 | { | ||
73 | pr_notice("\n"); | ||
74 | show_regs_print_info(KERN_DEFAULT); | ||
75 | |||
76 | pr_notice("r1: %08lx r2: %08lx r3: %08lx r4: %08lx\n", | ||
77 | regs->r1, regs->r2, regs->r3, regs->r4); | ||
78 | |||
79 | pr_notice("r5: %08lx r6: %08lx r7: %08lx r8: %08lx\n", | ||
80 | regs->r5, regs->r6, regs->r7, regs->r8); | ||
81 | |||
82 | pr_notice("r9: %08lx r10: %08lx r11: %08lx r12: %08lx\n", | ||
83 | regs->r9, regs->r10, regs->r11, regs->r12); | ||
84 | |||
85 | pr_notice("r13: %08lx r14: %08lx r15: %08lx\n", | ||
86 | regs->r13, regs->r14, regs->r15); | ||
87 | |||
88 | pr_notice("ra: %08lx fp: %08lx sp: %08lx gp: %08lx\n", | ||
89 | regs->ra, regs->fp, regs->sp, regs->gp); | ||
90 | |||
91 | pr_notice("ea: %08lx estatus: %08lx\n", | ||
92 | regs->ea, regs->estatus); | ||
93 | } | ||
94 | |||
95 | void flush_thread(void) | ||
96 | { | ||
97 | set_fs(USER_DS); | ||
98 | } | ||
99 | |||
100 | int copy_thread(unsigned long clone_flags, | ||
101 | unsigned long usp, unsigned long arg, struct task_struct *p) | ||
102 | { | ||
103 | struct pt_regs *childregs = task_pt_regs(p); | ||
104 | struct pt_regs *regs; | ||
105 | struct switch_stack *stack; | ||
106 | struct switch_stack *childstack = | ||
107 | ((struct switch_stack *)childregs) - 1; | ||
108 | |||
109 | if (unlikely(p->flags & PF_KTHREAD)) { | ||
110 | memset(childstack, 0, | ||
111 | sizeof(struct switch_stack) + sizeof(struct pt_regs)); | ||
112 | |||
113 | childstack->r16 = usp; /* fn */ | ||
114 | childstack->r17 = arg; | ||
115 | childstack->ra = (unsigned long) ret_from_kernel_thread; | ||
116 | childregs->estatus = STATUS_PIE; | ||
117 | childregs->sp = (unsigned long) childstack; | ||
118 | |||
119 | p->thread.ksp = (unsigned long) childstack; | ||
120 | p->thread.kregs = childregs; | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | regs = current_pt_regs(); | ||
125 | *childregs = *regs; | ||
126 | childregs->r2 = 0; /* Set the return value for the child. */ | ||
127 | childregs->r7 = 0; | ||
128 | |||
129 | stack = ((struct switch_stack *) regs) - 1; | ||
130 | *childstack = *stack; | ||
131 | childstack->ra = (unsigned long)ret_from_fork; | ||
132 | p->thread.kregs = childregs; | ||
133 | p->thread.ksp = (unsigned long) childstack; | ||
134 | |||
135 | if (usp) | ||
136 | childregs->sp = usp; | ||
137 | |||
138 | /* Initialize tls register. */ | ||
139 | if (clone_flags & CLONE_SETTLS) | ||
140 | childstack->r23 = regs->r8; | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | /* | ||
146 | * Generic dumping code. Used for panic and debug. | ||
147 | */ | ||
148 | void dump(struct pt_regs *fp) | ||
149 | { | ||
150 | unsigned long *sp; | ||
151 | unsigned char *tp; | ||
152 | int i; | ||
153 | |||
154 | pr_emerg("\nCURRENT PROCESS:\n\n"); | ||
155 | pr_emerg("COMM=%s PID=%d\n", current->comm, current->pid); | ||
156 | |||
157 | if (current->mm) { | ||
158 | pr_emerg("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n", | ||
159 | (int) current->mm->start_code, | ||
160 | (int) current->mm->end_code, | ||
161 | (int) current->mm->start_data, | ||
162 | (int) current->mm->end_data, | ||
163 | (int) current->mm->end_data, | ||
164 | (int) current->mm->brk); | ||
165 | pr_emerg("USER-STACK=%08x KERNEL-STACK=%08x\n\n", | ||
166 | (int) current->mm->start_stack, | ||
167 | (int)(((unsigned long) current) + THREAD_SIZE)); | ||
168 | } | ||
169 | |||
170 | pr_emerg("PC: %08lx\n", fp->ea); | ||
171 | pr_emerg("SR: %08lx SP: %08lx\n", | ||
172 | (long) fp->estatus, (long) fp); | ||
173 | |||
174 | pr_emerg("r1: %08lx r2: %08lx r3: %08lx\n", | ||
175 | fp->r1, fp->r2, fp->r3); | ||
176 | |||
177 | pr_emerg("r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n", | ||
178 | fp->r4, fp->r5, fp->r6, fp->r7); | ||
179 | pr_emerg("r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n", | ||
180 | fp->r8, fp->r9, fp->r10, fp->r11); | ||
181 | pr_emerg("r12: %08lx r13: %08lx r14: %08lx r15: %08lx\n", | ||
182 | fp->r12, fp->r13, fp->r14, fp->r15); | ||
183 | pr_emerg("or2: %08lx ra: %08lx fp: %08lx sp: %08lx\n", | ||
184 | fp->orig_r2, fp->ra, fp->fp, fp->sp); | ||
185 | pr_emerg("\nUSP: %08x TRAPFRAME: %08x\n", | ||
186 | (unsigned int) fp->sp, (unsigned int) fp); | ||
187 | |||
188 | pr_emerg("\nCODE:"); | ||
189 | tp = ((unsigned char *) fp->ea) - 0x20; | ||
190 | for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) { | ||
191 | if ((i % 0x10) == 0) | ||
192 | pr_emerg("\n%08x: ", (int) (tp + i)); | ||
193 | pr_emerg("%08x ", (int) *sp++); | ||
194 | } | ||
195 | pr_emerg("\n"); | ||
196 | |||
197 | pr_emerg("\nKERNEL STACK:"); | ||
198 | tp = ((unsigned char *) fp) - 0x40; | ||
199 | for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) { | ||
200 | if ((i % 0x10) == 0) | ||
201 | pr_emerg("\n%08x: ", (int) (tp + i)); | ||
202 | pr_emerg("%08x ", (int) *sp++); | ||
203 | } | ||
204 | pr_emerg("\n"); | ||
205 | pr_emerg("\n"); | ||
206 | |||
207 | pr_emerg("\nUSER STACK:"); | ||
208 | tp = (unsigned char *) (fp->sp - 0x10); | ||
209 | for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) { | ||
210 | if ((i % 0x10) == 0) | ||
211 | pr_emerg("\n%08x: ", (int) (tp + i)); | ||
212 | pr_emerg("%08x ", (int) *sp++); | ||
213 | } | ||
214 | pr_emerg("\n\n"); | ||
215 | } | ||
216 | |||
217 | unsigned long get_wchan(struct task_struct *p) | ||
218 | { | ||
219 | unsigned long fp, pc; | ||
220 | unsigned long stack_page; | ||
221 | int count = 0; | ||
222 | |||
223 | if (!p || p == current || p->state == TASK_RUNNING) | ||
224 | return 0; | ||
225 | |||
226 | stack_page = (unsigned long)p; | ||
227 | fp = ((struct switch_stack *)p->thread.ksp)->fp; /* ;dgt2 */ | ||
228 | do { | ||
229 | if (fp < stack_page+sizeof(struct task_struct) || | ||
230 | fp >= 8184+stack_page) /* ;dgt2;tmp */ | ||
231 | return 0; | ||
232 | pc = ((unsigned long *)fp)[1]; | ||
233 | if (!in_sched_functions(pc)) | ||
234 | return pc; | ||
235 | fp = *(unsigned long *) fp; | ||
236 | } while (count++ < 16); /* ;dgt2;tmp */ | ||
237 | return 0; | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * Do necessary setup to start up a newly executed thread. | ||
242 | * Will startup in user mode (status_extension = 0). | ||
243 | */ | ||
244 | void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp) | ||
245 | { | ||
246 | memset((void *) regs, 0, sizeof(struct pt_regs)); | ||
247 | regs->estatus = ESTATUS_EPIE | ESTATUS_EU; | ||
248 | regs->ea = pc; | ||
249 | regs->sp = sp; | ||
250 | } | ||
251 | |||
252 | #include <linux/elfcore.h> | ||
253 | |||
254 | /* Fill in the FPU structure for a core dump. */ | ||
255 | int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r) | ||
256 | { | ||
257 | return 0; /* Nios2 has no FPU and thus no FPU registers */ | ||
258 | } | ||
diff --git a/arch/nios2/kernel/prom.c b/arch/nios2/kernel/prom.c new file mode 100644 index 000000000000..0522d3378e3f --- /dev/null +++ b/arch/nios2/kernel/prom.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Device tree support | ||
3 | * | ||
4 | * Copyright (C) 2013 Altera Corporation | ||
5 | * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw> | ||
6 | * | ||
7 | * Based on MIPS support for CONFIG_OF device tree support | ||
8 | * | ||
9 | * Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #include <linux/init.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/bootmem.h> | ||
29 | #include <linux/of.h> | ||
30 | #include <linux/of_fdt.h> | ||
31 | #include <linux/io.h> | ||
32 | |||
33 | #include <asm/sections.h> | ||
34 | |||
35 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) | ||
36 | { | ||
37 | u64 kernel_start = (u64)virt_to_phys(_text); | ||
38 | |||
39 | if (!memory_size && | ||
40 | (kernel_start >= base) && (kernel_start < (base + size))) | ||
41 | memory_size = size; | ||
42 | |||
43 | } | ||
44 | |||
45 | void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | ||
46 | { | ||
47 | return alloc_bootmem_align(size, align); | ||
48 | } | ||
49 | |||
50 | void __init early_init_devtree(void *params) | ||
51 | { | ||
52 | __be32 *dtb = (u32 *)__dtb_start; | ||
53 | #if defined(CONFIG_NIOS2_DTB_AT_PHYS_ADDR) | ||
54 | if (be32_to_cpup((__be32 *)CONFIG_NIOS2_DTB_PHYS_ADDR) == | ||
55 | OF_DT_HEADER) { | ||
56 | params = (void *)CONFIG_NIOS2_DTB_PHYS_ADDR; | ||
57 | early_init_dt_scan(params); | ||
58 | return; | ||
59 | } | ||
60 | #endif | ||
61 | if (be32_to_cpu((__be32) *dtb) == OF_DT_HEADER) | ||
62 | params = (void *)__dtb_start; | ||
63 | |||
64 | early_init_dt_scan(params); | ||
65 | } | ||
diff --git a/arch/nios2/kernel/ptrace.c b/arch/nios2/kernel/ptrace.c new file mode 100644 index 000000000000..681dda92eff1 --- /dev/null +++ b/arch/nios2/kernel/ptrace.c | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Altera Corporation | ||
3 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General | ||
6 | * Public License. See the file COPYING in the main directory of this | ||
7 | * archive for more details. | ||
8 | */ | ||
9 | |||
10 | #include <linux/elf.h> | ||
11 | #include <linux/errno.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/mm.h> | ||
14 | #include <linux/ptrace.h> | ||
15 | #include <linux/regset.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/tracehook.h> | ||
18 | #include <linux/uaccess.h> | ||
19 | #include <linux/user.h> | ||
20 | |||
21 | static int genregs_get(struct task_struct *target, | ||
22 | const struct user_regset *regset, | ||
23 | unsigned int pos, unsigned int count, | ||
24 | void *kbuf, void __user *ubuf) | ||
25 | { | ||
26 | const struct pt_regs *regs = task_pt_regs(target); | ||
27 | const struct switch_stack *sw = (struct switch_stack *)regs - 1; | ||
28 | int ret = 0; | ||
29 | |||
30 | #define REG_O_ZERO_RANGE(START, END) \ | ||
31 | if (!ret) \ | ||
32 | ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, \ | ||
33 | START * 4, (END * 4) + 4); | ||
34 | |||
35 | #define REG_O_ONE(PTR, LOC) \ | ||
36 | if (!ret) \ | ||
37 | ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, PTR, \ | ||
38 | LOC * 4, (LOC * 4) + 4); | ||
39 | |||
40 | #define REG_O_RANGE(PTR, START, END) \ | ||
41 | if (!ret) \ | ||
42 | ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, PTR, \ | ||
43 | START * 4, (END * 4) + 4); | ||
44 | |||
45 | REG_O_ZERO_RANGE(PTR_R0, PTR_R0); | ||
46 | REG_O_RANGE(®s->r1, PTR_R1, PTR_R7); | ||
47 | REG_O_RANGE(®s->r8, PTR_R8, PTR_R15); | ||
48 | REG_O_RANGE(sw, PTR_R16, PTR_R23); | ||
49 | REG_O_ZERO_RANGE(PTR_R24, PTR_R25); /* et and bt */ | ||
50 | REG_O_ONE(®s->gp, PTR_GP); | ||
51 | REG_O_ONE(®s->sp, PTR_SP); | ||
52 | REG_O_ONE(®s->fp, PTR_FP); | ||
53 | REG_O_ONE(®s->ea, PTR_EA); | ||
54 | REG_O_ZERO_RANGE(PTR_BA, PTR_BA); | ||
55 | REG_O_ONE(®s->ra, PTR_RA); | ||
56 | REG_O_ONE(®s->ea, PTR_PC); /* use ea for PC */ | ||
57 | if (!ret) | ||
58 | ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, | ||
59 | PTR_STATUS * 4, -1); | ||
60 | |||
61 | return ret; | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * Set the thread state from a regset passed in via ptrace | ||
66 | */ | ||
67 | static int genregs_set(struct task_struct *target, | ||
68 | const struct user_regset *regset, | ||
69 | unsigned int pos, unsigned int count, | ||
70 | const void *kbuf, const void __user *ubuf) | ||
71 | { | ||
72 | struct pt_regs *regs = task_pt_regs(target); | ||
73 | const struct switch_stack *sw = (struct switch_stack *)regs - 1; | ||
74 | int ret = 0; | ||
75 | |||
76 | #define REG_IGNORE_RANGE(START, END) \ | ||
77 | if (!ret) \ | ||
78 | ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, \ | ||
79 | START * 4, (END * 4) + 4); | ||
80 | |||
81 | #define REG_IN_ONE(PTR, LOC) \ | ||
82 | if (!ret) \ | ||
83 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, \ | ||
84 | (void *)(PTR), LOC * 4, (LOC * 4) + 4); | ||
85 | |||
86 | #define REG_IN_RANGE(PTR, START, END) \ | ||
87 | if (!ret) \ | ||
88 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, \ | ||
89 | (void *)(PTR), START * 4, (END * 4) + 4); | ||
90 | |||
91 | REG_IGNORE_RANGE(PTR_R0, PTR_R0); | ||
92 | REG_IN_RANGE(®s->r1, PTR_R1, PTR_R7); | ||
93 | REG_IN_RANGE(®s->r8, PTR_R8, PTR_R15); | ||
94 | REG_IN_RANGE(sw, PTR_R16, PTR_R23); | ||
95 | REG_IGNORE_RANGE(PTR_R24, PTR_R25); /* et and bt */ | ||
96 | REG_IN_ONE(®s->gp, PTR_GP); | ||
97 | REG_IN_ONE(®s->sp, PTR_SP); | ||
98 | REG_IN_ONE(®s->fp, PTR_FP); | ||
99 | REG_IN_ONE(®s->ea, PTR_EA); | ||
100 | REG_IGNORE_RANGE(PTR_BA, PTR_BA); | ||
101 | REG_IN_ONE(®s->ra, PTR_RA); | ||
102 | REG_IN_ONE(®s->ea, PTR_PC); /* use ea for PC */ | ||
103 | if (!ret) | ||
104 | ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, | ||
105 | PTR_STATUS * 4, -1); | ||
106 | |||
107 | return ret; | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * Define the register sets available on Nios2 under Linux | ||
112 | */ | ||
113 | enum nios2_regset { | ||
114 | REGSET_GENERAL, | ||
115 | }; | ||
116 | |||
117 | static const struct user_regset nios2_regsets[] = { | ||
118 | [REGSET_GENERAL] = { | ||
119 | .core_note_type = NT_PRSTATUS, | ||
120 | .n = NUM_PTRACE_REG, | ||
121 | .size = sizeof(unsigned long), | ||
122 | .align = sizeof(unsigned long), | ||
123 | .get = genregs_get, | ||
124 | .set = genregs_set, | ||
125 | } | ||
126 | }; | ||
127 | |||
128 | static const struct user_regset_view nios2_user_view = { | ||
129 | .name = "nios2", | ||
130 | .e_machine = ELF_ARCH, | ||
131 | .ei_osabi = ELF_OSABI, | ||
132 | .regsets = nios2_regsets, | ||
133 | .n = ARRAY_SIZE(nios2_regsets) | ||
134 | }; | ||
135 | |||
136 | const struct user_regset_view *task_user_regset_view(struct task_struct *task) | ||
137 | { | ||
138 | return &nios2_user_view; | ||
139 | } | ||
140 | |||
141 | void ptrace_disable(struct task_struct *child) | ||
142 | { | ||
143 | |||
144 | } | ||
145 | |||
146 | long arch_ptrace(struct task_struct *child, long request, unsigned long addr, | ||
147 | unsigned long data) | ||
148 | { | ||
149 | return ptrace_request(child, request, addr, data); | ||
150 | } | ||
151 | |||
152 | asmlinkage int do_syscall_trace_enter(void) | ||
153 | { | ||
154 | int ret = 0; | ||
155 | |||
156 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | ||
157 | ret = tracehook_report_syscall_entry(task_pt_regs(current)); | ||
158 | |||
159 | return ret; | ||
160 | } | ||
161 | |||
162 | asmlinkage void do_syscall_trace_exit(void) | ||
163 | { | ||
164 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | ||
165 | tracehook_report_syscall_exit(task_pt_regs(current), 0); | ||
166 | } | ||
diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c new file mode 100644 index 000000000000..cb3121f975d4 --- /dev/null +++ b/arch/nios2/kernel/setup.c | |||
@@ -0,0 +1,218 @@ | |||
1 | /* | ||
2 | * Nios2-specific parts of system setup | ||
3 | * | ||
4 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
5 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
6 | * Copyright (C) 2001 Vic Phillips <vic@microtronix.com> | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | |||
13 | #include <linux/export.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/mm.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/console.h> | ||
18 | #include <linux/bootmem.h> | ||
19 | #include <linux/initrd.h> | ||
20 | #include <linux/of_fdt.h> | ||
21 | |||
22 | #include <asm/mmu_context.h> | ||
23 | #include <asm/sections.h> | ||
24 | #include <asm/setup.h> | ||
25 | #include <asm/cpuinfo.h> | ||
26 | |||
27 | unsigned long memory_start; | ||
28 | EXPORT_SYMBOL(memory_start); | ||
29 | |||
30 | unsigned long memory_end; | ||
31 | EXPORT_SYMBOL(memory_end); | ||
32 | |||
33 | unsigned long memory_size; | ||
34 | |||
35 | static struct pt_regs fake_regs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
36 | 0, 0, 0, 0, 0, 0, | ||
37 | 0}; | ||
38 | |||
39 | /* Copy a short hook instruction sequence to the exception address */ | ||
40 | static inline void copy_exception_handler(unsigned int addr) | ||
41 | { | ||
42 | unsigned int start = (unsigned int) exception_handler_hook; | ||
43 | volatile unsigned int tmp = 0; | ||
44 | |||
45 | if (start == addr) { | ||
46 | /* The CPU exception address already points to the handler. */ | ||
47 | return; | ||
48 | } | ||
49 | |||
50 | __asm__ __volatile__ ( | ||
51 | "ldw %2,0(%0)\n" | ||
52 | "stw %2,0(%1)\n" | ||
53 | "ldw %2,4(%0)\n" | ||
54 | "stw %2,4(%1)\n" | ||
55 | "ldw %2,8(%0)\n" | ||
56 | "stw %2,8(%1)\n" | ||
57 | "flushd 0(%1)\n" | ||
58 | "flushd 4(%1)\n" | ||
59 | "flushd 8(%1)\n" | ||
60 | "flushi %1\n" | ||
61 | "addi %1,%1,4\n" | ||
62 | "flushi %1\n" | ||
63 | "addi %1,%1,4\n" | ||
64 | "flushi %1\n" | ||
65 | "flushp\n" | ||
66 | : /* no output registers */ | ||
67 | : "r" (start), "r" (addr), "r" (tmp) | ||
68 | : "memory" | ||
69 | ); | ||
70 | } | ||
71 | |||
72 | /* Copy the fast TLB miss handler */ | ||
73 | static inline void copy_fast_tlb_miss_handler(unsigned int addr) | ||
74 | { | ||
75 | unsigned int start = (unsigned int) fast_handler; | ||
76 | unsigned int end = (unsigned int) fast_handler_end; | ||
77 | volatile unsigned int tmp = 0; | ||
78 | |||
79 | __asm__ __volatile__ ( | ||
80 | "1:\n" | ||
81 | " ldw %3,0(%0)\n" | ||
82 | " stw %3,0(%1)\n" | ||
83 | " flushd 0(%1)\n" | ||
84 | " flushi %1\n" | ||
85 | " flushp\n" | ||
86 | " addi %0,%0,4\n" | ||
87 | " addi %1,%1,4\n" | ||
88 | " bne %0,%2,1b\n" | ||
89 | : /* no output registers */ | ||
90 | : "r" (start), "r" (addr), "r" (end), "r" (tmp) | ||
91 | : "memory" | ||
92 | ); | ||
93 | } | ||
94 | |||
95 | /* | ||
96 | * save args passed from u-boot, called from head.S | ||
97 | * | ||
98 | * @r4: NIOS magic | ||
99 | * @r5: initrd start | ||
100 | * @r6: initrd end or fdt | ||
101 | * @r7: kernel command line | ||
102 | */ | ||
103 | asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6, | ||
104 | unsigned r7) | ||
105 | { | ||
106 | unsigned dtb_passed = 0; | ||
107 | char cmdline_passed[COMMAND_LINE_SIZE] = { 0, }; | ||
108 | |||
109 | #if defined(CONFIG_NIOS2_PASS_CMDLINE) | ||
110 | if (r4 == 0x534f494e) { /* r4 is magic NIOS */ | ||
111 | #if defined(CONFIG_BLK_DEV_INITRD) | ||
112 | if (r5) { /* initramfs */ | ||
113 | initrd_start = r5; | ||
114 | initrd_end = r6; | ||
115 | } | ||
116 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
117 | dtb_passed = r6; | ||
118 | |||
119 | if (r7) | ||
120 | strncpy(cmdline_passed, (char *)r7, COMMAND_LINE_SIZE); | ||
121 | } | ||
122 | #endif | ||
123 | |||
124 | early_init_devtree((void *)dtb_passed); | ||
125 | |||
126 | #ifndef CONFIG_CMDLINE_FORCE | ||
127 | if (cmdline_passed[0]) | ||
128 | strncpy(boot_command_line, cmdline_passed, COMMAND_LINE_SIZE); | ||
129 | #ifdef CONFIG_NIOS2_CMDLINE_IGNORE_DTB | ||
130 | else | ||
131 | strncpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
132 | #endif | ||
133 | #endif | ||
134 | } | ||
135 | |||
136 | void __init setup_arch(char **cmdline_p) | ||
137 | { | ||
138 | int bootmap_size; | ||
139 | |||
140 | console_verbose(); | ||
141 | |||
142 | memory_start = PAGE_ALIGN((unsigned long)__pa(_end)); | ||
143 | memory_end = (unsigned long) CONFIG_NIOS2_MEM_BASE + memory_size; | ||
144 | |||
145 | init_mm.start_code = (unsigned long) _stext; | ||
146 | init_mm.end_code = (unsigned long) _etext; | ||
147 | init_mm.end_data = (unsigned long) _edata; | ||
148 | init_mm.brk = (unsigned long) _end; | ||
149 | init_task.thread.kregs = &fake_regs; | ||
150 | |||
151 | /* Keep a copy of command line */ | ||
152 | *cmdline_p = boot_command_line; | ||
153 | |||
154 | min_low_pfn = PFN_UP(memory_start); | ||
155 | max_low_pfn = PFN_DOWN(memory_end); | ||
156 | max_mapnr = max_low_pfn; | ||
157 | |||
158 | /* | ||
159 | * give all the memory to the bootmap allocator, tell it to put the | ||
160 | * boot mem_map at the start of memory | ||
161 | */ | ||
162 | pr_debug("init_bootmem_node(?,%#lx, %#x, %#lx)\n", | ||
163 | min_low_pfn, PFN_DOWN(PHYS_OFFSET), max_low_pfn); | ||
164 | bootmap_size = init_bootmem_node(NODE_DATA(0), | ||
165 | min_low_pfn, PFN_DOWN(PHYS_OFFSET), | ||
166 | max_low_pfn); | ||
167 | |||
168 | /* | ||
169 | * free the usable memory, we have to make sure we do not free | ||
170 | * the bootmem bitmap so we then reserve it after freeing it :-) | ||
171 | */ | ||
172 | pr_debug("free_bootmem(%#lx, %#lx)\n", | ||
173 | memory_start, memory_end - memory_start); | ||
174 | free_bootmem(memory_start, memory_end - memory_start); | ||
175 | |||
176 | /* | ||
177 | * Reserve the bootmem bitmap itself as well. We do this in two | ||
178 | * steps (first step was init_bootmem()) because this catches | ||
179 | * the (very unlikely) case of us accidentally initializing the | ||
180 | * bootmem allocator with an invalid RAM area. | ||
181 | * | ||
182 | * Arguments are start, size | ||
183 | */ | ||
184 | pr_debug("reserve_bootmem(%#lx, %#x)\n", memory_start, bootmap_size); | ||
185 | reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT); | ||
186 | |||
187 | #ifdef CONFIG_BLK_DEV_INITRD | ||
188 | if (initrd_start) { | ||
189 | reserve_bootmem(virt_to_phys((void *)initrd_start), | ||
190 | initrd_end - initrd_start, BOOTMEM_DEFAULT); | ||
191 | } | ||
192 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
193 | |||
194 | unflatten_and_copy_device_tree(); | ||
195 | |||
196 | setup_cpuinfo(); | ||
197 | |||
198 | copy_exception_handler(cpuinfo.exception_addr); | ||
199 | |||
200 | mmu_init(); | ||
201 | |||
202 | copy_fast_tlb_miss_handler(cpuinfo.fast_tlb_miss_exc_addr); | ||
203 | |||
204 | /* | ||
205 | * Initialize MMU context handling here because data from cpuinfo is | ||
206 | * needed for this. | ||
207 | */ | ||
208 | mmu_context_init(); | ||
209 | |||
210 | /* | ||
211 | * get kmalloc into gear | ||
212 | */ | ||
213 | paging_init(); | ||
214 | |||
215 | #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) | ||
216 | conswitchp = &dummy_con; | ||
217 | #endif | ||
218 | } | ||
diff --git a/arch/nios2/kernel/signal.c b/arch/nios2/kernel/signal.c new file mode 100644 index 000000000000..f9d27883a714 --- /dev/null +++ b/arch/nios2/kernel/signal.c | |||
@@ -0,0 +1,323 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013-2014 Altera Corporation | ||
3 | * Copyright (C) 2011-2012 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
5 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file COPYING in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | |||
12 | #include <linux/signal.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/ptrace.h> | ||
15 | #include <linux/uaccess.h> | ||
16 | #include <linux/unistd.h> | ||
17 | #include <linux/personality.h> | ||
18 | #include <linux/tracehook.h> | ||
19 | |||
20 | #include <asm/ucontext.h> | ||
21 | #include <asm/cacheflush.h> | ||
22 | |||
23 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
24 | |||
25 | /* | ||
26 | * Do a signal return; undo the signal stack. | ||
27 | * | ||
28 | * Keep the return code on the stack quadword aligned! | ||
29 | * That makes the cache flush below easier. | ||
30 | */ | ||
31 | |||
32 | struct rt_sigframe { | ||
33 | struct siginfo info; | ||
34 | struct ucontext uc; | ||
35 | }; | ||
36 | |||
37 | static inline int rt_restore_ucontext(struct pt_regs *regs, | ||
38 | struct switch_stack *sw, | ||
39 | struct ucontext *uc, int *pr2) | ||
40 | { | ||
41 | int temp; | ||
42 | greg_t *gregs = uc->uc_mcontext.gregs; | ||
43 | int err; | ||
44 | |||
45 | /* Always make any pending restarted system calls return -EINTR */ | ||
46 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | ||
47 | |||
48 | err = __get_user(temp, &uc->uc_mcontext.version); | ||
49 | if (temp != MCONTEXT_VERSION) | ||
50 | goto badframe; | ||
51 | /* restore passed registers */ | ||
52 | err |= __get_user(regs->r1, &gregs[0]); | ||
53 | err |= __get_user(regs->r2, &gregs[1]); | ||
54 | err |= __get_user(regs->r3, &gregs[2]); | ||
55 | err |= __get_user(regs->r4, &gregs[3]); | ||
56 | err |= __get_user(regs->r5, &gregs[4]); | ||
57 | err |= __get_user(regs->r6, &gregs[5]); | ||
58 | err |= __get_user(regs->r7, &gregs[6]); | ||
59 | err |= __get_user(regs->r8, &gregs[7]); | ||
60 | err |= __get_user(regs->r9, &gregs[8]); | ||
61 | err |= __get_user(regs->r10, &gregs[9]); | ||
62 | err |= __get_user(regs->r11, &gregs[10]); | ||
63 | err |= __get_user(regs->r12, &gregs[11]); | ||
64 | err |= __get_user(regs->r13, &gregs[12]); | ||
65 | err |= __get_user(regs->r14, &gregs[13]); | ||
66 | err |= __get_user(regs->r15, &gregs[14]); | ||
67 | err |= __get_user(sw->r16, &gregs[15]); | ||
68 | err |= __get_user(sw->r17, &gregs[16]); | ||
69 | err |= __get_user(sw->r18, &gregs[17]); | ||
70 | err |= __get_user(sw->r19, &gregs[18]); | ||
71 | err |= __get_user(sw->r20, &gregs[19]); | ||
72 | err |= __get_user(sw->r21, &gregs[20]); | ||
73 | err |= __get_user(sw->r22, &gregs[21]); | ||
74 | err |= __get_user(sw->r23, &gregs[22]); | ||
75 | /* gregs[23] is handled below */ | ||
76 | err |= __get_user(sw->fp, &gregs[24]); /* Verify, should this be | ||
77 | settable */ | ||
78 | err |= __get_user(sw->gp, &gregs[25]); /* Verify, should this be | ||
79 | settable */ | ||
80 | |||
81 | err |= __get_user(temp, &gregs[26]); /* Not really necessary no user | ||
82 | settable bits */ | ||
83 | err |= __get_user(regs->ea, &gregs[27]); | ||
84 | |||
85 | err |= __get_user(regs->ra, &gregs[23]); | ||
86 | err |= __get_user(regs->sp, &gregs[28]); | ||
87 | |||
88 | regs->orig_r2 = -1; /* disable syscall checks */ | ||
89 | |||
90 | err |= restore_altstack(&uc->uc_stack); | ||
91 | if (err) | ||
92 | goto badframe; | ||
93 | |||
94 | *pr2 = regs->r2; | ||
95 | return err; | ||
96 | |||
97 | badframe: | ||
98 | return 1; | ||
99 | } | ||
100 | |||
101 | asmlinkage int do_rt_sigreturn(struct switch_stack *sw) | ||
102 | { | ||
103 | struct pt_regs *regs = (struct pt_regs *)(sw + 1); | ||
104 | /* Verify, can we follow the stack back */ | ||
105 | struct rt_sigframe *frame = (struct rt_sigframe *) regs->sp; | ||
106 | sigset_t set; | ||
107 | int rval; | ||
108 | |||
109 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | ||
110 | goto badframe; | ||
111 | |||
112 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | ||
113 | goto badframe; | ||
114 | |||
115 | set_current_blocked(&set); | ||
116 | |||
117 | if (rt_restore_ucontext(regs, sw, &frame->uc, &rval)) | ||
118 | goto badframe; | ||
119 | |||
120 | return rval; | ||
121 | |||
122 | badframe: | ||
123 | force_sig(SIGSEGV, current); | ||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) | ||
128 | { | ||
129 | struct switch_stack *sw = (struct switch_stack *)regs - 1; | ||
130 | greg_t *gregs = uc->uc_mcontext.gregs; | ||
131 | int err = 0; | ||
132 | |||
133 | err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version); | ||
134 | err |= __put_user(regs->r1, &gregs[0]); | ||
135 | err |= __put_user(regs->r2, &gregs[1]); | ||
136 | err |= __put_user(regs->r3, &gregs[2]); | ||
137 | err |= __put_user(regs->r4, &gregs[3]); | ||
138 | err |= __put_user(regs->r5, &gregs[4]); | ||
139 | err |= __put_user(regs->r6, &gregs[5]); | ||
140 | err |= __put_user(regs->r7, &gregs[6]); | ||
141 | err |= __put_user(regs->r8, &gregs[7]); | ||
142 | err |= __put_user(regs->r9, &gregs[8]); | ||
143 | err |= __put_user(regs->r10, &gregs[9]); | ||
144 | err |= __put_user(regs->r11, &gregs[10]); | ||
145 | err |= __put_user(regs->r12, &gregs[11]); | ||
146 | err |= __put_user(regs->r13, &gregs[12]); | ||
147 | err |= __put_user(regs->r14, &gregs[13]); | ||
148 | err |= __put_user(regs->r15, &gregs[14]); | ||
149 | err |= __put_user(sw->r16, &gregs[15]); | ||
150 | err |= __put_user(sw->r17, &gregs[16]); | ||
151 | err |= __put_user(sw->r18, &gregs[17]); | ||
152 | err |= __put_user(sw->r19, &gregs[18]); | ||
153 | err |= __put_user(sw->r20, &gregs[19]); | ||
154 | err |= __put_user(sw->r21, &gregs[20]); | ||
155 | err |= __put_user(sw->r22, &gregs[21]); | ||
156 | err |= __put_user(sw->r23, &gregs[22]); | ||
157 | err |= __put_user(regs->ra, &gregs[23]); | ||
158 | err |= __put_user(sw->fp, &gregs[24]); | ||
159 | err |= __put_user(sw->gp, &gregs[25]); | ||
160 | err |= __put_user(regs->ea, &gregs[27]); | ||
161 | err |= __put_user(regs->sp, &gregs[28]); | ||
162 | return err; | ||
163 | } | ||
164 | |||
165 | static inline void *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, | ||
166 | size_t frame_size) | ||
167 | { | ||
168 | unsigned long usp; | ||
169 | |||
170 | /* Default to using normal stack. */ | ||
171 | usp = regs->sp; | ||
172 | |||
173 | /* This is the X/Open sanctioned signal stack switching. */ | ||
174 | usp = sigsp(usp, ksig); | ||
175 | |||
176 | /* Verify, is it 32 or 64 bit aligned */ | ||
177 | return (void *)((usp - frame_size) & -8UL); | ||
178 | } | ||
179 | |||
180 | static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, | ||
181 | struct pt_regs *regs) | ||
182 | { | ||
183 | struct rt_sigframe *frame; | ||
184 | int err = 0; | ||
185 | |||
186 | frame = get_sigframe(ksig, regs, sizeof(*frame)); | ||
187 | |||
188 | if (ksig->ka.sa.sa_flags & SA_SIGINFO) | ||
189 | err |= copy_siginfo_to_user(&frame->info, &ksig->info); | ||
190 | |||
191 | /* Create the ucontext. */ | ||
192 | err |= __put_user(0, &frame->uc.uc_flags); | ||
193 | err |= __put_user(0, &frame->uc.uc_link); | ||
194 | err |= __save_altstack(&frame->uc.uc_stack, regs->sp); | ||
195 | err |= rt_setup_ucontext(&frame->uc, regs); | ||
196 | err |= copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | ||
197 | |||
198 | if (err) | ||
199 | goto give_sigsegv; | ||
200 | |||
201 | /* Set up to return from userspace; jump to fixed address sigreturn | ||
202 | trampoline on kuser page. */ | ||
203 | regs->ra = (unsigned long) (0x1040); | ||
204 | |||
205 | /* Set up registers for signal handler */ | ||
206 | regs->sp = (unsigned long) frame; | ||
207 | regs->r4 = (unsigned long) ksig->sig; | ||
208 | regs->r5 = (unsigned long) &frame->info; | ||
209 | regs->r6 = (unsigned long) &frame->uc; | ||
210 | regs->ea = (unsigned long) ksig->ka.sa.sa_handler; | ||
211 | return 0; | ||
212 | |||
213 | give_sigsegv: | ||
214 | force_sigsegv(ksig->sig, current); | ||
215 | return -EFAULT; | ||
216 | } | ||
217 | |||
218 | /* | ||
219 | * OK, we're invoking a handler | ||
220 | */ | ||
221 | static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) | ||
222 | { | ||
223 | int ret; | ||
224 | sigset_t *oldset = sigmask_to_save(); | ||
225 | |||
226 | /* set up the stack frame */ | ||
227 | ret = setup_rt_frame(ksig, oldset, regs); | ||
228 | |||
229 | signal_setup_done(ret, ksig, 0); | ||
230 | } | ||
231 | |||
232 | static int do_signal(struct pt_regs *regs) | ||
233 | { | ||
234 | unsigned int retval = 0, continue_addr = 0, restart_addr = 0; | ||
235 | int restart = 0; | ||
236 | struct ksignal ksig; | ||
237 | |||
238 | current->thread.kregs = regs; | ||
239 | |||
240 | /* | ||
241 | * If we were from a system call, check for system call restarting... | ||
242 | */ | ||
243 | if (regs->orig_r2 >= 0) { | ||
244 | continue_addr = regs->ea; | ||
245 | restart_addr = continue_addr - 4; | ||
246 | retval = regs->r2; | ||
247 | |||
248 | /* | ||
249 | * Prepare for system call restart. We do this here so that a | ||
250 | * debugger will see the already changed PC. | ||
251 | */ | ||
252 | switch (retval) { | ||
253 | case ERESTART_RESTARTBLOCK: | ||
254 | restart = -2; | ||
255 | case ERESTARTNOHAND: | ||
256 | case ERESTARTSYS: | ||
257 | case ERESTARTNOINTR: | ||
258 | restart++; | ||
259 | regs->r2 = regs->orig_r2; | ||
260 | regs->r7 = regs->orig_r7; | ||
261 | regs->ea = restart_addr; | ||
262 | break; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | if (get_signal(&ksig)) { | ||
267 | /* handler */ | ||
268 | if (unlikely(restart && regs->ea == restart_addr)) { | ||
269 | if (retval == ERESTARTNOHAND || | ||
270 | retval == ERESTART_RESTARTBLOCK || | ||
271 | (retval == ERESTARTSYS | ||
272 | && !(ksig.ka.sa.sa_flags & SA_RESTART))) { | ||
273 | regs->r2 = EINTR; | ||
274 | regs->r7 = 1; | ||
275 | regs->ea = continue_addr; | ||
276 | } | ||
277 | } | ||
278 | handle_signal(&ksig, regs); | ||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | /* | ||
283 | * No handler present | ||
284 | */ | ||
285 | if (unlikely(restart) && regs->ea == restart_addr) { | ||
286 | regs->ea = continue_addr; | ||
287 | regs->r2 = __NR_restart_syscall; | ||
288 | } | ||
289 | |||
290 | /* | ||
291 | * If there's no signal to deliver, we just put the saved sigmask back. | ||
292 | */ | ||
293 | restore_saved_sigmask(); | ||
294 | |||
295 | return restart; | ||
296 | } | ||
297 | |||
298 | asmlinkage int do_notify_resume(struct pt_regs *regs) | ||
299 | { | ||
300 | /* | ||
301 | * We want the common case to go fast, which is why we may in certain | ||
302 | * cases get here from kernel mode. Just return without doing anything | ||
303 | * if so. | ||
304 | */ | ||
305 | if (!user_mode(regs)) | ||
306 | return 0; | ||
307 | |||
308 | if (test_thread_flag(TIF_SIGPENDING)) { | ||
309 | int restart = do_signal(regs); | ||
310 | |||
311 | if (unlikely(restart)) { | ||
312 | /* | ||
313 | * Restart without handlers. | ||
314 | * Deal with it without leaving | ||
315 | * the kernel space. | ||
316 | */ | ||
317 | return restart; | ||
318 | } | ||
319 | } else if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) | ||
320 | tracehook_notify_resume(regs); | ||
321 | |||
322 | return 0; | ||
323 | } | ||
diff --git a/arch/nios2/kernel/sys_nios2.c b/arch/nios2/kernel/sys_nios2.c new file mode 100644 index 000000000000..cd390ec4f88b --- /dev/null +++ b/arch/nios2/kernel/sys_nios2.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * Copyright (C) 2011-2012 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/export.h> | ||
12 | #include <linux/file.h> | ||
13 | #include <linux/fs.h> | ||
14 | #include <linux/slab.h> | ||
15 | #include <linux/syscalls.h> | ||
16 | |||
17 | #include <asm/cacheflush.h> | ||
18 | #include <asm/traps.h> | ||
19 | |||
20 | /* sys_cacheflush -- flush the processor cache. */ | ||
21 | asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, | ||
22 | unsigned int op) | ||
23 | { | ||
24 | struct vm_area_struct *vma; | ||
25 | |||
26 | if (len == 0) | ||
27 | return 0; | ||
28 | |||
29 | /* We only support op 0 now, return error if op is non-zero.*/ | ||
30 | if (op) | ||
31 | return -EINVAL; | ||
32 | |||
33 | /* Check for overflow */ | ||
34 | if (addr + len < addr) | ||
35 | return -EFAULT; | ||
36 | |||
37 | /* | ||
38 | * Verify that the specified address region actually belongs | ||
39 | * to this process. | ||
40 | */ | ||
41 | vma = find_vma(current->mm, addr); | ||
42 | if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) | ||
43 | return -EFAULT; | ||
44 | |||
45 | flush_cache_range(vma, addr, addr + len); | ||
46 | |||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | asmlinkage int sys_getpagesize(void) | ||
51 | { | ||
52 | return PAGE_SIZE; | ||
53 | } | ||
diff --git a/arch/nios2/kernel/syscall_table.c b/arch/nios2/kernel/syscall_table.c new file mode 100644 index 000000000000..06e6ac1835b2 --- /dev/null +++ b/arch/nios2/kernel/syscall_table.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright Altera Corporation (C) 2013. All rights reserved | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/syscalls.h> | ||
19 | #include <linux/signal.h> | ||
20 | #include <linux/unistd.h> | ||
21 | |||
22 | #include <asm/syscalls.h> | ||
23 | |||
24 | #undef __SYSCALL | ||
25 | #define __SYSCALL(nr, call) [nr] = (call), | ||
26 | |||
27 | void *sys_call_table[__NR_syscalls] = { | ||
28 | #include <asm/unistd.h> | ||
29 | }; | ||
diff --git a/arch/nios2/kernel/time.c b/arch/nios2/kernel/time.c new file mode 100644 index 000000000000..7f4547418ee1 --- /dev/null +++ b/arch/nios2/kernel/time.c | |||
@@ -0,0 +1,308 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013-2014 Altera Corporation | ||
3 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/interrupt.h> | ||
12 | #include <linux/clockchips.h> | ||
13 | #include <linux/clocksource.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/of.h> | ||
16 | #include <linux/of_address.h> | ||
17 | #include <linux/of_irq.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/slab.h> | ||
20 | |||
21 | #define ALTERA_TIMER_STATUS_REG 0 | ||
22 | #define ALTERA_TIMER_CONTROL_REG 4 | ||
23 | #define ALTERA_TIMER_PERIODL_REG 8 | ||
24 | #define ALTERA_TIMER_PERIODH_REG 12 | ||
25 | #define ALTERA_TIMER_SNAPL_REG 16 | ||
26 | #define ALTERA_TIMER_SNAPH_REG 20 | ||
27 | |||
28 | #define ALTERA_TIMER_CONTROL_ITO_MSK (0x1) | ||
29 | #define ALTERA_TIMER_CONTROL_CONT_MSK (0x2) | ||
30 | #define ALTERA_TIMER_CONTROL_START_MSK (0x4) | ||
31 | #define ALTERA_TIMER_CONTROL_STOP_MSK (0x8) | ||
32 | |||
33 | struct nios2_timer { | ||
34 | void __iomem *base; | ||
35 | unsigned long freq; | ||
36 | }; | ||
37 | |||
38 | struct nios2_clockevent_dev { | ||
39 | struct nios2_timer timer; | ||
40 | struct clock_event_device ced; | ||
41 | }; | ||
42 | |||
43 | struct nios2_clocksource { | ||
44 | struct nios2_timer timer; | ||
45 | struct clocksource cs; | ||
46 | }; | ||
47 | |||
48 | static inline struct nios2_clockevent_dev * | ||
49 | to_nios2_clkevent(struct clock_event_device *evt) | ||
50 | { | ||
51 | return container_of(evt, struct nios2_clockevent_dev, ced); | ||
52 | } | ||
53 | |||
54 | static inline struct nios2_clocksource * | ||
55 | to_nios2_clksource(struct clocksource *cs) | ||
56 | { | ||
57 | return container_of(cs, struct nios2_clocksource, cs); | ||
58 | } | ||
59 | |||
60 | static u16 timer_readw(struct nios2_timer *timer, u32 offs) | ||
61 | { | ||
62 | return readw(timer->base + offs); | ||
63 | } | ||
64 | |||
65 | static void timer_writew(struct nios2_timer *timer, u16 val, u32 offs) | ||
66 | { | ||
67 | writew(val, timer->base + offs); | ||
68 | } | ||
69 | |||
70 | static inline unsigned long read_timersnapshot(struct nios2_timer *timer) | ||
71 | { | ||
72 | unsigned long count; | ||
73 | |||
74 | timer_writew(timer, 0, ALTERA_TIMER_SNAPL_REG); | ||
75 | count = timer_readw(timer, ALTERA_TIMER_SNAPH_REG) << 16 | | ||
76 | timer_readw(timer, ALTERA_TIMER_SNAPL_REG); | ||
77 | |||
78 | return count; | ||
79 | } | ||
80 | |||
81 | static cycle_t nios2_timer_read(struct clocksource *cs) | ||
82 | { | ||
83 | struct nios2_clocksource *nios2_cs = to_nios2_clksource(cs); | ||
84 | unsigned long flags; | ||
85 | u32 count; | ||
86 | |||
87 | local_irq_save(flags); | ||
88 | count = read_timersnapshot(&nios2_cs->timer); | ||
89 | local_irq_restore(flags); | ||
90 | |||
91 | /* Counter is counting down */ | ||
92 | return ~count; | ||
93 | } | ||
94 | |||
95 | static struct nios2_clocksource nios2_cs = { | ||
96 | .cs = { | ||
97 | .name = "nios2-clksrc", | ||
98 | .rating = 250, | ||
99 | .read = nios2_timer_read, | ||
100 | .mask = CLOCKSOURCE_MASK(32), | ||
101 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
102 | }, | ||
103 | }; | ||
104 | |||
105 | cycles_t get_cycles(void) | ||
106 | { | ||
107 | return nios2_timer_read(&nios2_cs.cs); | ||
108 | } | ||
109 | |||
110 | static void nios2_timer_start(struct nios2_timer *timer) | ||
111 | { | ||
112 | u16 ctrl; | ||
113 | |||
114 | ctrl = timer_readw(timer, ALTERA_TIMER_CONTROL_REG); | ||
115 | ctrl |= ALTERA_TIMER_CONTROL_START_MSK; | ||
116 | timer_writew(timer, ctrl, ALTERA_TIMER_CONTROL_REG); | ||
117 | } | ||
118 | |||
119 | static void nios2_timer_stop(struct nios2_timer *timer) | ||
120 | { | ||
121 | u16 ctrl; | ||
122 | |||
123 | ctrl = timer_readw(timer, ALTERA_TIMER_CONTROL_REG); | ||
124 | ctrl |= ALTERA_TIMER_CONTROL_STOP_MSK; | ||
125 | timer_writew(timer, ctrl, ALTERA_TIMER_CONTROL_REG); | ||
126 | } | ||
127 | |||
128 | static void nios2_timer_config(struct nios2_timer *timer, unsigned long period, | ||
129 | enum clock_event_mode mode) | ||
130 | { | ||
131 | u16 ctrl; | ||
132 | |||
133 | /* The timer's actual period is one cycle greater than the value | ||
134 | * stored in the period register. */ | ||
135 | period--; | ||
136 | |||
137 | ctrl = timer_readw(timer, ALTERA_TIMER_CONTROL_REG); | ||
138 | /* stop counter */ | ||
139 | timer_writew(timer, ctrl | ALTERA_TIMER_CONTROL_STOP_MSK, | ||
140 | ALTERA_TIMER_CONTROL_REG); | ||
141 | |||
142 | /* write new count */ | ||
143 | timer_writew(timer, period, ALTERA_TIMER_PERIODL_REG); | ||
144 | timer_writew(timer, period >> 16, ALTERA_TIMER_PERIODH_REG); | ||
145 | |||
146 | ctrl |= ALTERA_TIMER_CONTROL_START_MSK | ALTERA_TIMER_CONTROL_ITO_MSK; | ||
147 | if (mode == CLOCK_EVT_MODE_PERIODIC) | ||
148 | ctrl |= ALTERA_TIMER_CONTROL_CONT_MSK; | ||
149 | else | ||
150 | ctrl &= ~ALTERA_TIMER_CONTROL_CONT_MSK; | ||
151 | timer_writew(timer, ctrl, ALTERA_TIMER_CONTROL_REG); | ||
152 | } | ||
153 | |||
154 | static int nios2_timer_set_next_event(unsigned long delta, | ||
155 | struct clock_event_device *evt) | ||
156 | { | ||
157 | struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt); | ||
158 | |||
159 | nios2_timer_config(&nios2_ced->timer, delta, evt->mode); | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | static void nios2_timer_set_mode(enum clock_event_mode mode, | ||
165 | struct clock_event_device *evt) | ||
166 | { | ||
167 | unsigned long period; | ||
168 | struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt); | ||
169 | struct nios2_timer *timer = &nios2_ced->timer; | ||
170 | |||
171 | switch (mode) { | ||
172 | case CLOCK_EVT_MODE_PERIODIC: | ||
173 | period = DIV_ROUND_UP(timer->freq, HZ); | ||
174 | nios2_timer_config(timer, period, CLOCK_EVT_MODE_PERIODIC); | ||
175 | break; | ||
176 | case CLOCK_EVT_MODE_ONESHOT: | ||
177 | case CLOCK_EVT_MODE_UNUSED: | ||
178 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
179 | nios2_timer_stop(timer); | ||
180 | break; | ||
181 | case CLOCK_EVT_MODE_RESUME: | ||
182 | nios2_timer_start(timer); | ||
183 | break; | ||
184 | } | ||
185 | } | ||
186 | |||
187 | irqreturn_t timer_interrupt(int irq, void *dev_id) | ||
188 | { | ||
189 | struct clock_event_device *evt = (struct clock_event_device *) dev_id; | ||
190 | struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt); | ||
191 | |||
192 | /* Clear the interrupt condition */ | ||
193 | timer_writew(&nios2_ced->timer, 0, ALTERA_TIMER_STATUS_REG); | ||
194 | evt->event_handler(evt); | ||
195 | |||
196 | return IRQ_HANDLED; | ||
197 | } | ||
198 | |||
199 | static void __init nios2_timer_get_base_and_freq(struct device_node *np, | ||
200 | void __iomem **base, u32 *freq) | ||
201 | { | ||
202 | *base = of_iomap(np, 0); | ||
203 | if (!*base) | ||
204 | panic("Unable to map reg for %s\n", np->name); | ||
205 | |||
206 | if (of_property_read_u32(np, "clock-frequency", freq)) | ||
207 | panic("Unable to get %s clock frequency\n", np->name); | ||
208 | } | ||
209 | |||
210 | static struct nios2_clockevent_dev nios2_ce = { | ||
211 | .ced = { | ||
212 | .name = "nios2-clkevent", | ||
213 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | ||
214 | .rating = 250, | ||
215 | .shift = 32, | ||
216 | .set_next_event = nios2_timer_set_next_event, | ||
217 | .set_mode = nios2_timer_set_mode, | ||
218 | }, | ||
219 | }; | ||
220 | |||
221 | static __init void nios2_clockevent_init(struct device_node *timer) | ||
222 | { | ||
223 | void __iomem *iobase; | ||
224 | u32 freq; | ||
225 | int irq; | ||
226 | |||
227 | nios2_timer_get_base_and_freq(timer, &iobase, &freq); | ||
228 | |||
229 | irq = irq_of_parse_and_map(timer, 0); | ||
230 | if (!irq) | ||
231 | panic("Unable to parse timer irq\n"); | ||
232 | |||
233 | nios2_ce.timer.base = iobase; | ||
234 | nios2_ce.timer.freq = freq; | ||
235 | |||
236 | nios2_ce.ced.cpumask = cpumask_of(0); | ||
237 | nios2_ce.ced.irq = irq; | ||
238 | |||
239 | nios2_timer_stop(&nios2_ce.timer); | ||
240 | /* clear pending interrupt */ | ||
241 | timer_writew(&nios2_ce.timer, 0, ALTERA_TIMER_STATUS_REG); | ||
242 | |||
243 | if (request_irq(irq, timer_interrupt, IRQF_TIMER, timer->name, | ||
244 | &nios2_ce.ced)) | ||
245 | panic("Unable to setup timer irq\n"); | ||
246 | |||
247 | clockevents_config_and_register(&nios2_ce.ced, freq, 1, ULONG_MAX); | ||
248 | } | ||
249 | |||
250 | static __init void nios2_clocksource_init(struct device_node *timer) | ||
251 | { | ||
252 | unsigned int ctrl; | ||
253 | void __iomem *iobase; | ||
254 | u32 freq; | ||
255 | |||
256 | nios2_timer_get_base_and_freq(timer, &iobase, &freq); | ||
257 | |||
258 | nios2_cs.timer.base = iobase; | ||
259 | nios2_cs.timer.freq = freq; | ||
260 | |||
261 | clocksource_register_hz(&nios2_cs.cs, freq); | ||
262 | |||
263 | timer_writew(&nios2_cs.timer, USHRT_MAX, ALTERA_TIMER_PERIODL_REG); | ||
264 | timer_writew(&nios2_cs.timer, USHRT_MAX, ALTERA_TIMER_PERIODH_REG); | ||
265 | |||
266 | /* interrupt disable + continuous + start */ | ||
267 | ctrl = ALTERA_TIMER_CONTROL_CONT_MSK | ALTERA_TIMER_CONTROL_START_MSK; | ||
268 | timer_writew(&nios2_cs.timer, ctrl, ALTERA_TIMER_CONTROL_REG); | ||
269 | |||
270 | /* Calibrate the delay loop directly */ | ||
271 | lpj_fine = freq / HZ; | ||
272 | } | ||
273 | |||
274 | /* | ||
275 | * The first timer instance will use as a clockevent. If there are two or | ||
276 | * more instances, the second one gets used as clocksource and all | ||
277 | * others are unused. | ||
278 | */ | ||
279 | static void __init nios2_time_init(struct device_node *timer) | ||
280 | { | ||
281 | static int num_called; | ||
282 | |||
283 | switch (num_called) { | ||
284 | case 0: | ||
285 | nios2_clockevent_init(timer); | ||
286 | break; | ||
287 | case 1: | ||
288 | nios2_clocksource_init(timer); | ||
289 | break; | ||
290 | default: | ||
291 | break; | ||
292 | } | ||
293 | |||
294 | num_called++; | ||
295 | } | ||
296 | |||
297 | void read_persistent_clock(struct timespec *ts) | ||
298 | { | ||
299 | ts->tv_sec = mktime(2007, 1, 1, 0, 0, 0); | ||
300 | ts->tv_nsec = 0; | ||
301 | } | ||
302 | |||
303 | void __init time_init(void) | ||
304 | { | ||
305 | clocksource_of_init(); | ||
306 | } | ||
307 | |||
308 | CLOCKSOURCE_OF_DECLARE(nios2_timer, "altr,timer-1.0", nios2_time_init); | ||
diff --git a/arch/nios2/kernel/traps.c b/arch/nios2/kernel/traps.c new file mode 100644 index 000000000000..b7b97641a9a6 --- /dev/null +++ b/arch/nios2/kernel/traps.c | |||
@@ -0,0 +1,185 @@ | |||
1 | /* | ||
2 | * Hardware exception handling | ||
3 | * | ||
4 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
5 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
6 | * Copyright (C) 2001 Vic Phillips | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General | ||
9 | * Public License. See the file COPYING in the main directory of this | ||
10 | * archive for more details. | ||
11 | */ | ||
12 | |||
13 | #include <linux/sched.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/signal.h> | ||
16 | #include <linux/export.h> | ||
17 | #include <linux/mm.h> | ||
18 | #include <linux/ptrace.h> | ||
19 | |||
20 | #include <asm/traps.h> | ||
21 | #include <asm/sections.h> | ||
22 | #include <asm/uaccess.h> | ||
23 | |||
24 | static DEFINE_SPINLOCK(die_lock); | ||
25 | |||
26 | void die(const char *str, struct pt_regs *regs, long err) | ||
27 | { | ||
28 | console_verbose(); | ||
29 | spin_lock_irq(&die_lock); | ||
30 | pr_warn("Oops: %s, sig: %ld\n", str, err); | ||
31 | show_regs(regs); | ||
32 | spin_unlock_irq(&die_lock); | ||
33 | /* | ||
34 | * do_exit() should take care of panic'ing from an interrupt | ||
35 | * context so we don't handle it here | ||
36 | */ | ||
37 | do_exit(err); | ||
38 | } | ||
39 | |||
40 | void _exception(int signo, struct pt_regs *regs, int code, unsigned long addr) | ||
41 | { | ||
42 | siginfo_t info; | ||
43 | |||
44 | if (!user_mode(regs)) | ||
45 | die("Exception in kernel mode", regs, signo); | ||
46 | |||
47 | info.si_signo = signo; | ||
48 | info.si_errno = 0; | ||
49 | info.si_code = code; | ||
50 | info.si_addr = (void __user *) addr; | ||
51 | force_sig_info(signo, &info, current); | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * The show_stack is an external API which we do not use ourselves. | ||
56 | */ | ||
57 | |||
58 | int kstack_depth_to_print = 48; | ||
59 | |||
60 | void show_stack(struct task_struct *task, unsigned long *stack) | ||
61 | { | ||
62 | unsigned long *endstack, addr; | ||
63 | int i; | ||
64 | |||
65 | if (!stack) { | ||
66 | if (task) | ||
67 | stack = (unsigned long *)task->thread.ksp; | ||
68 | else | ||
69 | stack = (unsigned long *)&stack; | ||
70 | } | ||
71 | |||
72 | addr = (unsigned long) stack; | ||
73 | endstack = (unsigned long *) PAGE_ALIGN(addr); | ||
74 | |||
75 | pr_emerg("Stack from %08lx:", (unsigned long)stack); | ||
76 | for (i = 0; i < kstack_depth_to_print; i++) { | ||
77 | if (stack + 1 > endstack) | ||
78 | break; | ||
79 | if (i % 8 == 0) | ||
80 | pr_emerg("\n "); | ||
81 | pr_emerg(" %08lx", *stack++); | ||
82 | } | ||
83 | |||
84 | pr_emerg("\nCall Trace:"); | ||
85 | i = 0; | ||
86 | while (stack + 1 <= endstack) { | ||
87 | addr = *stack++; | ||
88 | /* | ||
89 | * If the address is either in the text segment of the | ||
90 | * kernel, or in the region which contains vmalloc'ed | ||
91 | * memory, it *may* be the address of a calling | ||
92 | * routine; if so, print it so that someone tracing | ||
93 | * down the cause of the crash will be able to figure | ||
94 | * out the call path that was taken. | ||
95 | */ | ||
96 | if (((addr >= (unsigned long) _stext) && | ||
97 | (addr <= (unsigned long) _etext))) { | ||
98 | if (i % 4 == 0) | ||
99 | pr_emerg("\n "); | ||
100 | pr_emerg(" [<%08lx>]", addr); | ||
101 | i++; | ||
102 | } | ||
103 | } | ||
104 | pr_emerg("\n"); | ||
105 | } | ||
106 | |||
107 | void __init trap_init(void) | ||
108 | { | ||
109 | /* Nothing to do here */ | ||
110 | } | ||
111 | |||
112 | /* Breakpoint handler */ | ||
113 | asmlinkage void breakpoint_c(struct pt_regs *fp) | ||
114 | { | ||
115 | /* | ||
116 | * The breakpoint entry code has moved the PC on by 4 bytes, so we must | ||
117 | * move it back. This could be done on the host but we do it here | ||
118 | * because monitor.S of JTAG gdbserver does it too. | ||
119 | */ | ||
120 | fp->ea -= 4; | ||
121 | _exception(SIGTRAP, fp, TRAP_BRKPT, fp->ea); | ||
122 | } | ||
123 | |||
124 | #ifndef CONFIG_NIOS2_ALIGNMENT_TRAP | ||
125 | /* Alignment exception handler */ | ||
126 | asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause) | ||
127 | { | ||
128 | unsigned long addr = RDCTL(CTL_BADADDR); | ||
129 | |||
130 | cause >>= 2; | ||
131 | fp->ea -= 4; | ||
132 | |||
133 | if (fixup_exception(fp)) | ||
134 | return; | ||
135 | |||
136 | if (!user_mode(fp)) { | ||
137 | pr_alert("Unaligned access from kernel mode, this might be a hardware\n"); | ||
138 | pr_alert("problem, dump registers and restart the instruction\n"); | ||
139 | pr_alert(" BADADDR 0x%08lx\n", addr); | ||
140 | pr_alert(" cause %d\n", cause); | ||
141 | pr_alert(" op-code 0x%08lx\n", *(unsigned long *)(fp->ea)); | ||
142 | show_regs(fp); | ||
143 | return; | ||
144 | } | ||
145 | |||
146 | _exception(SIGBUS, fp, BUS_ADRALN, addr); | ||
147 | } | ||
148 | #endif /* CONFIG_NIOS2_ALIGNMENT_TRAP */ | ||
149 | |||
150 | /* Illegal instruction handler */ | ||
151 | asmlinkage void handle_illegal_c(struct pt_regs *fp) | ||
152 | { | ||
153 | fp->ea -= 4; | ||
154 | _exception(SIGILL, fp, ILL_ILLOPC, fp->ea); | ||
155 | } | ||
156 | |||
157 | /* Supervisor instruction handler */ | ||
158 | asmlinkage void handle_supervisor_instr(struct pt_regs *fp) | ||
159 | { | ||
160 | fp->ea -= 4; | ||
161 | _exception(SIGILL, fp, ILL_PRVOPC, fp->ea); | ||
162 | } | ||
163 | |||
164 | /* Division error handler */ | ||
165 | asmlinkage void handle_diverror_c(struct pt_regs *fp) | ||
166 | { | ||
167 | fp->ea -= 4; | ||
168 | _exception(SIGFPE, fp, FPE_INTDIV, fp->ea); | ||
169 | } | ||
170 | |||
171 | /* Unhandled exception handler */ | ||
172 | asmlinkage void unhandled_exception(struct pt_regs *regs, int cause) | ||
173 | { | ||
174 | unsigned long addr = RDCTL(CTL_BADADDR); | ||
175 | |||
176 | cause /= 4; | ||
177 | |||
178 | pr_emerg("Unhandled exception #%d in %s mode (badaddr=0x%08lx)\n", | ||
179 | cause, user_mode(regs) ? "user" : "kernel", addr); | ||
180 | |||
181 | regs->ea -= 4; | ||
182 | show_regs(regs); | ||
183 | |||
184 | pr_emerg("opcode: 0x%08lx\n", *(unsigned long *)(regs->ea)); | ||
185 | } | ||
diff --git a/arch/nios2/kernel/vmlinux.lds.S b/arch/nios2/kernel/vmlinux.lds.S new file mode 100644 index 000000000000..326fab40a9de --- /dev/null +++ b/arch/nios2/kernel/vmlinux.lds.S | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | #include <asm/page.h> | ||
19 | #include <asm-generic/vmlinux.lds.h> | ||
20 | #include <asm/cache.h> | ||
21 | #include <asm/thread_info.h> | ||
22 | |||
23 | OUTPUT_FORMAT("elf32-littlenios2", "elf32-littlenios2", "elf32-littlenios2") | ||
24 | |||
25 | OUTPUT_ARCH(nios) | ||
26 | ENTRY(_start) /* Defined in head.S */ | ||
27 | |||
28 | jiffies = jiffies_64; | ||
29 | |||
30 | SECTIONS | ||
31 | { | ||
32 | . = CONFIG_NIOS2_MEM_BASE | CONFIG_NIOS2_KERNEL_REGION_BASE; | ||
33 | |||
34 | _text = .; | ||
35 | _stext = .; | ||
36 | HEAD_TEXT_SECTION | ||
37 | .text : { | ||
38 | TEXT_TEXT | ||
39 | SCHED_TEXT | ||
40 | LOCK_TEXT | ||
41 | IRQENTRY_TEXT | ||
42 | KPROBES_TEXT | ||
43 | } =0 | ||
44 | _etext = .; | ||
45 | |||
46 | .got : { | ||
47 | *(.got.plt) | ||
48 | *(.igot.plt) | ||
49 | *(.got) | ||
50 | *(.igot) | ||
51 | } | ||
52 | |||
53 | EXCEPTION_TABLE(L1_CACHE_BYTES) | ||
54 | |||
55 | . = ALIGN(PAGE_SIZE); | ||
56 | __init_begin = .; | ||
57 | INIT_TEXT_SECTION(PAGE_SIZE) | ||
58 | INIT_DATA_SECTION(PAGE_SIZE) | ||
59 | PERCPU_SECTION(L1_CACHE_BYTES) | ||
60 | __init_end = .; | ||
61 | |||
62 | _sdata = .; | ||
63 | RO_DATA_SECTION(PAGE_SIZE) | ||
64 | RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) | ||
65 | _edata = .; | ||
66 | |||
67 | BSS_SECTION(0, 0, 0) | ||
68 | _end = .; | ||
69 | |||
70 | STABS_DEBUG | ||
71 | DWARF_DEBUG | ||
72 | NOTES | ||
73 | |||
74 | DISCARDS | ||
75 | } | ||
diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile new file mode 100644 index 000000000000..557256628ecd --- /dev/null +++ b/arch/nios2/lib/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # | ||
2 | # Makefile for Nios2-specific library files. | ||
3 | # | ||
4 | |||
5 | lib-y += delay.o | ||
6 | lib-y += memcpy.o | ||
7 | lib-y += memmove.o | ||
8 | lib-y += memset.o | ||
diff --git a/arch/nios2/lib/delay.c b/arch/nios2/lib/delay.c new file mode 100644 index 000000000000..088119cd0cc5 --- /dev/null +++ b/arch/nios2/lib/delay.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* Copyright Altera Corporation (C) 2014. All rights reserved. | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License, version 2, | ||
5 | * as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <asm/delay.h> | ||
19 | #include <asm/param.h> | ||
20 | #include <asm/processor.h> | ||
21 | #include <asm/timex.h> | ||
22 | |||
23 | void __delay(unsigned long cycles) | ||
24 | { | ||
25 | cycles_t start = get_cycles(); | ||
26 | |||
27 | while ((get_cycles() - start) < cycles) | ||
28 | cpu_relax(); | ||
29 | } | ||
30 | EXPORT_SYMBOL(__delay); | ||
31 | |||
32 | void __const_udelay(unsigned long xloops) | ||
33 | { | ||
34 | u64 loops; | ||
35 | |||
36 | loops = (u64)xloops * loops_per_jiffy * HZ; | ||
37 | |||
38 | __delay(loops >> 32); | ||
39 | } | ||
40 | EXPORT_SYMBOL(__const_udelay); | ||
41 | |||
42 | void __udelay(unsigned long usecs) | ||
43 | { | ||
44 | __const_udelay(usecs * 0x10C7UL); /* 2**32 / 1000000 (rounded up) */ | ||
45 | } | ||
46 | EXPORT_SYMBOL(__udelay); | ||
47 | |||
48 | void __ndelay(unsigned long nsecs) | ||
49 | { | ||
50 | __const_udelay(nsecs * 0x5UL); /* 2**32 / 1000000000 (rounded up) */ | ||
51 | } | ||
52 | EXPORT_SYMBOL(__ndelay); | ||
diff --git a/arch/nios2/lib/memcpy.c b/arch/nios2/lib/memcpy.c new file mode 100644 index 000000000000..1715f5d28b11 --- /dev/null +++ b/arch/nios2/lib/memcpy.c | |||
@@ -0,0 +1,202 @@ | |||
1 | /* Extracted from GLIBC memcpy.c and memcopy.h, which is: | ||
2 | Copyright (C) 1991, 1992, 1993, 1997, 2004 Free Software Foundation, Inc. | ||
3 | This file is part of the GNU C Library. | ||
4 | Contributed by Torbjorn Granlund (tege@sics.se). | ||
5 | |||
6 | The GNU C Library is free software; you can redistribute it and/or | ||
7 | modify it under the terms of the GNU Lesser General Public | ||
8 | License as published by the Free Software Foundation; either | ||
9 | version 2.1 of the License, or (at your option) any later version. | ||
10 | |||
11 | The GNU C Library is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | Lesser General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the GNU C Library; if not, see | ||
18 | <http://www.gnu.org/licenses/>. */ | ||
19 | |||
20 | #include <linux/types.h> | ||
21 | |||
22 | /* Type to use for aligned memory operations. | ||
23 | This should normally be the biggest type supported by a single load | ||
24 | and store. */ | ||
25 | #define op_t unsigned long int | ||
26 | #define OPSIZ (sizeof(op_t)) | ||
27 | |||
28 | /* Optimal type for storing bytes in registers. */ | ||
29 | #define reg_char char | ||
30 | |||
31 | #define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2))) | ||
32 | |||
33 | /* Copy exactly NBYTES bytes from SRC_BP to DST_BP, | ||
34 | without any assumptions about alignment of the pointers. */ | ||
35 | #define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \ | ||
36 | do { \ | ||
37 | size_t __nbytes = (nbytes); \ | ||
38 | while (__nbytes > 0) { \ | ||
39 | unsigned char __x = ((unsigned char *) src_bp)[0]; \ | ||
40 | src_bp += 1; \ | ||
41 | __nbytes -= 1; \ | ||
42 | ((unsigned char *) dst_bp)[0] = __x; \ | ||
43 | dst_bp += 1; \ | ||
44 | } \ | ||
45 | } while (0) | ||
46 | |||
47 | /* Copy *up to* NBYTES bytes from SRC_BP to DST_BP, with | ||
48 | the assumption that DST_BP is aligned on an OPSIZ multiple. If | ||
49 | not all bytes could be easily copied, store remaining number of bytes | ||
50 | in NBYTES_LEFT, otherwise store 0. */ | ||
51 | /* extern void _wordcopy_fwd_aligned __P ((long int, long int, size_t)); */ | ||
52 | /* extern void _wordcopy_fwd_dest_aligned __P ((long int, long int, size_t)); */ | ||
53 | #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \ | ||
54 | do { \ | ||
55 | if (src_bp % OPSIZ == 0) \ | ||
56 | _wordcopy_fwd_aligned(dst_bp, src_bp, (nbytes) / OPSIZ);\ | ||
57 | else \ | ||
58 | _wordcopy_fwd_dest_aligned(dst_bp, src_bp, (nbytes) / OPSIZ);\ | ||
59 | src_bp += (nbytes) & -OPSIZ; \ | ||
60 | dst_bp += (nbytes) & -OPSIZ; \ | ||
61 | (nbytes_left) = (nbytes) % OPSIZ; \ | ||
62 | } while (0) | ||
63 | |||
64 | |||
65 | /* Threshold value for when to enter the unrolled loops. */ | ||
66 | #define OP_T_THRES 16 | ||
67 | |||
68 | /* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to | ||
69 | block beginning at DSTP with LEN `op_t' words (not LEN bytes!). | ||
70 | Both SRCP and DSTP should be aligned for memory operations on `op_t's. */ | ||
71 | /* stream-lined (read x8 + write x8) */ | ||
72 | static void _wordcopy_fwd_aligned(long int dstp, long int srcp, size_t len) | ||
73 | { | ||
74 | while (len > 7) { | ||
75 | register op_t a0, a1, a2, a3, a4, a5, a6, a7; | ||
76 | |||
77 | a0 = ((op_t *) srcp)[0]; | ||
78 | a1 = ((op_t *) srcp)[1]; | ||
79 | a2 = ((op_t *) srcp)[2]; | ||
80 | a3 = ((op_t *) srcp)[3]; | ||
81 | a4 = ((op_t *) srcp)[4]; | ||
82 | a5 = ((op_t *) srcp)[5]; | ||
83 | a6 = ((op_t *) srcp)[6]; | ||
84 | a7 = ((op_t *) srcp)[7]; | ||
85 | ((op_t *) dstp)[0] = a0; | ||
86 | ((op_t *) dstp)[1] = a1; | ||
87 | ((op_t *) dstp)[2] = a2; | ||
88 | ((op_t *) dstp)[3] = a3; | ||
89 | ((op_t *) dstp)[4] = a4; | ||
90 | ((op_t *) dstp)[5] = a5; | ||
91 | ((op_t *) dstp)[6] = a6; | ||
92 | ((op_t *) dstp)[7] = a7; | ||
93 | |||
94 | srcp += 8 * OPSIZ; | ||
95 | dstp += 8 * OPSIZ; | ||
96 | len -= 8; | ||
97 | } | ||
98 | while (len > 0) { | ||
99 | *(op_t *)dstp = *(op_t *)srcp; | ||
100 | |||
101 | srcp += OPSIZ; | ||
102 | dstp += OPSIZ; | ||
103 | len -= 1; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | /* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to | ||
108 | block beginning at DSTP with LEN `op_t' words (not LEN bytes!). | ||
109 | DSTP should be aligned for memory operations on `op_t's, but SRCP must | ||
110 | *not* be aligned. */ | ||
111 | /* stream-lined (read x4 + write x4) */ | ||
112 | static void _wordcopy_fwd_dest_aligned(long int dstp, long int srcp, | ||
113 | size_t len) | ||
114 | { | ||
115 | op_t ap; | ||
116 | int sh_1, sh_2; | ||
117 | |||
118 | /* Calculate how to shift a word read at the memory operation | ||
119 | aligned srcp to make it aligned for copy. */ | ||
120 | |||
121 | sh_1 = 8 * (srcp % OPSIZ); | ||
122 | sh_2 = 8 * OPSIZ - sh_1; | ||
123 | |||
124 | /* Make SRCP aligned by rounding it down to the beginning of the `op_t' | ||
125 | it points in the middle of. */ | ||
126 | srcp &= -OPSIZ; | ||
127 | ap = ((op_t *) srcp)[0]; | ||
128 | srcp += OPSIZ; | ||
129 | |||
130 | while (len > 3) { | ||
131 | op_t a0, a1, a2, a3; | ||
132 | |||
133 | a0 = ((op_t *) srcp)[0]; | ||
134 | a1 = ((op_t *) srcp)[1]; | ||
135 | a2 = ((op_t *) srcp)[2]; | ||
136 | a3 = ((op_t *) srcp)[3]; | ||
137 | ((op_t *) dstp)[0] = MERGE(ap, sh_1, a0, sh_2); | ||
138 | ((op_t *) dstp)[1] = MERGE(a0, sh_1, a1, sh_2); | ||
139 | ((op_t *) dstp)[2] = MERGE(a1, sh_1, a2, sh_2); | ||
140 | ((op_t *) dstp)[3] = MERGE(a2, sh_1, a3, sh_2); | ||
141 | |||
142 | ap = a3; | ||
143 | srcp += 4 * OPSIZ; | ||
144 | dstp += 4 * OPSIZ; | ||
145 | len -= 4; | ||
146 | } | ||
147 | while (len > 0) { | ||
148 | register op_t a0; | ||
149 | |||
150 | a0 = ((op_t *) srcp)[0]; | ||
151 | ((op_t *) dstp)[0] = MERGE(ap, sh_1, a0, sh_2); | ||
152 | |||
153 | ap = a0; | ||
154 | srcp += OPSIZ; | ||
155 | dstp += OPSIZ; | ||
156 | len -= 1; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | void *memcpy(void *dstpp, const void *srcpp, size_t len) | ||
161 | { | ||
162 | unsigned long int dstp = (long int) dstpp; | ||
163 | unsigned long int srcp = (long int) srcpp; | ||
164 | |||
165 | /* Copy from the beginning to the end. */ | ||
166 | |||
167 | /* If there not too few bytes to copy, use word copy. */ | ||
168 | if (len >= OP_T_THRES) { | ||
169 | /* Copy just a few bytes to make DSTP aligned. */ | ||
170 | len -= (-dstp) % OPSIZ; | ||
171 | BYTE_COPY_FWD(dstp, srcp, (-dstp) % OPSIZ); | ||
172 | |||
173 | /* Copy whole pages from SRCP to DSTP by virtual address | ||
174 | manipulation, as much as possible. */ | ||
175 | |||
176 | /* PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len); */ | ||
177 | |||
178 | /* Copy from SRCP to DSTP taking advantage of the known | ||
179 | alignment of DSTP. Number of bytes remaining is put in the | ||
180 | third argument, i.e. in LEN. This number may vary from | ||
181 | machine to machine. */ | ||
182 | |||
183 | WORD_COPY_FWD(dstp, srcp, len, len); | ||
184 | |||
185 | /* Fall out and copy the tail. */ | ||
186 | } | ||
187 | |||
188 | /* There are just a few bytes to copy. Use byte memory operations. */ | ||
189 | BYTE_COPY_FWD(dstp, srcp, len); | ||
190 | |||
191 | return dstpp; | ||
192 | } | ||
193 | |||
194 | void *memcpyb(void *dstpp, const void *srcpp, unsigned len) | ||
195 | { | ||
196 | unsigned long int dstp = (long int) dstpp; | ||
197 | unsigned long int srcp = (long int) srcpp; | ||
198 | |||
199 | BYTE_COPY_FWD(dstp, srcp, len); | ||
200 | |||
201 | return dstpp; | ||
202 | } | ||
diff --git a/arch/nios2/lib/memmove.c b/arch/nios2/lib/memmove.c new file mode 100644 index 000000000000..c65ef517eb80 --- /dev/null +++ b/arch/nios2/lib/memmove.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/string.h> | ||
12 | |||
13 | #ifdef __HAVE_ARCH_MEMMOVE | ||
14 | void *memmove(void *d, const void *s, size_t count) | ||
15 | { | ||
16 | unsigned long dst, src; | ||
17 | |||
18 | if (!count) | ||
19 | return d; | ||
20 | |||
21 | if (d < s) { | ||
22 | dst = (unsigned long) d; | ||
23 | src = (unsigned long) s; | ||
24 | |||
25 | if ((count < 8) || ((dst ^ src) & 3)) | ||
26 | goto restup; | ||
27 | |||
28 | if (dst & 1) { | ||
29 | *(char *)dst++ = *(char *)src++; | ||
30 | count--; | ||
31 | } | ||
32 | if (dst & 2) { | ||
33 | *(short *)dst = *(short *)src; | ||
34 | src += 2; | ||
35 | dst += 2; | ||
36 | count -= 2; | ||
37 | } | ||
38 | while (count > 3) { | ||
39 | *(long *)dst = *(long *)src; | ||
40 | src += 4; | ||
41 | dst += 4; | ||
42 | count -= 4; | ||
43 | } | ||
44 | restup: | ||
45 | while (count--) | ||
46 | *(char *)dst++ = *(char *)src++; | ||
47 | } else { | ||
48 | dst = (unsigned long) d + count; | ||
49 | src = (unsigned long) s + count; | ||
50 | |||
51 | if ((count < 8) || ((dst ^ src) & 3)) | ||
52 | goto restdown; | ||
53 | |||
54 | if (dst & 1) { | ||
55 | src--; | ||
56 | dst--; | ||
57 | count--; | ||
58 | *(char *)dst = *(char *)src; | ||
59 | } | ||
60 | if (dst & 2) { | ||
61 | src -= 2; | ||
62 | dst -= 2; | ||
63 | count -= 2; | ||
64 | *(short *)dst = *(short *)src; | ||
65 | } | ||
66 | while (count > 3) { | ||
67 | src -= 4; | ||
68 | dst -= 4; | ||
69 | count -= 4; | ||
70 | *(long *)dst = *(long *)src; | ||
71 | } | ||
72 | restdown: | ||
73 | while (count--) { | ||
74 | src--; | ||
75 | dst--; | ||
76 | *(char *)dst = *(char *)src; | ||
77 | } | ||
78 | } | ||
79 | |||
80 | return d; | ||
81 | } | ||
82 | #endif /* __HAVE_ARCH_MEMMOVE */ | ||
diff --git a/arch/nios2/lib/memset.c b/arch/nios2/lib/memset.c new file mode 100644 index 000000000000..65e97802f5cc --- /dev/null +++ b/arch/nios2/lib/memset.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/string.h> | ||
12 | |||
13 | #ifdef __HAVE_ARCH_MEMSET | ||
14 | void *memset(void *s, int c, size_t count) | ||
15 | { | ||
16 | int destptr, charcnt, dwordcnt, fill8reg, wrkrega; | ||
17 | |||
18 | if (!count) | ||
19 | return s; | ||
20 | |||
21 | c &= 0xFF; | ||
22 | |||
23 | if (count <= 8) { | ||
24 | char *xs = (char *) s; | ||
25 | |||
26 | while (count--) | ||
27 | *xs++ = c; | ||
28 | return s; | ||
29 | } | ||
30 | |||
31 | __asm__ __volatile__ ( | ||
32 | /* fill8 %3, %5 (c & 0xff) */ | ||
33 | " slli %4, %5, 8\n" | ||
34 | " or %4, %4, %5\n" | ||
35 | " slli %3, %4, 16\n" | ||
36 | " or %3, %3, %4\n" | ||
37 | /* Word-align %0 (s) if necessary */ | ||
38 | " andi %4, %0, 0x01\n" | ||
39 | " beq %4, zero, 1f\n" | ||
40 | " addi %1, %1, -1\n" | ||
41 | " stb %3, 0(%0)\n" | ||
42 | " addi %0, %0, 1\n" | ||
43 | "1: mov %2, %1\n" | ||
44 | /* Dword-align %0 (s) if necessary */ | ||
45 | " andi %4, %0, 0x02\n" | ||
46 | " beq %4, zero, 2f\n" | ||
47 | " addi %1, %1, -2\n" | ||
48 | " sth %3, 0(%0)\n" | ||
49 | " addi %0, %0, 2\n" | ||
50 | " mov %2, %1\n" | ||
51 | /* %1 and %2 are how many more bytes to set */ | ||
52 | "2: srli %2, %2, 2\n" | ||
53 | /* %2 is how many dwords to set */ | ||
54 | "3: stw %3, 0(%0)\n" | ||
55 | " addi %0, %0, 4\n" | ||
56 | " addi %2, %2, -1\n" | ||
57 | " bne %2, zero, 3b\n" | ||
58 | /* store residual word and/or byte if necessary */ | ||
59 | " andi %4, %1, 0x02\n" | ||
60 | " beq %4, zero, 4f\n" | ||
61 | " sth %3, 0(%0)\n" | ||
62 | " addi %0, %0, 2\n" | ||
63 | /* store residual byte if necessary */ | ||
64 | "4: andi %4, %1, 0x01\n" | ||
65 | " beq %4, zero, 5f\n" | ||
66 | " stb %3, 0(%0)\n" | ||
67 | "5:\n" | ||
68 | : "=r" (destptr), /* %0 Output */ | ||
69 | "=r" (charcnt), /* %1 Output */ | ||
70 | "=r" (dwordcnt), /* %2 Output */ | ||
71 | "=r" (fill8reg), /* %3 Output */ | ||
72 | "=r" (wrkrega) /* %4 Output */ | ||
73 | : "r" (c), /* %5 Input */ | ||
74 | "0" (s), /* %0 Input/Output */ | ||
75 | "1" (count) /* %1 Input/Output */ | ||
76 | : "memory" /* clobbered */ | ||
77 | ); | ||
78 | |||
79 | return s; | ||
80 | } | ||
81 | #endif /* __HAVE_ARCH_MEMSET */ | ||
diff --git a/arch/nios2/mm/Makefile b/arch/nios2/mm/Makefile new file mode 100644 index 000000000000..3cbd0840873c --- /dev/null +++ b/arch/nios2/mm/Makefile | |||
@@ -0,0 +1,14 @@ | |||
1 | # | ||
2 | # Makefile for the Nios2-specific parts of the memory manager. | ||
3 | # | ||
4 | |||
5 | obj-y += cacheflush.o | ||
6 | obj-y += dma-mapping.o | ||
7 | obj-y += extable.o | ||
8 | obj-y += fault.o | ||
9 | obj-y += init.o | ||
10 | obj-y += ioremap.o | ||
11 | obj-y += mmu_context.o | ||
12 | obj-y += pgtable.o | ||
13 | obj-y += tlb.o | ||
14 | obj-y += uaccess.o | ||
diff --git a/arch/nios2/mm/cacheflush.c b/arch/nios2/mm/cacheflush.c new file mode 100644 index 000000000000..2ae482b42669 --- /dev/null +++ b/arch/nios2/mm/cacheflush.c | |||
@@ -0,0 +1,271 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2009, Wind River Systems Inc | ||
7 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
8 | */ | ||
9 | |||
10 | #include <linux/export.h> | ||
11 | #include <linux/sched.h> | ||
12 | #include <linux/mm.h> | ||
13 | #include <linux/fs.h> | ||
14 | |||
15 | #include <asm/cacheflush.h> | ||
16 | #include <asm/cpuinfo.h> | ||
17 | |||
18 | static void __flush_dcache(unsigned long start, unsigned long end) | ||
19 | { | ||
20 | unsigned long addr; | ||
21 | |||
22 | start &= ~(cpuinfo.dcache_line_size - 1); | ||
23 | end += (cpuinfo.dcache_line_size - 1); | ||
24 | end &= ~(cpuinfo.dcache_line_size - 1); | ||
25 | |||
26 | if (end > start + cpuinfo.dcache_size) | ||
27 | end = start + cpuinfo.dcache_size; | ||
28 | |||
29 | for (addr = start; addr < end; addr += cpuinfo.dcache_line_size) { | ||
30 | __asm__ __volatile__ (" flushda 0(%0)\n" | ||
31 | : /* Outputs */ | ||
32 | : /* Inputs */ "r"(addr) | ||
33 | /* : No clobber */); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | static void __flush_dcache_all(unsigned long start, unsigned long end) | ||
38 | { | ||
39 | unsigned long addr; | ||
40 | |||
41 | start &= ~(cpuinfo.dcache_line_size - 1); | ||
42 | end += (cpuinfo.dcache_line_size - 1); | ||
43 | end &= ~(cpuinfo.dcache_line_size - 1); | ||
44 | |||
45 | if (end > start + cpuinfo.dcache_size) | ||
46 | end = start + cpuinfo.dcache_size; | ||
47 | |||
48 | for (addr = start; addr < end; addr += cpuinfo.dcache_line_size) { | ||
49 | __asm__ __volatile__ (" flushd 0(%0)\n" | ||
50 | : /* Outputs */ | ||
51 | : /* Inputs */ "r"(addr) | ||
52 | /* : No clobber */); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | static void __invalidate_dcache(unsigned long start, unsigned long end) | ||
57 | { | ||
58 | unsigned long addr; | ||
59 | |||
60 | start &= ~(cpuinfo.dcache_line_size - 1); | ||
61 | end += (cpuinfo.dcache_line_size - 1); | ||
62 | end &= ~(cpuinfo.dcache_line_size - 1); | ||
63 | |||
64 | if (end > start + cpuinfo.dcache_size) | ||
65 | end = start + cpuinfo.dcache_size; | ||
66 | |||
67 | for (addr = start; addr < end; addr += cpuinfo.dcache_line_size) { | ||
68 | __asm__ __volatile__ (" initda 0(%0)\n" | ||
69 | : /* Outputs */ | ||
70 | : /* Inputs */ "r"(addr) | ||
71 | /* : No clobber */); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | static void __flush_icache(unsigned long start, unsigned long end) | ||
76 | { | ||
77 | unsigned long addr; | ||
78 | |||
79 | start &= ~(cpuinfo.icache_line_size - 1); | ||
80 | end += (cpuinfo.icache_line_size - 1); | ||
81 | end &= ~(cpuinfo.icache_line_size - 1); | ||
82 | |||
83 | if (end > start + cpuinfo.icache_size) | ||
84 | end = start + cpuinfo.icache_size; | ||
85 | |||
86 | for (addr = start; addr < end; addr += cpuinfo.icache_line_size) { | ||
87 | __asm__ __volatile__ (" flushi %0\n" | ||
88 | : /* Outputs */ | ||
89 | : /* Inputs */ "r"(addr) | ||
90 | /* : No clobber */); | ||
91 | } | ||
92 | __asm__ __volatile(" flushp\n"); | ||
93 | } | ||
94 | |||
95 | static void flush_aliases(struct address_space *mapping, struct page *page) | ||
96 | { | ||
97 | struct mm_struct *mm = current->active_mm; | ||
98 | struct vm_area_struct *mpnt; | ||
99 | pgoff_t pgoff; | ||
100 | |||
101 | pgoff = page->index; | ||
102 | |||
103 | flush_dcache_mmap_lock(mapping); | ||
104 | vma_interval_tree_foreach(mpnt, &mapping->i_mmap, pgoff, pgoff) { | ||
105 | unsigned long offset; | ||
106 | |||
107 | if (mpnt->vm_mm != mm) | ||
108 | continue; | ||
109 | if (!(mpnt->vm_flags & VM_MAYSHARE)) | ||
110 | continue; | ||
111 | |||
112 | offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT; | ||
113 | flush_cache_page(mpnt, mpnt->vm_start + offset, | ||
114 | page_to_pfn(page)); | ||
115 | } | ||
116 | flush_dcache_mmap_unlock(mapping); | ||
117 | } | ||
118 | |||
119 | void flush_cache_all(void) | ||
120 | { | ||
121 | __flush_dcache_all(0, cpuinfo.dcache_size); | ||
122 | __flush_icache(0, cpuinfo.icache_size); | ||
123 | } | ||
124 | |||
125 | void flush_cache_mm(struct mm_struct *mm) | ||
126 | { | ||
127 | flush_cache_all(); | ||
128 | } | ||
129 | |||
130 | void flush_cache_dup_mm(struct mm_struct *mm) | ||
131 | { | ||
132 | flush_cache_all(); | ||
133 | } | ||
134 | |||
135 | void flush_icache_range(unsigned long start, unsigned long end) | ||
136 | { | ||
137 | __flush_icache(start, end); | ||
138 | } | ||
139 | |||
140 | void flush_dcache_range(unsigned long start, unsigned long end) | ||
141 | { | ||
142 | __flush_dcache(start, end); | ||
143 | } | ||
144 | EXPORT_SYMBOL(flush_dcache_range); | ||
145 | |||
146 | void invalidate_dcache_range(unsigned long start, unsigned long end) | ||
147 | { | ||
148 | __invalidate_dcache(start, end); | ||
149 | } | ||
150 | EXPORT_SYMBOL(invalidate_dcache_range); | ||
151 | |||
152 | void flush_cache_range(struct vm_area_struct *vma, unsigned long start, | ||
153 | unsigned long end) | ||
154 | { | ||
155 | __flush_dcache(start, end); | ||
156 | if (vma == NULL || (vma->vm_flags & VM_EXEC)) | ||
157 | __flush_icache(start, end); | ||
158 | } | ||
159 | |||
160 | void flush_icache_page(struct vm_area_struct *vma, struct page *page) | ||
161 | { | ||
162 | unsigned long start = (unsigned long) page_address(page); | ||
163 | unsigned long end = start + PAGE_SIZE; | ||
164 | |||
165 | __flush_icache(start, end); | ||
166 | } | ||
167 | |||
168 | void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, | ||
169 | unsigned long pfn) | ||
170 | { | ||
171 | unsigned long start = vmaddr; | ||
172 | unsigned long end = start + PAGE_SIZE; | ||
173 | |||
174 | __flush_dcache(start, end); | ||
175 | if (vma->vm_flags & VM_EXEC) | ||
176 | __flush_icache(start, end); | ||
177 | } | ||
178 | |||
179 | void flush_dcache_page(struct page *page) | ||
180 | { | ||
181 | struct address_space *mapping; | ||
182 | |||
183 | /* | ||
184 | * The zero page is never written to, so never has any dirty | ||
185 | * cache lines, and therefore never needs to be flushed. | ||
186 | */ | ||
187 | if (page == ZERO_PAGE(0)) | ||
188 | return; | ||
189 | |||
190 | mapping = page_mapping(page); | ||
191 | |||
192 | /* Flush this page if there are aliases. */ | ||
193 | if (mapping && !mapping_mapped(mapping)) { | ||
194 | clear_bit(PG_dcache_clean, &page->flags); | ||
195 | } else { | ||
196 | unsigned long start = (unsigned long)page_address(page); | ||
197 | |||
198 | __flush_dcache_all(start, start + PAGE_SIZE); | ||
199 | if (mapping) | ||
200 | flush_aliases(mapping, page); | ||
201 | set_bit(PG_dcache_clean, &page->flags); | ||
202 | } | ||
203 | } | ||
204 | EXPORT_SYMBOL(flush_dcache_page); | ||
205 | |||
206 | void update_mmu_cache(struct vm_area_struct *vma, | ||
207 | unsigned long address, pte_t *pte) | ||
208 | { | ||
209 | unsigned long pfn = pte_pfn(*pte); | ||
210 | struct page *page; | ||
211 | |||
212 | if (!pfn_valid(pfn)) | ||
213 | return; | ||
214 | |||
215 | /* | ||
216 | * The zero page is never written to, so never has any dirty | ||
217 | * cache lines, and therefore never needs to be flushed. | ||
218 | */ | ||
219 | page = pfn_to_page(pfn); | ||
220 | if (page == ZERO_PAGE(0)) | ||
221 | return; | ||
222 | |||
223 | if (!PageReserved(page) && | ||
224 | !test_and_set_bit(PG_dcache_clean, &page->flags)) { | ||
225 | unsigned long start = page_to_virt(page); | ||
226 | struct address_space *mapping; | ||
227 | |||
228 | __flush_dcache(start, start + PAGE_SIZE); | ||
229 | |||
230 | mapping = page_mapping(page); | ||
231 | if (mapping) | ||
232 | flush_aliases(mapping, page); | ||
233 | } | ||
234 | } | ||
235 | |||
236 | void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, | ||
237 | struct page *to) | ||
238 | { | ||
239 | __flush_dcache(vaddr, vaddr + PAGE_SIZE); | ||
240 | copy_page(vto, vfrom); | ||
241 | __flush_dcache((unsigned long)vto, (unsigned long)vto + PAGE_SIZE); | ||
242 | } | ||
243 | |||
244 | void clear_user_page(void *addr, unsigned long vaddr, struct page *page) | ||
245 | { | ||
246 | __flush_dcache(vaddr, vaddr + PAGE_SIZE); | ||
247 | clear_page(addr); | ||
248 | __flush_dcache((unsigned long)addr, (unsigned long)addr + PAGE_SIZE); | ||
249 | } | ||
250 | |||
251 | void copy_from_user_page(struct vm_area_struct *vma, struct page *page, | ||
252 | unsigned long user_vaddr, | ||
253 | void *dst, void *src, int len) | ||
254 | { | ||
255 | flush_cache_page(vma, user_vaddr, page_to_pfn(page)); | ||
256 | memcpy(dst, src, len); | ||
257 | __flush_dcache((unsigned long)src, (unsigned long)src + len); | ||
258 | if (vma->vm_flags & VM_EXEC) | ||
259 | __flush_icache((unsigned long)src, (unsigned long)src + len); | ||
260 | } | ||
261 | |||
262 | void copy_to_user_page(struct vm_area_struct *vma, struct page *page, | ||
263 | unsigned long user_vaddr, | ||
264 | void *dst, void *src, int len) | ||
265 | { | ||
266 | flush_cache_page(vma, user_vaddr, page_to_pfn(page)); | ||
267 | memcpy(dst, src, len); | ||
268 | __flush_dcache((unsigned long)dst, (unsigned long)dst + len); | ||
269 | if (vma->vm_flags & VM_EXEC) | ||
270 | __flush_icache((unsigned long)dst, (unsigned long)dst + len); | ||
271 | } | ||
diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c new file mode 100644 index 000000000000..ac5da7594f0b --- /dev/null +++ b/arch/nios2/mm/dma-mapping.c | |||
@@ -0,0 +1,186 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2009 Wind River Systems Inc | ||
4 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
5 | * | ||
6 | * Based on DMA code from MIPS. | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | |||
13 | #include <linux/types.h> | ||
14 | #include <linux/mm.h> | ||
15 | #include <linux/export.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/scatterlist.h> | ||
18 | #include <linux/dma-mapping.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/cache.h> | ||
21 | #include <asm/cacheflush.h> | ||
22 | |||
23 | |||
24 | void *dma_alloc_coherent(struct device *dev, size_t size, | ||
25 | dma_addr_t *dma_handle, gfp_t gfp) | ||
26 | { | ||
27 | void *ret; | ||
28 | |||
29 | /* ignore region specifiers */ | ||
30 | gfp &= ~(__GFP_DMA | __GFP_HIGHMEM); | ||
31 | |||
32 | /* optimized page clearing */ | ||
33 | gfp |= __GFP_ZERO; | ||
34 | |||
35 | if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff)) | ||
36 | gfp |= GFP_DMA; | ||
37 | |||
38 | ret = (void *) __get_free_pages(gfp, get_order(size)); | ||
39 | if (ret != NULL) { | ||
40 | *dma_handle = virt_to_phys(ret); | ||
41 | flush_dcache_range((unsigned long) ret, | ||
42 | (unsigned long) ret + size); | ||
43 | ret = UNCAC_ADDR(ret); | ||
44 | } | ||
45 | |||
46 | return ret; | ||
47 | } | ||
48 | EXPORT_SYMBOL(dma_alloc_coherent); | ||
49 | |||
50 | void dma_free_coherent(struct device *dev, size_t size, void *vaddr, | ||
51 | dma_addr_t dma_handle) | ||
52 | { | ||
53 | unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr); | ||
54 | |||
55 | free_pages(addr, get_order(size)); | ||
56 | } | ||
57 | EXPORT_SYMBOL(dma_free_coherent); | ||
58 | |||
59 | int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
60 | enum dma_data_direction direction) | ||
61 | { | ||
62 | int i; | ||
63 | |||
64 | BUG_ON(!valid_dma_direction(direction)); | ||
65 | |||
66 | for_each_sg(sg, sg, nents, i) { | ||
67 | void *addr; | ||
68 | |||
69 | addr = sg_virt(sg); | ||
70 | if (addr) { | ||
71 | __dma_sync_for_device(addr, sg->length, direction); | ||
72 | sg->dma_address = sg_phys(sg); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | return nents; | ||
77 | } | ||
78 | EXPORT_SYMBOL(dma_map_sg); | ||
79 | |||
80 | dma_addr_t dma_map_page(struct device *dev, struct page *page, | ||
81 | unsigned long offset, size_t size, | ||
82 | enum dma_data_direction direction) | ||
83 | { | ||
84 | void *addr; | ||
85 | |||
86 | BUG_ON(!valid_dma_direction(direction)); | ||
87 | |||
88 | addr = page_address(page) + offset; | ||
89 | __dma_sync_for_device(addr, size, direction); | ||
90 | |||
91 | return page_to_phys(page) + offset; | ||
92 | } | ||
93 | EXPORT_SYMBOL(dma_map_page); | ||
94 | |||
95 | void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
96 | enum dma_data_direction direction) | ||
97 | { | ||
98 | BUG_ON(!valid_dma_direction(direction)); | ||
99 | |||
100 | __dma_sync_for_cpu(phys_to_virt(dma_address), size, direction); | ||
101 | } | ||
102 | EXPORT_SYMBOL(dma_unmap_page); | ||
103 | |||
104 | void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
105 | enum dma_data_direction direction) | ||
106 | { | ||
107 | void *addr; | ||
108 | int i; | ||
109 | |||
110 | BUG_ON(!valid_dma_direction(direction)); | ||
111 | |||
112 | if (direction == DMA_TO_DEVICE) | ||
113 | return; | ||
114 | |||
115 | for_each_sg(sg, sg, nhwentries, i) { | ||
116 | addr = sg_virt(sg); | ||
117 | if (addr) | ||
118 | __dma_sync_for_cpu(addr, sg->length, direction); | ||
119 | } | ||
120 | } | ||
121 | EXPORT_SYMBOL(dma_unmap_sg); | ||
122 | |||
123 | void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, | ||
124 | size_t size, enum dma_data_direction direction) | ||
125 | { | ||
126 | BUG_ON(!valid_dma_direction(direction)); | ||
127 | |||
128 | __dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction); | ||
129 | } | ||
130 | EXPORT_SYMBOL(dma_sync_single_for_cpu); | ||
131 | |||
132 | void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, | ||
133 | size_t size, enum dma_data_direction direction) | ||
134 | { | ||
135 | BUG_ON(!valid_dma_direction(direction)); | ||
136 | |||
137 | __dma_sync_for_device(phys_to_virt(dma_handle), size, direction); | ||
138 | } | ||
139 | EXPORT_SYMBOL(dma_sync_single_for_device); | ||
140 | |||
141 | void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, | ||
142 | unsigned long offset, size_t size, | ||
143 | enum dma_data_direction direction) | ||
144 | { | ||
145 | BUG_ON(!valid_dma_direction(direction)); | ||
146 | |||
147 | __dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction); | ||
148 | } | ||
149 | EXPORT_SYMBOL(dma_sync_single_range_for_cpu); | ||
150 | |||
151 | void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, | ||
152 | unsigned long offset, size_t size, | ||
153 | enum dma_data_direction direction) | ||
154 | { | ||
155 | BUG_ON(!valid_dma_direction(direction)); | ||
156 | |||
157 | __dma_sync_for_device(phys_to_virt(dma_handle), size, direction); | ||
158 | } | ||
159 | EXPORT_SYMBOL(dma_sync_single_range_for_device); | ||
160 | |||
161 | void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | ||
162 | enum dma_data_direction direction) | ||
163 | { | ||
164 | int i; | ||
165 | |||
166 | BUG_ON(!valid_dma_direction(direction)); | ||
167 | |||
168 | /* Make sure that gcc doesn't leave the empty loop body. */ | ||
169 | for_each_sg(sg, sg, nelems, i) | ||
170 | __dma_sync_for_cpu(sg_virt(sg), sg->length, direction); | ||
171 | } | ||
172 | EXPORT_SYMBOL(dma_sync_sg_for_cpu); | ||
173 | |||
174 | void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | ||
175 | int nelems, enum dma_data_direction direction) | ||
176 | { | ||
177 | int i; | ||
178 | |||
179 | BUG_ON(!valid_dma_direction(direction)); | ||
180 | |||
181 | /* Make sure that gcc doesn't leave the empty loop body. */ | ||
182 | for_each_sg(sg, sg, nelems, i) | ||
183 | __dma_sync_for_device(sg_virt(sg), sg->length, direction); | ||
184 | |||
185 | } | ||
186 | EXPORT_SYMBOL(dma_sync_sg_for_device); | ||
diff --git a/arch/nios2/mm/extable.c b/arch/nios2/mm/extable.c new file mode 100644 index 000000000000..4d2fc5a589d0 --- /dev/null +++ b/arch/nios2/mm/extable.c | |||
@@ -0,0 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010, Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2009, Wind River Systems Inc | ||
4 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/module.h> | ||
12 | #include <linux/uaccess.h> | ||
13 | |||
14 | int fixup_exception(struct pt_regs *regs) | ||
15 | { | ||
16 | const struct exception_table_entry *fixup; | ||
17 | |||
18 | fixup = search_exception_tables(regs->ea); | ||
19 | if (fixup) { | ||
20 | regs->ea = fixup->fixup; | ||
21 | return 1; | ||
22 | } | ||
23 | |||
24 | return 0; | ||
25 | } | ||
diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c new file mode 100644 index 000000000000..15a0bb5fc06d --- /dev/null +++ b/arch/nios2/mm/fault.c | |||
@@ -0,0 +1,251 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Wind River Systems Inc | ||
3 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
4 | * | ||
5 | * based on arch/mips/mm/fault.c which is: | ||
6 | * | ||
7 | * Copyright (C) 1995-2000 Ralf Baechle | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file "COPYING" in the main directory of this archive | ||
11 | * for more details. | ||
12 | */ | ||
13 | |||
14 | #include <linux/signal.h> | ||
15 | #include <linux/sched.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/errno.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/ptrace.h> | ||
22 | #include <linux/mman.h> | ||
23 | #include <linux/mm.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/uaccess.h> | ||
26 | #include <linux/ptrace.h> | ||
27 | |||
28 | #include <asm/mmu_context.h> | ||
29 | #include <asm/traps.h> | ||
30 | |||
31 | #define EXC_SUPERV_INSN_ACCESS 9 /* Supervisor only instruction address */ | ||
32 | #define EXC_SUPERV_DATA_ACCESS 11 /* Supervisor only data address */ | ||
33 | #define EXC_X_PROTECTION_FAULT 13 /* TLB permission violation (x) */ | ||
34 | #define EXC_R_PROTECTION_FAULT 14 /* TLB permission violation (r) */ | ||
35 | #define EXC_W_PROTECTION_FAULT 15 /* TLB permission violation (w) */ | ||
36 | |||
37 | /* | ||
38 | * This routine handles page faults. It determines the address, | ||
39 | * and the problem, and then passes it off to one of the appropriate | ||
40 | * routines. | ||
41 | */ | ||
42 | asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause, | ||
43 | unsigned long address) | ||
44 | { | ||
45 | struct vm_area_struct *vma = NULL; | ||
46 | struct task_struct *tsk = current; | ||
47 | struct mm_struct *mm = tsk->mm; | ||
48 | int code = SEGV_MAPERR; | ||
49 | int fault; | ||
50 | unsigned int flags = 0; | ||
51 | |||
52 | cause >>= 2; | ||
53 | |||
54 | /* Restart the instruction */ | ||
55 | regs->ea -= 4; | ||
56 | |||
57 | /* | ||
58 | * We fault-in kernel-space virtual memory on-demand. The | ||
59 | * 'reference' page table is init_mm.pgd. | ||
60 | * | ||
61 | * NOTE! We MUST NOT take any locks for this case. We may | ||
62 | * be in an interrupt or a critical region, and should | ||
63 | * only copy the information from the master page table, | ||
64 | * nothing more. | ||
65 | */ | ||
66 | if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END)) { | ||
67 | if (user_mode(regs)) | ||
68 | goto bad_area_nosemaphore; | ||
69 | else | ||
70 | goto vmalloc_fault; | ||
71 | } | ||
72 | |||
73 | if (unlikely(address >= TASK_SIZE)) | ||
74 | goto bad_area_nosemaphore; | ||
75 | |||
76 | /* | ||
77 | * If we're in an interrupt or have no user | ||
78 | * context, we must not take the fault.. | ||
79 | */ | ||
80 | if (in_atomic() || !mm) | ||
81 | goto bad_area_nosemaphore; | ||
82 | |||
83 | if (user_mode(regs)) | ||
84 | flags |= FAULT_FLAG_USER; | ||
85 | |||
86 | if (!down_read_trylock(&mm->mmap_sem)) { | ||
87 | if (!user_mode(regs) && !search_exception_tables(regs->ea)) | ||
88 | goto bad_area_nosemaphore; | ||
89 | down_read(&mm->mmap_sem); | ||
90 | } | ||
91 | |||
92 | vma = find_vma(mm, address); | ||
93 | if (!vma) | ||
94 | goto bad_area; | ||
95 | if (vma->vm_start <= address) | ||
96 | goto good_area; | ||
97 | if (!(vma->vm_flags & VM_GROWSDOWN)) | ||
98 | goto bad_area; | ||
99 | if (expand_stack(vma, address)) | ||
100 | goto bad_area; | ||
101 | /* | ||
102 | * Ok, we have a good vm_area for this memory access, so | ||
103 | * we can handle it.. | ||
104 | */ | ||
105 | good_area: | ||
106 | code = SEGV_ACCERR; | ||
107 | |||
108 | switch (cause) { | ||
109 | case EXC_SUPERV_INSN_ACCESS: | ||
110 | goto bad_area; | ||
111 | case EXC_SUPERV_DATA_ACCESS: | ||
112 | goto bad_area; | ||
113 | case EXC_X_PROTECTION_FAULT: | ||
114 | if (!(vma->vm_flags & VM_EXEC)) | ||
115 | goto bad_area; | ||
116 | break; | ||
117 | case EXC_R_PROTECTION_FAULT: | ||
118 | if (!(vma->vm_flags & VM_READ)) | ||
119 | goto bad_area; | ||
120 | break; | ||
121 | case EXC_W_PROTECTION_FAULT: | ||
122 | if (!(vma->vm_flags & VM_WRITE)) | ||
123 | goto bad_area; | ||
124 | flags = FAULT_FLAG_WRITE; | ||
125 | break; | ||
126 | } | ||
127 | |||
128 | survive: | ||
129 | /* | ||
130 | * If for any reason at all we couldn't handle the fault, | ||
131 | * make sure we exit gracefully rather than endlessly redo | ||
132 | * the fault. | ||
133 | */ | ||
134 | fault = handle_mm_fault(mm, vma, address, flags); | ||
135 | if (unlikely(fault & VM_FAULT_ERROR)) { | ||
136 | if (fault & VM_FAULT_OOM) | ||
137 | goto out_of_memory; | ||
138 | else if (fault & VM_FAULT_SIGBUS) | ||
139 | goto do_sigbus; | ||
140 | BUG(); | ||
141 | } | ||
142 | if (fault & VM_FAULT_MAJOR) | ||
143 | tsk->maj_flt++; | ||
144 | else | ||
145 | tsk->min_flt++; | ||
146 | |||
147 | up_read(&mm->mmap_sem); | ||
148 | return; | ||
149 | |||
150 | /* | ||
151 | * Something tried to access memory that isn't in our memory map.. | ||
152 | * Fix it, but check if it's kernel or user first.. | ||
153 | */ | ||
154 | bad_area: | ||
155 | up_read(&mm->mmap_sem); | ||
156 | |||
157 | bad_area_nosemaphore: | ||
158 | /* User mode accesses just cause a SIGSEGV */ | ||
159 | if (user_mode(regs)) { | ||
160 | pr_alert("%s: unhandled page fault (%d) at 0x%08lx, " | ||
161 | "cause %ld\n", current->comm, SIGSEGV, address, cause); | ||
162 | show_regs(regs); | ||
163 | _exception(SIGSEGV, regs, code, address); | ||
164 | return; | ||
165 | } | ||
166 | |||
167 | no_context: | ||
168 | /* Are we prepared to handle this kernel fault? */ | ||
169 | if (fixup_exception(regs)) | ||
170 | return; | ||
171 | |||
172 | /* | ||
173 | * Oops. The kernel tried to access some bad page. We'll have to | ||
174 | * terminate things with extreme prejudice. | ||
175 | */ | ||
176 | bust_spinlocks(1); | ||
177 | |||
178 | pr_alert("Unable to handle kernel %s at virtual address %08lx", | ||
179 | address < PAGE_SIZE ? "NULL pointer dereference" : | ||
180 | "paging request", address); | ||
181 | pr_alert("ea = %08lx, ra = %08lx, cause = %ld\n", regs->ea, regs->ra, | ||
182 | cause); | ||
183 | panic("Oops"); | ||
184 | return; | ||
185 | |||
186 | /* | ||
187 | * We ran out of memory, or some other thing happened to us that made | ||
188 | * us unable to handle the page fault gracefully. | ||
189 | */ | ||
190 | out_of_memory: | ||
191 | up_read(&mm->mmap_sem); | ||
192 | if (is_global_init(tsk)) { | ||
193 | yield(); | ||
194 | down_read(&mm->mmap_sem); | ||
195 | goto survive; | ||
196 | } | ||
197 | if (!user_mode(regs)) | ||
198 | goto no_context; | ||
199 | pagefault_out_of_memory(); | ||
200 | return; | ||
201 | |||
202 | do_sigbus: | ||
203 | up_read(&mm->mmap_sem); | ||
204 | |||
205 | /* Kernel mode? Handle exceptions or die */ | ||
206 | if (!user_mode(regs)) | ||
207 | goto no_context; | ||
208 | |||
209 | _exception(SIGBUS, regs, BUS_ADRERR, address); | ||
210 | return; | ||
211 | |||
212 | vmalloc_fault: | ||
213 | { | ||
214 | /* | ||
215 | * Synchronize this task's top level page-table | ||
216 | * with the 'reference' page table. | ||
217 | * | ||
218 | * Do _not_ use "tsk" here. We might be inside | ||
219 | * an interrupt in the middle of a task switch.. | ||
220 | */ | ||
221 | int offset = pgd_index(address); | ||
222 | pgd_t *pgd, *pgd_k; | ||
223 | pud_t *pud, *pud_k; | ||
224 | pmd_t *pmd, *pmd_k; | ||
225 | pte_t *pte_k; | ||
226 | |||
227 | pgd = pgd_current + offset; | ||
228 | pgd_k = init_mm.pgd + offset; | ||
229 | |||
230 | if (!pgd_present(*pgd_k)) | ||
231 | goto no_context; | ||
232 | set_pgd(pgd, *pgd_k); | ||
233 | |||
234 | pud = pud_offset(pgd, address); | ||
235 | pud_k = pud_offset(pgd_k, address); | ||
236 | if (!pud_present(*pud_k)) | ||
237 | goto no_context; | ||
238 | pmd = pmd_offset(pud, address); | ||
239 | pmd_k = pmd_offset(pud_k, address); | ||
240 | if (!pmd_present(*pmd_k)) | ||
241 | goto no_context; | ||
242 | set_pmd(pmd, *pmd_k); | ||
243 | |||
244 | pte_k = pte_offset_kernel(pmd_k, address); | ||
245 | if (!pte_present(*pte_k)) | ||
246 | goto no_context; | ||
247 | |||
248 | flush_tlb_one(address); | ||
249 | return; | ||
250 | } | ||
251 | } | ||
diff --git a/arch/nios2/mm/init.c b/arch/nios2/mm/init.c new file mode 100644 index 000000000000..e75c75d249d6 --- /dev/null +++ b/arch/nios2/mm/init.c | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
4 | * Copyright (C) 2009 Wind River Systems Inc | ||
5 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
6 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
7 | * | ||
8 | * based on arch/m68k/mm/init.c | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/signal.h> | ||
16 | #include <linux/sched.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/errno.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/ptrace.h> | ||
22 | #include <linux/mman.h> | ||
23 | #include <linux/mm.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/pagemap.h> | ||
26 | #include <linux/bootmem.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/binfmts.h> | ||
29 | |||
30 | #include <asm/setup.h> | ||
31 | #include <asm/page.h> | ||
32 | #include <asm/pgtable.h> | ||
33 | #include <asm/sections.h> | ||
34 | #include <asm/tlb.h> | ||
35 | #include <asm/mmu_context.h> | ||
36 | #include <asm/cpuinfo.h> | ||
37 | #include <asm/processor.h> | ||
38 | |||
39 | pgd_t *pgd_current; | ||
40 | |||
41 | /* | ||
42 | * paging_init() continues the virtual memory environment setup which | ||
43 | * was begun by the code in arch/head.S. | ||
44 | * The parameters are pointers to where to stick the starting and ending | ||
45 | * addresses of available kernel virtual memory. | ||
46 | */ | ||
47 | void __init paging_init(void) | ||
48 | { | ||
49 | unsigned long zones_size[MAX_NR_ZONES]; | ||
50 | |||
51 | memset(zones_size, 0, sizeof(zones_size)); | ||
52 | |||
53 | pagetable_init(); | ||
54 | pgd_current = swapper_pg_dir; | ||
55 | |||
56 | zones_size[ZONE_NORMAL] = max_mapnr; | ||
57 | |||
58 | /* pass the memory from the bootmem allocator to the main allocator */ | ||
59 | free_area_init(zones_size); | ||
60 | |||
61 | flush_dcache_range((unsigned long)empty_zero_page, | ||
62 | (unsigned long)empty_zero_page + PAGE_SIZE); | ||
63 | } | ||
64 | |||
65 | void __init mem_init(void) | ||
66 | { | ||
67 | unsigned long end_mem = memory_end; /* this must not include | ||
68 | kernel stack at top */ | ||
69 | |||
70 | pr_debug("mem_init: start=%lx, end=%lx\n", memory_start, memory_end); | ||
71 | |||
72 | end_mem &= PAGE_MASK; | ||
73 | high_memory = __va(end_mem); | ||
74 | |||
75 | /* this will put all memory onto the freelists */ | ||
76 | free_all_bootmem(); | ||
77 | mem_init_print_info(NULL); | ||
78 | } | ||
79 | |||
80 | void __init mmu_init(void) | ||
81 | { | ||
82 | flush_tlb_all(); | ||
83 | } | ||
84 | |||
85 | #ifdef CONFIG_BLK_DEV_INITRD | ||
86 | void __init free_initrd_mem(unsigned long start, unsigned long end) | ||
87 | { | ||
88 | free_reserved_area((void *)start, (void *)end, -1, "initrd"); | ||
89 | } | ||
90 | #endif | ||
91 | |||
92 | void __init_refok free_initmem(void) | ||
93 | { | ||
94 | free_initmem_default(-1); | ||
95 | } | ||
96 | |||
97 | #define __page_aligned(order) __aligned(PAGE_SIZE << (order)) | ||
98 | pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned(PGD_ORDER); | ||
99 | pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned(PTE_ORDER); | ||
100 | static struct page *kuser_page[1]; | ||
101 | |||
102 | static int alloc_kuser_page(void) | ||
103 | { | ||
104 | extern char __kuser_helper_start[], __kuser_helper_end[]; | ||
105 | int kuser_sz = __kuser_helper_end - __kuser_helper_start; | ||
106 | unsigned long vpage; | ||
107 | |||
108 | vpage = get_zeroed_page(GFP_ATOMIC); | ||
109 | if (!vpage) | ||
110 | return -ENOMEM; | ||
111 | |||
112 | /* Copy kuser helpers */ | ||
113 | memcpy((void *)vpage, __kuser_helper_start, kuser_sz); | ||
114 | |||
115 | flush_icache_range(vpage, vpage + KUSER_SIZE); | ||
116 | kuser_page[0] = virt_to_page(vpage); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | arch_initcall(alloc_kuser_page); | ||
121 | |||
122 | int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | ||
123 | { | ||
124 | struct mm_struct *mm = current->mm; | ||
125 | int ret; | ||
126 | |||
127 | down_write(&mm->mmap_sem); | ||
128 | |||
129 | /* Map kuser helpers to user space address */ | ||
130 | ret = install_special_mapping(mm, KUSER_BASE, KUSER_SIZE, | ||
131 | VM_READ | VM_EXEC | VM_MAYREAD | | ||
132 | VM_MAYEXEC, kuser_page); | ||
133 | |||
134 | up_write(&mm->mmap_sem); | ||
135 | |||
136 | return ret; | ||
137 | } | ||
138 | |||
139 | const char *arch_vma_name(struct vm_area_struct *vma) | ||
140 | { | ||
141 | return (vma->vm_start == KUSER_BASE) ? "[kuser]" : NULL; | ||
142 | } | ||
diff --git a/arch/nios2/mm/ioremap.c b/arch/nios2/mm/ioremap.c new file mode 100644 index 000000000000..3a28177a01eb --- /dev/null +++ b/arch/nios2/mm/ioremap.c | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch> | ||
3 | * Copyright (C) 2009 Wind River Systems Inc | ||
4 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
5 | * Copyright (C) 2004 Microtronix Datacom Ltd. | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | |||
12 | #include <linux/export.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/mm.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include <linux/vmalloc.h> | ||
17 | #include <linux/io.h> | ||
18 | |||
19 | #include <asm/cacheflush.h> | ||
20 | #include <asm/tlbflush.h> | ||
21 | |||
22 | static inline void remap_area_pte(pte_t *pte, unsigned long address, | ||
23 | unsigned long size, unsigned long phys_addr, | ||
24 | unsigned long flags) | ||
25 | { | ||
26 | unsigned long end; | ||
27 | unsigned long pfn; | ||
28 | pgprot_t pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | _PAGE_READ | ||
29 | | _PAGE_WRITE | flags); | ||
30 | |||
31 | address &= ~PMD_MASK; | ||
32 | end = address + size; | ||
33 | if (end > PMD_SIZE) | ||
34 | end = PMD_SIZE; | ||
35 | if (address >= end) | ||
36 | BUG(); | ||
37 | pfn = PFN_DOWN(phys_addr); | ||
38 | do { | ||
39 | if (!pte_none(*pte)) { | ||
40 | pr_err("remap_area_pte: page already exists\n"); | ||
41 | BUG(); | ||
42 | } | ||
43 | set_pte(pte, pfn_pte(pfn, pgprot)); | ||
44 | address += PAGE_SIZE; | ||
45 | pfn++; | ||
46 | pte++; | ||
47 | } while (address && (address < end)); | ||
48 | } | ||
49 | |||
50 | static inline int remap_area_pmd(pmd_t *pmd, unsigned long address, | ||
51 | unsigned long size, unsigned long phys_addr, | ||
52 | unsigned long flags) | ||
53 | { | ||
54 | unsigned long end; | ||
55 | |||
56 | address &= ~PGDIR_MASK; | ||
57 | end = address + size; | ||
58 | if (end > PGDIR_SIZE) | ||
59 | end = PGDIR_SIZE; | ||
60 | phys_addr -= address; | ||
61 | if (address >= end) | ||
62 | BUG(); | ||
63 | do { | ||
64 | pte_t *pte = pte_alloc_kernel(pmd, address); | ||
65 | |||
66 | if (!pte) | ||
67 | return -ENOMEM; | ||
68 | remap_area_pte(pte, address, end - address, address + phys_addr, | ||
69 | flags); | ||
70 | address = (address + PMD_SIZE) & PMD_MASK; | ||
71 | pmd++; | ||
72 | } while (address && (address < end)); | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | static int remap_area_pages(unsigned long address, unsigned long phys_addr, | ||
77 | unsigned long size, unsigned long flags) | ||
78 | { | ||
79 | int error; | ||
80 | pgd_t *dir; | ||
81 | unsigned long end = address + size; | ||
82 | |||
83 | phys_addr -= address; | ||
84 | dir = pgd_offset(&init_mm, address); | ||
85 | flush_cache_all(); | ||
86 | if (address >= end) | ||
87 | BUG(); | ||
88 | do { | ||
89 | pud_t *pud; | ||
90 | pmd_t *pmd; | ||
91 | |||
92 | error = -ENOMEM; | ||
93 | pud = pud_alloc(&init_mm, dir, address); | ||
94 | if (!pud) | ||
95 | break; | ||
96 | pmd = pmd_alloc(&init_mm, pud, address); | ||
97 | if (!pmd) | ||
98 | break; | ||
99 | if (remap_area_pmd(pmd, address, end - address, | ||
100 | phys_addr + address, flags)) | ||
101 | break; | ||
102 | error = 0; | ||
103 | address = (address + PGDIR_SIZE) & PGDIR_MASK; | ||
104 | dir++; | ||
105 | } while (address && (address < end)); | ||
106 | flush_tlb_all(); | ||
107 | return error; | ||
108 | } | ||
109 | |||
110 | #define IS_MAPPABLE_UNCACHEABLE(addr) (addr < 0x20000000UL) | ||
111 | |||
112 | /* | ||
113 | * Map some physical address range into the kernel address space. | ||
114 | */ | ||
115 | void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | ||
116 | unsigned long cacheflag) | ||
117 | { | ||
118 | struct vm_struct *area; | ||
119 | unsigned long offset; | ||
120 | unsigned long last_addr; | ||
121 | void *addr; | ||
122 | |||
123 | /* Don't allow wraparound or zero size */ | ||
124 | last_addr = phys_addr + size - 1; | ||
125 | |||
126 | if (!size || last_addr < phys_addr) | ||
127 | return NULL; | ||
128 | |||
129 | /* Don't allow anybody to remap normal RAM that we're using */ | ||
130 | if (phys_addr > PHYS_OFFSET && phys_addr < virt_to_phys(high_memory)) { | ||
131 | char *t_addr, *t_end; | ||
132 | struct page *page; | ||
133 | |||
134 | t_addr = __va(phys_addr); | ||
135 | t_end = t_addr + (size - 1); | ||
136 | for (page = virt_to_page(t_addr); | ||
137 | page <= virt_to_page(t_end); page++) | ||
138 | if (!PageReserved(page)) | ||
139 | return NULL; | ||
140 | } | ||
141 | |||
142 | /* | ||
143 | * Map uncached objects in the low part of address space to | ||
144 | * CONFIG_NIOS2_IO_REGION_BASE | ||
145 | */ | ||
146 | if (IS_MAPPABLE_UNCACHEABLE(phys_addr) && | ||
147 | IS_MAPPABLE_UNCACHEABLE(last_addr) && | ||
148 | !(cacheflag & _PAGE_CACHED)) | ||
149 | return (void __iomem *)(CONFIG_NIOS2_IO_REGION_BASE + phys_addr); | ||
150 | |||
151 | /* Mappings have to be page-aligned */ | ||
152 | offset = phys_addr & ~PAGE_MASK; | ||
153 | phys_addr &= PAGE_MASK; | ||
154 | size = PAGE_ALIGN(last_addr + 1) - phys_addr; | ||
155 | |||
156 | /* Ok, go for it */ | ||
157 | area = get_vm_area(size, VM_IOREMAP); | ||
158 | if (!area) | ||
159 | return NULL; | ||
160 | addr = area->addr; | ||
161 | if (remap_area_pages((unsigned long) addr, phys_addr, size, | ||
162 | cacheflag)) { | ||
163 | vunmap(addr); | ||
164 | return NULL; | ||
165 | } | ||
166 | return (void __iomem *) (offset + (char *)addr); | ||
167 | } | ||
168 | EXPORT_SYMBOL(__ioremap); | ||
169 | |||
170 | /* | ||
171 | * __iounmap unmaps nearly everything, so be careful | ||
172 | * it doesn't free currently pointer/page tables anymore but it | ||
173 | * wasn't used anyway and might be added later. | ||
174 | */ | ||
175 | void __iounmap(void __iomem *addr) | ||
176 | { | ||
177 | struct vm_struct *p; | ||
178 | |||
179 | if ((unsigned long) addr > CONFIG_NIOS2_IO_REGION_BASE) | ||
180 | return; | ||
181 | |||
182 | p = remove_vm_area((void *) (PAGE_MASK & (unsigned long __force) addr)); | ||
183 | if (!p) | ||
184 | pr_err("iounmap: bad address %p\n", addr); | ||
185 | kfree(p); | ||
186 | } | ||
187 | EXPORT_SYMBOL(__iounmap); | ||
diff --git a/arch/nios2/mm/mmu_context.c b/arch/nios2/mm/mmu_context.c new file mode 100644 index 000000000000..45d6b9c58d67 --- /dev/null +++ b/arch/nios2/mm/mmu_context.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * MMU context handling. | ||
3 | * | ||
4 | * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> | ||
5 | * Copyright (C) 2009 Wind River Systems Inc | ||
6 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | |||
13 | #include <linux/mm.h> | ||
14 | |||
15 | #include <asm/cpuinfo.h> | ||
16 | #include <asm/mmu_context.h> | ||
17 | #include <asm/tlb.h> | ||
18 | |||
19 | /* The pids position and mask in context */ | ||
20 | #define PID_SHIFT 0 | ||
21 | #define PID_BITS (cpuinfo.tlb_pid_num_bits) | ||
22 | #define PID_MASK ((1UL << PID_BITS) - 1) | ||
23 | |||
24 | /* The versions position and mask in context */ | ||
25 | #define VERSION_BITS (32 - PID_BITS) | ||
26 | #define VERSION_SHIFT (PID_SHIFT + PID_BITS) | ||
27 | #define VERSION_MASK ((1UL << VERSION_BITS) - 1) | ||
28 | |||
29 | /* Return the version part of a context */ | ||
30 | #define CTX_VERSION(c) (((c) >> VERSION_SHIFT) & VERSION_MASK) | ||
31 | |||
32 | /* Return the pid part of a context */ | ||
33 | #define CTX_PID(c) (((c) >> PID_SHIFT) & PID_MASK) | ||
34 | |||
35 | /* Value of the first context (version 1, pid 0) */ | ||
36 | #define FIRST_CTX ((1UL << VERSION_SHIFT) | (0 << PID_SHIFT)) | ||
37 | |||
38 | static mm_context_t next_mmu_context; | ||
39 | |||
40 | /* | ||
41 | * Initialize MMU context management stuff. | ||
42 | */ | ||
43 | void __init mmu_context_init(void) | ||
44 | { | ||
45 | /* We need to set this here because the value depends on runtime data | ||
46 | * from cpuinfo */ | ||
47 | next_mmu_context = FIRST_CTX; | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * Set new context (pid), keep way | ||
52 | */ | ||
53 | static void set_context(mm_context_t context) | ||
54 | { | ||
55 | set_mmu_pid(CTX_PID(context)); | ||
56 | } | ||
57 | |||
58 | static mm_context_t get_new_context(void) | ||
59 | { | ||
60 | /* Return the next pid */ | ||
61 | next_mmu_context += (1UL << PID_SHIFT); | ||
62 | |||
63 | /* If the pid field wraps around we increase the version and | ||
64 | * flush the tlb */ | ||
65 | if (unlikely(CTX_PID(next_mmu_context) == 0)) { | ||
66 | /* Version is incremented since the pid increment above | ||
67 | * overflows info version */ | ||
68 | flush_cache_all(); | ||
69 | flush_tlb_all(); | ||
70 | } | ||
71 | |||
72 | /* If the version wraps we start over with the first generation, we do | ||
73 | * not need to flush the tlb here since it's always done above */ | ||
74 | if (unlikely(CTX_VERSION(next_mmu_context) == 0)) | ||
75 | next_mmu_context = FIRST_CTX; | ||
76 | |||
77 | return next_mmu_context; | ||
78 | } | ||
79 | |||
80 | void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
81 | struct task_struct *tsk) | ||
82 | { | ||
83 | unsigned long flags; | ||
84 | |||
85 | local_irq_save(flags); | ||
86 | |||
87 | /* If the process context we are swapping in has a different context | ||
88 | * generation then we have it should get a new generation/pid */ | ||
89 | if (unlikely(CTX_VERSION(next->context) != | ||
90 | CTX_VERSION(next_mmu_context))) | ||
91 | next->context = get_new_context(); | ||
92 | |||
93 | /* Save the current pgd so the fast tlb handler can find it */ | ||
94 | pgd_current = next->pgd; | ||
95 | |||
96 | /* Set the current context */ | ||
97 | set_context(next->context); | ||
98 | |||
99 | local_irq_restore(flags); | ||
100 | } | ||
101 | |||
102 | /* | ||
103 | * After we have set current->mm to a new value, this activates | ||
104 | * the context for the new mm so we see the new mappings. | ||
105 | */ | ||
106 | void activate_mm(struct mm_struct *prev, struct mm_struct *next) | ||
107 | { | ||
108 | next->context = get_new_context(); | ||
109 | set_context(next->context); | ||
110 | pgd_current = next->pgd; | ||
111 | } | ||
112 | |||
113 | unsigned long get_pid_from_context(mm_context_t *context) | ||
114 | { | ||
115 | return CTX_PID((*context)); | ||
116 | } | ||
diff --git a/arch/nios2/mm/pgtable.c b/arch/nios2/mm/pgtable.c new file mode 100644 index 000000000000..61e24a25f71a --- /dev/null +++ b/arch/nios2/mm/pgtable.c | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Wind River Systems Inc | ||
3 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #include <linux/mm.h> | ||
11 | #include <linux/sched.h> | ||
12 | |||
13 | #include <asm/pgtable.h> | ||
14 | #include <asm/cpuinfo.h> | ||
15 | |||
16 | /* pteaddr: | ||
17 | * ptbase | vpn* | zero | ||
18 | * 31-22 | 21-2 | 1-0 | ||
19 | * | ||
20 | * *vpn is preserved on double fault | ||
21 | * | ||
22 | * tlbacc: | ||
23 | * IG |*flags| pfn | ||
24 | * 31-25|24-20 | 19-0 | ||
25 | * | ||
26 | * *crwxg | ||
27 | * | ||
28 | * tlbmisc: | ||
29 | * resv |way |rd | we|pid |dbl|bad|perm|d | ||
30 | * 31-24 |23-20 |19 | 20|17-4|3 |2 |1 |0 | ||
31 | * | ||
32 | */ | ||
33 | |||
34 | /* | ||
35 | * Initialize a new pgd / pmd table with invalid pointers. | ||
36 | */ | ||
37 | static void pgd_init(pgd_t *pgd) | ||
38 | { | ||
39 | unsigned long *p = (unsigned long *) pgd; | ||
40 | int i; | ||
41 | |||
42 | for (i = 0; i < USER_PTRS_PER_PGD; i += 8) { | ||
43 | p[i + 0] = (unsigned long) invalid_pte_table; | ||
44 | p[i + 1] = (unsigned long) invalid_pte_table; | ||
45 | p[i + 2] = (unsigned long) invalid_pte_table; | ||
46 | p[i + 3] = (unsigned long) invalid_pte_table; | ||
47 | p[i + 4] = (unsigned long) invalid_pte_table; | ||
48 | p[i + 5] = (unsigned long) invalid_pte_table; | ||
49 | p[i + 6] = (unsigned long) invalid_pte_table; | ||
50 | p[i + 7] = (unsigned long) invalid_pte_table; | ||
51 | } | ||
52 | } | ||
53 | |||
54 | pgd_t *pgd_alloc(struct mm_struct *mm) | ||
55 | { | ||
56 | pgd_t *ret, *init; | ||
57 | |||
58 | ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER); | ||
59 | if (ret) { | ||
60 | init = pgd_offset(&init_mm, 0UL); | ||
61 | pgd_init(ret); | ||
62 | memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, | ||
63 | (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); | ||
64 | } | ||
65 | |||
66 | return ret; | ||
67 | } | ||
68 | |||
69 | void __init pagetable_init(void) | ||
70 | { | ||
71 | /* Initialize the entire pgd. */ | ||
72 | pgd_init(swapper_pg_dir); | ||
73 | pgd_init(swapper_pg_dir + USER_PTRS_PER_PGD); | ||
74 | } | ||
diff --git a/arch/nios2/mm/tlb.c b/arch/nios2/mm/tlb.c new file mode 100644 index 000000000000..cf10326aab1c --- /dev/null +++ b/arch/nios2/mm/tlb.c | |||
@@ -0,0 +1,275 @@ | |||
1 | /* | ||
2 | * Nios2 TLB handling | ||
3 | * | ||
4 | * Copyright (C) 2009, Wind River Systems Inc | ||
5 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/mm.h> | ||
15 | #include <linux/pagemap.h> | ||
16 | |||
17 | #include <asm/tlb.h> | ||
18 | #include <asm/mmu_context.h> | ||
19 | #include <asm/pgtable.h> | ||
20 | #include <asm/cpuinfo.h> | ||
21 | |||
22 | #define TLB_INDEX_MASK \ | ||
23 | ((((1UL << (cpuinfo.tlb_ptr_sz - cpuinfo.tlb_num_ways_log2))) - 1) \ | ||
24 | << PAGE_SHIFT) | ||
25 | |||
26 | /* Used as illegal PHYS_ADDR for TLB mappings | ||
27 | */ | ||
28 | #define MAX_PHYS_ADDR 0 | ||
29 | |||
30 | static void get_misc_and_pid(unsigned long *misc, unsigned long *pid) | ||
31 | { | ||
32 | *misc = RDCTL(CTL_TLBMISC); | ||
33 | *misc &= (TLBMISC_PID | TLBMISC_WAY); | ||
34 | *pid = *misc & TLBMISC_PID; | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * All entries common to a mm share an asid. To effectively flush these | ||
39 | * entries, we just bump the asid. | ||
40 | */ | ||
41 | void flush_tlb_mm(struct mm_struct *mm) | ||
42 | { | ||
43 | if (current->mm == mm) | ||
44 | flush_tlb_all(); | ||
45 | else | ||
46 | memset(&mm->context, 0, sizeof(mm_context_t)); | ||
47 | } | ||
48 | |||
49 | /* | ||
50 | * This one is only used for pages with the global bit set so we don't care | ||
51 | * much about the ASID. | ||
52 | */ | ||
53 | void flush_tlb_one_pid(unsigned long addr, unsigned long mmu_pid) | ||
54 | { | ||
55 | unsigned int way; | ||
56 | unsigned long org_misc, pid_misc; | ||
57 | |||
58 | pr_debug("Flush tlb-entry for vaddr=%#lx\n", addr); | ||
59 | |||
60 | /* remember pid/way until we return. */ | ||
61 | get_misc_and_pid(&org_misc, &pid_misc); | ||
62 | |||
63 | WRCTL(CTL_PTEADDR, (addr >> PAGE_SHIFT) << 2); | ||
64 | |||
65 | for (way = 0; way < cpuinfo.tlb_num_ways; way++) { | ||
66 | unsigned long pteaddr; | ||
67 | unsigned long tlbmisc; | ||
68 | unsigned long pid; | ||
69 | |||
70 | tlbmisc = pid_misc | TLBMISC_RD | (way << TLBMISC_WAY_SHIFT); | ||
71 | WRCTL(CTL_TLBMISC, tlbmisc); | ||
72 | pteaddr = RDCTL(CTL_PTEADDR); | ||
73 | tlbmisc = RDCTL(CTL_TLBMISC); | ||
74 | pid = (tlbmisc >> TLBMISC_PID_SHIFT) & TLBMISC_PID_MASK; | ||
75 | if (((((pteaddr >> 2) & 0xfffff)) == (addr >> PAGE_SHIFT)) && | ||
76 | pid == mmu_pid) { | ||
77 | unsigned long vaddr = CONFIG_NIOS2_IO_REGION_BASE + | ||
78 | ((PAGE_SIZE * cpuinfo.tlb_num_lines) * way) + | ||
79 | (addr & TLB_INDEX_MASK); | ||
80 | pr_debug("Flush entry by writing %#lx way=%dl pid=%ld\n", | ||
81 | vaddr, way, (pid_misc >> TLBMISC_PID_SHIFT)); | ||
82 | |||
83 | WRCTL(CTL_PTEADDR, (vaddr >> 12) << 2); | ||
84 | tlbmisc = pid_misc | TLBMISC_WE | | ||
85 | (way << TLBMISC_WAY_SHIFT); | ||
86 | WRCTL(CTL_TLBMISC, tlbmisc); | ||
87 | WRCTL(CTL_TLBACC, (MAX_PHYS_ADDR >> PAGE_SHIFT)); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | WRCTL(CTL_TLBMISC, org_misc); | ||
92 | } | ||
93 | |||
94 | void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | ||
95 | unsigned long end) | ||
96 | { | ||
97 | unsigned long mmu_pid = get_pid_from_context(&vma->vm_mm->context); | ||
98 | |||
99 | while (start < end) { | ||
100 | flush_tlb_one_pid(start, mmu_pid); | ||
101 | start += PAGE_SIZE; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | void flush_tlb_kernel_range(unsigned long start, unsigned long end) | ||
106 | { | ||
107 | while (start < end) { | ||
108 | flush_tlb_one(start); | ||
109 | start += PAGE_SIZE; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | /* | ||
114 | * This one is only used for pages with the global bit set so we don't care | ||
115 | * much about the ASID. | ||
116 | */ | ||
117 | void flush_tlb_one(unsigned long addr) | ||
118 | { | ||
119 | unsigned int way; | ||
120 | unsigned long org_misc, pid_misc; | ||
121 | |||
122 | pr_debug("Flush tlb-entry for vaddr=%#lx\n", addr); | ||
123 | |||
124 | /* remember pid/way until we return. */ | ||
125 | get_misc_and_pid(&org_misc, &pid_misc); | ||
126 | |||
127 | WRCTL(CTL_PTEADDR, (addr >> PAGE_SHIFT) << 2); | ||
128 | |||
129 | for (way = 0; way < cpuinfo.tlb_num_ways; way++) { | ||
130 | unsigned long pteaddr; | ||
131 | unsigned long tlbmisc; | ||
132 | |||
133 | tlbmisc = pid_misc | TLBMISC_RD | (way << TLBMISC_WAY_SHIFT); | ||
134 | WRCTL(CTL_TLBMISC, tlbmisc); | ||
135 | pteaddr = RDCTL(CTL_PTEADDR); | ||
136 | tlbmisc = RDCTL(CTL_TLBMISC); | ||
137 | |||
138 | if ((((pteaddr >> 2) & 0xfffff)) == (addr >> PAGE_SHIFT)) { | ||
139 | unsigned long vaddr = CONFIG_NIOS2_IO_REGION_BASE + | ||
140 | ((PAGE_SIZE * cpuinfo.tlb_num_lines) * way) + | ||
141 | (addr & TLB_INDEX_MASK); | ||
142 | |||
143 | pr_debug("Flush entry by writing %#lx way=%dl pid=%ld\n", | ||
144 | vaddr, way, (pid_misc >> TLBMISC_PID_SHIFT)); | ||
145 | |||
146 | tlbmisc = pid_misc | TLBMISC_WE | | ||
147 | (way << TLBMISC_WAY_SHIFT); | ||
148 | WRCTL(CTL_PTEADDR, (vaddr >> 12) << 2); | ||
149 | WRCTL(CTL_TLBMISC, tlbmisc); | ||
150 | WRCTL(CTL_TLBACC, (MAX_PHYS_ADDR >> PAGE_SHIFT)); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | WRCTL(CTL_TLBMISC, org_misc); | ||
155 | } | ||
156 | |||
157 | void dump_tlb_line(unsigned long line) | ||
158 | { | ||
159 | unsigned int way; | ||
160 | unsigned long org_misc; | ||
161 | |||
162 | pr_debug("dump tlb-entries for line=%#lx (addr %08lx)\n", line, | ||
163 | line << (PAGE_SHIFT + cpuinfo.tlb_num_ways_log2)); | ||
164 | |||
165 | /* remember pid/way until we return */ | ||
166 | org_misc = (RDCTL(CTL_TLBMISC) & (TLBMISC_PID | TLBMISC_WAY)); | ||
167 | |||
168 | WRCTL(CTL_PTEADDR, line << 2); | ||
169 | |||
170 | for (way = 0; way < cpuinfo.tlb_num_ways; way++) { | ||
171 | unsigned long pteaddr; | ||
172 | unsigned long tlbmisc; | ||
173 | unsigned long tlbacc; | ||
174 | |||
175 | WRCTL(CTL_TLBMISC, TLBMISC_RD | (way << TLBMISC_WAY_SHIFT)); | ||
176 | pteaddr = RDCTL(CTL_PTEADDR); | ||
177 | tlbmisc = RDCTL(CTL_TLBMISC); | ||
178 | tlbacc = RDCTL(CTL_TLBACC); | ||
179 | |||
180 | if ((tlbacc << PAGE_SHIFT) != (MAX_PHYS_ADDR & PAGE_MASK)) { | ||
181 | pr_debug("-- way:%02x vpn:0x%08lx phys:0x%08lx pid:0x%02lx flags:%c%c%c%c%c\n", | ||
182 | way, | ||
183 | (pteaddr << (PAGE_SHIFT-2)), | ||
184 | (tlbacc << PAGE_SHIFT), | ||
185 | ((tlbmisc >> TLBMISC_PID_SHIFT) & | ||
186 | TLBMISC_PID_MASK), | ||
187 | (tlbacc & _PAGE_READ ? 'r' : '-'), | ||
188 | (tlbacc & _PAGE_WRITE ? 'w' : '-'), | ||
189 | (tlbacc & _PAGE_EXEC ? 'x' : '-'), | ||
190 | (tlbacc & _PAGE_GLOBAL ? 'g' : '-'), | ||
191 | (tlbacc & _PAGE_CACHED ? 'c' : '-')); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | WRCTL(CTL_TLBMISC, org_misc); | ||
196 | } | ||
197 | |||
198 | void dump_tlb(void) | ||
199 | { | ||
200 | unsigned int i; | ||
201 | |||
202 | for (i = 0; i < cpuinfo.tlb_num_lines; i++) | ||
203 | dump_tlb_line(i); | ||
204 | } | ||
205 | |||
206 | void flush_tlb_pid(unsigned long pid) | ||
207 | { | ||
208 | unsigned int line; | ||
209 | unsigned int way; | ||
210 | unsigned long org_misc, pid_misc; | ||
211 | |||
212 | /* remember pid/way until we return */ | ||
213 | get_misc_and_pid(&org_misc, &pid_misc); | ||
214 | |||
215 | for (line = 0; line < cpuinfo.tlb_num_lines; line++) { | ||
216 | WRCTL(CTL_PTEADDR, line << 2); | ||
217 | |||
218 | for (way = 0; way < cpuinfo.tlb_num_ways; way++) { | ||
219 | unsigned long pteaddr; | ||
220 | unsigned long tlbmisc; | ||
221 | unsigned long tlbacc; | ||
222 | |||
223 | tlbmisc = pid_misc | TLBMISC_RD | | ||
224 | (way << TLBMISC_WAY_SHIFT); | ||
225 | WRCTL(CTL_TLBMISC, tlbmisc); | ||
226 | pteaddr = RDCTL(CTL_PTEADDR); | ||
227 | tlbmisc = RDCTL(CTL_TLBMISC); | ||
228 | tlbacc = RDCTL(CTL_TLBACC); | ||
229 | |||
230 | if (((tlbmisc>>TLBMISC_PID_SHIFT) & TLBMISC_PID_MASK) | ||
231 | == pid) { | ||
232 | tlbmisc = pid_misc | TLBMISC_WE | | ||
233 | (way << TLBMISC_WAY_SHIFT); | ||
234 | WRCTL(CTL_TLBMISC, tlbmisc); | ||
235 | WRCTL(CTL_TLBACC, | ||
236 | (MAX_PHYS_ADDR >> PAGE_SHIFT)); | ||
237 | } | ||
238 | } | ||
239 | |||
240 | WRCTL(CTL_TLBMISC, org_misc); | ||
241 | } | ||
242 | } | ||
243 | |||
244 | void flush_tlb_all(void) | ||
245 | { | ||
246 | int i; | ||
247 | unsigned long vaddr = CONFIG_NIOS2_IO_REGION_BASE; | ||
248 | unsigned int way; | ||
249 | unsigned long org_misc, pid_misc, tlbmisc; | ||
250 | |||
251 | /* remember pid/way until we return */ | ||
252 | get_misc_and_pid(&org_misc, &pid_misc); | ||
253 | pid_misc |= TLBMISC_WE; | ||
254 | |||
255 | /* Map each TLB entry to physcal address 0 with no-access and a | ||
256 | bad ptbase */ | ||
257 | for (way = 0; way < cpuinfo.tlb_num_ways; way++) { | ||
258 | tlbmisc = pid_misc | (way << TLBMISC_WAY_SHIFT); | ||
259 | for (i = 0; i < cpuinfo.tlb_num_lines; i++) { | ||
260 | WRCTL(CTL_PTEADDR, ((vaddr) >> PAGE_SHIFT) << 2); | ||
261 | WRCTL(CTL_TLBMISC, tlbmisc); | ||
262 | WRCTL(CTL_TLBACC, (MAX_PHYS_ADDR >> PAGE_SHIFT)); | ||
263 | vaddr += 1UL << 12; | ||
264 | } | ||
265 | } | ||
266 | |||
267 | /* restore pid/way */ | ||
268 | WRCTL(CTL_TLBMISC, org_misc); | ||
269 | } | ||
270 | |||
271 | void set_mmu_pid(unsigned long pid) | ||
272 | { | ||
273 | WRCTL(CTL_TLBMISC, (RDCTL(CTL_TLBMISC) & TLBMISC_WAY) | | ||
274 | ((pid & TLBMISC_PID_MASK) << TLBMISC_PID_SHIFT)); | ||
275 | } | ||
diff --git a/arch/nios2/mm/uaccess.c b/arch/nios2/mm/uaccess.c new file mode 100644 index 000000000000..7663e156ff4f --- /dev/null +++ b/arch/nios2/mm/uaccess.c | |||
@@ -0,0 +1,163 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2009, Wind River Systems Inc | ||
7 | * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
8 | */ | ||
9 | |||
10 | #include <linux/export.h> | ||
11 | #include <linux/uaccess.h> | ||
12 | |||
13 | asm(".global __copy_from_user\n" | ||
14 | " .type __copy_from_user, @function\n" | ||
15 | "__copy_from_user:\n" | ||
16 | " movi r2,7\n" | ||
17 | " mov r3,r4\n" | ||
18 | " bge r2,r6,1f\n" | ||
19 | " xor r2,r4,r5\n" | ||
20 | " andi r2,r2,3\n" | ||
21 | " movi r7,3\n" | ||
22 | " beq r2,zero,4f\n" | ||
23 | "1: addi r6,r6,-1\n" | ||
24 | " movi r2,-1\n" | ||
25 | " beq r6,r2,3f\n" | ||
26 | " mov r7,r2\n" | ||
27 | "2: ldbu r2,0(r5)\n" | ||
28 | " addi r6,r6,-1\n" | ||
29 | " addi r5,r5,1\n" | ||
30 | " stb r2,0(r3)\n" | ||
31 | " addi r3,r3,1\n" | ||
32 | " bne r6,r7,2b\n" | ||
33 | "3:\n" | ||
34 | " addi r2,r6,1\n" | ||
35 | " ret\n" | ||
36 | "13:mov r2,r6\n" | ||
37 | " ret\n" | ||
38 | "4: andi r2,r4,1\n" | ||
39 | " cmpeq r2,r2,zero\n" | ||
40 | " beq r2,zero,7f\n" | ||
41 | "5: andi r2,r3,2\n" | ||
42 | " beq r2,zero,6f\n" | ||
43 | "9: ldhu r2,0(r5)\n" | ||
44 | " addi r6,r6,-2\n" | ||
45 | " addi r5,r5,2\n" | ||
46 | " sth r2,0(r3)\n" | ||
47 | " addi r3,r3,2\n" | ||
48 | "6: bge r7,r6,1b\n" | ||
49 | "10:ldw r2,0(r5)\n" | ||
50 | " addi r6,r6,-4\n" | ||
51 | " addi r5,r5,4\n" | ||
52 | " stw r2,0(r3)\n" | ||
53 | " addi r3,r3,4\n" | ||
54 | " br 6b\n" | ||
55 | "7: ldbu r2,0(r5)\n" | ||
56 | " addi r6,r6,-1\n" | ||
57 | " addi r5,r5,1\n" | ||
58 | " addi r3,r4,1\n" | ||
59 | " stb r2,0(r4)\n" | ||
60 | " br 5b\n" | ||
61 | ".section __ex_table,\"a\"\n" | ||
62 | ".word 2b,3b\n" | ||
63 | ".word 9b,13b\n" | ||
64 | ".word 10b,13b\n" | ||
65 | ".word 7b,13b\n" | ||
66 | ".previous\n" | ||
67 | ); | ||
68 | EXPORT_SYMBOL(__copy_from_user); | ||
69 | |||
70 | asm( | ||
71 | " .global __copy_to_user\n" | ||
72 | " .type __copy_to_user, @function\n" | ||
73 | "__copy_to_user:\n" | ||
74 | " movi r2,7\n" | ||
75 | " mov r3,r4\n" | ||
76 | " bge r2,r6,1f\n" | ||
77 | " xor r2,r4,r5\n" | ||
78 | " andi r2,r2,3\n" | ||
79 | " movi r7,3\n" | ||
80 | " beq r2,zero,4f\n" | ||
81 | /* Bail if we try to copy zero bytes */ | ||
82 | "1: addi r6,r6,-1\n" | ||
83 | " movi r2,-1\n" | ||
84 | " beq r6,r2,3f\n" | ||
85 | /* Copy byte by byte for small copies and if src^dst != 0 */ | ||
86 | " mov r7,r2\n" | ||
87 | "2: ldbu r2,0(r5)\n" | ||
88 | " addi r5,r5,1\n" | ||
89 | "9: stb r2,0(r3)\n" | ||
90 | " addi r6,r6,-1\n" | ||
91 | " addi r3,r3,1\n" | ||
92 | " bne r6,r7,2b\n" | ||
93 | "3: addi r2,r6,1\n" | ||
94 | " ret\n" | ||
95 | "13:mov r2,r6\n" | ||
96 | " ret\n" | ||
97 | /* If 'to' is an odd address byte copy */ | ||
98 | "4: andi r2,r4,1\n" | ||
99 | " cmpeq r2,r2,zero\n" | ||
100 | " beq r2,zero,7f\n" | ||
101 | /* If 'to' is not divideable by four copy halfwords */ | ||
102 | "5: andi r2,r3,2\n" | ||
103 | " beq r2,zero,6f\n" | ||
104 | " ldhu r2,0(r5)\n" | ||
105 | " addi r5,r5,2\n" | ||
106 | "10:sth r2,0(r3)\n" | ||
107 | " addi r6,r6,-2\n" | ||
108 | " addi r3,r3,2\n" | ||
109 | /* Copy words */ | ||
110 | "6: bge r7,r6,1b\n" | ||
111 | " ldw r2,0(r5)\n" | ||
112 | " addi r5,r5,4\n" | ||
113 | "11:stw r2,0(r3)\n" | ||
114 | " addi r6,r6,-4\n" | ||
115 | " addi r3,r3,4\n" | ||
116 | " br 6b\n" | ||
117 | /* Copy remaining bytes */ | ||
118 | "7: ldbu r2,0(r5)\n" | ||
119 | " addi r5,r5,1\n" | ||
120 | " addi r3,r4,1\n" | ||
121 | "12: stb r2,0(r4)\n" | ||
122 | " addi r6,r6,-1\n" | ||
123 | " br 5b\n" | ||
124 | ".section __ex_table,\"a\"\n" | ||
125 | ".word 9b,3b\n" | ||
126 | ".word 10b,13b\n" | ||
127 | ".word 11b,13b\n" | ||
128 | ".word 12b,13b\n" | ||
129 | ".previous\n"); | ||
130 | EXPORT_SYMBOL(__copy_to_user); | ||
131 | |||
132 | long strncpy_from_user(char *__to, const char __user *__from, long __len) | ||
133 | { | ||
134 | int l = strnlen_user(__from, __len); | ||
135 | int is_zt = 1; | ||
136 | |||
137 | if (l > __len) { | ||
138 | is_zt = 0; | ||
139 | l = __len; | ||
140 | } | ||
141 | |||
142 | if (l == 0 || copy_from_user(__to, __from, l)) | ||
143 | return -EFAULT; | ||
144 | |||
145 | if (is_zt) | ||
146 | l--; | ||
147 | return l; | ||
148 | } | ||
149 | |||
150 | long strnlen_user(const char __user *s, long n) | ||
151 | { | ||
152 | long i; | ||
153 | |||
154 | for (i = 0; i < n; i++) { | ||
155 | char c; | ||
156 | |||
157 | if (get_user(c, s + i) == -EFAULT) | ||
158 | return 0; | ||
159 | if (c == 0) | ||
160 | return i + 1; | ||
161 | } | ||
162 | return n + 1; | ||
163 | } | ||
diff --git a/arch/nios2/platform/Kconfig.platform b/arch/nios2/platform/Kconfig.platform new file mode 100644 index 000000000000..d3e5df9fb36b --- /dev/null +++ b/arch/nios2/platform/Kconfig.platform | |||
@@ -0,0 +1,129 @@ | |||
1 | menu "Platform options" | ||
2 | |||
3 | comment "Memory settings" | ||
4 | |||
5 | config NIOS2_MEM_BASE | ||
6 | hex "Memory base address" | ||
7 | default "0x00000000" | ||
8 | help | ||
9 | This is the physical address of the memory that the kernel will run | ||
10 | from. This address is used to link the kernel and setup initial memory | ||
11 | management. You should take the raw memory address without any MMU | ||
12 | or cache bits set. | ||
13 | Please not that this address is used directly so you have to manually | ||
14 | do address translation if it's connected to a bridge. | ||
15 | |||
16 | comment "Device tree" | ||
17 | |||
18 | config NIOS2_DTB_AT_PHYS_ADDR | ||
19 | bool "DTB at physical address" | ||
20 | default n | ||
21 | help | ||
22 | When enabled you can select a physical address to load the dtb from. | ||
23 | Normally this address is passed by a bootloader such as u-boot but | ||
24 | using this you can use a devicetree without a bootloader. | ||
25 | This way you can store a devicetree in NOR flash or an onchip rom. | ||
26 | Please note that this address is used directly so you have to manually | ||
27 | do address translation if it's connected to a bridge. Also take into | ||
28 | account that when using an MMU you'd have to ad 0xC0000000 to your | ||
29 | address | ||
30 | |||
31 | config NIOS2_DTB_PHYS_ADDR | ||
32 | hex "DTB Address" | ||
33 | depends on NIOS2_DTB_AT_PHYS_ADDR | ||
34 | default "0xC0000000" | ||
35 | help | ||
36 | Physical address of a dtb blob. | ||
37 | |||
38 | config NIOS2_DTB_SOURCE_BOOL | ||
39 | bool "Compile and link device tree into kernel image" | ||
40 | default n | ||
41 | help | ||
42 | This allows you to specify a dts (device tree source) file | ||
43 | which will be compiled and linked into the kernel image. | ||
44 | |||
45 | config NIOS2_DTB_SOURCE | ||
46 | string "Device tree source file" | ||
47 | depends on NIOS2_DTB_SOURCE_BOOL | ||
48 | default "" | ||
49 | help | ||
50 | Absolute path to the device tree source (dts) file describing your | ||
51 | system. | ||
52 | |||
53 | comment "Nios II instructions" | ||
54 | |||
55 | config NIOS2_HW_MUL_SUPPORT | ||
56 | bool "Enable MUL instruction" | ||
57 | default n | ||
58 | help | ||
59 | Set to true if you configured the Nios II to include the MUL | ||
60 | instruction. This will enable the -mhw-mul compiler flag. | ||
61 | |||
62 | config NIOS2_HW_MULX_SUPPORT | ||
63 | bool "Enable MULX instruction" | ||
64 | default n | ||
65 | help | ||
66 | Set to true if you configured the Nios II to include the MULX | ||
67 | instruction. Enables the -mhw-mulx compiler flag. | ||
68 | |||
69 | config NIOS2_HW_DIV_SUPPORT | ||
70 | bool "Enable DIV instruction" | ||
71 | default n | ||
72 | help | ||
73 | Set to true if you configured the Nios II to include the DIV | ||
74 | instruction. Enables the -mhw-div compiler flag. | ||
75 | |||
76 | config NIOS2_FPU_SUPPORT | ||
77 | bool "Custom floating point instr support" | ||
78 | default n | ||
79 | help | ||
80 | Enables the -mcustom-fpu-cfg=60-1 compiler flag. | ||
81 | |||
82 | config NIOS2_CI_SWAB_SUPPORT | ||
83 | bool "Byteswap custom instruction" | ||
84 | default n | ||
85 | help | ||
86 | Use the byteswap (endian converter) Nios II custom instruction provided | ||
87 | by Altera and which can be enabled in QSYS builder. This accelerates | ||
88 | endian conversions in the kernel (e.g. ntohs). | ||
89 | |||
90 | config NIOS2_CI_SWAB_NO | ||
91 | int "Byteswap custom instruction number" if NIOS2_CI_SWAB_SUPPORT | ||
92 | default 0 | ||
93 | help | ||
94 | Number of the instruction as configured in QSYS Builder. | ||
95 | |||
96 | comment "Cache settings" | ||
97 | |||
98 | config CUSTOM_CACHE_SETTINGS | ||
99 | bool "Custom cache settings" | ||
100 | help | ||
101 | This option allows you to tweak the cache settings used during early | ||
102 | boot (where the information from device tree is not yet available). | ||
103 | There should be no reason to change these values. Linux will work | ||
104 | perfectly fine, even if the Nios II is configured with smaller caches. | ||
105 | |||
106 | Say N here unless you know what you are doing. | ||
107 | |||
108 | config NIOS2_DCACHE_SIZE | ||
109 | hex "D-Cache size" if CUSTOM_CACHE_SETTINGS | ||
110 | range 0x200 0x10000 | ||
111 | default "0x800" | ||
112 | help | ||
113 | Maximum possible data cache size. | ||
114 | |||
115 | config NIOS2_DCACHE_LINE_SIZE | ||
116 | hex "D-Cache line size" if CUSTOM_CACHE_SETTINGS | ||
117 | range 0x10 0x20 | ||
118 | default "0x20" | ||
119 | help | ||
120 | Minimum possible data cache line size. | ||
121 | |||
122 | config NIOS2_ICACHE_SIZE | ||
123 | hex "I-Cache size" if CUSTOM_CACHE_SETTINGS | ||
124 | range 0x200 0x10000 | ||
125 | default "0x1000" | ||
126 | help | ||
127 | Maximum possible instruction cache size. | ||
128 | |||
129 | endmenu | ||
diff --git a/arch/nios2/platform/Makefile b/arch/nios2/platform/Makefile new file mode 100644 index 000000000000..46364f1d9352 --- /dev/null +++ b/arch/nios2/platform/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-y += platform.o | |||
diff --git a/arch/nios2/platform/platform.c b/arch/nios2/platform/platform.c new file mode 100644 index 000000000000..d478773f758a --- /dev/null +++ b/arch/nios2/platform/platform.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Altera Corporation | ||
3 | * Copyright (C) 2011 Thomas Chou | ||
4 | * Copyright (C) 2011 Walter Goossens | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General | ||
7 | * Public License. See the file COPYING in the main directory of this | ||
8 | * archive for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/init.h> | ||
12 | #include <linux/of_platform.h> | ||
13 | #include <linux/of_address.h> | ||
14 | #include <linux/of_fdt.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/sys_soc.h> | ||
18 | #include <linux/io.h> | ||
19 | |||
20 | static int __init nios2_soc_device_init(void) | ||
21 | { | ||
22 | struct soc_device *soc_dev; | ||
23 | struct soc_device_attribute *soc_dev_attr; | ||
24 | const char *machine; | ||
25 | |||
26 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); | ||
27 | if (soc_dev_attr) { | ||
28 | machine = of_flat_dt_get_machine_name(); | ||
29 | if (machine) | ||
30 | soc_dev_attr->machine = kasprintf(GFP_KERNEL, "%s", | ||
31 | machine); | ||
32 | |||
33 | soc_dev_attr->family = "Nios II"; | ||
34 | |||
35 | soc_dev = soc_device_register(soc_dev_attr); | ||
36 | if (IS_ERR(soc_dev)) { | ||
37 | kfree(soc_dev_attr->machine); | ||
38 | kfree(soc_dev_attr); | ||
39 | } | ||
40 | } | ||
41 | |||
42 | return of_platform_populate(NULL, of_default_bus_match_table, | ||
43 | NULL, NULL); | ||
44 | } | ||
45 | |||
46 | device_initcall(nios2_soc_device_init); | ||
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index 4006964d8e12..a5cb070b54bf 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #include <asm/errno.h> | 9 | #include <asm/errno.h> |
10 | #include <asm-generic/uaccess-unaligned.h> | 10 | #include <asm-generic/uaccess-unaligned.h> |
11 | 11 | ||
12 | #include <linux/bug.h> | ||
13 | |||
12 | #define VERIFY_READ 0 | 14 | #define VERIFY_READ 0 |
13 | #define VERIFY_WRITE 1 | 15 | #define VERIFY_WRITE 1 |
14 | 16 | ||
@@ -28,11 +30,6 @@ | |||
28 | * that put_user is the same as __put_user, etc. | 30 | * that put_user is the same as __put_user, etc. |
29 | */ | 31 | */ |
30 | 32 | ||
31 | extern int __get_kernel_bad(void); | ||
32 | extern int __get_user_bad(void); | ||
33 | extern int __put_kernel_bad(void); | ||
34 | extern int __put_user_bad(void); | ||
35 | |||
36 | static inline long access_ok(int type, const void __user * addr, | 33 | static inline long access_ok(int type, const void __user * addr, |
37 | unsigned long size) | 34 | unsigned long size) |
38 | { | 35 | { |
@@ -43,8 +40,8 @@ static inline long access_ok(int type, const void __user * addr, | |||
43 | #define get_user __get_user | 40 | #define get_user __get_user |
44 | 41 | ||
45 | #if !defined(CONFIG_64BIT) | 42 | #if !defined(CONFIG_64BIT) |
46 | #define LDD_KERNEL(ptr) __get_kernel_bad(); | 43 | #define LDD_KERNEL(ptr) BUILD_BUG() |
47 | #define LDD_USER(ptr) __get_user_bad(); | 44 | #define LDD_USER(ptr) BUILD_BUG() |
48 | #define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr) | 45 | #define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr) |
49 | #define STD_USER(x, ptr) __put_user_asm64(x,ptr) | 46 | #define STD_USER(x, ptr) __put_user_asm64(x,ptr) |
50 | #define ASM_WORD_INSN ".word\t" | 47 | #define ASM_WORD_INSN ".word\t" |
@@ -94,7 +91,7 @@ struct exception_data { | |||
94 | case 2: __get_kernel_asm("ldh",ptr); break; \ | 91 | case 2: __get_kernel_asm("ldh",ptr); break; \ |
95 | case 4: __get_kernel_asm("ldw",ptr); break; \ | 92 | case 4: __get_kernel_asm("ldw",ptr); break; \ |
96 | case 8: LDD_KERNEL(ptr); break; \ | 93 | case 8: LDD_KERNEL(ptr); break; \ |
97 | default: __get_kernel_bad(); break; \ | 94 | default: BUILD_BUG(); break; \ |
98 | } \ | 95 | } \ |
99 | } \ | 96 | } \ |
100 | else { \ | 97 | else { \ |
@@ -103,7 +100,7 @@ struct exception_data { | |||
103 | case 2: __get_user_asm("ldh",ptr); break; \ | 100 | case 2: __get_user_asm("ldh",ptr); break; \ |
104 | case 4: __get_user_asm("ldw",ptr); break; \ | 101 | case 4: __get_user_asm("ldw",ptr); break; \ |
105 | case 8: LDD_USER(ptr); break; \ | 102 | case 8: LDD_USER(ptr); break; \ |
106 | default: __get_user_bad(); break; \ | 103 | default: BUILD_BUG(); break; \ |
107 | } \ | 104 | } \ |
108 | } \ | 105 | } \ |
109 | \ | 106 | \ |
@@ -136,7 +133,7 @@ struct exception_data { | |||
136 | case 2: __put_kernel_asm("sth",__x,ptr); break; \ | 133 | case 2: __put_kernel_asm("sth",__x,ptr); break; \ |
137 | case 4: __put_kernel_asm("stw",__x,ptr); break; \ | 134 | case 4: __put_kernel_asm("stw",__x,ptr); break; \ |
138 | case 8: STD_KERNEL(__x,ptr); break; \ | 135 | case 8: STD_KERNEL(__x,ptr); break; \ |
139 | default: __put_kernel_bad(); break; \ | 136 | default: BUILD_BUG(); break; \ |
140 | } \ | 137 | } \ |
141 | } \ | 138 | } \ |
142 | else { \ | 139 | else { \ |
@@ -145,7 +142,7 @@ struct exception_data { | |||
145 | case 2: __put_user_asm("sth",__x,ptr); break; \ | 142 | case 2: __put_user_asm("sth",__x,ptr); break; \ |
146 | case 4: __put_user_asm("stw",__x,ptr); break; \ | 143 | case 4: __put_user_asm("stw",__x,ptr); break; \ |
147 | case 8: STD_USER(__x,ptr); break; \ | 144 | case 8: STD_USER(__x,ptr); break; \ |
148 | default: __put_user_bad(); break; \ | 145 | default: BUILD_BUG(); break; \ |
149 | } \ | 146 | } \ |
150 | } \ | 147 | } \ |
151 | \ | 148 | \ |
diff --git a/arch/parisc/include/uapi/asm/bitsperlong.h b/arch/parisc/include/uapi/asm/bitsperlong.h index 75196b415d3f..e0a23c7bdd43 100644 --- a/arch/parisc/include/uapi/asm/bitsperlong.h +++ b/arch/parisc/include/uapi/asm/bitsperlong.h | |||
@@ -1,13 +1,7 @@ | |||
1 | #ifndef __ASM_PARISC_BITSPERLONG_H | 1 | #ifndef __ASM_PARISC_BITSPERLONG_H |
2 | #define __ASM_PARISC_BITSPERLONG_H | 2 | #define __ASM_PARISC_BITSPERLONG_H |
3 | 3 | ||
4 | /* | 4 | #if defined(__LP64__) |
5 | * using CONFIG_* outside of __KERNEL__ is wrong, | ||
6 | * __LP64__ was also removed from headers, so what | ||
7 | * is the right approach on parisc? | ||
8 | * -arnd | ||
9 | */ | ||
10 | #if (defined(__KERNEL__) && defined(CONFIG_64BIT)) || defined (__LP64__) | ||
11 | #define __BITS_PER_LONG 64 | 5 | #define __BITS_PER_LONG 64 |
12 | #define SHIFT_PER_LONG 6 | 6 | #define SHIFT_PER_LONG 6 |
13 | #else | 7 | #else |
diff --git a/arch/parisc/include/uapi/asm/msgbuf.h b/arch/parisc/include/uapi/asm/msgbuf.h index fe88f2649418..342138983914 100644 --- a/arch/parisc/include/uapi/asm/msgbuf.h +++ b/arch/parisc/include/uapi/asm/msgbuf.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _PARISC_MSGBUF_H | 1 | #ifndef _PARISC_MSGBUF_H |
2 | #define _PARISC_MSGBUF_H | 2 | #define _PARISC_MSGBUF_H |
3 | 3 | ||
4 | #include <asm/bitsperlong.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * The msqid64_ds structure for parisc architecture, copied from sparc. | 7 | * The msqid64_ds structure for parisc architecture, copied from sparc. |
6 | * Note extra padding because this structure is passed back and forth | 8 | * Note extra padding because this structure is passed back and forth |
@@ -13,15 +15,15 @@ | |||
13 | 15 | ||
14 | struct msqid64_ds { | 16 | struct msqid64_ds { |
15 | struct ipc64_perm msg_perm; | 17 | struct ipc64_perm msg_perm; |
16 | #ifndef CONFIG_64BIT | 18 | #if __BITS_PER_LONG != 64 |
17 | unsigned int __pad1; | 19 | unsigned int __pad1; |
18 | #endif | 20 | #endif |
19 | __kernel_time_t msg_stime; /* last msgsnd time */ | 21 | __kernel_time_t msg_stime; /* last msgsnd time */ |
20 | #ifndef CONFIG_64BIT | 22 | #if __BITS_PER_LONG != 64 |
21 | unsigned int __pad2; | 23 | unsigned int __pad2; |
22 | #endif | 24 | #endif |
23 | __kernel_time_t msg_rtime; /* last msgrcv time */ | 25 | __kernel_time_t msg_rtime; /* last msgrcv time */ |
24 | #ifndef CONFIG_64BIT | 26 | #if __BITS_PER_LONG != 64 |
25 | unsigned int __pad3; | 27 | unsigned int __pad3; |
26 | #endif | 28 | #endif |
27 | __kernel_time_t msg_ctime; /* last change time */ | 29 | __kernel_time_t msg_ctime; /* last change time */ |
diff --git a/arch/parisc/include/uapi/asm/sembuf.h b/arch/parisc/include/uapi/asm/sembuf.h index 1e59ffd3bd1e..f01d89e30d73 100644 --- a/arch/parisc/include/uapi/asm/sembuf.h +++ b/arch/parisc/include/uapi/asm/sembuf.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _PARISC_SEMBUF_H | 1 | #ifndef _PARISC_SEMBUF_H |
2 | #define _PARISC_SEMBUF_H | 2 | #define _PARISC_SEMBUF_H |
3 | 3 | ||
4 | #include <asm/bitsperlong.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * The semid64_ds structure for parisc architecture. | 7 | * The semid64_ds structure for parisc architecture. |
6 | * Note extra padding because this structure is passed back and forth | 8 | * Note extra padding because this structure is passed back and forth |
@@ -13,11 +15,11 @@ | |||
13 | 15 | ||
14 | struct semid64_ds { | 16 | struct semid64_ds { |
15 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | 17 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ |
16 | #ifndef CONFIG_64BIT | 18 | #if __BITS_PER_LONG != 64 |
17 | unsigned int __pad1; | 19 | unsigned int __pad1; |
18 | #endif | 20 | #endif |
19 | __kernel_time_t sem_otime; /* last semop time */ | 21 | __kernel_time_t sem_otime; /* last semop time */ |
20 | #ifndef CONFIG_64BIT | 22 | #if __BITS_PER_LONG != 64 |
21 | unsigned int __pad2; | 23 | unsigned int __pad2; |
22 | #endif | 24 | #endif |
23 | __kernel_time_t sem_ctime; /* last change time */ | 25 | __kernel_time_t sem_ctime; /* last change time */ |
diff --git a/arch/parisc/include/uapi/asm/shmbuf.h b/arch/parisc/include/uapi/asm/shmbuf.h index 0a3eada1863b..8496c38560c6 100644 --- a/arch/parisc/include/uapi/asm/shmbuf.h +++ b/arch/parisc/include/uapi/asm/shmbuf.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _PARISC_SHMBUF_H | 1 | #ifndef _PARISC_SHMBUF_H |
2 | #define _PARISC_SHMBUF_H | 2 | #define _PARISC_SHMBUF_H |
3 | 3 | ||
4 | #include <asm/bitsperlong.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * The shmid64_ds structure for parisc architecture. | 7 | * The shmid64_ds structure for parisc architecture. |
6 | * Note extra padding because this structure is passed back and forth | 8 | * Note extra padding because this structure is passed back and forth |
@@ -13,19 +15,19 @@ | |||
13 | 15 | ||
14 | struct shmid64_ds { | 16 | struct shmid64_ds { |
15 | struct ipc64_perm shm_perm; /* operation perms */ | 17 | struct ipc64_perm shm_perm; /* operation perms */ |
16 | #ifndef CONFIG_64BIT | 18 | #if __BITS_PER_LONG != 64 |
17 | unsigned int __pad1; | 19 | unsigned int __pad1; |
18 | #endif | 20 | #endif |
19 | __kernel_time_t shm_atime; /* last attach time */ | 21 | __kernel_time_t shm_atime; /* last attach time */ |
20 | #ifndef CONFIG_64BIT | 22 | #if __BITS_PER_LONG != 64 |
21 | unsigned int __pad2; | 23 | unsigned int __pad2; |
22 | #endif | 24 | #endif |
23 | __kernel_time_t shm_dtime; /* last detach time */ | 25 | __kernel_time_t shm_dtime; /* last detach time */ |
24 | #ifndef CONFIG_64BIT | 26 | #if __BITS_PER_LONG != 64 |
25 | unsigned int __pad3; | 27 | unsigned int __pad3; |
26 | #endif | 28 | #endif |
27 | __kernel_time_t shm_ctime; /* last change time */ | 29 | __kernel_time_t shm_ctime; /* last change time */ |
28 | #ifndef CONFIG_64BIT | 30 | #if __BITS_PER_LONG != 64 |
29 | unsigned int __pad4; | 31 | unsigned int __pad4; |
30 | #endif | 32 | #endif |
31 | size_t shm_segsz; /* size of segment (bytes) */ | 33 | size_t shm_segsz; /* size of segment (bytes) */ |
@@ -36,23 +38,16 @@ struct shmid64_ds { | |||
36 | unsigned int __unused2; | 38 | unsigned int __unused2; |
37 | }; | 39 | }; |
38 | 40 | ||
39 | #ifdef CONFIG_64BIT | ||
40 | /* The 'unsigned int' (formerly 'unsigned long') data types below will | ||
41 | * ensure that a 32-bit app calling shmctl(*,IPC_INFO,*) will work on | ||
42 | * a wide kernel, but if some of these values are meant to contain pointers | ||
43 | * they may need to be 'long long' instead. -PB XXX FIXME | ||
44 | */ | ||
45 | #endif | ||
46 | struct shminfo64 { | 41 | struct shminfo64 { |
47 | unsigned int shmmax; | 42 | unsigned long shmmax; |
48 | unsigned int shmmin; | 43 | unsigned long shmmin; |
49 | unsigned int shmmni; | 44 | unsigned long shmmni; |
50 | unsigned int shmseg; | 45 | unsigned long shmseg; |
51 | unsigned int shmall; | 46 | unsigned long shmall; |
52 | unsigned int __unused1; | 47 | unsigned long __unused1; |
53 | unsigned int __unused2; | 48 | unsigned long __unused2; |
54 | unsigned int __unused3; | 49 | unsigned long __unused3; |
55 | unsigned int __unused4; | 50 | unsigned long __unused4; |
56 | }; | 51 | }; |
57 | 52 | ||
58 | #endif /* _PARISC_SHMBUF_H */ | 53 | #endif /* _PARISC_SHMBUF_H */ |
diff --git a/arch/parisc/include/uapi/asm/signal.h b/arch/parisc/include/uapi/asm/signal.h index 10df7079f4cd..e26043b73f5d 100644 --- a/arch/parisc/include/uapi/asm/signal.h +++ b/arch/parisc/include/uapi/asm/signal.h | |||
@@ -85,7 +85,7 @@ | |||
85 | struct siginfo; | 85 | struct siginfo; |
86 | 86 | ||
87 | /* Type of a signal handler. */ | 87 | /* Type of a signal handler. */ |
88 | #ifdef CONFIG_64BIT | 88 | #if defined(__LP64__) |
89 | /* function pointers on 64-bit parisc are pointers to little structs and the | 89 | /* function pointers on 64-bit parisc are pointers to little structs and the |
90 | * compiler doesn't support code which changes or tests the address of | 90 | * compiler doesn't support code which changes or tests the address of |
91 | * the function in the little struct. This is really ugly -PB | 91 | * the function in the little struct. This is really ugly -PB |
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h index 8667f18be238..5f5c0373de63 100644 --- a/arch/parisc/include/uapi/asm/unistd.h +++ b/arch/parisc/include/uapi/asm/unistd.h | |||
@@ -833,8 +833,9 @@ | |||
833 | #define __NR_seccomp (__NR_Linux + 338) | 833 | #define __NR_seccomp (__NR_Linux + 338) |
834 | #define __NR_getrandom (__NR_Linux + 339) | 834 | #define __NR_getrandom (__NR_Linux + 339) |
835 | #define __NR_memfd_create (__NR_Linux + 340) | 835 | #define __NR_memfd_create (__NR_Linux + 340) |
836 | #define __NR_bpf (__NR_Linux + 341) | ||
836 | 837 | ||
837 | #define __NR_Linux_syscalls (__NR_memfd_create + 1) | 838 | #define __NR_Linux_syscalls (__NR_bpf + 1) |
838 | 839 | ||
839 | 840 | ||
840 | #define __IGNORE_select /* newselect */ | 841 | #define __IGNORE_select /* newselect */ |
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index b563d9c8268b..fe4f0b89bf8f 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -286,11 +286,11 @@ | |||
286 | ENTRY_COMP(msgsnd) | 286 | ENTRY_COMP(msgsnd) |
287 | ENTRY_COMP(msgrcv) | 287 | ENTRY_COMP(msgrcv) |
288 | ENTRY_SAME(msgget) /* 190 */ | 288 | ENTRY_SAME(msgget) /* 190 */ |
289 | ENTRY_SAME(msgctl) | 289 | ENTRY_COMP(msgctl) |
290 | ENTRY_SAME(shmat) | 290 | ENTRY_COMP(shmat) |
291 | ENTRY_SAME(shmdt) | 291 | ENTRY_SAME(shmdt) |
292 | ENTRY_SAME(shmget) | 292 | ENTRY_SAME(shmget) |
293 | ENTRY_SAME(shmctl) /* 195 */ | 293 | ENTRY_COMP(shmctl) /* 195 */ |
294 | ENTRY_SAME(ni_syscall) /* streams1 */ | 294 | ENTRY_SAME(ni_syscall) /* streams1 */ |
295 | ENTRY_SAME(ni_syscall) /* streams2 */ | 295 | ENTRY_SAME(ni_syscall) /* streams2 */ |
296 | ENTRY_SAME(lstat64) | 296 | ENTRY_SAME(lstat64) |
@@ -323,7 +323,7 @@ | |||
323 | ENTRY_SAME(epoll_ctl) /* 225 */ | 323 | ENTRY_SAME(epoll_ctl) /* 225 */ |
324 | ENTRY_SAME(epoll_wait) | 324 | ENTRY_SAME(epoll_wait) |
325 | ENTRY_SAME(remap_file_pages) | 325 | ENTRY_SAME(remap_file_pages) |
326 | ENTRY_SAME(semtimedop) | 326 | ENTRY_COMP(semtimedop) |
327 | ENTRY_COMP(mq_open) | 327 | ENTRY_COMP(mq_open) |
328 | ENTRY_SAME(mq_unlink) /* 230 */ | 328 | ENTRY_SAME(mq_unlink) /* 230 */ |
329 | ENTRY_COMP(mq_timedsend) | 329 | ENTRY_COMP(mq_timedsend) |
@@ -436,6 +436,7 @@ | |||
436 | ENTRY_SAME(seccomp) | 436 | ENTRY_SAME(seccomp) |
437 | ENTRY_SAME(getrandom) | 437 | ENTRY_SAME(getrandom) |
438 | ENTRY_SAME(memfd_create) /* 340 */ | 438 | ENTRY_SAME(memfd_create) /* 340 */ |
439 | ENTRY_SAME(bpf) | ||
439 | 440 | ||
440 | /* Nothing yet */ | 441 | /* Nothing yet */ |
441 | 442 | ||
diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h index a6774560afe3..493e72f64b35 100644 --- a/arch/powerpc/include/asm/fadump.h +++ b/arch/powerpc/include/asm/fadump.h | |||
@@ -70,39 +70,39 @@ | |||
70 | #define CPU_UNKNOWN (~((u32)0)) | 70 | #define CPU_UNKNOWN (~((u32)0)) |
71 | 71 | ||
72 | /* Utility macros */ | 72 | /* Utility macros */ |
73 | #define SKIP_TO_NEXT_CPU(reg_entry) \ | 73 | #define SKIP_TO_NEXT_CPU(reg_entry) \ |
74 | ({ \ | 74 | ({ \ |
75 | while (reg_entry->reg_id != REG_ID("CPUEND")) \ | 75 | while (be64_to_cpu(reg_entry->reg_id) != REG_ID("CPUEND")) \ |
76 | reg_entry++; \ | 76 | reg_entry++; \ |
77 | reg_entry++; \ | 77 | reg_entry++; \ |
78 | }) | 78 | }) |
79 | 79 | ||
80 | /* Kernel Dump section info */ | 80 | /* Kernel Dump section info */ |
81 | struct fadump_section { | 81 | struct fadump_section { |
82 | u32 request_flag; | 82 | __be32 request_flag; |
83 | u16 source_data_type; | 83 | __be16 source_data_type; |
84 | u16 error_flags; | 84 | __be16 error_flags; |
85 | u64 source_address; | 85 | __be64 source_address; |
86 | u64 source_len; | 86 | __be64 source_len; |
87 | u64 bytes_dumped; | 87 | __be64 bytes_dumped; |
88 | u64 destination_address; | 88 | __be64 destination_address; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | /* ibm,configure-kernel-dump header. */ | 91 | /* ibm,configure-kernel-dump header. */ |
92 | struct fadump_section_header { | 92 | struct fadump_section_header { |
93 | u32 dump_format_version; | 93 | __be32 dump_format_version; |
94 | u16 dump_num_sections; | 94 | __be16 dump_num_sections; |
95 | u16 dump_status_flag; | 95 | __be16 dump_status_flag; |
96 | u32 offset_first_dump_section; | 96 | __be32 offset_first_dump_section; |
97 | 97 | ||
98 | /* Fields for disk dump option. */ | 98 | /* Fields for disk dump option. */ |
99 | u32 dd_block_size; | 99 | __be32 dd_block_size; |
100 | u64 dd_block_offset; | 100 | __be64 dd_block_offset; |
101 | u64 dd_num_blocks; | 101 | __be64 dd_num_blocks; |
102 | u32 dd_offset_disk_path; | 102 | __be32 dd_offset_disk_path; |
103 | 103 | ||
104 | /* Maximum time allowed to prevent an automatic dump-reboot. */ | 104 | /* Maximum time allowed to prevent an automatic dump-reboot. */ |
105 | u32 max_time_auto; | 105 | __be32 max_time_auto; |
106 | }; | 106 | }; |
107 | 107 | ||
108 | /* | 108 | /* |
@@ -174,15 +174,15 @@ static inline u64 str_to_u64(const char *str) | |||
174 | 174 | ||
175 | /* Register save area header. */ | 175 | /* Register save area header. */ |
176 | struct fadump_reg_save_area_header { | 176 | struct fadump_reg_save_area_header { |
177 | u64 magic_number; | 177 | __be64 magic_number; |
178 | u32 version; | 178 | __be32 version; |
179 | u32 num_cpu_offset; | 179 | __be32 num_cpu_offset; |
180 | }; | 180 | }; |
181 | 181 | ||
182 | /* Register entry. */ | 182 | /* Register entry. */ |
183 | struct fadump_reg_entry { | 183 | struct fadump_reg_entry { |
184 | u64 reg_id; | 184 | __be64 reg_id; |
185 | u64 reg_value; | 185 | __be64 reg_value; |
186 | }; | 186 | }; |
187 | 187 | ||
188 | /* fadump crash info structure */ | 188 | /* fadump crash info structure */ |
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 623f2971ce0e..766b77d527ac 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h | |||
@@ -71,7 +71,7 @@ pte_t *huge_pte_offset_and_shift(struct mm_struct *mm, | |||
71 | 71 | ||
72 | void flush_dcache_icache_hugepage(struct page *page); | 72 | void flush_dcache_icache_hugepage(struct page *page); |
73 | 73 | ||
74 | #if defined(CONFIG_PPC_MM_SLICES) || defined(CONFIG_PPC_SUBPAGE_PROT) | 74 | #if defined(CONFIG_PPC_MM_SLICES) |
75 | int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, | 75 | int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, |
76 | unsigned long len); | 76 | unsigned long len); |
77 | #else | 77 | #else |
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 4ca90a39d6d0..725247beebec 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -159,8 +159,6 @@ struct pci_dn { | |||
159 | 159 | ||
160 | int pci_ext_config_space; /* for pci devices */ | 160 | int pci_ext_config_space; /* for pci devices */ |
161 | 161 | ||
162 | bool force_32bit_msi; | ||
163 | |||
164 | struct pci_dev *pcidev; /* back-pointer to the pci device */ | 162 | struct pci_dev *pcidev; /* back-pointer to the pci device */ |
165 | #ifdef CONFIG_EEH | 163 | #ifdef CONFIG_EEH |
166 | struct eeh_dev *edev; /* eeh device */ | 164 | struct eeh_dev *edev; /* eeh device */ |
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index 7d8a60068805..ce9577d693be 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h | |||
@@ -365,3 +365,4 @@ SYSCALL_SPU(renameat2) | |||
365 | SYSCALL_SPU(seccomp) | 365 | SYSCALL_SPU(seccomp) |
366 | SYSCALL_SPU(getrandom) | 366 | SYSCALL_SPU(getrandom) |
367 | SYSCALL_SPU(memfd_create) | 367 | SYSCALL_SPU(memfd_create) |
368 | SYSCALL_SPU(bpf) | ||
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 4e9af3fd43e7..e0da021caa00 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <uapi/asm/unistd.h> | 12 | #include <uapi/asm/unistd.h> |
13 | 13 | ||
14 | 14 | ||
15 | #define __NR_syscalls 361 | 15 | #define __NR_syscalls 362 |
16 | 16 | ||
17 | #define __NR__exit __NR_exit | 17 | #define __NR__exit __NR_exit |
18 | #define NR_syscalls __NR_syscalls | 18 | #define NR_syscalls __NR_syscalls |
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h index 0688fc06e183..f55351f2e66e 100644 --- a/arch/powerpc/include/uapi/asm/unistd.h +++ b/arch/powerpc/include/uapi/asm/unistd.h | |||
@@ -383,5 +383,6 @@ | |||
383 | #define __NR_seccomp 358 | 383 | #define __NR_seccomp 358 |
384 | #define __NR_getrandom 359 | 384 | #define __NR_getrandom 359 |
385 | #define __NR_memfd_create 360 | 385 | #define __NR_memfd_create 360 |
386 | #define __NR_bpf 361 | ||
386 | 387 | ||
387 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ | 388 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ |
diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index f19b1e5cb060..1ceecdda810b 100644 --- a/arch/powerpc/kernel/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c | |||
@@ -65,7 +65,7 @@ static ssize_t eeh_pe_state_show(struct device *dev, | |||
65 | return -ENODEV; | 65 | return -ENODEV; |
66 | 66 | ||
67 | state = eeh_ops->get_state(edev->pe, NULL); | 67 | state = eeh_ops->get_state(edev->pe, NULL); |
68 | return sprintf(buf, "%0x08x %0x08x\n", | 68 | return sprintf(buf, "0x%08x 0x%08x\n", |
69 | state, edev->pe->state); | 69 | state, edev->pe->state); |
70 | } | 70 | } |
71 | 71 | ||
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 5bbd1bc8c3b0..0905c8da90f1 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -659,7 +659,13 @@ _GLOBAL(ret_from_except_lite) | |||
659 | 3: | 659 | 3: |
660 | #endif | 660 | #endif |
661 | bl save_nvgprs | 661 | bl save_nvgprs |
662 | /* | ||
663 | * Use a non volatile GPR to save and restore our thread_info flags | ||
664 | * across the call to restore_interrupts. | ||
665 | */ | ||
666 | mr r30,r4 | ||
662 | bl restore_interrupts | 667 | bl restore_interrupts |
668 | mr r4,r30 | ||
663 | addi r3,r1,STACK_FRAME_OVERHEAD | 669 | addi r3,r1,STACK_FRAME_OVERHEAD |
664 | bl do_notify_resume | 670 | bl do_notify_resume |
665 | b ret_from_except | 671 | b ret_from_except |
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 742694c1d852..26d091a1a54c 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c | |||
@@ -58,7 +58,7 @@ int __init early_init_dt_scan_fw_dump(unsigned long node, | |||
58 | const __be32 *sections; | 58 | const __be32 *sections; |
59 | int i, num_sections; | 59 | int i, num_sections; |
60 | int size; | 60 | int size; |
61 | const int *token; | 61 | const __be32 *token; |
62 | 62 | ||
63 | if (depth != 1 || strcmp(uname, "rtas") != 0) | 63 | if (depth != 1 || strcmp(uname, "rtas") != 0) |
64 | return 0; | 64 | return 0; |
@@ -72,7 +72,7 @@ int __init early_init_dt_scan_fw_dump(unsigned long node, | |||
72 | return 1; | 72 | return 1; |
73 | 73 | ||
74 | fw_dump.fadump_supported = 1; | 74 | fw_dump.fadump_supported = 1; |
75 | fw_dump.ibm_configure_kernel_dump = *token; | 75 | fw_dump.ibm_configure_kernel_dump = be32_to_cpu(*token); |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * The 'ibm,kernel-dump' rtas node is present only if there is | 78 | * The 'ibm,kernel-dump' rtas node is present only if there is |
@@ -147,11 +147,11 @@ static unsigned long init_fadump_mem_struct(struct fadump_mem_struct *fdm, | |||
147 | memset(fdm, 0, sizeof(struct fadump_mem_struct)); | 147 | memset(fdm, 0, sizeof(struct fadump_mem_struct)); |
148 | addr = addr & PAGE_MASK; | 148 | addr = addr & PAGE_MASK; |
149 | 149 | ||
150 | fdm->header.dump_format_version = 0x00000001; | 150 | fdm->header.dump_format_version = cpu_to_be32(0x00000001); |
151 | fdm->header.dump_num_sections = 3; | 151 | fdm->header.dump_num_sections = cpu_to_be16(3); |
152 | fdm->header.dump_status_flag = 0; | 152 | fdm->header.dump_status_flag = 0; |
153 | fdm->header.offset_first_dump_section = | 153 | fdm->header.offset_first_dump_section = |
154 | (u32)offsetof(struct fadump_mem_struct, cpu_state_data); | 154 | cpu_to_be32((u32)offsetof(struct fadump_mem_struct, cpu_state_data)); |
155 | 155 | ||
156 | /* | 156 | /* |
157 | * Fields for disk dump option. | 157 | * Fields for disk dump option. |
@@ -167,27 +167,27 @@ static unsigned long init_fadump_mem_struct(struct fadump_mem_struct *fdm, | |||
167 | 167 | ||
168 | /* Kernel dump sections */ | 168 | /* Kernel dump sections */ |
169 | /* cpu state data section. */ | 169 | /* cpu state data section. */ |
170 | fdm->cpu_state_data.request_flag = FADUMP_REQUEST_FLAG; | 170 | fdm->cpu_state_data.request_flag = cpu_to_be32(FADUMP_REQUEST_FLAG); |
171 | fdm->cpu_state_data.source_data_type = FADUMP_CPU_STATE_DATA; | 171 | fdm->cpu_state_data.source_data_type = cpu_to_be16(FADUMP_CPU_STATE_DATA); |
172 | fdm->cpu_state_data.source_address = 0; | 172 | fdm->cpu_state_data.source_address = 0; |
173 | fdm->cpu_state_data.source_len = fw_dump.cpu_state_data_size; | 173 | fdm->cpu_state_data.source_len = cpu_to_be64(fw_dump.cpu_state_data_size); |
174 | fdm->cpu_state_data.destination_address = addr; | 174 | fdm->cpu_state_data.destination_address = cpu_to_be64(addr); |
175 | addr += fw_dump.cpu_state_data_size; | 175 | addr += fw_dump.cpu_state_data_size; |
176 | 176 | ||
177 | /* hpte region section */ | 177 | /* hpte region section */ |
178 | fdm->hpte_region.request_flag = FADUMP_REQUEST_FLAG; | 178 | fdm->hpte_region.request_flag = cpu_to_be32(FADUMP_REQUEST_FLAG); |
179 | fdm->hpte_region.source_data_type = FADUMP_HPTE_REGION; | 179 | fdm->hpte_region.source_data_type = cpu_to_be16(FADUMP_HPTE_REGION); |
180 | fdm->hpte_region.source_address = 0; | 180 | fdm->hpte_region.source_address = 0; |
181 | fdm->hpte_region.source_len = fw_dump.hpte_region_size; | 181 | fdm->hpte_region.source_len = cpu_to_be64(fw_dump.hpte_region_size); |
182 | fdm->hpte_region.destination_address = addr; | 182 | fdm->hpte_region.destination_address = cpu_to_be64(addr); |
183 | addr += fw_dump.hpte_region_size; | 183 | addr += fw_dump.hpte_region_size; |
184 | 184 | ||
185 | /* RMA region section */ | 185 | /* RMA region section */ |
186 | fdm->rmr_region.request_flag = FADUMP_REQUEST_FLAG; | 186 | fdm->rmr_region.request_flag = cpu_to_be32(FADUMP_REQUEST_FLAG); |
187 | fdm->rmr_region.source_data_type = FADUMP_REAL_MODE_REGION; | 187 | fdm->rmr_region.source_data_type = cpu_to_be16(FADUMP_REAL_MODE_REGION); |
188 | fdm->rmr_region.source_address = RMA_START; | 188 | fdm->rmr_region.source_address = cpu_to_be64(RMA_START); |
189 | fdm->rmr_region.source_len = fw_dump.boot_memory_size; | 189 | fdm->rmr_region.source_len = cpu_to_be64(fw_dump.boot_memory_size); |
190 | fdm->rmr_region.destination_address = addr; | 190 | fdm->rmr_region.destination_address = cpu_to_be64(addr); |
191 | addr += fw_dump.boot_memory_size; | 191 | addr += fw_dump.boot_memory_size; |
192 | 192 | ||
193 | return addr; | 193 | return addr; |
@@ -272,7 +272,7 @@ int __init fadump_reserve_mem(void) | |||
272 | * first kernel. | 272 | * first kernel. |
273 | */ | 273 | */ |
274 | if (fdm_active) | 274 | if (fdm_active) |
275 | fw_dump.boot_memory_size = fdm_active->rmr_region.source_len; | 275 | fw_dump.boot_memory_size = be64_to_cpu(fdm_active->rmr_region.source_len); |
276 | else | 276 | else |
277 | fw_dump.boot_memory_size = fadump_calculate_reserve_size(); | 277 | fw_dump.boot_memory_size = fadump_calculate_reserve_size(); |
278 | 278 | ||
@@ -314,8 +314,8 @@ int __init fadump_reserve_mem(void) | |||
314 | (unsigned long)(base >> 20)); | 314 | (unsigned long)(base >> 20)); |
315 | 315 | ||
316 | fw_dump.fadumphdr_addr = | 316 | fw_dump.fadumphdr_addr = |
317 | fdm_active->rmr_region.destination_address + | 317 | be64_to_cpu(fdm_active->rmr_region.destination_address) + |
318 | fdm_active->rmr_region.source_len; | 318 | be64_to_cpu(fdm_active->rmr_region.source_len); |
319 | pr_debug("fadumphdr_addr = %p\n", | 319 | pr_debug("fadumphdr_addr = %p\n", |
320 | (void *) fw_dump.fadumphdr_addr); | 320 | (void *) fw_dump.fadumphdr_addr); |
321 | } else { | 321 | } else { |
@@ -472,9 +472,9 @@ fadump_read_registers(struct fadump_reg_entry *reg_entry, struct pt_regs *regs) | |||
472 | { | 472 | { |
473 | memset(regs, 0, sizeof(struct pt_regs)); | 473 | memset(regs, 0, sizeof(struct pt_regs)); |
474 | 474 | ||
475 | while (reg_entry->reg_id != REG_ID("CPUEND")) { | 475 | while (be64_to_cpu(reg_entry->reg_id) != REG_ID("CPUEND")) { |
476 | fadump_set_regval(regs, reg_entry->reg_id, | 476 | fadump_set_regval(regs, be64_to_cpu(reg_entry->reg_id), |
477 | reg_entry->reg_value); | 477 | be64_to_cpu(reg_entry->reg_value)); |
478 | reg_entry++; | 478 | reg_entry++; |
479 | } | 479 | } |
480 | reg_entry++; | 480 | reg_entry++; |
@@ -603,20 +603,20 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm) | |||
603 | if (!fdm->cpu_state_data.bytes_dumped) | 603 | if (!fdm->cpu_state_data.bytes_dumped) |
604 | return -EINVAL; | 604 | return -EINVAL; |
605 | 605 | ||
606 | addr = fdm->cpu_state_data.destination_address; | 606 | addr = be64_to_cpu(fdm->cpu_state_data.destination_address); |
607 | vaddr = __va(addr); | 607 | vaddr = __va(addr); |
608 | 608 | ||
609 | reg_header = vaddr; | 609 | reg_header = vaddr; |
610 | if (reg_header->magic_number != REGSAVE_AREA_MAGIC) { | 610 | if (be64_to_cpu(reg_header->magic_number) != REGSAVE_AREA_MAGIC) { |
611 | printk(KERN_ERR "Unable to read register save area.\n"); | 611 | printk(KERN_ERR "Unable to read register save area.\n"); |
612 | return -ENOENT; | 612 | return -ENOENT; |
613 | } | 613 | } |
614 | pr_debug("--------CPU State Data------------\n"); | 614 | pr_debug("--------CPU State Data------------\n"); |
615 | pr_debug("Magic Number: %llx\n", reg_header->magic_number); | 615 | pr_debug("Magic Number: %llx\n", be64_to_cpu(reg_header->magic_number)); |
616 | pr_debug("NumCpuOffset: %x\n", reg_header->num_cpu_offset); | 616 | pr_debug("NumCpuOffset: %x\n", be32_to_cpu(reg_header->num_cpu_offset)); |
617 | 617 | ||
618 | vaddr += reg_header->num_cpu_offset; | 618 | vaddr += be32_to_cpu(reg_header->num_cpu_offset); |
619 | num_cpus = *((u32 *)(vaddr)); | 619 | num_cpus = be32_to_cpu(*((__be32 *)(vaddr))); |
620 | pr_debug("NumCpus : %u\n", num_cpus); | 620 | pr_debug("NumCpus : %u\n", num_cpus); |
621 | vaddr += sizeof(u32); | 621 | vaddr += sizeof(u32); |
622 | reg_entry = (struct fadump_reg_entry *)vaddr; | 622 | reg_entry = (struct fadump_reg_entry *)vaddr; |
@@ -639,13 +639,13 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm) | |||
639 | fdh = __va(fw_dump.fadumphdr_addr); | 639 | fdh = __va(fw_dump.fadumphdr_addr); |
640 | 640 | ||
641 | for (i = 0; i < num_cpus; i++) { | 641 | for (i = 0; i < num_cpus; i++) { |
642 | if (reg_entry->reg_id != REG_ID("CPUSTRT")) { | 642 | if (be64_to_cpu(reg_entry->reg_id) != REG_ID("CPUSTRT")) { |
643 | printk(KERN_ERR "Unable to read CPU state data\n"); | 643 | printk(KERN_ERR "Unable to read CPU state data\n"); |
644 | rc = -ENOENT; | 644 | rc = -ENOENT; |
645 | goto error_out; | 645 | goto error_out; |
646 | } | 646 | } |
647 | /* Lower 4 bytes of reg_value contains logical cpu id */ | 647 | /* Lower 4 bytes of reg_value contains logical cpu id */ |
648 | cpu = reg_entry->reg_value & FADUMP_CPU_ID_MASK; | 648 | cpu = be64_to_cpu(reg_entry->reg_value) & FADUMP_CPU_ID_MASK; |
649 | if (fdh && !cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) { | 649 | if (fdh && !cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) { |
650 | SKIP_TO_NEXT_CPU(reg_entry); | 650 | SKIP_TO_NEXT_CPU(reg_entry); |
651 | continue; | 651 | continue; |
@@ -692,7 +692,7 @@ static int __init process_fadump(const struct fadump_mem_struct *fdm_active) | |||
692 | return -EINVAL; | 692 | return -EINVAL; |
693 | 693 | ||
694 | /* Check if the dump data is valid. */ | 694 | /* Check if the dump data is valid. */ |
695 | if ((fdm_active->header.dump_status_flag == FADUMP_ERROR_FLAG) || | 695 | if ((be16_to_cpu(fdm_active->header.dump_status_flag) == FADUMP_ERROR_FLAG) || |
696 | (fdm_active->cpu_state_data.error_flags != 0) || | 696 | (fdm_active->cpu_state_data.error_flags != 0) || |
697 | (fdm_active->rmr_region.error_flags != 0)) { | 697 | (fdm_active->rmr_region.error_flags != 0)) { |
698 | printk(KERN_ERR "Dump taken by platform is not valid\n"); | 698 | printk(KERN_ERR "Dump taken by platform is not valid\n"); |
@@ -828,7 +828,7 @@ static void fadump_setup_crash_memory_ranges(void) | |||
828 | static inline unsigned long fadump_relocate(unsigned long paddr) | 828 | static inline unsigned long fadump_relocate(unsigned long paddr) |
829 | { | 829 | { |
830 | if (paddr > RMA_START && paddr < fw_dump.boot_memory_size) | 830 | if (paddr > RMA_START && paddr < fw_dump.boot_memory_size) |
831 | return fdm.rmr_region.destination_address + paddr; | 831 | return be64_to_cpu(fdm.rmr_region.destination_address) + paddr; |
832 | else | 832 | else |
833 | return paddr; | 833 | return paddr; |
834 | } | 834 | } |
@@ -902,7 +902,7 @@ static int fadump_create_elfcore_headers(char *bufp) | |||
902 | * to the specified destination_address. Hence set | 902 | * to the specified destination_address. Hence set |
903 | * the correct offset. | 903 | * the correct offset. |
904 | */ | 904 | */ |
905 | phdr->p_offset = fdm.rmr_region.destination_address; | 905 | phdr->p_offset = be64_to_cpu(fdm.rmr_region.destination_address); |
906 | } | 906 | } |
907 | 907 | ||
908 | phdr->p_paddr = mbase; | 908 | phdr->p_paddr = mbase; |
@@ -951,7 +951,7 @@ static void register_fadump(void) | |||
951 | 951 | ||
952 | fadump_setup_crash_memory_ranges(); | 952 | fadump_setup_crash_memory_ranges(); |
953 | 953 | ||
954 | addr = fdm.rmr_region.destination_address + fdm.rmr_region.source_len; | 954 | addr = be64_to_cpu(fdm.rmr_region.destination_address) + be64_to_cpu(fdm.rmr_region.source_len); |
955 | /* Initialize fadump crash info header. */ | 955 | /* Initialize fadump crash info header. */ |
956 | addr = init_fadump_header(addr); | 956 | addr = init_fadump_header(addr); |
957 | vaddr = __va(addr); | 957 | vaddr = __va(addr); |
@@ -1023,7 +1023,7 @@ void fadump_cleanup(void) | |||
1023 | /* Invalidate the registration only if dump is active. */ | 1023 | /* Invalidate the registration only if dump is active. */ |
1024 | if (fw_dump.dump_active) { | 1024 | if (fw_dump.dump_active) { |
1025 | init_fadump_mem_struct(&fdm, | 1025 | init_fadump_mem_struct(&fdm, |
1026 | fdm_active->cpu_state_data.destination_address); | 1026 | be64_to_cpu(fdm_active->cpu_state_data.destination_address)); |
1027 | fadump_invalidate_dump(&fdm); | 1027 | fadump_invalidate_dump(&fdm); |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
@@ -1063,7 +1063,7 @@ static void fadump_invalidate_release_mem(void) | |||
1063 | return; | 1063 | return; |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | destination_address = fdm_active->cpu_state_data.destination_address; | 1066 | destination_address = be64_to_cpu(fdm_active->cpu_state_data.destination_address); |
1067 | fadump_cleanup(); | 1067 | fadump_cleanup(); |
1068 | mutex_unlock(&fadump_mutex); | 1068 | mutex_unlock(&fadump_mutex); |
1069 | 1069 | ||
@@ -1183,31 +1183,31 @@ static int fadump_region_show(struct seq_file *m, void *private) | |||
1183 | seq_printf(m, | 1183 | seq_printf(m, |
1184 | "CPU : [%#016llx-%#016llx] %#llx bytes, " | 1184 | "CPU : [%#016llx-%#016llx] %#llx bytes, " |
1185 | "Dumped: %#llx\n", | 1185 | "Dumped: %#llx\n", |
1186 | fdm_ptr->cpu_state_data.destination_address, | 1186 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address), |
1187 | fdm_ptr->cpu_state_data.destination_address + | 1187 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) + |
1188 | fdm_ptr->cpu_state_data.source_len - 1, | 1188 | be64_to_cpu(fdm_ptr->cpu_state_data.source_len) - 1, |
1189 | fdm_ptr->cpu_state_data.source_len, | 1189 | be64_to_cpu(fdm_ptr->cpu_state_data.source_len), |
1190 | fdm_ptr->cpu_state_data.bytes_dumped); | 1190 | be64_to_cpu(fdm_ptr->cpu_state_data.bytes_dumped)); |
1191 | seq_printf(m, | 1191 | seq_printf(m, |
1192 | "HPTE: [%#016llx-%#016llx] %#llx bytes, " | 1192 | "HPTE: [%#016llx-%#016llx] %#llx bytes, " |
1193 | "Dumped: %#llx\n", | 1193 | "Dumped: %#llx\n", |
1194 | fdm_ptr->hpte_region.destination_address, | 1194 | be64_to_cpu(fdm_ptr->hpte_region.destination_address), |
1195 | fdm_ptr->hpte_region.destination_address + | 1195 | be64_to_cpu(fdm_ptr->hpte_region.destination_address) + |
1196 | fdm_ptr->hpte_region.source_len - 1, | 1196 | be64_to_cpu(fdm_ptr->hpte_region.source_len) - 1, |
1197 | fdm_ptr->hpte_region.source_len, | 1197 | be64_to_cpu(fdm_ptr->hpte_region.source_len), |
1198 | fdm_ptr->hpte_region.bytes_dumped); | 1198 | be64_to_cpu(fdm_ptr->hpte_region.bytes_dumped)); |
1199 | seq_printf(m, | 1199 | seq_printf(m, |
1200 | "DUMP: [%#016llx-%#016llx] %#llx bytes, " | 1200 | "DUMP: [%#016llx-%#016llx] %#llx bytes, " |
1201 | "Dumped: %#llx\n", | 1201 | "Dumped: %#llx\n", |
1202 | fdm_ptr->rmr_region.destination_address, | 1202 | be64_to_cpu(fdm_ptr->rmr_region.destination_address), |
1203 | fdm_ptr->rmr_region.destination_address + | 1203 | be64_to_cpu(fdm_ptr->rmr_region.destination_address) + |
1204 | fdm_ptr->rmr_region.source_len - 1, | 1204 | be64_to_cpu(fdm_ptr->rmr_region.source_len) - 1, |
1205 | fdm_ptr->rmr_region.source_len, | 1205 | be64_to_cpu(fdm_ptr->rmr_region.source_len), |
1206 | fdm_ptr->rmr_region.bytes_dumped); | 1206 | be64_to_cpu(fdm_ptr->rmr_region.bytes_dumped)); |
1207 | 1207 | ||
1208 | if (!fdm_active || | 1208 | if (!fdm_active || |
1209 | (fw_dump.reserve_dump_area_start == | 1209 | (fw_dump.reserve_dump_area_start == |
1210 | fdm_ptr->cpu_state_data.destination_address)) | 1210 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address))) |
1211 | goto out; | 1211 | goto out; |
1212 | 1212 | ||
1213 | /* Dump is active. Show reserved memory region. */ | 1213 | /* Dump is active. Show reserved memory region. */ |
@@ -1215,10 +1215,10 @@ static int fadump_region_show(struct seq_file *m, void *private) | |||
1215 | " : [%#016llx-%#016llx] %#llx bytes, " | 1215 | " : [%#016llx-%#016llx] %#llx bytes, " |
1216 | "Dumped: %#llx\n", | 1216 | "Dumped: %#llx\n", |
1217 | (unsigned long long)fw_dump.reserve_dump_area_start, | 1217 | (unsigned long long)fw_dump.reserve_dump_area_start, |
1218 | fdm_ptr->cpu_state_data.destination_address - 1, | 1218 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) - 1, |
1219 | fdm_ptr->cpu_state_data.destination_address - | 1219 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) - |
1220 | fw_dump.reserve_dump_area_start, | 1220 | fw_dump.reserve_dump_area_start, |
1221 | fdm_ptr->cpu_state_data.destination_address - | 1221 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) - |
1222 | fw_dump.reserve_dump_area_start); | 1222 | fw_dump.reserve_dump_area_start); |
1223 | out: | 1223 | out: |
1224 | if (fdm_active) | 1224 | if (fdm_active) |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 155013da27e0..b15194e2c5fc 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -266,13 +266,3 @@ int pcibus_to_node(struct pci_bus *bus) | |||
266 | } | 266 | } |
267 | EXPORT_SYMBOL(pcibus_to_node); | 267 | EXPORT_SYMBOL(pcibus_to_node); |
268 | #endif | 268 | #endif |
269 | |||
270 | static void quirk_radeon_32bit_msi(struct pci_dev *dev) | ||
271 | { | ||
272 | struct pci_dn *pdn = pci_get_pdn(dev); | ||
273 | |||
274 | if (pdn) | ||
275 | pdn->force_32bit_msi = true; | ||
276 | } | ||
277 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x68f2, quirk_radeon_32bit_msi); | ||
278 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi); | ||
diff --git a/arch/powerpc/kernel/vdso32/getcpu.S b/arch/powerpc/kernel/vdso32/getcpu.S index 23eb9a9441bd..c62be60c7274 100644 --- a/arch/powerpc/kernel/vdso32/getcpu.S +++ b/arch/powerpc/kernel/vdso32/getcpu.S | |||
@@ -30,8 +30,8 @@ | |||
30 | V_FUNCTION_BEGIN(__kernel_getcpu) | 30 | V_FUNCTION_BEGIN(__kernel_getcpu) |
31 | .cfi_startproc | 31 | .cfi_startproc |
32 | mfspr r5,SPRN_SPRG_VDSO_READ | 32 | mfspr r5,SPRN_SPRG_VDSO_READ |
33 | cmpdi cr0,r3,0 | 33 | cmpwi cr0,r3,0 |
34 | cmpdi cr1,r4,0 | 34 | cmpwi cr1,r4,0 |
35 | clrlwi r6,r5,16 | 35 | clrlwi r6,r5,16 |
36 | rlwinm r7,r5,16,31-15,31-0 | 36 | rlwinm r7,r5,16,31-15,31-0 |
37 | beq cr0,1f | 37 | beq cr0,1f |
diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_fault.c index 0f9939e693df..5a236f082c78 100644 --- a/arch/powerpc/mm/copro_fault.c +++ b/arch/powerpc/mm/copro_fault.c | |||
@@ -99,8 +99,6 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb) | |||
99 | u64 vsid; | 99 | u64 vsid; |
100 | int psize, ssize; | 100 | int psize, ssize; |
101 | 101 | ||
102 | slb->esid = (ea & ESID_MASK) | SLB_ESID_V; | ||
103 | |||
104 | switch (REGION_ID(ea)) { | 102 | switch (REGION_ID(ea)) { |
105 | case USER_REGION_ID: | 103 | case USER_REGION_ID: |
106 | pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea); | 104 | pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea); |
@@ -133,6 +131,7 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb) | |||
133 | vsid |= mmu_psize_defs[psize].sllp | | 131 | vsid |= mmu_psize_defs[psize].sllp | |
134 | ((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0); | 132 | ((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0); |
135 | 133 | ||
134 | slb->esid = (ea & (ssize == MMU_SEGSIZE_1T ? ESID_MASK_1T : ESID_MASK)) | SLB_ESID_V; | ||
136 | slb->vsid = vsid; | 135 | slb->vsid = vsid; |
137 | 136 | ||
138 | return 0; | 137 | return 0; |
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index cad68ff8eca5..415a51b028b9 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c | |||
@@ -103,7 +103,7 @@ unsigned long __max_low_memory = MAX_LOW_MEM; | |||
103 | /* | 103 | /* |
104 | * Check for command-line options that affect what MMU_init will do. | 104 | * Check for command-line options that affect what MMU_init will do. |
105 | */ | 105 | */ |
106 | void MMU_setup(void) | 106 | void __init MMU_setup(void) |
107 | { | 107 | { |
108 | /* Check for nobats option (used in mapin_ram). */ | 108 | /* Check for nobats option (used in mapin_ram). */ |
109 | if (strstr(boot_command_line, "nobats")) { | 109 | if (strstr(boot_command_line, "nobats")) { |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index e5236c24dc07..b9d1dfdbe5bb 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -1509,11 +1509,14 @@ static int update_cpu_topology(void *data) | |||
1509 | cpu = smp_processor_id(); | 1509 | cpu = smp_processor_id(); |
1510 | 1510 | ||
1511 | for (update = data; update; update = update->next) { | 1511 | for (update = data; update; update = update->next) { |
1512 | int new_nid = update->new_nid; | ||
1512 | if (cpu != update->cpu) | 1513 | if (cpu != update->cpu) |
1513 | continue; | 1514 | continue; |
1514 | 1515 | ||
1515 | unmap_cpu_from_node(update->cpu); | 1516 | unmap_cpu_from_node(cpu); |
1516 | map_cpu_to_node(update->cpu, update->new_nid); | 1517 | map_cpu_to_node(cpu, new_nid); |
1518 | set_cpu_numa_node(cpu, new_nid); | ||
1519 | set_cpu_numa_mem(cpu, local_memory_node(new_nid)); | ||
1517 | vdso_getcpu_init(); | 1520 | vdso_getcpu_init(); |
1518 | } | 1521 | } |
1519 | 1522 | ||
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c index 8d7bda94d196..ded0ea1afde4 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/slice.c | |||
@@ -682,6 +682,7 @@ void slice_set_range_psize(struct mm_struct *mm, unsigned long start, | |||
682 | slice_convert(mm, mask, psize); | 682 | slice_convert(mm, mask, psize); |
683 | } | 683 | } |
684 | 684 | ||
685 | #ifdef CONFIG_HUGETLB_PAGE | ||
685 | /* | 686 | /* |
686 | * is_hugepage_only_range() is used by generic code to verify whether | 687 | * is_hugepage_only_range() is used by generic code to verify whether |
687 | * a normal mmap mapping (non hugetlbfs) is valid on a given area. | 688 | * a normal mmap mapping (non hugetlbfs) is valid on a given area. |
@@ -726,4 +727,4 @@ int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, | |||
726 | #endif | 727 | #endif |
727 | return !slice_check_fit(mask, available); | 728 | return !slice_check_fit(mask, available); |
728 | } | 729 | } |
729 | 730 | #endif | |
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 6c8710dd90c9..dba34088da28 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c | |||
@@ -417,11 +417,6 @@ static int h_24x7_event_add(struct perf_event *event, int flags) | |||
417 | return 0; | 417 | return 0; |
418 | } | 418 | } |
419 | 419 | ||
420 | static int h_24x7_event_idx(struct perf_event *event) | ||
421 | { | ||
422 | return 0; | ||
423 | } | ||
424 | |||
425 | static struct pmu h_24x7_pmu = { | 420 | static struct pmu h_24x7_pmu = { |
426 | .task_ctx_nr = perf_invalid_context, | 421 | .task_ctx_nr = perf_invalid_context, |
427 | 422 | ||
@@ -433,7 +428,6 @@ static struct pmu h_24x7_pmu = { | |||
433 | .start = h_24x7_event_start, | 428 | .start = h_24x7_event_start, |
434 | .stop = h_24x7_event_stop, | 429 | .stop = h_24x7_event_stop, |
435 | .read = h_24x7_event_update, | 430 | .read = h_24x7_event_update, |
436 | .event_idx = h_24x7_event_idx, | ||
437 | }; | 431 | }; |
438 | 432 | ||
439 | static int hv_24x7_init(void) | 433 | static int hv_24x7_init(void) |
diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c index 15fc76c93022..a051fe946c63 100644 --- a/arch/powerpc/perf/hv-gpci.c +++ b/arch/powerpc/perf/hv-gpci.c | |||
@@ -246,11 +246,6 @@ static int h_gpci_event_init(struct perf_event *event) | |||
246 | return 0; | 246 | return 0; |
247 | } | 247 | } |
248 | 248 | ||
249 | static int h_gpci_event_idx(struct perf_event *event) | ||
250 | { | ||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | static struct pmu h_gpci_pmu = { | 249 | static struct pmu h_gpci_pmu = { |
255 | .task_ctx_nr = perf_invalid_context, | 250 | .task_ctx_nr = perf_invalid_context, |
256 | 251 | ||
@@ -262,7 +257,6 @@ static struct pmu h_gpci_pmu = { | |||
262 | .start = h_gpci_event_start, | 257 | .start = h_gpci_event_start, |
263 | .stop = h_gpci_event_stop, | 258 | .stop = h_gpci_event_stop, |
264 | .read = h_gpci_event_update, | 259 | .read = h_gpci_event_update, |
265 | .event_idx = h_gpci_event_idx, | ||
266 | }; | 260 | }; |
267 | 261 | ||
268 | static int hv_gpci_init(void) | 262 | static int hv_gpci_init(void) |
diff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c index 5e1ed1575aab..b322bfb51343 100644 --- a/arch/powerpc/platforms/powernv/opal-hmi.c +++ b/arch/powerpc/platforms/powernv/opal-hmi.c | |||
@@ -57,7 +57,7 @@ static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt) | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | /* Print things out */ | 59 | /* Print things out */ |
60 | if (hmi_evt->version != OpalHMIEvt_V1) { | 60 | if (hmi_evt->version < OpalHMIEvt_V1) { |
61 | pr_err("HMI Interrupt, Unknown event version %d !\n", | 61 | pr_err("HMI Interrupt, Unknown event version %d !\n", |
62 | hmi_evt->version); | 62 | hmi_evt->version); |
63 | return; | 63 | return; |
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c index dd2c285ad170..e4169d68cb32 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c | |||
@@ -191,7 +191,6 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, | |||
191 | { | 191 | { |
192 | struct lpc_debugfs_entry *lpc = filp->private_data; | 192 | struct lpc_debugfs_entry *lpc = filp->private_data; |
193 | u32 data, pos, len, todo; | 193 | u32 data, pos, len, todo; |
194 | __be32 bedata; | ||
195 | int rc; | 194 | int rc; |
196 | 195 | ||
197 | if (!access_ok(VERIFY_WRITE, ubuf, count)) | 196 | if (!access_ok(VERIFY_WRITE, ubuf, count)) |
@@ -214,18 +213,57 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, | |||
214 | len = 2; | 213 | len = 2; |
215 | } | 214 | } |
216 | rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, | 215 | rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, |
217 | &bedata, len); | 216 | &data, len); |
218 | if (rc) | 217 | if (rc) |
219 | return -ENXIO; | 218 | return -ENXIO; |
220 | data = be32_to_cpu(bedata); | 219 | |
220 | /* | ||
221 | * Now there is some trickery with the data returned by OPAL | ||
222 | * as it's the desired data right justified in a 32-bit BE | ||
223 | * word. | ||
224 | * | ||
225 | * This is a very bad interface and I'm to blame for it :-( | ||
226 | * | ||
227 | * So we can't just apply a 32-bit swap to what comes from OPAL, | ||
228 | * because user space expects the *bytes* to be in their proper | ||
229 | * respective positions (ie, LPC position). | ||
230 | * | ||
231 | * So what we really want to do here is to shift data right | ||
232 | * appropriately on a LE kernel. | ||
233 | * | ||
234 | * IE. If the LPC transaction has bytes B0, B1, B2 and B3 in that | ||
235 | * order, we have in memory written to by OPAL at the "data" | ||
236 | * pointer: | ||
237 | * | ||
238 | * Bytes: OPAL "data" LE "data" | ||
239 | * 32-bit: B0 B1 B2 B3 B0B1B2B3 B3B2B1B0 | ||
240 | * 16-bit: B0 B1 0000B0B1 B1B00000 | ||
241 | * 8-bit: B0 000000B0 B0000000 | ||
242 | * | ||
243 | * So a BE kernel will have the leftmost of the above in the MSB | ||
244 | * and rightmost in the LSB and can just then "cast" the u32 "data" | ||
245 | * down to the appropriate quantity and write it. | ||
246 | * | ||
247 | * However, an LE kernel can't. It doesn't need to swap because a | ||
248 | * load from data followed by a store to user are going to preserve | ||
249 | * the byte ordering which is the wire byte order which is what the | ||
250 | * user wants, but in order to "crop" to the right size, we need to | ||
251 | * shift right first. | ||
252 | */ | ||
221 | switch(len) { | 253 | switch(len) { |
222 | case 4: | 254 | case 4: |
223 | rc = __put_user((u32)data, (u32 __user *)ubuf); | 255 | rc = __put_user((u32)data, (u32 __user *)ubuf); |
224 | break; | 256 | break; |
225 | case 2: | 257 | case 2: |
258 | #ifdef __LITTLE_ENDIAN__ | ||
259 | data >>= 16; | ||
260 | #endif | ||
226 | rc = __put_user((u16)data, (u16 __user *)ubuf); | 261 | rc = __put_user((u16)data, (u16 __user *)ubuf); |
227 | break; | 262 | break; |
228 | default: | 263 | default: |
264 | #ifdef __LITTLE_ENDIAN__ | ||
265 | data >>= 24; | ||
266 | #endif | ||
229 | rc = __put_user((u8)data, (u8 __user *)ubuf); | 267 | rc = __put_user((u8)data, (u8 __user *)ubuf); |
230 | break; | 268 | break; |
231 | } | 269 | } |
@@ -265,12 +303,31 @@ static ssize_t lpc_debug_write(struct file *filp, const char __user *ubuf, | |||
265 | else if (todo > 1 && (pos & 1) == 0) | 303 | else if (todo > 1 && (pos & 1) == 0) |
266 | len = 2; | 304 | len = 2; |
267 | } | 305 | } |
306 | |||
307 | /* | ||
308 | * Similarly to the read case, we have some trickery here but | ||
309 | * it's different to handle. We need to pass the value to OPAL in | ||
310 | * a register whose layout depends on the access size. We want | ||
311 | * to reproduce the memory layout of the user, however we aren't | ||
312 | * doing a load from user and a store to another memory location | ||
313 | * which would achieve that. Here we pass the value to OPAL via | ||
314 | * a register which is expected to contain the "BE" interpretation | ||
315 | * of the byte sequence. IE: for a 32-bit access, byte 0 should be | ||
316 | * in the MSB. So here we *do* need to byteswap on LE. | ||
317 | * | ||
318 | * User bytes: LE "data" OPAL "data" | ||
319 | * 32-bit: B0 B1 B2 B3 B3B2B1B0 B0B1B2B3 | ||
320 | * 16-bit: B0 B1 0000B1B0 0000B0B1 | ||
321 | * 8-bit: B0 000000B0 000000B0 | ||
322 | */ | ||
268 | switch(len) { | 323 | switch(len) { |
269 | case 4: | 324 | case 4: |
270 | rc = __get_user(data, (u32 __user *)ubuf); | 325 | rc = __get_user(data, (u32 __user *)ubuf); |
326 | data = cpu_to_be32(data); | ||
271 | break; | 327 | break; |
272 | case 2: | 328 | case 2: |
273 | rc = __get_user(data, (u16 __user *)ubuf); | 329 | rc = __get_user(data, (u16 __user *)ubuf); |
330 | data = cpu_to_be16(data); | ||
274 | break; | 331 | break; |
275 | default: | 332 | default: |
276 | rc = __get_user(data, (u8 __user *)ubuf); | 333 | rc = __get_user(data, (u8 __user *)ubuf); |
diff --git a/arch/powerpc/platforms/powernv/opal-sensor.c b/arch/powerpc/platforms/powernv/opal-sensor.c index 10271ad1fac4..4ab67ef7abc9 100644 --- a/arch/powerpc/platforms/powernv/opal-sensor.c +++ b/arch/powerpc/platforms/powernv/opal-sensor.c | |||
@@ -20,7 +20,9 @@ | |||
20 | 20 | ||
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/mutex.h> | 22 | #include <linux/mutex.h> |
23 | #include <linux/of_platform.h> | ||
23 | #include <asm/opal.h> | 24 | #include <asm/opal.h> |
25 | #include <asm/machdep.h> | ||
24 | 26 | ||
25 | static DEFINE_MUTEX(opal_sensor_mutex); | 27 | static DEFINE_MUTEX(opal_sensor_mutex); |
26 | 28 | ||
@@ -64,3 +66,21 @@ out: | |||
64 | return ret; | 66 | return ret; |
65 | } | 67 | } |
66 | EXPORT_SYMBOL_GPL(opal_get_sensor_data); | 68 | EXPORT_SYMBOL_GPL(opal_get_sensor_data); |
69 | |||
70 | static __init int opal_sensor_init(void) | ||
71 | { | ||
72 | struct platform_device *pdev; | ||
73 | struct device_node *sensor; | ||
74 | |||
75 | sensor = of_find_node_by_path("/ibm,opal/sensors"); | ||
76 | if (!sensor) { | ||
77 | pr_err("Opal node 'sensors' not found\n"); | ||
78 | return -ENODEV; | ||
79 | } | ||
80 | |||
81 | pdev = of_platform_device_create(sensor, "opal-sensor", NULL); | ||
82 | of_node_put(sensor); | ||
83 | |||
84 | return PTR_ERR_OR_ZERO(pdev); | ||
85 | } | ||
86 | machine_subsys_initcall(powernv, opal_sensor_init); | ||
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index e9e2450c1fdd..feb549aa3eea 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S | |||
@@ -58,7 +58,7 @@ END_FTR_SECTION(0, 1); \ | |||
58 | */ | 58 | */ |
59 | 59 | ||
60 | #define OPAL_CALL(name, token) \ | 60 | #define OPAL_CALL(name, token) \ |
61 | _GLOBAL(name); \ | 61 | _GLOBAL_TOC(name); \ |
62 | mflr r0; \ | 62 | mflr r0; \ |
63 | std r0,16(r1); \ | 63 | std r0,16(r1); \ |
64 | li r0,token; \ | 64 | li r0,token; \ |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 468a0f23c7f2..3ba435ec3dcd 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -1509,7 +1509,6 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, | |||
1509 | unsigned int is_64, struct msi_msg *msg) | 1509 | unsigned int is_64, struct msi_msg *msg) |
1510 | { | 1510 | { |
1511 | struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); | 1511 | struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); |
1512 | struct pci_dn *pdn = pci_get_pdn(dev); | ||
1513 | unsigned int xive_num = hwirq - phb->msi_base; | 1512 | unsigned int xive_num = hwirq - phb->msi_base; |
1514 | __be32 data; | 1513 | __be32 data; |
1515 | int rc; | 1514 | int rc; |
@@ -1523,7 +1522,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, | |||
1523 | return -ENXIO; | 1522 | return -ENXIO; |
1524 | 1523 | ||
1525 | /* Force 32-bit MSI on some broken devices */ | 1524 | /* Force 32-bit MSI on some broken devices */ |
1526 | if (pdn && pdn->force_32bit_msi) | 1525 | if (dev->no_64bit_msi) |
1527 | is_64 = 0; | 1526 | is_64 = 0; |
1528 | 1527 | ||
1529 | /* Assign XIVE to PE */ | 1528 | /* Assign XIVE to PE */ |
@@ -1997,7 +1996,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, | |||
1997 | if (is_kdump_kernel()) { | 1996 | if (is_kdump_kernel()) { |
1998 | pr_info(" Issue PHB reset ...\n"); | 1997 | pr_info(" Issue PHB reset ...\n"); |
1999 | ioda_eeh_phb_reset(hose, EEH_RESET_FUNDAMENTAL); | 1998 | ioda_eeh_phb_reset(hose, EEH_RESET_FUNDAMENTAL); |
2000 | ioda_eeh_phb_reset(hose, OPAL_DEASSERT_RESET); | 1999 | ioda_eeh_phb_reset(hose, EEH_RESET_DEACTIVATE); |
2001 | } | 2000 | } |
2002 | 2001 | ||
2003 | /* Configure M64 window */ | 2002 | /* Configure M64 window */ |
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index b2187d0068b8..4b20f2c6b3b2 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -50,7 +50,6 @@ static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
50 | { | 50 | { |
51 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); | 51 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); |
52 | struct pnv_phb *phb = hose->private_data; | 52 | struct pnv_phb *phb = hose->private_data; |
53 | struct pci_dn *pdn = pci_get_pdn(pdev); | ||
54 | struct msi_desc *entry; | 53 | struct msi_desc *entry; |
55 | struct msi_msg msg; | 54 | struct msi_msg msg; |
56 | int hwirq; | 55 | int hwirq; |
@@ -60,7 +59,7 @@ static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
60 | if (WARN_ON(!phb) || !phb->msi_bmp.bitmap) | 59 | if (WARN_ON(!phb) || !phb->msi_bmp.bitmap) |
61 | return -ENODEV; | 60 | return -ENODEV; |
62 | 61 | ||
63 | if (pdn && pdn->force_32bit_msi && !phb->msi32_support) | 62 | if (pdev->no_64bit_msi && !phb->msi32_support) |
64 | return -ENODEV; | 63 | return -ENODEV; |
65 | 64 | ||
66 | list_for_each_entry(entry, &pdev->msi_list, list) { | 65 | list_for_each_entry(entry, &pdev->msi_list, list) { |
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index 6ad83bd11fe2..c22bb1b4beb8 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c | |||
@@ -382,7 +382,7 @@ static int dlpar_online_cpu(struct device_node *dn) | |||
382 | BUG_ON(get_cpu_current_state(cpu) | 382 | BUG_ON(get_cpu_current_state(cpu) |
383 | != CPU_STATE_OFFLINE); | 383 | != CPU_STATE_OFFLINE); |
384 | cpu_maps_update_done(); | 384 | cpu_maps_update_done(); |
385 | rc = cpu_up(cpu); | 385 | rc = device_online(get_cpu_device(cpu)); |
386 | if (rc) | 386 | if (rc) |
387 | goto out; | 387 | goto out; |
388 | cpu_maps_update_begin(); | 388 | cpu_maps_update_begin(); |
@@ -467,7 +467,7 @@ static int dlpar_offline_cpu(struct device_node *dn) | |||
467 | if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) { | 467 | if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) { |
468 | set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); | 468 | set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); |
469 | cpu_maps_update_done(); | 469 | cpu_maps_update_done(); |
470 | rc = cpu_down(cpu); | 470 | rc = device_offline(get_cpu_device(cpu)); |
471 | if (rc) | 471 | if (rc) |
472 | goto out; | 472 | goto out; |
473 | cpu_maps_update_begin(); | 473 | cpu_maps_update_begin(); |
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 8c509d5397c6..f6880d2a40fb 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <asm/trace.h> | 43 | #include <asm/trace.h> |
44 | #include <asm/firmware.h> | 44 | #include <asm/firmware.h> |
45 | #include <asm/plpar_wrappers.h> | 45 | #include <asm/plpar_wrappers.h> |
46 | #include <asm/fadump.h> | ||
46 | 47 | ||
47 | #include "pseries.h" | 48 | #include "pseries.h" |
48 | 49 | ||
@@ -247,8 +248,17 @@ static void pSeries_lpar_hptab_clear(void) | |||
247 | } | 248 | } |
248 | 249 | ||
249 | #ifdef __LITTLE_ENDIAN__ | 250 | #ifdef __LITTLE_ENDIAN__ |
250 | /* Reset exceptions to big endian */ | 251 | /* |
251 | if (firmware_has_feature(FW_FEATURE_SET_MODE)) { | 252 | * Reset exceptions to big endian. |
253 | * | ||
254 | * FIXME this is a hack for kexec, we need to reset the exception | ||
255 | * endian before starting the new kernel and this is a convenient place | ||
256 | * to do it. | ||
257 | * | ||
258 | * This is also called on boot when a fadump happens. In that case we | ||
259 | * must not change the exception endian mode. | ||
260 | */ | ||
261 | if (firmware_has_feature(FW_FEATURE_SET_MODE) && !is_fadump_active()) { | ||
252 | long rc; | 262 | long rc; |
253 | 263 | ||
254 | rc = pseries_big_endian_exceptions(); | 264 | rc = pseries_big_endian_exceptions(); |
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c index 8ab5add4ac82..8b909e94fd9a 100644 --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c | |||
@@ -420,7 +420,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) | |||
420 | */ | 420 | */ |
421 | again: | 421 | again: |
422 | if (type == PCI_CAP_ID_MSI) { | 422 | if (type == PCI_CAP_ID_MSI) { |
423 | if (pdn->force_32bit_msi) { | 423 | if (pdev->no_64bit_msi) { |
424 | rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); | 424 | rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); |
425 | if (rc < 0) { | 425 | if (rc < 0) { |
426 | /* | 426 | /* |
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index de40b48b460e..da08ed088157 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c | |||
@@ -361,7 +361,7 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev, | |||
361 | cascade_data->virq = virt_msir; | 361 | cascade_data->virq = virt_msir; |
362 | msi->cascade_array[irq_index] = cascade_data; | 362 | msi->cascade_array[irq_index] = cascade_data; |
363 | 363 | ||
364 | ret = request_irq(virt_msir, fsl_msi_cascade, 0, | 364 | ret = request_irq(virt_msir, fsl_msi_cascade, IRQF_NO_THREAD, |
365 | "fsl-msi-cascade", cascade_data); | 365 | "fsl-msi-cascade", cascade_data); |
366 | if (ret) { | 366 | if (ret) { |
367 | dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n", | 367 | dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n", |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index b988b5addf86..c8efbb37d6e0 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -293,10 +293,10 @@ static inline void disable_surveillance(void) | |||
293 | args.token = rtas_token("set-indicator"); | 293 | args.token = rtas_token("set-indicator"); |
294 | if (args.token == RTAS_UNKNOWN_SERVICE) | 294 | if (args.token == RTAS_UNKNOWN_SERVICE) |
295 | return; | 295 | return; |
296 | args.nargs = 3; | 296 | args.nargs = cpu_to_be32(3); |
297 | args.nret = 1; | 297 | args.nret = cpu_to_be32(1); |
298 | args.rets = &args.args[3]; | 298 | args.rets = &args.args[3]; |
299 | args.args[0] = SURVEILLANCE_TOKEN; | 299 | args.args[0] = cpu_to_be32(SURVEILLANCE_TOKEN); |
300 | args.args[1] = 0; | 300 | args.args[1] = 0; |
301 | args.args[2] = 0; | 301 | args.args[2] = 0; |
302 | enter_rtas(__pa(&args)); | 302 | enter_rtas(__pa(&args)); |
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig index 9d94fdd9f525..9432d0f202ef 100644 --- a/arch/s390/configs/default_defconfig +++ b/arch/s390/configs/default_defconfig | |||
@@ -35,7 +35,6 @@ CONFIG_MODULE_UNLOAD=y | |||
35 | CONFIG_MODULE_FORCE_UNLOAD=y | 35 | CONFIG_MODULE_FORCE_UNLOAD=y |
36 | CONFIG_MODVERSIONS=y | 36 | CONFIG_MODVERSIONS=y |
37 | CONFIG_MODULE_SRCVERSION_ALL=y | 37 | CONFIG_MODULE_SRCVERSION_ALL=y |
38 | CONFIG_BLK_DEV_INTEGRITY=y | ||
39 | CONFIG_BLK_DEV_THROTTLING=y | 38 | CONFIG_BLK_DEV_THROTTLING=y |
40 | CONFIG_PARTITION_ADVANCED=y | 39 | CONFIG_PARTITION_ADVANCED=y |
41 | CONFIG_IBM_PARTITION=y | 40 | CONFIG_IBM_PARTITION=y |
@@ -245,6 +244,7 @@ CONFIG_NF_TABLES_IPV4=m | |||
245 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m | 244 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
246 | CONFIG_NFT_CHAIN_NAT_IPV4=m | 245 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
247 | CONFIG_NF_TABLES_ARP=m | 246 | CONFIG_NF_TABLES_ARP=m |
247 | CONFIG_NF_NAT_IPV4=m | ||
248 | CONFIG_IP_NF_IPTABLES=m | 248 | CONFIG_IP_NF_IPTABLES=m |
249 | CONFIG_IP_NF_MATCH_AH=m | 249 | CONFIG_IP_NF_MATCH_AH=m |
250 | CONFIG_IP_NF_MATCH_ECN=m | 250 | CONFIG_IP_NF_MATCH_ECN=m |
@@ -252,11 +252,6 @@ CONFIG_IP_NF_MATCH_RPFILTER=m | |||
252 | CONFIG_IP_NF_MATCH_TTL=m | 252 | CONFIG_IP_NF_MATCH_TTL=m |
253 | CONFIG_IP_NF_FILTER=m | 253 | CONFIG_IP_NF_FILTER=m |
254 | CONFIG_IP_NF_TARGET_REJECT=m | 254 | CONFIG_IP_NF_TARGET_REJECT=m |
255 | CONFIG_IP_NF_TARGET_ULOG=m | ||
256 | CONFIG_NF_NAT_IPV4=m | ||
257 | CONFIG_IP_NF_TARGET_MASQUERADE=m | ||
258 | CONFIG_IP_NF_TARGET_NETMAP=m | ||
259 | CONFIG_IP_NF_TARGET_REDIRECT=m | ||
260 | CONFIG_IP_NF_MANGLE=m | 255 | CONFIG_IP_NF_MANGLE=m |
261 | CONFIG_IP_NF_TARGET_CLUSTERIP=m | 256 | CONFIG_IP_NF_TARGET_CLUSTERIP=m |
262 | CONFIG_IP_NF_TARGET_ECN=m | 257 | CONFIG_IP_NF_TARGET_ECN=m |
@@ -270,6 +265,7 @@ CONFIG_NF_CONNTRACK_IPV6=m | |||
270 | CONFIG_NF_TABLES_IPV6=m | 265 | CONFIG_NF_TABLES_IPV6=m |
271 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m | 266 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
272 | CONFIG_NFT_CHAIN_NAT_IPV6=m | 267 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
268 | CONFIG_NF_NAT_IPV6=m | ||
273 | CONFIG_IP6_NF_IPTABLES=m | 269 | CONFIG_IP6_NF_IPTABLES=m |
274 | CONFIG_IP6_NF_MATCH_AH=m | 270 | CONFIG_IP6_NF_MATCH_AH=m |
275 | CONFIG_IP6_NF_MATCH_EUI64=m | 271 | CONFIG_IP6_NF_MATCH_EUI64=m |
@@ -286,9 +282,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m | |||
286 | CONFIG_IP6_NF_MANGLE=m | 282 | CONFIG_IP6_NF_MANGLE=m |
287 | CONFIG_IP6_NF_RAW=m | 283 | CONFIG_IP6_NF_RAW=m |
288 | CONFIG_IP6_NF_SECURITY=m | 284 | CONFIG_IP6_NF_SECURITY=m |
289 | CONFIG_NF_NAT_IPV6=m | ||
290 | CONFIG_IP6_NF_TARGET_MASQUERADE=m | ||
291 | CONFIG_IP6_NF_TARGET_NPT=m | ||
292 | CONFIG_NF_TABLES_BRIDGE=m | 285 | CONFIG_NF_TABLES_BRIDGE=m |
293 | CONFIG_NET_SCTPPROBE=m | 286 | CONFIG_NET_SCTPPROBE=m |
294 | CONFIG_RDS=m | 287 | CONFIG_RDS=m |
@@ -374,14 +367,13 @@ CONFIG_BLK_DEV_SR=m | |||
374 | CONFIG_CHR_DEV_SG=y | 367 | CONFIG_CHR_DEV_SG=y |
375 | CONFIG_CHR_DEV_SCH=m | 368 | CONFIG_CHR_DEV_SCH=m |
376 | CONFIG_SCSI_ENCLOSURE=m | 369 | CONFIG_SCSI_ENCLOSURE=m |
377 | CONFIG_SCSI_MULTI_LUN=y | ||
378 | CONFIG_SCSI_CONSTANTS=y | 370 | CONFIG_SCSI_CONSTANTS=y |
379 | CONFIG_SCSI_LOGGING=y | 371 | CONFIG_SCSI_LOGGING=y |
380 | CONFIG_SCSI_SPI_ATTRS=m | 372 | CONFIG_SCSI_SPI_ATTRS=m |
373 | CONFIG_SCSI_FC_ATTRS=y | ||
381 | CONFIG_SCSI_SAS_LIBSAS=m | 374 | CONFIG_SCSI_SAS_LIBSAS=m |
382 | CONFIG_SCSI_SRP_ATTRS=m | 375 | CONFIG_SCSI_SRP_ATTRS=m |
383 | CONFIG_ISCSI_TCP=m | 376 | CONFIG_ISCSI_TCP=m |
384 | CONFIG_LIBFCOE=m | ||
385 | CONFIG_SCSI_DEBUG=m | 377 | CONFIG_SCSI_DEBUG=m |
386 | CONFIG_ZFCP=y | 378 | CONFIG_ZFCP=y |
387 | CONFIG_SCSI_VIRTIO=m | 379 | CONFIG_SCSI_VIRTIO=m |
@@ -427,7 +419,6 @@ CONFIG_VIRTIO_NET=m | |||
427 | CONFIG_NLMON=m | 419 | CONFIG_NLMON=m |
428 | CONFIG_VHOST_NET=m | 420 | CONFIG_VHOST_NET=m |
429 | # CONFIG_NET_VENDOR_ARC is not set | 421 | # CONFIG_NET_VENDOR_ARC is not set |
430 | # CONFIG_NET_CADENCE is not set | ||
431 | # CONFIG_NET_VENDOR_CHELSIO is not set | 422 | # CONFIG_NET_VENDOR_CHELSIO is not set |
432 | # CONFIG_NET_VENDOR_INTEL is not set | 423 | # CONFIG_NET_VENDOR_INTEL is not set |
433 | # CONFIG_NET_VENDOR_MARVELL is not set | 424 | # CONFIG_NET_VENDOR_MARVELL is not set |
@@ -481,14 +472,14 @@ CONFIG_JFS_FS=m | |||
481 | CONFIG_JFS_POSIX_ACL=y | 472 | CONFIG_JFS_POSIX_ACL=y |
482 | CONFIG_JFS_SECURITY=y | 473 | CONFIG_JFS_SECURITY=y |
483 | CONFIG_JFS_STATISTICS=y | 474 | CONFIG_JFS_STATISTICS=y |
484 | CONFIG_XFS_FS=m | 475 | CONFIG_XFS_FS=y |
485 | CONFIG_XFS_QUOTA=y | 476 | CONFIG_XFS_QUOTA=y |
486 | CONFIG_XFS_POSIX_ACL=y | 477 | CONFIG_XFS_POSIX_ACL=y |
487 | CONFIG_XFS_RT=y | 478 | CONFIG_XFS_RT=y |
488 | CONFIG_XFS_DEBUG=y | 479 | CONFIG_XFS_DEBUG=y |
489 | CONFIG_GFS2_FS=m | 480 | CONFIG_GFS2_FS=m |
490 | CONFIG_OCFS2_FS=m | 481 | CONFIG_OCFS2_FS=m |
491 | CONFIG_BTRFS_FS=m | 482 | CONFIG_BTRFS_FS=y |
492 | CONFIG_BTRFS_FS_POSIX_ACL=y | 483 | CONFIG_BTRFS_FS_POSIX_ACL=y |
493 | CONFIG_NILFS2_FS=m | 484 | CONFIG_NILFS2_FS=m |
494 | CONFIG_FANOTIFY=y | 485 | CONFIG_FANOTIFY=y |
@@ -574,7 +565,6 @@ CONFIG_DEBUG_SHIRQ=y | |||
574 | CONFIG_DETECT_HUNG_TASK=y | 565 | CONFIG_DETECT_HUNG_TASK=y |
575 | CONFIG_TIMER_STATS=y | 566 | CONFIG_TIMER_STATS=y |
576 | CONFIG_DEBUG_RT_MUTEXES=y | 567 | CONFIG_DEBUG_RT_MUTEXES=y |
577 | CONFIG_RT_MUTEX_TESTER=y | ||
578 | CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y | 568 | CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y |
579 | CONFIG_PROVE_LOCKING=y | 569 | CONFIG_PROVE_LOCKING=y |
580 | CONFIG_LOCK_STAT=y | 570 | CONFIG_LOCK_STAT=y |
@@ -600,8 +590,13 @@ CONFIG_FAULT_INJECTION_DEBUG_FS=y | |||
600 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y | 590 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y |
601 | CONFIG_LATENCYTOP=y | 591 | CONFIG_LATENCYTOP=y |
602 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y | 592 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y |
593 | CONFIG_IRQSOFF_TRACER=y | ||
594 | CONFIG_PREEMPT_TRACER=y | ||
595 | CONFIG_SCHED_TRACER=y | ||
596 | CONFIG_FTRACE_SYSCALLS=y | ||
597 | CONFIG_STACK_TRACER=y | ||
603 | CONFIG_BLK_DEV_IO_TRACE=y | 598 | CONFIG_BLK_DEV_IO_TRACE=y |
604 | # CONFIG_KPROBE_EVENT is not set | 599 | CONFIG_UPROBE_EVENT=y |
605 | CONFIG_LKDTM=m | 600 | CONFIG_LKDTM=m |
606 | CONFIG_TEST_LIST_SORT=y | 601 | CONFIG_TEST_LIST_SORT=y |
607 | CONFIG_KPROBES_SANITY_TEST=y | 602 | CONFIG_KPROBES_SANITY_TEST=y |
@@ -609,7 +604,10 @@ CONFIG_RBTREE_TEST=y | |||
609 | CONFIG_INTERVAL_TREE_TEST=m | 604 | CONFIG_INTERVAL_TREE_TEST=m |
610 | CONFIG_PERCPU_TEST=m | 605 | CONFIG_PERCPU_TEST=m |
611 | CONFIG_ATOMIC64_SELFTEST=y | 606 | CONFIG_ATOMIC64_SELFTEST=y |
607 | CONFIG_TEST_STRING_HELPERS=y | ||
608 | CONFIG_TEST_KSTRTOX=y | ||
612 | CONFIG_DMA_API_DEBUG=y | 609 | CONFIG_DMA_API_DEBUG=y |
610 | CONFIG_TEST_BPF=m | ||
613 | # CONFIG_STRICT_DEVMEM is not set | 611 | # CONFIG_STRICT_DEVMEM is not set |
614 | CONFIG_S390_PTDUMP=y | 612 | CONFIG_S390_PTDUMP=y |
615 | CONFIG_ENCRYPTED_KEYS=m | 613 | CONFIG_ENCRYPTED_KEYS=m |
@@ -673,12 +671,6 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m | |||
673 | CONFIG_X509_CERTIFICATE_PARSER=m | 671 | CONFIG_X509_CERTIFICATE_PARSER=m |
674 | CONFIG_CRC7=m | 672 | CONFIG_CRC7=m |
675 | CONFIG_CRC8=m | 673 | CONFIG_CRC8=m |
676 | CONFIG_XZ_DEC_X86=y | ||
677 | CONFIG_XZ_DEC_POWERPC=y | ||
678 | CONFIG_XZ_DEC_IA64=y | ||
679 | CONFIG_XZ_DEC_ARM=y | ||
680 | CONFIG_XZ_DEC_ARMTHUMB=y | ||
681 | CONFIG_XZ_DEC_SPARC=y | ||
682 | CONFIG_CORDIC=m | 674 | CONFIG_CORDIC=m |
683 | CONFIG_CMM=m | 675 | CONFIG_CMM=m |
684 | CONFIG_APPLDATA_BASE=y | 676 | CONFIG_APPLDATA_BASE=y |
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig index 90f514baa37d..219dca6ea926 100644 --- a/arch/s390/configs/gcov_defconfig +++ b/arch/s390/configs/gcov_defconfig | |||
@@ -35,7 +35,6 @@ CONFIG_MODULE_UNLOAD=y | |||
35 | CONFIG_MODULE_FORCE_UNLOAD=y | 35 | CONFIG_MODULE_FORCE_UNLOAD=y |
36 | CONFIG_MODVERSIONS=y | 36 | CONFIG_MODVERSIONS=y |
37 | CONFIG_MODULE_SRCVERSION_ALL=y | 37 | CONFIG_MODULE_SRCVERSION_ALL=y |
38 | CONFIG_BLK_DEV_INTEGRITY=y | ||
39 | CONFIG_BLK_DEV_THROTTLING=y | 38 | CONFIG_BLK_DEV_THROTTLING=y |
40 | CONFIG_PARTITION_ADVANCED=y | 39 | CONFIG_PARTITION_ADVANCED=y |
41 | CONFIG_IBM_PARTITION=y | 40 | CONFIG_IBM_PARTITION=y |
@@ -243,6 +242,7 @@ CONFIG_NF_TABLES_IPV4=m | |||
243 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m | 242 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
244 | CONFIG_NFT_CHAIN_NAT_IPV4=m | 243 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
245 | CONFIG_NF_TABLES_ARP=m | 244 | CONFIG_NF_TABLES_ARP=m |
245 | CONFIG_NF_NAT_IPV4=m | ||
246 | CONFIG_IP_NF_IPTABLES=m | 246 | CONFIG_IP_NF_IPTABLES=m |
247 | CONFIG_IP_NF_MATCH_AH=m | 247 | CONFIG_IP_NF_MATCH_AH=m |
248 | CONFIG_IP_NF_MATCH_ECN=m | 248 | CONFIG_IP_NF_MATCH_ECN=m |
@@ -250,11 +250,6 @@ CONFIG_IP_NF_MATCH_RPFILTER=m | |||
250 | CONFIG_IP_NF_MATCH_TTL=m | 250 | CONFIG_IP_NF_MATCH_TTL=m |
251 | CONFIG_IP_NF_FILTER=m | 251 | CONFIG_IP_NF_FILTER=m |
252 | CONFIG_IP_NF_TARGET_REJECT=m | 252 | CONFIG_IP_NF_TARGET_REJECT=m |
253 | CONFIG_IP_NF_TARGET_ULOG=m | ||
254 | CONFIG_NF_NAT_IPV4=m | ||
255 | CONFIG_IP_NF_TARGET_MASQUERADE=m | ||
256 | CONFIG_IP_NF_TARGET_NETMAP=m | ||
257 | CONFIG_IP_NF_TARGET_REDIRECT=m | ||
258 | CONFIG_IP_NF_MANGLE=m | 253 | CONFIG_IP_NF_MANGLE=m |
259 | CONFIG_IP_NF_TARGET_CLUSTERIP=m | 254 | CONFIG_IP_NF_TARGET_CLUSTERIP=m |
260 | CONFIG_IP_NF_TARGET_ECN=m | 255 | CONFIG_IP_NF_TARGET_ECN=m |
@@ -268,6 +263,7 @@ CONFIG_NF_CONNTRACK_IPV6=m | |||
268 | CONFIG_NF_TABLES_IPV6=m | 263 | CONFIG_NF_TABLES_IPV6=m |
269 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m | 264 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
270 | CONFIG_NFT_CHAIN_NAT_IPV6=m | 265 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
266 | CONFIG_NF_NAT_IPV6=m | ||
271 | CONFIG_IP6_NF_IPTABLES=m | 267 | CONFIG_IP6_NF_IPTABLES=m |
272 | CONFIG_IP6_NF_MATCH_AH=m | 268 | CONFIG_IP6_NF_MATCH_AH=m |
273 | CONFIG_IP6_NF_MATCH_EUI64=m | 269 | CONFIG_IP6_NF_MATCH_EUI64=m |
@@ -284,9 +280,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m | |||
284 | CONFIG_IP6_NF_MANGLE=m | 280 | CONFIG_IP6_NF_MANGLE=m |
285 | CONFIG_IP6_NF_RAW=m | 281 | CONFIG_IP6_NF_RAW=m |
286 | CONFIG_IP6_NF_SECURITY=m | 282 | CONFIG_IP6_NF_SECURITY=m |
287 | CONFIG_NF_NAT_IPV6=m | ||
288 | CONFIG_IP6_NF_TARGET_MASQUERADE=m | ||
289 | CONFIG_IP6_NF_TARGET_NPT=m | ||
290 | CONFIG_NF_TABLES_BRIDGE=m | 283 | CONFIG_NF_TABLES_BRIDGE=m |
291 | CONFIG_NET_SCTPPROBE=m | 284 | CONFIG_NET_SCTPPROBE=m |
292 | CONFIG_RDS=m | 285 | CONFIG_RDS=m |
@@ -371,14 +364,13 @@ CONFIG_BLK_DEV_SR=m | |||
371 | CONFIG_CHR_DEV_SG=y | 364 | CONFIG_CHR_DEV_SG=y |
372 | CONFIG_CHR_DEV_SCH=m | 365 | CONFIG_CHR_DEV_SCH=m |
373 | CONFIG_SCSI_ENCLOSURE=m | 366 | CONFIG_SCSI_ENCLOSURE=m |
374 | CONFIG_SCSI_MULTI_LUN=y | ||
375 | CONFIG_SCSI_CONSTANTS=y | 367 | CONFIG_SCSI_CONSTANTS=y |
376 | CONFIG_SCSI_LOGGING=y | 368 | CONFIG_SCSI_LOGGING=y |
377 | CONFIG_SCSI_SPI_ATTRS=m | 369 | CONFIG_SCSI_SPI_ATTRS=m |
370 | CONFIG_SCSI_FC_ATTRS=y | ||
378 | CONFIG_SCSI_SAS_LIBSAS=m | 371 | CONFIG_SCSI_SAS_LIBSAS=m |
379 | CONFIG_SCSI_SRP_ATTRS=m | 372 | CONFIG_SCSI_SRP_ATTRS=m |
380 | CONFIG_ISCSI_TCP=m | 373 | CONFIG_ISCSI_TCP=m |
381 | CONFIG_LIBFCOE=m | ||
382 | CONFIG_SCSI_DEBUG=m | 374 | CONFIG_SCSI_DEBUG=m |
383 | CONFIG_ZFCP=y | 375 | CONFIG_ZFCP=y |
384 | CONFIG_SCSI_VIRTIO=m | 376 | CONFIG_SCSI_VIRTIO=m |
@@ -424,7 +416,6 @@ CONFIG_VIRTIO_NET=m | |||
424 | CONFIG_NLMON=m | 416 | CONFIG_NLMON=m |
425 | CONFIG_VHOST_NET=m | 417 | CONFIG_VHOST_NET=m |
426 | # CONFIG_NET_VENDOR_ARC is not set | 418 | # CONFIG_NET_VENDOR_ARC is not set |
427 | # CONFIG_NET_CADENCE is not set | ||
428 | # CONFIG_NET_VENDOR_CHELSIO is not set | 419 | # CONFIG_NET_VENDOR_CHELSIO is not set |
429 | # CONFIG_NET_VENDOR_INTEL is not set | 420 | # CONFIG_NET_VENDOR_INTEL is not set |
430 | # CONFIG_NET_VENDOR_MARVELL is not set | 421 | # CONFIG_NET_VENDOR_MARVELL is not set |
@@ -478,13 +469,13 @@ CONFIG_JFS_FS=m | |||
478 | CONFIG_JFS_POSIX_ACL=y | 469 | CONFIG_JFS_POSIX_ACL=y |
479 | CONFIG_JFS_SECURITY=y | 470 | CONFIG_JFS_SECURITY=y |
480 | CONFIG_JFS_STATISTICS=y | 471 | CONFIG_JFS_STATISTICS=y |
481 | CONFIG_XFS_FS=m | 472 | CONFIG_XFS_FS=y |
482 | CONFIG_XFS_QUOTA=y | 473 | CONFIG_XFS_QUOTA=y |
483 | CONFIG_XFS_POSIX_ACL=y | 474 | CONFIG_XFS_POSIX_ACL=y |
484 | CONFIG_XFS_RT=y | 475 | CONFIG_XFS_RT=y |
485 | CONFIG_GFS2_FS=m | 476 | CONFIG_GFS2_FS=m |
486 | CONFIG_OCFS2_FS=m | 477 | CONFIG_OCFS2_FS=m |
487 | CONFIG_BTRFS_FS=m | 478 | CONFIG_BTRFS_FS=y |
488 | CONFIG_BTRFS_FS_POSIX_ACL=y | 479 | CONFIG_BTRFS_FS_POSIX_ACL=y |
489 | CONFIG_NILFS2_FS=m | 480 | CONFIG_NILFS2_FS=m |
490 | CONFIG_FANOTIFY=y | 481 | CONFIG_FANOTIFY=y |
@@ -626,12 +617,6 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m | |||
626 | CONFIG_X509_CERTIFICATE_PARSER=m | 617 | CONFIG_X509_CERTIFICATE_PARSER=m |
627 | CONFIG_CRC7=m | 618 | CONFIG_CRC7=m |
628 | CONFIG_CRC8=m | 619 | CONFIG_CRC8=m |
629 | CONFIG_XZ_DEC_X86=y | ||
630 | CONFIG_XZ_DEC_POWERPC=y | ||
631 | CONFIG_XZ_DEC_IA64=y | ||
632 | CONFIG_XZ_DEC_ARM=y | ||
633 | CONFIG_XZ_DEC_ARMTHUMB=y | ||
634 | CONFIG_XZ_DEC_SPARC=y | ||
635 | CONFIG_CORDIC=m | 620 | CONFIG_CORDIC=m |
636 | CONFIG_CMM=m | 621 | CONFIG_CMM=m |
637 | CONFIG_APPLDATA_BASE=y | 622 | CONFIG_APPLDATA_BASE=y |
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig index 13559d32af69..822c2f2e0c25 100644 --- a/arch/s390/configs/performance_defconfig +++ b/arch/s390/configs/performance_defconfig | |||
@@ -33,7 +33,6 @@ CONFIG_MODULE_UNLOAD=y | |||
33 | CONFIG_MODULE_FORCE_UNLOAD=y | 33 | CONFIG_MODULE_FORCE_UNLOAD=y |
34 | CONFIG_MODVERSIONS=y | 34 | CONFIG_MODVERSIONS=y |
35 | CONFIG_MODULE_SRCVERSION_ALL=y | 35 | CONFIG_MODULE_SRCVERSION_ALL=y |
36 | CONFIG_BLK_DEV_INTEGRITY=y | ||
37 | CONFIG_BLK_DEV_THROTTLING=y | 36 | CONFIG_BLK_DEV_THROTTLING=y |
38 | CONFIG_PARTITION_ADVANCED=y | 37 | CONFIG_PARTITION_ADVANCED=y |
39 | CONFIG_IBM_PARTITION=y | 38 | CONFIG_IBM_PARTITION=y |
@@ -241,6 +240,7 @@ CONFIG_NF_TABLES_IPV4=m | |||
241 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m | 240 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
242 | CONFIG_NFT_CHAIN_NAT_IPV4=m | 241 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
243 | CONFIG_NF_TABLES_ARP=m | 242 | CONFIG_NF_TABLES_ARP=m |
243 | CONFIG_NF_NAT_IPV4=m | ||
244 | CONFIG_IP_NF_IPTABLES=m | 244 | CONFIG_IP_NF_IPTABLES=m |
245 | CONFIG_IP_NF_MATCH_AH=m | 245 | CONFIG_IP_NF_MATCH_AH=m |
246 | CONFIG_IP_NF_MATCH_ECN=m | 246 | CONFIG_IP_NF_MATCH_ECN=m |
@@ -248,11 +248,6 @@ CONFIG_IP_NF_MATCH_RPFILTER=m | |||
248 | CONFIG_IP_NF_MATCH_TTL=m | 248 | CONFIG_IP_NF_MATCH_TTL=m |
249 | CONFIG_IP_NF_FILTER=m | 249 | CONFIG_IP_NF_FILTER=m |
250 | CONFIG_IP_NF_TARGET_REJECT=m | 250 | CONFIG_IP_NF_TARGET_REJECT=m |
251 | CONFIG_IP_NF_TARGET_ULOG=m | ||
252 | CONFIG_NF_NAT_IPV4=m | ||
253 | CONFIG_IP_NF_TARGET_MASQUERADE=m | ||
254 | CONFIG_IP_NF_TARGET_NETMAP=m | ||
255 | CONFIG_IP_NF_TARGET_REDIRECT=m | ||
256 | CONFIG_IP_NF_MANGLE=m | 251 | CONFIG_IP_NF_MANGLE=m |
257 | CONFIG_IP_NF_TARGET_CLUSTERIP=m | 252 | CONFIG_IP_NF_TARGET_CLUSTERIP=m |
258 | CONFIG_IP_NF_TARGET_ECN=m | 253 | CONFIG_IP_NF_TARGET_ECN=m |
@@ -266,6 +261,7 @@ CONFIG_NF_CONNTRACK_IPV6=m | |||
266 | CONFIG_NF_TABLES_IPV6=m | 261 | CONFIG_NF_TABLES_IPV6=m |
267 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m | 262 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
268 | CONFIG_NFT_CHAIN_NAT_IPV6=m | 263 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
264 | CONFIG_NF_NAT_IPV6=m | ||
269 | CONFIG_IP6_NF_IPTABLES=m | 265 | CONFIG_IP6_NF_IPTABLES=m |
270 | CONFIG_IP6_NF_MATCH_AH=m | 266 | CONFIG_IP6_NF_MATCH_AH=m |
271 | CONFIG_IP6_NF_MATCH_EUI64=m | 267 | CONFIG_IP6_NF_MATCH_EUI64=m |
@@ -282,9 +278,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m | |||
282 | CONFIG_IP6_NF_MANGLE=m | 278 | CONFIG_IP6_NF_MANGLE=m |
283 | CONFIG_IP6_NF_RAW=m | 279 | CONFIG_IP6_NF_RAW=m |
284 | CONFIG_IP6_NF_SECURITY=m | 280 | CONFIG_IP6_NF_SECURITY=m |
285 | CONFIG_NF_NAT_IPV6=m | ||
286 | CONFIG_IP6_NF_TARGET_MASQUERADE=m | ||
287 | CONFIG_IP6_NF_TARGET_NPT=m | ||
288 | CONFIG_NF_TABLES_BRIDGE=m | 281 | CONFIG_NF_TABLES_BRIDGE=m |
289 | CONFIG_NET_SCTPPROBE=m | 282 | CONFIG_NET_SCTPPROBE=m |
290 | CONFIG_RDS=m | 283 | CONFIG_RDS=m |
@@ -369,14 +362,13 @@ CONFIG_BLK_DEV_SR=m | |||
369 | CONFIG_CHR_DEV_SG=y | 362 | CONFIG_CHR_DEV_SG=y |
370 | CONFIG_CHR_DEV_SCH=m | 363 | CONFIG_CHR_DEV_SCH=m |
371 | CONFIG_SCSI_ENCLOSURE=m | 364 | CONFIG_SCSI_ENCLOSURE=m |
372 | CONFIG_SCSI_MULTI_LUN=y | ||
373 | CONFIG_SCSI_CONSTANTS=y | 365 | CONFIG_SCSI_CONSTANTS=y |
374 | CONFIG_SCSI_LOGGING=y | 366 | CONFIG_SCSI_LOGGING=y |
375 | CONFIG_SCSI_SPI_ATTRS=m | 367 | CONFIG_SCSI_SPI_ATTRS=m |
368 | CONFIG_SCSI_FC_ATTRS=y | ||
376 | CONFIG_SCSI_SAS_LIBSAS=m | 369 | CONFIG_SCSI_SAS_LIBSAS=m |
377 | CONFIG_SCSI_SRP_ATTRS=m | 370 | CONFIG_SCSI_SRP_ATTRS=m |
378 | CONFIG_ISCSI_TCP=m | 371 | CONFIG_ISCSI_TCP=m |
379 | CONFIG_LIBFCOE=m | ||
380 | CONFIG_SCSI_DEBUG=m | 372 | CONFIG_SCSI_DEBUG=m |
381 | CONFIG_ZFCP=y | 373 | CONFIG_ZFCP=y |
382 | CONFIG_SCSI_VIRTIO=m | 374 | CONFIG_SCSI_VIRTIO=m |
@@ -422,7 +414,6 @@ CONFIG_VIRTIO_NET=m | |||
422 | CONFIG_NLMON=m | 414 | CONFIG_NLMON=m |
423 | CONFIG_VHOST_NET=m | 415 | CONFIG_VHOST_NET=m |
424 | # CONFIG_NET_VENDOR_ARC is not set | 416 | # CONFIG_NET_VENDOR_ARC is not set |
425 | # CONFIG_NET_CADENCE is not set | ||
426 | # CONFIG_NET_VENDOR_CHELSIO is not set | 417 | # CONFIG_NET_VENDOR_CHELSIO is not set |
427 | # CONFIG_NET_VENDOR_INTEL is not set | 418 | # CONFIG_NET_VENDOR_INTEL is not set |
428 | # CONFIG_NET_VENDOR_MARVELL is not set | 419 | # CONFIG_NET_VENDOR_MARVELL is not set |
@@ -476,13 +467,13 @@ CONFIG_JFS_FS=m | |||
476 | CONFIG_JFS_POSIX_ACL=y | 467 | CONFIG_JFS_POSIX_ACL=y |
477 | CONFIG_JFS_SECURITY=y | 468 | CONFIG_JFS_SECURITY=y |
478 | CONFIG_JFS_STATISTICS=y | 469 | CONFIG_JFS_STATISTICS=y |
479 | CONFIG_XFS_FS=m | 470 | CONFIG_XFS_FS=y |
480 | CONFIG_XFS_QUOTA=y | 471 | CONFIG_XFS_QUOTA=y |
481 | CONFIG_XFS_POSIX_ACL=y | 472 | CONFIG_XFS_POSIX_ACL=y |
482 | CONFIG_XFS_RT=y | 473 | CONFIG_XFS_RT=y |
483 | CONFIG_GFS2_FS=m | 474 | CONFIG_GFS2_FS=m |
484 | CONFIG_OCFS2_FS=m | 475 | CONFIG_OCFS2_FS=m |
485 | CONFIG_BTRFS_FS=m | 476 | CONFIG_BTRFS_FS=y |
486 | CONFIG_BTRFS_FS_POSIX_ACL=y | 477 | CONFIG_BTRFS_FS_POSIX_ACL=y |
487 | CONFIG_NILFS2_FS=m | 478 | CONFIG_NILFS2_FS=m |
488 | CONFIG_FANOTIFY=y | 479 | CONFIG_FANOTIFY=y |
@@ -550,8 +541,11 @@ CONFIG_TIMER_STATS=y | |||
550 | CONFIG_RCU_TORTURE_TEST=m | 541 | CONFIG_RCU_TORTURE_TEST=m |
551 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 542 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
552 | CONFIG_LATENCYTOP=y | 543 | CONFIG_LATENCYTOP=y |
544 | CONFIG_SCHED_TRACER=y | ||
545 | CONFIG_FTRACE_SYSCALLS=y | ||
546 | CONFIG_STACK_TRACER=y | ||
553 | CONFIG_BLK_DEV_IO_TRACE=y | 547 | CONFIG_BLK_DEV_IO_TRACE=y |
554 | # CONFIG_KPROBE_EVENT is not set | 548 | CONFIG_UPROBE_EVENT=y |
555 | CONFIG_LKDTM=m | 549 | CONFIG_LKDTM=m |
556 | CONFIG_PERCPU_TEST=m | 550 | CONFIG_PERCPU_TEST=m |
557 | CONFIG_ATOMIC64_SELFTEST=y | 551 | CONFIG_ATOMIC64_SELFTEST=y |
@@ -618,12 +612,6 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m | |||
618 | CONFIG_X509_CERTIFICATE_PARSER=m | 612 | CONFIG_X509_CERTIFICATE_PARSER=m |
619 | CONFIG_CRC7=m | 613 | CONFIG_CRC7=m |
620 | CONFIG_CRC8=m | 614 | CONFIG_CRC8=m |
621 | CONFIG_XZ_DEC_X86=y | ||
622 | CONFIG_XZ_DEC_POWERPC=y | ||
623 | CONFIG_XZ_DEC_IA64=y | ||
624 | CONFIG_XZ_DEC_ARM=y | ||
625 | CONFIG_XZ_DEC_ARMTHUMB=y | ||
626 | CONFIG_XZ_DEC_SPARC=y | ||
627 | CONFIG_CORDIC=m | 615 | CONFIG_CORDIC=m |
628 | CONFIG_CMM=m | 616 | CONFIG_CMM=m |
629 | CONFIG_APPLDATA_BASE=y | 617 | CONFIG_APPLDATA_BASE=y |
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig index e376789f2d8d..9d63051ebec4 100644 --- a/arch/s390/configs/zfcpdump_defconfig +++ b/arch/s390/configs/zfcpdump_defconfig | |||
@@ -22,8 +22,8 @@ CONFIG_HZ_100=y | |||
22 | CONFIG_CRASH_DUMP=y | 22 | CONFIG_CRASH_DUMP=y |
23 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 23 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
24 | # CONFIG_SECCOMP is not set | 24 | # CONFIG_SECCOMP is not set |
25 | # CONFIG_IUCV is not set | ||
26 | CONFIG_NET=y | 25 | CONFIG_NET=y |
26 | # CONFIG_IUCV is not set | ||
27 | CONFIG_ATM=y | 27 | CONFIG_ATM=y |
28 | CONFIG_ATM_LANE=y | 28 | CONFIG_ATM_LANE=y |
29 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 29 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
@@ -36,9 +36,9 @@ CONFIG_ENCLOSURE_SERVICES=y | |||
36 | CONFIG_SCSI=y | 36 | CONFIG_SCSI=y |
37 | CONFIG_BLK_DEV_SD=y | 37 | CONFIG_BLK_DEV_SD=y |
38 | CONFIG_SCSI_ENCLOSURE=y | 38 | CONFIG_SCSI_ENCLOSURE=y |
39 | CONFIG_SCSI_MULTI_LUN=y | ||
40 | CONFIG_SCSI_CONSTANTS=y | 39 | CONFIG_SCSI_CONSTANTS=y |
41 | CONFIG_SCSI_LOGGING=y | 40 | CONFIG_SCSI_LOGGING=y |
41 | CONFIG_SCSI_FC_ATTRS=y | ||
42 | CONFIG_SCSI_SRP_ATTRS=y | 42 | CONFIG_SCSI_SRP_ATTRS=y |
43 | CONFIG_ZFCP=y | 43 | CONFIG_ZFCP=y |
44 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | 44 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set |
@@ -75,12 +75,6 @@ CONFIG_DEBUG_KERNEL=y | |||
75 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 75 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
76 | # CONFIG_FTRACE is not set | 76 | # CONFIG_FTRACE is not set |
77 | # CONFIG_STRICT_DEVMEM is not set | 77 | # CONFIG_STRICT_DEVMEM is not set |
78 | CONFIG_XZ_DEC_X86=y | ||
79 | CONFIG_XZ_DEC_POWERPC=y | ||
80 | CONFIG_XZ_DEC_IA64=y | ||
81 | CONFIG_XZ_DEC_ARM=y | ||
82 | CONFIG_XZ_DEC_ARMTHUMB=y | ||
83 | CONFIG_XZ_DEC_SPARC=y | ||
84 | # CONFIG_PFAULT is not set | 78 | # CONFIG_PFAULT is not set |
85 | # CONFIG_S390_HYPFS_FS is not set | 79 | # CONFIG_S390_HYPFS_FS is not set |
86 | # CONFIG_VIRTUALIZATION is not set | 80 | # CONFIG_VIRTUALIZATION is not set |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index fab35a8efa4f..785c5f24d6f9 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -92,10 +92,10 @@ CONFIG_CHR_DEV_ST=y | |||
92 | CONFIG_BLK_DEV_SR=y | 92 | CONFIG_BLK_DEV_SR=y |
93 | CONFIG_BLK_DEV_SR_VENDOR=y | 93 | CONFIG_BLK_DEV_SR_VENDOR=y |
94 | CONFIG_CHR_DEV_SG=y | 94 | CONFIG_CHR_DEV_SG=y |
95 | CONFIG_SCSI_MULTI_LUN=y | ||
96 | CONFIG_SCSI_CONSTANTS=y | 95 | CONFIG_SCSI_CONSTANTS=y |
97 | CONFIG_SCSI_LOGGING=y | 96 | CONFIG_SCSI_LOGGING=y |
98 | CONFIG_SCSI_SCAN_ASYNC=y | 97 | CONFIG_SCSI_SCAN_ASYNC=y |
98 | CONFIG_SCSI_FC_ATTRS=y | ||
99 | CONFIG_ZFCP=y | 99 | CONFIG_ZFCP=y |
100 | CONFIG_SCSI_VIRTIO=y | 100 | CONFIG_SCSI_VIRTIO=y |
101 | CONFIG_NETDEVICES=y | 101 | CONFIG_NETDEVICES=y |
@@ -164,14 +164,13 @@ CONFIG_CRYPTO_CMAC=m | |||
164 | CONFIG_CRYPTO_XCBC=m | 164 | CONFIG_CRYPTO_XCBC=m |
165 | CONFIG_CRYPTO_VMAC=m | 165 | CONFIG_CRYPTO_VMAC=m |
166 | CONFIG_CRYPTO_CRC32=m | 166 | CONFIG_CRYPTO_CRC32=m |
167 | CONFIG_CRYPTO_CRCT10DIF=m | ||
168 | CONFIG_CRYPTO_MD4=m | 167 | CONFIG_CRYPTO_MD4=m |
169 | CONFIG_CRYPTO_MICHAEL_MIC=m | 168 | CONFIG_CRYPTO_MICHAEL_MIC=m |
170 | CONFIG_CRYPTO_RMD128=m | 169 | CONFIG_CRYPTO_RMD128=m |
171 | CONFIG_CRYPTO_RMD160=m | 170 | CONFIG_CRYPTO_RMD160=m |
172 | CONFIG_CRYPTO_RMD256=m | 171 | CONFIG_CRYPTO_RMD256=m |
173 | CONFIG_CRYPTO_RMD320=m | 172 | CONFIG_CRYPTO_RMD320=m |
174 | CONFIG_CRYPTO_SHA256=m | 173 | CONFIG_CRYPTO_SHA256=y |
175 | CONFIG_CRYPTO_SHA512=m | 174 | CONFIG_CRYPTO_SHA512=m |
176 | CONFIG_CRYPTO_TGR192=m | 175 | CONFIG_CRYPTO_TGR192=m |
177 | CONFIG_CRYPTO_WP512=m | 176 | CONFIG_CRYPTO_WP512=m |
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index 51d14fe5eb9a..ca1cabb3a96c 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c | |||
@@ -121,6 +121,8 @@ unsigned long __kprobes prepare_ftrace_return(unsigned long parent, | |||
121 | { | 121 | { |
122 | struct ftrace_graph_ent trace; | 122 | struct ftrace_graph_ent trace; |
123 | 123 | ||
124 | if (unlikely(ftrace_graph_is_dead())) | ||
125 | goto out; | ||
124 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | 126 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) |
125 | goto out; | 127 | goto out; |
126 | ip = (ip & PSW_ADDR_INSN) - MCOUNT_INSN_SIZE; | 128 | ip = (ip & PSW_ADDR_INSN) - MCOUNT_INSN_SIZE; |
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c index dd1c24ceda50..3f51cf4e8f02 100644 --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c | |||
@@ -54,12 +54,8 @@ void s390_handle_mcck(void) | |||
54 | */ | 54 | */ |
55 | local_irq_save(flags); | 55 | local_irq_save(flags); |
56 | local_mcck_disable(); | 56 | local_mcck_disable(); |
57 | /* | 57 | mcck = *this_cpu_ptr(&cpu_mcck); |
58 | * Ummm... Does this make sense at all? Copying the percpu struct | 58 | memset(this_cpu_ptr(&cpu_mcck), 0, sizeof(mcck)); |
59 | * and then zapping it one statement later? | ||
60 | */ | ||
61 | memcpy(&mcck, this_cpu_ptr(&cpu_mcck), sizeof(mcck)); | ||
62 | memset(&mcck, 0, sizeof(struct mcck_struct)); | ||
63 | clear_cpu_flag(CIF_MCCK_PENDING); | 59 | clear_cpu_flag(CIF_MCCK_PENDING); |
64 | local_mcck_enable(); | 60 | local_mcck_enable(); |
65 | local_irq_restore(flags); | 61 | local_irq_restore(flags); |
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 08e761318c17..b878f12a9597 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c | |||
@@ -1411,11 +1411,6 @@ static void cpumsf_pmu_del(struct perf_event *event, int flags) | |||
1411 | perf_pmu_enable(event->pmu); | 1411 | perf_pmu_enable(event->pmu); |
1412 | } | 1412 | } |
1413 | 1413 | ||
1414 | static int cpumsf_pmu_event_idx(struct perf_event *event) | ||
1415 | { | ||
1416 | return event->hw.idx; | ||
1417 | } | ||
1418 | |||
1419 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); | 1414 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); |
1420 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); | 1415 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); |
1421 | 1416 | ||
@@ -1458,7 +1453,6 @@ static struct pmu cpumf_sampling = { | |||
1458 | .stop = cpumsf_pmu_stop, | 1453 | .stop = cpumsf_pmu_stop, |
1459 | .read = cpumsf_pmu_read, | 1454 | .read = cpumsf_pmu_read, |
1460 | 1455 | ||
1461 | .event_idx = cpumsf_pmu_event_idx, | ||
1462 | .attr_groups = cpumsf_pmu_attr_groups, | 1456 | .attr_groups = cpumsf_pmu_attr_groups, |
1463 | }; | 1457 | }; |
1464 | 1458 | ||
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S index 48c2206a3956..5eec9afbb5b5 100644 --- a/arch/s390/kernel/vdso32/clock_gettime.S +++ b/arch/s390/kernel/vdso32/clock_gettime.S | |||
@@ -19,6 +19,7 @@ | |||
19 | .type __kernel_clock_gettime,@function | 19 | .type __kernel_clock_gettime,@function |
20 | __kernel_clock_gettime: | 20 | __kernel_clock_gettime: |
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | ahi %r15,-16 | ||
22 | basr %r5,0 | 23 | basr %r5,0 |
23 | 0: al %r5,21f-0b(%r5) /* get &_vdso_data */ | 24 | 0: al %r5,21f-0b(%r5) /* get &_vdso_data */ |
24 | chi %r2,__CLOCK_REALTIME_COARSE | 25 | chi %r2,__CLOCK_REALTIME_COARSE |
@@ -34,8 +35,8 @@ __kernel_clock_gettime: | |||
34 | 1: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 35 | 1: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
35 | tml %r4,0x0001 /* pending update ? loop */ | 36 | tml %r4,0x0001 /* pending update ? loop */ |
36 | jnz 1b | 37 | jnz 1b |
37 | stcke 24(%r15) /* Store TOD clock */ | 38 | stcke 0(%r15) /* Store TOD clock */ |
38 | lm %r0,%r1,25(%r15) | 39 | lm %r0,%r1,1(%r15) |
39 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 40 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
40 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) | 41 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) |
41 | brc 3,2f | 42 | brc 3,2f |
@@ -70,6 +71,7 @@ __kernel_clock_gettime: | |||
70 | 8: st %r2,0(%r3) /* store tp->tv_sec */ | 71 | 8: st %r2,0(%r3) /* store tp->tv_sec */ |
71 | st %r1,4(%r3) /* store tp->tv_nsec */ | 72 | st %r1,4(%r3) /* store tp->tv_nsec */ |
72 | lhi %r2,0 | 73 | lhi %r2,0 |
74 | ahi %r15,16 | ||
73 | br %r14 | 75 | br %r14 |
74 | 76 | ||
75 | /* CLOCK_MONOTONIC_COARSE */ | 77 | /* CLOCK_MONOTONIC_COARSE */ |
@@ -96,8 +98,8 @@ __kernel_clock_gettime: | |||
96 | 11: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 98 | 11: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
97 | tml %r4,0x0001 /* pending update ? loop */ | 99 | tml %r4,0x0001 /* pending update ? loop */ |
98 | jnz 11b | 100 | jnz 11b |
99 | stcke 24(%r15) /* Store TOD clock */ | 101 | stcke 0(%r15) /* Store TOD clock */ |
100 | lm %r0,%r1,25(%r15) | 102 | lm %r0,%r1,1(%r15) |
101 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 103 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
102 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) | 104 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) |
103 | brc 3,12f | 105 | brc 3,12f |
@@ -132,11 +134,13 @@ __kernel_clock_gettime: | |||
132 | 17: st %r2,0(%r3) /* store tp->tv_sec */ | 134 | 17: st %r2,0(%r3) /* store tp->tv_sec */ |
133 | st %r1,4(%r3) /* store tp->tv_nsec */ | 135 | st %r1,4(%r3) /* store tp->tv_nsec */ |
134 | lhi %r2,0 | 136 | lhi %r2,0 |
137 | ahi %r15,16 | ||
135 | br %r14 | 138 | br %r14 |
136 | 139 | ||
137 | /* Fallback to system call */ | 140 | /* Fallback to system call */ |
138 | 19: lhi %r1,__NR_clock_gettime | 141 | 19: lhi %r1,__NR_clock_gettime |
139 | svc 0 | 142 | svc 0 |
143 | ahi %r15,16 | ||
140 | br %r14 | 144 | br %r14 |
141 | 145 | ||
142 | 20: .long 1000000000 | 146 | 20: .long 1000000000 |
diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S index 60def5f562db..719de6186b20 100644 --- a/arch/s390/kernel/vdso32/gettimeofday.S +++ b/arch/s390/kernel/vdso32/gettimeofday.S | |||
@@ -19,6 +19,7 @@ | |||
19 | .type __kernel_gettimeofday,@function | 19 | .type __kernel_gettimeofday,@function |
20 | __kernel_gettimeofday: | 20 | __kernel_gettimeofday: |
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | ahi %r15,-16 | ||
22 | basr %r5,0 | 23 | basr %r5,0 |
23 | 0: al %r5,13f-0b(%r5) /* get &_vdso_data */ | 24 | 0: al %r5,13f-0b(%r5) /* get &_vdso_data */ |
24 | 1: ltr %r3,%r3 /* check if tz is NULL */ | 25 | 1: ltr %r3,%r3 /* check if tz is NULL */ |
@@ -29,30 +30,30 @@ __kernel_gettimeofday: | |||
29 | l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 30 | l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
30 | tml %r4,0x0001 /* pending update ? loop */ | 31 | tml %r4,0x0001 /* pending update ? loop */ |
31 | jnz 1b | 32 | jnz 1b |
32 | stcke 24(%r15) /* Store TOD clock */ | 33 | stcke 0(%r15) /* Store TOD clock */ |
33 | lm %r0,%r1,25(%r15) | 34 | lm %r0,%r1,1(%r15) |
34 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 35 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
35 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) | 36 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) |
36 | brc 3,3f | 37 | brc 3,3f |
37 | ahi %r0,-1 | 38 | ahi %r0,-1 |
38 | 3: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */ | 39 | 3: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
39 | st %r0,24(%r15) | 40 | st %r0,0(%r15) |
40 | l %r0,__VDSO_TK_MULT(%r5) | 41 | l %r0,__VDSO_TK_MULT(%r5) |
41 | ltr %r1,%r1 | 42 | ltr %r1,%r1 |
42 | mr %r0,%r0 | 43 | mr %r0,%r0 |
43 | jnm 4f | 44 | jnm 4f |
44 | a %r0,__VDSO_TK_MULT(%r5) | 45 | a %r0,__VDSO_TK_MULT(%r5) |
45 | 4: al %r0,24(%r15) | 46 | 4: al %r0,0(%r15) |
46 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ | 47 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ |
47 | al %r1,__VDSO_XTIME_NSEC+4(%r5) | 48 | al %r1,__VDSO_XTIME_NSEC+4(%r5) |
48 | brc 12,5f | 49 | brc 12,5f |
49 | ahi %r0,1 | 50 | ahi %r0,1 |
50 | 5: mvc 24(4,%r15),__VDSO_XTIME_SEC+4(%r5) | 51 | 5: mvc 0(4,%r15),__VDSO_XTIME_SEC+4(%r5) |
51 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ | 52 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ |
52 | jne 1b | 53 | jne 1b |
53 | l %r4,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | 54 | l %r4,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
54 | srdl %r0,0(%r4) /* >> tk->shift */ | 55 | srdl %r0,0(%r4) /* >> tk->shift */ |
55 | l %r4,24(%r15) /* get tv_sec from stack */ | 56 | l %r4,0(%r15) /* get tv_sec from stack */ |
56 | basr %r5,0 | 57 | basr %r5,0 |
57 | 6: ltr %r0,%r0 | 58 | 6: ltr %r0,%r0 |
58 | jnz 7f | 59 | jnz 7f |
@@ -71,6 +72,7 @@ __kernel_gettimeofday: | |||
71 | 9: srl %r0,6 | 72 | 9: srl %r0,6 |
72 | st %r0,4(%r2) /* store tv->tv_usec */ | 73 | st %r0,4(%r2) /* store tv->tv_usec */ |
73 | 10: slr %r2,%r2 | 74 | 10: slr %r2,%r2 |
75 | ahi %r15,16 | ||
74 | br %r14 | 76 | br %r14 |
75 | 11: .long 1000000000 | 77 | 11: .long 1000000000 |
76 | 12: .long 274877907 | 78 | 12: .long 274877907 |
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S index 9d9761f8e110..7699e735ae28 100644 --- a/arch/s390/kernel/vdso64/clock_gettime.S +++ b/arch/s390/kernel/vdso64/clock_gettime.S | |||
@@ -19,6 +19,7 @@ | |||
19 | .type __kernel_clock_gettime,@function | 19 | .type __kernel_clock_gettime,@function |
20 | __kernel_clock_gettime: | 20 | __kernel_clock_gettime: |
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | aghi %r15,-16 | ||
22 | larl %r5,_vdso_data | 23 | larl %r5,_vdso_data |
23 | cghi %r2,__CLOCK_REALTIME_COARSE | 24 | cghi %r2,__CLOCK_REALTIME_COARSE |
24 | je 4f | 25 | je 4f |
@@ -37,10 +38,10 @@ __kernel_clock_gettime: | |||
37 | 0: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 38 | 0: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
38 | tmll %r4,0x0001 /* pending update ? loop */ | 39 | tmll %r4,0x0001 /* pending update ? loop */ |
39 | jnz 0b | 40 | jnz 0b |
40 | stcke 48(%r15) /* Store TOD clock */ | 41 | stcke 0(%r15) /* Store TOD clock */ |
41 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | 42 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
42 | lg %r0,__VDSO_WTOM_SEC(%r5) | 43 | lg %r0,__VDSO_WTOM_SEC(%r5) |
43 | lg %r1,49(%r15) | 44 | lg %r1,1(%r15) |
44 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 45 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
45 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ | 46 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
46 | alg %r1,__VDSO_WTOM_NSEC(%r5) | 47 | alg %r1,__VDSO_WTOM_NSEC(%r5) |
@@ -56,6 +57,7 @@ __kernel_clock_gettime: | |||
56 | 2: stg %r0,0(%r3) /* store tp->tv_sec */ | 57 | 2: stg %r0,0(%r3) /* store tp->tv_sec */ |
57 | stg %r1,8(%r3) /* store tp->tv_nsec */ | 58 | stg %r1,8(%r3) /* store tp->tv_nsec */ |
58 | lghi %r2,0 | 59 | lghi %r2,0 |
60 | aghi %r15,16 | ||
59 | br %r14 | 61 | br %r14 |
60 | 62 | ||
61 | /* CLOCK_MONOTONIC_COARSE */ | 63 | /* CLOCK_MONOTONIC_COARSE */ |
@@ -82,9 +84,9 @@ __kernel_clock_gettime: | |||
82 | 5: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 84 | 5: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
83 | tmll %r4,0x0001 /* pending update ? loop */ | 85 | tmll %r4,0x0001 /* pending update ? loop */ |
84 | jnz 5b | 86 | jnz 5b |
85 | stcke 48(%r15) /* Store TOD clock */ | 87 | stcke 0(%r15) /* Store TOD clock */ |
86 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | 88 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
87 | lg %r1,49(%r15) | 89 | lg %r1,1(%r15) |
88 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 90 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
89 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ | 91 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
90 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ | 92 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ |
@@ -101,6 +103,7 @@ __kernel_clock_gettime: | |||
101 | 7: stg %r0,0(%r3) /* store tp->tv_sec */ | 103 | 7: stg %r0,0(%r3) /* store tp->tv_sec */ |
102 | stg %r1,8(%r3) /* store tp->tv_nsec */ | 104 | stg %r1,8(%r3) /* store tp->tv_nsec */ |
103 | lghi %r2,0 | 105 | lghi %r2,0 |
106 | aghi %r15,16 | ||
104 | br %r14 | 107 | br %r14 |
105 | 108 | ||
106 | /* CLOCK_THREAD_CPUTIME_ID for this thread */ | 109 | /* CLOCK_THREAD_CPUTIME_ID for this thread */ |
@@ -134,11 +137,13 @@ __kernel_clock_gettime: | |||
134 | slgr %r4,%r0 /* r4 = tv_nsec */ | 137 | slgr %r4,%r0 /* r4 = tv_nsec */ |
135 | stg %r4,8(%r3) | 138 | stg %r4,8(%r3) |
136 | lghi %r2,0 | 139 | lghi %r2,0 |
140 | aghi %r15,16 | ||
137 | br %r14 | 141 | br %r14 |
138 | 142 | ||
139 | /* Fallback to system call */ | 143 | /* Fallback to system call */ |
140 | 12: lghi %r1,__NR_clock_gettime | 144 | 12: lghi %r1,__NR_clock_gettime |
141 | svc 0 | 145 | svc 0 |
146 | aghi %r15,16 | ||
142 | br %r14 | 147 | br %r14 |
143 | 148 | ||
144 | 13: .quad 1000000000 | 149 | 13: .quad 1000000000 |
diff --git a/arch/s390/kernel/vdso64/gettimeofday.S b/arch/s390/kernel/vdso64/gettimeofday.S index 7a344995a97f..6ce46707663c 100644 --- a/arch/s390/kernel/vdso64/gettimeofday.S +++ b/arch/s390/kernel/vdso64/gettimeofday.S | |||
@@ -19,6 +19,7 @@ | |||
19 | .type __kernel_gettimeofday,@function | 19 | .type __kernel_gettimeofday,@function |
20 | __kernel_gettimeofday: | 20 | __kernel_gettimeofday: |
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | aghi %r15,-16 | ||
22 | larl %r5,_vdso_data | 23 | larl %r5,_vdso_data |
23 | 0: ltgr %r3,%r3 /* check if tz is NULL */ | 24 | 0: ltgr %r3,%r3 /* check if tz is NULL */ |
24 | je 1f | 25 | je 1f |
@@ -28,8 +29,8 @@ __kernel_gettimeofday: | |||
28 | lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 29 | lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
29 | tmll %r4,0x0001 /* pending update ? loop */ | 30 | tmll %r4,0x0001 /* pending update ? loop */ |
30 | jnz 0b | 31 | jnz 0b |
31 | stcke 48(%r15) /* Store TOD clock */ | 32 | stcke 0(%r15) /* Store TOD clock */ |
32 | lg %r1,49(%r15) | 33 | lg %r1,1(%r15) |
33 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 34 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
34 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ | 35 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
35 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ | 36 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ |
@@ -50,6 +51,7 @@ __kernel_gettimeofday: | |||
50 | srlg %r0,%r0,6 | 51 | srlg %r0,%r0,6 |
51 | stg %r0,8(%r2) /* store tv->tv_usec */ | 52 | stg %r0,8(%r2) /* store tv->tv_usec */ |
52 | 4: lghi %r2,0 | 53 | 4: lghi %r2,0 |
54 | aghi %r15,16 | ||
53 | br %r14 | 55 | br %r14 |
54 | 5: .quad 1000000000 | 56 | 5: .quad 1000000000 |
55 | .long 274877907 | 57 | .long 274877907 |
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 416f2a323ba5..7f0089d9a4aa 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -66,7 +66,11 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset) | |||
66 | clock = S390_lowcore.last_update_clock; | 66 | clock = S390_lowcore.last_update_clock; |
67 | asm volatile( | 67 | asm volatile( |
68 | " stpt %0\n" /* Store current cpu timer value */ | 68 | " stpt %0\n" /* Store current cpu timer value */ |
69 | #ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES | ||
70 | " stckf %1" /* Store current tod clock value */ | ||
71 | #else | ||
69 | " stck %1" /* Store current tod clock value */ | 72 | " stck %1" /* Store current tod clock value */ |
73 | #endif | ||
70 | : "=m" (S390_lowcore.last_update_timer), | 74 | : "=m" (S390_lowcore.last_update_timer), |
71 | "=m" (S390_lowcore.last_update_clock)); | 75 | "=m" (S390_lowcore.last_update_clock)); |
72 | S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; | 76 | S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c index 9139d14b9c53..538c10db3537 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c | |||
@@ -118,7 +118,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
118 | }; | 118 | }; |
119 | 119 | ||
120 | static struct resource scif0_resources[] = { | 120 | static struct resource scif0_resources[] = { |
121 | DEFINE_RES_MEM(0xfffffe80, 0x100), | 121 | DEFINE_RES_MEM(0xfffffe80, 0x10), |
122 | DEFINE_RES_IRQ(evt2irq(0x4e0)), | 122 | DEFINE_RES_IRQ(evt2irq(0x4e0)), |
123 | }; | 123 | }; |
124 | 124 | ||
@@ -143,7 +143,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
143 | }; | 143 | }; |
144 | 144 | ||
145 | static struct resource scif1_resources[] = { | 145 | static struct resource scif1_resources[] = { |
146 | DEFINE_RES_MEM(0xa4000150, 0x100), | 146 | DEFINE_RES_MEM(0xa4000150, 0x10), |
147 | DEFINE_RES_IRQ(evt2irq(0x900)), | 147 | DEFINE_RES_IRQ(evt2irq(0x900)), |
148 | }; | 148 | }; |
149 | 149 | ||
@@ -169,7 +169,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
169 | }; | 169 | }; |
170 | 170 | ||
171 | static struct resource scif2_resources[] = { | 171 | static struct resource scif2_resources[] = { |
172 | DEFINE_RES_MEM(0xa4000140, 0x100), | 172 | DEFINE_RES_MEM(0xa4000140, 0x10), |
173 | DEFINE_RES_IRQ(evt2irq(0x880)), | 173 | DEFINE_RES_IRQ(evt2irq(0x880)), |
174 | }; | 174 | }; |
175 | 175 | ||
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index 765c1776ec9f..0e69b7e7a439 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | int atomic_add_return(int, atomic_t *); | 23 | int atomic_add_return(int, atomic_t *); |
24 | int atomic_cmpxchg(atomic_t *, int, int); | 24 | int atomic_cmpxchg(atomic_t *, int, int); |
25 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | 25 | int atomic_xchg(atomic_t *, int); |
26 | int __atomic_add_unless(atomic_t *, int, int); | 26 | int __atomic_add_unless(atomic_t *, int, int); |
27 | void atomic_set(atomic_t *, int); | 27 | void atomic_set(atomic_t *, int); |
28 | 28 | ||
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h index 32c29a133f9d..d38b52dca216 100644 --- a/arch/sparc/include/asm/cmpxchg_32.h +++ b/arch/sparc/include/asm/cmpxchg_32.h | |||
@@ -11,22 +11,14 @@ | |||
11 | #ifndef __ARCH_SPARC_CMPXCHG__ | 11 | #ifndef __ARCH_SPARC_CMPXCHG__ |
12 | #define __ARCH_SPARC_CMPXCHG__ | 12 | #define __ARCH_SPARC_CMPXCHG__ |
13 | 13 | ||
14 | static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) | 14 | unsigned long __xchg_u32(volatile u32 *m, u32 new); |
15 | { | ||
16 | __asm__ __volatile__("swap [%2], %0" | ||
17 | : "=&r" (val) | ||
18 | : "0" (val), "r" (m) | ||
19 | : "memory"); | ||
20 | return val; | ||
21 | } | ||
22 | |||
23 | void __xchg_called_with_bad_pointer(void); | 15 | void __xchg_called_with_bad_pointer(void); |
24 | 16 | ||
25 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) | 17 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) |
26 | { | 18 | { |
27 | switch (size) { | 19 | switch (size) { |
28 | case 4: | 20 | case 4: |
29 | return xchg_u32(ptr, x); | 21 | return __xchg_u32(ptr, x); |
30 | } | 22 | } |
31 | __xchg_called_with_bad_pointer(); | 23 | __xchg_called_with_bad_pointer(); |
32 | return x; | 24 | return x; |
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 5b1b52a04ad6..7e064c68c5ec 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h | |||
@@ -12,6 +12,14 @@ int dma_supported(struct device *dev, u64 mask); | |||
12 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 12 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
13 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | 13 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
14 | 14 | ||
15 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | ||
16 | enum dma_data_direction dir) | ||
17 | { | ||
18 | /* Since dma_{alloc,free}_noncoherent() allocated coherent memory, this | ||
19 | * routine can be a nop. | ||
20 | */ | ||
21 | } | ||
22 | |||
15 | extern struct dma_map_ops *dma_ops; | 23 | extern struct dma_map_ops *dma_ops; |
16 | extern struct dma_map_ops *leon_dma_ops; | 24 | extern struct dma_map_ops *leon_dma_ops; |
17 | extern struct dma_map_ops pci32_dma_ops; | 25 | extern struct dma_map_ops pci32_dma_ops; |
diff --git a/arch/sparc/include/uapi/asm/swab.h b/arch/sparc/include/uapi/asm/swab.h index a34ad079487e..4c7c12d69bea 100644 --- a/arch/sparc/include/uapi/asm/swab.h +++ b/arch/sparc/include/uapi/asm/swab.h | |||
@@ -9,9 +9,9 @@ static inline __u16 __arch_swab16p(const __u16 *addr) | |||
9 | { | 9 | { |
10 | __u16 ret; | 10 | __u16 ret; |
11 | 11 | ||
12 | __asm__ __volatile__ ("lduha [%1] %2, %0" | 12 | __asm__ __volatile__ ("lduha [%2] %3, %0" |
13 | : "=r" (ret) | 13 | : "=r" (ret) |
14 | : "r" (addr), "i" (ASI_PL)); | 14 | : "m" (*addr), "r" (addr), "i" (ASI_PL)); |
15 | return ret; | 15 | return ret; |
16 | } | 16 | } |
17 | #define __arch_swab16p __arch_swab16p | 17 | #define __arch_swab16p __arch_swab16p |
@@ -20,9 +20,9 @@ static inline __u32 __arch_swab32p(const __u32 *addr) | |||
20 | { | 20 | { |
21 | __u32 ret; | 21 | __u32 ret; |
22 | 22 | ||
23 | __asm__ __volatile__ ("lduwa [%1] %2, %0" | 23 | __asm__ __volatile__ ("lduwa [%2] %3, %0" |
24 | : "=r" (ret) | 24 | : "=r" (ret) |
25 | : "r" (addr), "i" (ASI_PL)); | 25 | : "m" (*addr), "r" (addr), "i" (ASI_PL)); |
26 | return ret; | 26 | return ret; |
27 | } | 27 | } |
28 | #define __arch_swab32p __arch_swab32p | 28 | #define __arch_swab32p __arch_swab32p |
@@ -31,9 +31,9 @@ static inline __u64 __arch_swab64p(const __u64 *addr) | |||
31 | { | 31 | { |
32 | __u64 ret; | 32 | __u64 ret; |
33 | 33 | ||
34 | __asm__ __volatile__ ("ldxa [%1] %2, %0" | 34 | __asm__ __volatile__ ("ldxa [%2] %3, %0" |
35 | : "=r" (ret) | 35 | : "=r" (ret) |
36 | : "r" (addr), "i" (ASI_PL)); | 36 | : "m" (*addr), "r" (addr), "i" (ASI_PL)); |
37 | return ret; | 37 | return ret; |
38 | } | 38 | } |
39 | #define __arch_swab64p __arch_swab64p | 39 | #define __arch_swab64p __arch_swab64p |
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h index c842a89b1190..46d83842eddc 100644 --- a/arch/sparc/include/uapi/asm/unistd.h +++ b/arch/sparc/include/uapi/asm/unistd.h | |||
@@ -414,8 +414,9 @@ | |||
414 | #define __NR_seccomp 346 | 414 | #define __NR_seccomp 346 |
415 | #define __NR_getrandom 347 | 415 | #define __NR_getrandom 347 |
416 | #define __NR_memfd_create 348 | 416 | #define __NR_memfd_create 348 |
417 | #define __NR_bpf 349 | ||
417 | 418 | ||
418 | #define NR_syscalls 349 | 419 | #define NR_syscalls 350 |
419 | 420 | ||
420 | /* Bitmask values returned from kern_features system call. */ | 421 | /* Bitmask values returned from kern_features system call. */ |
421 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 | 422 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 |
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c index 8f76f23dac38..f9c6813c132d 100644 --- a/arch/sparc/kernel/pci_schizo.c +++ b/arch/sparc/kernel/pci_schizo.c | |||
@@ -581,7 +581,7 @@ static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) | |||
581 | { | 581 | { |
582 | unsigned long csr_reg, csr, csr_error_bits; | 582 | unsigned long csr_reg, csr, csr_error_bits; |
583 | irqreturn_t ret = IRQ_NONE; | 583 | irqreturn_t ret = IRQ_NONE; |
584 | u16 stat; | 584 | u32 stat; |
585 | 585 | ||
586 | csr_reg = pbm->pbm_regs + SCHIZO_PCI_CTRL; | 586 | csr_reg = pbm->pbm_regs + SCHIZO_PCI_CTRL; |
587 | csr = upa_readq(csr_reg); | 587 | csr = upa_readq(csr_reg); |
@@ -617,7 +617,7 @@ static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) | |||
617 | pbm->name); | 617 | pbm->name); |
618 | ret = IRQ_HANDLED; | 618 | ret = IRQ_HANDLED; |
619 | } | 619 | } |
620 | pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat); | 620 | pbm->pci_ops->read(pbm->pci_bus, 0, PCI_STATUS, 2, &stat); |
621 | if (stat & (PCI_STATUS_PARITY | | 621 | if (stat & (PCI_STATUS_PARITY | |
622 | PCI_STATUS_SIG_TARGET_ABORT | | 622 | PCI_STATUS_SIG_TARGET_ABORT | |
623 | PCI_STATUS_REC_TARGET_ABORT | | 623 | PCI_STATUS_REC_TARGET_ABORT | |
@@ -625,7 +625,7 @@ static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) | |||
625 | PCI_STATUS_SIG_SYSTEM_ERROR)) { | 625 | PCI_STATUS_SIG_SYSTEM_ERROR)) { |
626 | printk("%s: PCI bus error, PCI_STATUS[%04x]\n", | 626 | printk("%s: PCI bus error, PCI_STATUS[%04x]\n", |
627 | pbm->name, stat); | 627 | pbm->name, stat); |
628 | pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff); | 628 | pbm->pci_ops->write(pbm->pci_bus, 0, PCI_STATUS, 2, 0xffff); |
629 | ret = IRQ_HANDLED; | 629 | ret = IRQ_HANDLED; |
630 | } | 630 | } |
631 | return ret; | 631 | return ret; |
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 302c476413d5..da6f1a7fc4db 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -816,13 +816,17 @@ void arch_send_call_function_single_ipi(int cpu) | |||
816 | void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs) | 816 | void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs) |
817 | { | 817 | { |
818 | clear_softint(1 << irq); | 818 | clear_softint(1 << irq); |
819 | irq_enter(); | ||
819 | generic_smp_call_function_interrupt(); | 820 | generic_smp_call_function_interrupt(); |
821 | irq_exit(); | ||
820 | } | 822 | } |
821 | 823 | ||
822 | void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs) | 824 | void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs) |
823 | { | 825 | { |
824 | clear_softint(1 << irq); | 826 | clear_softint(1 << irq); |
827 | irq_enter(); | ||
825 | generic_smp_call_function_single_interrupt(); | 828 | generic_smp_call_function_single_interrupt(); |
829 | irq_exit(); | ||
826 | } | 830 | } |
827 | 831 | ||
828 | static void tsb_sync(void *info) | 832 | static void tsb_sync(void *info) |
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index 6a873c344bc0..ad0cdf497b78 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S | |||
@@ -86,4 +86,4 @@ sys_call_table: | |||
86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
89 | /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create | 89 | /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf |
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index d9151b6490d8..580cde9370c9 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S | |||
@@ -87,7 +87,7 @@ sys_call_table32: | |||
87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime | 87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime |
88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev | 88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev |
89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
90 | .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create | 90 | .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf |
91 | 91 | ||
92 | #endif /* CONFIG_COMPAT */ | 92 | #endif /* CONFIG_COMPAT */ |
93 | 93 | ||
@@ -166,4 +166,4 @@ sys_call_table: | |||
166 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 166 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
167 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 167 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
168 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 168 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
169 | .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create | 169 | .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf |
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index a7c418ac26af..71cd65ab200c 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c | |||
@@ -45,6 +45,19 @@ ATOMIC_OP(add, +=) | |||
45 | 45 | ||
46 | #undef ATOMIC_OP | 46 | #undef ATOMIC_OP |
47 | 47 | ||
48 | int atomic_xchg(atomic_t *v, int new) | ||
49 | { | ||
50 | int ret; | ||
51 | unsigned long flags; | ||
52 | |||
53 | spin_lock_irqsave(ATOMIC_HASH(v), flags); | ||
54 | ret = v->counter; | ||
55 | v->counter = new; | ||
56 | spin_unlock_irqrestore(ATOMIC_HASH(v), flags); | ||
57 | return ret; | ||
58 | } | ||
59 | EXPORT_SYMBOL(atomic_xchg); | ||
60 | |||
48 | int atomic_cmpxchg(atomic_t *v, int old, int new) | 61 | int atomic_cmpxchg(atomic_t *v, int old, int new) |
49 | { | 62 | { |
50 | int ret; | 63 | int ret; |
@@ -137,3 +150,17 @@ unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new) | |||
137 | return (unsigned long)prev; | 150 | return (unsigned long)prev; |
138 | } | 151 | } |
139 | EXPORT_SYMBOL(__cmpxchg_u32); | 152 | EXPORT_SYMBOL(__cmpxchg_u32); |
153 | |||
154 | unsigned long __xchg_u32(volatile u32 *ptr, u32 new) | ||
155 | { | ||
156 | unsigned long flags; | ||
157 | u32 prev; | ||
158 | |||
159 | spin_lock_irqsave(ATOMIC_HASH(ptr), flags); | ||
160 | prev = *ptr; | ||
161 | *ptr = new; | ||
162 | spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags); | ||
163 | |||
164 | return (unsigned long)prev; | ||
165 | } | ||
166 | EXPORT_SYMBOL(__xchg_u32); | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f2327e88e07c..41a503c15862 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -142,6 +142,10 @@ config INSTRUCTION_DECODER | |||
142 | def_bool y | 142 | def_bool y |
143 | depends on KPROBES || PERF_EVENTS || UPROBES | 143 | depends on KPROBES || PERF_EVENTS || UPROBES |
144 | 144 | ||
145 | config PERF_EVENTS_INTEL_UNCORE | ||
146 | def_bool y | ||
147 | depends on PERF_EVENTS && CPU_SUP_INTEL && PCI | ||
148 | |||
145 | config OUTPUT_FORMAT | 149 | config OUTPUT_FORMAT |
146 | string | 150 | string |
147 | default "elf32-i386" if X86_32 | 151 | default "elf32-i386" if X86_32 |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 704f58aa79cd..45abc363dd3e 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -76,8 +76,10 @@ suffix-$(CONFIG_KERNEL_XZ) := xz | |||
76 | suffix-$(CONFIG_KERNEL_LZO) := lzo | 76 | suffix-$(CONFIG_KERNEL_LZO) := lzo |
77 | suffix-$(CONFIG_KERNEL_LZ4) := lz4 | 77 | suffix-$(CONFIG_KERNEL_LZ4) := lz4 |
78 | 78 | ||
79 | RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \ | ||
80 | perl $(srctree)/arch/x86/tools/calc_run_size.pl) | ||
79 | quiet_cmd_mkpiggy = MKPIGGY $@ | 81 | quiet_cmd_mkpiggy = MKPIGGY $@ |
80 | cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) | 82 | cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) |
81 | 83 | ||
82 | targets += piggy.S | 84 | targets += piggy.S |
83 | $(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE | 85 | $(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE |
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S index cbed1407a5cd..1d7fbbcc196d 100644 --- a/arch/x86/boot/compressed/head_32.S +++ b/arch/x86/boot/compressed/head_32.S | |||
@@ -207,7 +207,8 @@ relocated: | |||
207 | * Do the decompression, and jump to the new kernel.. | 207 | * Do the decompression, and jump to the new kernel.. |
208 | */ | 208 | */ |
209 | /* push arguments for decompress_kernel: */ | 209 | /* push arguments for decompress_kernel: */ |
210 | pushl $z_output_len /* decompressed length */ | 210 | pushl $z_run_size /* size of kernel with .bss and .brk */ |
211 | pushl $z_output_len /* decompressed length, end of relocs */ | ||
211 | leal z_extract_offset_negative(%ebx), %ebp | 212 | leal z_extract_offset_negative(%ebx), %ebp |
212 | pushl %ebp /* output address */ | 213 | pushl %ebp /* output address */ |
213 | pushl $z_input_len /* input_len */ | 214 | pushl $z_input_len /* input_len */ |
@@ -217,7 +218,7 @@ relocated: | |||
217 | pushl %eax /* heap area */ | 218 | pushl %eax /* heap area */ |
218 | pushl %esi /* real mode pointer */ | 219 | pushl %esi /* real mode pointer */ |
219 | call decompress_kernel /* returns kernel location in %eax */ | 220 | call decompress_kernel /* returns kernel location in %eax */ |
220 | addl $24, %esp | 221 | addl $28, %esp |
221 | 222 | ||
222 | /* | 223 | /* |
223 | * Jump to the decompressed kernel. | 224 | * Jump to the decompressed kernel. |
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 2884e0c3e8a5..6b1766c6c082 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
@@ -402,13 +402,16 @@ relocated: | |||
402 | * Do the decompression, and jump to the new kernel.. | 402 | * Do the decompression, and jump to the new kernel.. |
403 | */ | 403 | */ |
404 | pushq %rsi /* Save the real mode argument */ | 404 | pushq %rsi /* Save the real mode argument */ |
405 | movq $z_run_size, %r9 /* size of kernel with .bss and .brk */ | ||
406 | pushq %r9 | ||
405 | movq %rsi, %rdi /* real mode address */ | 407 | movq %rsi, %rdi /* real mode address */ |
406 | leaq boot_heap(%rip), %rsi /* malloc area for uncompression */ | 408 | leaq boot_heap(%rip), %rsi /* malloc area for uncompression */ |
407 | leaq input_data(%rip), %rdx /* input_data */ | 409 | leaq input_data(%rip), %rdx /* input_data */ |
408 | movl $z_input_len, %ecx /* input_len */ | 410 | movl $z_input_len, %ecx /* input_len */ |
409 | movq %rbp, %r8 /* output target address */ | 411 | movq %rbp, %r8 /* output target address */ |
410 | movq $z_output_len, %r9 /* decompressed length */ | 412 | movq $z_output_len, %r9 /* decompressed length, end of relocs */ |
411 | call decompress_kernel /* returns kernel location in %rax */ | 413 | call decompress_kernel /* returns kernel location in %rax */ |
414 | popq %r9 | ||
412 | popq %rsi | 415 | popq %rsi |
413 | 416 | ||
414 | /* | 417 | /* |
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 57ab74df7eea..30dd59a9f0b4 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
@@ -358,7 +358,8 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap, | |||
358 | unsigned char *input_data, | 358 | unsigned char *input_data, |
359 | unsigned long input_len, | 359 | unsigned long input_len, |
360 | unsigned char *output, | 360 | unsigned char *output, |
361 | unsigned long output_len) | 361 | unsigned long output_len, |
362 | unsigned long run_size) | ||
362 | { | 363 | { |
363 | real_mode = rmode; | 364 | real_mode = rmode; |
364 | 365 | ||
@@ -381,8 +382,14 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap, | |||
381 | free_mem_ptr = heap; /* Heap */ | 382 | free_mem_ptr = heap; /* Heap */ |
382 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; | 383 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; |
383 | 384 | ||
384 | output = choose_kernel_location(input_data, input_len, | 385 | /* |
385 | output, output_len); | 386 | * The memory hole needed for the kernel is the larger of either |
387 | * the entire decompressed kernel plus relocation table, or the | ||
388 | * entire decompressed kernel plus .bss and .brk sections. | ||
389 | */ | ||
390 | output = choose_kernel_location(input_data, input_len, output, | ||
391 | output_len > run_size ? output_len | ||
392 | : run_size); | ||
386 | 393 | ||
387 | /* Validate memory location choices. */ | 394 | /* Validate memory location choices. */ |
388 | if ((unsigned long)output & (MIN_KERNEL_ALIGN - 1)) | 395 | if ((unsigned long)output & (MIN_KERNEL_ALIGN - 1)) |
diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c index b669ab65bf6c..d8222f213182 100644 --- a/arch/x86/boot/compressed/mkpiggy.c +++ b/arch/x86/boot/compressed/mkpiggy.c | |||
@@ -36,11 +36,13 @@ int main(int argc, char *argv[]) | |||
36 | uint32_t olen; | 36 | uint32_t olen; |
37 | long ilen; | 37 | long ilen; |
38 | unsigned long offs; | 38 | unsigned long offs; |
39 | unsigned long run_size; | ||
39 | FILE *f = NULL; | 40 | FILE *f = NULL; |
40 | int retval = 1; | 41 | int retval = 1; |
41 | 42 | ||
42 | if (argc < 2) { | 43 | if (argc < 3) { |
43 | fprintf(stderr, "Usage: %s compressed_file\n", argv[0]); | 44 | fprintf(stderr, "Usage: %s compressed_file run_size\n", |
45 | argv[0]); | ||
44 | goto bail; | 46 | goto bail; |
45 | } | 47 | } |
46 | 48 | ||
@@ -74,6 +76,7 @@ int main(int argc, char *argv[]) | |||
74 | offs += olen >> 12; /* Add 8 bytes for each 32K block */ | 76 | offs += olen >> 12; /* Add 8 bytes for each 32K block */ |
75 | offs += 64*1024 + 128; /* Add 64K + 128 bytes slack */ | 77 | offs += 64*1024 + 128; /* Add 64K + 128 bytes slack */ |
76 | offs = (offs+4095) & ~4095; /* Round to a 4K boundary */ | 78 | offs = (offs+4095) & ~4095; /* Round to a 4K boundary */ |
79 | run_size = atoi(argv[2]); | ||
77 | 80 | ||
78 | printf(".section \".rodata..compressed\",\"a\",@progbits\n"); | 81 | printf(".section \".rodata..compressed\",\"a\",@progbits\n"); |
79 | printf(".globl z_input_len\n"); | 82 | printf(".globl z_input_len\n"); |
@@ -85,6 +88,8 @@ int main(int argc, char *argv[]) | |||
85 | /* z_extract_offset_negative allows simplification of head_32.S */ | 88 | /* z_extract_offset_negative allows simplification of head_32.S */ |
86 | printf(".globl z_extract_offset_negative\n"); | 89 | printf(".globl z_extract_offset_negative\n"); |
87 | printf("z_extract_offset_negative = -0x%lx\n", offs); | 90 | printf("z_extract_offset_negative = -0x%lx\n", offs); |
91 | printf(".globl z_run_size\n"); | ||
92 | printf("z_run_size = %lu\n", run_size); | ||
88 | 93 | ||
89 | printf(".globl input_data, input_data_end\n"); | 94 | printf(".globl input_data, input_data_end\n"); |
90 | printf("input_data:\n"); | 95 | printf("input_data:\n"); |
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 8ffba18395c8..ffe71228fc10 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -157,7 +157,7 @@ ENTRY(ia32_sysenter_target) | |||
157 | * ourselves. To save a few cycles, we can check whether | 157 | * ourselves. To save a few cycles, we can check whether |
158 | * NT was set instead of doing an unconditional popfq. | 158 | * NT was set instead of doing an unconditional popfq. |
159 | */ | 159 | */ |
160 | testl $X86_EFLAGS_NT,EFLAGS(%rsp) /* saved EFLAGS match cpu */ | 160 | testl $X86_EFLAGS_NT,EFLAGS-ARGOFFSET(%rsp) |
161 | jnz sysenter_fix_flags | 161 | jnz sysenter_fix_flags |
162 | sysenter_flags_fixed: | 162 | sysenter_flags_fixed: |
163 | 163 | ||
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index f48b17df4224..3a52ee0e726d 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #define THREAD_SIZE_ORDER 1 | 20 | #define THREAD_SIZE_ORDER 1 |
21 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) | 21 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) |
22 | 22 | ||
23 | #define STACKFAULT_STACK 0 | ||
24 | #define DOUBLEFAULT_STACK 1 | 23 | #define DOUBLEFAULT_STACK 1 |
25 | #define NMI_STACK 0 | 24 | #define NMI_STACK 0 |
26 | #define DEBUG_STACK 0 | 25 | #define DEBUG_STACK 0 |
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h index 678205195ae1..75450b2c7be4 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h | |||
@@ -14,12 +14,11 @@ | |||
14 | #define IRQ_STACK_ORDER 2 | 14 | #define IRQ_STACK_ORDER 2 |
15 | #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) | 15 | #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) |
16 | 16 | ||
17 | #define STACKFAULT_STACK 1 | 17 | #define DOUBLEFAULT_STACK 1 |
18 | #define DOUBLEFAULT_STACK 2 | 18 | #define NMI_STACK 2 |
19 | #define NMI_STACK 3 | 19 | #define DEBUG_STACK 3 |
20 | #define DEBUG_STACK 4 | 20 | #define MCE_STACK 4 |
21 | #define MCE_STACK 5 | 21 | #define N_EXCEPTION_STACKS 4 /* hw limit: 7 */ |
22 | #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ | ||
23 | 22 | ||
24 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) | 23 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) |
25 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) | 24 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) |
diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h index 7024c12f7bfe..400873450e33 100644 --- a/arch/x86/include/asm/preempt.h +++ b/arch/x86/include/asm/preempt.h | |||
@@ -105,6 +105,7 @@ static __always_inline bool should_resched(void) | |||
105 | # ifdef CONFIG_CONTEXT_TRACKING | 105 | # ifdef CONFIG_CONTEXT_TRACKING |
106 | extern asmlinkage void ___preempt_schedule_context(void); | 106 | extern asmlinkage void ___preempt_schedule_context(void); |
107 | # define __preempt_schedule_context() asm ("call ___preempt_schedule_context") | 107 | # define __preempt_schedule_context() asm ("call ___preempt_schedule_context") |
108 | extern asmlinkage void preempt_schedule_context(void); | ||
108 | # endif | 109 | # endif |
109 | #endif | 110 | #endif |
110 | 111 | ||
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 8cd27e08e23c..8cd1cc3bc835 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -150,6 +150,7 @@ static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask) | |||
150 | } | 150 | } |
151 | 151 | ||
152 | void cpu_disable_common(void); | 152 | void cpu_disable_common(void); |
153 | void cpu_die_common(unsigned int cpu); | ||
153 | void native_smp_prepare_boot_cpu(void); | 154 | void native_smp_prepare_boot_cpu(void); |
154 | void native_smp_prepare_cpus(unsigned int max_cpus); | 155 | void native_smp_prepare_cpus(unsigned int max_cpus); |
155 | void native_smp_cpus_done(unsigned int max_cpus); | 156 | void native_smp_cpus_done(unsigned int max_cpus); |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 854053889d4d..547e344a6dc6 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -141,7 +141,7 @@ struct thread_info { | |||
141 | /* Only used for 64 bit */ | 141 | /* Only used for 64 bit */ |
142 | #define _TIF_DO_NOTIFY_MASK \ | 142 | #define _TIF_DO_NOTIFY_MASK \ |
143 | (_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME | \ | 143 | (_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME | \ |
144 | _TIF_USER_RETURN_NOTIFY) | 144 | _TIF_USER_RETURN_NOTIFY | _TIF_UPROBE) |
145 | 145 | ||
146 | /* flags to check in __switch_to() */ | 146 | /* flags to check in __switch_to() */ |
147 | #define _TIF_WORK_CTXSW \ | 147 | #define _TIF_WORK_CTXSW \ |
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h index bc8352e7010a..707adc6549d8 100644 --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h | |||
@@ -39,6 +39,7 @@ asmlinkage void simd_coprocessor_error(void); | |||
39 | 39 | ||
40 | #ifdef CONFIG_TRACING | 40 | #ifdef CONFIG_TRACING |
41 | asmlinkage void trace_page_fault(void); | 41 | asmlinkage void trace_page_fault(void); |
42 | #define trace_stack_segment stack_segment | ||
42 | #define trace_divide_error divide_error | 43 | #define trace_divide_error divide_error |
43 | #define trace_bounds bounds | 44 | #define trace_bounds bounds |
44 | #define trace_invalid_op invalid_op | 45 | #define trace_invalid_op invalid_op |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b436fc735aa4..a142e77693e1 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -397,7 +397,7 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, | |||
397 | 397 | ||
398 | /* Don't set up the ACPI SCI because it's already set up */ | 398 | /* Don't set up the ACPI SCI because it's already set up */ |
399 | if (acpi_gbl_FADT.sci_interrupt == gsi) | 399 | if (acpi_gbl_FADT.sci_interrupt == gsi) |
400 | return gsi; | 400 | return mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC); |
401 | 401 | ||
402 | trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1; | 402 | trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1; |
403 | polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1; | 403 | polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1; |
@@ -604,14 +604,18 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) | |||
604 | 604 | ||
605 | int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) | 605 | int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) |
606 | { | 606 | { |
607 | int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); | 607 | int irq; |
608 | 608 | ||
609 | if (irq >= 0) { | 609 | if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { |
610 | *irqp = gsi; | ||
611 | } else { | ||
612 | irq = mp_map_gsi_to_irq(gsi, | ||
613 | IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); | ||
614 | if (irq < 0) | ||
615 | return -1; | ||
610 | *irqp = irq; | 616 | *irqp = irq; |
611 | return 0; | ||
612 | } | 617 | } |
613 | 618 | return 0; | |
614 | return -1; | ||
615 | } | 619 | } |
616 | EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); | 620 | EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); |
617 | 621 | ||
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index f04dbb3069b8..5caed1dd7ccf 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c | |||
@@ -21,6 +21,7 @@ const struct pci_device_id amd_nb_misc_ids[] = { | |||
21 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, | 21 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, |
22 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) }, | 22 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) }, |
23 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) }, | 23 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) }, |
24 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M60H_NB_F3) }, | ||
24 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, | 25 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, |
25 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, | 26 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, |
26 | {} | 27 | {} |
@@ -30,6 +31,7 @@ EXPORT_SYMBOL(amd_nb_misc_ids); | |||
30 | static const struct pci_device_id amd_nb_link_ids[] = { | 31 | static const struct pci_device_id amd_nb_link_ids[] = { |
31 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | 32 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
32 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, | 33 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, |
34 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M60H_NB_F4) }, | ||
33 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, | 35 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, |
34 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, | 36 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, |
35 | {} | 37 | {} |
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c index 5972b108f15a..b708738d016e 100644 --- a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c | |||
@@ -185,8 +185,6 @@ static void apbt_setup_irq(struct apbt_dev *adev) | |||
185 | 185 | ||
186 | irq_modify_status(adev->irq, 0, IRQ_MOVE_PCNTXT); | 186 | irq_modify_status(adev->irq, 0, IRQ_MOVE_PCNTXT); |
187 | irq_set_affinity(adev->irq, cpumask_of(adev->cpu)); | 187 | irq_set_affinity(adev->irq, cpumask_of(adev->cpu)); |
188 | /* APB timer irqs are set up as mp_irqs, timer is edge type */ | ||
189 | __irq_set_handler(adev->irq, handle_edge_irq, 0, "edge"); | ||
190 | } | 188 | } |
191 | 189 | ||
192 | /* Should be called with per cpu */ | 190 | /* Should be called with per cpu */ |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 00853b254ab0..ba6cc041edb1 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1297,7 +1297,7 @@ void setup_local_APIC(void) | |||
1297 | unsigned int value, queued; | 1297 | unsigned int value, queued; |
1298 | int i, j, acked = 0; | 1298 | int i, j, acked = 0; |
1299 | unsigned long long tsc = 0, ntsc; | 1299 | unsigned long long tsc = 0, ntsc; |
1300 | long long max_loops = cpu_khz; | 1300 | long long max_loops = cpu_khz ? cpu_khz : 1000000; |
1301 | 1301 | ||
1302 | if (cpu_has_tsc) | 1302 | if (cpu_has_tsc) |
1303 | rdtscll(tsc); | 1303 | rdtscll(tsc); |
@@ -1383,7 +1383,7 @@ void setup_local_APIC(void) | |||
1383 | break; | 1383 | break; |
1384 | } | 1384 | } |
1385 | if (queued) { | 1385 | if (queued) { |
1386 | if (cpu_has_tsc) { | 1386 | if (cpu_has_tsc && cpu_khz) { |
1387 | rdtscll(ntsc); | 1387 | rdtscll(ntsc); |
1388 | max_loops = (cpu_khz << 10) - (ntsc - tsc); | 1388 | max_loops = (cpu_khz << 10) - (ntsc - tsc); |
1389 | } else | 1389 | } else |
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index 01d5453b5502..e27b49d7c922 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
@@ -39,9 +39,12 @@ obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd_iommu.o | |||
39 | endif | 39 | endif |
40 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o | 40 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o |
41 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o | 41 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o |
42 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o perf_event_intel_uncore_snb.o | ||
43 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore_snbep.o perf_event_intel_uncore_nhmex.o | ||
44 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_rapl.o | 42 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_rapl.o |
43 | |||
44 | obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE) += perf_event_intel_uncore.o \ | ||
45 | perf_event_intel_uncore_snb.o \ | ||
46 | perf_event_intel_uncore_snbep.o \ | ||
47 | perf_event_intel_uncore_nhmex.o | ||
45 | endif | 48 | endif |
46 | 49 | ||
47 | 50 | ||
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 4b4f78c9ba19..cfa9b5b2c27a 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -146,6 +146,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); | |||
146 | 146 | ||
147 | static int __init x86_xsave_setup(char *s) | 147 | static int __init x86_xsave_setup(char *s) |
148 | { | 148 | { |
149 | if (strlen(s)) | ||
150 | return 0; | ||
149 | setup_clear_cpu_cap(X86_FEATURE_XSAVE); | 151 | setup_clear_cpu_cap(X86_FEATURE_XSAVE); |
150 | setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); | 152 | setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); |
151 | setup_clear_cpu_cap(X86_FEATURE_XSAVES); | 153 | setup_clear_cpu_cap(X86_FEATURE_XSAVES); |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 1ef456273172..9cc6b6f25f42 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -213,12 +213,13 @@ static void intel_workarounds(struct cpuinfo_x86 *c) | |||
213 | { | 213 | { |
214 | #ifdef CONFIG_X86_F00F_BUG | 214 | #ifdef CONFIG_X86_F00F_BUG |
215 | /* | 215 | /* |
216 | * All current models of Pentium and Pentium with MMX technology CPUs | 216 | * All models of Pentium and Pentium with MMX technology CPUs |
217 | * have the F0 0F bug, which lets nonprivileged users lock up the | 217 | * have the F0 0F bug, which lets nonprivileged users lock up the |
218 | * system. Announce that the fault handler will be checking for it. | 218 | * system. Announce that the fault handler will be checking for it. |
219 | * The Quark is also family 5, but does not have the same bug. | ||
219 | */ | 220 | */ |
220 | clear_cpu_bug(c, X86_BUG_F00F); | 221 | clear_cpu_bug(c, X86_BUG_F00F); |
221 | if (!paravirt_enabled() && c->x86 == 5) { | 222 | if (!paravirt_enabled() && c->x86 == 5 && c->x86_model < 9) { |
222 | static int f00f_workaround_enabled; | 223 | static int f00f_workaround_enabled; |
223 | 224 | ||
224 | set_cpu_bug(c, X86_BUG_F00F); | 225 | set_cpu_bug(c, X86_BUG_F00F); |
diff --git a/arch/x86/kernel/cpu/microcode/amd_early.c b/arch/x86/kernel/cpu/microcode/amd_early.c index 7aa1acc79789..06674473b0e6 100644 --- a/arch/x86/kernel/cpu/microcode/amd_early.c +++ b/arch/x86/kernel/cpu/microcode/amd_early.c | |||
@@ -108,12 +108,13 @@ static size_t compute_container_size(u8 *data, u32 total_size) | |||
108 | * load_microcode_amd() to save equivalent cpu table and microcode patches in | 108 | * load_microcode_amd() to save equivalent cpu table and microcode patches in |
109 | * kernel heap memory. | 109 | * kernel heap memory. |
110 | */ | 110 | */ |
111 | static void apply_ucode_in_initrd(void *ucode, size_t size) | 111 | static void apply_ucode_in_initrd(void *ucode, size_t size, bool save_patch) |
112 | { | 112 | { |
113 | struct equiv_cpu_entry *eq; | 113 | struct equiv_cpu_entry *eq; |
114 | size_t *cont_sz; | 114 | size_t *cont_sz; |
115 | u32 *header; | 115 | u32 *header; |
116 | u8 *data, **cont; | 116 | u8 *data, **cont; |
117 | u8 (*patch)[PATCH_MAX_SIZE]; | ||
117 | u16 eq_id = 0; | 118 | u16 eq_id = 0; |
118 | int offset, left; | 119 | int offset, left; |
119 | u32 rev, eax, ebx, ecx, edx; | 120 | u32 rev, eax, ebx, ecx, edx; |
@@ -123,10 +124,12 @@ static void apply_ucode_in_initrd(void *ucode, size_t size) | |||
123 | new_rev = (u32 *)__pa_nodebug(&ucode_new_rev); | 124 | new_rev = (u32 *)__pa_nodebug(&ucode_new_rev); |
124 | cont_sz = (size_t *)__pa_nodebug(&container_size); | 125 | cont_sz = (size_t *)__pa_nodebug(&container_size); |
125 | cont = (u8 **)__pa_nodebug(&container); | 126 | cont = (u8 **)__pa_nodebug(&container); |
127 | patch = (u8 (*)[PATCH_MAX_SIZE])__pa_nodebug(&amd_ucode_patch); | ||
126 | #else | 128 | #else |
127 | new_rev = &ucode_new_rev; | 129 | new_rev = &ucode_new_rev; |
128 | cont_sz = &container_size; | 130 | cont_sz = &container_size; |
129 | cont = &container; | 131 | cont = &container; |
132 | patch = &amd_ucode_patch; | ||
130 | #endif | 133 | #endif |
131 | 134 | ||
132 | data = ucode; | 135 | data = ucode; |
@@ -213,9 +216,9 @@ static void apply_ucode_in_initrd(void *ucode, size_t size) | |||
213 | rev = mc->hdr.patch_id; | 216 | rev = mc->hdr.patch_id; |
214 | *new_rev = rev; | 217 | *new_rev = rev; |
215 | 218 | ||
216 | /* save ucode patch */ | 219 | if (save_patch) |
217 | memcpy(amd_ucode_patch, mc, | 220 | memcpy(patch, mc, |
218 | min_t(u32, header[1], PATCH_MAX_SIZE)); | 221 | min_t(u32, header[1], PATCH_MAX_SIZE)); |
219 | } | 222 | } |
220 | } | 223 | } |
221 | 224 | ||
@@ -246,7 +249,7 @@ void __init load_ucode_amd_bsp(void) | |||
246 | *data = cp.data; | 249 | *data = cp.data; |
247 | *size = cp.size; | 250 | *size = cp.size; |
248 | 251 | ||
249 | apply_ucode_in_initrd(cp.data, cp.size); | 252 | apply_ucode_in_initrd(cp.data, cp.size, true); |
250 | } | 253 | } |
251 | 254 | ||
252 | #ifdef CONFIG_X86_32 | 255 | #ifdef CONFIG_X86_32 |
@@ -263,7 +266,7 @@ void load_ucode_amd_ap(void) | |||
263 | size_t *usize; | 266 | size_t *usize; |
264 | void **ucode; | 267 | void **ucode; |
265 | 268 | ||
266 | mc = (struct microcode_amd *)__pa(amd_ucode_patch); | 269 | mc = (struct microcode_amd *)__pa_nodebug(amd_ucode_patch); |
267 | if (mc->hdr.patch_id && mc->hdr.processor_rev_id) { | 270 | if (mc->hdr.patch_id && mc->hdr.processor_rev_id) { |
268 | __apply_microcode_amd(mc); | 271 | __apply_microcode_amd(mc); |
269 | return; | 272 | return; |
@@ -275,7 +278,7 @@ void load_ucode_amd_ap(void) | |||
275 | if (!*ucode || !*usize) | 278 | if (!*ucode || !*usize) |
276 | return; | 279 | return; |
277 | 280 | ||
278 | apply_ucode_in_initrd(*ucode, *usize); | 281 | apply_ucode_in_initrd(*ucode, *usize, false); |
279 | } | 282 | } |
280 | 283 | ||
281 | static void __init collect_cpu_sig_on_bsp(void *arg) | 284 | static void __init collect_cpu_sig_on_bsp(void *arg) |
@@ -339,7 +342,7 @@ void load_ucode_amd_ap(void) | |||
339 | * AP has a different equivalence ID than BSP, looks like | 342 | * AP has a different equivalence ID than BSP, looks like |
340 | * mixed-steppings silicon so go through the ucode blob anew. | 343 | * mixed-steppings silicon so go through the ucode blob anew. |
341 | */ | 344 | */ |
342 | apply_ucode_in_initrd(ucode_cpio.data, ucode_cpio.size); | 345 | apply_ucode_in_initrd(ucode_cpio.data, ucode_cpio.size, false); |
343 | } | 346 | } |
344 | } | 347 | } |
345 | #endif | 348 | #endif |
@@ -347,7 +350,9 @@ void load_ucode_amd_ap(void) | |||
347 | int __init save_microcode_in_initrd_amd(void) | 350 | int __init save_microcode_in_initrd_amd(void) |
348 | { | 351 | { |
349 | unsigned long cont; | 352 | unsigned long cont; |
353 | int retval = 0; | ||
350 | enum ucode_state ret; | 354 | enum ucode_state ret; |
355 | u8 *cont_va; | ||
351 | u32 eax; | 356 | u32 eax; |
352 | 357 | ||
353 | if (!container) | 358 | if (!container) |
@@ -355,13 +360,15 @@ int __init save_microcode_in_initrd_amd(void) | |||
355 | 360 | ||
356 | #ifdef CONFIG_X86_32 | 361 | #ifdef CONFIG_X86_32 |
357 | get_bsp_sig(); | 362 | get_bsp_sig(); |
358 | cont = (unsigned long)container; | 363 | cont = (unsigned long)container; |
364 | cont_va = __va(container); | ||
359 | #else | 365 | #else |
360 | /* | 366 | /* |
361 | * We need the physical address of the container for both bitness since | 367 | * We need the physical address of the container for both bitness since |
362 | * boot_params.hdr.ramdisk_image is a physical address. | 368 | * boot_params.hdr.ramdisk_image is a physical address. |
363 | */ | 369 | */ |
364 | cont = __pa(container); | 370 | cont = __pa(container); |
371 | cont_va = container; | ||
365 | #endif | 372 | #endif |
366 | 373 | ||
367 | /* | 374 | /* |
@@ -372,6 +379,8 @@ int __init save_microcode_in_initrd_amd(void) | |||
372 | if (relocated_ramdisk) | 379 | if (relocated_ramdisk) |
373 | container = (u8 *)(__va(relocated_ramdisk) + | 380 | container = (u8 *)(__va(relocated_ramdisk) + |
374 | (cont - boot_params.hdr.ramdisk_image)); | 381 | (cont - boot_params.hdr.ramdisk_image)); |
382 | else | ||
383 | container = cont_va; | ||
375 | 384 | ||
376 | if (ucode_new_rev) | 385 | if (ucode_new_rev) |
377 | pr_info("microcode: updated early to new patch_level=0x%08x\n", | 386 | pr_info("microcode: updated early to new patch_level=0x%08x\n", |
@@ -382,7 +391,7 @@ int __init save_microcode_in_initrd_amd(void) | |||
382 | 391 | ||
383 | ret = load_microcode_amd(eax, container, container_size); | 392 | ret = load_microcode_amd(eax, container, container_size); |
384 | if (ret != UCODE_OK) | 393 | if (ret != UCODE_OK) |
385 | return -EINVAL; | 394 | retval = -EINVAL; |
386 | 395 | ||
387 | /* | 396 | /* |
388 | * This will be freed any msec now, stash patches for the current | 397 | * This will be freed any msec now, stash patches for the current |
@@ -391,5 +400,5 @@ int __init save_microcode_in_initrd_amd(void) | |||
391 | container = NULL; | 400 | container = NULL; |
392 | container_size = 0; | 401 | container_size = 0; |
393 | 402 | ||
394 | return 0; | 403 | return retval; |
395 | } | 404 | } |
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index dd9d6190b08d..08fe6e8a726e 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c | |||
@@ -465,6 +465,16 @@ static void mc_bp_resume(void) | |||
465 | 465 | ||
466 | if (uci->valid && uci->mc) | 466 | if (uci->valid && uci->mc) |
467 | microcode_ops->apply_microcode(cpu); | 467 | microcode_ops->apply_microcode(cpu); |
468 | #ifdef CONFIG_X86_64 | ||
469 | else if (!uci->mc) | ||
470 | /* | ||
471 | * We might resume and not have applied late microcode but still | ||
472 | * have a newer patch stashed from the early loader. We don't | ||
473 | * have it in uci->mc so we have to load it the same way we're | ||
474 | * applying patches early on the APs. | ||
475 | */ | ||
476 | load_ucode_ap(); | ||
477 | #endif | ||
468 | } | 478 | } |
469 | 479 | ||
470 | static struct syscore_ops mc_syscore_ops = { | 480 | static struct syscore_ops mc_syscore_ops = { |
diff --git a/arch/x86/kernel/cpu/microcode/core_early.c b/arch/x86/kernel/cpu/microcode/core_early.c index 5f28a64e71ea..2c017f242a78 100644 --- a/arch/x86/kernel/cpu/microcode/core_early.c +++ b/arch/x86/kernel/cpu/microcode/core_early.c | |||
@@ -124,7 +124,7 @@ void __init load_ucode_bsp(void) | |||
124 | static bool check_loader_disabled_ap(void) | 124 | static bool check_loader_disabled_ap(void) |
125 | { | 125 | { |
126 | #ifdef CONFIG_X86_32 | 126 | #ifdef CONFIG_X86_32 |
127 | return __pa_nodebug(dis_ucode_ldr); | 127 | return *((bool *)__pa_nodebug(&dis_ucode_ldr)); |
128 | #else | 128 | #else |
129 | return dis_ucode_ldr; | 129 | return dis_ucode_ldr; |
130 | #endif | 130 | #endif |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 1b8299dd3d91..143e5f5dc855 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -243,8 +243,9 @@ static bool check_hw_exists(void) | |||
243 | 243 | ||
244 | msr_fail: | 244 | msr_fail: |
245 | printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n"); | 245 | printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n"); |
246 | printk(boot_cpu_has(X86_FEATURE_HYPERVISOR) ? KERN_INFO : KERN_ERR | 246 | printk("%sFailed to access perfctr msr (MSR %x is %Lx)\n", |
247 | "Failed to access perfctr msr (MSR %x is %Lx)\n", reg, val_new); | 247 | boot_cpu_has(X86_FEATURE_HYPERVISOR) ? KERN_INFO : KERN_ERR, |
248 | reg, val_new); | ||
248 | 249 | ||
249 | return false; | 250 | return false; |
250 | } | 251 | } |
@@ -444,12 +445,6 @@ int x86_pmu_hw_config(struct perf_event *event) | |||
444 | if (event->attr.type == PERF_TYPE_RAW) | 445 | if (event->attr.type == PERF_TYPE_RAW) |
445 | event->hw.config |= event->attr.config & X86_RAW_EVENT_MASK; | 446 | event->hw.config |= event->attr.config & X86_RAW_EVENT_MASK; |
446 | 447 | ||
447 | if (event->attr.sample_period && x86_pmu.limit_period) { | ||
448 | if (x86_pmu.limit_period(event, event->attr.sample_period) > | ||
449 | event->attr.sample_period) | ||
450 | return -EINVAL; | ||
451 | } | ||
452 | |||
453 | return x86_setup_perfctr(event); | 448 | return x86_setup_perfctr(event); |
454 | } | 449 | } |
455 | 450 | ||
@@ -987,9 +982,6 @@ int x86_perf_event_set_period(struct perf_event *event) | |||
987 | if (left > x86_pmu.max_period) | 982 | if (left > x86_pmu.max_period) |
988 | left = x86_pmu.max_period; | 983 | left = x86_pmu.max_period; |
989 | 984 | ||
990 | if (x86_pmu.limit_period) | ||
991 | left = x86_pmu.limit_period(event, left); | ||
992 | |||
993 | per_cpu(pmc_prev_left[idx], smp_processor_id()) = left; | 985 | per_cpu(pmc_prev_left[idx], smp_processor_id()) = left; |
994 | 986 | ||
995 | /* | 987 | /* |
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index d98a34d435d7..fc5eb390b368 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
@@ -445,7 +445,6 @@ struct x86_pmu { | |||
445 | struct x86_pmu_quirk *quirks; | 445 | struct x86_pmu_quirk *quirks; |
446 | int perfctr_second_write; | 446 | int perfctr_second_write; |
447 | bool late_ack; | 447 | bool late_ack; |
448 | unsigned (*limit_period)(struct perf_event *event, unsigned l); | ||
449 | 448 | ||
450 | /* | 449 | /* |
451 | * sysfs attrs | 450 | * sysfs attrs |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index a73947c53b65..944bf019b74f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -220,15 +220,6 @@ static struct event_constraint intel_hsw_event_constraints[] = { | |||
220 | EVENT_CONSTRAINT_END | 220 | EVENT_CONSTRAINT_END |
221 | }; | 221 | }; |
222 | 222 | ||
223 | static struct event_constraint intel_bdw_event_constraints[] = { | ||
224 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | ||
225 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | ||
226 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ | ||
227 | INTEL_UEVENT_CONSTRAINT(0x148, 0x4), /* L1D_PEND_MISS.PENDING */ | ||
228 | INTEL_EVENT_CONSTRAINT(0xa3, 0x4), /* CYCLE_ACTIVITY.* */ | ||
229 | EVENT_CONSTRAINT_END | ||
230 | }; | ||
231 | |||
232 | static u64 intel_pmu_event_map(int hw_event) | 223 | static u64 intel_pmu_event_map(int hw_event) |
233 | { | 224 | { |
234 | return intel_perfmon_event_map[hw_event]; | 225 | return intel_perfmon_event_map[hw_event]; |
@@ -424,126 +415,6 @@ static __initconst const u64 snb_hw_cache_event_ids | |||
424 | 415 | ||
425 | }; | 416 | }; |
426 | 417 | ||
427 | static __initconst const u64 hsw_hw_cache_event_ids | ||
428 | [PERF_COUNT_HW_CACHE_MAX] | ||
429 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
430 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = | ||
431 | { | ||
432 | [ C(L1D ) ] = { | ||
433 | [ C(OP_READ) ] = { | ||
434 | [ C(RESULT_ACCESS) ] = 0x81d0, /* MEM_UOPS_RETIRED.ALL_LOADS */ | ||
435 | [ C(RESULT_MISS) ] = 0x151, /* L1D.REPLACEMENT */ | ||
436 | }, | ||
437 | [ C(OP_WRITE) ] = { | ||
438 | [ C(RESULT_ACCESS) ] = 0x82d0, /* MEM_UOPS_RETIRED.ALL_STORES */ | ||
439 | [ C(RESULT_MISS) ] = 0x0, | ||
440 | }, | ||
441 | [ C(OP_PREFETCH) ] = { | ||
442 | [ C(RESULT_ACCESS) ] = 0x0, | ||
443 | [ C(RESULT_MISS) ] = 0x0, | ||
444 | }, | ||
445 | }, | ||
446 | [ C(L1I ) ] = { | ||
447 | [ C(OP_READ) ] = { | ||
448 | [ C(RESULT_ACCESS) ] = 0x0, | ||
449 | [ C(RESULT_MISS) ] = 0x280, /* ICACHE.MISSES */ | ||
450 | }, | ||
451 | [ C(OP_WRITE) ] = { | ||
452 | [ C(RESULT_ACCESS) ] = -1, | ||
453 | [ C(RESULT_MISS) ] = -1, | ||
454 | }, | ||
455 | [ C(OP_PREFETCH) ] = { | ||
456 | [ C(RESULT_ACCESS) ] = 0x0, | ||
457 | [ C(RESULT_MISS) ] = 0x0, | ||
458 | }, | ||
459 | }, | ||
460 | [ C(LL ) ] = { | ||
461 | [ C(OP_READ) ] = { | ||
462 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD */ | ||
463 | [ C(RESULT_ACCESS) ] = 0x1b7, | ||
464 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD|SUPPLIER_NONE| | ||
465 | L3_MISS|ANY_SNOOP */ | ||
466 | [ C(RESULT_MISS) ] = 0x1b7, | ||
467 | }, | ||
468 | [ C(OP_WRITE) ] = { | ||
469 | [ C(RESULT_ACCESS) ] = 0x1b7, /* OFFCORE_RESPONSE:ALL_RFO */ | ||
470 | /* OFFCORE_RESPONSE:ALL_RFO|SUPPLIER_NONE|L3_MISS|ANY_SNOOP */ | ||
471 | [ C(RESULT_MISS) ] = 0x1b7, | ||
472 | }, | ||
473 | [ C(OP_PREFETCH) ] = { | ||
474 | [ C(RESULT_ACCESS) ] = 0x0, | ||
475 | [ C(RESULT_MISS) ] = 0x0, | ||
476 | }, | ||
477 | }, | ||
478 | [ C(DTLB) ] = { | ||
479 | [ C(OP_READ) ] = { | ||
480 | [ C(RESULT_ACCESS) ] = 0x81d0, /* MEM_UOPS_RETIRED.ALL_LOADS */ | ||
481 | [ C(RESULT_MISS) ] = 0x108, /* DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK */ | ||
482 | }, | ||
483 | [ C(OP_WRITE) ] = { | ||
484 | [ C(RESULT_ACCESS) ] = 0x82d0, /* MEM_UOPS_RETIRED.ALL_STORES */ | ||
485 | [ C(RESULT_MISS) ] = 0x149, /* DTLB_STORE_MISSES.MISS_CAUSES_A_WALK */ | ||
486 | }, | ||
487 | [ C(OP_PREFETCH) ] = { | ||
488 | [ C(RESULT_ACCESS) ] = 0x0, | ||
489 | [ C(RESULT_MISS) ] = 0x0, | ||
490 | }, | ||
491 | }, | ||
492 | [ C(ITLB) ] = { | ||
493 | [ C(OP_READ) ] = { | ||
494 | [ C(RESULT_ACCESS) ] = 0x6085, /* ITLB_MISSES.STLB_HIT */ | ||
495 | [ C(RESULT_MISS) ] = 0x185, /* ITLB_MISSES.MISS_CAUSES_A_WALK */ | ||
496 | }, | ||
497 | [ C(OP_WRITE) ] = { | ||
498 | [ C(RESULT_ACCESS) ] = -1, | ||
499 | [ C(RESULT_MISS) ] = -1, | ||
500 | }, | ||
501 | [ C(OP_PREFETCH) ] = { | ||
502 | [ C(RESULT_ACCESS) ] = -1, | ||
503 | [ C(RESULT_MISS) ] = -1, | ||
504 | }, | ||
505 | }, | ||
506 | [ C(BPU ) ] = { | ||
507 | [ C(OP_READ) ] = { | ||
508 | [ C(RESULT_ACCESS) ] = 0xc4, /* BR_INST_RETIRED.ALL_BRANCHES */ | ||
509 | [ C(RESULT_MISS) ] = 0xc5, /* BR_MISP_RETIRED.ALL_BRANCHES */ | ||
510 | }, | ||
511 | [ C(OP_WRITE) ] = { | ||
512 | [ C(RESULT_ACCESS) ] = -1, | ||
513 | [ C(RESULT_MISS) ] = -1, | ||
514 | }, | ||
515 | [ C(OP_PREFETCH) ] = { | ||
516 | [ C(RESULT_ACCESS) ] = -1, | ||
517 | [ C(RESULT_MISS) ] = -1, | ||
518 | }, | ||
519 | }, | ||
520 | }; | ||
521 | |||
522 | static __initconst const u64 hsw_hw_cache_extra_regs | ||
523 | [PERF_COUNT_HW_CACHE_MAX] | ||
524 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
525 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = | ||
526 | { | ||
527 | [ C(LL ) ] = { | ||
528 | [ C(OP_READ) ] = { | ||
529 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD */ | ||
530 | [ C(RESULT_ACCESS) ] = 0x2d5, | ||
531 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD|SUPPLIER_NONE| | ||
532 | L3_MISS|ANY_SNOOP */ | ||
533 | [ C(RESULT_MISS) ] = 0x3fbc0202d5ull, | ||
534 | }, | ||
535 | [ C(OP_WRITE) ] = { | ||
536 | [ C(RESULT_ACCESS) ] = 0x122, /* OFFCORE_RESPONSE:ALL_RFO */ | ||
537 | /* OFFCORE_RESPONSE:ALL_RFO|SUPPLIER_NONE|L3_MISS|ANY_SNOOP */ | ||
538 | [ C(RESULT_MISS) ] = 0x3fbc020122ull, | ||
539 | }, | ||
540 | [ C(OP_PREFETCH) ] = { | ||
541 | [ C(RESULT_ACCESS) ] = 0x0, | ||
542 | [ C(RESULT_MISS) ] = 0x0, | ||
543 | }, | ||
544 | }, | ||
545 | }; | ||
546 | |||
547 | static __initconst const u64 westmere_hw_cache_event_ids | 418 | static __initconst const u64 westmere_hw_cache_event_ids |
548 | [PERF_COUNT_HW_CACHE_MAX] | 419 | [PERF_COUNT_HW_CACHE_MAX] |
549 | [PERF_COUNT_HW_CACHE_OP_MAX] | 420 | [PERF_COUNT_HW_CACHE_OP_MAX] |
@@ -2034,24 +1905,6 @@ hsw_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event) | |||
2034 | return c; | 1905 | return c; |
2035 | } | 1906 | } |
2036 | 1907 | ||
2037 | /* | ||
2038 | * Broadwell: | ||
2039 | * The INST_RETIRED.ALL period always needs to have lowest | ||
2040 | * 6bits cleared (BDM57). It shall not use a period smaller | ||
2041 | * than 100 (BDM11). We combine the two to enforce | ||
2042 | * a min-period of 128. | ||
2043 | */ | ||
2044 | static unsigned bdw_limit_period(struct perf_event *event, unsigned left) | ||
2045 | { | ||
2046 | if ((event->hw.config & INTEL_ARCH_EVENT_MASK) == | ||
2047 | X86_CONFIG(.event=0xc0, .umask=0x01)) { | ||
2048 | if (left < 128) | ||
2049 | left = 128; | ||
2050 | left &= ~0x3fu; | ||
2051 | } | ||
2052 | return left; | ||
2053 | } | ||
2054 | |||
2055 | PMU_FORMAT_ATTR(event, "config:0-7" ); | 1908 | PMU_FORMAT_ATTR(event, "config:0-7" ); |
2056 | PMU_FORMAT_ATTR(umask, "config:8-15" ); | 1909 | PMU_FORMAT_ATTR(umask, "config:8-15" ); |
2057 | PMU_FORMAT_ATTR(edge, "config:18" ); | 1910 | PMU_FORMAT_ATTR(edge, "config:18" ); |
@@ -2692,8 +2545,8 @@ __init int intel_pmu_init(void) | |||
2692 | case 69: /* 22nm Haswell ULT */ | 2545 | case 69: /* 22nm Haswell ULT */ |
2693 | case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */ | 2546 | case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */ |
2694 | x86_pmu.late_ack = true; | 2547 | x86_pmu.late_ack = true; |
2695 | memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids)); | 2548 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids)); |
2696 | memcpy(hw_cache_extra_regs, hsw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); | 2549 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); |
2697 | 2550 | ||
2698 | intel_pmu_lbr_init_snb(); | 2551 | intel_pmu_lbr_init_snb(); |
2699 | 2552 | ||
@@ -2712,28 +2565,6 @@ __init int intel_pmu_init(void) | |||
2712 | pr_cont("Haswell events, "); | 2565 | pr_cont("Haswell events, "); |
2713 | break; | 2566 | break; |
2714 | 2567 | ||
2715 | case 61: /* 14nm Broadwell Core-M */ | ||
2716 | x86_pmu.late_ack = true; | ||
2717 | memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids)); | ||
2718 | memcpy(hw_cache_extra_regs, hsw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); | ||
2719 | |||
2720 | intel_pmu_lbr_init_snb(); | ||
2721 | |||
2722 | x86_pmu.event_constraints = intel_bdw_event_constraints; | ||
2723 | x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints; | ||
2724 | x86_pmu.extra_regs = intel_snbep_extra_regs; | ||
2725 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; | ||
2726 | /* all extra regs are per-cpu when HT is on */ | ||
2727 | x86_pmu.er_flags |= ERF_HAS_RSP_1; | ||
2728 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; | ||
2729 | |||
2730 | x86_pmu.hw_config = hsw_hw_config; | ||
2731 | x86_pmu.get_event_constraints = hsw_get_event_constraints; | ||
2732 | x86_pmu.cpu_events = hsw_events_attrs; | ||
2733 | x86_pmu.limit_period = bdw_limit_period; | ||
2734 | pr_cont("Broadwell events, "); | ||
2735 | break; | ||
2736 | |||
2737 | default: | 2568 | default: |
2738 | switch (x86_pmu.version) { | 2569 | switch (x86_pmu.version) { |
2739 | case 1: | 2570 | case 1: |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c index adf138eac85c..f9ed429d6e4f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | |||
@@ -486,14 +486,17 @@ static struct attribute_group snbep_uncore_qpi_format_group = { | |||
486 | .attrs = snbep_uncore_qpi_formats_attr, | 486 | .attrs = snbep_uncore_qpi_formats_attr, |
487 | }; | 487 | }; |
488 | 488 | ||
489 | #define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ | 489 | #define __SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ |
490 | .init_box = snbep_uncore_msr_init_box, \ | ||
491 | .disable_box = snbep_uncore_msr_disable_box, \ | 490 | .disable_box = snbep_uncore_msr_disable_box, \ |
492 | .enable_box = snbep_uncore_msr_enable_box, \ | 491 | .enable_box = snbep_uncore_msr_enable_box, \ |
493 | .disable_event = snbep_uncore_msr_disable_event, \ | 492 | .disable_event = snbep_uncore_msr_disable_event, \ |
494 | .enable_event = snbep_uncore_msr_enable_event, \ | 493 | .enable_event = snbep_uncore_msr_enable_event, \ |
495 | .read_counter = uncore_msr_read_counter | 494 | .read_counter = uncore_msr_read_counter |
496 | 495 | ||
496 | #define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ | ||
497 | __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), \ | ||
498 | .init_box = snbep_uncore_msr_init_box \ | ||
499 | |||
497 | static struct intel_uncore_ops snbep_uncore_msr_ops = { | 500 | static struct intel_uncore_ops snbep_uncore_msr_ops = { |
498 | SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), | 501 | SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), |
499 | }; | 502 | }; |
@@ -1919,6 +1922,30 @@ static struct intel_uncore_type hswep_uncore_cbox = { | |||
1919 | .format_group = &hswep_uncore_cbox_format_group, | 1922 | .format_group = &hswep_uncore_cbox_format_group, |
1920 | }; | 1923 | }; |
1921 | 1924 | ||
1925 | /* | ||
1926 | * Write SBOX Initialization register bit by bit to avoid spurious #GPs | ||
1927 | */ | ||
1928 | static void hswep_uncore_sbox_msr_init_box(struct intel_uncore_box *box) | ||
1929 | { | ||
1930 | unsigned msr = uncore_msr_box_ctl(box); | ||
1931 | |||
1932 | if (msr) { | ||
1933 | u64 init = SNBEP_PMON_BOX_CTL_INT; | ||
1934 | u64 flags = 0; | ||
1935 | int i; | ||
1936 | |||
1937 | for_each_set_bit(i, (unsigned long *)&init, 64) { | ||
1938 | flags |= (1ULL << i); | ||
1939 | wrmsrl(msr, flags); | ||
1940 | } | ||
1941 | } | ||
1942 | } | ||
1943 | |||
1944 | static struct intel_uncore_ops hswep_uncore_sbox_msr_ops = { | ||
1945 | __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), | ||
1946 | .init_box = hswep_uncore_sbox_msr_init_box | ||
1947 | }; | ||
1948 | |||
1922 | static struct attribute *hswep_uncore_sbox_formats_attr[] = { | 1949 | static struct attribute *hswep_uncore_sbox_formats_attr[] = { |
1923 | &format_attr_event.attr, | 1950 | &format_attr_event.attr, |
1924 | &format_attr_umask.attr, | 1951 | &format_attr_umask.attr, |
@@ -1944,7 +1971,7 @@ static struct intel_uncore_type hswep_uncore_sbox = { | |||
1944 | .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK, | 1971 | .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK, |
1945 | .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL, | 1972 | .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL, |
1946 | .msr_offset = HSWEP_SBOX_MSR_OFFSET, | 1973 | .msr_offset = HSWEP_SBOX_MSR_OFFSET, |
1947 | .ops = &snbep_uncore_msr_ops, | 1974 | .ops = &hswep_uncore_sbox_msr_ops, |
1948 | .format_group = &hswep_uncore_sbox_format_group, | 1975 | .format_group = &hswep_uncore_sbox_format_group, |
1949 | }; | 1976 | }; |
1950 | 1977 | ||
@@ -2025,13 +2052,27 @@ static struct intel_uncore_type hswep_uncore_imc = { | |||
2025 | SNBEP_UNCORE_PCI_COMMON_INIT(), | 2052 | SNBEP_UNCORE_PCI_COMMON_INIT(), |
2026 | }; | 2053 | }; |
2027 | 2054 | ||
2055 | static unsigned hswep_uncore_irp_ctrs[] = {0xa0, 0xa8, 0xb0, 0xb8}; | ||
2056 | |||
2057 | static u64 hswep_uncore_irp_read_counter(struct intel_uncore_box *box, struct perf_event *event) | ||
2058 | { | ||
2059 | struct pci_dev *pdev = box->pci_dev; | ||
2060 | struct hw_perf_event *hwc = &event->hw; | ||
2061 | u64 count = 0; | ||
2062 | |||
2063 | pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx], (u32 *)&count); | ||
2064 | pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx] + 4, (u32 *)&count + 1); | ||
2065 | |||
2066 | return count; | ||
2067 | } | ||
2068 | |||
2028 | static struct intel_uncore_ops hswep_uncore_irp_ops = { | 2069 | static struct intel_uncore_ops hswep_uncore_irp_ops = { |
2029 | .init_box = snbep_uncore_pci_init_box, | 2070 | .init_box = snbep_uncore_pci_init_box, |
2030 | .disable_box = snbep_uncore_pci_disable_box, | 2071 | .disable_box = snbep_uncore_pci_disable_box, |
2031 | .enable_box = snbep_uncore_pci_enable_box, | 2072 | .enable_box = snbep_uncore_pci_enable_box, |
2032 | .disable_event = ivbep_uncore_irp_disable_event, | 2073 | .disable_event = ivbep_uncore_irp_disable_event, |
2033 | .enable_event = ivbep_uncore_irp_enable_event, | 2074 | .enable_event = ivbep_uncore_irp_enable_event, |
2034 | .read_counter = ivbep_uncore_irp_read_counter, | 2075 | .read_counter = hswep_uncore_irp_read_counter, |
2035 | }; | 2076 | }; |
2036 | 2077 | ||
2037 | static struct intel_uncore_type hswep_uncore_irp = { | 2078 | static struct intel_uncore_type hswep_uncore_irp = { |
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index 1abcb50b48ae..ff86f19b5758 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
@@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = { | |||
24 | [ DEBUG_STACK-1 ] = "#DB", | 24 | [ DEBUG_STACK-1 ] = "#DB", |
25 | [ NMI_STACK-1 ] = "NMI", | 25 | [ NMI_STACK-1 ] = "NMI", |
26 | [ DOUBLEFAULT_STACK-1 ] = "#DF", | 26 | [ DOUBLEFAULT_STACK-1 ] = "#DF", |
27 | [ STACKFAULT_STACK-1 ] = "#SS", | ||
28 | [ MCE_STACK-1 ] = "#MC", | 27 | [ MCE_STACK-1 ] = "#MC", |
29 | #if DEBUG_STKSZ > EXCEPTION_STKSZ | 28 | #if DEBUG_STKSZ > EXCEPTION_STKSZ |
30 | [ N_EXCEPTION_STACKS ... | 29 | [ N_EXCEPTION_STACKS ... |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index b553ed89e5f5..344b63f18d14 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -447,15 +447,14 @@ sysenter_exit: | |||
447 | sysenter_audit: | 447 | sysenter_audit: |
448 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp) | 448 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp) |
449 | jnz syscall_trace_entry | 449 | jnz syscall_trace_entry |
450 | addl $4,%esp | 450 | /* movl PT_EAX(%esp), %eax already set, syscall number: 1st arg to audit */ |
451 | CFI_ADJUST_CFA_OFFSET -4 | 451 | movl PT_EBX(%esp), %edx /* ebx/a0: 2nd arg to audit */ |
452 | movl %esi,4(%esp) /* 5th arg: 4th syscall arg */ | 452 | /* movl PT_ECX(%esp), %ecx already set, a1: 3nd arg to audit */ |
453 | movl %edx,(%esp) /* 4th arg: 3rd syscall arg */ | 453 | pushl_cfi PT_ESI(%esp) /* a3: 5th arg */ |
454 | /* %ecx already in %ecx 3rd arg: 2nd syscall arg */ | 454 | pushl_cfi PT_EDX+4(%esp) /* a2: 4th arg */ |
455 | movl %ebx,%edx /* 2nd arg: 1st syscall arg */ | ||
456 | /* %eax already in %eax 1st arg: syscall number */ | ||
457 | call __audit_syscall_entry | 455 | call __audit_syscall_entry |
458 | pushl_cfi %ebx | 456 | popl_cfi %ecx /* get that remapped edx off the stack */ |
457 | popl_cfi %ecx /* get that remapped esi off the stack */ | ||
459 | movl PT_EAX(%esp),%eax /* reload syscall number */ | 458 | movl PT_EAX(%esp),%eax /* reload syscall number */ |
460 | jmp sysenter_do_call | 459 | jmp sysenter_do_call |
461 | 460 | ||
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index df088bb03fb3..c0226ab54106 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -828,9 +828,15 @@ ENTRY(native_iret) | |||
828 | jnz native_irq_return_ldt | 828 | jnz native_irq_return_ldt |
829 | #endif | 829 | #endif |
830 | 830 | ||
831 | .global native_irq_return_iret | ||
831 | native_irq_return_iret: | 832 | native_irq_return_iret: |
833 | /* | ||
834 | * This may fault. Non-paranoid faults on return to userspace are | ||
835 | * handled by fixup_bad_iret. These include #SS, #GP, and #NP. | ||
836 | * Double-faults due to espfix64 are handled in do_double_fault. | ||
837 | * Other faults here are fatal. | ||
838 | */ | ||
832 | iretq | 839 | iretq |
833 | _ASM_EXTABLE(native_irq_return_iret, bad_iret) | ||
834 | 840 | ||
835 | #ifdef CONFIG_X86_ESPFIX64 | 841 | #ifdef CONFIG_X86_ESPFIX64 |
836 | native_irq_return_ldt: | 842 | native_irq_return_ldt: |
@@ -858,25 +864,6 @@ native_irq_return_ldt: | |||
858 | jmp native_irq_return_iret | 864 | jmp native_irq_return_iret |
859 | #endif | 865 | #endif |
860 | 866 | ||
861 | .section .fixup,"ax" | ||
862 | bad_iret: | ||
863 | /* | ||
864 | * The iret traps when the %cs or %ss being restored is bogus. | ||
865 | * We've lost the original trap vector and error code. | ||
866 | * #GPF is the most likely one to get for an invalid selector. | ||
867 | * So pretend we completed the iret and took the #GPF in user mode. | ||
868 | * | ||
869 | * We are now running with the kernel GS after exception recovery. | ||
870 | * But error_entry expects us to have user GS to match the user %cs, | ||
871 | * so swap back. | ||
872 | */ | ||
873 | pushq $0 | ||
874 | |||
875 | SWAPGS | ||
876 | jmp general_protection | ||
877 | |||
878 | .previous | ||
879 | |||
880 | /* edi: workmask, edx: work */ | 867 | /* edi: workmask, edx: work */ |
881 | retint_careful: | 868 | retint_careful: |
882 | CFI_RESTORE_STATE | 869 | CFI_RESTORE_STATE |
@@ -922,37 +909,6 @@ ENTRY(retint_kernel) | |||
922 | CFI_ENDPROC | 909 | CFI_ENDPROC |
923 | END(common_interrupt) | 910 | END(common_interrupt) |
924 | 911 | ||
925 | /* | ||
926 | * If IRET takes a fault on the espfix stack, then we | ||
927 | * end up promoting it to a doublefault. In that case, | ||
928 | * modify the stack to make it look like we just entered | ||
929 | * the #GP handler from user space, similar to bad_iret. | ||
930 | */ | ||
931 | #ifdef CONFIG_X86_ESPFIX64 | ||
932 | ALIGN | ||
933 | __do_double_fault: | ||
934 | XCPT_FRAME 1 RDI+8 | ||
935 | movq RSP(%rdi),%rax /* Trap on the espfix stack? */ | ||
936 | sarq $PGDIR_SHIFT,%rax | ||
937 | cmpl $ESPFIX_PGD_ENTRY,%eax | ||
938 | jne do_double_fault /* No, just deliver the fault */ | ||
939 | cmpl $__KERNEL_CS,CS(%rdi) | ||
940 | jne do_double_fault | ||
941 | movq RIP(%rdi),%rax | ||
942 | cmpq $native_irq_return_iret,%rax | ||
943 | jne do_double_fault /* This shouldn't happen... */ | ||
944 | movq PER_CPU_VAR(kernel_stack),%rax | ||
945 | subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */ | ||
946 | movq %rax,RSP(%rdi) | ||
947 | movq $0,(%rax) /* Missing (lost) #GP error code */ | ||
948 | movq $general_protection,RIP(%rdi) | ||
949 | retq | ||
950 | CFI_ENDPROC | ||
951 | END(__do_double_fault) | ||
952 | #else | ||
953 | # define __do_double_fault do_double_fault | ||
954 | #endif | ||
955 | |||
956 | /* | 912 | /* |
957 | * APIC interrupts. | 913 | * APIC interrupts. |
958 | */ | 914 | */ |
@@ -1124,7 +1080,7 @@ idtentry overflow do_overflow has_error_code=0 | |||
1124 | idtentry bounds do_bounds has_error_code=0 | 1080 | idtentry bounds do_bounds has_error_code=0 |
1125 | idtentry invalid_op do_invalid_op has_error_code=0 | 1081 | idtentry invalid_op do_invalid_op has_error_code=0 |
1126 | idtentry device_not_available do_device_not_available has_error_code=0 | 1082 | idtentry device_not_available do_device_not_available has_error_code=0 |
1127 | idtentry double_fault __do_double_fault has_error_code=1 paranoid=1 | 1083 | idtentry double_fault do_double_fault has_error_code=1 paranoid=1 |
1128 | idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0 | 1084 | idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0 |
1129 | idtentry invalid_TSS do_invalid_TSS has_error_code=1 | 1085 | idtentry invalid_TSS do_invalid_TSS has_error_code=1 |
1130 | idtentry segment_not_present do_segment_not_present has_error_code=1 | 1086 | idtentry segment_not_present do_segment_not_present has_error_code=1 |
@@ -1289,7 +1245,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ | |||
1289 | 1245 | ||
1290 | idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK | 1246 | idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK |
1291 | idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK | 1247 | idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK |
1292 | idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1 | 1248 | idtentry stack_segment do_stack_segment has_error_code=1 |
1293 | #ifdef CONFIG_XEN | 1249 | #ifdef CONFIG_XEN |
1294 | idtentry xen_debug do_debug has_error_code=0 | 1250 | idtentry xen_debug do_debug has_error_code=0 |
1295 | idtentry xen_int3 do_int3 has_error_code=0 | 1251 | idtentry xen_int3 do_int3 has_error_code=0 |
@@ -1399,17 +1355,16 @@ error_sti: | |||
1399 | 1355 | ||
1400 | /* | 1356 | /* |
1401 | * There are two places in the kernel that can potentially fault with | 1357 | * There are two places in the kernel that can potentially fault with |
1402 | * usergs. Handle them here. The exception handlers after iret run with | 1358 | * usergs. Handle them here. B stepping K8s sometimes report a |
1403 | * kernel gs again, so don't set the user space flag. B stepping K8s | 1359 | * truncated RIP for IRET exceptions returning to compat mode. Check |
1404 | * sometimes report an truncated RIP for IRET exceptions returning to | 1360 | * for these here too. |
1405 | * compat mode. Check for these here too. | ||
1406 | */ | 1361 | */ |
1407 | error_kernelspace: | 1362 | error_kernelspace: |
1408 | CFI_REL_OFFSET rcx, RCX+8 | 1363 | CFI_REL_OFFSET rcx, RCX+8 |
1409 | incl %ebx | 1364 | incl %ebx |
1410 | leaq native_irq_return_iret(%rip),%rcx | 1365 | leaq native_irq_return_iret(%rip),%rcx |
1411 | cmpq %rcx,RIP+8(%rsp) | 1366 | cmpq %rcx,RIP+8(%rsp) |
1412 | je error_swapgs | 1367 | je error_bad_iret |
1413 | movl %ecx,%eax /* zero extend */ | 1368 | movl %ecx,%eax /* zero extend */ |
1414 | cmpq %rax,RIP+8(%rsp) | 1369 | cmpq %rax,RIP+8(%rsp) |
1415 | je bstep_iret | 1370 | je bstep_iret |
@@ -1420,7 +1375,15 @@ error_kernelspace: | |||
1420 | bstep_iret: | 1375 | bstep_iret: |
1421 | /* Fix truncated RIP */ | 1376 | /* Fix truncated RIP */ |
1422 | movq %rcx,RIP+8(%rsp) | 1377 | movq %rcx,RIP+8(%rsp) |
1423 | jmp error_swapgs | 1378 | /* fall through */ |
1379 | |||
1380 | error_bad_iret: | ||
1381 | SWAPGS | ||
1382 | mov %rsp,%rdi | ||
1383 | call fixup_bad_iret | ||
1384 | mov %rax,%rsp | ||
1385 | decl %ebx /* Return to usergs */ | ||
1386 | jmp error_sti | ||
1424 | CFI_ENDPROC | 1387 | CFI_ENDPROC |
1425 | END(error_entry) | 1388 | END(error_entry) |
1426 | 1389 | ||
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index 8af817105e29..e7cc5370cd2f 100644 --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c | |||
@@ -111,8 +111,7 @@ static void make_8259A_irq(unsigned int irq) | |||
111 | { | 111 | { |
112 | disable_irq_nosync(irq); | 112 | disable_irq_nosync(irq); |
113 | io_apic_irqs &= ~(1<<irq); | 113 | io_apic_irqs &= ~(1<<irq); |
114 | irq_set_chip_and_handler_name(irq, &i8259A_chip, handle_level_irq, | 114 | irq_set_chip_and_handler(irq, &i8259A_chip, handle_level_irq); |
115 | i8259A_chip.name); | ||
116 | enable_irq(irq); | 115 | enable_irq(irq); |
117 | } | 116 | } |
118 | 117 | ||
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 44f1ed42fdf2..4de73ee78361 100644 --- a/arch/x86/kernel/irqinit.c +++ b/arch/x86/kernel/irqinit.c | |||
@@ -70,7 +70,6 @@ int vector_used_by_percpu_irq(unsigned int vector) | |||
70 | void __init init_ISA_irqs(void) | 70 | void __init init_ISA_irqs(void) |
71 | { | 71 | { |
72 | struct irq_chip *chip = legacy_pic->chip; | 72 | struct irq_chip *chip = legacy_pic->chip; |
73 | const char *name = chip->name; | ||
74 | int i; | 73 | int i; |
75 | 74 | ||
76 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC) | 75 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC) |
@@ -79,7 +78,7 @@ void __init init_ISA_irqs(void) | |||
79 | legacy_pic->init(0); | 78 | legacy_pic->init(0); |
80 | 79 | ||
81 | for (i = 0; i < nr_legacy_irqs(); i++) | 80 | for (i = 0; i < nr_legacy_irqs(); i++) |
82 | irq_set_chip_and_handler_name(i, chip, handle_level_irq, name); | 81 | irq_set_chip_and_handler(i, chip, handle_level_irq); |
83 | } | 82 | } |
84 | 83 | ||
85 | void __init init_IRQ(void) | 84 | void __init init_IRQ(void) |
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 749b0e423419..e510618b2e91 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -1484,7 +1484,7 @@ unsigned long syscall_trace_enter_phase1(struct pt_regs *regs, u32 arch) | |||
1484 | */ | 1484 | */ |
1485 | if (work & _TIF_NOHZ) { | 1485 | if (work & _TIF_NOHZ) { |
1486 | user_exit(); | 1486 | user_exit(); |
1487 | work &= ~TIF_NOHZ; | 1487 | work &= ~_TIF_NOHZ; |
1488 | } | 1488 | } |
1489 | 1489 | ||
1490 | #ifdef CONFIG_SECCOMP | 1490 | #ifdef CONFIG_SECCOMP |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 235cfd39e0d7..ab08aa2276fb 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1128,7 +1128,6 @@ void __init setup_arch(char **cmdline_p) | |||
1128 | setup_real_mode(); | 1128 | setup_real_mode(); |
1129 | 1129 | ||
1130 | memblock_set_current_limit(get_max_mapped()); | 1130 | memblock_set_current_limit(get_max_mapped()); |
1131 | dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT); | ||
1132 | 1131 | ||
1133 | /* | 1132 | /* |
1134 | * NOTE: On x86-32, only from this point on, fixmaps are ready for use. | 1133 | * NOTE: On x86-32, only from this point on, fixmaps are ready for use. |
@@ -1159,6 +1158,7 @@ void __init setup_arch(char **cmdline_p) | |||
1159 | early_acpi_boot_init(); | 1158 | early_acpi_boot_init(); |
1160 | 1159 | ||
1161 | initmem_init(); | 1160 | initmem_init(); |
1161 | dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT); | ||
1162 | 1162 | ||
1163 | /* | 1163 | /* |
1164 | * Reserve memory for crash kernel after SRAT is parsed so that it | 1164 | * Reserve memory for crash kernel after SRAT is parsed so that it |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 2d5200e56357..668d8f2a8781 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -102,8 +102,6 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map); | |||
102 | DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); | 102 | DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); |
103 | EXPORT_PER_CPU_SYMBOL(cpu_info); | 103 | EXPORT_PER_CPU_SYMBOL(cpu_info); |
104 | 104 | ||
105 | static DEFINE_PER_CPU(struct completion, die_complete); | ||
106 | |||
107 | atomic_t init_deasserted; | 105 | atomic_t init_deasserted; |
108 | 106 | ||
109 | /* | 107 | /* |
@@ -1305,10 +1303,14 @@ static void __ref remove_cpu_from_maps(int cpu) | |||
1305 | numa_remove_cpu(cpu); | 1303 | numa_remove_cpu(cpu); |
1306 | } | 1304 | } |
1307 | 1305 | ||
1306 | static DEFINE_PER_CPU(struct completion, die_complete); | ||
1307 | |||
1308 | void cpu_disable_common(void) | 1308 | void cpu_disable_common(void) |
1309 | { | 1309 | { |
1310 | int cpu = smp_processor_id(); | 1310 | int cpu = smp_processor_id(); |
1311 | 1311 | ||
1312 | init_completion(&per_cpu(die_complete, smp_processor_id())); | ||
1313 | |||
1312 | remove_siblinginfo(cpu); | 1314 | remove_siblinginfo(cpu); |
1313 | 1315 | ||
1314 | /* It's now safe to remove this processor from the online map */ | 1316 | /* It's now safe to remove this processor from the online map */ |
@@ -1327,16 +1329,21 @@ int native_cpu_disable(void) | |||
1327 | return ret; | 1329 | return ret; |
1328 | 1330 | ||
1329 | clear_local_APIC(); | 1331 | clear_local_APIC(); |
1330 | init_completion(&per_cpu(die_complete, smp_processor_id())); | ||
1331 | cpu_disable_common(); | 1332 | cpu_disable_common(); |
1332 | 1333 | ||
1333 | return 0; | 1334 | return 0; |
1334 | } | 1335 | } |
1335 | 1336 | ||
1337 | void cpu_die_common(unsigned int cpu) | ||
1338 | { | ||
1339 | wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ); | ||
1340 | } | ||
1341 | |||
1336 | void native_cpu_die(unsigned int cpu) | 1342 | void native_cpu_die(unsigned int cpu) |
1337 | { | 1343 | { |
1338 | /* We don't do anything here: idle task is faking death itself. */ | 1344 | /* We don't do anything here: idle task is faking death itself. */ |
1339 | wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ); | 1345 | |
1346 | cpu_die_common(cpu); | ||
1340 | 1347 | ||
1341 | /* They ack this in play_dead() by setting CPU_DEAD */ | 1348 | /* They ack this in play_dead() by setting CPU_DEAD */ |
1342 | if (per_cpu(cpu_state, cpu) == CPU_DEAD) { | 1349 | if (per_cpu(cpu_state, cpu) == CPU_DEAD) { |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 0d0e922fafc1..de801f22128a 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -233,32 +233,40 @@ DO_ERROR(X86_TRAP_UD, SIGILL, "invalid opcode", invalid_op) | |||
233 | DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun) | 233 | DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun) |
234 | DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS) | 234 | DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS) |
235 | DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present) | 235 | DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present) |
236 | #ifdef CONFIG_X86_32 | ||
237 | DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment) | 236 | DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment) |
238 | #endif | ||
239 | DO_ERROR(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check) | 237 | DO_ERROR(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check) |
240 | 238 | ||
241 | #ifdef CONFIG_X86_64 | 239 | #ifdef CONFIG_X86_64 |
242 | /* Runs on IST stack */ | 240 | /* Runs on IST stack */ |
243 | dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code) | ||
244 | { | ||
245 | enum ctx_state prev_state; | ||
246 | |||
247 | prev_state = exception_enter(); | ||
248 | if (notify_die(DIE_TRAP, "stack segment", regs, error_code, | ||
249 | X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) { | ||
250 | preempt_conditional_sti(regs); | ||
251 | do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL); | ||
252 | preempt_conditional_cli(regs); | ||
253 | } | ||
254 | exception_exit(prev_state); | ||
255 | } | ||
256 | |||
257 | dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) | 241 | dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) |
258 | { | 242 | { |
259 | static const char str[] = "double fault"; | 243 | static const char str[] = "double fault"; |
260 | struct task_struct *tsk = current; | 244 | struct task_struct *tsk = current; |
261 | 245 | ||
246 | #ifdef CONFIG_X86_ESPFIX64 | ||
247 | extern unsigned char native_irq_return_iret[]; | ||
248 | |||
249 | /* | ||
250 | * If IRET takes a non-IST fault on the espfix64 stack, then we | ||
251 | * end up promoting it to a doublefault. In that case, modify | ||
252 | * the stack to make it look like we just entered the #GP | ||
253 | * handler from user space, similar to bad_iret. | ||
254 | */ | ||
255 | if (((long)regs->sp >> PGDIR_SHIFT) == ESPFIX_PGD_ENTRY && | ||
256 | regs->cs == __KERNEL_CS && | ||
257 | regs->ip == (unsigned long)native_irq_return_iret) | ||
258 | { | ||
259 | struct pt_regs *normal_regs = task_pt_regs(current); | ||
260 | |||
261 | /* Fake a #GP(0) from userspace. */ | ||
262 | memmove(&normal_regs->ip, (void *)regs->sp, 5*8); | ||
263 | normal_regs->orig_ax = 0; /* Missing (lost) #GP error code */ | ||
264 | regs->ip = (unsigned long)general_protection; | ||
265 | regs->sp = (unsigned long)&normal_regs->orig_ax; | ||
266 | return; | ||
267 | } | ||
268 | #endif | ||
269 | |||
262 | exception_enter(); | 270 | exception_enter(); |
263 | /* Return not checked because double check cannot be ignored */ | 271 | /* Return not checked because double check cannot be ignored */ |
264 | notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); | 272 | notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); |
@@ -399,6 +407,35 @@ asmlinkage __visible struct pt_regs *sync_regs(struct pt_regs *eregs) | |||
399 | return regs; | 407 | return regs; |
400 | } | 408 | } |
401 | NOKPROBE_SYMBOL(sync_regs); | 409 | NOKPROBE_SYMBOL(sync_regs); |
410 | |||
411 | struct bad_iret_stack { | ||
412 | void *error_entry_ret; | ||
413 | struct pt_regs regs; | ||
414 | }; | ||
415 | |||
416 | asmlinkage __visible | ||
417 | struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s) | ||
418 | { | ||
419 | /* | ||
420 | * This is called from entry_64.S early in handling a fault | ||
421 | * caused by a bad iret to user mode. To handle the fault | ||
422 | * correctly, we want move our stack frame to task_pt_regs | ||
423 | * and we want to pretend that the exception came from the | ||
424 | * iret target. | ||
425 | */ | ||
426 | struct bad_iret_stack *new_stack = | ||
427 | container_of(task_pt_regs(current), | ||
428 | struct bad_iret_stack, regs); | ||
429 | |||
430 | /* Copy the IRET target to the new stack. */ | ||
431 | memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8); | ||
432 | |||
433 | /* Copy the remainder of the stack from the current stack. */ | ||
434 | memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip)); | ||
435 | |||
436 | BUG_ON(!user_mode_vm(&new_stack->regs)); | ||
437 | return new_stack; | ||
438 | } | ||
402 | #endif | 439 | #endif |
403 | 440 | ||
404 | /* | 441 | /* |
@@ -778,7 +815,7 @@ void __init trap_init(void) | |||
778 | set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun); | 815 | set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun); |
779 | set_intr_gate(X86_TRAP_TS, invalid_TSS); | 816 | set_intr_gate(X86_TRAP_TS, invalid_TSS); |
780 | set_intr_gate(X86_TRAP_NP, segment_not_present); | 817 | set_intr_gate(X86_TRAP_NP, segment_not_present); |
781 | set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK); | 818 | set_intr_gate(X86_TRAP_SS, stack_segment); |
782 | set_intr_gate(X86_TRAP_GP, general_protection); | 819 | set_intr_gate(X86_TRAP_GP, general_protection); |
783 | set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug); | 820 | set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug); |
784 | set_intr_gate(X86_TRAP_MF, coprocessor_error); | 821 | set_intr_gate(X86_TRAP_MF, coprocessor_error); |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index b6025f9e36c6..b7e50bba3bbb 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -1166,14 +1166,17 @@ void __init tsc_init(void) | |||
1166 | 1166 | ||
1167 | x86_init.timers.tsc_pre_init(); | 1167 | x86_init.timers.tsc_pre_init(); |
1168 | 1168 | ||
1169 | if (!cpu_has_tsc) | 1169 | if (!cpu_has_tsc) { |
1170 | setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); | ||
1170 | return; | 1171 | return; |
1172 | } | ||
1171 | 1173 | ||
1172 | tsc_khz = x86_platform.calibrate_tsc(); | 1174 | tsc_khz = x86_platform.calibrate_tsc(); |
1173 | cpu_khz = tsc_khz; | 1175 | cpu_khz = tsc_khz; |
1174 | 1176 | ||
1175 | if (!tsc_khz) { | 1177 | if (!tsc_khz) { |
1176 | mark_tsc_unstable("could not calculate TSC khz"); | 1178 | mark_tsc_unstable("could not calculate TSC khz"); |
1179 | setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); | ||
1177 | return; | 1180 | return; |
1178 | } | 1181 | } |
1179 | 1182 | ||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 749f9fa38254..9f8a2faf5040 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -574,12 +574,14 @@ static inline int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst, | |||
574 | case 4: | 574 | case 4: |
575 | ctxt->_eip = (u32)dst; | 575 | ctxt->_eip = (u32)dst; |
576 | break; | 576 | break; |
577 | #ifdef CONFIG_X86_64 | ||
577 | case 8: | 578 | case 8: |
578 | if ((cs_l && is_noncanonical_address(dst)) || | 579 | if ((cs_l && is_noncanonical_address(dst)) || |
579 | (!cs_l && (dst & ~(u32)-1))) | 580 | (!cs_l && (dst >> 32) != 0)) |
580 | return emulate_gp(ctxt, 0); | 581 | return emulate_gp(ctxt, 0); |
581 | ctxt->_eip = dst; | 582 | ctxt->_eip = dst; |
582 | break; | 583 | break; |
584 | #endif | ||
583 | default: | 585 | default: |
584 | WARN(1, "unsupported eip assignment size\n"); | 586 | WARN(1, "unsupported eip assignment size\n"); |
585 | } | 587 | } |
@@ -641,7 +643,8 @@ static bool insn_aligned(struct x86_emulate_ctxt *ctxt, unsigned size) | |||
641 | 643 | ||
642 | static int __linearize(struct x86_emulate_ctxt *ctxt, | 644 | static int __linearize(struct x86_emulate_ctxt *ctxt, |
643 | struct segmented_address addr, | 645 | struct segmented_address addr, |
644 | unsigned size, bool write, bool fetch, | 646 | unsigned *max_size, unsigned size, |
647 | bool write, bool fetch, | ||
645 | ulong *linear) | 648 | ulong *linear) |
646 | { | 649 | { |
647 | struct desc_struct desc; | 650 | struct desc_struct desc; |
@@ -652,10 +655,15 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, | |||
652 | unsigned cpl; | 655 | unsigned cpl; |
653 | 656 | ||
654 | la = seg_base(ctxt, addr.seg) + addr.ea; | 657 | la = seg_base(ctxt, addr.seg) + addr.ea; |
658 | *max_size = 0; | ||
655 | switch (ctxt->mode) { | 659 | switch (ctxt->mode) { |
656 | case X86EMUL_MODE_PROT64: | 660 | case X86EMUL_MODE_PROT64: |
657 | if (((signed long)la << 16) >> 16 != la) | 661 | if (((signed long)la << 16) >> 16 != la) |
658 | return emulate_gp(ctxt, 0); | 662 | return emulate_gp(ctxt, 0); |
663 | |||
664 | *max_size = min_t(u64, ~0u, (1ull << 48) - la); | ||
665 | if (size > *max_size) | ||
666 | goto bad; | ||
659 | break; | 667 | break; |
660 | default: | 668 | default: |
661 | usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL, | 669 | usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL, |
@@ -673,20 +681,25 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, | |||
673 | if ((ctxt->mode == X86EMUL_MODE_REAL) && !fetch && | 681 | if ((ctxt->mode == X86EMUL_MODE_REAL) && !fetch && |
674 | (ctxt->d & NoBigReal)) { | 682 | (ctxt->d & NoBigReal)) { |
675 | /* la is between zero and 0xffff */ | 683 | /* la is between zero and 0xffff */ |
676 | if (la > 0xffff || (u32)(la + size - 1) > 0xffff) | 684 | if (la > 0xffff) |
677 | goto bad; | 685 | goto bad; |
686 | *max_size = 0x10000 - la; | ||
678 | } else if ((desc.type & 8) || !(desc.type & 4)) { | 687 | } else if ((desc.type & 8) || !(desc.type & 4)) { |
679 | /* expand-up segment */ | 688 | /* expand-up segment */ |
680 | if (addr.ea > lim || (u32)(addr.ea + size - 1) > lim) | 689 | if (addr.ea > lim) |
681 | goto bad; | 690 | goto bad; |
691 | *max_size = min_t(u64, ~0u, (u64)lim + 1 - addr.ea); | ||
682 | } else { | 692 | } else { |
683 | /* expand-down segment */ | 693 | /* expand-down segment */ |
684 | if (addr.ea <= lim || (u32)(addr.ea + size - 1) <= lim) | 694 | if (addr.ea <= lim) |
685 | goto bad; | 695 | goto bad; |
686 | lim = desc.d ? 0xffffffff : 0xffff; | 696 | lim = desc.d ? 0xffffffff : 0xffff; |
687 | if (addr.ea > lim || (u32)(addr.ea + size - 1) > lim) | 697 | if (addr.ea > lim) |
688 | goto bad; | 698 | goto bad; |
699 | *max_size = min_t(u64, ~0u, (u64)lim + 1 - addr.ea); | ||
689 | } | 700 | } |
701 | if (size > *max_size) | ||
702 | goto bad; | ||
690 | cpl = ctxt->ops->cpl(ctxt); | 703 | cpl = ctxt->ops->cpl(ctxt); |
691 | if (!(desc.type & 8)) { | 704 | if (!(desc.type & 8)) { |
692 | /* data segment */ | 705 | /* data segment */ |
@@ -711,9 +724,9 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, | |||
711 | return X86EMUL_CONTINUE; | 724 | return X86EMUL_CONTINUE; |
712 | bad: | 725 | bad: |
713 | if (addr.seg == VCPU_SREG_SS) | 726 | if (addr.seg == VCPU_SREG_SS) |
714 | return emulate_ss(ctxt, sel); | 727 | return emulate_ss(ctxt, 0); |
715 | else | 728 | else |
716 | return emulate_gp(ctxt, sel); | 729 | return emulate_gp(ctxt, 0); |
717 | } | 730 | } |
718 | 731 | ||
719 | static int linearize(struct x86_emulate_ctxt *ctxt, | 732 | static int linearize(struct x86_emulate_ctxt *ctxt, |
@@ -721,7 +734,8 @@ static int linearize(struct x86_emulate_ctxt *ctxt, | |||
721 | unsigned size, bool write, | 734 | unsigned size, bool write, |
722 | ulong *linear) | 735 | ulong *linear) |
723 | { | 736 | { |
724 | return __linearize(ctxt, addr, size, write, false, linear); | 737 | unsigned max_size; |
738 | return __linearize(ctxt, addr, &max_size, size, write, false, linear); | ||
725 | } | 739 | } |
726 | 740 | ||
727 | 741 | ||
@@ -746,17 +760,27 @@ static int segmented_read_std(struct x86_emulate_ctxt *ctxt, | |||
746 | static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size) | 760 | static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size) |
747 | { | 761 | { |
748 | int rc; | 762 | int rc; |
749 | unsigned size; | 763 | unsigned size, max_size; |
750 | unsigned long linear; | 764 | unsigned long linear; |
751 | int cur_size = ctxt->fetch.end - ctxt->fetch.data; | 765 | int cur_size = ctxt->fetch.end - ctxt->fetch.data; |
752 | struct segmented_address addr = { .seg = VCPU_SREG_CS, | 766 | struct segmented_address addr = { .seg = VCPU_SREG_CS, |
753 | .ea = ctxt->eip + cur_size }; | 767 | .ea = ctxt->eip + cur_size }; |
754 | 768 | ||
755 | size = 15UL ^ cur_size; | 769 | /* |
756 | rc = __linearize(ctxt, addr, size, false, true, &linear); | 770 | * We do not know exactly how many bytes will be needed, and |
771 | * __linearize is expensive, so fetch as much as possible. We | ||
772 | * just have to avoid going beyond the 15 byte limit, the end | ||
773 | * of the segment, or the end of the page. | ||
774 | * | ||
775 | * __linearize is called with size 0 so that it does not do any | ||
776 | * boundary check itself. Instead, we use max_size to check | ||
777 | * against op_size. | ||
778 | */ | ||
779 | rc = __linearize(ctxt, addr, &max_size, 0, false, true, &linear); | ||
757 | if (unlikely(rc != X86EMUL_CONTINUE)) | 780 | if (unlikely(rc != X86EMUL_CONTINUE)) |
758 | return rc; | 781 | return rc; |
759 | 782 | ||
783 | size = min_t(unsigned, 15UL ^ cur_size, max_size); | ||
760 | size = min_t(unsigned, size, PAGE_SIZE - offset_in_page(linear)); | 784 | size = min_t(unsigned, size, PAGE_SIZE - offset_in_page(linear)); |
761 | 785 | ||
762 | /* | 786 | /* |
@@ -766,7 +790,8 @@ static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size) | |||
766 | * still, we must have hit the 15-byte boundary. | 790 | * still, we must have hit the 15-byte boundary. |
767 | */ | 791 | */ |
768 | if (unlikely(size < op_size)) | 792 | if (unlikely(size < op_size)) |
769 | return X86EMUL_UNHANDLEABLE; | 793 | return emulate_gp(ctxt, 0); |
794 | |||
770 | rc = ctxt->ops->fetch(ctxt, linear, ctxt->fetch.end, | 795 | rc = ctxt->ops->fetch(ctxt, linear, ctxt->fetch.end, |
771 | size, &ctxt->exception); | 796 | size, &ctxt->exception); |
772 | if (unlikely(rc != X86EMUL_CONTINUE)) | 797 | if (unlikely(rc != X86EMUL_CONTINUE)) |
@@ -2012,7 +2037,7 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt) | |||
2012 | 2037 | ||
2013 | rc = assign_eip_far(ctxt, ctxt->src.val, new_desc.l); | 2038 | rc = assign_eip_far(ctxt, ctxt->src.val, new_desc.l); |
2014 | if (rc != X86EMUL_CONTINUE) { | 2039 | if (rc != X86EMUL_CONTINUE) { |
2015 | WARN_ON(!ctxt->mode != X86EMUL_MODE_PROT64); | 2040 | WARN_ON(ctxt->mode != X86EMUL_MODE_PROT64); |
2016 | /* assigning eip failed; restore the old cs */ | 2041 | /* assigning eip failed; restore the old cs */ |
2017 | ops->set_segment(ctxt, old_sel, &old_desc, 0, VCPU_SREG_CS); | 2042 | ops->set_segment(ctxt, old_sel, &old_desc, 0, VCPU_SREG_CS); |
2018 | return rc; | 2043 | return rc; |
@@ -2109,7 +2134,7 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) | |||
2109 | return rc; | 2134 | return rc; |
2110 | rc = assign_eip_far(ctxt, eip, new_desc.l); | 2135 | rc = assign_eip_far(ctxt, eip, new_desc.l); |
2111 | if (rc != X86EMUL_CONTINUE) { | 2136 | if (rc != X86EMUL_CONTINUE) { |
2112 | WARN_ON(!ctxt->mode != X86EMUL_MODE_PROT64); | 2137 | WARN_ON(ctxt->mode != X86EMUL_MODE_PROT64); |
2113 | ops->set_segment(ctxt, old_cs, &old_desc, 0, VCPU_SREG_CS); | 2138 | ops->set_segment(ctxt, old_cs, &old_desc, 0, VCPU_SREG_CS); |
2114 | } | 2139 | } |
2115 | return rc; | 2140 | return rc; |
@@ -4262,6 +4287,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, | |||
4262 | fetch_register_operand(op); | 4287 | fetch_register_operand(op); |
4263 | break; | 4288 | break; |
4264 | case OpCL: | 4289 | case OpCL: |
4290 | op->type = OP_IMM; | ||
4265 | op->bytes = 1; | 4291 | op->bytes = 1; |
4266 | op->val = reg_read(ctxt, VCPU_REGS_RCX) & 0xff; | 4292 | op->val = reg_read(ctxt, VCPU_REGS_RCX) & 0xff; |
4267 | break; | 4293 | break; |
@@ -4269,6 +4295,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, | |||
4269 | rc = decode_imm(ctxt, op, 1, true); | 4295 | rc = decode_imm(ctxt, op, 1, true); |
4270 | break; | 4296 | break; |
4271 | case OpOne: | 4297 | case OpOne: |
4298 | op->type = OP_IMM; | ||
4272 | op->bytes = 1; | 4299 | op->bytes = 1; |
4273 | op->val = 1; | 4300 | op->val = 1; |
4274 | break; | 4301 | break; |
@@ -4327,21 +4354,27 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, | |||
4327 | ctxt->memop.bytes = ctxt->op_bytes + 2; | 4354 | ctxt->memop.bytes = ctxt->op_bytes + 2; |
4328 | goto mem_common; | 4355 | goto mem_common; |
4329 | case OpES: | 4356 | case OpES: |
4357 | op->type = OP_IMM; | ||
4330 | op->val = VCPU_SREG_ES; | 4358 | op->val = VCPU_SREG_ES; |
4331 | break; | 4359 | break; |
4332 | case OpCS: | 4360 | case OpCS: |
4361 | op->type = OP_IMM; | ||
4333 | op->val = VCPU_SREG_CS; | 4362 | op->val = VCPU_SREG_CS; |
4334 | break; | 4363 | break; |
4335 | case OpSS: | 4364 | case OpSS: |
4365 | op->type = OP_IMM; | ||
4336 | op->val = VCPU_SREG_SS; | 4366 | op->val = VCPU_SREG_SS; |
4337 | break; | 4367 | break; |
4338 | case OpDS: | 4368 | case OpDS: |
4369 | op->type = OP_IMM; | ||
4339 | op->val = VCPU_SREG_DS; | 4370 | op->val = VCPU_SREG_DS; |
4340 | break; | 4371 | break; |
4341 | case OpFS: | 4372 | case OpFS: |
4373 | op->type = OP_IMM; | ||
4342 | op->val = VCPU_SREG_FS; | 4374 | op->val = VCPU_SREG_FS; |
4343 | break; | 4375 | break; |
4344 | case OpGS: | 4376 | case OpGS: |
4377 | op->type = OP_IMM; | ||
4345 | op->val = VCPU_SREG_GS; | 4378 | op->val = VCPU_SREG_GS; |
4346 | break; | 4379 | break; |
4347 | case OpImplicit: | 4380 | case OpImplicit: |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ac1c4de3a484..978f402006ee 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -630,7 +630,7 @@ static int mmu_spte_clear_track_bits(u64 *sptep) | |||
630 | * kvm mmu, before reclaiming the page, we should | 630 | * kvm mmu, before reclaiming the page, we should |
631 | * unmap it from mmu first. | 631 | * unmap it from mmu first. |
632 | */ | 632 | */ |
633 | WARN_ON(!kvm_is_mmio_pfn(pfn) && !page_count(pfn_to_page(pfn))); | 633 | WARN_ON(!kvm_is_reserved_pfn(pfn) && !page_count(pfn_to_page(pfn))); |
634 | 634 | ||
635 | if (!shadow_accessed_mask || old_spte & shadow_accessed_mask) | 635 | if (!shadow_accessed_mask || old_spte & shadow_accessed_mask) |
636 | kvm_set_pfn_accessed(pfn); | 636 | kvm_set_pfn_accessed(pfn); |
@@ -2461,7 +2461,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, | |||
2461 | spte |= PT_PAGE_SIZE_MASK; | 2461 | spte |= PT_PAGE_SIZE_MASK; |
2462 | if (tdp_enabled) | 2462 | if (tdp_enabled) |
2463 | spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, | 2463 | spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, |
2464 | kvm_is_mmio_pfn(pfn)); | 2464 | kvm_is_reserved_pfn(pfn)); |
2465 | 2465 | ||
2466 | if (host_writable) | 2466 | if (host_writable) |
2467 | spte |= SPTE_HOST_WRITEABLE; | 2467 | spte |= SPTE_HOST_WRITEABLE; |
@@ -2737,7 +2737,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu, | |||
2737 | * PT_PAGE_TABLE_LEVEL and there would be no adjustment done | 2737 | * PT_PAGE_TABLE_LEVEL and there would be no adjustment done |
2738 | * here. | 2738 | * here. |
2739 | */ | 2739 | */ |
2740 | if (!is_error_noslot_pfn(pfn) && !kvm_is_mmio_pfn(pfn) && | 2740 | if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn) && |
2741 | level == PT_PAGE_TABLE_LEVEL && | 2741 | level == PT_PAGE_TABLE_LEVEL && |
2742 | PageTransCompound(pfn_to_page(pfn)) && | 2742 | PageTransCompound(pfn_to_page(pfn)) && |
2743 | !has_wrprotected_page(vcpu->kvm, gfn, PT_DIRECTORY_LEVEL)) { | 2743 | !has_wrprotected_page(vcpu->kvm, gfn, PT_DIRECTORY_LEVEL)) { |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a8b76c4c95e2..3e556c68351b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -4579,7 +4579,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
4579 | vmcs_write32(TPR_THRESHOLD, 0); | 4579 | vmcs_write32(TPR_THRESHOLD, 0); |
4580 | } | 4580 | } |
4581 | 4581 | ||
4582 | kvm_vcpu_reload_apic_access_page(vcpu); | 4582 | kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu); |
4583 | 4583 | ||
4584 | if (vmx_vm_has_apicv(vcpu->kvm)) | 4584 | if (vmx_vm_has_apicv(vcpu->kvm)) |
4585 | memset(&vmx->pi_desc, 0, sizeof(struct pi_desc)); | 4585 | memset(&vmx->pi_desc, 0, sizeof(struct pi_desc)); |
@@ -6426,6 +6426,8 @@ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx) | |||
6426 | const unsigned long *fields = shadow_read_write_fields; | 6426 | const unsigned long *fields = shadow_read_write_fields; |
6427 | const int num_fields = max_shadow_read_write_fields; | 6427 | const int num_fields = max_shadow_read_write_fields; |
6428 | 6428 | ||
6429 | preempt_disable(); | ||
6430 | |||
6429 | vmcs_load(shadow_vmcs); | 6431 | vmcs_load(shadow_vmcs); |
6430 | 6432 | ||
6431 | for (i = 0; i < num_fields; i++) { | 6433 | for (i = 0; i < num_fields; i++) { |
@@ -6449,6 +6451,8 @@ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx) | |||
6449 | 6451 | ||
6450 | vmcs_clear(shadow_vmcs); | 6452 | vmcs_clear(shadow_vmcs); |
6451 | vmcs_load(vmx->loaded_vmcs->vmcs); | 6453 | vmcs_load(vmx->loaded_vmcs->vmcs); |
6454 | |||
6455 | preempt_enable(); | ||
6452 | } | 6456 | } |
6453 | 6457 | ||
6454 | static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx) | 6458 | static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx) |
diff --git a/arch/x86/lib/csum-wrappers_64.c b/arch/x86/lib/csum-wrappers_64.c index 7609e0e421ec..1318f75d56e4 100644 --- a/arch/x86/lib/csum-wrappers_64.c +++ b/arch/x86/lib/csum-wrappers_64.c | |||
@@ -41,9 +41,8 @@ csum_partial_copy_from_user(const void __user *src, void *dst, | |||
41 | while (((unsigned long)src & 6) && len >= 2) { | 41 | while (((unsigned long)src & 6) && len >= 2) { |
42 | __u16 val16; | 42 | __u16 val16; |
43 | 43 | ||
44 | *errp = __get_user(val16, (const __u16 __user *)src); | 44 | if (__get_user(val16, (const __u16 __user *)src)) |
45 | if (*errp) | 45 | goto out_err; |
46 | return isum; | ||
47 | 46 | ||
48 | *(__u16 *)dst = val16; | 47 | *(__u16 *)dst = val16; |
49 | isum = (__force __wsum)add32_with_carry( | 48 | isum = (__force __wsum)add32_with_carry( |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 4cb8763868fc..4e5dfec750fc 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -1123,7 +1123,7 @@ void mark_rodata_ro(void) | |||
1123 | unsigned long end = (unsigned long) &__end_rodata_hpage_align; | 1123 | unsigned long end = (unsigned long) &__end_rodata_hpage_align; |
1124 | unsigned long text_end = PFN_ALIGN(&__stop___ex_table); | 1124 | unsigned long text_end = PFN_ALIGN(&__stop___ex_table); |
1125 | unsigned long rodata_end = PFN_ALIGN(&__end_rodata); | 1125 | unsigned long rodata_end = PFN_ALIGN(&__end_rodata); |
1126 | unsigned long all_end = PFN_ALIGN(&_end); | 1126 | unsigned long all_end; |
1127 | 1127 | ||
1128 | printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", | 1128 | printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", |
1129 | (end - start) >> 10); | 1129 | (end - start) >> 10); |
@@ -1134,7 +1134,16 @@ void mark_rodata_ro(void) | |||
1134 | /* | 1134 | /* |
1135 | * The rodata/data/bss/brk section (but not the kernel text!) | 1135 | * The rodata/data/bss/brk section (but not the kernel text!) |
1136 | * should also be not-executable. | 1136 | * should also be not-executable. |
1137 | * | ||
1138 | * We align all_end to PMD_SIZE because the existing mapping | ||
1139 | * is a full PMD. If we would align _brk_end to PAGE_SIZE we | ||
1140 | * split the PMD and the reminder between _brk_end and the end | ||
1141 | * of the PMD will remain mapped executable. | ||
1142 | * | ||
1143 | * Any PMD which was setup after the one which covers _brk_end | ||
1144 | * has been zapped already via cleanup_highmem(). | ||
1137 | */ | 1145 | */ |
1146 | all_end = roundup((unsigned long)_brk_end, PMD_SIZE); | ||
1138 | set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); | 1147 | set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); |
1139 | 1148 | ||
1140 | rodata_test(); | 1149 | rodata_test(); |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index ae242a7c11c7..36de293caf25 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -409,7 +409,7 @@ phys_addr_t slow_virt_to_phys(void *__virt_addr) | |||
409 | psize = page_level_size(level); | 409 | psize = page_level_size(level); |
410 | pmask = page_level_mask(level); | 410 | pmask = page_level_mask(level); |
411 | offset = virt_addr & ~pmask; | 411 | offset = virt_addr & ~pmask; |
412 | phys_addr = pte_pfn(*pte) << PAGE_SHIFT; | 412 | phys_addr = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT; |
413 | return (phys_addr | offset); | 413 | return (phys_addr | offset); |
414 | } | 414 | } |
415 | EXPORT_SYMBOL_GPL(slow_virt_to_phys); | 415 | EXPORT_SYMBOL_GPL(slow_virt_to_phys); |
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c index 3c53a90fdb18..c14ad34776c4 100644 --- a/arch/x86/platform/intel-mid/sfi.c +++ b/arch/x86/platform/intel-mid/sfi.c | |||
@@ -106,6 +106,7 @@ int __init sfi_parse_mtmr(struct sfi_table_header *table) | |||
106 | mp_irq.dstapic = MP_APIC_ALL; | 106 | mp_irq.dstapic = MP_APIC_ALL; |
107 | mp_irq.dstirq = pentry->irq; | 107 | mp_irq.dstirq = pentry->irq; |
108 | mp_save_irq(&mp_irq); | 108 | mp_save_irq(&mp_irq); |
109 | mp_map_gsi_to_irq(pentry->irq, IOAPIC_MAP_ALLOC); | ||
109 | } | 110 | } |
110 | 111 | ||
111 | return 0; | 112 | return 0; |
@@ -176,6 +177,7 @@ int __init sfi_parse_mrtc(struct sfi_table_header *table) | |||
176 | mp_irq.dstapic = MP_APIC_ALL; | 177 | mp_irq.dstapic = MP_APIC_ALL; |
177 | mp_irq.dstirq = pentry->irq; | 178 | mp_irq.dstirq = pentry->irq; |
178 | mp_save_irq(&mp_irq); | 179 | mp_save_irq(&mp_irq); |
180 | mp_map_gsi_to_irq(pentry->irq, IOAPIC_MAP_ALLOC); | ||
179 | } | 181 | } |
180 | return 0; | 182 | return 0; |
181 | } | 183 | } |
diff --git a/arch/x86/tools/calc_run_size.pl b/arch/x86/tools/calc_run_size.pl new file mode 100644 index 000000000000..23210baade2d --- /dev/null +++ b/arch/x86/tools/calc_run_size.pl | |||
@@ -0,0 +1,39 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # Calculate the amount of space needed to run the kernel, including room for | ||
4 | # the .bss and .brk sections. | ||
5 | # | ||
6 | # Usage: | ||
7 | # objdump -h a.out | perl calc_run_size.pl | ||
8 | use strict; | ||
9 | |||
10 | my $mem_size = 0; | ||
11 | my $file_offset = 0; | ||
12 | |||
13 | my $sections=" *[0-9]+ \.(?:bss|brk) +"; | ||
14 | while (<>) { | ||
15 | if (/^$sections([0-9a-f]+) +(?:[0-9a-f]+ +){2}([0-9a-f]+)/) { | ||
16 | my $size = hex($1); | ||
17 | my $offset = hex($2); | ||
18 | $mem_size += $size; | ||
19 | if ($file_offset == 0) { | ||
20 | $file_offset = $offset; | ||
21 | } elsif ($file_offset != $offset) { | ||
22 | # BFD linker shows the same file offset in ELF. | ||
23 | # Gold linker shows them as consecutive. | ||
24 | next if ($file_offset + $mem_size == $offset + $size); | ||
25 | |||
26 | printf STDERR "file_offset: 0x%lx\n", $file_offset; | ||
27 | printf STDERR "mem_size: 0x%lx\n", $mem_size; | ||
28 | printf STDERR "offset: 0x%lx\n", $offset; | ||
29 | printf STDERR "size: 0x%lx\n", $size; | ||
30 | |||
31 | die ".bss and .brk are non-contiguous\n"; | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | |||
36 | if ($file_offset == 0) { | ||
37 | die "Never found .bss or .brk file offset\n"; | ||
38 | } | ||
39 | printf("%d\n", $mem_size + $file_offset); | ||
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 8650cdb53209..4c071aeb8417 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -510,6 +510,9 @@ static void xen_cpu_die(unsigned int cpu) | |||
510 | current->state = TASK_UNINTERRUPTIBLE; | 510 | current->state = TASK_UNINTERRUPTIBLE; |
511 | schedule_timeout(HZ/10); | 511 | schedule_timeout(HZ/10); |
512 | } | 512 | } |
513 | |||
514 | cpu_die_common(cpu); | ||
515 | |||
513 | xen_smp_intr_free(cpu); | 516 | xen_smp_intr_free(cpu); |
514 | xen_uninit_lock_cpu(cpu); | 517 | xen_uninit_lock_cpu(cpu); |
515 | xen_teardown_timer(cpu); | 518 | xen_teardown_timer(cpu); |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 49c6c3d94449..81f57e8c8f1b 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -319,8 +319,8 @@ config XTENSA_PLATFORM_S6105 | |||
319 | 319 | ||
320 | config XTENSA_PLATFORM_XTFPGA | 320 | config XTENSA_PLATFORM_XTFPGA |
321 | bool "XTFPGA" | 321 | bool "XTFPGA" |
322 | select ETHOC if ETHERNET | ||
322 | select SERIAL_CONSOLE | 323 | select SERIAL_CONSOLE |
323 | select ETHOC | ||
324 | select XTENSA_CALIBRATE_CCOUNT | 324 | select XTENSA_CALIBRATE_CCOUNT |
325 | help | 325 | help |
326 | XTFPGA is the name of Tensilica board family (LX60, LX110, LX200, ML605). | 326 | XTFPGA is the name of Tensilica board family (LX60, LX110, LX200, ML605). |
@@ -367,7 +367,7 @@ config BUILTIN_DTB | |||
367 | config BLK_DEV_SIMDISK | 367 | config BLK_DEV_SIMDISK |
368 | tristate "Host file-based simulated block device support" | 368 | tristate "Host file-based simulated block device support" |
369 | default n | 369 | default n |
370 | depends on XTENSA_PLATFORM_ISS | 370 | depends on XTENSA_PLATFORM_ISS && BLOCK |
371 | help | 371 | help |
372 | Create block devices that map to files in the host file system. | 372 | Create block devices that map to files in the host file system. |
373 | Device binding to host file may be changed at runtime via proc | 373 | Device binding to host file may be changed at runtime via proc |
diff --git a/arch/xtensa/boot/dts/lx200mx.dts b/arch/xtensa/boot/dts/lx200mx.dts new file mode 100644 index 000000000000..249822b99bd6 --- /dev/null +++ b/arch/xtensa/boot/dts/lx200mx.dts | |||
@@ -0,0 +1,16 @@ | |||
1 | /dts-v1/; | ||
2 | /include/ "xtfpga.dtsi" | ||
3 | /include/ "xtfpga-flash-16m.dtsi" | ||
4 | |||
5 | / { | ||
6 | compatible = "cdns,xtensa-lx200"; | ||
7 | memory@0 { | ||
8 | device_type = "memory"; | ||
9 | reg = <0x00000000 0x06000000>; | ||
10 | }; | ||
11 | pic: pic { | ||
12 | compatible = "cdns,xtensa-mx"; | ||
13 | #interrupt-cells = <2>; | ||
14 | interrupt-controller; | ||
15 | }; | ||
16 | }; | ||
diff --git a/arch/xtensa/configs/generic_kc705_defconfig b/arch/xtensa/configs/generic_kc705_defconfig new file mode 100644 index 000000000000..f4b7b3888da8 --- /dev/null +++ b/arch/xtensa/configs/generic_kc705_defconfig | |||
@@ -0,0 +1,131 @@ | |||
1 | CONFIG_SYSVIPC=y | ||
2 | CONFIG_POSIX_MQUEUE=y | ||
3 | CONFIG_FHANDLE=y | ||
4 | CONFIG_IRQ_DOMAIN_DEBUG=y | ||
5 | CONFIG_NO_HZ_IDLE=y | ||
6 | CONFIG_HIGH_RES_TIMERS=y | ||
7 | CONFIG_IRQ_TIME_ACCOUNTING=y | ||
8 | CONFIG_BSD_PROCESS_ACCT=y | ||
9 | CONFIG_CGROUP_DEBUG=y | ||
10 | CONFIG_CGROUP_FREEZER=y | ||
11 | CONFIG_CGROUP_DEVICE=y | ||
12 | CONFIG_CPUSETS=y | ||
13 | CONFIG_CGROUP_CPUACCT=y | ||
14 | CONFIG_RESOURCE_COUNTERS=y | ||
15 | CONFIG_MEMCG=y | ||
16 | CONFIG_NAMESPACES=y | ||
17 | CONFIG_SCHED_AUTOGROUP=y | ||
18 | CONFIG_RELAY=y | ||
19 | CONFIG_BLK_DEV_INITRD=y | ||
20 | CONFIG_EXPERT=y | ||
21 | CONFIG_SYSCTL_SYSCALL=y | ||
22 | CONFIG_KALLSYMS_ALL=y | ||
23 | CONFIG_PROFILING=y | ||
24 | CONFIG_OPROFILE=y | ||
25 | CONFIG_MODULES=y | ||
26 | CONFIG_MODULE_UNLOAD=y | ||
27 | # CONFIG_IOSCHED_DEADLINE is not set | ||
28 | # CONFIG_IOSCHED_CFQ is not set | ||
29 | CONFIG_XTENSA_VARIANT_DC233C=y | ||
30 | CONFIG_XTENSA_UNALIGNED_USER=y | ||
31 | CONFIG_PREEMPT=y | ||
32 | CONFIG_HIGHMEM=y | ||
33 | # CONFIG_PCI is not set | ||
34 | CONFIG_XTENSA_PLATFORM_XTFPGA=y | ||
35 | CONFIG_CMDLINE_BOOL=y | ||
36 | CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug" | ||
37 | CONFIG_USE_OF=y | ||
38 | CONFIG_BUILTIN_DTB="kc705" | ||
39 | # CONFIG_COMPACTION is not set | ||
40 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
41 | CONFIG_NET=y | ||
42 | CONFIG_PACKET=y | ||
43 | CONFIG_UNIX=y | ||
44 | CONFIG_INET=y | ||
45 | CONFIG_IP_MULTICAST=y | ||
46 | CONFIG_IP_PNP=y | ||
47 | CONFIG_IP_PNP_DHCP=y | ||
48 | CONFIG_IP_PNP_BOOTP=y | ||
49 | CONFIG_IP_PNP_RARP=y | ||
50 | # CONFIG_IPV6 is not set | ||
51 | CONFIG_NETFILTER=y | ||
52 | # CONFIG_WIRELESS is not set | ||
53 | CONFIG_DEVTMPFS=y | ||
54 | CONFIG_DEVTMPFS_MOUNT=y | ||
55 | # CONFIG_STANDALONE is not set | ||
56 | CONFIG_MTD=y | ||
57 | CONFIG_MTD_CFI=y | ||
58 | CONFIG_MTD_JEDECPROBE=y | ||
59 | CONFIG_MTD_CFI_INTELEXT=y | ||
60 | CONFIG_MTD_CFI_AMDSTD=y | ||
61 | CONFIG_MTD_CFI_STAA=y | ||
62 | CONFIG_MTD_PHYSMAP_OF=y | ||
63 | CONFIG_MTD_UBI=y | ||
64 | CONFIG_BLK_DEV_LOOP=y | ||
65 | CONFIG_BLK_DEV_RAM=y | ||
66 | CONFIG_SCSI=y | ||
67 | CONFIG_BLK_DEV_SD=y | ||
68 | CONFIG_NETDEVICES=y | ||
69 | # CONFIG_NET_VENDOR_ARC is not set | ||
70 | # CONFIG_NET_VENDOR_BROADCOM is not set | ||
71 | # CONFIG_NET_VENDOR_INTEL is not set | ||
72 | # CONFIG_NET_VENDOR_MARVELL is not set | ||
73 | # CONFIG_NET_VENDOR_MICREL is not set | ||
74 | # CONFIG_NET_VENDOR_NATSEMI is not set | ||
75 | # CONFIG_NET_VENDOR_SAMSUNG is not set | ||
76 | # CONFIG_NET_VENDOR_SEEQ is not set | ||
77 | # CONFIG_NET_VENDOR_SMSC is not set | ||
78 | # CONFIG_NET_VENDOR_STMICRO is not set | ||
79 | # CONFIG_NET_VENDOR_VIA is not set | ||
80 | # CONFIG_NET_VENDOR_WIZNET is not set | ||
81 | CONFIG_MARVELL_PHY=y | ||
82 | # CONFIG_WLAN is not set | ||
83 | # CONFIG_INPUT_MOUSEDEV is not set | ||
84 | # CONFIG_INPUT_KEYBOARD is not set | ||
85 | # CONFIG_INPUT_MOUSE is not set | ||
86 | # CONFIG_SERIO is not set | ||
87 | CONFIG_SERIAL_8250=y | ||
88 | # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set | ||
89 | CONFIG_SERIAL_8250_CONSOLE=y | ||
90 | CONFIG_SERIAL_OF_PLATFORM=y | ||
91 | CONFIG_HW_RANDOM=y | ||
92 | # CONFIG_HWMON is not set | ||
93 | CONFIG_WATCHDOG=y | ||
94 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
95 | CONFIG_SOFT_WATCHDOG=y | ||
96 | # CONFIG_VGA_CONSOLE is not set | ||
97 | # CONFIG_USB_SUPPORT is not set | ||
98 | # CONFIG_IOMMU_SUPPORT is not set | ||
99 | CONFIG_EXT3_FS=y | ||
100 | CONFIG_EXT4_FS=y | ||
101 | CONFIG_FANOTIFY=y | ||
102 | CONFIG_VFAT_FS=y | ||
103 | CONFIG_PROC_KCORE=y | ||
104 | CONFIG_TMPFS=y | ||
105 | CONFIG_TMPFS_POSIX_ACL=y | ||
106 | CONFIG_UBIFS_FS=y | ||
107 | CONFIG_NFS_FS=y | ||
108 | CONFIG_NFS_V4=y | ||
109 | CONFIG_NFS_SWAP=y | ||
110 | CONFIG_ROOT_NFS=y | ||
111 | CONFIG_SUNRPC_DEBUG=y | ||
112 | CONFIG_NLS_CODEPAGE_437=y | ||
113 | CONFIG_NLS_ISO8859_1=y | ||
114 | CONFIG_PRINTK_TIME=y | ||
115 | CONFIG_DYNAMIC_DEBUG=y | ||
116 | CONFIG_DEBUG_INFO=y | ||
117 | CONFIG_MAGIC_SYSRQ=y | ||
118 | CONFIG_LOCKUP_DETECTOR=y | ||
119 | # CONFIG_SCHED_DEBUG is not set | ||
120 | CONFIG_SCHEDSTATS=y | ||
121 | CONFIG_TIMER_STATS=y | ||
122 | CONFIG_DEBUG_RT_MUTEXES=y | ||
123 | CONFIG_DEBUG_SPINLOCK=y | ||
124 | CONFIG_DEBUG_MUTEXES=y | ||
125 | CONFIG_DEBUG_ATOMIC_SLEEP=y | ||
126 | CONFIG_STACKTRACE=y | ||
127 | CONFIG_RCU_TRACE=y | ||
128 | # CONFIG_FTRACE is not set | ||
129 | CONFIG_LD_NO_RELAX=y | ||
130 | # CONFIG_S32C1I_SELFTEST is not set | ||
131 | CONFIG_CRYPTO_ANSI_CPRNG=y | ||
diff --git a/arch/xtensa/configs/smp_lx200_defconfig b/arch/xtensa/configs/smp_lx200_defconfig new file mode 100644 index 000000000000..22eeacba37cc --- /dev/null +++ b/arch/xtensa/configs/smp_lx200_defconfig | |||
@@ -0,0 +1,135 @@ | |||
1 | CONFIG_SYSVIPC=y | ||
2 | CONFIG_POSIX_MQUEUE=y | ||
3 | CONFIG_FHANDLE=y | ||
4 | CONFIG_IRQ_DOMAIN_DEBUG=y | ||
5 | CONFIG_NO_HZ_IDLE=y | ||
6 | CONFIG_HIGH_RES_TIMERS=y | ||
7 | CONFIG_IRQ_TIME_ACCOUNTING=y | ||
8 | CONFIG_BSD_PROCESS_ACCT=y | ||
9 | CONFIG_CGROUP_DEBUG=y | ||
10 | CONFIG_CGROUP_FREEZER=y | ||
11 | CONFIG_CGROUP_DEVICE=y | ||
12 | CONFIG_CPUSETS=y | ||
13 | CONFIG_CGROUP_CPUACCT=y | ||
14 | CONFIG_RESOURCE_COUNTERS=y | ||
15 | CONFIG_MEMCG=y | ||
16 | CONFIG_NAMESPACES=y | ||
17 | CONFIG_SCHED_AUTOGROUP=y | ||
18 | CONFIG_RELAY=y | ||
19 | CONFIG_BLK_DEV_INITRD=y | ||
20 | CONFIG_EXPERT=y | ||
21 | CONFIG_SYSCTL_SYSCALL=y | ||
22 | CONFIG_KALLSYMS_ALL=y | ||
23 | CONFIG_PROFILING=y | ||
24 | CONFIG_OPROFILE=y | ||
25 | CONFIG_MODULES=y | ||
26 | CONFIG_MODULE_UNLOAD=y | ||
27 | # CONFIG_IOSCHED_DEADLINE is not set | ||
28 | # CONFIG_IOSCHED_CFQ is not set | ||
29 | CONFIG_XTENSA_VARIANT_CUSTOM=y | ||
30 | CONFIG_XTENSA_VARIANT_CUSTOM_NAME="test_mmuhifi_c3" | ||
31 | CONFIG_XTENSA_UNALIGNED_USER=y | ||
32 | CONFIG_PREEMPT=y | ||
33 | CONFIG_HAVE_SMP=y | ||
34 | CONFIG_SMP=y | ||
35 | CONFIG_HOTPLUG_CPU=y | ||
36 | # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set | ||
37 | # CONFIG_PCI is not set | ||
38 | CONFIG_XTENSA_PLATFORM_XTFPGA=y | ||
39 | CONFIG_CMDLINE_BOOL=y | ||
40 | CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug" | ||
41 | CONFIG_USE_OF=y | ||
42 | CONFIG_BUILTIN_DTB="lx200mx" | ||
43 | # CONFIG_COMPACTION is not set | ||
44 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
45 | CONFIG_NET=y | ||
46 | CONFIG_PACKET=y | ||
47 | CONFIG_UNIX=y | ||
48 | CONFIG_INET=y | ||
49 | CONFIG_IP_MULTICAST=y | ||
50 | CONFIG_IP_PNP=y | ||
51 | CONFIG_IP_PNP_DHCP=y | ||
52 | CONFIG_IP_PNP_BOOTP=y | ||
53 | CONFIG_IP_PNP_RARP=y | ||
54 | # CONFIG_IPV6 is not set | ||
55 | CONFIG_NETFILTER=y | ||
56 | # CONFIG_WIRELESS is not set | ||
57 | CONFIG_DEVTMPFS=y | ||
58 | CONFIG_DEVTMPFS_MOUNT=y | ||
59 | # CONFIG_STANDALONE is not set | ||
60 | CONFIG_MTD=y | ||
61 | CONFIG_MTD_CFI=y | ||
62 | CONFIG_MTD_JEDECPROBE=y | ||
63 | CONFIG_MTD_CFI_INTELEXT=y | ||
64 | CONFIG_MTD_CFI_AMDSTD=y | ||
65 | CONFIG_MTD_CFI_STAA=y | ||
66 | CONFIG_MTD_PHYSMAP_OF=y | ||
67 | CONFIG_MTD_UBI=y | ||
68 | CONFIG_BLK_DEV_LOOP=y | ||
69 | CONFIG_BLK_DEV_RAM=y | ||
70 | CONFIG_SCSI=y | ||
71 | CONFIG_BLK_DEV_SD=y | ||
72 | CONFIG_NETDEVICES=y | ||
73 | # CONFIG_NET_VENDOR_ARC is not set | ||
74 | # CONFIG_NET_VENDOR_BROADCOM is not set | ||
75 | # CONFIG_NET_VENDOR_INTEL is not set | ||
76 | # CONFIG_NET_VENDOR_MARVELL is not set | ||
77 | # CONFIG_NET_VENDOR_MICREL is not set | ||
78 | # CONFIG_NET_VENDOR_NATSEMI is not set | ||
79 | # CONFIG_NET_VENDOR_SAMSUNG is not set | ||
80 | # CONFIG_NET_VENDOR_SEEQ is not set | ||
81 | # CONFIG_NET_VENDOR_SMSC is not set | ||
82 | # CONFIG_NET_VENDOR_STMICRO is not set | ||
83 | # CONFIG_NET_VENDOR_VIA is not set | ||
84 | # CONFIG_NET_VENDOR_WIZNET is not set | ||
85 | CONFIG_MARVELL_PHY=y | ||
86 | # CONFIG_WLAN is not set | ||
87 | # CONFIG_INPUT_MOUSEDEV is not set | ||
88 | # CONFIG_INPUT_KEYBOARD is not set | ||
89 | # CONFIG_INPUT_MOUSE is not set | ||
90 | # CONFIG_SERIO is not set | ||
91 | CONFIG_SERIAL_8250=y | ||
92 | # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set | ||
93 | CONFIG_SERIAL_8250_CONSOLE=y | ||
94 | CONFIG_SERIAL_OF_PLATFORM=y | ||
95 | CONFIG_HW_RANDOM=y | ||
96 | # CONFIG_HWMON is not set | ||
97 | CONFIG_WATCHDOG=y | ||
98 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
99 | CONFIG_SOFT_WATCHDOG=y | ||
100 | # CONFIG_VGA_CONSOLE is not set | ||
101 | # CONFIG_USB_SUPPORT is not set | ||
102 | # CONFIG_IOMMU_SUPPORT is not set | ||
103 | CONFIG_EXT3_FS=y | ||
104 | CONFIG_EXT4_FS=y | ||
105 | CONFIG_FANOTIFY=y | ||
106 | CONFIG_VFAT_FS=y | ||
107 | CONFIG_PROC_KCORE=y | ||
108 | CONFIG_TMPFS=y | ||
109 | CONFIG_TMPFS_POSIX_ACL=y | ||
110 | CONFIG_UBIFS_FS=y | ||
111 | CONFIG_NFS_FS=y | ||
112 | CONFIG_NFS_V4=y | ||
113 | CONFIG_NFS_SWAP=y | ||
114 | CONFIG_ROOT_NFS=y | ||
115 | CONFIG_SUNRPC_DEBUG=y | ||
116 | CONFIG_NLS_CODEPAGE_437=y | ||
117 | CONFIG_NLS_ISO8859_1=y | ||
118 | CONFIG_PRINTK_TIME=y | ||
119 | CONFIG_DYNAMIC_DEBUG=y | ||
120 | CONFIG_DEBUG_INFO=y | ||
121 | CONFIG_MAGIC_SYSRQ=y | ||
122 | CONFIG_DEBUG_VM=y | ||
123 | CONFIG_LOCKUP_DETECTOR=y | ||
124 | CONFIG_SCHEDSTATS=y | ||
125 | CONFIG_TIMER_STATS=y | ||
126 | CONFIG_DEBUG_RT_MUTEXES=y | ||
127 | CONFIG_DEBUG_SPINLOCK=y | ||
128 | CONFIG_DEBUG_MUTEXES=y | ||
129 | CONFIG_DEBUG_ATOMIC_SLEEP=y | ||
130 | CONFIG_STACKTRACE=y | ||
131 | CONFIG_RCU_TRACE=y | ||
132 | # CONFIG_FTRACE is not set | ||
133 | CONFIG_LD_NO_RELAX=y | ||
134 | # CONFIG_S32C1I_SELFTEST is not set | ||
135 | CONFIG_CRYPTO_ANSI_CPRNG=y | ||
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h index b2173e5da601..0383aed59121 100644 --- a/arch/xtensa/include/asm/pgtable.h +++ b/arch/xtensa/include/asm/pgtable.h | |||
@@ -277,6 +277,8 @@ static inline pte_t pte_mkwrite(pte_t pte) | |||
277 | static inline pte_t pte_mkspecial(pte_t pte) | 277 | static inline pte_t pte_mkspecial(pte_t pte) |
278 | { return pte; } | 278 | { return pte; } |
279 | 279 | ||
280 | #define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) & ~_PAGE_CA_MASK)) | ||
281 | |||
280 | /* | 282 | /* |
281 | * Conversion functions: convert a page and protection to a page entry, | 283 | * Conversion functions: convert a page and protection to a page entry, |
282 | * and a page entry and page directory to the page they refer to. | 284 | * and a page entry and page directory to the page they refer to. |
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h index 8883fc877c5c..db5bb72e2f4e 100644 --- a/arch/xtensa/include/uapi/asm/unistd.h +++ b/arch/xtensa/include/uapi/asm/unistd.h | |||
@@ -384,7 +384,8 @@ __SYSCALL(174, sys_chroot, 1) | |||
384 | #define __NR_pivot_root 175 | 384 | #define __NR_pivot_root 175 |
385 | __SYSCALL(175, sys_pivot_root, 2) | 385 | __SYSCALL(175, sys_pivot_root, 2) |
386 | #define __NR_umount 176 | 386 | #define __NR_umount 176 |
387 | __SYSCALL(176, sys_umount, 2) | 387 | __SYSCALL(176, sys_oldumount, 1) |
388 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
388 | #define __NR_swapoff 177 | 389 | #define __NR_swapoff 177 |
389 | __SYSCALL(177, sys_swapoff, 1) | 390 | __SYSCALL(177, sys_swapoff, 1) |
390 | #define __NR_sync 178 | 391 | #define __NR_sync 178 |
@@ -742,7 +743,14 @@ __SYSCALL(335, sys_sched_getattr, 3) | |||
742 | #define __NR_renameat2 336 | 743 | #define __NR_renameat2 336 |
743 | __SYSCALL(336, sys_renameat2, 5) | 744 | __SYSCALL(336, sys_renameat2, 5) |
744 | 745 | ||
745 | #define __NR_syscall_count 337 | 746 | #define __NR_seccomp 337 |
747 | __SYSCALL(337, sys_seccomp, 3) | ||
748 | #define __NR_getrandom 338 | ||
749 | __SYSCALL(338, sys_getrandom, 3) | ||
750 | #define __NR_memfd_create 339 | ||
751 | __SYSCALL(339, sys_memfd_create, 2) | ||
752 | |||
753 | #define __NR_syscall_count 340 | ||
746 | 754 | ||
747 | /* | 755 | /* |
748 | * sysxtensa syscall handler | 756 | * sysxtensa syscall handler |