diff options
429 files changed, 3756 insertions, 2818 deletions
diff --git a/Documentation/devicetree/bindings/arm/armada-38x.txt b/Documentation/devicetree/bindings/arm/armada-38x.txt index 11f2330a6554..ad9f8ed4d9bd 100644 --- a/Documentation/devicetree/bindings/arm/armada-38x.txt +++ b/Documentation/devicetree/bindings/arm/armada-38x.txt | |||
| @@ -6,5 +6,15 @@ following property: | |||
| 6 | 6 | ||
| 7 | Required root node property: | 7 | Required root node property: |
| 8 | 8 | ||
| 9 | - compatible: must contain either "marvell,armada380" or | 9 | - compatible: must contain "marvell,armada380" |
| 10 | "marvell,armada385" depending on the variant of the SoC being used. | 10 | |
| 11 | In addition, boards using the Marvell Armada 385 SoC shall have the | ||
| 12 | following property before the previous one: | ||
| 13 | |||
| 14 | Required root node property: | ||
| 15 | |||
| 16 | compatible: must contain "marvell,armada385" | ||
| 17 | |||
| 18 | Example: | ||
| 19 | |||
| 20 | compatible = "marvell,a385-rd", "marvell,armada385", "marvell,armada380"; | ||
diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt index b513cb8196fe..af527ee111c2 100644 --- a/Documentation/devicetree/bindings/arm/l2cc.txt +++ b/Documentation/devicetree/bindings/arm/l2cc.txt | |||
| @@ -40,6 +40,9 @@ Optional properties: | |||
| 40 | - arm,filter-ranges : <start length> Starting address and length of window to | 40 | - arm,filter-ranges : <start length> Starting address and length of window to |
| 41 | filter. Addresses in the filter window are directed to the M1 port. Other | 41 | filter. Addresses in the filter window are directed to the M1 port. Other |
| 42 | addresses will go to the M0 port. | 42 | addresses will go to the M0 port. |
| 43 | - arm,io-coherent : indicates that the system is operating in an hardware | ||
| 44 | I/O coherent mode. Valid only when the arm,pl310-cache compatible | ||
| 45 | string is used. | ||
| 43 | - interrupts : 1 combined interrupt. | 46 | - interrupts : 1 combined interrupt. |
| 44 | - cache-id-part: cache id part number to be used if it is not present | 47 | - cache-id-part: cache id part number to be used if it is not present |
| 45 | on hardware | 48 | on hardware |
diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt index 5d49f2b37f68..832fe8cc24d7 100644 --- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt | |||
| @@ -48,7 +48,7 @@ adc@12D10000 { | |||
| 48 | 48 | ||
| 49 | /* NTC thermistor is a hwmon device */ | 49 | /* NTC thermistor is a hwmon device */ |
| 50 | ncp15wb473@0 { | 50 | ncp15wb473@0 { |
| 51 | compatible = "ntc,ncp15wb473"; | 51 | compatible = "murata,ncp15wb473"; |
| 52 | pullup-uv = <1800000>; | 52 | pullup-uv = <1800000>; |
| 53 | pullup-ohm = <47000>; | 53 | pullup-ohm = <47000>; |
| 54 | pulldown-ohm = <0>; | 54 | pulldown-ohm = <0>; |
diff --git a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt index c6f66674f19c..b117b2e9e1a7 100644 --- a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt +++ b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt | |||
| @@ -3,11 +3,19 @@ NTC Thermistor hwmon sensors | |||
| 3 | 3 | ||
| 4 | Requires node properties: | 4 | Requires node properties: |
| 5 | - "compatible" value : one of | 5 | - "compatible" value : one of |
| 6 | "ntc,ncp15wb473" | 6 | "murata,ncp15wb473" |
| 7 | "ntc,ncp18wb473" | 7 | "murata,ncp18wb473" |
| 8 | "ntc,ncp21wb473" | 8 | "murata,ncp21wb473" |
| 9 | "ntc,ncp03wb473" | 9 | "murata,ncp03wb473" |
| 10 | "ntc,ncp15wl333" | 10 | "murata,ncp15wl333" |
| 11 | |||
| 12 | /* Usage of vendor name "ntc" is deprecated */ | ||
| 13 | <DEPRECATED> "ntc,ncp15wb473" | ||
| 14 | <DEPRECATED> "ntc,ncp18wb473" | ||
| 15 | <DEPRECATED> "ntc,ncp21wb473" | ||
| 16 | <DEPRECATED> "ntc,ncp03wb473" | ||
| 17 | <DEPRECATED> "ntc,ncp15wl333" | ||
| 18 | |||
| 11 | - "pullup-uv" Pull up voltage in micro volts | 19 | - "pullup-uv" Pull up voltage in micro volts |
| 12 | - "pullup-ohm" Pull up resistor value in ohms | 20 | - "pullup-ohm" Pull up resistor value in ohms |
| 13 | - "pulldown-ohm" Pull down resistor value in ohms | 21 | - "pulldown-ohm" Pull down resistor value in ohms |
| @@ -21,7 +29,7 @@ Read more about iio bindings at | |||
| 21 | 29 | ||
| 22 | Example: | 30 | Example: |
| 23 | ncp15wb473@0 { | 31 | ncp15wb473@0 { |
| 24 | compatible = "ntc,ncp15wb473"; | 32 | compatible = "murata,ncp15wb473"; |
| 25 | pullup-uv = <1800000>; | 33 | pullup-uv = <1800000>; |
| 26 | pullup-ohm = <47000>; | 34 | pullup-ohm = <47000>; |
| 27 | pulldown-ohm = <0>; | 35 | pulldown-ohm = <0>; |
diff --git a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt index b82a268f1bd4..bee6ff204baf 100644 --- a/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt +++ b/Documentation/devicetree/bindings/spi/qcom,spi-qup.txt | |||
| @@ -23,6 +23,12 @@ Optional properties: | |||
| 23 | - spi-max-frequency: Specifies maximum SPI clock frequency, | 23 | - spi-max-frequency: Specifies maximum SPI clock frequency, |
| 24 | Units - Hz. Definition as per | 24 | Units - Hz. Definition as per |
| 25 | Documentation/devicetree/bindings/spi/spi-bus.txt | 25 | Documentation/devicetree/bindings/spi/spi-bus.txt |
| 26 | - num-cs: total number of chipselects | ||
| 27 | - cs-gpios: should specify GPIOs used for chipselects. | ||
| 28 | The gpios will be referred to as reg = <index> in the SPI child | ||
| 29 | nodes. If unspecified, a single SPI device without a chip | ||
| 30 | select can be used. | ||
| 31 | |||
| 26 | 32 | ||
| 27 | SPI slave nodes must be children of the SPI master node and can contain | 33 | SPI slave nodes must be children of the SPI master node and can contain |
| 28 | properties described in Documentation/devicetree/bindings/spi/spi-bus.txt | 34 | properties described in Documentation/devicetree/bindings/spi/spi-bus.txt |
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index 4d7f3758d1b4..46a311e728a8 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
| @@ -83,6 +83,7 @@ mosaixtech Mosaix Technologies, Inc. | |||
| 83 | moxa Moxa | 83 | moxa Moxa |
| 84 | mpl MPL AG | 84 | mpl MPL AG |
| 85 | mundoreader Mundo Reader S.L. | 85 | mundoreader Mundo Reader S.L. |
| 86 | murata Murata Manufacturing Co., Ltd. | ||
| 86 | mxicy Macronix International Co., Ltd. | 87 | mxicy Macronix International Co., Ltd. |
| 87 | national National Semiconductor | 88 | national National Semiconductor |
| 88 | neonode Neonode Inc. | 89 | neonode Neonode Inc. |
diff --git a/Documentation/email-clients.txt b/Documentation/email-clients.txt index 4e30ebaa9e5b..9af538be3751 100644 --- a/Documentation/email-clients.txt +++ b/Documentation/email-clients.txt | |||
| @@ -1,6 +1,17 @@ | |||
| 1 | Email clients info for Linux | 1 | Email clients info for Linux |
| 2 | ====================================================================== | 2 | ====================================================================== |
| 3 | 3 | ||
| 4 | Git | ||
| 5 | ---------------------------------------------------------------------- | ||
| 6 | These days most developers use `git send-email` instead of regular | ||
| 7 | email clients. The man page for this is quite good. On the receiving | ||
| 8 | end, maintainers use `git am` to apply the patches. | ||
| 9 | |||
| 10 | If you are new to git then send your first patch to yourself. Save it | ||
| 11 | as raw text including all the headers. Run `git am raw_email.txt` and | ||
| 12 | then review the changelog with `git log`. When that works then send | ||
| 13 | the patch to the appropriate mailing list(s). | ||
| 14 | |||
| 4 | General Preferences | 15 | General Preferences |
| 5 | ---------------------------------------------------------------------- | 16 | ---------------------------------------------------------------------- |
| 6 | Patches for the Linux kernel are submitted via email, preferably as | 17 | Patches for the Linux kernel are submitted via email, preferably as |
diff --git a/Documentation/hwmon/ntc_thermistor b/Documentation/hwmon/ntc_thermistor index 3bfda94096fd..057b77029f26 100644 --- a/Documentation/hwmon/ntc_thermistor +++ b/Documentation/hwmon/ntc_thermistor | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | Kernel driver ntc_thermistor | 1 | Kernel driver ntc_thermistor |
| 2 | ================= | 2 | ================= |
| 3 | 3 | ||
| 4 | Supported thermistors: | 4 | Supported thermistors from Murata: |
| 5 | * Murata NTC Thermistors NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, NCP15WL333 | 5 | * Murata NTC Thermistors NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, NCP15WL333 |
| 6 | Prefixes: 'ncp15wb473', 'ncp18wb473', 'ncp21wb473', 'ncp03wb473', 'ncp15wl333' | 6 | Prefixes: 'ncp15wb473', 'ncp18wb473', 'ncp21wb473', 'ncp03wb473', 'ncp15wl333' |
| 7 | Datasheet: Publicly available at Murata | 7 | Datasheet: Publicly available at Murata |
| @@ -15,9 +15,9 @@ Authors: | |||
| 15 | Description | 15 | Description |
| 16 | ----------- | 16 | ----------- |
| 17 | 17 | ||
| 18 | The NTC thermistor is a simple thermistor that requires users to provide the | 18 | The NTC (Negative Temperature Coefficient) thermistor is a simple thermistor |
| 19 | resistance and lookup the corresponding compensation table to get the | 19 | that requires users to provide the resistance and lookup the corresponding |
| 20 | temperature input. | 20 | compensation table to get the temperature input. |
| 21 | 21 | ||
| 22 | The NTC driver provides lookup tables with a linear approximation function | 22 | The NTC driver provides lookup tables with a linear approximation function |
| 23 | and four circuit models with an option not to use any of the four models. | 23 | and four circuit models with an option not to use any of the four models. |
diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c index f1ac2dae999e..ba1d50200c46 100644 --- a/Documentation/ptp/testptp.c +++ b/Documentation/ptp/testptp.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | */ | 19 | */ |
| 20 | #define _GNU_SOURCE | ||
| 20 | #include <errno.h> | 21 | #include <errno.h> |
| 21 | #include <fcntl.h> | 22 | #include <fcntl.h> |
| 22 | #include <inttypes.h> | 23 | #include <inttypes.h> |
| @@ -46,12 +47,14 @@ | |||
| 46 | #define CLOCK_INVALID -1 | 47 | #define CLOCK_INVALID -1 |
| 47 | #endif | 48 | #endif |
| 48 | 49 | ||
| 49 | /* When glibc offers the syscall, this will go away. */ | 50 | /* clock_adjtime is not available in GLIBC < 2.14 */ |
| 51 | #if !__GLIBC_PREREQ(2, 14) | ||
| 50 | #include <sys/syscall.h> | 52 | #include <sys/syscall.h> |
| 51 | static int clock_adjtime(clockid_t id, struct timex *tx) | 53 | static int clock_adjtime(clockid_t id, struct timex *tx) |
| 52 | { | 54 | { |
| 53 | return syscall(__NR_clock_adjtime, id, tx); | 55 | return syscall(__NR_clock_adjtime, id, tx); |
| 54 | } | 56 | } |
| 57 | #endif | ||
| 55 | 58 | ||
| 56 | static clockid_t get_clockid(int fd) | 59 | static clockid_t get_clockid(int fd) |
| 57 | { | 60 | { |
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 85c362d8ea34..d1ab5e17eb13 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt | |||
| @@ -286,6 +286,11 @@ STAC92HD83* | |||
| 286 | hp-inv-led HP with broken BIOS for inverted mute LED | 286 | hp-inv-led HP with broken BIOS for inverted mute LED |
| 287 | auto BIOS setup (default) | 287 | auto BIOS setup (default) |
| 288 | 288 | ||
| 289 | STAC92HD95 | ||
| 290 | ========== | ||
| 291 | hp-led LED support for HP laptops | ||
| 292 | hp-bass Bass HPF setup for HP Spectre 13 | ||
| 293 | |||
| 289 | STAC9872 | 294 | STAC9872 |
| 290 | ======== | 295 | ======== |
| 291 | vaio VAIO laptop without SPDIF | 296 | vaio VAIO laptop without SPDIF |
diff --git a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl index 00e425faa2fd..78c9a7b2b58f 100644 --- a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl +++ b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl | |||
| @@ -47,7 +47,6 @@ use constant HIGH_KSWAPD_REWAKEUP => 21; | |||
| 47 | use constant HIGH_NR_SCANNED => 22; | 47 | use constant HIGH_NR_SCANNED => 22; |
| 48 | use constant HIGH_NR_TAKEN => 23; | 48 | use constant HIGH_NR_TAKEN => 23; |
| 49 | use constant HIGH_NR_RECLAIMED => 24; | 49 | use constant HIGH_NR_RECLAIMED => 24; |
| 50 | use constant HIGH_NR_CONTIG_DIRTY => 25; | ||
| 51 | 50 | ||
| 52 | my %perprocesspid; | 51 | my %perprocesspid; |
| 53 | my %perprocess; | 52 | my %perprocess; |
| @@ -105,7 +104,7 @@ my $regex_direct_end_default = 'nr_reclaimed=([0-9]*)'; | |||
| 105 | my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)'; | 104 | my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)'; |
| 106 | my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; | 105 | my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; |
| 107 | my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)'; | 106 | my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)'; |
| 108 | my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) contig_taken=([0-9]*) contig_dirty=([0-9]*) contig_failed=([0-9]*)'; | 107 | my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) file=([0-9]*)'; |
| 109 | my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) zid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)'; | 108 | my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) zid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)'; |
| 110 | my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; | 109 | my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; |
| 111 | my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; | 110 | my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; |
| @@ -200,7 +199,7 @@ $regex_lru_isolate = generate_traceevent_regex( | |||
| 200 | $regex_lru_isolate_default, | 199 | $regex_lru_isolate_default, |
| 201 | "isolate_mode", "order", | 200 | "isolate_mode", "order", |
| 202 | "nr_requested", "nr_scanned", "nr_taken", | 201 | "nr_requested", "nr_scanned", "nr_taken", |
| 203 | "contig_taken", "contig_dirty", "contig_failed"); | 202 | "file"); |
| 204 | $regex_lru_shrink_inactive = generate_traceevent_regex( | 203 | $regex_lru_shrink_inactive = generate_traceevent_regex( |
| 205 | "vmscan/mm_vmscan_lru_shrink_inactive", | 204 | "vmscan/mm_vmscan_lru_shrink_inactive", |
| 206 | $regex_lru_shrink_inactive_default, | 205 | $regex_lru_shrink_inactive_default, |
| @@ -375,7 +374,6 @@ EVENT_PROCESS: | |||
| 375 | } | 374 | } |
| 376 | my $isolate_mode = $1; | 375 | my $isolate_mode = $1; |
| 377 | my $nr_scanned = $4; | 376 | my $nr_scanned = $4; |
| 378 | my $nr_contig_dirty = $7; | ||
| 379 | 377 | ||
| 380 | # To closer match vmstat scanning statistics, only count isolate_both | 378 | # To closer match vmstat scanning statistics, only count isolate_both |
| 381 | # and isolate_inactive as scanning. isolate_active is rotation | 379 | # and isolate_inactive as scanning. isolate_active is rotation |
| @@ -385,7 +383,6 @@ EVENT_PROCESS: | |||
| 385 | if ($isolate_mode != 2) { | 383 | if ($isolate_mode != 2) { |
| 386 | $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; | 384 | $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; |
| 387 | } | 385 | } |
| 388 | $perprocesspid{$process_pid}->{HIGH_NR_CONTIG_DIRTY} += $nr_contig_dirty; | ||
| 389 | } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { | 386 | } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { |
| 390 | $details = $6; | 387 | $details = $6; |
| 391 | if ($details !~ /$regex_lru_shrink_inactive/o) { | 388 | if ($details !~ /$regex_lru_shrink_inactive/o) { |
| @@ -539,13 +536,6 @@ sub dump_stats { | |||
| 539 | } | 536 | } |
| 540 | } | 537 | } |
| 541 | } | 538 | } |
| 542 | if ($stats{$process_pid}->{HIGH_NR_CONTIG_DIRTY}) { | ||
| 543 | print " "; | ||
| 544 | my $count = $stats{$process_pid}->{HIGH_NR_CONTIG_DIRTY}; | ||
| 545 | if ($count != 0) { | ||
| 546 | print "contig-dirty=$count "; | ||
| 547 | } | ||
| 548 | } | ||
| 549 | 539 | ||
| 550 | print "\n"; | 540 | print "\n"; |
| 551 | } | 541 | } |
diff --git a/MAINTAINERS b/MAINTAINERS index 636a51af0770..6813d0aa5ecf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -943,16 +943,10 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | |||
| 943 | S: Maintained | 943 | S: Maintained |
| 944 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git | 944 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git |
| 945 | F: arch/arm/mach-imx/ | 945 | F: arch/arm/mach-imx/ |
| 946 | F: arch/arm/mach-mxs/ | ||
| 946 | F: arch/arm/boot/dts/imx* | 947 | F: arch/arm/boot/dts/imx* |
| 947 | F: arch/arm/configs/imx*_defconfig | 948 | F: arch/arm/configs/imx*_defconfig |
| 948 | 949 | ||
| 949 | ARM/FREESCALE MXS ARM ARCHITECTURE | ||
| 950 | M: Shawn Guo <shawn.guo@linaro.org> | ||
| 951 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
| 952 | S: Maintained | ||
| 953 | T: git git://git.linaro.org/people/shawnguo/linux-2.6.git | ||
| 954 | F: arch/arm/mach-mxs/ | ||
| 955 | |||
| 956 | ARM/GLOMATION GESBC9312SX MACHINE SUPPORT | 950 | ARM/GLOMATION GESBC9312SX MACHINE SUPPORT |
| 957 | M: Lennert Buytenhek <kernel@wantstofly.org> | 951 | M: Lennert Buytenhek <kernel@wantstofly.org> |
| 958 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 952 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| @@ -1052,9 +1046,33 @@ M: Santosh Shilimkar <santosh.shilimkar@ti.com> | |||
| 1052 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1046 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1053 | S: Maintained | 1047 | S: Maintained |
| 1054 | F: arch/arm/mach-keystone/ | 1048 | F: arch/arm/mach-keystone/ |
| 1055 | F: drivers/clk/keystone/ | ||
| 1056 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git | 1049 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git |
| 1057 | 1050 | ||
| 1051 | ARM/TEXAS INSTRUMENT KEYSTONE CLOCK FRAMEWORK | ||
| 1052 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
| 1053 | L: linux-kernel@vger.kernel.org | ||
| 1054 | S: Maintained | ||
| 1055 | F: drivers/clk/keystone/ | ||
| 1056 | |||
| 1057 | ARM/TEXAS INSTRUMENT KEYSTONE ClOCKSOURCE | ||
| 1058 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
| 1059 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
| 1060 | L: linux-kernel@vger.kernel.org | ||
| 1061 | S: Maintained | ||
| 1062 | F: drivers/clocksource/timer-keystone.c | ||
| 1063 | |||
| 1064 | ARM/TEXAS INSTRUMENT KEYSTONE RESET DRIVER | ||
| 1065 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
| 1066 | L: linux-kernel@vger.kernel.org | ||
| 1067 | S: Maintained | ||
| 1068 | F: drivers/power/reset/keystone-reset.c | ||
| 1069 | |||
| 1070 | ARM/TEXAS INSTRUMENT AEMIF/EMIF DRIVERS | ||
| 1071 | M: Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
| 1072 | L: linux-kernel@vger.kernel.org | ||
| 1073 | S: Maintained | ||
| 1074 | F: drivers/memory/*emif* | ||
| 1075 | |||
| 1058 | ARM/LOGICPD PXA270 MACHINE SUPPORT | 1076 | ARM/LOGICPD PXA270 MACHINE SUPPORT |
| 1059 | M: Lennert Buytenhek <kernel@wantstofly.org> | 1077 | M: Lennert Buytenhek <kernel@wantstofly.org> |
| 1060 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1078 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| @@ -2917,6 +2935,9 @@ L: linux-doc@vger.kernel.org | |||
| 2917 | T: quilt http://www.infradead.org/~rdunlap/Doc/patches/ | 2935 | T: quilt http://www.infradead.org/~rdunlap/Doc/patches/ |
| 2918 | S: Maintained | 2936 | S: Maintained |
| 2919 | F: Documentation/ | 2937 | F: Documentation/ |
| 2938 | X: Documentation/ABI/ | ||
| 2939 | X: Documentation/devicetree/ | ||
| 2940 | X: Documentation/[a-z][a-z]_[A-Z][A-Z]/ | ||
| 2920 | 2941 | ||
| 2921 | DOUBLETALK DRIVER | 2942 | DOUBLETALK DRIVER |
| 2922 | M: "James R. Van Zandt" <jrv@vanzandt.mv.com> | 2943 | M: "James R. Van Zandt" <jrv@vanzandt.mv.com> |
| @@ -3189,14 +3210,6 @@ L: linux-scsi@vger.kernel.org | |||
| 3189 | S: Maintained | 3210 | S: Maintained |
| 3190 | F: drivers/scsi/eata_pio.* | 3211 | F: drivers/scsi/eata_pio.* |
| 3191 | 3212 | ||
| 3192 | EBTABLES | ||
| 3193 | L: netfilter-devel@vger.kernel.org | ||
| 3194 | W: http://ebtables.sourceforge.net/ | ||
| 3195 | S: Orphan | ||
| 3196 | F: include/linux/netfilter_bridge/ebt_*.h | ||
| 3197 | F: include/uapi/linux/netfilter_bridge/ebt_*.h | ||
| 3198 | F: net/bridge/netfilter/ebt*.c | ||
| 3199 | |||
| 3200 | EC100 MEDIA DRIVER | 3213 | EC100 MEDIA DRIVER |
| 3201 | M: Antti Palosaari <crope@iki.fi> | 3214 | M: Antti Palosaari <crope@iki.fi> |
| 3202 | L: linux-media@vger.kernel.org | 3215 | L: linux-media@vger.kernel.org |
| @@ -6106,12 +6119,11 @@ F: Documentation/networking/s2io.txt | |||
| 6106 | F: Documentation/networking/vxge.txt | 6119 | F: Documentation/networking/vxge.txt |
| 6107 | F: drivers/net/ethernet/neterion/ | 6120 | F: drivers/net/ethernet/neterion/ |
| 6108 | 6121 | ||
| 6109 | NETFILTER/IPTABLES | 6122 | NETFILTER ({IP,IP6,ARP,EB,NF}TABLES) |
| 6110 | M: Pablo Neira Ayuso <pablo@netfilter.org> | 6123 | M: Pablo Neira Ayuso <pablo@netfilter.org> |
| 6111 | M: Patrick McHardy <kaber@trash.net> | 6124 | M: Patrick McHardy <kaber@trash.net> |
| 6112 | M: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 6125 | M: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> |
| 6113 | L: netfilter-devel@vger.kernel.org | 6126 | L: netfilter-devel@vger.kernel.org |
| 6114 | L: netfilter@vger.kernel.org | ||
| 6115 | L: coreteam@netfilter.org | 6127 | L: coreteam@netfilter.org |
| 6116 | W: http://www.netfilter.org/ | 6128 | W: http://www.netfilter.org/ |
| 6117 | W: http://www.iptables.org/ | 6129 | W: http://www.iptables.org/ |
| @@ -9413,12 +9425,6 @@ S: Maintained | |||
| 9413 | F: drivers/usb/host/isp116x* | 9425 | F: drivers/usb/host/isp116x* |
| 9414 | F: include/linux/usb/isp116x.h | 9426 | F: include/linux/usb/isp116x.h |
| 9415 | 9427 | ||
| 9416 | USB KAWASAKI LSI DRIVER | ||
| 9417 | M: Oliver Neukum <oliver@neukum.org> | ||
| 9418 | L: linux-usb@vger.kernel.org | ||
| 9419 | S: Maintained | ||
| 9420 | F: drivers/usb/serial/kl5kusb105.* | ||
| 9421 | |||
| 9422 | USB MASS STORAGE DRIVER | 9428 | USB MASS STORAGE DRIVER |
| 9423 | M: Matthew Dharm <mdharm-usb@one-eyed-alien.net> | 9429 | M: Matthew Dharm <mdharm-usb@one-eyed-alien.net> |
| 9424 | L: linux-usb@vger.kernel.org | 9430 | L: linux-usb@vger.kernel.org |
| @@ -9446,12 +9452,6 @@ S: Maintained | |||
| 9446 | F: Documentation/usb/ohci.txt | 9452 | F: Documentation/usb/ohci.txt |
| 9447 | F: drivers/usb/host/ohci* | 9453 | F: drivers/usb/host/ohci* |
| 9448 | 9454 | ||
| 9449 | USB OPTION-CARD DRIVER | ||
| 9450 | M: Matthias Urlichs <smurf@smurf.noris.de> | ||
| 9451 | L: linux-usb@vger.kernel.org | ||
| 9452 | S: Maintained | ||
| 9453 | F: drivers/usb/serial/option.c | ||
| 9454 | |||
| 9455 | USB PEGASUS DRIVER | 9455 | USB PEGASUS DRIVER |
| 9456 | M: Petko Manolov <petkan@nucleusys.com> | 9456 | M: Petko Manolov <petkan@nucleusys.com> |
| 9457 | L: linux-usb@vger.kernel.org | 9457 | L: linux-usb@vger.kernel.org |
| @@ -9484,7 +9484,7 @@ S: Maintained | |||
| 9484 | F: drivers/net/usb/rtl8150.c | 9484 | F: drivers/net/usb/rtl8150.c |
| 9485 | 9485 | ||
| 9486 | USB SERIAL SUBSYSTEM | 9486 | USB SERIAL SUBSYSTEM |
| 9487 | M: Johan Hovold <jhovold@gmail.com> | 9487 | M: Johan Hovold <johan@kernel.org> |
| 9488 | L: linux-usb@vger.kernel.org | 9488 | L: linux-usb@vger.kernel.org |
| 9489 | S: Maintained | 9489 | S: Maintained |
| 9490 | F: Documentation/usb/usb-serial.txt | 9490 | F: Documentation/usb/usb-serial.txt |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 3 | 1 | VERSION = 3 |
| 2 | PATCHLEVEL = 16 | 2 | PATCHLEVEL = 16 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc3 |
| 5 | NAME = Shuffling Zombie Juror | 5 | NAME = Shuffling Zombie Juror |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
| @@ -126,7 +126,10 @@ PHONY += $(MAKECMDGOALS) sub-make | |||
| 126 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make | 126 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make |
| 127 | @: | 127 | @: |
| 128 | 128 | ||
| 129 | # Fake the "Entering directory" message once, so that IDEs/editors are | ||
| 130 | # able to understand relative filenames. | ||
| 129 | sub-make: FORCE | 131 | sub-make: FORCE |
| 132 | @echo "make[1]: Entering directory \`$(KBUILD_OUTPUT)'" | ||
| 130 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ | 133 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ |
| 131 | KBUILD_SRC=$(CURDIR) \ | 134 | KBUILD_SRC=$(CURDIR) \ |
| 132 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ | 135 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ |
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h index c1d3d2da1191..b3c750979aa1 100644 --- a/arch/arc/include/asm/cache.h +++ b/arch/arc/include/asm/cache.h | |||
| @@ -60,7 +60,7 @@ extern void read_decode_cache_bcr(void); | |||
| 60 | #define ARC_REG_IC_IVIC 0x10 | 60 | #define ARC_REG_IC_IVIC 0x10 |
| 61 | #define ARC_REG_IC_CTRL 0x11 | 61 | #define ARC_REG_IC_CTRL 0x11 |
| 62 | #define ARC_REG_IC_IVIL 0x19 | 62 | #define ARC_REG_IC_IVIL 0x19 |
| 63 | #if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4) | 63 | #if defined(CONFIG_ARC_MMU_V3) |
| 64 | #define ARC_REG_IC_PTAG 0x1E | 64 | #define ARC_REG_IC_PTAG 0x1E |
| 65 | #endif | 65 | #endif |
| 66 | 66 | ||
| @@ -74,7 +74,7 @@ extern void read_decode_cache_bcr(void); | |||
| 74 | #define ARC_REG_DC_IVDL 0x4A | 74 | #define ARC_REG_DC_IVDL 0x4A |
| 75 | #define ARC_REG_DC_FLSH 0x4B | 75 | #define ARC_REG_DC_FLSH 0x4B |
| 76 | #define ARC_REG_DC_FLDL 0x4C | 76 | #define ARC_REG_DC_FLDL 0x4C |
| 77 | #if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4) | 77 | #if defined(CONFIG_ARC_MMU_V3) |
| 78 | #define ARC_REG_DC_PTAG 0x5C | 78 | #define ARC_REG_DC_PTAG 0x5C |
| 79 | #endif | 79 | #endif |
| 80 | 80 | ||
diff --git a/arch/arc/include/uapi/asm/ptrace.h b/arch/arc/include/uapi/asm/ptrace.h index 2618cc13ba75..76a7739aab1c 100644 --- a/arch/arc/include/uapi/asm/ptrace.h +++ b/arch/arc/include/uapi/asm/ptrace.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #ifndef _UAPI__ASM_ARC_PTRACE_H | 11 | #ifndef _UAPI__ASM_ARC_PTRACE_H |
| 12 | #define _UAPI__ASM_ARC_PTRACE_H | 12 | #define _UAPI__ASM_ARC_PTRACE_H |
| 13 | 13 | ||
| 14 | #define PTRACE_GET_THREAD_AREA 25 | ||
| 14 | 15 | ||
| 15 | #ifndef __ASSEMBLY__ | 16 | #ifndef __ASSEMBLY__ |
| 16 | /* | 17 | /* |
diff --git a/arch/arc/kernel/ctx_sw_asm.S b/arch/arc/kernel/ctx_sw_asm.S index 2ff0347a2fd7..e248594097e7 100644 --- a/arch/arc/kernel/ctx_sw_asm.S +++ b/arch/arc/kernel/ctx_sw_asm.S | |||
| @@ -10,9 +10,9 @@ | |||
| 10 | * -This is the more "natural" hand written assembler | 10 | * -This is the more "natural" hand written assembler |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/linkage.h> | ||
| 13 | #include <asm/entry.h> /* For the SAVE_* macros */ | 14 | #include <asm/entry.h> /* For the SAVE_* macros */ |
| 14 | #include <asm/asm-offsets.h> | 15 | #include <asm/asm-offsets.h> |
| 15 | #include <asm/linkage.h> | ||
| 16 | 16 | ||
| 17 | #define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4) | 17 | #define KSP_WORD_OFF ((TASK_THREAD + THREAD_KSP) / 4) |
| 18 | 18 | ||
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c index 0b3ef4025d89..fffdb5e41b20 100644 --- a/arch/arc/kernel/devtree.c +++ b/arch/arc/kernel/devtree.c | |||
| @@ -41,7 +41,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt) | |||
| 41 | { | 41 | { |
| 42 | const struct machine_desc *mdesc; | 42 | const struct machine_desc *mdesc; |
| 43 | unsigned long dt_root; | 43 | unsigned long dt_root; |
| 44 | void *clk; | 44 | const void *clk; |
| 45 | int len; | 45 | int len; |
| 46 | 46 | ||
| 47 | if (!early_init_dt_scan(dt)) | 47 | if (!early_init_dt_scan(dt)) |
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S index 07a58f2d3077..4d2481bd8b98 100644 --- a/arch/arc/kernel/head.S +++ b/arch/arc/kernel/head.S | |||
| @@ -77,10 +77,11 @@ stext: | |||
| 77 | ; Clear BSS before updating any globals | 77 | ; Clear BSS before updating any globals |
| 78 | ; XXX: use ZOL here | 78 | ; XXX: use ZOL here |
| 79 | mov r5, __bss_start | 79 | mov r5, __bss_start |
| 80 | mov r6, __bss_stop | 80 | sub r6, __bss_stop, r5 |
| 81 | lsr.f lp_count, r6, 2 | ||
| 82 | lpnz 1f | ||
| 83 | st.ab 0, [r5, 4] | ||
| 81 | 1: | 84 | 1: |
| 82 | st.ab 0, [r5,4] | ||
| 83 | brlt r5, r6, 1b | ||
| 84 | 85 | ||
| 85 | ; Uboot - kernel ABI | 86 | ; Uboot - kernel ABI |
| 86 | ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 | 87 | ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 |
diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c index 5d76706139dd..13b3ffb27a38 100644 --- a/arch/arc/kernel/ptrace.c +++ b/arch/arc/kernel/ptrace.c | |||
| @@ -146,6 +146,10 @@ long arch_ptrace(struct task_struct *child, long request, | |||
| 146 | pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data); | 146 | pr_debug("REQ=%ld: ADDR =0x%lx, DATA=0x%lx)\n", request, addr, data); |
| 147 | 147 | ||
| 148 | switch (request) { | 148 | switch (request) { |
| 149 | case PTRACE_GET_THREAD_AREA: | ||
| 150 | ret = put_user(task_thread_info(child)->thr_ptr, | ||
| 151 | (unsigned long __user *)data); | ||
| 152 | break; | ||
| 149 | default: | 153 | default: |
| 150 | ret = ptrace_request(child, request, addr, data); | 154 | ret = ptrace_request(child, request, addr, data); |
| 151 | break; | 155 | break; |
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c index cf90b6f4d3e0..c802bb500602 100644 --- a/arch/arc/kernel/smp.c +++ b/arch/arc/kernel/smp.c | |||
| @@ -337,8 +337,19 @@ irqreturn_t do_IPI(int irq, void *dev_id) | |||
| 337 | * API called by platform code to hookup arch-common ISR to their IPI IRQ | 337 | * API called by platform code to hookup arch-common ISR to their IPI IRQ |
| 338 | */ | 338 | */ |
| 339 | static DEFINE_PER_CPU(int, ipi_dev); | 339 | static DEFINE_PER_CPU(int, ipi_dev); |
| 340 | |||
| 341 | static struct irqaction arc_ipi_irq = { | ||
| 342 | .name = "IPI Interrupt", | ||
| 343 | .flags = IRQF_PERCPU, | ||
| 344 | .handler = do_IPI, | ||
| 345 | }; | ||
| 346 | |||
| 340 | int smp_ipi_irq_setup(int cpu, int irq) | 347 | int smp_ipi_irq_setup(int cpu, int irq) |
| 341 | { | 348 | { |
| 342 | int *dev_id = &per_cpu(ipi_dev, smp_processor_id()); | 349 | if (!cpu) |
| 343 | return request_percpu_irq(irq, do_IPI, "IPI Interrupt", dev_id); | 350 | return setup_irq(irq, &arc_ipi_irq); |
| 351 | else | ||
| 352 | arch_unmask_irq(irq); | ||
| 353 | |||
| 354 | return 0; | ||
| 344 | } | 355 | } |
diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S index 2555f5886af6..dd35bde39f69 100644 --- a/arch/arc/kernel/vmlinux.lds.S +++ b/arch/arc/kernel/vmlinux.lds.S | |||
| @@ -116,7 +116,7 @@ SECTIONS | |||
| 116 | 116 | ||
| 117 | _edata = .; | 117 | _edata = .; |
| 118 | 118 | ||
| 119 | BSS_SECTION(0, 0, 0) | 119 | BSS_SECTION(4, 4, 4) |
| 120 | 120 | ||
| 121 | #ifdef CONFIG_ARC_DW2_UNWIND | 121 | #ifdef CONFIG_ARC_DW2_UNWIND |
| 122 | . = ALIGN(PAGE_SIZE); | 122 | . = ALIGN(PAGE_SIZE); |
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c index 1f676c4794e0..353b202c37c9 100644 --- a/arch/arc/mm/cache_arc700.c +++ b/arch/arc/mm/cache_arc700.c | |||
| @@ -389,7 +389,7 @@ static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr, | |||
| 389 | /*********************************************************** | 389 | /*********************************************************** |
| 390 | * Machine specific helper for per line I-Cache invalidate. | 390 | * Machine specific helper for per line I-Cache invalidate. |
| 391 | */ | 391 | */ |
| 392 | static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr, | 392 | static void __ic_line_inv_vaddr_local(unsigned long paddr, unsigned long vaddr, |
| 393 | unsigned long sz) | 393 | unsigned long sz) |
| 394 | { | 394 | { |
| 395 | unsigned long flags; | 395 | unsigned long flags; |
| @@ -405,6 +405,23 @@ static inline void __ic_entire_inv(void) | |||
| 405 | read_aux_reg(ARC_REG_IC_CTRL); /* blocks */ | 405 | read_aux_reg(ARC_REG_IC_CTRL); /* blocks */ |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | struct ic_line_inv_vaddr_ipi { | ||
| 409 | unsigned long paddr, vaddr; | ||
| 410 | int sz; | ||
| 411 | }; | ||
| 412 | |||
| 413 | static void __ic_line_inv_vaddr_helper(void *info) | ||
| 414 | { | ||
| 415 | struct ic_line_inv_vaddr_ipi *ic_inv = (struct ic_line_inv_vaddr_ipi*) info; | ||
| 416 | __ic_line_inv_vaddr_local(ic_inv->paddr, ic_inv->vaddr, ic_inv->sz); | ||
| 417 | } | ||
| 418 | |||
| 419 | static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr, | ||
| 420 | unsigned long sz) | ||
| 421 | { | ||
| 422 | struct ic_line_inv_vaddr_ipi ic_inv = { paddr, vaddr , sz}; | ||
| 423 | on_each_cpu(__ic_line_inv_vaddr_helper, &ic_inv, 1); | ||
| 424 | } | ||
| 408 | #else | 425 | #else |
| 409 | 426 | ||
| 410 | #define __ic_entire_inv() | 427 | #define __ic_entire_inv() |
| @@ -553,12 +570,8 @@ void flush_icache_range(unsigned long kstart, unsigned long kend) | |||
| 553 | */ | 570 | */ |
| 554 | void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len) | 571 | void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len) |
| 555 | { | 572 | { |
| 556 | unsigned long flags; | ||
| 557 | |||
| 558 | local_irq_save(flags); | ||
| 559 | __ic_line_inv_vaddr(paddr, vaddr, len); | ||
| 560 | __dc_line_op(paddr, vaddr, len, OP_FLUSH_N_INV); | 573 | __dc_line_op(paddr, vaddr, len, OP_FLUSH_N_INV); |
| 561 | local_irq_restore(flags); | 574 | __ic_line_inv_vaddr(paddr, vaddr, len); |
| 562 | } | 575 | } |
| 563 | 576 | ||
| 564 | /* wrapper to compile time eliminate alignment checks in flush loop */ | 577 | /* wrapper to compile time eliminate alignment checks in flush loop */ |
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 5986ff63b901..adb5ed9e269e 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
| @@ -357,7 +357,7 @@ dtb-$(CONFIG_ARCH_STI)+= stih407-b2120.dtb \ | |||
| 357 | stih415-b2020.dtb \ | 357 | stih415-b2020.dtb \ |
| 358 | stih416-b2000.dtb \ | 358 | stih416-b2000.dtb \ |
| 359 | stih416-b2020.dtb \ | 359 | stih416-b2020.dtb \ |
| 360 | stih416-b2020-revE.dtb | 360 | stih416-b2020e.dtb |
| 361 | dtb-$(CONFIG_MACH_SUN4I) += \ | 361 | dtb-$(CONFIG_MACH_SUN4I) += \ |
| 362 | sun4i-a10-a1000.dtb \ | 362 | sun4i-a10-a1000.dtb \ |
| 363 | sun4i-a10-cubieboard.dtb \ | 363 | sun4i-a10-cubieboard.dtb \ |
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts index 19f1f7e87597..90098f98a5c8 100644 --- a/arch/arm/boot/dts/am43x-epos-evm.dts +++ b/arch/arm/boot/dts/am43x-epos-evm.dts | |||
| @@ -319,6 +319,10 @@ | |||
| 319 | phy-mode = "rmii"; | 319 | phy-mode = "rmii"; |
| 320 | }; | 320 | }; |
| 321 | 321 | ||
| 322 | &phy_sel { | ||
| 323 | rmii-clock-ext; | ||
| 324 | }; | ||
| 325 | |||
| 322 | &i2c0 { | 326 | &i2c0 { |
| 323 | status = "okay"; | 327 | status = "okay"; |
| 324 | pinctrl-names = "default"; | 328 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/armada-380.dtsi b/arch/arm/boot/dts/armada-380.dtsi index e69bc6759c39..4173a8ab34e7 100644 --- a/arch/arm/boot/dts/armada-380.dtsi +++ b/arch/arm/boot/dts/armada-380.dtsi | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | / { | 17 | / { |
| 18 | model = "Marvell Armada 380 family SoC"; | 18 | model = "Marvell Armada 380 family SoC"; |
| 19 | compatible = "marvell,armada380", "marvell,armada38x"; | 19 | compatible = "marvell,armada380"; |
| 20 | 20 | ||
| 21 | cpus { | 21 | cpus { |
| 22 | #address-cells = <1>; | 22 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/armada-385-db.dts b/arch/arm/boot/dts/armada-385-db.dts index 5bae4731828b..1af886f1e486 100644 --- a/arch/arm/boot/dts/armada-385-db.dts +++ b/arch/arm/boot/dts/armada-385-db.dts | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | / { | 17 | / { |
| 18 | model = "Marvell Armada 385 Development Board"; | 18 | model = "Marvell Armada 385 Development Board"; |
| 19 | compatible = "marvell,a385-db", "marvell,armada385", "marvell,armada38x"; | 19 | compatible = "marvell,a385-db", "marvell,armada385", "marvell,armada380"; |
| 20 | 20 | ||
| 21 | chosen { | 21 | chosen { |
| 22 | bootargs = "console=ttyS0,115200 earlyprintk"; | 22 | bootargs = "console=ttyS0,115200 earlyprintk"; |
diff --git a/arch/arm/boot/dts/armada-385-rd.dts b/arch/arm/boot/dts/armada-385-rd.dts index 40893255a3f0..aaca2861dc87 100644 --- a/arch/arm/boot/dts/armada-385-rd.dts +++ b/arch/arm/boot/dts/armada-385-rd.dts | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | / { | 18 | / { |
| 19 | model = "Marvell Armada 385 Reference Design"; | 19 | model = "Marvell Armada 385 Reference Design"; |
| 20 | compatible = "marvell,a385-rd", "marvell,armada385", "marvell,armada38x"; | 20 | compatible = "marvell,a385-rd", "marvell,armada385", "marvell,armada380"; |
| 21 | 21 | ||
| 22 | chosen { | 22 | chosen { |
| 23 | bootargs = "console=ttyS0,115200 earlyprintk"; | 23 | bootargs = "console=ttyS0,115200 earlyprintk"; |
diff --git a/arch/arm/boot/dts/armada-385.dtsi b/arch/arm/boot/dts/armada-385.dtsi index f011009bf4cf..6283d7912f71 100644 --- a/arch/arm/boot/dts/armada-385.dtsi +++ b/arch/arm/boot/dts/armada-385.dtsi | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | / { | 17 | / { |
| 18 | model = "Marvell Armada 385 family SoC"; | 18 | model = "Marvell Armada 385 family SoC"; |
| 19 | compatible = "marvell,armada385", "marvell,armada38x"; | 19 | compatible = "marvell,armada385", "marvell,armada380"; |
| 20 | 20 | ||
| 21 | cpus { | 21 | cpus { |
| 22 | #address-cells = <1>; | 22 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi index 3de364e81b52..689fa1a46728 100644 --- a/arch/arm/boot/dts/armada-38x.dtsi +++ b/arch/arm/boot/dts/armada-38x.dtsi | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | / { | 21 | / { |
| 22 | model = "Marvell Armada 38x family SoC"; | 22 | model = "Marvell Armada 38x family SoC"; |
| 23 | compatible = "marvell,armada38x"; | 23 | compatible = "marvell,armada380"; |
| 24 | 24 | ||
| 25 | aliases { | 25 | aliases { |
| 26 | gpio0 = &gpio0; | 26 | gpio0 = &gpio0; |
diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi index b309c1c6e848..04927db1d6bf 100644 --- a/arch/arm/boot/dts/at91sam9261.dtsi +++ b/arch/arm/boot/dts/at91sam9261.dtsi | |||
| @@ -568,24 +568,17 @@ | |||
| 568 | #size-cells = <0>; | 568 | #size-cells = <0>; |
| 569 | #interrupt-cells = <1>; | 569 | #interrupt-cells = <1>; |
| 570 | 570 | ||
| 571 | slow_rc_osc: slow_rc_osc { | 571 | main_osc: main_osc { |
| 572 | compatible = "fixed-clock"; | 572 | compatible = "atmel,at91rm9200-clk-main-osc"; |
| 573 | #clock-cells = <0>; | 573 | #clock-cells = <0>; |
| 574 | clock-frequency = <32768>; | 574 | interrupts-extended = <&pmc AT91_PMC_MOSCS>; |
| 575 | clock-accuracy = <50000000>; | 575 | clocks = <&main_xtal>; |
| 576 | }; | ||
| 577 | |||
| 578 | clk32k: slck { | ||
| 579 | compatible = "atmel,at91sam9260-clk-slow"; | ||
| 580 | #clock-cells = <0>; | ||
| 581 | clocks = <&slow_rc_osc &slow_xtal>; | ||
| 582 | }; | 576 | }; |
| 583 | 577 | ||
| 584 | main: mainck { | 578 | main: mainck { |
| 585 | compatible = "atmel,at91rm9200-clk-main"; | 579 | compatible = "atmel,at91rm9200-clk-main"; |
| 586 | #clock-cells = <0>; | 580 | #clock-cells = <0>; |
| 587 | interrupts-extended = <&pmc AT91_PMC_MOSCS>; | 581 | clocks = <&main_osc>; |
| 588 | clocks = <&main_xtal>; | ||
| 589 | }; | 582 | }; |
| 590 | 583 | ||
| 591 | plla: pllack { | 584 | plla: pllack { |
| @@ -615,7 +608,7 @@ | |||
| 615 | compatible = "atmel,at91rm9200-clk-master"; | 608 | compatible = "atmel,at91rm9200-clk-master"; |
| 616 | #clock-cells = <0>; | 609 | #clock-cells = <0>; |
| 617 | interrupts-extended = <&pmc AT91_PMC_MCKRDY>; | 610 | interrupts-extended = <&pmc AT91_PMC_MCKRDY>; |
| 618 | clocks = <&clk32k>, <&main>, <&plla>, <&pllb>; | 611 | clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>; |
| 619 | atmel,clk-output-range = <0 94000000>; | 612 | atmel,clk-output-range = <0 94000000>; |
| 620 | atmel,clk-divisors = <1 2 4 0>; | 613 | atmel,clk-divisors = <1 2 4 0>; |
| 621 | }; | 614 | }; |
| @@ -632,7 +625,7 @@ | |||
| 632 | #address-cells = <1>; | 625 | #address-cells = <1>; |
| 633 | #size-cells = <0>; | 626 | #size-cells = <0>; |
| 634 | interrupt-parent = <&pmc>; | 627 | interrupt-parent = <&pmc>; |
| 635 | clocks = <&clk32k>, <&main>, <&plla>, <&pllb>; | 628 | clocks = <&slow_xtal>, <&main>, <&plla>, <&pllb>; |
| 636 | 629 | ||
| 637 | prog0: prog0 { | 630 | prog0: prog0 { |
| 638 | #clock-cells = <0>; | 631 | #clock-cells = <0>; |
diff --git a/arch/arm/boot/dts/at91sam9261ek.dts b/arch/arm/boot/dts/at91sam9261ek.dts index c6683ea8b743..aa35a7aec9a8 100644 --- a/arch/arm/boot/dts/at91sam9261ek.dts +++ b/arch/arm/boot/dts/at91sam9261ek.dts | |||
| @@ -20,6 +20,10 @@ | |||
| 20 | reg = <0x20000000 0x4000000>; | 20 | reg = <0x20000000 0x4000000>; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | slow_xtal { | ||
| 24 | clock-frequency = <32768>; | ||
| 25 | }; | ||
| 26 | |||
| 23 | main_xtal { | 27 | main_xtal { |
| 24 | clock-frequency = <18432000>; | 28 | clock-frequency = <18432000>; |
| 25 | }; | 29 | }; |
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index d1b82e6635d5..287795985e32 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi | |||
| @@ -132,8 +132,8 @@ | |||
| 132 | <595000000 650000000 3 0>, | 132 | <595000000 650000000 3 0>, |
| 133 | <545000000 600000000 0 1>, | 133 | <545000000 600000000 0 1>, |
| 134 | <495000000 555000000 1 1>, | 134 | <495000000 555000000 1 1>, |
| 135 | <445000000 500000000 1 2>, | 135 | <445000000 500000000 2 1>, |
| 136 | <400000000 450000000 1 3>; | 136 | <400000000 450000000 3 1>; |
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| 139 | plladiv: plladivck { | 139 | plladiv: plladivck { |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 1a57298636a5..d6133f497207 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
| @@ -140,8 +140,8 @@ | |||
| 140 | 595000000 650000000 3 0 | 140 | 595000000 650000000 3 0 |
| 141 | 545000000 600000000 0 1 | 141 | 545000000 600000000 0 1 |
| 142 | 495000000 555000000 1 1 | 142 | 495000000 555000000 1 1 |
| 143 | 445000000 500000000 1 2 | 143 | 445000000 500000000 2 1 |
| 144 | 400000000 450000000 1 3>; | 144 | 400000000 450000000 3 1>; |
| 145 | }; | 145 | }; |
| 146 | 146 | ||
| 147 | plladiv: plladivck { | 147 | plladiv: plladivck { |
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index c29945e07c5a..80127638b379 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi | |||
| @@ -773,7 +773,6 @@ | |||
| 773 | clocks = <&qspi_gfclk_div>; | 773 | clocks = <&qspi_gfclk_div>; |
| 774 | clock-names = "fck"; | 774 | clock-names = "fck"; |
| 775 | num-cs = <4>; | 775 | num-cs = <4>; |
| 776 | interrupts = <0 343 0x4>; | ||
| 777 | status = "disabled"; | 776 | status = "disabled"; |
| 778 | }; | 777 | }; |
| 779 | 778 | ||
| @@ -984,6 +983,17 @@ | |||
| 984 | #size-cells = <1>; | 983 | #size-cells = <1>; |
| 985 | status = "disabled"; | 984 | status = "disabled"; |
| 986 | }; | 985 | }; |
| 986 | |||
| 987 | atl: atl@4843c000 { | ||
| 988 | compatible = "ti,dra7-atl"; | ||
| 989 | reg = <0x4843c000 0x3ff>; | ||
| 990 | ti,hwmods = "atl"; | ||
| 991 | ti,provided-clocks = <&atl_clkin0_ck>, <&atl_clkin1_ck>, | ||
| 992 | <&atl_clkin2_ck>, <&atl_clkin3_ck>; | ||
| 993 | clocks = <&atl_gfclk_mux>; | ||
| 994 | clock-names = "fck"; | ||
| 995 | status = "disabled"; | ||
| 996 | }; | ||
| 987 | }; | 997 | }; |
| 988 | }; | 998 | }; |
| 989 | 999 | ||
diff --git a/arch/arm/boot/dts/dra7xx-clocks.dtsi b/arch/arm/boot/dts/dra7xx-clocks.dtsi index b03cfe49d22b..c90c76de84d6 100644 --- a/arch/arm/boot/dts/dra7xx-clocks.dtsi +++ b/arch/arm/boot/dts/dra7xx-clocks.dtsi | |||
| @@ -10,26 +10,26 @@ | |||
| 10 | &cm_core_aon_clocks { | 10 | &cm_core_aon_clocks { |
| 11 | atl_clkin0_ck: atl_clkin0_ck { | 11 | atl_clkin0_ck: atl_clkin0_ck { |
| 12 | #clock-cells = <0>; | 12 | #clock-cells = <0>; |
| 13 | compatible = "fixed-clock"; | 13 | compatible = "ti,dra7-atl-clock"; |
| 14 | clock-frequency = <0>; | 14 | clocks = <&atl_gfclk_mux>; |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | atl_clkin1_ck: atl_clkin1_ck { | 17 | atl_clkin1_ck: atl_clkin1_ck { |
| 18 | #clock-cells = <0>; | 18 | #clock-cells = <0>; |
| 19 | compatible = "fixed-clock"; | 19 | compatible = "ti,dra7-atl-clock"; |
| 20 | clock-frequency = <0>; | 20 | clocks = <&atl_gfclk_mux>; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | atl_clkin2_ck: atl_clkin2_ck { | 23 | atl_clkin2_ck: atl_clkin2_ck { |
| 24 | #clock-cells = <0>; | 24 | #clock-cells = <0>; |
| 25 | compatible = "fixed-clock"; | 25 | compatible = "ti,dra7-atl-clock"; |
| 26 | clock-frequency = <0>; | 26 | clocks = <&atl_gfclk_mux>; |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | atl_clkin3_ck: atl_clkin3_ck { | 29 | atl_clkin3_ck: atl_clkin3_ck { |
| 30 | #clock-cells = <0>; | 30 | #clock-cells = <0>; |
| 31 | compatible = "fixed-clock"; | 31 | compatible = "ti,dra7-atl-clock"; |
| 32 | clock-frequency = <0>; | 32 | clocks = <&atl_gfclk_mux>; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | hdmi_clkin_ck: hdmi_clkin_ck { | 35 | hdmi_clkin_ck: hdmi_clkin_ck { |
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi index b8ece4be41ca..fbaf426d2daa 100644 --- a/arch/arm/boot/dts/exynos4.dtsi +++ b/arch/arm/boot/dts/exynos4.dtsi | |||
| @@ -113,7 +113,7 @@ | |||
| 113 | compatible = "arm,cortex-a9-gic"; | 113 | compatible = "arm,cortex-a9-gic"; |
| 114 | #interrupt-cells = <3>; | 114 | #interrupt-cells = <3>; |
| 115 | interrupt-controller; | 115 | interrupt-controller; |
| 116 | reg = <0x10490000 0x1000>, <0x10480000 0x100>; | 116 | reg = <0x10490000 0x10000>, <0x10480000 0x10000>; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | combiner: interrupt-controller@10440000 { | 119 | combiner: interrupt-controller@10440000 { |
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts index 6bc3243a80d3..181d77fa2fa6 100644 --- a/arch/arm/boot/dts/imx51-babbage.dts +++ b/arch/arm/boot/dts/imx51-babbage.dts | |||
| @@ -315,15 +315,15 @@ | |||
| 315 | &esdhc1 { | 315 | &esdhc1 { |
| 316 | pinctrl-names = "default"; | 316 | pinctrl-names = "default"; |
| 317 | pinctrl-0 = <&pinctrl_esdhc1>; | 317 | pinctrl-0 = <&pinctrl_esdhc1>; |
| 318 | fsl,cd-controller; | 318 | cd-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; |
| 319 | fsl,wp-controller; | 319 | wp-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; |
| 320 | status = "okay"; | 320 | status = "okay"; |
| 321 | }; | 321 | }; |
| 322 | 322 | ||
| 323 | &esdhc2 { | 323 | &esdhc2 { |
| 324 | pinctrl-names = "default"; | 324 | pinctrl-names = "default"; |
| 325 | pinctrl-0 = <&pinctrl_esdhc2>; | 325 | pinctrl-0 = <&pinctrl_esdhc2>; |
| 326 | cd-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; | 326 | cd-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; |
| 327 | wp-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; | 327 | wp-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; |
| 328 | status = "okay"; | 328 | status = "okay"; |
| 329 | }; | 329 | }; |
| @@ -468,8 +468,8 @@ | |||
| 468 | MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5 | 468 | MX51_PAD_SD1_DATA1__SD1_DATA1 0x20d5 |
| 469 | MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5 | 469 | MX51_PAD_SD1_DATA2__SD1_DATA2 0x20d5 |
| 470 | MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5 | 470 | MX51_PAD_SD1_DATA3__SD1_DATA3 0x20d5 |
| 471 | MX51_PAD_GPIO1_0__SD1_CD 0x20d5 | 471 | MX51_PAD_GPIO1_0__GPIO1_0 0x100 |
| 472 | MX51_PAD_GPIO1_1__SD1_WP 0x20d5 | 472 | MX51_PAD_GPIO1_1__GPIO1_1 0x100 |
| 473 | >; | 473 | >; |
| 474 | }; | 474 | }; |
| 475 | 475 | ||
diff --git a/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts b/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts index 75e66c9c6144..31cfb7f2b02e 100644 --- a/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts +++ b/arch/arm/boot/dts/imx51-eukrea-mbimxsd51-baseboard.dts | |||
| @@ -107,7 +107,7 @@ | |||
| 107 | &esdhc1 { | 107 | &esdhc1 { |
| 108 | pinctrl-names = "default"; | 108 | pinctrl-names = "default"; |
| 109 | pinctrl-0 = <&pinctrl_esdhc1 &pinctrl_esdhc1_cd>; | 109 | pinctrl-0 = <&pinctrl_esdhc1 &pinctrl_esdhc1_cd>; |
| 110 | fsl,cd-controller; | 110 | cd-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; |
| 111 | status = "okay"; | 111 | status = "okay"; |
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| @@ -206,7 +206,7 @@ | |||
| 206 | 206 | ||
| 207 | pinctrl_esdhc1_cd: esdhc1_cd { | 207 | pinctrl_esdhc1_cd: esdhc1_cd { |
| 208 | fsl,pins = < | 208 | fsl,pins = < |
| 209 | MX51_PAD_GPIO1_0__SD1_CD 0x20d5 | 209 | MX51_PAD_GPIO1_0__GPIO1_0 0xd5 |
| 210 | >; | 210 | >; |
| 211 | }; | 211 | }; |
| 212 | 212 | ||
diff --git a/arch/arm/boot/dts/imx53-m53evk.dts b/arch/arm/boot/dts/imx53-m53evk.dts index d5d146a8b149..c4956b0ffb35 100644 --- a/arch/arm/boot/dts/imx53-m53evk.dts +++ b/arch/arm/boot/dts/imx53-m53evk.dts | |||
| @@ -21,27 +21,25 @@ | |||
| 21 | <0xb0000000 0x20000000>; | 21 | <0xb0000000 0x20000000>; |
| 22 | }; | 22 | }; |
| 23 | 23 | ||
| 24 | soc { | 24 | display1: display@di1 { |
| 25 | display1: display@di1 { | 25 | compatible = "fsl,imx-parallel-display"; |
| 26 | compatible = "fsl,imx-parallel-display"; | 26 | interface-pix-fmt = "bgr666"; |
| 27 | interface-pix-fmt = "bgr666"; | 27 | pinctrl-names = "default"; |
| 28 | pinctrl-names = "default"; | 28 | pinctrl-0 = <&pinctrl_ipu_disp1>; |
| 29 | pinctrl-0 = <&pinctrl_ipu_disp1>; | 29 | |
| 30 | 30 | display-timings { | |
| 31 | display-timings { | 31 | 800x480p60 { |
| 32 | 800x480p60 { | 32 | native-mode; |
| 33 | native-mode; | 33 | clock-frequency = <31500000>; |
| 34 | clock-frequency = <31500000>; | 34 | hactive = <800>; |
| 35 | hactive = <800>; | 35 | vactive = <480>; |
| 36 | vactive = <480>; | 36 | hfront-porch = <40>; |
| 37 | hfront-porch = <40>; | 37 | hback-porch = <88>; |
| 38 | hback-porch = <88>; | 38 | hsync-len = <128>; |
| 39 | hsync-len = <128>; | 39 | vback-porch = <33>; |
| 40 | vback-porch = <33>; | 40 | vfront-porch = <9>; |
| 41 | vfront-porch = <9>; | 41 | vsync-len = <3>; |
| 42 | vsync-len = <3>; | 42 | vsync-active = <1>; |
| 43 | vsync-active = <1>; | ||
| 44 | }; | ||
| 45 | }; | 43 | }; |
| 46 | }; | 44 | }; |
| 47 | 45 | ||
diff --git a/arch/arm/boot/dts/imx6dl-hummingboard.dts b/arch/arm/boot/dts/imx6dl-hummingboard.dts index 5373a5f2782b..c8e51dd41b8f 100644 --- a/arch/arm/boot/dts/imx6dl-hummingboard.dts +++ b/arch/arm/boot/dts/imx6dl-hummingboard.dts | |||
| @@ -143,6 +143,14 @@ | |||
| 143 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>; | 143 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x1b0b0>; |
| 144 | }; | 144 | }; |
| 145 | 145 | ||
| 146 | pinctrl_hummingboard_usbotg_id: hummingboard-usbotg-id { | ||
| 147 | /* | ||
| 148 | * Similar to pinctrl_usbotg_2, but we want it | ||
| 149 | * pulled down for a fixed host connection. | ||
| 150 | */ | ||
| 151 | fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>; | ||
| 152 | }; | ||
| 153 | |||
| 146 | pinctrl_hummingboard_usbotg_vbus: hummingboard-usbotg-vbus { | 154 | pinctrl_hummingboard_usbotg_vbus: hummingboard-usbotg-vbus { |
| 147 | fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>; | 155 | fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x1b0b0>; |
| 148 | }; | 156 | }; |
| @@ -178,6 +186,8 @@ | |||
| 178 | }; | 186 | }; |
| 179 | 187 | ||
| 180 | &usbotg { | 188 | &usbotg { |
| 189 | pinctrl-names = "default"; | ||
| 190 | pinctrl-0 = <&pinctrl_hummingboard_usbotg_id>; | ||
| 181 | vbus-supply = <®_usbotg_vbus>; | 191 | vbus-supply = <®_usbotg_vbus>; |
| 182 | status = "okay"; | 192 | status = "okay"; |
| 183 | }; | 193 | }; |
diff --git a/arch/arm/boot/dts/imx6q-gw51xx.dts b/arch/arm/boot/dts/imx6q-gw51xx.dts index af4929aee075..0e1406e58eff 100644 --- a/arch/arm/boot/dts/imx6q-gw51xx.dts +++ b/arch/arm/boot/dts/imx6q-gw51xx.dts | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | /dts-v1/; | 12 | /dts-v1/; |
| 13 | #include "imx6q.dtsi" | 13 | #include "imx6q.dtsi" |
| 14 | #include "imx6qdl-gw54xx.dtsi" | 14 | #include "imx6qdl-gw51xx.dtsi" |
| 15 | 15 | ||
| 16 | / { | 16 | / { |
| 17 | model = "Gateworks Ventana i.MX6 Quad GW51XX"; | 17 | model = "Gateworks Ventana i.MX6 Quad GW51XX"; |
diff --git a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi index 25da82a03110..e8e781656b3f 100644 --- a/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi +++ b/arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | |||
| @@ -12,6 +12,19 @@ | |||
| 12 | pinctrl-0 = <&pinctrl_cubox_i_ir>; | 12 | pinctrl-0 = <&pinctrl_cubox_i_ir>; |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | pwmleds { | ||
| 16 | compatible = "pwm-leds"; | ||
| 17 | pinctrl-names = "default"; | ||
| 18 | pinctrl-0 = <&pinctrl_cubox_i_pwm1>; | ||
| 19 | |||
| 20 | front { | ||
| 21 | active-low; | ||
| 22 | label = "imx6:red:front"; | ||
| 23 | max-brightness = <248>; | ||
| 24 | pwms = <&pwm1 0 50000>; | ||
| 25 | }; | ||
| 26 | }; | ||
| 27 | |||
| 15 | regulators { | 28 | regulators { |
| 16 | compatible = "simple-bus"; | 29 | compatible = "simple-bus"; |
| 17 | 30 | ||
| @@ -109,6 +122,10 @@ | |||
| 109 | >; | 122 | >; |
| 110 | }; | 123 | }; |
| 111 | 124 | ||
| 125 | pinctrl_cubox_i_pwm1: cubox-i-pwm1-front-led { | ||
| 126 | fsl,pins = <MX6QDL_PAD_DISP0_DAT8__PWM1_OUT 0x1b0b0>; | ||
| 127 | }; | ||
| 128 | |||
| 112 | pinctrl_cubox_i_spdif: cubox-i-spdif { | 129 | pinctrl_cubox_i_spdif: cubox-i-spdif { |
| 113 | fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>; | 130 | fsl,pins = <MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x13091>; |
| 114 | }; | 131 | }; |
| @@ -117,6 +134,14 @@ | |||
| 117 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>; | 134 | fsl,pins = <MX6QDL_PAD_GPIO_0__GPIO1_IO00 0x4001b0b0>; |
| 118 | }; | 135 | }; |
| 119 | 136 | ||
| 137 | pinctrl_cubox_i_usbotg_id: cubox-i-usbotg-id { | ||
| 138 | /* | ||
| 139 | * The Cubox-i pulls this low, but as it's pointless | ||
| 140 | * leaving it as a pull-up, even if it is just 10uA. | ||
| 141 | */ | ||
| 142 | fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>; | ||
| 143 | }; | ||
| 144 | |||
| 120 | pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus { | 145 | pinctrl_cubox_i_usbotg_vbus: cubox-i-usbotg-vbus { |
| 121 | fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x4001b0b0>; | 146 | fsl,pins = <MX6QDL_PAD_EIM_D22__GPIO3_IO22 0x4001b0b0>; |
| 122 | }; | 147 | }; |
| @@ -153,6 +178,8 @@ | |||
| 153 | }; | 178 | }; |
| 154 | 179 | ||
| 155 | &usbotg { | 180 | &usbotg { |
| 181 | pinctrl-names = "default"; | ||
| 182 | pinctrl-0 = <&pinctrl_cubox_i_usbotg_id>; | ||
| 156 | vbus-supply = <®_usbotg_vbus>; | 183 | vbus-supply = <®_usbotg_vbus>; |
| 157 | status = "okay"; | 184 | status = "okay"; |
| 158 | }; | 185 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi index 31665adcbf39..0db15af41cb1 100644 --- a/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw51xx.dtsi | |||
| @@ -161,7 +161,7 @@ | |||
| 161 | status = "okay"; | 161 | status = "okay"; |
| 162 | 162 | ||
| 163 | pmic: ltc3676@3c { | 163 | pmic: ltc3676@3c { |
| 164 | compatible = "ltc,ltc3676"; | 164 | compatible = "lltc,ltc3676"; |
| 165 | reg = <0x3c>; | 165 | reg = <0x3c>; |
| 166 | 166 | ||
| 167 | regulators { | 167 | regulators { |
diff --git a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi index 367af3ec9435..744c8a2d81f6 100644 --- a/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw52xx.dtsi | |||
| @@ -220,7 +220,7 @@ | |||
| 220 | }; | 220 | }; |
| 221 | 221 | ||
| 222 | pmic: ltc3676@3c { | 222 | pmic: ltc3676@3c { |
| 223 | compatible = "ltc,ltc3676"; | 223 | compatible = "lltc,ltc3676"; |
| 224 | reg = <0x3c>; | 224 | reg = <0x3c>; |
| 225 | 225 | ||
| 226 | regulators { | 226 | regulators { |
| @@ -288,7 +288,7 @@ | |||
| 288 | codec: sgtl5000@0a { | 288 | codec: sgtl5000@0a { |
| 289 | compatible = "fsl,sgtl5000"; | 289 | compatible = "fsl,sgtl5000"; |
| 290 | reg = <0x0a>; | 290 | reg = <0x0a>; |
| 291 | clocks = <&clks 169>; | 291 | clocks = <&clks 201>; |
| 292 | VDDA-supply = <®_1p8v>; | 292 | VDDA-supply = <®_1p8v>; |
| 293 | VDDIO-supply = <®_3p3v>; | 293 | VDDIO-supply = <®_3p3v>; |
| 294 | }; | 294 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi index c91b5a6c769b..adf150c1be90 100644 --- a/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi +++ b/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi | |||
| @@ -234,7 +234,7 @@ | |||
| 234 | }; | 234 | }; |
| 235 | 235 | ||
| 236 | pmic: ltc3676@3c { | 236 | pmic: ltc3676@3c { |
| 237 | compatible = "ltc,ltc3676"; | 237 | compatible = "lltc,ltc3676"; |
| 238 | reg = <0x3c>; | 238 | reg = <0x3c>; |
| 239 | 239 | ||
| 240 | regulators { | 240 | regulators { |
diff --git a/arch/arm/boot/dts/imx6qdl-microsom.dtsi b/arch/arm/boot/dts/imx6qdl-microsom.dtsi index d729d0b15f25..79eac6849d4c 100644 --- a/arch/arm/boot/dts/imx6qdl-microsom.dtsi +++ b/arch/arm/boot/dts/imx6qdl-microsom.dtsi | |||
| @@ -10,14 +10,6 @@ | |||
| 10 | MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1 | 10 | MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA 0x1b0b1 |
| 11 | >; | 11 | >; |
| 12 | }; | 12 | }; |
| 13 | |||
| 14 | pinctrl_microsom_usbotg: microsom-usbotg { | ||
| 15 | /* | ||
| 16 | * Similar to pinctrl_usbotg_2, but we want it | ||
| 17 | * pulled down for a fixed host connection. | ||
| 18 | */ | ||
| 19 | fsl,pins = <MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x13059>; | ||
| 20 | }; | ||
| 21 | }; | 13 | }; |
| 22 | }; | 14 | }; |
| 23 | 15 | ||
| @@ -26,8 +18,3 @@ | |||
| 26 | pinctrl-0 = <&pinctrl_microsom_uart1>; | 18 | pinctrl-0 = <&pinctrl_microsom_uart1>; |
| 27 | status = "okay"; | 19 | status = "okay"; |
| 28 | }; | 20 | }; |
| 29 | |||
| 30 | &usbotg { | ||
| 31 | pinctrl-names = "default"; | ||
| 32 | pinctrl-0 = <&pinctrl_microsom_usbotg>; | ||
| 33 | }; | ||
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index 2d4e5285f3f3..57d4abe03a94 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi | |||
| @@ -686,7 +686,7 @@ | |||
| 686 | compatible = "fsl,imx6sl-fec", "fsl,imx25-fec"; | 686 | compatible = "fsl,imx6sl-fec", "fsl,imx25-fec"; |
| 687 | reg = <0x02188000 0x4000>; | 687 | reg = <0x02188000 0x4000>; |
| 688 | interrupts = <0 114 IRQ_TYPE_LEVEL_HIGH>; | 688 | interrupts = <0 114 IRQ_TYPE_LEVEL_HIGH>; |
| 689 | clocks = <&clks IMX6SL_CLK_ENET_REF>, | 689 | clocks = <&clks IMX6SL_CLK_ENET>, |
| 690 | <&clks IMX6SL_CLK_ENET_REF>; | 690 | <&clks IMX6SL_CLK_ENET_REF>; |
| 691 | clock-names = "ipg", "ahb"; | 691 | clock-names = "ipg", "ahb"; |
| 692 | status = "disabled"; | 692 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts index c5a1fc75c7a3..b2d9834bf458 100644 --- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts +++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts | |||
| @@ -105,7 +105,6 @@ | |||
| 105 | compatible = "ethernet-phy-id0141.0cb0", | 105 | compatible = "ethernet-phy-id0141.0cb0", |
| 106 | "ethernet-phy-ieee802.3-c22"; | 106 | "ethernet-phy-ieee802.3-c22"; |
| 107 | reg = <0>; | 107 | reg = <0>; |
| 108 | phy-connection-type = "rgmii-id"; | ||
| 109 | }; | 108 | }; |
| 110 | 109 | ||
| 111 | ethphy1: ethernet-phy@1 { | 110 | ethphy1: ethernet-phy@1 { |
| @@ -113,7 +112,6 @@ | |||
| 113 | compatible = "ethernet-phy-id0141.0cb0", | 112 | compatible = "ethernet-phy-id0141.0cb0", |
| 114 | "ethernet-phy-ieee802.3-c22"; | 113 | "ethernet-phy-ieee802.3-c22"; |
| 115 | reg = <1>; | 114 | reg = <1>; |
| 116 | phy-connection-type = "rgmii-id"; | ||
| 117 | }; | 115 | }; |
| 118 | }; | 116 | }; |
| 119 | 117 | ||
| @@ -121,6 +119,7 @@ | |||
| 121 | status = "okay"; | 119 | status = "okay"; |
| 122 | ethernet0-port@0 { | 120 | ethernet0-port@0 { |
| 123 | phy-handle = <ðphy0>; | 121 | phy-handle = <ðphy0>; |
| 122 | phy-connection-type = "rgmii-id"; | ||
| 124 | }; | 123 | }; |
| 125 | }; | 124 | }; |
| 126 | 125 | ||
| @@ -128,5 +127,6 @@ | |||
| 128 | status = "okay"; | 127 | status = "okay"; |
| 129 | ethernet1-port@0 { | 128 | ethernet1-port@0 { |
| 130 | phy-handle = <ðphy1>; | 129 | phy-handle = <ðphy1>; |
| 130 | phy-connection-type = "rgmii-id"; | ||
| 131 | }; | 131 | }; |
| 132 | }; | 132 | }; |
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts index cf0be662297e..1becefce821b 100644 --- a/arch/arm/boot/dts/omap3-beagle-xm.dts +++ b/arch/arm/boot/dts/omap3-beagle-xm.dts | |||
| @@ -251,6 +251,11 @@ | |||
| 251 | codec { | 251 | codec { |
| 252 | }; | 252 | }; |
| 253 | }; | 253 | }; |
| 254 | |||
| 255 | twl_power: power { | ||
| 256 | compatible = "ti,twl4030-power-beagleboard-xm", "ti,twl4030-power-idle-osc-off"; | ||
| 257 | ti,use_poweroff; | ||
| 258 | }; | ||
| 254 | }; | 259 | }; |
| 255 | }; | 260 | }; |
| 256 | 261 | ||
| @@ -301,6 +306,7 @@ | |||
| 301 | }; | 306 | }; |
| 302 | 307 | ||
| 303 | &uart3 { | 308 | &uart3 { |
| 309 | interrupts-extended = <&intc 74 &omap3_pmx_core OMAP3_UART3_RX>; | ||
| 304 | pinctrl-names = "default"; | 310 | pinctrl-names = "default"; |
| 305 | pinctrl-0 = <&uart3_pins>; | 311 | pinctrl-0 = <&uart3_pins>; |
| 306 | }; | 312 | }; |
diff --git a/arch/arm/boot/dts/omap3-evm-common.dtsi b/arch/arm/boot/dts/omap3-evm-common.dtsi index 8ae8f007c8ad..c8747c7f1cc8 100644 --- a/arch/arm/boot/dts/omap3-evm-common.dtsi +++ b/arch/arm/boot/dts/omap3-evm-common.dtsi | |||
| @@ -50,6 +50,13 @@ | |||
| 50 | gpios = <&twl_gpio 18 GPIO_ACTIVE_LOW>; | 50 | gpios = <&twl_gpio 18 GPIO_ACTIVE_LOW>; |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | &twl { | ||
| 54 | twl_power: power { | ||
| 55 | compatible = "ti,twl4030-power-omap3-evm", "ti,twl4030-power-idle"; | ||
| 56 | ti,use_poweroff; | ||
| 57 | }; | ||
| 58 | }; | ||
| 59 | |||
| 53 | &i2c2 { | 60 | &i2c2 { |
| 54 | clock-frequency = <400000>; | 61 | clock-frequency = <400000>; |
| 55 | }; | 62 | }; |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index ae8ae3f4f9bf..1fe45d1f75ec 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
| @@ -351,6 +351,11 @@ | |||
| 351 | compatible = "ti,twl4030-audio"; | 351 | compatible = "ti,twl4030-audio"; |
| 352 | ti,enable-vibra = <1>; | 352 | ti,enable-vibra = <1>; |
| 353 | }; | 353 | }; |
| 354 | |||
| 355 | twl_power: power { | ||
| 356 | compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off"; | ||
| 357 | ti,use_poweroff; | ||
| 358 | }; | ||
| 354 | }; | 359 | }; |
| 355 | 360 | ||
| 356 | &twl_keypad { | 361 | &twl_keypad { |
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index 3bfda16c8b52..a4ed54988866 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi | |||
| @@ -45,7 +45,6 @@ | |||
| 45 | 45 | ||
| 46 | operating-points = < | 46 | operating-points = < |
| 47 | /* kHz uV */ | 47 | /* kHz uV */ |
| 48 | 500000 880000 | ||
| 49 | 1000000 1060000 | 48 | 1000000 1060000 |
| 50 | 1500000 1250000 | 49 | 1500000 1250000 |
| 51 | >; | 50 | >; |
diff --git a/arch/arm/boot/dts/stih415.dtsi b/arch/arm/boot/dts/stih415.dtsi index d6f254f302fe..a0f6f75fe3b5 100644 --- a/arch/arm/boot/dts/stih415.dtsi +++ b/arch/arm/boot/dts/stih415.dtsi | |||
| @@ -169,8 +169,8 @@ | |||
| 169 | 169 | ||
| 170 | pinctrl-names = "default"; | 170 | pinctrl-names = "default"; |
| 171 | pinctrl-0 = <&pinctrl_mii0>; | 171 | pinctrl-0 = <&pinctrl_mii0>; |
| 172 | clock-names = "stmmaceth"; | 172 | clock-names = "stmmaceth", "sti-ethclk"; |
| 173 | clocks = <&clk_s_a1_ls CLK_GMAC0_PHY>; | 173 | clocks = <&clk_s_a1_ls CLK_ICN_IF_2>, <&clk_s_a1_ls CLK_GMAC0_PHY>; |
| 174 | }; | 174 | }; |
| 175 | 175 | ||
| 176 | ethernet1: dwmac@fef08000 { | 176 | ethernet1: dwmac@fef08000 { |
| @@ -192,8 +192,8 @@ | |||
| 192 | reset-names = "stmmaceth"; | 192 | reset-names = "stmmaceth"; |
| 193 | pinctrl-names = "default"; | 193 | pinctrl-names = "default"; |
| 194 | pinctrl-0 = <&pinctrl_mii1>; | 194 | pinctrl-0 = <&pinctrl_mii1>; |
| 195 | clock-names = "stmmaceth"; | 195 | clock-names = "stmmaceth", "sti-ethclk"; |
| 196 | clocks = <&clk_s_a0_ls CLK_ETH1_PHY>; | 196 | clocks = <&clk_s_a0_ls CLK_ICN_REG>, <&clk_s_a0_ls CLK_ETH1_PHY>; |
| 197 | }; | 197 | }; |
| 198 | 198 | ||
| 199 | rc: rc@fe518000 { | 199 | rc: rc@fe518000 { |
diff --git a/arch/arm/boot/dts/stih416-b2020-revE.dts b/arch/arm/boot/dts/stih416-b2020e.dts index ba0fa2caaf18..ba0fa2caaf18 100644 --- a/arch/arm/boot/dts/stih416-b2020-revE.dts +++ b/arch/arm/boot/dts/stih416-b2020e.dts | |||
diff --git a/arch/arm/boot/dts/stih416.dtsi b/arch/arm/boot/dts/stih416.dtsi index 06473c5d9ea9..84758d76d064 100644 --- a/arch/arm/boot/dts/stih416.dtsi +++ b/arch/arm/boot/dts/stih416.dtsi | |||
| @@ -175,8 +175,8 @@ | |||
| 175 | reset-names = "stmmaceth"; | 175 | reset-names = "stmmaceth"; |
| 176 | pinctrl-names = "default"; | 176 | pinctrl-names = "default"; |
| 177 | pinctrl-0 = <&pinctrl_mii0>; | 177 | pinctrl-0 = <&pinctrl_mii0>; |
| 178 | clock-names = "stmmaceth"; | 178 | clock-names = "stmmaceth", "sti-ethclk"; |
| 179 | clocks = <&clk_s_a1_ls CLK_GMAC0_PHY>; | 179 | clocks = <&clk_s_a1_ls CLK_ICN_IF_2>, <&clk_s_a1_ls CLK_GMAC0_PHY>; |
| 180 | }; | 180 | }; |
| 181 | 181 | ||
| 182 | ethernet1: dwmac@fef08000 { | 182 | ethernet1: dwmac@fef08000 { |
| @@ -197,8 +197,8 @@ | |||
| 197 | reset-names = "stmmaceth"; | 197 | reset-names = "stmmaceth"; |
| 198 | pinctrl-names = "default"; | 198 | pinctrl-names = "default"; |
| 199 | pinctrl-0 = <&pinctrl_mii1>; | 199 | pinctrl-0 = <&pinctrl_mii1>; |
| 200 | clock-names = "stmmaceth"; | 200 | clock-names = "stmmaceth", "sti-ethclk"; |
| 201 | clocks = <&clk_s_a0_ls CLK_ETH1_PHY>; | 201 | clocks = <&clk_s_a0_ls CLK_ICN_REG>, <&clk_s_a0_ls CLK_ETH1_PHY>; |
| 202 | }; | 202 | }; |
| 203 | 203 | ||
| 204 | rc: rc@fe518000 { | 204 | rc: rc@fe518000 { |
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c index 6ef146edd0cd..a20fa80776d3 100644 --- a/arch/arm/common/scoop.c +++ b/arch/arm/common/scoop.c | |||
| @@ -182,7 +182,6 @@ static int scoop_probe(struct platform_device *pdev) | |||
| 182 | struct scoop_config *inf; | 182 | struct scoop_config *inf; |
| 183 | struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 183 | struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 184 | int ret; | 184 | int ret; |
| 185 | int temp; | ||
| 186 | 185 | ||
| 187 | if (!mem) | 186 | if (!mem) |
| 188 | return -EINVAL; | 187 | return -EINVAL; |
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig index 9d13dae99125..4bf72264b175 100644 --- a/arch/arm/configs/bcm_defconfig +++ b/arch/arm/configs/bcm_defconfig | |||
| @@ -94,10 +94,10 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y | |||
| 94 | CONFIG_BACKLIGHT_PWM=y | 94 | CONFIG_BACKLIGHT_PWM=y |
| 95 | # CONFIG_USB_SUPPORT is not set | 95 | # CONFIG_USB_SUPPORT is not set |
| 96 | CONFIG_MMC=y | 96 | CONFIG_MMC=y |
| 97 | CONFIG_MMC_UNSAFE_RESUME=y | ||
| 98 | CONFIG_MMC_BLOCK_MINORS=32 | 97 | CONFIG_MMC_BLOCK_MINORS=32 |
| 99 | CONFIG_MMC_TEST=y | 98 | CONFIG_MMC_TEST=y |
| 100 | CONFIG_MMC_SDHCI=y | 99 | CONFIG_MMC_SDHCI=y |
| 100 | CONFIG_MMC_SDHCI_PLTFM=y | ||
| 101 | CONFIG_MMC_SDHCI_BCM_KONA=y | 101 | CONFIG_MMC_SDHCI_BCM_KONA=y |
| 102 | CONFIG_NEW_LEDS=y | 102 | CONFIG_NEW_LEDS=y |
| 103 | CONFIG_LEDS_CLASS=y | 103 | CONFIG_LEDS_CLASS=y |
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index ef8815327e5b..59b7e45142d8 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig | |||
| @@ -186,6 +186,7 @@ CONFIG_VIDEO_MX3=y | |||
| 186 | CONFIG_V4L_MEM2MEM_DRIVERS=y | 186 | CONFIG_V4L_MEM2MEM_DRIVERS=y |
| 187 | CONFIG_VIDEO_CODA=y | 187 | CONFIG_VIDEO_CODA=y |
| 188 | CONFIG_SOC_CAMERA_OV2640=y | 188 | CONFIG_SOC_CAMERA_OV2640=y |
| 189 | CONFIG_IMX_IPUV3_CORE=y | ||
| 189 | CONFIG_DRM=y | 190 | CONFIG_DRM=y |
| 190 | CONFIG_DRM_PANEL_SIMPLE=y | 191 | CONFIG_DRM_PANEL_SIMPLE=y |
| 191 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | 192 | CONFIG_BACKLIGHT_LCD_SUPPORT=y |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 17d9462b9fb9..534836497998 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
| @@ -223,12 +223,12 @@ CONFIG_POWER_RESET_GPIO=y | |||
| 223 | CONFIG_POWER_RESET_SUN6I=y | 223 | CONFIG_POWER_RESET_SUN6I=y |
| 224 | CONFIG_SENSORS_LM90=y | 224 | CONFIG_SENSORS_LM90=y |
| 225 | CONFIG_THERMAL=y | 225 | CONFIG_THERMAL=y |
| 226 | CONFIG_DOVE_THERMAL=y | ||
| 227 | CONFIG_ARMADA_THERMAL=y | 226 | CONFIG_ARMADA_THERMAL=y |
| 228 | CONFIG_WATCHDOG=y | 227 | CONFIG_WATCHDOG=y |
| 229 | CONFIG_ORION_WATCHDOG=y | 228 | CONFIG_ORION_WATCHDOG=y |
| 230 | CONFIG_SUNXI_WATCHDOG=y | 229 | CONFIG_SUNXI_WATCHDOG=y |
| 231 | CONFIG_MFD_AS3722=y | 230 | CONFIG_MFD_AS3722=y |
| 231 | CONFIG_MFD_BCM590XX=y | ||
| 232 | CONFIG_MFD_CROS_EC=y | 232 | CONFIG_MFD_CROS_EC=y |
| 233 | CONFIG_MFD_CROS_EC_SPI=y | 233 | CONFIG_MFD_CROS_EC_SPI=y |
| 234 | CONFIG_MFD_MAX8907=y | 234 | CONFIG_MFD_MAX8907=y |
| @@ -240,6 +240,7 @@ CONFIG_MFD_TPS65910=y | |||
| 240 | CONFIG_REGULATOR_VIRTUAL_CONSUMER=y | 240 | CONFIG_REGULATOR_VIRTUAL_CONSUMER=y |
| 241 | CONFIG_REGULATOR_AB8500=y | 241 | CONFIG_REGULATOR_AB8500=y |
| 242 | CONFIG_REGULATOR_AS3722=y | 242 | CONFIG_REGULATOR_AS3722=y |
| 243 | CONFIG_REGULATOR_BCM590XX=y | ||
| 243 | CONFIG_REGULATOR_GPIO=y | 244 | CONFIG_REGULATOR_GPIO=y |
| 244 | CONFIG_REGULATOR_MAX8907=y | 245 | CONFIG_REGULATOR_MAX8907=y |
| 245 | CONFIG_REGULATOR_PALMAS=y | 246 | CONFIG_REGULATOR_PALMAS=y |
| @@ -353,6 +354,7 @@ CONFIG_MFD_NVEC=y | |||
| 353 | CONFIG_KEYBOARD_NVEC=y | 354 | CONFIG_KEYBOARD_NVEC=y |
| 354 | CONFIG_SERIO_NVEC_PS2=y | 355 | CONFIG_SERIO_NVEC_PS2=y |
| 355 | CONFIG_NVEC_POWER=y | 356 | CONFIG_NVEC_POWER=y |
| 357 | CONFIG_QCOM_GSBI=y | ||
| 356 | CONFIG_COMMON_CLK_QCOM=y | 358 | CONFIG_COMMON_CLK_QCOM=y |
| 357 | CONFIG_MSM_GCC_8660=y | 359 | CONFIG_MSM_GCC_8660=y |
| 358 | CONFIG_MSM_MMCC_8960=y | 360 | CONFIG_MSM_MMCC_8960=y |
diff --git a/arch/arm/configs/mvebu_v7_defconfig b/arch/arm/configs/mvebu_v7_defconfig index e11170e37442..b0bfefa23902 100644 --- a/arch/arm/configs/mvebu_v7_defconfig +++ b/arch/arm/configs/mvebu_v7_defconfig | |||
| @@ -14,6 +14,7 @@ CONFIG_MACH_ARMADA_370=y | |||
| 14 | CONFIG_MACH_ARMADA_375=y | 14 | CONFIG_MACH_ARMADA_375=y |
| 15 | CONFIG_MACH_ARMADA_38X=y | 15 | CONFIG_MACH_ARMADA_38X=y |
| 16 | CONFIG_MACH_ARMADA_XP=y | 16 | CONFIG_MACH_ARMADA_XP=y |
| 17 | CONFIG_MACH_DOVE=y | ||
| 17 | CONFIG_NEON=y | 18 | CONFIG_NEON=y |
| 18 | # CONFIG_CACHE_L2X0 is not set | 19 | # CONFIG_CACHE_L2X0 is not set |
| 19 | # CONFIG_SWP_EMULATE is not set | 20 | # CONFIG_SWP_EMULATE is not set |
| @@ -52,6 +53,7 @@ CONFIG_INPUT_EVDEV=y | |||
| 52 | CONFIG_KEYBOARD_GPIO=y | 53 | CONFIG_KEYBOARD_GPIO=y |
| 53 | CONFIG_SERIAL_8250=y | 54 | CONFIG_SERIAL_8250=y |
| 54 | CONFIG_SERIAL_8250_CONSOLE=y | 55 | CONFIG_SERIAL_8250_CONSOLE=y |
| 56 | CONFIG_SERIAL_OF_PLATFORM=y | ||
| 55 | CONFIG_I2C=y | 57 | CONFIG_I2C=y |
| 56 | CONFIG_SPI=y | 58 | CONFIG_SPI=y |
| 57 | CONFIG_SPI_ORION=y | 59 | CONFIG_SPI_ORION=y |
diff --git a/arch/arm/include/asm/mcpm.h b/arch/arm/include/asm/mcpm.h index d9702eb0b02b..94060adba174 100644 --- a/arch/arm/include/asm/mcpm.h +++ b/arch/arm/include/asm/mcpm.h | |||
| @@ -208,8 +208,6 @@ struct sync_struct { | |||
| 208 | struct mcpm_sync_struct clusters[MAX_NR_CLUSTERS]; | 208 | struct mcpm_sync_struct clusters[MAX_NR_CLUSTERS]; |
| 209 | }; | 209 | }; |
| 210 | 210 | ||
| 211 | extern unsigned long sync_phys; /* physical address of *mcpm_sync */ | ||
| 212 | |||
| 213 | void __mcpm_cpu_going_down(unsigned int cpu, unsigned int cluster); | 211 | void __mcpm_cpu_going_down(unsigned int cpu, unsigned int cluster); |
| 214 | void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster); | 212 | void __mcpm_cpu_down(unsigned int cpu, unsigned int cluster); |
| 215 | void __mcpm_outbound_leave_critical(unsigned int cluster, int state); | 213 | void __mcpm_outbound_leave_critical(unsigned int cluster, int state); |
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index f989d7c22dc5..e4e4208a9130 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
| @@ -114,8 +114,14 @@ static inline struct thread_info *current_thread_info(void) | |||
| 114 | ((unsigned long)(task_thread_info(tsk)->cpu_context.pc)) | 114 | ((unsigned long)(task_thread_info(tsk)->cpu_context.pc)) |
| 115 | #define thread_saved_sp(tsk) \ | 115 | #define thread_saved_sp(tsk) \ |
| 116 | ((unsigned long)(task_thread_info(tsk)->cpu_context.sp)) | 116 | ((unsigned long)(task_thread_info(tsk)->cpu_context.sp)) |
| 117 | |||
| 118 | #ifndef CONFIG_THUMB2_KERNEL | ||
| 117 | #define thread_saved_fp(tsk) \ | 119 | #define thread_saved_fp(tsk) \ |
| 118 | ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) | 120 | ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) |
| 121 | #else | ||
| 122 | #define thread_saved_fp(tsk) \ | ||
| 123 | ((unsigned long)(task_thread_info(tsk)->cpu_context.r7)) | ||
| 124 | #endif | ||
| 119 | 125 | ||
| 120 | extern void crunch_task_disable(struct thread_info *); | 126 | extern void crunch_task_disable(struct thread_info *); |
| 121 | extern void crunch_task_copy(struct thread_info *, void *); | 127 | extern void crunch_task_copy(struct thread_info *, void *); |
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index 2037f7205987..1d37568c547a 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c | |||
| @@ -1924,7 +1924,7 @@ static int krait_pmu_get_event_idx(struct pmu_hw_events *cpuc, | |||
| 1924 | struct perf_event *event) | 1924 | struct perf_event *event) |
| 1925 | { | 1925 | { |
| 1926 | int idx; | 1926 | int idx; |
| 1927 | int bit; | 1927 | int bit = -1; |
| 1928 | unsigned int prefix; | 1928 | unsigned int prefix; |
| 1929 | unsigned int region; | 1929 | unsigned int region; |
| 1930 | unsigned int code; | 1930 | unsigned int code; |
| @@ -1953,7 +1953,7 @@ static int krait_pmu_get_event_idx(struct pmu_hw_events *cpuc, | |||
| 1953 | } | 1953 | } |
| 1954 | 1954 | ||
| 1955 | idx = armv7pmu_get_event_idx(cpuc, event); | 1955 | idx = armv7pmu_get_event_idx(cpuc, event); |
| 1956 | if (idx < 0 && krait_event) | 1956 | if (idx < 0 && bit >= 0) |
| 1957 | clear_bit(bit, cpuc->used_mask); | 1957 | clear_bit(bit, cpuc->used_mask); |
| 1958 | 1958 | ||
| 1959 | return idx; | 1959 | return idx; |
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 0dd3b79b15c3..0c27ed6f3f23 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
| @@ -908,7 +908,7 @@ enum ptrace_syscall_dir { | |||
| 908 | PTRACE_SYSCALL_EXIT, | 908 | PTRACE_SYSCALL_EXIT, |
| 909 | }; | 909 | }; |
| 910 | 910 | ||
| 911 | static int tracehook_report_syscall(struct pt_regs *regs, | 911 | static void tracehook_report_syscall(struct pt_regs *regs, |
| 912 | enum ptrace_syscall_dir dir) | 912 | enum ptrace_syscall_dir dir) |
| 913 | { | 913 | { |
| 914 | unsigned long ip; | 914 | unsigned long ip; |
| @@ -926,7 +926,6 @@ static int tracehook_report_syscall(struct pt_regs *regs, | |||
| 926 | current_thread_info()->syscall = -1; | 926 | current_thread_info()->syscall = -1; |
| 927 | 927 | ||
| 928 | regs->ARM_ip = ip; | 928 | regs->ARM_ip = ip; |
| 929 | return current_thread_info()->syscall; | ||
| 930 | } | 929 | } |
| 931 | 930 | ||
| 932 | asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) | 931 | asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) |
| @@ -938,7 +937,9 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) | |||
| 938 | return -1; | 937 | return -1; |
| 939 | 938 | ||
| 940 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 939 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
| 941 | scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); | 940 | tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER); |
| 941 | |||
| 942 | scno = current_thread_info()->syscall; | ||
| 942 | 943 | ||
| 943 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 944 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
| 944 | trace_sys_enter(regs, scno); | 945 | trace_sys_enter(regs, scno); |
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index 69fa48397394..8a134d019cb3 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c | |||
| @@ -46,13 +46,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) | |||
| 46 | if (cpu == 1) | 46 | if (cpu == 1) |
| 47 | exynos_cpu_power_down(cpu); | 47 | exynos_cpu_power_down(cpu); |
| 48 | 48 | ||
| 49 | /* | 49 | wfi(); |
| 50 | * here's the WFI | ||
| 51 | */ | ||
| 52 | asm(".word 0xe320f003\n" | ||
| 53 | : | ||
| 54 | : | ||
| 55 | : "memory", "cc"); | ||
| 56 | 50 | ||
| 57 | if (pen_release == cpu_logical_map(cpu)) { | 51 | if (pen_release == cpu_logical_map(cpu)) { |
| 58 | /* | 52 | /* |
diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index 0498d0b887ef..ace0ed617476 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | 25 | ||
| 26 | #define EXYNOS5420_CPUS_PER_CLUSTER 4 | 26 | #define EXYNOS5420_CPUS_PER_CLUSTER 4 |
| 27 | #define EXYNOS5420_NR_CLUSTERS 2 | 27 | #define EXYNOS5420_NR_CLUSTERS 2 |
| 28 | #define MCPM_BOOT_ADDR_OFFSET 0x1c | ||
| 29 | 28 | ||
| 30 | /* | 29 | /* |
| 31 | * The common v7_exit_coherency_flush API could not be used because of the | 30 | * The common v7_exit_coherency_flush API could not be used because of the |
| @@ -343,11 +342,13 @@ static int __init exynos_mcpm_init(void) | |||
| 343 | pr_info("Exynos MCPM support installed\n"); | 342 | pr_info("Exynos MCPM support installed\n"); |
| 344 | 343 | ||
| 345 | /* | 344 | /* |
| 346 | * Future entries into the kernel can now go | 345 | * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr |
| 347 | * through the cluster entry vectors. | 346 | * as part of secondary_cpu_start(). Let's redirect it to the |
| 347 | * mcpm_entry_point(). | ||
| 348 | */ | 348 | */ |
| 349 | __raw_writel(virt_to_phys(mcpm_entry_point), | 349 | __raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */ |
| 350 | ns_sram_base_addr + MCPM_BOOT_ADDR_OFFSET); | 350 | __raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */ |
| 351 | __raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8); | ||
| 351 | 352 | ||
| 352 | iounmap(ns_sram_base_addr); | 353 | iounmap(ns_sram_base_addr); |
| 353 | 354 | ||
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index 87c0d34c7fba..202ca73e49c4 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c | |||
| @@ -300,7 +300,7 @@ static int exynos_pm_suspend(void) | |||
| 300 | tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0); | 300 | tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0); |
| 301 | __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION); | 301 | __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION); |
| 302 | 302 | ||
| 303 | if (!soc_is_exynos5250()) | 303 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) |
| 304 | exynos_cpu_save_register(); | 304 | exynos_cpu_save_register(); |
| 305 | 305 | ||
| 306 | return 0; | 306 | return 0; |
| @@ -334,7 +334,7 @@ static void exynos_pm_resume(void) | |||
| 334 | if (exynos_pm_central_resume()) | 334 | if (exynos_pm_central_resume()) |
| 335 | goto early_wakeup; | 335 | goto early_wakeup; |
| 336 | 336 | ||
| 337 | if (!soc_is_exynos5250()) | 337 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) |
| 338 | exynos_cpu_restore_register(); | 338 | exynos_cpu_restore_register(); |
| 339 | 339 | ||
| 340 | /* For release retention */ | 340 | /* For release retention */ |
| @@ -353,7 +353,7 @@ static void exynos_pm_resume(void) | |||
| 353 | 353 | ||
| 354 | s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save)); | 354 | s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save)); |
| 355 | 355 | ||
| 356 | if (!soc_is_exynos5250()) | 356 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) |
| 357 | scu_enable(S5P_VA_SCU); | 357 | scu_enable(S5P_VA_SCU); |
| 358 | 358 | ||
| 359 | early_wakeup: | 359 | early_wakeup: |
| @@ -440,15 +440,18 @@ static int exynos_cpu_pm_notifier(struct notifier_block *self, | |||
| 440 | case CPU_PM_ENTER: | 440 | case CPU_PM_ENTER: |
| 441 | if (cpu == 0) { | 441 | if (cpu == 0) { |
| 442 | exynos_pm_central_suspend(); | 442 | exynos_pm_central_suspend(); |
| 443 | exynos_cpu_save_register(); | 443 | if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) |
| 444 | exynos_cpu_save_register(); | ||
| 444 | } | 445 | } |
| 445 | break; | 446 | break; |
| 446 | 447 | ||
| 447 | case CPU_PM_EXIT: | 448 | case CPU_PM_EXIT: |
| 448 | if (cpu == 0) { | 449 | if (cpu == 0) { |
| 449 | if (!soc_is_exynos5250()) | 450 | if (read_cpuid_part_number() == |
| 451 | ARM_CPU_PART_CORTEX_A9) { | ||
| 450 | scu_enable(S5P_VA_SCU); | 452 | scu_enable(S5P_VA_SCU); |
| 451 | exynos_cpu_restore_register(); | 453 | exynos_cpu_restore_register(); |
| 454 | } | ||
| 452 | exynos_pm_central_resume(); | 455 | exynos_pm_central_resume(); |
| 453 | } | 456 | } |
| 454 | break; | 457 | break; |
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 28fa2fa49e5d..4b5185748f74 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
| @@ -734,9 +734,9 @@ config SOC_IMX6 | |||
| 734 | select HAVE_IMX_MMDC | 734 | select HAVE_IMX_MMDC |
| 735 | select HAVE_IMX_SRC | 735 | select HAVE_IMX_SRC |
| 736 | select MFD_SYSCON | 736 | select MFD_SYSCON |
| 737 | select PL310_ERRATA_588369 if CACHE_PL310 | 737 | select PL310_ERRATA_588369 if CACHE_L2X0 |
| 738 | select PL310_ERRATA_727915 if CACHE_PL310 | 738 | select PL310_ERRATA_727915 if CACHE_L2X0 |
| 739 | select PL310_ERRATA_769419 if CACHE_PL310 | 739 | select PL310_ERRATA_769419 if CACHE_L2X0 |
| 740 | 740 | ||
| 741 | config SOC_IMX6Q | 741 | config SOC_IMX6Q |
| 742 | bool "i.MX6 Quad/DualLite support" | 742 | bool "i.MX6 Quad/DualLite support" |
| @@ -771,9 +771,9 @@ config SOC_VF610 | |||
| 771 | select ARM_GIC | 771 | select ARM_GIC |
| 772 | select PINCTRL_VF610 | 772 | select PINCTRL_VF610 |
| 773 | select VF_PIT_TIMER | 773 | select VF_PIT_TIMER |
| 774 | select PL310_ERRATA_588369 if CACHE_PL310 | 774 | select PL310_ERRATA_588369 if CACHE_L2X0 |
| 775 | select PL310_ERRATA_727915 if CACHE_PL310 | 775 | select PL310_ERRATA_727915 if CACHE_L2X0 |
| 776 | select PL310_ERRATA_769419 if CACHE_PL310 | 776 | select PL310_ERRATA_769419 if CACHE_L2X0 |
| 777 | 777 | ||
| 778 | help | 778 | help |
| 779 | This enable support for Freescale Vybrid VF610 processor. | 779 | This enable support for Freescale Vybrid VF610 processor. |
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c index 21cf06cebade..5408ca70c8d6 100644 --- a/arch/arm/mach-imx/clk-imx6sl.c +++ b/arch/arm/mach-imx/clk-imx6sl.c | |||
| @@ -312,6 +312,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node) | |||
| 312 | clks[IMX6SL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); | 312 | clks[IMX6SL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2); |
| 313 | clks[IMX6SL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); | 313 | clks[IMX6SL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4); |
| 314 | clks[IMX6SL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); | 314 | clks[IMX6SL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6); |
| 315 | clks[IMX6SL_CLK_ENET] = imx_clk_gate2("enet", "ipg", base + 0x6c, 10); | ||
| 315 | clks[IMX6SL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12); | 316 | clks[IMX6SL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12); |
| 316 | clks[IMX6SL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14); | 317 | clks[IMX6SL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14); |
| 317 | clks[IMX6SL_CLK_EXTERN_AUDIO] = imx_clk_gate2("extern_audio", "extern_audio_podf", base + 0x6c, 16); | 318 | clks[IMX6SL_CLK_EXTERN_AUDIO] = imx_clk_gate2("extern_audio", "extern_audio_podf", base + 0x6c, 16); |
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index dd0cc677d596..660ca6feff40 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c | |||
| @@ -480,25 +480,18 @@ static const struct of_device_id ebi_match[] = { | |||
| 480 | static void __init ap_init_of(void) | 480 | static void __init ap_init_of(void) |
| 481 | { | 481 | { |
| 482 | unsigned long sc_dec; | 482 | unsigned long sc_dec; |
| 483 | struct device_node *root; | ||
| 484 | struct device_node *syscon; | 483 | struct device_node *syscon; |
| 485 | struct device_node *ebi; | 484 | struct device_node *ebi; |
| 486 | struct device *parent; | 485 | struct device *parent; |
| 487 | struct soc_device *soc_dev; | 486 | struct soc_device *soc_dev; |
| 488 | struct soc_device_attribute *soc_dev_attr; | 487 | struct soc_device_attribute *soc_dev_attr; |
| 489 | u32 ap_sc_id; | 488 | u32 ap_sc_id; |
| 490 | int err; | ||
| 491 | int i; | 489 | int i; |
| 492 | 490 | ||
| 493 | /* Here we create an SoC device for the root node */ | 491 | syscon = of_find_matching_node(NULL, ap_syscon_match); |
| 494 | root = of_find_node_by_path("/"); | ||
| 495 | if (!root) | ||
| 496 | return; | ||
| 497 | |||
| 498 | syscon = of_find_matching_node(root, ap_syscon_match); | ||
| 499 | if (!syscon) | 492 | if (!syscon) |
| 500 | return; | 493 | return; |
| 501 | ebi = of_find_matching_node(root, ebi_match); | 494 | ebi = of_find_matching_node(NULL, ebi_match); |
| 502 | if (!ebi) | 495 | if (!ebi) |
| 503 | return; | 496 | return; |
| 504 | 497 | ||
| @@ -509,19 +502,17 @@ static void __init ap_init_of(void) | |||
| 509 | if (!ebi_base) | 502 | if (!ebi_base) |
| 510 | return; | 503 | return; |
| 511 | 504 | ||
| 505 | of_platform_populate(NULL, of_default_bus_match_table, | ||
| 506 | ap_auxdata_lookup, NULL); | ||
| 507 | |||
| 512 | ap_sc_id = readl(ap_syscon_base); | 508 | ap_sc_id = readl(ap_syscon_base); |
| 513 | 509 | ||
| 514 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); | 510 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); |
| 515 | if (!soc_dev_attr) | 511 | if (!soc_dev_attr) |
| 516 | return; | 512 | return; |
| 517 | 513 | ||
| 518 | err = of_property_read_string(root, "compatible", | 514 | soc_dev_attr->soc_id = "XVC"; |
| 519 | &soc_dev_attr->soc_id); | 515 | soc_dev_attr->machine = "Integrator/AP"; |
| 520 | if (err) | ||
| 521 | return; | ||
| 522 | err = of_property_read_string(root, "model", &soc_dev_attr->machine); | ||
| 523 | if (err) | ||
| 524 | return; | ||
| 525 | soc_dev_attr->family = "Integrator"; | 516 | soc_dev_attr->family = "Integrator"; |
| 526 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", | 517 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", |
| 527 | 'A' + (ap_sc_id & 0x0f)); | 518 | 'A' + (ap_sc_id & 0x0f)); |
| @@ -536,9 +527,6 @@ static void __init ap_init_of(void) | |||
| 536 | parent = soc_device_to_device(soc_dev); | 527 | parent = soc_device_to_device(soc_dev); |
| 537 | integrator_init_sysfs(parent, ap_sc_id); | 528 | integrator_init_sysfs(parent, ap_sc_id); |
| 538 | 529 | ||
| 539 | of_platform_populate(root, of_default_bus_match_table, | ||
| 540 | ap_auxdata_lookup, parent); | ||
| 541 | |||
| 542 | sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); | 530 | sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); |
| 543 | for (i = 0; i < 4; i++) { | 531 | for (i = 0; i < 4; i++) { |
| 544 | struct lm_device *lmdev; | 532 | struct lm_device *lmdev; |
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index a938242b0c95..0e57f8f820a5 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c | |||
| @@ -279,20 +279,13 @@ static const struct of_device_id intcp_syscon_match[] = { | |||
| 279 | 279 | ||
| 280 | static void __init intcp_init_of(void) | 280 | static void __init intcp_init_of(void) |
| 281 | { | 281 | { |
| 282 | struct device_node *root; | ||
| 283 | struct device_node *cpcon; | 282 | struct device_node *cpcon; |
| 284 | struct device *parent; | 283 | struct device *parent; |
| 285 | struct soc_device *soc_dev; | 284 | struct soc_device *soc_dev; |
| 286 | struct soc_device_attribute *soc_dev_attr; | 285 | struct soc_device_attribute *soc_dev_attr; |
| 287 | u32 intcp_sc_id; | 286 | u32 intcp_sc_id; |
| 288 | int err; | ||
| 289 | 287 | ||
| 290 | /* Here we create an SoC device for the root node */ | 288 | cpcon = of_find_matching_node(NULL, intcp_syscon_match); |
| 291 | root = of_find_node_by_path("/"); | ||
| 292 | if (!root) | ||
| 293 | return; | ||
| 294 | |||
| 295 | cpcon = of_find_matching_node(root, intcp_syscon_match); | ||
| 296 | if (!cpcon) | 289 | if (!cpcon) |
| 297 | return; | 290 | return; |
| 298 | 291 | ||
| @@ -300,19 +293,17 @@ static void __init intcp_init_of(void) | |||
| 300 | if (!intcp_con_base) | 293 | if (!intcp_con_base) |
| 301 | return; | 294 | return; |
| 302 | 295 | ||
| 296 | of_platform_populate(NULL, of_default_bus_match_table, | ||
| 297 | intcp_auxdata_lookup, NULL); | ||
| 298 | |||
| 303 | intcp_sc_id = readl(intcp_con_base); | 299 | intcp_sc_id = readl(intcp_con_base); |
| 304 | 300 | ||
| 305 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); | 301 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); |
| 306 | if (!soc_dev_attr) | 302 | if (!soc_dev_attr) |
| 307 | return; | 303 | return; |
| 308 | 304 | ||
| 309 | err = of_property_read_string(root, "compatible", | 305 | soc_dev_attr->soc_id = "XCV"; |
| 310 | &soc_dev_attr->soc_id); | 306 | soc_dev_attr->machine = "Integrator/CP"; |
| 311 | if (err) | ||
| 312 | return; | ||
| 313 | err = of_property_read_string(root, "model", &soc_dev_attr->machine); | ||
| 314 | if (err) | ||
| 315 | return; | ||
| 316 | soc_dev_attr->family = "Integrator"; | 307 | soc_dev_attr->family = "Integrator"; |
| 317 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", | 308 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c", |
| 318 | 'A' + (intcp_sc_id & 0x0f)); | 309 | 'A' + (intcp_sc_id & 0x0f)); |
| @@ -326,8 +317,6 @@ static void __init intcp_init_of(void) | |||
| 326 | 317 | ||
| 327 | parent = soc_device_to_device(soc_dev); | 318 | parent = soc_device_to_device(soc_dev); |
| 328 | integrator_init_sysfs(parent, intcp_sc_id); | 319 | integrator_init_sysfs(parent, intcp_sc_id); |
| 329 | of_platform_populate(root, of_default_bus_match_table, | ||
| 330 | intcp_auxdata_lookup, parent); | ||
| 331 | } | 320 | } |
| 332 | 321 | ||
| 333 | static const char * intcp_dt_board_compat[] = { | 322 | static const char * intcp_dt_board_compat[] = { |
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 4a7c250c9a30..b9bc599a5fd0 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig | |||
| @@ -10,6 +10,7 @@ menuconfig ARCH_MVEBU | |||
| 10 | select ZONE_DMA if ARM_LPAE | 10 | select ZONE_DMA if ARM_LPAE |
| 11 | select ARCH_REQUIRE_GPIOLIB | 11 | select ARCH_REQUIRE_GPIOLIB |
| 12 | select PCI_QUIRKS if PCI | 12 | select PCI_QUIRKS if PCI |
| 13 | select OF_ADDRESS_PCI | ||
| 13 | 14 | ||
| 14 | if ARCH_MVEBU | 15 | if ARCH_MVEBU |
| 15 | 16 | ||
| @@ -17,6 +18,7 @@ config MACH_MVEBU_V7 | |||
| 17 | bool | 18 | bool |
| 18 | select ARMADA_370_XP_TIMER | 19 | select ARMADA_370_XP_TIMER |
| 19 | select CACHE_L2X0 | 20 | select CACHE_L2X0 |
| 21 | select ARM_CPU_SUSPEND | ||
| 20 | 22 | ||
| 21 | config MACH_ARMADA_370 | 23 | config MACH_ARMADA_370 |
| 22 | bool "Marvell Armada 370 boards" if ARCH_MULTI_V7 | 24 | bool "Marvell Armada 370 boards" if ARCH_MULTI_V7 |
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index 2ecb828e4a8b..1636cdbef01a 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile | |||
| @@ -7,7 +7,7 @@ CFLAGS_pmsu.o := -march=armv7-a | |||
| 7 | obj-y += system-controller.o mvebu-soc-id.o | 7 | obj-y += system-controller.o mvebu-soc-id.o |
| 8 | 8 | ||
| 9 | ifeq ($(CONFIG_MACH_MVEBU_V7),y) | 9 | ifeq ($(CONFIG_MACH_MVEBU_V7),y) |
| 10 | obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o | 10 | obj-y += cpu-reset.o board-v7.o coherency.o coherency_ll.o pmsu.o pmsu_ll.o |
| 11 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o | 11 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o |
| 12 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 12 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
| 13 | endif | 13 | endif |
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index 8bb742fdf5ca..b2524d689f21 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/mbus.h> | 23 | #include <linux/mbus.h> |
| 24 | #include <linux/signal.h> | 24 | #include <linux/signal.h> |
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/irqchip.h> | ||
| 26 | #include <asm/hardware/cache-l2x0.h> | 27 | #include <asm/hardware/cache-l2x0.h> |
| 27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
| 28 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
| @@ -71,17 +72,23 @@ static int armada_375_external_abort_wa(unsigned long addr, unsigned int fsr, | |||
| 71 | return 1; | 72 | return 1; |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | static void __init mvebu_timer_and_clk_init(void) | 75 | static void __init mvebu_init_irq(void) |
| 75 | { | 76 | { |
| 76 | of_clk_init(NULL); | 77 | irqchip_init(); |
| 77 | clocksource_of_init(); | ||
| 78 | mvebu_scu_enable(); | 78 | mvebu_scu_enable(); |
| 79 | coherency_init(); | 79 | coherency_init(); |
| 80 | BUG_ON(mvebu_mbus_dt_init(coherency_available())); | 80 | BUG_ON(mvebu_mbus_dt_init(coherency_available())); |
| 81 | } | ||
| 82 | |||
| 83 | static void __init external_abort_quirk(void) | ||
| 84 | { | ||
| 85 | u32 dev, rev; | ||
| 81 | 86 | ||
| 82 | if (of_machine_is_compatible("marvell,armada375")) | 87 | if (mvebu_get_soc_id(&dev, &rev) == 0 && rev > ARMADA_375_Z1_REV) |
| 83 | hook_fault_code(16 + 6, armada_375_external_abort_wa, SIGBUS, 0, | 88 | return; |
| 84 | "imprecise external abort"); | 89 | |
| 90 | hook_fault_code(16 + 6, armada_375_external_abort_wa, SIGBUS, 0, | ||
| 91 | "imprecise external abort"); | ||
| 85 | } | 92 | } |
| 86 | 93 | ||
| 87 | static void __init i2c_quirk(void) | 94 | static void __init i2c_quirk(void) |
| @@ -169,8 +176,10 @@ static void __init mvebu_dt_init(void) | |||
| 169 | { | 176 | { |
| 170 | if (of_machine_is_compatible("plathome,openblocks-ax3-4")) | 177 | if (of_machine_is_compatible("plathome,openblocks-ax3-4")) |
| 171 | i2c_quirk(); | 178 | i2c_quirk(); |
| 172 | if (of_machine_is_compatible("marvell,a375-db")) | 179 | if (of_machine_is_compatible("marvell,a375-db")) { |
| 180 | external_abort_quirk(); | ||
| 173 | thermal_quirk(); | 181 | thermal_quirk(); |
| 182 | } | ||
| 174 | 183 | ||
| 175 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 184 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
| 176 | } | 185 | } |
| @@ -185,7 +194,7 @@ DT_MACHINE_START(ARMADA_370_XP_DT, "Marvell Armada 370/XP (Device Tree)") | |||
| 185 | .l2c_aux_mask = ~0, | 194 | .l2c_aux_mask = ~0, |
| 186 | .smp = smp_ops(armada_xp_smp_ops), | 195 | .smp = smp_ops(armada_xp_smp_ops), |
| 187 | .init_machine = mvebu_dt_init, | 196 | .init_machine = mvebu_dt_init, |
| 188 | .init_time = mvebu_timer_and_clk_init, | 197 | .init_irq = mvebu_init_irq, |
| 189 | .restart = mvebu_restart, | 198 | .restart = mvebu_restart, |
| 190 | .dt_compat = armada_370_xp_dt_compat, | 199 | .dt_compat = armada_370_xp_dt_compat, |
| 191 | MACHINE_END | 200 | MACHINE_END |
| @@ -198,7 +207,7 @@ static const char * const armada_375_dt_compat[] = { | |||
| 198 | DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)") | 207 | DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)") |
| 199 | .l2c_aux_val = 0, | 208 | .l2c_aux_val = 0, |
| 200 | .l2c_aux_mask = ~0, | 209 | .l2c_aux_mask = ~0, |
| 201 | .init_time = mvebu_timer_and_clk_init, | 210 | .init_irq = mvebu_init_irq, |
| 202 | .init_machine = mvebu_dt_init, | 211 | .init_machine = mvebu_dt_init, |
| 203 | .restart = mvebu_restart, | 212 | .restart = mvebu_restart, |
| 204 | .dt_compat = armada_375_dt_compat, | 213 | .dt_compat = armada_375_dt_compat, |
| @@ -213,7 +222,7 @@ static const char * const armada_38x_dt_compat[] = { | |||
| 213 | DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)") | 222 | DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)") |
| 214 | .l2c_aux_val = 0, | 223 | .l2c_aux_val = 0, |
| 215 | .l2c_aux_mask = ~0, | 224 | .l2c_aux_mask = ~0, |
| 216 | .init_time = mvebu_timer_and_clk_init, | 225 | .init_irq = mvebu_init_irq, |
| 217 | .restart = mvebu_restart, | 226 | .restart = mvebu_restart, |
| 218 | .dt_compat = armada_38x_dt_compat, | 227 | .dt_compat = armada_38x_dt_compat, |
| 219 | MACHINE_END | 228 | MACHINE_END |
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c index 53a55c8520bf..a1d407c0febe 100644 --- a/arch/arm/mach-mvebu/pmsu.c +++ b/arch/arm/mach-mvebu/pmsu.c | |||
| @@ -66,6 +66,8 @@ static void __iomem *pmsu_mp_base; | |||
| 66 | extern void ll_disable_coherency(void); | 66 | extern void ll_disable_coherency(void); |
| 67 | extern void ll_enable_coherency(void); | 67 | extern void ll_enable_coherency(void); |
| 68 | 68 | ||
| 69 | extern void armada_370_xp_cpu_resume(void); | ||
| 70 | |||
| 69 | static struct platform_device armada_xp_cpuidle_device = { | 71 | static struct platform_device armada_xp_cpuidle_device = { |
| 70 | .name = "cpuidle-armada-370-xp", | 72 | .name = "cpuidle-armada-370-xp", |
| 71 | }; | 73 | }; |
| @@ -140,13 +142,6 @@ static void armada_370_xp_pmsu_enable_l2_powerdown_onidle(void) | |||
| 140 | writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL); | 142 | writel(reg, pmsu_mp_base + L2C_NFABRIC_PM_CTL); |
| 141 | } | 143 | } |
| 142 | 144 | ||
| 143 | static void armada_370_xp_cpu_resume(void) | ||
| 144 | { | ||
| 145 | asm volatile("bl ll_add_cpu_to_smp_group\n\t" | ||
| 146 | "bl ll_enable_coherency\n\t" | ||
| 147 | "b cpu_resume\n\t"); | ||
| 148 | } | ||
| 149 | |||
| 150 | /* No locking is needed because we only access per-CPU registers */ | 145 | /* No locking is needed because we only access per-CPU registers */ |
| 151 | void armada_370_xp_pmsu_idle_prepare(bool deepidle) | 146 | void armada_370_xp_pmsu_idle_prepare(bool deepidle) |
| 152 | { | 147 | { |
diff --git a/arch/arm/mach-mvebu/pmsu_ll.S b/arch/arm/mach-mvebu/pmsu_ll.S new file mode 100644 index 000000000000..fc3de68d8c54 --- /dev/null +++ b/arch/arm/mach-mvebu/pmsu_ll.S | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2014 Marvell | ||
| 3 | * | ||
| 4 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
| 5 | * Gregory Clement <gregory.clement@free-electrons.com> | ||
| 6 | * | ||
| 7 | * This file is licensed under the terms of the GNU General Public | ||
| 8 | * License version 2. This program is licensed "as is" without any | ||
| 9 | * warranty of any kind, whether express or implied. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/linkage.h> | ||
| 13 | #include <asm/assembler.h> | ||
| 14 | |||
| 15 | /* | ||
| 16 | * This is the entry point through which CPUs exiting cpuidle deep | ||
| 17 | * idle state are going. | ||
| 18 | */ | ||
| 19 | ENTRY(armada_370_xp_cpu_resume) | ||
| 20 | ARM_BE8(setend be ) @ go BE8 if entered LE | ||
| 21 | bl ll_add_cpu_to_smp_group | ||
| 22 | bl ll_enable_coherency | ||
| 23 | b cpu_resume | ||
| 24 | ENDPROC(armada_370_xp_cpu_resume) | ||
| 25 | |||
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 062505345c95..1c1ed737f7ab 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
| @@ -34,8 +34,8 @@ config ARCH_OMAP4 | |||
| 34 | select HAVE_ARM_SCU if SMP | 34 | select HAVE_ARM_SCU if SMP |
| 35 | select HAVE_ARM_TWD if SMP | 35 | select HAVE_ARM_TWD if SMP |
| 36 | select OMAP_INTERCONNECT | 36 | select OMAP_INTERCONNECT |
| 37 | select PL310_ERRATA_588369 | 37 | select PL310_ERRATA_588369 if CACHE_L2X0 |
| 38 | select PL310_ERRATA_727915 | 38 | select PL310_ERRATA_727915 if CACHE_L2X0 |
| 39 | select PM_OPP if PM | 39 | select PM_OPP if PM |
| 40 | select PM_RUNTIME if CPU_IDLE | 40 | select PM_RUNTIME if CPU_IDLE |
| 41 | select ARM_ERRATA_754322 | 41 | select ARM_ERRATA_754322 |
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 8421f38cf445..8ca99e9321e3 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
| @@ -110,14 +110,16 @@ obj-y += prm_common.o cm_common.o | |||
| 110 | obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o | 110 | obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o |
| 111 | obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o | 111 | obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o |
| 112 | obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o | 112 | obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o |
| 113 | obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o | ||
| 114 | omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ | 113 | omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ |
| 115 | prcm_mpu44xx.o prminst44xx.o \ | 114 | prcm_mpu44xx.o prminst44xx.o \ |
| 116 | vc44xx_data.o vp44xx_data.o | 115 | vc44xx_data.o vp44xx_data.o |
| 117 | obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) | 116 | obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) |
| 118 | obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) | 117 | obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) |
| 119 | obj-$(CONFIG_SOC_DRA7XX) += $(omap-prcm-4-5-common) | 118 | obj-$(CONFIG_SOC_DRA7XX) += $(omap-prcm-4-5-common) |
| 120 | obj-$(CONFIG_SOC_AM43XX) += $(omap-prcm-4-5-common) | 119 | am33xx-43xx-prcm-common += prm33xx.o cm33xx.o |
| 120 | obj-$(CONFIG_SOC_AM33XX) += $(am33xx-43xx-prcm-common) | ||
| 121 | obj-$(CONFIG_SOC_AM43XX) += $(omap-prcm-4-5-common) \ | ||
| 122 | $(am33xx-43xx-prcm-common) | ||
| 121 | 123 | ||
| 122 | # OMAP voltage domains | 124 | # OMAP voltage domains |
| 123 | voltagedomain-common := voltage.o vc.o vp.o | 125 | voltagedomain-common := voltage.o vc.o vp.o |
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h index 15a778ce7707..bd2441790779 100644 --- a/arch/arm/mach-omap2/cm33xx.h +++ b/arch/arm/mach-omap2/cm33xx.h | |||
| @@ -380,7 +380,7 @@ void am33xx_cm_clkdm_disable_hwsup(u16 inst, u16 cdoffs); | |||
| 380 | void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs); | 380 | void am33xx_cm_clkdm_force_sleep(u16 inst, u16 cdoffs); |
| 381 | void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs); | 381 | void am33xx_cm_clkdm_force_wakeup(u16 inst, u16 cdoffs); |
| 382 | 382 | ||
| 383 | #ifdef CONFIG_SOC_AM33XX | 383 | #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) |
| 384 | extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, | 384 | extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, |
| 385 | u16 clkctrl_offs); | 385 | u16 clkctrl_offs); |
| 386 | extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, | 386 | extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, |
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index a373d508799a..b2d252bf4a53 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
| @@ -248,7 +248,6 @@ static inline void __iomem *omap4_get_scu_base(void) | |||
| 248 | } | 248 | } |
| 249 | #endif | 249 | #endif |
| 250 | 250 | ||
| 251 | extern void __init gic_init_irq(void); | ||
| 252 | extern void gic_dist_disable(void); | 251 | extern void gic_dist_disable(void); |
| 253 | extern void gic_dist_enable(void); | 252 | extern void gic_dist_enable(void); |
| 254 | extern bool gic_dist_disabled(void); | 253 | extern bool gic_dist_disabled(void); |
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 43969da5d50b..d42022f2a71e 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c | |||
| @@ -649,6 +649,18 @@ void __init dra7xxx_check_revision(void) | |||
| 649 | } | 649 | } |
| 650 | break; | 650 | break; |
| 651 | 651 | ||
| 652 | case 0xb9bc: | ||
| 653 | switch (rev) { | ||
| 654 | case 0: | ||
| 655 | omap_revision = DRA722_REV_ES1_0; | ||
| 656 | break; | ||
| 657 | default: | ||
| 658 | /* If we have no new revisions */ | ||
| 659 | omap_revision = DRA722_REV_ES1_0; | ||
| 660 | break; | ||
| 661 | } | ||
| 662 | break; | ||
| 663 | |||
| 652 | default: | 664 | default: |
| 653 | /* Unknown default to latest silicon rev as default*/ | 665 | /* Unknown default to latest silicon rev as default*/ |
| 654 | pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n", | 666 | pr_warn("%s: unknown idcode=0x%08x (hawkeye=0x%08x,rev=0x%d)\n", |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index fd88edeb027f..f62f7537d899 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
| @@ -183,8 +183,10 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, | |||
| 183 | m0_entry = mux->muxnames[0]; | 183 | m0_entry = mux->muxnames[0]; |
| 184 | 184 | ||
| 185 | /* First check for full name in mode0.muxmode format */ | 185 | /* First check for full name in mode0.muxmode format */ |
| 186 | if (mode0_len && strncmp(muxname, m0_entry, mode0_len)) | 186 | if (mode0_len) |
| 187 | continue; | 187 | if (strncmp(muxname, m0_entry, mode0_len) || |
| 188 | (strlen(m0_entry) != mode0_len)) | ||
| 189 | continue; | ||
| 188 | 190 | ||
| 189 | /* Then check for muxmode only */ | 191 | /* Then check for muxmode only */ |
| 190 | for (i = 0; i < OMAP_MUX_NR_MODES; i++) { | 192 | for (i = 0; i < OMAP_MUX_NR_MODES; i++) { |
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index 326cd982a3cb..539e8106eb96 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
| @@ -102,26 +102,6 @@ void __init omap_barriers_init(void) | |||
| 102 | {} | 102 | {} |
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
| 105 | void __init gic_init_irq(void) | ||
| 106 | { | ||
| 107 | void __iomem *omap_irq_base; | ||
| 108 | |||
| 109 | /* Static mapping, never released */ | ||
| 110 | gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K); | ||
| 111 | BUG_ON(!gic_dist_base_addr); | ||
| 112 | |||
| 113 | twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_4K); | ||
| 114 | BUG_ON(!twd_base); | ||
| 115 | |||
| 116 | /* Static mapping, never released */ | ||
| 117 | omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); | ||
| 118 | BUG_ON(!omap_irq_base); | ||
| 119 | |||
| 120 | omap_wakeupgen_init(); | ||
| 121 | |||
| 122 | gic_init(0, 29, gic_dist_base_addr, omap_irq_base); | ||
| 123 | } | ||
| 124 | |||
| 125 | void gic_dist_disable(void) | 105 | void gic_dist_disable(void) |
| 126 | { | 106 | { |
| 127 | if (gic_dist_base_addr) | 107 | if (gic_dist_base_addr) |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index f7bb435bb543..6c074f37cdd2 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
| @@ -4251,9 +4251,9 @@ void __init omap_hwmod_init(void) | |||
| 4251 | soc_ops.enable_module = _omap4_enable_module; | 4251 | soc_ops.enable_module = _omap4_enable_module; |
| 4252 | soc_ops.disable_module = _omap4_disable_module; | 4252 | soc_ops.disable_module = _omap4_disable_module; |
| 4253 | soc_ops.wait_target_ready = _omap4_wait_target_ready; | 4253 | soc_ops.wait_target_ready = _omap4_wait_target_ready; |
| 4254 | soc_ops.assert_hardreset = _omap4_assert_hardreset; | 4254 | soc_ops.assert_hardreset = _am33xx_assert_hardreset; |
| 4255 | soc_ops.deassert_hardreset = _omap4_deassert_hardreset; | 4255 | soc_ops.deassert_hardreset = _am33xx_deassert_hardreset; |
| 4256 | soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; | 4256 | soc_ops.is_hardreset_asserted = _am33xx_is_hardreset_asserted; |
| 4257 | soc_ops.init_clkdm = _init_clkdm; | 4257 | soc_ops.init_clkdm = _init_clkdm; |
| 4258 | } else if (soc_is_am33xx()) { | 4258 | } else if (soc_is_am33xx()) { |
| 4259 | soc_ops.enable_module = _am33xx_enable_module; | 4259 | soc_ops.enable_module = _am33xx_enable_module; |
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index 290213f2cbe3..1103aa0e0d29 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c | |||
| @@ -2020,6 +2020,77 @@ static struct omap_hwmod omap54xx_wd_timer2_hwmod = { | |||
| 2020 | }, | 2020 | }, |
| 2021 | }; | 2021 | }; |
| 2022 | 2022 | ||
| 2023 | /* | ||
| 2024 | * 'ocp2scp' class | ||
| 2025 | * bridge to transform ocp interface protocol to scp (serial control port) | ||
| 2026 | * protocol | ||
| 2027 | */ | ||
| 2028 | /* ocp2scp3 */ | ||
| 2029 | static struct omap_hwmod omap54xx_ocp2scp3_hwmod; | ||
| 2030 | /* l4_cfg -> ocp2scp3 */ | ||
| 2031 | static struct omap_hwmod_ocp_if omap54xx_l4_cfg__ocp2scp3 = { | ||
| 2032 | .master = &omap54xx_l4_cfg_hwmod, | ||
| 2033 | .slave = &omap54xx_ocp2scp3_hwmod, | ||
| 2034 | .clk = "l4_root_clk_div", | ||
| 2035 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
| 2036 | }; | ||
| 2037 | |||
| 2038 | static struct omap_hwmod omap54xx_ocp2scp3_hwmod = { | ||
| 2039 | .name = "ocp2scp3", | ||
| 2040 | .class = &omap54xx_ocp2scp_hwmod_class, | ||
| 2041 | .clkdm_name = "l3init_clkdm", | ||
| 2042 | .prcm = { | ||
| 2043 | .omap4 = { | ||
| 2044 | .clkctrl_offs = OMAP54XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET, | ||
| 2045 | .context_offs = OMAP54XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET, | ||
| 2046 | .modulemode = MODULEMODE_HWCTRL, | ||
| 2047 | }, | ||
| 2048 | }, | ||
| 2049 | }; | ||
| 2050 | |||
| 2051 | /* | ||
| 2052 | * 'sata' class | ||
| 2053 | * sata: serial ata interface gen2 compliant ( 1 rx/ 1 tx) | ||
| 2054 | */ | ||
| 2055 | |||
| 2056 | static struct omap_hwmod_class_sysconfig omap54xx_sata_sysc = { | ||
| 2057 | .sysc_offs = 0x0000, | ||
| 2058 | .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE), | ||
| 2059 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | ||
| 2060 | SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | | ||
| 2061 | MSTANDBY_SMART | MSTANDBY_SMART_WKUP), | ||
| 2062 | .sysc_fields = &omap_hwmod_sysc_type2, | ||
| 2063 | }; | ||
| 2064 | |||
| 2065 | static struct omap_hwmod_class omap54xx_sata_hwmod_class = { | ||
| 2066 | .name = "sata", | ||
| 2067 | .sysc = &omap54xx_sata_sysc, | ||
| 2068 | }; | ||
| 2069 | |||
| 2070 | /* sata */ | ||
| 2071 | static struct omap_hwmod omap54xx_sata_hwmod = { | ||
| 2072 | .name = "sata", | ||
| 2073 | .class = &omap54xx_sata_hwmod_class, | ||
| 2074 | .clkdm_name = "l3init_clkdm", | ||
| 2075 | .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, | ||
| 2076 | .main_clk = "func_48m_fclk", | ||
| 2077 | .mpu_rt_idx = 1, | ||
| 2078 | .prcm = { | ||
| 2079 | .omap4 = { | ||
| 2080 | .clkctrl_offs = OMAP54XX_CM_L3INIT_SATA_CLKCTRL_OFFSET, | ||
| 2081 | .context_offs = OMAP54XX_RM_L3INIT_SATA_CONTEXT_OFFSET, | ||
| 2082 | .modulemode = MODULEMODE_SWCTRL, | ||
| 2083 | }, | ||
| 2084 | }, | ||
| 2085 | }; | ||
| 2086 | |||
| 2087 | /* l4_cfg -> sata */ | ||
| 2088 | static struct omap_hwmod_ocp_if omap54xx_l4_cfg__sata = { | ||
| 2089 | .master = &omap54xx_l4_cfg_hwmod, | ||
| 2090 | .slave = &omap54xx_sata_hwmod, | ||
| 2091 | .clk = "l3_iclk_div", | ||
| 2092 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
| 2093 | }; | ||
| 2023 | 2094 | ||
| 2024 | /* | 2095 | /* |
| 2025 | * Interfaces | 2096 | * Interfaces |
| @@ -2765,6 +2836,8 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = { | |||
| 2765 | &omap54xx_l4_cfg__usb_tll_hs, | 2836 | &omap54xx_l4_cfg__usb_tll_hs, |
| 2766 | &omap54xx_l4_cfg__usb_otg_ss, | 2837 | &omap54xx_l4_cfg__usb_otg_ss, |
| 2767 | &omap54xx_l4_wkup__wd_timer2, | 2838 | &omap54xx_l4_wkup__wd_timer2, |
| 2839 | &omap54xx_l4_cfg__ocp2scp3, | ||
| 2840 | &omap54xx_l4_cfg__sata, | ||
| 2768 | NULL, | 2841 | NULL, |
| 2769 | }; | 2842 | }; |
| 2770 | 2843 | ||
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h index de2a34c423a7..01ca8086fb6c 100644 --- a/arch/arm/mach-omap2/soc.h +++ b/arch/arm/mach-omap2/soc.h | |||
| @@ -462,6 +462,7 @@ IS_OMAP_TYPE(3430, 0x3430) | |||
| 462 | #define DRA7XX_CLASS 0x07000000 | 462 | #define DRA7XX_CLASS 0x07000000 |
| 463 | #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8)) | 463 | #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8)) |
| 464 | #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8)) | 464 | #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8)) |
| 465 | #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8)) | ||
| 465 | 466 | ||
| 466 | void omap2xxx_check_revision(void); | 467 | void omap2xxx_check_revision(void); |
| 467 | void omap3xxx_check_revision(void); | 468 | void omap3xxx_check_revision(void); |
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index f9874ba60cc8..108939f8d053 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
| @@ -329,6 +329,11 @@ static struct mtd_partition collie_partitions[] = { | |||
| 329 | .name = "rootfs", | 329 | .name = "rootfs", |
| 330 | .offset = MTDPART_OFS_APPEND, | 330 | .offset = MTDPART_OFS_APPEND, |
| 331 | .size = 0x00e20000, | 331 | .size = 0x00e20000, |
| 332 | }, { | ||
| 333 | .name = "bootblock", | ||
| 334 | .offset = MTDPART_OFS_APPEND, | ||
| 335 | .size = 0x00020000, | ||
| 336 | .mask_flags = MTD_WRITEABLE | ||
| 332 | } | 337 | } |
| 333 | }; | 338 | }; |
| 334 | 339 | ||
| @@ -356,7 +361,7 @@ static void collie_flash_exit(void) | |||
| 356 | } | 361 | } |
| 357 | 362 | ||
| 358 | static struct flash_platform_data collie_flash_data = { | 363 | static struct flash_platform_data collie_flash_data = { |
| 359 | .map_name = "jedec_probe", | 364 | .map_name = "cfi_probe", |
| 360 | .init = collie_flash_init, | 365 | .init = collie_flash_init, |
| 361 | .set_vpp = collie_set_vpp, | 366 | .set_vpp = collie_set_vpp, |
| 362 | .exit = collie_flash_exit, | 367 | .exit = collie_flash_exit, |
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig index 7e33e9d2c42e..878e9ec97d0f 100644 --- a/arch/arm/mach-sti/Kconfig +++ b/arch/arm/mach-sti/Kconfig | |||
| @@ -11,8 +11,8 @@ menuconfig ARCH_STI | |||
| 11 | select ARM_ERRATA_754322 | 11 | select ARM_ERRATA_754322 |
| 12 | select ARM_ERRATA_764369 if SMP | 12 | select ARM_ERRATA_764369 if SMP |
| 13 | select ARM_ERRATA_775420 | 13 | select ARM_ERRATA_775420 |
| 14 | select PL310_ERRATA_753970 if CACHE_PL310 | 14 | select PL310_ERRATA_753970 if CACHE_L2X0 |
| 15 | select PL310_ERRATA_769419 if CACHE_PL310 | 15 | select PL310_ERRATA_769419 if CACHE_L2X0 |
| 16 | help | 16 | help |
| 17 | Include support for STiH41x SOCs like STiH415/416 using the device tree | 17 | Include support for STiH41x SOCs like STiH415/416 using the device tree |
| 18 | for discovery | 18 | for discovery |
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c index 3f9587bb51f6..b6085084e0ff 100644 --- a/arch/arm/mach-sunxi/sunxi.c +++ b/arch/arm/mach-sunxi/sunxi.c | |||
| @@ -12,8 +12,81 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/clk-provider.h> | 13 | #include <linux/clk-provider.h> |
| 14 | #include <linux/clocksource.h> | 14 | #include <linux/clocksource.h> |
| 15 | #include <linux/delay.h> | ||
| 16 | #include <linux/kernel.h> | ||
| 17 | #include <linux/init.h> | ||
| 18 | #include <linux/of_address.h> | ||
| 19 | #include <linux/of_irq.h> | ||
| 20 | #include <linux/of_platform.h> | ||
| 21 | #include <linux/io.h> | ||
| 22 | #include <linux/reboot.h> | ||
| 15 | 23 | ||
| 16 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
| 25 | #include <asm/mach/map.h> | ||
| 26 | #include <asm/system_misc.h> | ||
| 27 | |||
| 28 | #define SUN4I_WATCHDOG_CTRL_REG 0x00 | ||
| 29 | #define SUN4I_WATCHDOG_CTRL_RESTART BIT(0) | ||
| 30 | #define SUN4I_WATCHDOG_MODE_REG 0x04 | ||
| 31 | #define SUN4I_WATCHDOG_MODE_ENABLE BIT(0) | ||
| 32 | #define SUN4I_WATCHDOG_MODE_RESET_ENABLE BIT(1) | ||
| 33 | |||
| 34 | #define SUN6I_WATCHDOG1_IRQ_REG 0x00 | ||
| 35 | #define SUN6I_WATCHDOG1_CTRL_REG 0x10 | ||
| 36 | #define SUN6I_WATCHDOG1_CTRL_RESTART BIT(0) | ||
| 37 | #define SUN6I_WATCHDOG1_CONFIG_REG 0x14 | ||
| 38 | #define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0) | ||
| 39 | #define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1) | ||
| 40 | #define SUN6I_WATCHDOG1_MODE_REG 0x18 | ||
| 41 | #define SUN6I_WATCHDOG1_MODE_ENABLE BIT(0) | ||
| 42 | |||
| 43 | static void __iomem *wdt_base; | ||
| 44 | |||
| 45 | static void sun4i_restart(enum reboot_mode mode, const char *cmd) | ||
| 46 | { | ||
| 47 | if (!wdt_base) | ||
| 48 | return; | ||
| 49 | |||
| 50 | /* Enable timer and set reset bit in the watchdog */ | ||
| 51 | writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE, | ||
| 52 | wdt_base + SUN4I_WATCHDOG_MODE_REG); | ||
| 53 | |||
| 54 | /* | ||
| 55 | * Restart the watchdog. The default (and lowest) interval | ||
| 56 | * value for the watchdog is 0.5s. | ||
| 57 | */ | ||
| 58 | writel(SUN4I_WATCHDOG_CTRL_RESTART, wdt_base + SUN4I_WATCHDOG_CTRL_REG); | ||
| 59 | |||
| 60 | while (1) { | ||
| 61 | mdelay(5); | ||
| 62 | writel(SUN4I_WATCHDOG_MODE_ENABLE | SUN4I_WATCHDOG_MODE_RESET_ENABLE, | ||
| 63 | wdt_base + SUN4I_WATCHDOG_MODE_REG); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | static struct of_device_id sunxi_restart_ids[] = { | ||
| 68 | { .compatible = "allwinner,sun4i-a10-wdt" }, | ||
| 69 | { /*sentinel*/ } | ||
| 70 | }; | ||
| 71 | |||
| 72 | static void sunxi_setup_restart(void) | ||
| 73 | { | ||
| 74 | struct device_node *np; | ||
| 75 | |||
| 76 | np = of_find_matching_node(NULL, sunxi_restart_ids); | ||
| 77 | if (WARN(!np, "unable to setup watchdog restart")) | ||
| 78 | return; | ||
| 79 | |||
| 80 | wdt_base = of_iomap(np, 0); | ||
| 81 | WARN(!wdt_base, "failed to map watchdog base address"); | ||
| 82 | } | ||
| 83 | |||
| 84 | static void __init sunxi_dt_init(void) | ||
| 85 | { | ||
| 86 | sunxi_setup_restart(); | ||
| 87 | |||
| 88 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
| 89 | } | ||
| 17 | 90 | ||
| 18 | static const char * const sunxi_board_dt_compat[] = { | 91 | static const char * const sunxi_board_dt_compat[] = { |
| 19 | "allwinner,sun4i-a10", | 92 | "allwinner,sun4i-a10", |
| @@ -23,7 +96,9 @@ static const char * const sunxi_board_dt_compat[] = { | |||
| 23 | }; | 96 | }; |
| 24 | 97 | ||
| 25 | DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") | 98 | DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") |
| 99 | .init_machine = sunxi_dt_init, | ||
| 26 | .dt_compat = sunxi_board_dt_compat, | 100 | .dt_compat = sunxi_board_dt_compat, |
| 101 | .restart = sun4i_restart, | ||
| 27 | MACHINE_END | 102 | MACHINE_END |
| 28 | 103 | ||
| 29 | static const char * const sun6i_board_dt_compat[] = { | 104 | static const char * const sun6i_board_dt_compat[] = { |
| @@ -51,5 +126,7 @@ static const char * const sun7i_board_dt_compat[] = { | |||
| 51 | }; | 126 | }; |
| 52 | 127 | ||
| 53 | DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family") | 128 | DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family") |
| 129 | .init_machine = sunxi_dt_init, | ||
| 54 | .dt_compat = sun7i_board_dt_compat, | 130 | .dt_compat = sun7i_board_dt_compat, |
| 131 | .restart = sun4i_restart, | ||
| 55 | MACHINE_END | 132 | MACHINE_END |
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index 5be7c4583a93..699e8601dbf0 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig | |||
| @@ -15,7 +15,7 @@ menuconfig ARCH_U8500 | |||
| 15 | select PINCTRL | 15 | select PINCTRL |
| 16 | select PINCTRL_ABX500 | 16 | select PINCTRL_ABX500 |
| 17 | select PINCTRL_NOMADIK | 17 | select PINCTRL_NOMADIK |
| 18 | select PL310_ERRATA_753970 if CACHE_PL310 | 18 | select PL310_ERRATA_753970 if CACHE_L2X0 |
| 19 | help | 19 | help |
| 20 | Support for ST-Ericsson's Ux500 architecture | 20 | Support for ST-Ericsson's Ux500 architecture |
| 21 | 21 | ||
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig index 99c1f151c403..d8b9330f896a 100644 --- a/arch/arm/mach-vexpress/Kconfig +++ b/arch/arm/mach-vexpress/Kconfig | |||
| @@ -43,7 +43,7 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA | |||
| 43 | bool "Enable A5 and A9 only errata work-arounds" | 43 | bool "Enable A5 and A9 only errata work-arounds" |
| 44 | default y | 44 | default y |
| 45 | select ARM_ERRATA_720789 | 45 | select ARM_ERRATA_720789 |
| 46 | select PL310_ERRATA_753970 if CACHE_PL310 | 46 | select PL310_ERRATA_753970 if CACHE_L2X0 |
| 47 | help | 47 | help |
| 48 | Provides common dependencies for Versatile Express platforms | 48 | Provides common dependencies for Versatile Express platforms |
| 49 | based on Cortex-A5 and Cortex-A9 processors. In order to | 49 | based on Cortex-A5 and Cortex-A9 processors. In order to |
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index eda0dd0ab97b..c348eaee7ee2 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
| @@ -889,9 +889,10 @@ config CACHE_L2X0 | |||
| 889 | help | 889 | help |
| 890 | This option enables the L2x0 PrimeCell. | 890 | This option enables the L2x0 PrimeCell. |
| 891 | 891 | ||
| 892 | if CACHE_L2X0 | ||
| 893 | |||
| 892 | config CACHE_PL310 | 894 | config CACHE_PL310 |
| 893 | bool | 895 | bool |
| 894 | depends on CACHE_L2X0 | ||
| 895 | default y if CPU_V7 && !(CPU_V6 || CPU_V6K) | 896 | default y if CPU_V7 && !(CPU_V6 || CPU_V6K) |
| 896 | help | 897 | help |
| 897 | This option enables optimisations for the PL310 cache | 898 | This option enables optimisations for the PL310 cache |
| @@ -899,7 +900,6 @@ config CACHE_PL310 | |||
| 899 | 900 | ||
| 900 | config PL310_ERRATA_588369 | 901 | config PL310_ERRATA_588369 |
| 901 | bool "PL310 errata: Clean & Invalidate maintenance operations do not invalidate clean lines" | 902 | bool "PL310 errata: Clean & Invalidate maintenance operations do not invalidate clean lines" |
| 902 | depends on CACHE_L2X0 | ||
| 903 | help | 903 | help |
| 904 | The PL310 L2 cache controller implements three types of Clean & | 904 | The PL310 L2 cache controller implements three types of Clean & |
| 905 | Invalidate maintenance operations: by Physical Address | 905 | Invalidate maintenance operations: by Physical Address |
| @@ -912,7 +912,6 @@ config PL310_ERRATA_588369 | |||
| 912 | 912 | ||
| 913 | config PL310_ERRATA_727915 | 913 | config PL310_ERRATA_727915 |
| 914 | bool "PL310 errata: Background Clean & Invalidate by Way operation can cause data corruption" | 914 | bool "PL310 errata: Background Clean & Invalidate by Way operation can cause data corruption" |
| 915 | depends on CACHE_L2X0 | ||
| 916 | help | 915 | help |
| 917 | PL310 implements the Clean & Invalidate by Way L2 cache maintenance | 916 | PL310 implements the Clean & Invalidate by Way L2 cache maintenance |
| 918 | operation (offset 0x7FC). This operation runs in background so that | 917 | operation (offset 0x7FC). This operation runs in background so that |
| @@ -923,7 +922,6 @@ config PL310_ERRATA_727915 | |||
| 923 | 922 | ||
| 924 | config PL310_ERRATA_753970 | 923 | config PL310_ERRATA_753970 |
| 925 | bool "PL310 errata: cache sync operation may be faulty" | 924 | bool "PL310 errata: cache sync operation may be faulty" |
| 926 | depends on CACHE_PL310 | ||
| 927 | help | 925 | help |
| 928 | This option enables the workaround for the 753970 PL310 (r3p0) erratum. | 926 | This option enables the workaround for the 753970 PL310 (r3p0) erratum. |
| 929 | 927 | ||
| @@ -938,7 +936,6 @@ config PL310_ERRATA_753970 | |||
| 938 | 936 | ||
| 939 | config PL310_ERRATA_769419 | 937 | config PL310_ERRATA_769419 |
| 940 | bool "PL310 errata: no automatic Store Buffer drain" | 938 | bool "PL310 errata: no automatic Store Buffer drain" |
| 941 | depends on CACHE_L2X0 | ||
| 942 | help | 939 | help |
| 943 | On revisions of the PL310 prior to r3p2, the Store Buffer does | 940 | On revisions of the PL310 prior to r3p2, the Store Buffer does |
| 944 | not automatically drain. This can cause normal, non-cacheable | 941 | not automatically drain. This can cause normal, non-cacheable |
| @@ -948,6 +945,8 @@ config PL310_ERRATA_769419 | |||
| 948 | on systems with an outer cache, the store buffer is drained | 945 | on systems with an outer cache, the store buffer is drained |
| 949 | explicitly. | 946 | explicitly. |
| 950 | 947 | ||
| 948 | endif | ||
| 949 | |||
| 951 | config CACHE_TAUROS2 | 950 | config CACHE_TAUROS2 |
| 952 | bool "Enable the Tauros2 L2 cache controller" | 951 | bool "Enable the Tauros2 L2 cache controller" |
| 953 | depends on (ARCH_DOVE || ARCH_MMP || CPU_PJ4) | 952 | depends on (ARCH_DOVE || ARCH_MMP || CPU_PJ4) |
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index efc5cabf70e0..076172b69422 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
| @@ -1069,6 +1069,33 @@ static const struct l2c_init_data of_l2c310_data __initconst = { | |||
| 1069 | }; | 1069 | }; |
| 1070 | 1070 | ||
| 1071 | /* | 1071 | /* |
| 1072 | * This is a variant of the of_l2c310_data with .sync set to | ||
| 1073 | * NULL. Outer sync operations are not needed when the system is I/O | ||
| 1074 | * coherent, and potentially harmful in certain situations (PCIe/PL310 | ||
| 1075 | * deadlock on Armada 375/38x due to hardware I/O coherency). The | ||
| 1076 | * other operations are kept because they are infrequent (therefore do | ||
| 1077 | * not cause the deadlock in practice) and needed for secondary CPU | ||
| 1078 | * boot and other power management activities. | ||
| 1079 | */ | ||
| 1080 | static const struct l2c_init_data of_l2c310_coherent_data __initconst = { | ||
| 1081 | .type = "L2C-310 Coherent", | ||
| 1082 | .way_size_0 = SZ_8K, | ||
| 1083 | .num_lock = 8, | ||
| 1084 | .of_parse = l2c310_of_parse, | ||
| 1085 | .enable = l2c310_enable, | ||
| 1086 | .fixup = l2c310_fixup, | ||
| 1087 | .save = l2c310_save, | ||
| 1088 | .outer_cache = { | ||
| 1089 | .inv_range = l2c210_inv_range, | ||
| 1090 | .clean_range = l2c210_clean_range, | ||
| 1091 | .flush_range = l2c210_flush_range, | ||
| 1092 | .flush_all = l2c210_flush_all, | ||
| 1093 | .disable = l2c310_disable, | ||
| 1094 | .resume = l2c310_resume, | ||
| 1095 | }, | ||
| 1096 | }; | ||
| 1097 | |||
| 1098 | /* | ||
| 1072 | * Note that the end addresses passed to Linux primitives are | 1099 | * Note that the end addresses passed to Linux primitives are |
| 1073 | * noninclusive, while the hardware cache range operations use | 1100 | * noninclusive, while the hardware cache range operations use |
| 1074 | * inclusive start and end addresses. | 1101 | * inclusive start and end addresses. |
| @@ -1487,6 +1514,10 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) | |||
| 1487 | 1514 | ||
| 1488 | data = of_match_node(l2x0_ids, np)->data; | 1515 | data = of_match_node(l2x0_ids, np)->data; |
| 1489 | 1516 | ||
| 1517 | if (of_device_is_compatible(np, "arm,pl310-cache") && | ||
| 1518 | of_property_read_bool(np, "arm,io-coherent")) | ||
| 1519 | data = &of_l2c310_coherent_data; | ||
| 1520 | |||
| 1490 | old_aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); | 1521 | old_aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); |
| 1491 | if (old_aux != ((old_aux & aux_mask) | aux_val)) { | 1522 | if (old_aux != ((old_aux & aux_mask) | aux_val)) { |
| 1492 | pr_warn("L2C: platform modifies aux control register: 0x%08x -> 0x%08x\n", | 1523 | pr_warn("L2C: platform modifies aux control register: 0x%08x -> 0x%08x\n", |
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index da1874f9f8cf..a014dfacd5ca 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c | |||
| @@ -300,6 +300,7 @@ void __init sanity_check_meminfo(void) | |||
| 300 | sanity_check_meminfo_mpu(); | 300 | sanity_check_meminfo_mpu(); |
| 301 | end = memblock_end_of_DRAM(); | 301 | end = memblock_end_of_DRAM(); |
| 302 | high_memory = __va(end - 1) + 1; | 302 | high_memory = __va(end - 1) + 1; |
| 303 | memblock_set_current_limit(end); | ||
| 303 | } | 304 | } |
| 304 | 305 | ||
| 305 | /* | 306 | /* |
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S index 97448c3acf38..ba0d58e1a2a2 100644 --- a/arch/arm/mm/proc-arm925.S +++ b/arch/arm/mm/proc-arm925.S | |||
| @@ -502,6 +502,7 @@ __\name\()_proc_info: | |||
| 502 | .long \cpu_val | 502 | .long \cpu_val |
| 503 | .long \cpu_mask | 503 | .long \cpu_mask |
| 504 | .long PMD_TYPE_SECT | \ | 504 | .long PMD_TYPE_SECT | \ |
| 505 | PMD_SECT_CACHEABLE | \ | ||
| 505 | PMD_BIT4 | \ | 506 | PMD_BIT4 | \ |
| 506 | PMD_SECT_AP_WRITE | \ | 507 | PMD_SECT_AP_WRITE | \ |
| 507 | PMD_SECT_AP_READ | 508 | PMD_SECT_AP_READ |
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 579702086488..e0ccceb317d9 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
| @@ -292,7 +292,7 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | |||
| 292 | #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ | 292 | #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ |
| 293 | PMD_TYPE_SECT) | 293 | PMD_TYPE_SECT) |
| 294 | 294 | ||
| 295 | #ifdef ARM64_64K_PAGES | 295 | #ifdef CONFIG_ARM64_64K_PAGES |
| 296 | #define pud_sect(pud) (0) | 296 | #define pud_sect(pud) (0) |
| 297 | #else | 297 | #else |
| 298 | #define pud_sect(pud) ((pud_val(pud) & PUD_TYPE_MASK) == \ | 298 | #define pud_sect(pud) ((pud_val(pud) & PUD_TYPE_MASK) == \ |
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index a429b5940be2..501000fadb6f 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h | |||
| @@ -21,6 +21,10 @@ | |||
| 21 | 21 | ||
| 22 | #include <uapi/asm/ptrace.h> | 22 | #include <uapi/asm/ptrace.h> |
| 23 | 23 | ||
| 24 | /* Current Exception Level values, as contained in CurrentEL */ | ||
| 25 | #define CurrentEL_EL1 (1 << 2) | ||
| 26 | #define CurrentEL_EL2 (2 << 2) | ||
| 27 | |||
| 24 | /* AArch32-specific ptrace requests */ | 28 | /* AArch32-specific ptrace requests */ |
| 25 | #define COMPAT_PTRACE_GETREGS 12 | 29 | #define COMPAT_PTRACE_GETREGS 12 |
| 26 | #define COMPAT_PTRACE_SETREGS 13 | 30 | #define COMPAT_PTRACE_SETREGS 13 |
diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S index 66716c9b9e5f..619b1dd7bcde 100644 --- a/arch/arm64/kernel/efi-entry.S +++ b/arch/arm64/kernel/efi-entry.S | |||
| @@ -78,8 +78,7 @@ ENTRY(efi_stub_entry) | |||
| 78 | 78 | ||
| 79 | /* Turn off Dcache and MMU */ | 79 | /* Turn off Dcache and MMU */ |
| 80 | mrs x0, CurrentEL | 80 | mrs x0, CurrentEL |
| 81 | cmp x0, #PSR_MODE_EL2t | 81 | cmp x0, #CurrentEL_EL2 |
| 82 | ccmp x0, #PSR_MODE_EL2h, #0x4, ne | ||
| 83 | b.ne 1f | 82 | b.ne 1f |
| 84 | mrs x0, sctlr_el2 | 83 | mrs x0, sctlr_el2 |
| 85 | bic x0, x0, #1 << 0 // clear SCTLR.M | 84 | bic x0, x0, #1 << 0 // clear SCTLR.M |
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index a96d3a6a63f6..a2c1195abb7f 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S | |||
| @@ -270,8 +270,7 @@ ENDPROC(stext) | |||
| 270 | */ | 270 | */ |
| 271 | ENTRY(el2_setup) | 271 | ENTRY(el2_setup) |
| 272 | mrs x0, CurrentEL | 272 | mrs x0, CurrentEL |
| 273 | cmp x0, #PSR_MODE_EL2t | 273 | cmp x0, #CurrentEL_EL2 |
| 274 | ccmp x0, #PSR_MODE_EL2h, #0x4, ne | ||
| 275 | b.ne 1f | 274 | b.ne 1f |
| 276 | mrs x0, sctlr_el2 | 275 | mrs x0, sctlr_el2 |
| 277 | CPU_BE( orr x0, x0, #(1 << 25) ) // Set the EE bit for EL2 | 276 | CPU_BE( orr x0, x0, #(1 << 25) ) // Set the EE bit for EL2 |
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index e4193e3adc7f..0d64089d28b5 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c | |||
| @@ -79,7 +79,8 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr) | |||
| 79 | return; | 79 | return; |
| 80 | 80 | ||
| 81 | if (!test_and_set_bit(PG_dcache_clean, &page->flags)) { | 81 | if (!test_and_set_bit(PG_dcache_clean, &page->flags)) { |
| 82 | __flush_dcache_area(page_address(page), PAGE_SIZE); | 82 | __flush_dcache_area(page_address(page), |
| 83 | PAGE_SIZE << compound_order(page)); | ||
| 83 | __flush_icache_all(); | 84 | __flush_icache_all(); |
| 84 | } else if (icache_is_aivivt()) { | 85 | } else if (icache_is_aivivt()) { |
| 85 | __flush_icache_all(); | 86 | __flush_icache_all(); |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 7a469acee33c..4e238e6e661c 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -269,6 +269,7 @@ config LANTIQ | |||
| 269 | config LASAT | 269 | config LASAT |
| 270 | bool "LASAT Networks platforms" | 270 | bool "LASAT Networks platforms" |
| 271 | select CEVT_R4K | 271 | select CEVT_R4K |
| 272 | select CRC32 | ||
| 272 | select CSRC_R4K | 273 | select CSRC_R4K |
| 273 | select DMA_NONCOHERENT | 274 | select DMA_NONCOHERENT |
| 274 | select SYS_HAS_EARLY_PRINTK | 275 | select SYS_HAS_EARLY_PRINTK |
diff --git a/arch/mips/include/asm/sigcontext.h b/arch/mips/include/asm/sigcontext.h index f54bdbe85c0d..eeeb0f48c767 100644 --- a/arch/mips/include/asm/sigcontext.h +++ b/arch/mips/include/asm/sigcontext.h | |||
| @@ -32,8 +32,6 @@ struct sigcontext32 { | |||
| 32 | __u32 sc_lo2; | 32 | __u32 sc_lo2; |
| 33 | __u32 sc_hi3; | 33 | __u32 sc_hi3; |
| 34 | __u32 sc_lo3; | 34 | __u32 sc_lo3; |
| 35 | __u64 sc_msaregs[32]; /* Most significant 64 bits */ | ||
| 36 | __u32 sc_msa_csr; | ||
| 37 | }; | 35 | }; |
| 38 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */ | 36 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */ |
| 39 | #endif /* _ASM_SIGCONTEXT_H */ | 37 | #endif /* _ASM_SIGCONTEXT_H */ |
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h index f8d63b3b40b4..708c5d414905 100644 --- a/arch/mips/include/asm/uasm.h +++ b/arch/mips/include/asm/uasm.h | |||
| @@ -67,6 +67,9 @@ void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c) | |||
| 67 | #define Ip_u2s3u1(op) \ | 67 | #define Ip_u2s3u1(op) \ |
| 68 | void ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c) | 68 | void ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c) |
| 69 | 69 | ||
| 70 | #define Ip_s3s1s2(op) \ | ||
| 71 | void ISAOPC(op)(u32 **buf, int a, int b, int c) | ||
| 72 | |||
| 70 | #define Ip_u2u1s3(op) \ | 73 | #define Ip_u2u1s3(op) \ |
| 71 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c) | 74 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c) |
| 72 | 75 | ||
| @@ -147,6 +150,7 @@ Ip_u2s3u1(_scd); | |||
| 147 | Ip_u2s3u1(_sd); | 150 | Ip_u2s3u1(_sd); |
| 148 | Ip_u2u1u3(_sll); | 151 | Ip_u2u1u3(_sll); |
| 149 | Ip_u3u2u1(_sllv); | 152 | Ip_u3u2u1(_sllv); |
| 153 | Ip_s3s1s2(_slt); | ||
| 150 | Ip_u2u1s3(_sltiu); | 154 | Ip_u2u1s3(_sltiu); |
| 151 | Ip_u3u1u2(_sltu); | 155 | Ip_u3u1u2(_sltu); |
| 152 | Ip_u2u1u3(_sra); | 156 | Ip_u2u1u3(_sra); |
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h index 4b7160259292..4bfdb9d4c186 100644 --- a/arch/mips/include/uapi/asm/inst.h +++ b/arch/mips/include/uapi/asm/inst.h | |||
| @@ -273,6 +273,7 @@ enum mm_32a_minor_op { | |||
| 273 | mm_and_op = 0x250, | 273 | mm_and_op = 0x250, |
| 274 | mm_or32_op = 0x290, | 274 | mm_or32_op = 0x290, |
| 275 | mm_xor32_op = 0x310, | 275 | mm_xor32_op = 0x310, |
| 276 | mm_slt_op = 0x350, | ||
| 276 | mm_sltu_op = 0x390, | 277 | mm_sltu_op = 0x390, |
| 277 | }; | 278 | }; |
| 278 | 279 | ||
diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h index 681c17603a48..6c9906f59c6e 100644 --- a/arch/mips/include/uapi/asm/sigcontext.h +++ b/arch/mips/include/uapi/asm/sigcontext.h | |||
| @@ -12,10 +12,6 @@ | |||
| 12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | #include <asm/sgidefs.h> | 13 | #include <asm/sgidefs.h> |
| 14 | 14 | ||
| 15 | /* Bits which may be set in sc_used_math */ | ||
| 16 | #define USEDMATH_FP (1 << 0) | ||
| 17 | #define USEDMATH_MSA (1 << 1) | ||
| 18 | |||
| 19 | #if _MIPS_SIM == _MIPS_SIM_ABI32 | 15 | #if _MIPS_SIM == _MIPS_SIM_ABI32 |
| 20 | 16 | ||
| 21 | /* | 17 | /* |
| @@ -41,8 +37,6 @@ struct sigcontext { | |||
| 41 | unsigned long sc_lo2; | 37 | unsigned long sc_lo2; |
| 42 | unsigned long sc_hi3; | 38 | unsigned long sc_hi3; |
| 43 | unsigned long sc_lo3; | 39 | unsigned long sc_lo3; |
| 44 | unsigned long long sc_msaregs[32]; /* Most significant 64 bits */ | ||
| 45 | unsigned long sc_msa_csr; | ||
| 46 | }; | 40 | }; |
| 47 | 41 | ||
| 48 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 42 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
| @@ -76,8 +70,6 @@ struct sigcontext { | |||
| 76 | __u32 sc_used_math; | 70 | __u32 sc_used_math; |
| 77 | __u32 sc_dsp; | 71 | __u32 sc_dsp; |
| 78 | __u32 sc_reserved; | 72 | __u32 sc_reserved; |
| 79 | __u64 sc_msaregs[32]; | ||
| 80 | __u32 sc_msa_csr; | ||
| 81 | }; | 73 | }; |
| 82 | 74 | ||
| 83 | 75 | ||
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c index 02f075df8f2e..4bb5107511e2 100644 --- a/arch/mips/kernel/asm-offsets.c +++ b/arch/mips/kernel/asm-offsets.c | |||
| @@ -293,7 +293,6 @@ void output_sc_defines(void) | |||
| 293 | OFFSET(SC_LO2, sigcontext, sc_lo2); | 293 | OFFSET(SC_LO2, sigcontext, sc_lo2); |
| 294 | OFFSET(SC_HI3, sigcontext, sc_hi3); | 294 | OFFSET(SC_HI3, sigcontext, sc_hi3); |
| 295 | OFFSET(SC_LO3, sigcontext, sc_lo3); | 295 | OFFSET(SC_LO3, sigcontext, sc_lo3); |
| 296 | OFFSET(SC_MSAREGS, sigcontext, sc_msaregs); | ||
| 297 | BLANK(); | 296 | BLANK(); |
| 298 | } | 297 | } |
| 299 | #endif | 298 | #endif |
| @@ -308,7 +307,6 @@ void output_sc_defines(void) | |||
| 308 | OFFSET(SC_MDLO, sigcontext, sc_mdlo); | 307 | OFFSET(SC_MDLO, sigcontext, sc_mdlo); |
| 309 | OFFSET(SC_PC, sigcontext, sc_pc); | 308 | OFFSET(SC_PC, sigcontext, sc_pc); |
| 310 | OFFSET(SC_FPC_CSR, sigcontext, sc_fpc_csr); | 309 | OFFSET(SC_FPC_CSR, sigcontext, sc_fpc_csr); |
| 311 | OFFSET(SC_MSAREGS, sigcontext, sc_msaregs); | ||
| 312 | BLANK(); | 310 | BLANK(); |
| 313 | } | 311 | } |
| 314 | #endif | 312 | #endif |
| @@ -320,7 +318,6 @@ void output_sc32_defines(void) | |||
| 320 | OFFSET(SC32_FPREGS, sigcontext32, sc_fpregs); | 318 | OFFSET(SC32_FPREGS, sigcontext32, sc_fpregs); |
| 321 | OFFSET(SC32_FPC_CSR, sigcontext32, sc_fpc_csr); | 319 | OFFSET(SC32_FPC_CSR, sigcontext32, sc_fpc_csr); |
| 322 | OFFSET(SC32_FPC_EIR, sigcontext32, sc_fpc_eir); | 320 | OFFSET(SC32_FPC_EIR, sigcontext32, sc_fpc_eir); |
| 323 | OFFSET(SC32_MSAREGS, sigcontext32, sc_msaregs); | ||
| 324 | BLANK(); | 321 | BLANK(); |
| 325 | } | 322 | } |
| 326 | #endif | 323 | #endif |
diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c index 4858642d543d..a734b2c2f9ea 100644 --- a/arch/mips/kernel/irq-msc01.c +++ b/arch/mips/kernel/irq-msc01.c | |||
| @@ -126,7 +126,7 @@ void __init init_msc_irqs(unsigned long icubase, unsigned int irqbase, msc_irqma | |||
| 126 | 126 | ||
| 127 | board_bind_eic_interrupt = &msc_bind_eic_interrupt; | 127 | board_bind_eic_interrupt = &msc_bind_eic_interrupt; |
| 128 | 128 | ||
| 129 | for (; nirq >= 0; nirq--, imp++) { | 129 | for (; nirq > 0; nirq--, imp++) { |
| 130 | int n = imp->im_irq; | 130 | int n = imp->im_irq; |
| 131 | 131 | ||
| 132 | switch (imp->im_type) { | 132 | switch (imp->im_type) { |
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c index 5aa4c6f8cf83..c4c2069d3a20 100644 --- a/arch/mips/kernel/pm-cps.c +++ b/arch/mips/kernel/pm-cps.c | |||
| @@ -101,7 +101,7 @@ static void coupled_barrier(atomic_t *a, unsigned online) | |||
| 101 | if (!coupled_coherence) | 101 | if (!coupled_coherence) |
| 102 | return; | 102 | return; |
| 103 | 103 | ||
| 104 | smp_mb__before_atomic_inc(); | 104 | smp_mb__before_atomic(); |
| 105 | atomic_inc(a); | 105 | atomic_inc(a); |
| 106 | 106 | ||
| 107 | while (atomic_read(a) < online) | 107 | while (atomic_read(a) < online) |
| @@ -158,7 +158,7 @@ int cps_pm_enter_state(enum cps_pm_state state) | |||
| 158 | 158 | ||
| 159 | /* Indicate that this CPU might not be coherent */ | 159 | /* Indicate that this CPU might not be coherent */ |
| 160 | cpumask_clear_cpu(cpu, &cpu_coherent_mask); | 160 | cpumask_clear_cpu(cpu, &cpu_coherent_mask); |
| 161 | smp_mb__after_clear_bit(); | 161 | smp_mb__after_atomic(); |
| 162 | 162 | ||
| 163 | /* Create a non-coherent mapping of the core ready_count */ | 163 | /* Create a non-coherent mapping of the core ready_count */ |
| 164 | core_ready_count = per_cpu(ready_count, core); | 164 | core_ready_count = per_cpu(ready_count, core); |
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S index 71814272d148..8352523568e6 100644 --- a/arch/mips/kernel/r4k_fpu.S +++ b/arch/mips/kernel/r4k_fpu.S | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | * Copyright (C) 1999, 2001 Silicon Graphics, Inc. | 13 | * Copyright (C) 1999, 2001 Silicon Graphics, Inc. |
| 14 | */ | 14 | */ |
| 15 | #include <asm/asm.h> | 15 | #include <asm/asm.h> |
| 16 | #include <asm/asmmacro.h> | ||
| 17 | #include <asm/errno.h> | 16 | #include <asm/errno.h> |
| 18 | #include <asm/fpregdef.h> | 17 | #include <asm/fpregdef.h> |
| 19 | #include <asm/mipsregs.h> | 18 | #include <asm/mipsregs.h> |
| @@ -246,218 +245,6 @@ LEAF(_restore_fp_context32) | |||
| 246 | END(_restore_fp_context32) | 245 | END(_restore_fp_context32) |
| 247 | #endif | 246 | #endif |
| 248 | 247 | ||
| 249 | #ifdef CONFIG_CPU_HAS_MSA | ||
| 250 | |||
| 251 | .macro save_sc_msareg wr, off, sc, tmp | ||
| 252 | #ifdef CONFIG_64BIT | ||
| 253 | copy_u_d \tmp, \wr, 1 | ||
| 254 | EX sd \tmp, (\off+(\wr*8))(\sc) | ||
| 255 | #elif defined(CONFIG_CPU_LITTLE_ENDIAN) | ||
| 256 | copy_u_w \tmp, \wr, 2 | ||
| 257 | EX sw \tmp, (\off+(\wr*8)+0)(\sc) | ||
| 258 | copy_u_w \tmp, \wr, 3 | ||
| 259 | EX sw \tmp, (\off+(\wr*8)+4)(\sc) | ||
| 260 | #else /* CONFIG_CPU_BIG_ENDIAN */ | ||
| 261 | copy_u_w \tmp, \wr, 2 | ||
| 262 | EX sw \tmp, (\off+(\wr*8)+4)(\sc) | ||
| 263 | copy_u_w \tmp, \wr, 3 | ||
| 264 | EX sw \tmp, (\off+(\wr*8)+0)(\sc) | ||
| 265 | #endif | ||
| 266 | .endm | ||
| 267 | |||
| 268 | /* | ||
| 269 | * int _save_msa_context(struct sigcontext *sc) | ||
| 270 | * | ||
| 271 | * Save the upper 64 bits of each vector register along with the MSA_CSR | ||
| 272 | * register into sc. Returns zero on success, else non-zero. | ||
| 273 | */ | ||
| 274 | LEAF(_save_msa_context) | ||
| 275 | save_sc_msareg 0, SC_MSAREGS, a0, t0 | ||
| 276 | save_sc_msareg 1, SC_MSAREGS, a0, t0 | ||
| 277 | save_sc_msareg 2, SC_MSAREGS, a0, t0 | ||
| 278 | save_sc_msareg 3, SC_MSAREGS, a0, t0 | ||
| 279 | save_sc_msareg 4, SC_MSAREGS, a0, t0 | ||
| 280 | save_sc_msareg 5, SC_MSAREGS, a0, t0 | ||
| 281 | save_sc_msareg 6, SC_MSAREGS, a0, t0 | ||
| 282 | save_sc_msareg 7, SC_MSAREGS, a0, t0 | ||
| 283 | save_sc_msareg 8, SC_MSAREGS, a0, t0 | ||
| 284 | save_sc_msareg 9, SC_MSAREGS, a0, t0 | ||
| 285 | save_sc_msareg 10, SC_MSAREGS, a0, t0 | ||
| 286 | save_sc_msareg 11, SC_MSAREGS, a0, t0 | ||
| 287 | save_sc_msareg 12, SC_MSAREGS, a0, t0 | ||
| 288 | save_sc_msareg 13, SC_MSAREGS, a0, t0 | ||
| 289 | save_sc_msareg 14, SC_MSAREGS, a0, t0 | ||
| 290 | save_sc_msareg 15, SC_MSAREGS, a0, t0 | ||
| 291 | save_sc_msareg 16, SC_MSAREGS, a0, t0 | ||
| 292 | save_sc_msareg 17, SC_MSAREGS, a0, t0 | ||
| 293 | save_sc_msareg 18, SC_MSAREGS, a0, t0 | ||
| 294 | save_sc_msareg 19, SC_MSAREGS, a0, t0 | ||
| 295 | save_sc_msareg 20, SC_MSAREGS, a0, t0 | ||
| 296 | save_sc_msareg 21, SC_MSAREGS, a0, t0 | ||
| 297 | save_sc_msareg 22, SC_MSAREGS, a0, t0 | ||
| 298 | save_sc_msareg 23, SC_MSAREGS, a0, t0 | ||
| 299 | save_sc_msareg 24, SC_MSAREGS, a0, t0 | ||
| 300 | save_sc_msareg 25, SC_MSAREGS, a0, t0 | ||
| 301 | save_sc_msareg 26, SC_MSAREGS, a0, t0 | ||
| 302 | save_sc_msareg 27, SC_MSAREGS, a0, t0 | ||
| 303 | save_sc_msareg 28, SC_MSAREGS, a0, t0 | ||
| 304 | save_sc_msareg 29, SC_MSAREGS, a0, t0 | ||
| 305 | save_sc_msareg 30, SC_MSAREGS, a0, t0 | ||
| 306 | save_sc_msareg 31, SC_MSAREGS, a0, t0 | ||
| 307 | jr ra | ||
| 308 | li v0, 0 | ||
| 309 | END(_save_msa_context) | ||
| 310 | |||
| 311 | #ifdef CONFIG_MIPS32_COMPAT | ||
| 312 | |||
| 313 | /* | ||
| 314 | * int _save_msa_context32(struct sigcontext32 *sc) | ||
| 315 | * | ||
| 316 | * Save the upper 64 bits of each vector register along with the MSA_CSR | ||
| 317 | * register into sc. Returns zero on success, else non-zero. | ||
| 318 | */ | ||
| 319 | LEAF(_save_msa_context32) | ||
| 320 | save_sc_msareg 0, SC32_MSAREGS, a0, t0 | ||
| 321 | save_sc_msareg 1, SC32_MSAREGS, a0, t0 | ||
| 322 | save_sc_msareg 2, SC32_MSAREGS, a0, t0 | ||
| 323 | save_sc_msareg 3, SC32_MSAREGS, a0, t0 | ||
| 324 | save_sc_msareg 4, SC32_MSAREGS, a0, t0 | ||
| 325 | save_sc_msareg 5, SC32_MSAREGS, a0, t0 | ||
| 326 | save_sc_msareg 6, SC32_MSAREGS, a0, t0 | ||
| 327 | save_sc_msareg 7, SC32_MSAREGS, a0, t0 | ||
| 328 | save_sc_msareg 8, SC32_MSAREGS, a0, t0 | ||
| 329 | save_sc_msareg 9, SC32_MSAREGS, a0, t0 | ||
| 330 | save_sc_msareg 10, SC32_MSAREGS, a0, t0 | ||
| 331 | save_sc_msareg 11, SC32_MSAREGS, a0, t0 | ||
| 332 | save_sc_msareg 12, SC32_MSAREGS, a0, t0 | ||
| 333 | save_sc_msareg 13, SC32_MSAREGS, a0, t0 | ||
| 334 | save_sc_msareg 14, SC32_MSAREGS, a0, t0 | ||
| 335 | save_sc_msareg 15, SC32_MSAREGS, a0, t0 | ||
| 336 | save_sc_msareg 16, SC32_MSAREGS, a0, t0 | ||
| 337 | save_sc_msareg 17, SC32_MSAREGS, a0, t0 | ||
| 338 | save_sc_msareg 18, SC32_MSAREGS, a0, t0 | ||
| 339 | save_sc_msareg 19, SC32_MSAREGS, a0, t0 | ||
| 340 | save_sc_msareg 20, SC32_MSAREGS, a0, t0 | ||
| 341 | save_sc_msareg 21, SC32_MSAREGS, a0, t0 | ||
| 342 | save_sc_msareg 22, SC32_MSAREGS, a0, t0 | ||
| 343 | save_sc_msareg 23, SC32_MSAREGS, a0, t0 | ||
| 344 | save_sc_msareg 24, SC32_MSAREGS, a0, t0 | ||
| 345 | save_sc_msareg 25, SC32_MSAREGS, a0, t0 | ||
| 346 | save_sc_msareg 26, SC32_MSAREGS, a0, t0 | ||
| 347 | save_sc_msareg 27, SC32_MSAREGS, a0, t0 | ||
| 348 | save_sc_msareg 28, SC32_MSAREGS, a0, t0 | ||
| 349 | save_sc_msareg 29, SC32_MSAREGS, a0, t0 | ||
| 350 | save_sc_msareg 30, SC32_MSAREGS, a0, t0 | ||
| 351 | save_sc_msareg 31, SC32_MSAREGS, a0, t0 | ||
| 352 | jr ra | ||
| 353 | li v0, 0 | ||
| 354 | END(_save_msa_context32) | ||
| 355 | |||
| 356 | #endif /* CONFIG_MIPS32_COMPAT */ | ||
| 357 | |||
| 358 | .macro restore_sc_msareg wr, off, sc, tmp | ||
| 359 | #ifdef CONFIG_64BIT | ||
| 360 | EX ld \tmp, (\off+(\wr*8))(\sc) | ||
| 361 | insert_d \wr, 1, \tmp | ||
| 362 | #elif defined(CONFIG_CPU_LITTLE_ENDIAN) | ||
| 363 | EX lw \tmp, (\off+(\wr*8)+0)(\sc) | ||
| 364 | insert_w \wr, 2, \tmp | ||
| 365 | EX lw \tmp, (\off+(\wr*8)+4)(\sc) | ||
| 366 | insert_w \wr, 3, \tmp | ||
| 367 | #else /* CONFIG_CPU_BIG_ENDIAN */ | ||
| 368 | EX lw \tmp, (\off+(\wr*8)+4)(\sc) | ||
| 369 | insert_w \wr, 2, \tmp | ||
| 370 | EX lw \tmp, (\off+(\wr*8)+0)(\sc) | ||
| 371 | insert_w \wr, 3, \tmp | ||
| 372 | #endif | ||
| 373 | .endm | ||
| 374 | |||
| 375 | /* | ||
| 376 | * int _restore_msa_context(struct sigcontext *sc) | ||
| 377 | */ | ||
| 378 | LEAF(_restore_msa_context) | ||
| 379 | restore_sc_msareg 0, SC_MSAREGS, a0, t0 | ||
| 380 | restore_sc_msareg 1, SC_MSAREGS, a0, t0 | ||
| 381 | restore_sc_msareg 2, SC_MSAREGS, a0, t0 | ||
| 382 | restore_sc_msareg 3, SC_MSAREGS, a0, t0 | ||
| 383 | restore_sc_msareg 4, SC_MSAREGS, a0, t0 | ||
| 384 | restore_sc_msareg 5, SC_MSAREGS, a0, t0 | ||
| 385 | restore_sc_msareg 6, SC_MSAREGS, a0, t0 | ||
| 386 | restore_sc_msareg 7, SC_MSAREGS, a0, t0 | ||
| 387 | restore_sc_msareg 8, SC_MSAREGS, a0, t0 | ||
| 388 | restore_sc_msareg 9, SC_MSAREGS, a0, t0 | ||
| 389 | restore_sc_msareg 10, SC_MSAREGS, a0, t0 | ||
| 390 | restore_sc_msareg 11, SC_MSAREGS, a0, t0 | ||
| 391 | restore_sc_msareg 12, SC_MSAREGS, a0, t0 | ||
| 392 | restore_sc_msareg 13, SC_MSAREGS, a0, t0 | ||
| 393 | restore_sc_msareg 14, SC_MSAREGS, a0, t0 | ||
| 394 | restore_sc_msareg 15, SC_MSAREGS, a0, t0 | ||
| 395 | restore_sc_msareg 16, SC_MSAREGS, a0, t0 | ||
| 396 | restore_sc_msareg 17, SC_MSAREGS, a0, t0 | ||
| 397 | restore_sc_msareg 18, SC_MSAREGS, a0, t0 | ||
| 398 | restore_sc_msareg 19, SC_MSAREGS, a0, t0 | ||
| 399 | restore_sc_msareg 20, SC_MSAREGS, a0, t0 | ||
| 400 | restore_sc_msareg 21, SC_MSAREGS, a0, t0 | ||
| 401 | restore_sc_msareg 22, SC_MSAREGS, a0, t0 | ||
| 402 | restore_sc_msareg 23, SC_MSAREGS, a0, t0 | ||
| 403 | restore_sc_msareg 24, SC_MSAREGS, a0, t0 | ||
| 404 | restore_sc_msareg 25, SC_MSAREGS, a0, t0 | ||
| 405 | restore_sc_msareg 26, SC_MSAREGS, a0, t0 | ||
| 406 | restore_sc_msareg 27, SC_MSAREGS, a0, t0 | ||
| 407 | restore_sc_msareg 28, SC_MSAREGS, a0, t0 | ||
| 408 | restore_sc_msareg 29, SC_MSAREGS, a0, t0 | ||
| 409 | restore_sc_msareg 30, SC_MSAREGS, a0, t0 | ||
| 410 | restore_sc_msareg 31, SC_MSAREGS, a0, t0 | ||
| 411 | jr ra | ||
| 412 | li v0, 0 | ||
| 413 | END(_restore_msa_context) | ||
| 414 | |||
| 415 | #ifdef CONFIG_MIPS32_COMPAT | ||
| 416 | |||
| 417 | /* | ||
| 418 | * int _restore_msa_context32(struct sigcontext32 *sc) | ||
| 419 | */ | ||
| 420 | LEAF(_restore_msa_context32) | ||
| 421 | restore_sc_msareg 0, SC32_MSAREGS, a0, t0 | ||
| 422 | restore_sc_msareg 1, SC32_MSAREGS, a0, t0 | ||
| 423 | restore_sc_msareg 2, SC32_MSAREGS, a0, t0 | ||
| 424 | restore_sc_msareg 3, SC32_MSAREGS, a0, t0 | ||
| 425 | restore_sc_msareg 4, SC32_MSAREGS, a0, t0 | ||
| 426 | restore_sc_msareg 5, SC32_MSAREGS, a0, t0 | ||
| 427 | restore_sc_msareg 6, SC32_MSAREGS, a0, t0 | ||
| 428 | restore_sc_msareg 7, SC32_MSAREGS, a0, t0 | ||
| 429 | restore_sc_msareg 8, SC32_MSAREGS, a0, t0 | ||
| 430 | restore_sc_msareg 9, SC32_MSAREGS, a0, t0 | ||
| 431 | restore_sc_msareg 10, SC32_MSAREGS, a0, t0 | ||
| 432 | restore_sc_msareg 11, SC32_MSAREGS, a0, t0 | ||
| 433 | restore_sc_msareg 12, SC32_MSAREGS, a0, t0 | ||
| 434 | restore_sc_msareg 13, SC32_MSAREGS, a0, t0 | ||
| 435 | restore_sc_msareg 14, SC32_MSAREGS, a0, t0 | ||
| 436 | restore_sc_msareg 15, SC32_MSAREGS, a0, t0 | ||
| 437 | restore_sc_msareg 16, SC32_MSAREGS, a0, t0 | ||
| 438 | restore_sc_msareg 17, SC32_MSAREGS, a0, t0 | ||
| 439 | restore_sc_msareg 18, SC32_MSAREGS, a0, t0 | ||
| 440 | restore_sc_msareg 19, SC32_MSAREGS, a0, t0 | ||
| 441 | restore_sc_msareg 20, SC32_MSAREGS, a0, t0 | ||
| 442 | restore_sc_msareg 21, SC32_MSAREGS, a0, t0 | ||
| 443 | restore_sc_msareg 22, SC32_MSAREGS, a0, t0 | ||
| 444 | restore_sc_msareg 23, SC32_MSAREGS, a0, t0 | ||
| 445 | restore_sc_msareg 24, SC32_MSAREGS, a0, t0 | ||
| 446 | restore_sc_msareg 25, SC32_MSAREGS, a0, t0 | ||
| 447 | restore_sc_msareg 26, SC32_MSAREGS, a0, t0 | ||
| 448 | restore_sc_msareg 27, SC32_MSAREGS, a0, t0 | ||
| 449 | restore_sc_msareg 28, SC32_MSAREGS, a0, t0 | ||
| 450 | restore_sc_msareg 29, SC32_MSAREGS, a0, t0 | ||
| 451 | restore_sc_msareg 30, SC32_MSAREGS, a0, t0 | ||
| 452 | restore_sc_msareg 31, SC32_MSAREGS, a0, t0 | ||
| 453 | jr ra | ||
| 454 | li v0, 0 | ||
| 455 | END(_restore_msa_context32) | ||
| 456 | |||
| 457 | #endif /* CONFIG_MIPS32_COMPAT */ | ||
| 458 | |||
| 459 | #endif /* CONFIG_CPU_HAS_MSA */ | ||
| 460 | |||
| 461 | .set reorder | 248 | .set reorder |
| 462 | 249 | ||
| 463 | .type fault@function | 250 | .type fault@function |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 33133d3df3e5..9e60d117e41e 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <linux/bitops.h> | 31 | #include <linux/bitops.h> |
| 32 | #include <asm/cacheflush.h> | 32 | #include <asm/cacheflush.h> |
| 33 | #include <asm/fpu.h> | 33 | #include <asm/fpu.h> |
| 34 | #include <asm/msa.h> | ||
| 35 | #include <asm/sim.h> | 34 | #include <asm/sim.h> |
| 36 | #include <asm/ucontext.h> | 35 | #include <asm/ucontext.h> |
| 37 | #include <asm/cpu-features.h> | 36 | #include <asm/cpu-features.h> |
| @@ -48,9 +47,6 @@ static int (*restore_fp_context)(struct sigcontext __user *sc); | |||
| 48 | extern asmlinkage int _save_fp_context(struct sigcontext __user *sc); | 47 | extern asmlinkage int _save_fp_context(struct sigcontext __user *sc); |
| 49 | extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc); | 48 | extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc); |
| 50 | 49 | ||
| 51 | extern asmlinkage int _save_msa_context(struct sigcontext __user *sc); | ||
| 52 | extern asmlinkage int _restore_msa_context(struct sigcontext __user *sc); | ||
| 53 | |||
| 54 | struct sigframe { | 50 | struct sigframe { |
| 55 | u32 sf_ass[4]; /* argument save space for o32 */ | 51 | u32 sf_ass[4]; /* argument save space for o32 */ |
| 56 | u32 sf_pad[2]; /* Was: signal trampoline */ | 52 | u32 sf_pad[2]; /* Was: signal trampoline */ |
| @@ -100,60 +96,20 @@ static int copy_fp_from_sigcontext(struct sigcontext __user *sc) | |||
| 100 | } | 96 | } |
| 101 | 97 | ||
| 102 | /* | 98 | /* |
| 103 | * These functions will save only the upper 64 bits of the vector registers, | ||
| 104 | * since the lower 64 bits have already been saved as the scalar FP context. | ||
| 105 | */ | ||
| 106 | static int copy_msa_to_sigcontext(struct sigcontext __user *sc) | ||
| 107 | { | ||
| 108 | int i; | ||
| 109 | int err = 0; | ||
| 110 | |||
| 111 | for (i = 0; i < NUM_FPU_REGS; i++) { | ||
| 112 | err |= | ||
| 113 | __put_user(get_fpr64(¤t->thread.fpu.fpr[i], 1), | ||
| 114 | &sc->sc_msaregs[i]); | ||
| 115 | } | ||
| 116 | err |= __put_user(current->thread.fpu.msacsr, &sc->sc_msa_csr); | ||
| 117 | |||
| 118 | return err; | ||
| 119 | } | ||
| 120 | |||
| 121 | static int copy_msa_from_sigcontext(struct sigcontext __user *sc) | ||
| 122 | { | ||
| 123 | int i; | ||
| 124 | int err = 0; | ||
| 125 | u64 val; | ||
| 126 | |||
| 127 | for (i = 0; i < NUM_FPU_REGS; i++) { | ||
| 128 | err |= __get_user(val, &sc->sc_msaregs[i]); | ||
| 129 | set_fpr64(¤t->thread.fpu.fpr[i], 1, val); | ||
| 130 | } | ||
| 131 | err |= __get_user(current->thread.fpu.msacsr, &sc->sc_msa_csr); | ||
| 132 | |||
| 133 | return err; | ||
| 134 | } | ||
| 135 | |||
| 136 | /* | ||
| 137 | * Helper routines | 99 | * Helper routines |
| 138 | */ | 100 | */ |
| 139 | static int protected_save_fp_context(struct sigcontext __user *sc, | 101 | static int protected_save_fp_context(struct sigcontext __user *sc) |
| 140 | unsigned used_math) | ||
| 141 | { | 102 | { |
| 142 | int err; | 103 | int err; |
| 143 | bool save_msa = cpu_has_msa && (used_math & USEDMATH_MSA); | ||
| 144 | #ifndef CONFIG_EVA | 104 | #ifndef CONFIG_EVA |
| 145 | while (1) { | 105 | while (1) { |
| 146 | lock_fpu_owner(); | 106 | lock_fpu_owner(); |
| 147 | if (is_fpu_owner()) { | 107 | if (is_fpu_owner()) { |
| 148 | err = save_fp_context(sc); | 108 | err = save_fp_context(sc); |
| 149 | if (save_msa && !err) | ||
| 150 | err = _save_msa_context(sc); | ||
| 151 | unlock_fpu_owner(); | 109 | unlock_fpu_owner(); |
| 152 | } else { | 110 | } else { |
| 153 | unlock_fpu_owner(); | 111 | unlock_fpu_owner(); |
| 154 | err = copy_fp_to_sigcontext(sc); | 112 | err = copy_fp_to_sigcontext(sc); |
| 155 | if (save_msa && !err) | ||
| 156 | err = copy_msa_to_sigcontext(sc); | ||
| 157 | } | 113 | } |
| 158 | if (likely(!err)) | 114 | if (likely(!err)) |
| 159 | break; | 115 | break; |
| @@ -169,38 +125,24 @@ static int protected_save_fp_context(struct sigcontext __user *sc, | |||
| 169 | * EVA does not have FPU EVA instructions so saving fpu context directly | 125 | * EVA does not have FPU EVA instructions so saving fpu context directly |
| 170 | * does not work. | 126 | * does not work. |
| 171 | */ | 127 | */ |
| 172 | disable_msa(); | ||
| 173 | lose_fpu(1); | 128 | lose_fpu(1); |
| 174 | err = save_fp_context(sc); /* this might fail */ | 129 | err = save_fp_context(sc); /* this might fail */ |
| 175 | if (save_msa && !err) | ||
| 176 | err = copy_msa_to_sigcontext(sc); | ||
| 177 | #endif | 130 | #endif |
| 178 | return err; | 131 | return err; |
| 179 | } | 132 | } |
| 180 | 133 | ||
| 181 | static int protected_restore_fp_context(struct sigcontext __user *sc, | 134 | static int protected_restore_fp_context(struct sigcontext __user *sc) |
| 182 | unsigned used_math) | ||
| 183 | { | 135 | { |
| 184 | int err, tmp __maybe_unused; | 136 | int err, tmp __maybe_unused; |
| 185 | bool restore_msa = cpu_has_msa && (used_math & USEDMATH_MSA); | ||
| 186 | #ifndef CONFIG_EVA | 137 | #ifndef CONFIG_EVA |
| 187 | while (1) { | 138 | while (1) { |
| 188 | lock_fpu_owner(); | 139 | lock_fpu_owner(); |
| 189 | if (is_fpu_owner()) { | 140 | if (is_fpu_owner()) { |
| 190 | err = restore_fp_context(sc); | 141 | err = restore_fp_context(sc); |
| 191 | if (restore_msa && !err) { | ||
| 192 | enable_msa(); | ||
| 193 | err = _restore_msa_context(sc); | ||
| 194 | } else { | ||
| 195 | /* signal handler may have used MSA */ | ||
| 196 | disable_msa(); | ||
| 197 | } | ||
| 198 | unlock_fpu_owner(); | 142 | unlock_fpu_owner(); |
| 199 | } else { | 143 | } else { |
| 200 | unlock_fpu_owner(); | 144 | unlock_fpu_owner(); |
| 201 | err = copy_fp_from_sigcontext(sc); | 145 | err = copy_fp_from_sigcontext(sc); |
| 202 | if (!err && (used_math & USEDMATH_MSA)) | ||
| 203 | err = copy_msa_from_sigcontext(sc); | ||
| 204 | } | 146 | } |
| 205 | if (likely(!err)) | 147 | if (likely(!err)) |
| 206 | break; | 148 | break; |
| @@ -216,11 +158,8 @@ static int protected_restore_fp_context(struct sigcontext __user *sc, | |||
| 216 | * EVA does not have FPU EVA instructions so restoring fpu context | 158 | * EVA does not have FPU EVA instructions so restoring fpu context |
| 217 | * directly does not work. | 159 | * directly does not work. |
| 218 | */ | 160 | */ |
| 219 | enable_msa(); | ||
| 220 | lose_fpu(0); | 161 | lose_fpu(0); |
| 221 | err = restore_fp_context(sc); /* this might fail */ | 162 | err = restore_fp_context(sc); /* this might fail */ |
| 222 | if (restore_msa && !err) | ||
| 223 | err = copy_msa_from_sigcontext(sc); | ||
| 224 | #endif | 163 | #endif |
| 225 | return err; | 164 | return err; |
| 226 | } | 165 | } |
| @@ -252,8 +191,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
| 252 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); | 191 | err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp); |
| 253 | } | 192 | } |
| 254 | 193 | ||
| 255 | used_math = used_math() ? USEDMATH_FP : 0; | 194 | used_math = !!used_math(); |
| 256 | used_math |= thread_msa_context_live() ? USEDMATH_MSA : 0; | ||
| 257 | err |= __put_user(used_math, &sc->sc_used_math); | 195 | err |= __put_user(used_math, &sc->sc_used_math); |
| 258 | 196 | ||
| 259 | if (used_math) { | 197 | if (used_math) { |
| @@ -261,7 +199,7 @@ int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
| 261 | * Save FPU state to signal context. Signal handler | 199 | * Save FPU state to signal context. Signal handler |
| 262 | * will "inherit" current FPU state. | 200 | * will "inherit" current FPU state. |
| 263 | */ | 201 | */ |
| 264 | err |= protected_save_fp_context(sc, used_math); | 202 | err |= protected_save_fp_context(sc); |
| 265 | } | 203 | } |
| 266 | return err; | 204 | return err; |
| 267 | } | 205 | } |
| @@ -286,14 +224,14 @@ int fpcsr_pending(unsigned int __user *fpcsr) | |||
| 286 | } | 224 | } |
| 287 | 225 | ||
| 288 | static int | 226 | static int |
| 289 | check_and_restore_fp_context(struct sigcontext __user *sc, unsigned used_math) | 227 | check_and_restore_fp_context(struct sigcontext __user *sc) |
| 290 | { | 228 | { |
| 291 | int err, sig; | 229 | int err, sig; |
| 292 | 230 | ||
| 293 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); | 231 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); |
| 294 | if (err > 0) | 232 | if (err > 0) |
| 295 | err = 0; | 233 | err = 0; |
| 296 | err |= protected_restore_fp_context(sc, used_math); | 234 | err |= protected_restore_fp_context(sc); |
| 297 | return err ?: sig; | 235 | return err ?: sig; |
| 298 | } | 236 | } |
| 299 | 237 | ||
| @@ -333,10 +271,9 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
| 333 | if (used_math) { | 271 | if (used_math) { |
| 334 | /* restore fpu context if we have used it before */ | 272 | /* restore fpu context if we have used it before */ |
| 335 | if (!err) | 273 | if (!err) |
| 336 | err = check_and_restore_fp_context(sc, used_math); | 274 | err = check_and_restore_fp_context(sc); |
| 337 | } else { | 275 | } else { |
| 338 | /* signal handler may have used FPU or MSA. Disable them. */ | 276 | /* signal handler may have used FPU. Give it up. */ |
| 339 | disable_msa(); | ||
| 340 | lose_fpu(0); | 277 | lose_fpu(0); |
| 341 | } | 278 | } |
| 342 | 279 | ||
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 299f956e4db3..bae2e6ee2109 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | #include <asm/sim.h> | 30 | #include <asm/sim.h> |
| 31 | #include <asm/ucontext.h> | 31 | #include <asm/ucontext.h> |
| 32 | #include <asm/fpu.h> | 32 | #include <asm/fpu.h> |
| 33 | #include <asm/msa.h> | ||
| 34 | #include <asm/war.h> | 33 | #include <asm/war.h> |
| 35 | #include <asm/vdso.h> | 34 | #include <asm/vdso.h> |
| 36 | #include <asm/dsp.h> | 35 | #include <asm/dsp.h> |
| @@ -43,9 +42,6 @@ static int (*restore_fp_context32)(struct sigcontext32 __user *sc); | |||
| 43 | extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc); | 42 | extern asmlinkage int _save_fp_context32(struct sigcontext32 __user *sc); |
| 44 | extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc); | 43 | extern asmlinkage int _restore_fp_context32(struct sigcontext32 __user *sc); |
| 45 | 44 | ||
| 46 | extern asmlinkage int _save_msa_context32(struct sigcontext32 __user *sc); | ||
| 47 | extern asmlinkage int _restore_msa_context32(struct sigcontext32 __user *sc); | ||
| 48 | |||
| 49 | /* | 45 | /* |
| 50 | * Including <asm/unistd.h> would give use the 64-bit syscall numbers ... | 46 | * Including <asm/unistd.h> would give use the 64-bit syscall numbers ... |
| 51 | */ | 47 | */ |
| @@ -115,59 +111,19 @@ static int copy_fp_from_sigcontext32(struct sigcontext32 __user *sc) | |||
| 115 | } | 111 | } |
| 116 | 112 | ||
| 117 | /* | 113 | /* |
| 118 | * These functions will save only the upper 64 bits of the vector registers, | ||
| 119 | * since the lower 64 bits have already been saved as the scalar FP context. | ||
| 120 | */ | ||
| 121 | static int copy_msa_to_sigcontext32(struct sigcontext32 __user *sc) | ||
| 122 | { | ||
| 123 | int i; | ||
| 124 | int err = 0; | ||
| 125 | |||
| 126 | for (i = 0; i < NUM_FPU_REGS; i++) { | ||
| 127 | err |= | ||
| 128 | __put_user(get_fpr64(¤t->thread.fpu.fpr[i], 1), | ||
| 129 | &sc->sc_msaregs[i]); | ||
| 130 | } | ||
| 131 | err |= __put_user(current->thread.fpu.msacsr, &sc->sc_msa_csr); | ||
| 132 | |||
| 133 | return err; | ||
| 134 | } | ||
| 135 | |||
| 136 | static int copy_msa_from_sigcontext32(struct sigcontext32 __user *sc) | ||
| 137 | { | ||
| 138 | int i; | ||
| 139 | int err = 0; | ||
| 140 | u64 val; | ||
| 141 | |||
| 142 | for (i = 0; i < NUM_FPU_REGS; i++) { | ||
| 143 | err |= __get_user(val, &sc->sc_msaregs[i]); | ||
| 144 | set_fpr64(¤t->thread.fpu.fpr[i], 1, val); | ||
| 145 | } | ||
| 146 | err |= __get_user(current->thread.fpu.msacsr, &sc->sc_msa_csr); | ||
| 147 | |||
| 148 | return err; | ||
| 149 | } | ||
| 150 | |||
| 151 | /* | ||
| 152 | * sigcontext handlers | 114 | * sigcontext handlers |
| 153 | */ | 115 | */ |
| 154 | static int protected_save_fp_context32(struct sigcontext32 __user *sc, | 116 | static int protected_save_fp_context32(struct sigcontext32 __user *sc) |
| 155 | unsigned used_math) | ||
| 156 | { | 117 | { |
| 157 | int err; | 118 | int err; |
| 158 | bool save_msa = cpu_has_msa && (used_math & USEDMATH_MSA); | ||
| 159 | while (1) { | 119 | while (1) { |
| 160 | lock_fpu_owner(); | 120 | lock_fpu_owner(); |
| 161 | if (is_fpu_owner()) { | 121 | if (is_fpu_owner()) { |
| 162 | err = save_fp_context32(sc); | 122 | err = save_fp_context32(sc); |
| 163 | if (save_msa && !err) | ||
| 164 | err = _save_msa_context32(sc); | ||
| 165 | unlock_fpu_owner(); | 123 | unlock_fpu_owner(); |
| 166 | } else { | 124 | } else { |
| 167 | unlock_fpu_owner(); | 125 | unlock_fpu_owner(); |
| 168 | err = copy_fp_to_sigcontext32(sc); | 126 | err = copy_fp_to_sigcontext32(sc); |
| 169 | if (save_msa && !err) | ||
| 170 | err = copy_msa_to_sigcontext32(sc); | ||
| 171 | } | 127 | } |
| 172 | if (likely(!err)) | 128 | if (likely(!err)) |
| 173 | break; | 129 | break; |
| @@ -181,28 +137,17 @@ static int protected_save_fp_context32(struct sigcontext32 __user *sc, | |||
| 181 | return err; | 137 | return err; |
| 182 | } | 138 | } |
| 183 | 139 | ||
| 184 | static int protected_restore_fp_context32(struct sigcontext32 __user *sc, | 140 | static int protected_restore_fp_context32(struct sigcontext32 __user *sc) |
| 185 | unsigned used_math) | ||
| 186 | { | 141 | { |
| 187 | int err, tmp __maybe_unused; | 142 | int err, tmp __maybe_unused; |
| 188 | bool restore_msa = cpu_has_msa && (used_math & USEDMATH_MSA); | ||
| 189 | while (1) { | 143 | while (1) { |
| 190 | lock_fpu_owner(); | 144 | lock_fpu_owner(); |
| 191 | if (is_fpu_owner()) { | 145 | if (is_fpu_owner()) { |
| 192 | err = restore_fp_context32(sc); | 146 | err = restore_fp_context32(sc); |
| 193 | if (restore_msa && !err) { | ||
| 194 | enable_msa(); | ||
| 195 | err = _restore_msa_context32(sc); | ||
| 196 | } else { | ||
| 197 | /* signal handler may have used MSA */ | ||
| 198 | disable_msa(); | ||
| 199 | } | ||
| 200 | unlock_fpu_owner(); | 147 | unlock_fpu_owner(); |
| 201 | } else { | 148 | } else { |
| 202 | unlock_fpu_owner(); | 149 | unlock_fpu_owner(); |
| 203 | err = copy_fp_from_sigcontext32(sc); | 150 | err = copy_fp_from_sigcontext32(sc); |
| 204 | if (restore_msa && !err) | ||
| 205 | err = copy_msa_from_sigcontext32(sc); | ||
| 206 | } | 151 | } |
| 207 | if (likely(!err)) | 152 | if (likely(!err)) |
| 208 | break; | 153 | break; |
| @@ -241,8 +186,7 @@ static int setup_sigcontext32(struct pt_regs *regs, | |||
| 241 | err |= __put_user(mflo3(), &sc->sc_lo3); | 186 | err |= __put_user(mflo3(), &sc->sc_lo3); |
| 242 | } | 187 | } |
| 243 | 188 | ||
| 244 | used_math = used_math() ? USEDMATH_FP : 0; | 189 | used_math = !!used_math(); |
| 245 | used_math |= thread_msa_context_live() ? USEDMATH_MSA : 0; | ||
| 246 | err |= __put_user(used_math, &sc->sc_used_math); | 190 | err |= __put_user(used_math, &sc->sc_used_math); |
| 247 | 191 | ||
| 248 | if (used_math) { | 192 | if (used_math) { |
| @@ -250,21 +194,20 @@ static int setup_sigcontext32(struct pt_regs *regs, | |||
| 250 | * Save FPU state to signal context. Signal handler | 194 | * Save FPU state to signal context. Signal handler |
| 251 | * will "inherit" current FPU state. | 195 | * will "inherit" current FPU state. |
| 252 | */ | 196 | */ |
| 253 | err |= protected_save_fp_context32(sc, used_math); | 197 | err |= protected_save_fp_context32(sc); |
| 254 | } | 198 | } |
| 255 | return err; | 199 | return err; |
| 256 | } | 200 | } |
| 257 | 201 | ||
| 258 | static int | 202 | static int |
| 259 | check_and_restore_fp_context32(struct sigcontext32 __user *sc, | 203 | check_and_restore_fp_context32(struct sigcontext32 __user *sc) |
| 260 | unsigned used_math) | ||
| 261 | { | 204 | { |
| 262 | int err, sig; | 205 | int err, sig; |
| 263 | 206 | ||
| 264 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); | 207 | err = sig = fpcsr_pending(&sc->sc_fpc_csr); |
| 265 | if (err > 0) | 208 | if (err > 0) |
| 266 | err = 0; | 209 | err = 0; |
| 267 | err |= protected_restore_fp_context32(sc, used_math); | 210 | err |= protected_restore_fp_context32(sc); |
| 268 | return err ?: sig; | 211 | return err ?: sig; |
| 269 | } | 212 | } |
| 270 | 213 | ||
| @@ -301,10 +244,9 @@ static int restore_sigcontext32(struct pt_regs *regs, | |||
| 301 | if (used_math) { | 244 | if (used_math) { |
| 302 | /* restore fpu context if we have used it before */ | 245 | /* restore fpu context if we have used it before */ |
| 303 | if (!err) | 246 | if (!err) |
| 304 | err = check_and_restore_fp_context32(sc, used_math); | 247 | err = check_and_restore_fp_context32(sc); |
| 305 | } else { | 248 | } else { |
| 306 | /* signal handler may have used FPU or MSA. Disable them. */ | 249 | /* signal handler may have used FPU. Give it up. */ |
| 307 | disable_msa(); | ||
| 308 | lose_fpu(0); | 250 | lose_fpu(0); |
| 309 | } | 251 | } |
| 310 | 252 | ||
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c index df0598d9bfdd..949f2c6827a0 100644 --- a/arch/mips/kernel/smp-cps.c +++ b/arch/mips/kernel/smp-cps.c | |||
| @@ -301,7 +301,7 @@ static int cps_cpu_disable(void) | |||
| 301 | 301 | ||
| 302 | core_cfg = &mips_cps_core_bootcfg[current_cpu_data.core]; | 302 | core_cfg = &mips_cps_core_bootcfg[current_cpu_data.core]; |
| 303 | atomic_sub(1 << cpu_vpe_id(¤t_cpu_data), &core_cfg->vpe_mask); | 303 | atomic_sub(1 << cpu_vpe_id(¤t_cpu_data), &core_cfg->vpe_mask); |
| 304 | smp_mb__after_atomic_dec(); | 304 | smp_mb__after_atomic(); |
| 305 | set_cpu_online(cpu, false); | 305 | set_cpu_online(cpu, false); |
| 306 | cpu_clear(cpu, cpu_callin_map); | 306 | cpu_clear(cpu, cpu_callin_map); |
| 307 | 307 | ||
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index cd5e4f568439..f3c56a182fd8 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c | |||
| @@ -384,6 +384,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) | |||
| 384 | 384 | ||
| 385 | kfree(vcpu->arch.guest_ebase); | 385 | kfree(vcpu->arch.guest_ebase); |
| 386 | kfree(vcpu->arch.kseg0_commpage); | 386 | kfree(vcpu->arch.kseg0_commpage); |
| 387 | kfree(vcpu); | ||
| 387 | } | 388 | } |
| 388 | 389 | ||
| 389 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) | 390 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) |
diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c index 53f1d2287084..8e97acbbe22c 100644 --- a/arch/mips/math-emu/ieee754.c +++ b/arch/mips/math-emu/ieee754.c | |||
| @@ -34,13 +34,22 @@ | |||
| 34 | * Special constants | 34 | * Special constants |
| 35 | */ | 35 | */ |
| 36 | 36 | ||
| 37 | #define DPCNST(s, b, m) \ | 37 | /* |
| 38 | * Older GCC requires the inner braces for initialization of union ieee754dp's | ||
| 39 | * anonymous struct member. Without an error will result. | ||
| 40 | */ | ||
| 41 | #define xPCNST(s, b, m, ebias) \ | ||
| 38 | { \ | 42 | { \ |
| 39 | .sign = (s), \ | 43 | { \ |
| 40 | .bexp = (b) + DP_EBIAS, \ | 44 | .sign = (s), \ |
| 41 | .mant = (m) \ | 45 | .bexp = (b) + ebias, \ |
| 46 | .mant = (m) \ | ||
| 47 | } \ | ||
| 42 | } | 48 | } |
| 43 | 49 | ||
| 50 | #define DPCNST(s, b, m) \ | ||
| 51 | xPCNST(s, b, m, DP_EBIAS) | ||
| 52 | |||
| 44 | const union ieee754dp __ieee754dp_spcvals[] = { | 53 | const union ieee754dp __ieee754dp_spcvals[] = { |
| 45 | DPCNST(0, DP_EMIN - 1, 0x0000000000000ULL), /* + zero */ | 54 | DPCNST(0, DP_EMIN - 1, 0x0000000000000ULL), /* + zero */ |
| 46 | DPCNST(1, DP_EMIN - 1, 0x0000000000000ULL), /* - zero */ | 55 | DPCNST(1, DP_EMIN - 1, 0x0000000000000ULL), /* - zero */ |
| @@ -62,11 +71,7 @@ const union ieee754dp __ieee754dp_spcvals[] = { | |||
| 62 | }; | 71 | }; |
| 63 | 72 | ||
| 64 | #define SPCNST(s, b, m) \ | 73 | #define SPCNST(s, b, m) \ |
| 65 | { \ | 74 | xPCNST(s, b, m, SP_EBIAS) |
| 66 | .sign = (s), \ | ||
| 67 | .bexp = (b) + SP_EBIAS, \ | ||
| 68 | .mant = (m) \ | ||
| 69 | } | ||
| 70 | 75 | ||
| 71 | const union ieee754sp __ieee754sp_spcvals[] = { | 76 | const union ieee754sp __ieee754sp_spcvals[] = { |
| 72 | SPCNST(0, SP_EMIN - 1, 0x000000), /* + zero */ | 77 | SPCNST(0, SP_EMIN - 1, 0x000000), /* + zero */ |
diff --git a/arch/mips/mm/uasm-micromips.c b/arch/mips/mm/uasm-micromips.c index 775c2800cba2..8399ddf03a02 100644 --- a/arch/mips/mm/uasm-micromips.c +++ b/arch/mips/mm/uasm-micromips.c | |||
| @@ -102,6 +102,7 @@ static struct insn insn_table_MM[] = { | |||
| 102 | { insn_sd, 0, 0 }, | 102 | { insn_sd, 0, 0 }, |
| 103 | { insn_sll, M(mm_pool32a_op, 0, 0, 0, 0, mm_sll32_op), RT | RS | RD }, | 103 | { insn_sll, M(mm_pool32a_op, 0, 0, 0, 0, mm_sll32_op), RT | RS | RD }, |
| 104 | { insn_sllv, M(mm_pool32a_op, 0, 0, 0, 0, mm_sllv32_op), RT | RS | RD }, | 104 | { insn_sllv, M(mm_pool32a_op, 0, 0, 0, 0, mm_sllv32_op), RT | RS | RD }, |
| 105 | { insn_slt, M(mm_pool32a_op, 0, 0, 0, 0, mm_slt_op), RT | RS | RD }, | ||
| 105 | { insn_sltiu, M(mm_sltiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM }, | 106 | { insn_sltiu, M(mm_sltiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM }, |
| 106 | { insn_sltu, M(mm_pool32a_op, 0, 0, 0, 0, mm_sltu_op), RT | RS | RD }, | 107 | { insn_sltu, M(mm_pool32a_op, 0, 0, 0, 0, mm_sltu_op), RT | RS | RD }, |
| 107 | { insn_sra, M(mm_pool32a_op, 0, 0, 0, 0, mm_sra_op), RT | RS | RD }, | 108 | { insn_sra, M(mm_pool32a_op, 0, 0, 0, 0, mm_sra_op), RT | RS | RD }, |
diff --git a/arch/mips/mm/uasm-mips.c b/arch/mips/mm/uasm-mips.c index 38792c2364f5..6708a2dbf934 100644 --- a/arch/mips/mm/uasm-mips.c +++ b/arch/mips/mm/uasm-mips.c | |||
| @@ -89,7 +89,7 @@ static struct insn insn_table[] = { | |||
| 89 | { insn_lb, M(lb_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 89 | { insn_lb, M(lb_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
| 90 | { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 90 | { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
| 91 | { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD }, | 91 | { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD }, |
| 92 | { insn_lh, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 92 | { insn_lh, M(lh_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
| 93 | { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 93 | { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
| 94 | { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 94 | { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
| 95 | { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM }, | 95 | { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM }, |
| @@ -110,6 +110,7 @@ static struct insn insn_table[] = { | |||
| 110 | { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 110 | { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
| 111 | { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE }, | 111 | { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE }, |
| 112 | { insn_sllv, M(spec_op, 0, 0, 0, 0, sllv_op), RS | RT | RD }, | 112 | { insn_sllv, M(spec_op, 0, 0, 0, 0, sllv_op), RS | RT | RD }, |
| 113 | { insn_slt, M(spec_op, 0, 0, 0, 0, slt_op), RS | RT | RD }, | ||
| 113 | { insn_sltiu, M(sltiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 114 | { insn_sltiu, M(sltiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
| 114 | { insn_sltu, M(spec_op, 0, 0, 0, 0, sltu_op), RS | RT | RD }, | 115 | { insn_sltu, M(spec_op, 0, 0, 0, 0, sltu_op), RS | RT | RD }, |
| 115 | { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE }, | 116 | { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE }, |
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c index 00515805fe41..a01b0d6cedd2 100644 --- a/arch/mips/mm/uasm.c +++ b/arch/mips/mm/uasm.c | |||
| @@ -53,7 +53,7 @@ enum opcode { | |||
| 53 | insn_ld, insn_ldx, insn_lh, insn_ll, insn_lld, insn_lui, insn_lw, | 53 | insn_ld, insn_ldx, insn_lh, insn_ll, insn_lld, insn_lui, insn_lw, |
| 54 | insn_lwx, insn_mfc0, insn_mfhi, insn_mflo, insn_mtc0, insn_mul, | 54 | insn_lwx, insn_mfc0, insn_mfhi, insn_mflo, insn_mtc0, insn_mul, |
| 55 | insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd, | 55 | insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sc, insn_scd, |
| 56 | insn_sd, insn_sll, insn_sllv, insn_sltiu, insn_sltu, insn_sra, | 56 | insn_sd, insn_sll, insn_sllv, insn_slt, insn_sltiu, insn_sltu, insn_sra, |
| 57 | insn_srl, insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall, | 57 | insn_srl, insn_srlv, insn_subu, insn_sw, insn_sync, insn_syscall, |
| 58 | insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh, | 58 | insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_wait, insn_wsbh, |
| 59 | insn_xor, insn_xori, insn_yield, | 59 | insn_xor, insn_xori, insn_yield, |
| @@ -139,6 +139,13 @@ Ip_u1u2u3(op) \ | |||
| 139 | } \ | 139 | } \ |
| 140 | UASM_EXPORT_SYMBOL(uasm_i##op); | 140 | UASM_EXPORT_SYMBOL(uasm_i##op); |
| 141 | 141 | ||
| 142 | #define I_s3s1s2(op) \ | ||
| 143 | Ip_s3s1s2(op) \ | ||
| 144 | { \ | ||
| 145 | build_insn(buf, insn##op, b, c, a); \ | ||
| 146 | } \ | ||
| 147 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
| 148 | |||
| 142 | #define I_u2u1u3(op) \ | 149 | #define I_u2u1u3(op) \ |
| 143 | Ip_u2u1u3(op) \ | 150 | Ip_u2u1u3(op) \ |
| 144 | { \ | 151 | { \ |
| @@ -289,6 +296,7 @@ I_u2s3u1(_scd) | |||
| 289 | I_u2s3u1(_sd) | 296 | I_u2s3u1(_sd) |
| 290 | I_u2u1u3(_sll) | 297 | I_u2u1u3(_sll) |
| 291 | I_u3u2u1(_sllv) | 298 | I_u3u2u1(_sllv) |
| 299 | I_s3s1s2(_slt) | ||
| 292 | I_u2u1s3(_sltiu) | 300 | I_u2u1s3(_sltiu) |
| 293 | I_u3u1u2(_sltu) | 301 | I_u3u1u2(_sltu) |
| 294 | I_u2u1u3(_sra) | 302 | I_u2u1u3(_sra) |
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index a67b9753330b..b87390a56a2f 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c | |||
| @@ -119,8 +119,6 @@ | |||
| 119 | /* Arguments used by JIT */ | 119 | /* Arguments used by JIT */ |
| 120 | #define ARGS_USED_BY_JIT 2 /* only applicable to 64-bit */ | 120 | #define ARGS_USED_BY_JIT 2 /* only applicable to 64-bit */ |
| 121 | 121 | ||
| 122 | #define FLAG_NEED_X_RESET (1 << 0) | ||
| 123 | |||
| 124 | #define SBIT(x) (1 << (x)) /* Signed version of BIT() */ | 122 | #define SBIT(x) (1 << (x)) /* Signed version of BIT() */ |
| 125 | 123 | ||
| 126 | /** | 124 | /** |
| @@ -153,6 +151,8 @@ static inline int optimize_div(u32 *k) | |||
| 153 | return 0; | 151 | return 0; |
| 154 | } | 152 | } |
| 155 | 153 | ||
| 154 | static inline void emit_jit_reg_move(ptr dst, ptr src, struct jit_ctx *ctx); | ||
| 155 | |||
| 156 | /* Simply emit the instruction if the JIT memory space has been allocated */ | 156 | /* Simply emit the instruction if the JIT memory space has been allocated */ |
| 157 | #define emit_instr(ctx, func, ...) \ | 157 | #define emit_instr(ctx, func, ...) \ |
| 158 | do { \ | 158 | do { \ |
| @@ -166,9 +166,7 @@ do { \ | |||
| 166 | /* Determine if immediate is within the 16-bit signed range */ | 166 | /* Determine if immediate is within the 16-bit signed range */ |
| 167 | static inline bool is_range16(s32 imm) | 167 | static inline bool is_range16(s32 imm) |
| 168 | { | 168 | { |
| 169 | if (imm >= SBIT(15) || imm < -SBIT(15)) | 169 | return !(imm >= SBIT(15) || imm < -SBIT(15)); |
| 170 | return true; | ||
| 171 | return false; | ||
| 172 | } | 170 | } |
| 173 | 171 | ||
| 174 | static inline void emit_addu(unsigned int dst, unsigned int src1, | 172 | static inline void emit_addu(unsigned int dst, unsigned int src1, |
| @@ -187,7 +185,7 @@ static inline void emit_load_imm(unsigned int dst, u32 imm, struct jit_ctx *ctx) | |||
| 187 | { | 185 | { |
| 188 | if (ctx->target != NULL) { | 186 | if (ctx->target != NULL) { |
| 189 | /* addiu can only handle s16 */ | 187 | /* addiu can only handle s16 */ |
| 190 | if (is_range16(imm)) { | 188 | if (!is_range16(imm)) { |
| 191 | u32 *p = &ctx->target[ctx->idx]; | 189 | u32 *p = &ctx->target[ctx->idx]; |
| 192 | uasm_i_lui(&p, r_tmp_imm, (s32)imm >> 16); | 190 | uasm_i_lui(&p, r_tmp_imm, (s32)imm >> 16); |
| 193 | p = &ctx->target[ctx->idx + 1]; | 191 | p = &ctx->target[ctx->idx + 1]; |
| @@ -199,7 +197,7 @@ static inline void emit_load_imm(unsigned int dst, u32 imm, struct jit_ctx *ctx) | |||
| 199 | } | 197 | } |
| 200 | ctx->idx++; | 198 | ctx->idx++; |
| 201 | 199 | ||
| 202 | if (is_range16(imm)) | 200 | if (!is_range16(imm)) |
| 203 | ctx->idx++; | 201 | ctx->idx++; |
| 204 | } | 202 | } |
| 205 | 203 | ||
| @@ -240,7 +238,7 @@ static inline void emit_daddiu(unsigned int dst, unsigned int src, | |||
| 240 | static inline void emit_addiu(unsigned int dst, unsigned int src, | 238 | static inline void emit_addiu(unsigned int dst, unsigned int src, |
| 241 | u32 imm, struct jit_ctx *ctx) | 239 | u32 imm, struct jit_ctx *ctx) |
| 242 | { | 240 | { |
| 243 | if (is_range16(imm)) { | 241 | if (!is_range16(imm)) { |
| 244 | emit_load_imm(r_tmp, imm, ctx); | 242 | emit_load_imm(r_tmp, imm, ctx); |
| 245 | emit_addu(dst, r_tmp, src, ctx); | 243 | emit_addu(dst, r_tmp, src, ctx); |
| 246 | } else { | 244 | } else { |
| @@ -313,8 +311,11 @@ static inline void emit_sll(unsigned int dst, unsigned int src, | |||
| 313 | unsigned int sa, struct jit_ctx *ctx) | 311 | unsigned int sa, struct jit_ctx *ctx) |
| 314 | { | 312 | { |
| 315 | /* sa is 5-bits long */ | 313 | /* sa is 5-bits long */ |
| 316 | BUG_ON(sa >= BIT(5)); | 314 | if (sa >= BIT(5)) |
| 317 | emit_instr(ctx, sll, dst, src, sa); | 315 | /* Shifting >= 32 results in zero */ |
| 316 | emit_jit_reg_move(dst, r_zero, ctx); | ||
| 317 | else | ||
| 318 | emit_instr(ctx, sll, dst, src, sa); | ||
| 318 | } | 319 | } |
| 319 | 320 | ||
| 320 | static inline void emit_srlv(unsigned int dst, unsigned int src, | 321 | static inline void emit_srlv(unsigned int dst, unsigned int src, |
| @@ -327,8 +328,17 @@ static inline void emit_srl(unsigned int dst, unsigned int src, | |||
| 327 | unsigned int sa, struct jit_ctx *ctx) | 328 | unsigned int sa, struct jit_ctx *ctx) |
| 328 | { | 329 | { |
| 329 | /* sa is 5-bits long */ | 330 | /* sa is 5-bits long */ |
| 330 | BUG_ON(sa >= BIT(5)); | 331 | if (sa >= BIT(5)) |
| 331 | emit_instr(ctx, srl, dst, src, sa); | 332 | /* Shifting >= 32 results in zero */ |
| 333 | emit_jit_reg_move(dst, r_zero, ctx); | ||
| 334 | else | ||
| 335 | emit_instr(ctx, srl, dst, src, sa); | ||
| 336 | } | ||
| 337 | |||
| 338 | static inline void emit_slt(unsigned int dst, unsigned int src1, | ||
| 339 | unsigned int src2, struct jit_ctx *ctx) | ||
| 340 | { | ||
| 341 | emit_instr(ctx, slt, dst, src1, src2); | ||
| 332 | } | 342 | } |
| 333 | 343 | ||
| 334 | static inline void emit_sltu(unsigned int dst, unsigned int src1, | 344 | static inline void emit_sltu(unsigned int dst, unsigned int src1, |
| @@ -341,7 +351,7 @@ static inline void emit_sltiu(unsigned dst, unsigned int src, | |||
| 341 | unsigned int imm, struct jit_ctx *ctx) | 351 | unsigned int imm, struct jit_ctx *ctx) |
| 342 | { | 352 | { |
| 343 | /* 16 bit immediate */ | 353 | /* 16 bit immediate */ |
| 344 | if (is_range16((s32)imm)) { | 354 | if (!is_range16((s32)imm)) { |
| 345 | emit_load_imm(r_tmp, imm, ctx); | 355 | emit_load_imm(r_tmp, imm, ctx); |
| 346 | emit_sltu(dst, src, r_tmp, ctx); | 356 | emit_sltu(dst, src, r_tmp, ctx); |
| 347 | } else { | 357 | } else { |
| @@ -408,7 +418,7 @@ static inline void emit_div(unsigned int dst, unsigned int src, | |||
| 408 | u32 *p = &ctx->target[ctx->idx]; | 418 | u32 *p = &ctx->target[ctx->idx]; |
| 409 | uasm_i_divu(&p, dst, src); | 419 | uasm_i_divu(&p, dst, src); |
| 410 | p = &ctx->target[ctx->idx + 1]; | 420 | p = &ctx->target[ctx->idx + 1]; |
| 411 | uasm_i_mfhi(&p, dst); | 421 | uasm_i_mflo(&p, dst); |
| 412 | } | 422 | } |
| 413 | ctx->idx += 2; /* 2 insts */ | 423 | ctx->idx += 2; /* 2 insts */ |
| 414 | } | 424 | } |
| @@ -443,6 +453,17 @@ static inline void emit_wsbh(unsigned int dst, unsigned int src, | |||
| 443 | emit_instr(ctx, wsbh, dst, src); | 453 | emit_instr(ctx, wsbh, dst, src); |
| 444 | } | 454 | } |
| 445 | 455 | ||
| 456 | /* load pointer to register */ | ||
| 457 | static inline void emit_load_ptr(unsigned int dst, unsigned int src, | ||
| 458 | int imm, struct jit_ctx *ctx) | ||
| 459 | { | ||
| 460 | /* src contains the base addr of the 32/64-pointer */ | ||
| 461 | if (config_enabled(CONFIG_64BIT)) | ||
| 462 | emit_instr(ctx, ld, dst, imm, src); | ||
| 463 | else | ||
| 464 | emit_instr(ctx, lw, dst, imm, src); | ||
| 465 | } | ||
| 466 | |||
| 446 | /* load a function pointer to register */ | 467 | /* load a function pointer to register */ |
| 447 | static inline void emit_load_func(unsigned int reg, ptr imm, | 468 | static inline void emit_load_func(unsigned int reg, ptr imm, |
| 448 | struct jit_ctx *ctx) | 469 | struct jit_ctx *ctx) |
| @@ -545,29 +566,13 @@ static inline u16 align_sp(unsigned int num) | |||
| 545 | return num; | 566 | return num; |
| 546 | } | 567 | } |
| 547 | 568 | ||
| 548 | static inline void update_on_xread(struct jit_ctx *ctx) | ||
| 549 | { | ||
| 550 | if (!(ctx->flags & SEEN_X)) | ||
| 551 | ctx->flags |= FLAG_NEED_X_RESET; | ||
| 552 | |||
| 553 | ctx->flags |= SEEN_X; | ||
| 554 | } | ||
| 555 | |||
| 556 | static bool is_load_to_a(u16 inst) | 569 | static bool is_load_to_a(u16 inst) |
| 557 | { | 570 | { |
| 558 | switch (inst) { | 571 | switch (inst) { |
| 559 | case BPF_S_LD_W_LEN: | 572 | case BPF_LD | BPF_W | BPF_LEN: |
| 560 | case BPF_S_LD_W_ABS: | 573 | case BPF_LD | BPF_W | BPF_ABS: |
| 561 | case BPF_S_LD_H_ABS: | 574 | case BPF_LD | BPF_H | BPF_ABS: |
| 562 | case BPF_S_LD_B_ABS: | 575 | case BPF_LD | BPF_B | BPF_ABS: |
| 563 | case BPF_S_ANC_CPU: | ||
| 564 | case BPF_S_ANC_IFINDEX: | ||
| 565 | case BPF_S_ANC_MARK: | ||
| 566 | case BPF_S_ANC_PROTOCOL: | ||
| 567 | case BPF_S_ANC_RXHASH: | ||
| 568 | case BPF_S_ANC_VLAN_TAG: | ||
| 569 | case BPF_S_ANC_VLAN_TAG_PRESENT: | ||
| 570 | case BPF_S_ANC_QUEUE: | ||
| 571 | return true; | 576 | return true; |
| 572 | default: | 577 | default: |
| 573 | return false; | 578 | return false; |
| @@ -618,7 +623,10 @@ static void save_bpf_jit_regs(struct jit_ctx *ctx, unsigned offset) | |||
| 618 | if (ctx->flags & SEEN_MEM) { | 623 | if (ctx->flags & SEEN_MEM) { |
| 619 | if (real_off % (RSIZE * 2)) | 624 | if (real_off % (RSIZE * 2)) |
| 620 | real_off += RSIZE; | 625 | real_off += RSIZE; |
| 621 | emit_addiu(r_M, r_sp, real_off, ctx); | 626 | if (config_enabled(CONFIG_64BIT)) |
| 627 | emit_daddiu(r_M, r_sp, real_off, ctx); | ||
| 628 | else | ||
| 629 | emit_addiu(r_M, r_sp, real_off, ctx); | ||
| 622 | } | 630 | } |
| 623 | } | 631 | } |
| 624 | 632 | ||
| @@ -705,11 +713,11 @@ static void build_prologue(struct jit_ctx *ctx) | |||
| 705 | if (ctx->flags & SEEN_SKB) | 713 | if (ctx->flags & SEEN_SKB) |
| 706 | emit_reg_move(r_skb, MIPS_R_A0, ctx); | 714 | emit_reg_move(r_skb, MIPS_R_A0, ctx); |
| 707 | 715 | ||
| 708 | if (ctx->flags & FLAG_NEED_X_RESET) | 716 | if (ctx->flags & SEEN_X) |
| 709 | emit_jit_reg_move(r_X, r_zero, ctx); | 717 | emit_jit_reg_move(r_X, r_zero, ctx); |
| 710 | 718 | ||
| 711 | /* Do not leak kernel data to userspace */ | 719 | /* Do not leak kernel data to userspace */ |
| 712 | if ((first_inst != BPF_S_RET_K) && !(is_load_to_a(first_inst))) | 720 | if ((first_inst != (BPF_RET | BPF_K)) && !(is_load_to_a(first_inst))) |
| 713 | emit_jit_reg_move(r_A, r_zero, ctx); | 721 | emit_jit_reg_move(r_A, r_zero, ctx); |
| 714 | } | 722 | } |
| 715 | 723 | ||
| @@ -757,13 +765,17 @@ static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset) | |||
| 757 | return (u64)err << 32 | ntohl(ret); | 765 | return (u64)err << 32 | ntohl(ret); |
| 758 | } | 766 | } |
| 759 | 767 | ||
| 760 | #define PKT_TYPE_MAX 7 | 768 | #ifdef __BIG_ENDIAN_BITFIELD |
| 769 | #define PKT_TYPE_MAX (7 << 5) | ||
| 770 | #else | ||
| 771 | #define PKT_TYPE_MAX 7 | ||
| 772 | #endif | ||
| 761 | static int pkt_type_offset(void) | 773 | static int pkt_type_offset(void) |
| 762 | { | 774 | { |
| 763 | struct sk_buff skb_probe = { | 775 | struct sk_buff skb_probe = { |
| 764 | .pkt_type = ~0, | 776 | .pkt_type = ~0, |
| 765 | }; | 777 | }; |
| 766 | char *ct = (char *)&skb_probe; | 778 | u8 *ct = (u8 *)&skb_probe; |
| 767 | unsigned int off; | 779 | unsigned int off; |
| 768 | 780 | ||
| 769 | for (off = 0; off < sizeof(struct sk_buff); off++) { | 781 | for (off = 0; off < sizeof(struct sk_buff); off++) { |
| @@ -783,46 +795,62 @@ static int build_body(struct jit_ctx *ctx) | |||
| 783 | u32 k, b_off __maybe_unused; | 795 | u32 k, b_off __maybe_unused; |
| 784 | 796 | ||
| 785 | for (i = 0; i < prog->len; i++) { | 797 | for (i = 0; i < prog->len; i++) { |
| 798 | u16 code; | ||
| 799 | |||
| 786 | inst = &(prog->insns[i]); | 800 | inst = &(prog->insns[i]); |
| 787 | pr_debug("%s: code->0x%02x, jt->0x%x, jf->0x%x, k->0x%x\n", | 801 | pr_debug("%s: code->0x%02x, jt->0x%x, jf->0x%x, k->0x%x\n", |
| 788 | __func__, inst->code, inst->jt, inst->jf, inst->k); | 802 | __func__, inst->code, inst->jt, inst->jf, inst->k); |
| 789 | k = inst->k; | 803 | k = inst->k; |
| 804 | code = bpf_anc_helper(inst); | ||
| 790 | 805 | ||
| 791 | if (ctx->target == NULL) | 806 | if (ctx->target == NULL) |
| 792 | ctx->offsets[i] = ctx->idx * 4; | 807 | ctx->offsets[i] = ctx->idx * 4; |
| 793 | 808 | ||
| 794 | switch (inst->code) { | 809 | switch (code) { |
| 795 | case BPF_S_LD_IMM: | 810 | case BPF_LD | BPF_IMM: |
| 796 | /* A <- k ==> li r_A, k */ | 811 | /* A <- k ==> li r_A, k */ |
| 797 | ctx->flags |= SEEN_A; | 812 | ctx->flags |= SEEN_A; |
| 798 | emit_load_imm(r_A, k, ctx); | 813 | emit_load_imm(r_A, k, ctx); |
| 799 | break; | 814 | break; |
| 800 | case BPF_S_LD_W_LEN: | 815 | case BPF_LD | BPF_W | BPF_LEN: |
| 801 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4); | 816 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4); |
| 802 | /* A <- len ==> lw r_A, offset(skb) */ | 817 | /* A <- len ==> lw r_A, offset(skb) */ |
| 803 | ctx->flags |= SEEN_SKB | SEEN_A; | 818 | ctx->flags |= SEEN_SKB | SEEN_A; |
| 804 | off = offsetof(struct sk_buff, len); | 819 | off = offsetof(struct sk_buff, len); |
| 805 | emit_load(r_A, r_skb, off, ctx); | 820 | emit_load(r_A, r_skb, off, ctx); |
| 806 | break; | 821 | break; |
| 807 | case BPF_S_LD_MEM: | 822 | case BPF_LD | BPF_MEM: |
| 808 | /* A <- M[k] ==> lw r_A, offset(M) */ | 823 | /* A <- M[k] ==> lw r_A, offset(M) */ |
| 809 | ctx->flags |= SEEN_MEM | SEEN_A; | 824 | ctx->flags |= SEEN_MEM | SEEN_A; |
| 810 | emit_load(r_A, r_M, SCRATCH_OFF(k), ctx); | 825 | emit_load(r_A, r_M, SCRATCH_OFF(k), ctx); |
| 811 | break; | 826 | break; |
| 812 | case BPF_S_LD_W_ABS: | 827 | case BPF_LD | BPF_W | BPF_ABS: |
| 813 | /* A <- P[k:4] */ | 828 | /* A <- P[k:4] */ |
| 814 | load_order = 2; | 829 | load_order = 2; |
| 815 | goto load; | 830 | goto load; |
| 816 | case BPF_S_LD_H_ABS: | 831 | case BPF_LD | BPF_H | BPF_ABS: |
| 817 | /* A <- P[k:2] */ | 832 | /* A <- P[k:2] */ |
| 818 | load_order = 1; | 833 | load_order = 1; |
| 819 | goto load; | 834 | goto load; |
| 820 | case BPF_S_LD_B_ABS: | 835 | case BPF_LD | BPF_B | BPF_ABS: |
| 821 | /* A <- P[k:1] */ | 836 | /* A <- P[k:1] */ |
| 822 | load_order = 0; | 837 | load_order = 0; |
| 823 | load: | 838 | load: |
| 839 | /* the interpreter will deal with the negative K */ | ||
| 840 | if ((int)k < 0) | ||
| 841 | return -ENOTSUPP; | ||
| 842 | |||
| 824 | emit_load_imm(r_off, k, ctx); | 843 | emit_load_imm(r_off, k, ctx); |
| 825 | load_common: | 844 | load_common: |
| 845 | /* | ||
| 846 | * We may got here from the indirect loads so | ||
| 847 | * return if offset is negative. | ||
| 848 | */ | ||
| 849 | emit_slt(r_s0, r_off, r_zero, ctx); | ||
| 850 | emit_bcond(MIPS_COND_NE, r_s0, r_zero, | ||
| 851 | b_imm(prog->len, ctx), ctx); | ||
| 852 | emit_reg_move(r_ret, r_zero, ctx); | ||
| 853 | |||
| 826 | ctx->flags |= SEEN_CALL | SEEN_OFF | SEEN_S0 | | 854 | ctx->flags |= SEEN_CALL | SEEN_OFF | SEEN_S0 | |
| 827 | SEEN_SKB | SEEN_A; | 855 | SEEN_SKB | SEEN_A; |
| 828 | 856 | ||
| @@ -852,39 +880,42 @@ load_common: | |||
| 852 | emit_b(b_imm(prog->len, ctx), ctx); | 880 | emit_b(b_imm(prog->len, ctx), ctx); |
| 853 | emit_reg_move(r_ret, r_zero, ctx); | 881 | emit_reg_move(r_ret, r_zero, ctx); |
| 854 | break; | 882 | break; |
| 855 | case BPF_S_LD_W_IND: | 883 | case BPF_LD | BPF_W | BPF_IND: |
| 856 | /* A <- P[X + k:4] */ | 884 | /* A <- P[X + k:4] */ |
| 857 | load_order = 2; | 885 | load_order = 2; |
| 858 | goto load_ind; | 886 | goto load_ind; |
| 859 | case BPF_S_LD_H_IND: | 887 | case BPF_LD | BPF_H | BPF_IND: |
| 860 | /* A <- P[X + k:2] */ | 888 | /* A <- P[X + k:2] */ |
| 861 | load_order = 1; | 889 | load_order = 1; |
| 862 | goto load_ind; | 890 | goto load_ind; |
| 863 | case BPF_S_LD_B_IND: | 891 | case BPF_LD | BPF_B | BPF_IND: |
| 864 | /* A <- P[X + k:1] */ | 892 | /* A <- P[X + k:1] */ |
| 865 | load_order = 0; | 893 | load_order = 0; |
| 866 | load_ind: | 894 | load_ind: |
| 867 | update_on_xread(ctx); | ||
| 868 | ctx->flags |= SEEN_OFF | SEEN_X; | 895 | ctx->flags |= SEEN_OFF | SEEN_X; |
| 869 | emit_addiu(r_off, r_X, k, ctx); | 896 | emit_addiu(r_off, r_X, k, ctx); |
| 870 | goto load_common; | 897 | goto load_common; |
| 871 | case BPF_S_LDX_IMM: | 898 | case BPF_LDX | BPF_IMM: |
| 872 | /* X <- k */ | 899 | /* X <- k */ |
| 873 | ctx->flags |= SEEN_X; | 900 | ctx->flags |= SEEN_X; |
| 874 | emit_load_imm(r_X, k, ctx); | 901 | emit_load_imm(r_X, k, ctx); |
| 875 | break; | 902 | break; |
| 876 | case BPF_S_LDX_MEM: | 903 | case BPF_LDX | BPF_MEM: |
| 877 | /* X <- M[k] */ | 904 | /* X <- M[k] */ |
| 878 | ctx->flags |= SEEN_X | SEEN_MEM; | 905 | ctx->flags |= SEEN_X | SEEN_MEM; |
| 879 | emit_load(r_X, r_M, SCRATCH_OFF(k), ctx); | 906 | emit_load(r_X, r_M, SCRATCH_OFF(k), ctx); |
| 880 | break; | 907 | break; |
| 881 | case BPF_S_LDX_W_LEN: | 908 | case BPF_LDX | BPF_W | BPF_LEN: |
| 882 | /* X <- len */ | 909 | /* X <- len */ |
| 883 | ctx->flags |= SEEN_X | SEEN_SKB; | 910 | ctx->flags |= SEEN_X | SEEN_SKB; |
| 884 | off = offsetof(struct sk_buff, len); | 911 | off = offsetof(struct sk_buff, len); |
| 885 | emit_load(r_X, r_skb, off, ctx); | 912 | emit_load(r_X, r_skb, off, ctx); |
| 886 | break; | 913 | break; |
| 887 | case BPF_S_LDX_B_MSH: | 914 | case BPF_LDX | BPF_B | BPF_MSH: |
| 915 | /* the interpreter will deal with the negative K */ | ||
| 916 | if ((int)k < 0) | ||
| 917 | return -ENOTSUPP; | ||
| 918 | |||
| 888 | /* X <- 4 * (P[k:1] & 0xf) */ | 919 | /* X <- 4 * (P[k:1] & 0xf) */ |
| 889 | ctx->flags |= SEEN_X | SEEN_CALL | SEEN_S0 | SEEN_SKB; | 920 | ctx->flags |= SEEN_X | SEEN_CALL | SEEN_S0 | SEEN_SKB; |
| 890 | /* Load offset to a1 */ | 921 | /* Load offset to a1 */ |
| @@ -917,50 +948,49 @@ load_ind: | |||
| 917 | emit_b(b_imm(prog->len, ctx), ctx); | 948 | emit_b(b_imm(prog->len, ctx), ctx); |
| 918 | emit_load_imm(r_ret, 0, ctx); /* delay slot */ | 949 | emit_load_imm(r_ret, 0, ctx); /* delay slot */ |
| 919 | break; | 950 | break; |
| 920 | case BPF_S_ST: | 951 | case BPF_ST: |
| 921 | /* M[k] <- A */ | 952 | /* M[k] <- A */ |
| 922 | ctx->flags |= SEEN_MEM | SEEN_A; | 953 | ctx->flags |= SEEN_MEM | SEEN_A; |
| 923 | emit_store(r_A, r_M, SCRATCH_OFF(k), ctx); | 954 | emit_store(r_A, r_M, SCRATCH_OFF(k), ctx); |
| 924 | break; | 955 | break; |
| 925 | case BPF_S_STX: | 956 | case BPF_STX: |
| 926 | /* M[k] <- X */ | 957 | /* M[k] <- X */ |
| 927 | ctx->flags |= SEEN_MEM | SEEN_X; | 958 | ctx->flags |= SEEN_MEM | SEEN_X; |
| 928 | emit_store(r_X, r_M, SCRATCH_OFF(k), ctx); | 959 | emit_store(r_X, r_M, SCRATCH_OFF(k), ctx); |
| 929 | break; | 960 | break; |
| 930 | case BPF_S_ALU_ADD_K: | 961 | case BPF_ALU | BPF_ADD | BPF_K: |
| 931 | /* A += K */ | 962 | /* A += K */ |
| 932 | ctx->flags |= SEEN_A; | 963 | ctx->flags |= SEEN_A; |
| 933 | emit_addiu(r_A, r_A, k, ctx); | 964 | emit_addiu(r_A, r_A, k, ctx); |
| 934 | break; | 965 | break; |
| 935 | case BPF_S_ALU_ADD_X: | 966 | case BPF_ALU | BPF_ADD | BPF_X: |
| 936 | /* A += X */ | 967 | /* A += X */ |
| 937 | ctx->flags |= SEEN_A | SEEN_X; | 968 | ctx->flags |= SEEN_A | SEEN_X; |
| 938 | emit_addu(r_A, r_A, r_X, ctx); | 969 | emit_addu(r_A, r_A, r_X, ctx); |
| 939 | break; | 970 | break; |
| 940 | case BPF_S_ALU_SUB_K: | 971 | case BPF_ALU | BPF_SUB | BPF_K: |
| 941 | /* A -= K */ | 972 | /* A -= K */ |
| 942 | ctx->flags |= SEEN_A; | 973 | ctx->flags |= SEEN_A; |
| 943 | emit_addiu(r_A, r_A, -k, ctx); | 974 | emit_addiu(r_A, r_A, -k, ctx); |
| 944 | break; | 975 | break; |
| 945 | case BPF_S_ALU_SUB_X: | 976 | case BPF_ALU | BPF_SUB | BPF_X: |
| 946 | /* A -= X */ | 977 | /* A -= X */ |
| 947 | ctx->flags |= SEEN_A | SEEN_X; | 978 | ctx->flags |= SEEN_A | SEEN_X; |
| 948 | emit_subu(r_A, r_A, r_X, ctx); | 979 | emit_subu(r_A, r_A, r_X, ctx); |
| 949 | break; | 980 | break; |
| 950 | case BPF_S_ALU_MUL_K: | 981 | case BPF_ALU | BPF_MUL | BPF_K: |
| 951 | /* A *= K */ | 982 | /* A *= K */ |
| 952 | /* Load K to scratch register before MUL */ | 983 | /* Load K to scratch register before MUL */ |
| 953 | ctx->flags |= SEEN_A | SEEN_S0; | 984 | ctx->flags |= SEEN_A | SEEN_S0; |
| 954 | emit_load_imm(r_s0, k, ctx); | 985 | emit_load_imm(r_s0, k, ctx); |
| 955 | emit_mul(r_A, r_A, r_s0, ctx); | 986 | emit_mul(r_A, r_A, r_s0, ctx); |
| 956 | break; | 987 | break; |
| 957 | case BPF_S_ALU_MUL_X: | 988 | case BPF_ALU | BPF_MUL | BPF_X: |
| 958 | /* A *= X */ | 989 | /* A *= X */ |
| 959 | update_on_xread(ctx); | ||
| 960 | ctx->flags |= SEEN_A | SEEN_X; | 990 | ctx->flags |= SEEN_A | SEEN_X; |
| 961 | emit_mul(r_A, r_A, r_X, ctx); | 991 | emit_mul(r_A, r_A, r_X, ctx); |
| 962 | break; | 992 | break; |
| 963 | case BPF_S_ALU_DIV_K: | 993 | case BPF_ALU | BPF_DIV | BPF_K: |
| 964 | /* A /= k */ | 994 | /* A /= k */ |
| 965 | if (k == 1) | 995 | if (k == 1) |
| 966 | break; | 996 | break; |
| @@ -973,7 +1003,7 @@ load_ind: | |||
| 973 | emit_load_imm(r_s0, k, ctx); | 1003 | emit_load_imm(r_s0, k, ctx); |
| 974 | emit_div(r_A, r_s0, ctx); | 1004 | emit_div(r_A, r_s0, ctx); |
| 975 | break; | 1005 | break; |
| 976 | case BPF_S_ALU_MOD_K: | 1006 | case BPF_ALU | BPF_MOD | BPF_K: |
| 977 | /* A %= k */ | 1007 | /* A %= k */ |
| 978 | if (k == 1 || optimize_div(&k)) { | 1008 | if (k == 1 || optimize_div(&k)) { |
| 979 | ctx->flags |= SEEN_A; | 1009 | ctx->flags |= SEEN_A; |
| @@ -984,9 +1014,8 @@ load_ind: | |||
| 984 | emit_mod(r_A, r_s0, ctx); | 1014 | emit_mod(r_A, r_s0, ctx); |
| 985 | } | 1015 | } |
| 986 | break; | 1016 | break; |
| 987 | case BPF_S_ALU_DIV_X: | 1017 | case BPF_ALU | BPF_DIV | BPF_X: |
| 988 | /* A /= X */ | 1018 | /* A /= X */ |
| 989 | update_on_xread(ctx); | ||
| 990 | ctx->flags |= SEEN_X | SEEN_A; | 1019 | ctx->flags |= SEEN_X | SEEN_A; |
| 991 | /* Check if r_X is zero */ | 1020 | /* Check if r_X is zero */ |
| 992 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, | 1021 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, |
| @@ -994,9 +1023,8 @@ load_ind: | |||
| 994 | emit_load_imm(r_val, 0, ctx); /* delay slot */ | 1023 | emit_load_imm(r_val, 0, ctx); /* delay slot */ |
| 995 | emit_div(r_A, r_X, ctx); | 1024 | emit_div(r_A, r_X, ctx); |
| 996 | break; | 1025 | break; |
| 997 | case BPF_S_ALU_MOD_X: | 1026 | case BPF_ALU | BPF_MOD | BPF_X: |
| 998 | /* A %= X */ | 1027 | /* A %= X */ |
| 999 | update_on_xread(ctx); | ||
| 1000 | ctx->flags |= SEEN_X | SEEN_A; | 1028 | ctx->flags |= SEEN_X | SEEN_A; |
| 1001 | /* Check if r_X is zero */ | 1029 | /* Check if r_X is zero */ |
| 1002 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, | 1030 | emit_bcond(MIPS_COND_EQ, r_X, r_zero, |
| @@ -1004,94 +1032,89 @@ load_ind: | |||
| 1004 | emit_load_imm(r_val, 0, ctx); /* delay slot */ | 1032 | emit_load_imm(r_val, 0, ctx); /* delay slot */ |
| 1005 | emit_mod(r_A, r_X, ctx); | 1033 | emit_mod(r_A, r_X, ctx); |
| 1006 | break; | 1034 | break; |
| 1007 | case BPF_S_ALU_OR_K: | 1035 | case BPF_ALU | BPF_OR | BPF_K: |
| 1008 | /* A |= K */ | 1036 | /* A |= K */ |
| 1009 | ctx->flags |= SEEN_A; | 1037 | ctx->flags |= SEEN_A; |
| 1010 | emit_ori(r_A, r_A, k, ctx); | 1038 | emit_ori(r_A, r_A, k, ctx); |
| 1011 | break; | 1039 | break; |
| 1012 | case BPF_S_ALU_OR_X: | 1040 | case BPF_ALU | BPF_OR | BPF_X: |
| 1013 | /* A |= X */ | 1041 | /* A |= X */ |
| 1014 | update_on_xread(ctx); | ||
| 1015 | ctx->flags |= SEEN_A; | 1042 | ctx->flags |= SEEN_A; |
| 1016 | emit_ori(r_A, r_A, r_X, ctx); | 1043 | emit_ori(r_A, r_A, r_X, ctx); |
| 1017 | break; | 1044 | break; |
| 1018 | case BPF_S_ALU_XOR_K: | 1045 | case BPF_ALU | BPF_XOR | BPF_K: |
| 1019 | /* A ^= k */ | 1046 | /* A ^= k */ |
| 1020 | ctx->flags |= SEEN_A; | 1047 | ctx->flags |= SEEN_A; |
| 1021 | emit_xori(r_A, r_A, k, ctx); | 1048 | emit_xori(r_A, r_A, k, ctx); |
| 1022 | break; | 1049 | break; |
| 1023 | case BPF_S_ANC_ALU_XOR_X: | 1050 | case BPF_ANC | SKF_AD_ALU_XOR_X: |
| 1024 | case BPF_S_ALU_XOR_X: | 1051 | case BPF_ALU | BPF_XOR | BPF_X: |
| 1025 | /* A ^= X */ | 1052 | /* A ^= X */ |
| 1026 | update_on_xread(ctx); | ||
| 1027 | ctx->flags |= SEEN_A; | 1053 | ctx->flags |= SEEN_A; |
| 1028 | emit_xor(r_A, r_A, r_X, ctx); | 1054 | emit_xor(r_A, r_A, r_X, ctx); |
| 1029 | break; | 1055 | break; |
| 1030 | case BPF_S_ALU_AND_K: | 1056 | case BPF_ALU | BPF_AND | BPF_K: |
| 1031 | /* A &= K */ | 1057 | /* A &= K */ |
| 1032 | ctx->flags |= SEEN_A; | 1058 | ctx->flags |= SEEN_A; |
| 1033 | emit_andi(r_A, r_A, k, ctx); | 1059 | emit_andi(r_A, r_A, k, ctx); |
| 1034 | break; | 1060 | break; |
| 1035 | case BPF_S_ALU_AND_X: | 1061 | case BPF_ALU | BPF_AND | BPF_X: |
| 1036 | /* A &= X */ | 1062 | /* A &= X */ |
| 1037 | update_on_xread(ctx); | ||
| 1038 | ctx->flags |= SEEN_A | SEEN_X; | 1063 | ctx->flags |= SEEN_A | SEEN_X; |
| 1039 | emit_and(r_A, r_A, r_X, ctx); | 1064 | emit_and(r_A, r_A, r_X, ctx); |
| 1040 | break; | 1065 | break; |
| 1041 | case BPF_S_ALU_LSH_K: | 1066 | case BPF_ALU | BPF_LSH | BPF_K: |
| 1042 | /* A <<= K */ | 1067 | /* A <<= K */ |
| 1043 | ctx->flags |= SEEN_A; | 1068 | ctx->flags |= SEEN_A; |
| 1044 | emit_sll(r_A, r_A, k, ctx); | 1069 | emit_sll(r_A, r_A, k, ctx); |
| 1045 | break; | 1070 | break; |
| 1046 | case BPF_S_ALU_LSH_X: | 1071 | case BPF_ALU | BPF_LSH | BPF_X: |
| 1047 | /* A <<= X */ | 1072 | /* A <<= X */ |
| 1048 | ctx->flags |= SEEN_A | SEEN_X; | 1073 | ctx->flags |= SEEN_A | SEEN_X; |
| 1049 | update_on_xread(ctx); | ||
| 1050 | emit_sllv(r_A, r_A, r_X, ctx); | 1074 | emit_sllv(r_A, r_A, r_X, ctx); |
| 1051 | break; | 1075 | break; |
| 1052 | case BPF_S_ALU_RSH_K: | 1076 | case BPF_ALU | BPF_RSH | BPF_K: |
| 1053 | /* A >>= K */ | 1077 | /* A >>= K */ |
| 1054 | ctx->flags |= SEEN_A; | 1078 | ctx->flags |= SEEN_A; |
| 1055 | emit_srl(r_A, r_A, k, ctx); | 1079 | emit_srl(r_A, r_A, k, ctx); |
| 1056 | break; | 1080 | break; |
| 1057 | case BPF_S_ALU_RSH_X: | 1081 | case BPF_ALU | BPF_RSH | BPF_X: |
| 1058 | ctx->flags |= SEEN_A | SEEN_X; | 1082 | ctx->flags |= SEEN_A | SEEN_X; |
| 1059 | update_on_xread(ctx); | ||
| 1060 | emit_srlv(r_A, r_A, r_X, ctx); | 1083 | emit_srlv(r_A, r_A, r_X, ctx); |
| 1061 | break; | 1084 | break; |
| 1062 | case BPF_S_ALU_NEG: | 1085 | case BPF_ALU | BPF_NEG: |
| 1063 | /* A = -A */ | 1086 | /* A = -A */ |
| 1064 | ctx->flags |= SEEN_A; | 1087 | ctx->flags |= SEEN_A; |
| 1065 | emit_neg(r_A, ctx); | 1088 | emit_neg(r_A, ctx); |
| 1066 | break; | 1089 | break; |
| 1067 | case BPF_S_JMP_JA: | 1090 | case BPF_JMP | BPF_JA: |
| 1068 | /* pc += K */ | 1091 | /* pc += K */ |
| 1069 | emit_b(b_imm(i + k + 1, ctx), ctx); | 1092 | emit_b(b_imm(i + k + 1, ctx), ctx); |
| 1070 | emit_nop(ctx); | 1093 | emit_nop(ctx); |
| 1071 | break; | 1094 | break; |
| 1072 | case BPF_S_JMP_JEQ_K: | 1095 | case BPF_JMP | BPF_JEQ | BPF_K: |
| 1073 | /* pc += ( A == K ) ? pc->jt : pc->jf */ | 1096 | /* pc += ( A == K ) ? pc->jt : pc->jf */ |
| 1074 | condt = MIPS_COND_EQ | MIPS_COND_K; | 1097 | condt = MIPS_COND_EQ | MIPS_COND_K; |
| 1075 | goto jmp_cmp; | 1098 | goto jmp_cmp; |
| 1076 | case BPF_S_JMP_JEQ_X: | 1099 | case BPF_JMP | BPF_JEQ | BPF_X: |
| 1077 | ctx->flags |= SEEN_X; | 1100 | ctx->flags |= SEEN_X; |
| 1078 | /* pc += ( A == X ) ? pc->jt : pc->jf */ | 1101 | /* pc += ( A == X ) ? pc->jt : pc->jf */ |
| 1079 | condt = MIPS_COND_EQ | MIPS_COND_X; | 1102 | condt = MIPS_COND_EQ | MIPS_COND_X; |
| 1080 | goto jmp_cmp; | 1103 | goto jmp_cmp; |
| 1081 | case BPF_S_JMP_JGE_K: | 1104 | case BPF_JMP | BPF_JGE | BPF_K: |
| 1082 | /* pc += ( A >= K ) ? pc->jt : pc->jf */ | 1105 | /* pc += ( A >= K ) ? pc->jt : pc->jf */ |
| 1083 | condt = MIPS_COND_GE | MIPS_COND_K; | 1106 | condt = MIPS_COND_GE | MIPS_COND_K; |
| 1084 | goto jmp_cmp; | 1107 | goto jmp_cmp; |
| 1085 | case BPF_S_JMP_JGE_X: | 1108 | case BPF_JMP | BPF_JGE | BPF_X: |
| 1086 | ctx->flags |= SEEN_X; | 1109 | ctx->flags |= SEEN_X; |
| 1087 | /* pc += ( A >= X ) ? pc->jt : pc->jf */ | 1110 | /* pc += ( A >= X ) ? pc->jt : pc->jf */ |
| 1088 | condt = MIPS_COND_GE | MIPS_COND_X; | 1111 | condt = MIPS_COND_GE | MIPS_COND_X; |
| 1089 | goto jmp_cmp; | 1112 | goto jmp_cmp; |
| 1090 | case BPF_S_JMP_JGT_K: | 1113 | case BPF_JMP | BPF_JGT | BPF_K: |
| 1091 | /* pc += ( A > K ) ? pc->jt : pc->jf */ | 1114 | /* pc += ( A > K ) ? pc->jt : pc->jf */ |
| 1092 | condt = MIPS_COND_GT | MIPS_COND_K; | 1115 | condt = MIPS_COND_GT | MIPS_COND_K; |
| 1093 | goto jmp_cmp; | 1116 | goto jmp_cmp; |
| 1094 | case BPF_S_JMP_JGT_X: | 1117 | case BPF_JMP | BPF_JGT | BPF_X: |
| 1095 | ctx->flags |= SEEN_X; | 1118 | ctx->flags |= SEEN_X; |
| 1096 | /* pc += ( A > X ) ? pc->jt : pc->jf */ | 1119 | /* pc += ( A > X ) ? pc->jt : pc->jf */ |
| 1097 | condt = MIPS_COND_GT | MIPS_COND_X; | 1120 | condt = MIPS_COND_GT | MIPS_COND_X; |
| @@ -1109,7 +1132,7 @@ jmp_cmp: | |||
| 1109 | } | 1132 | } |
| 1110 | /* A < (K|X) ? r_scrach = 1 */ | 1133 | /* A < (K|X) ? r_scrach = 1 */ |
| 1111 | b_off = b_imm(i + inst->jf + 1, ctx); | 1134 | b_off = b_imm(i + inst->jf + 1, ctx); |
| 1112 | emit_bcond(MIPS_COND_GT, r_s0, r_zero, b_off, | 1135 | emit_bcond(MIPS_COND_NE, r_s0, r_zero, b_off, |
| 1113 | ctx); | 1136 | ctx); |
| 1114 | emit_nop(ctx); | 1137 | emit_nop(ctx); |
| 1115 | /* A > (K|X) ? scratch = 0 */ | 1138 | /* A > (K|X) ? scratch = 0 */ |
| @@ -1167,7 +1190,7 @@ jmp_cmp: | |||
| 1167 | } | 1190 | } |
| 1168 | } | 1191 | } |
| 1169 | break; | 1192 | break; |
| 1170 | case BPF_S_JMP_JSET_K: | 1193 | case BPF_JMP | BPF_JSET | BPF_K: |
| 1171 | ctx->flags |= SEEN_S0 | SEEN_S1 | SEEN_A; | 1194 | ctx->flags |= SEEN_S0 | SEEN_S1 | SEEN_A; |
| 1172 | /* pc += (A & K) ? pc -> jt : pc -> jf */ | 1195 | /* pc += (A & K) ? pc -> jt : pc -> jf */ |
| 1173 | emit_load_imm(r_s1, k, ctx); | 1196 | emit_load_imm(r_s1, k, ctx); |
| @@ -1181,7 +1204,7 @@ jmp_cmp: | |||
| 1181 | emit_b(b_off, ctx); | 1204 | emit_b(b_off, ctx); |
| 1182 | emit_nop(ctx); | 1205 | emit_nop(ctx); |
| 1183 | break; | 1206 | break; |
| 1184 | case BPF_S_JMP_JSET_X: | 1207 | case BPF_JMP | BPF_JSET | BPF_X: |
| 1185 | ctx->flags |= SEEN_S0 | SEEN_X | SEEN_A; | 1208 | ctx->flags |= SEEN_S0 | SEEN_X | SEEN_A; |
| 1186 | /* pc += (A & X) ? pc -> jt : pc -> jf */ | 1209 | /* pc += (A & X) ? pc -> jt : pc -> jf */ |
| 1187 | emit_and(r_s0, r_A, r_X, ctx); | 1210 | emit_and(r_s0, r_A, r_X, ctx); |
| @@ -1194,7 +1217,7 @@ jmp_cmp: | |||
| 1194 | emit_b(b_off, ctx); | 1217 | emit_b(b_off, ctx); |
| 1195 | emit_nop(ctx); | 1218 | emit_nop(ctx); |
| 1196 | break; | 1219 | break; |
| 1197 | case BPF_S_RET_A: | 1220 | case BPF_RET | BPF_A: |
| 1198 | ctx->flags |= SEEN_A; | 1221 | ctx->flags |= SEEN_A; |
| 1199 | if (i != prog->len - 1) | 1222 | if (i != prog->len - 1) |
| 1200 | /* | 1223 | /* |
| @@ -1204,7 +1227,7 @@ jmp_cmp: | |||
| 1204 | emit_b(b_imm(prog->len, ctx), ctx); | 1227 | emit_b(b_imm(prog->len, ctx), ctx); |
| 1205 | emit_reg_move(r_ret, r_A, ctx); /* delay slot */ | 1228 | emit_reg_move(r_ret, r_A, ctx); /* delay slot */ |
| 1206 | break; | 1229 | break; |
| 1207 | case BPF_S_RET_K: | 1230 | case BPF_RET | BPF_K: |
| 1208 | /* | 1231 | /* |
| 1209 | * It can emit two instructions so it does not fit on | 1232 | * It can emit two instructions so it does not fit on |
| 1210 | * the delay slot. | 1233 | * the delay slot. |
| @@ -1219,19 +1242,18 @@ jmp_cmp: | |||
| 1219 | emit_nop(ctx); | 1242 | emit_nop(ctx); |
| 1220 | } | 1243 | } |
| 1221 | break; | 1244 | break; |
| 1222 | case BPF_S_MISC_TAX: | 1245 | case BPF_MISC | BPF_TAX: |
| 1223 | /* X = A */ | 1246 | /* X = A */ |
| 1224 | ctx->flags |= SEEN_X | SEEN_A; | 1247 | ctx->flags |= SEEN_X | SEEN_A; |
| 1225 | emit_jit_reg_move(r_X, r_A, ctx); | 1248 | emit_jit_reg_move(r_X, r_A, ctx); |
| 1226 | break; | 1249 | break; |
| 1227 | case BPF_S_MISC_TXA: | 1250 | case BPF_MISC | BPF_TXA: |
| 1228 | /* A = X */ | 1251 | /* A = X */ |
| 1229 | ctx->flags |= SEEN_A | SEEN_X; | 1252 | ctx->flags |= SEEN_A | SEEN_X; |
| 1230 | update_on_xread(ctx); | ||
| 1231 | emit_jit_reg_move(r_A, r_X, ctx); | 1253 | emit_jit_reg_move(r_A, r_X, ctx); |
| 1232 | break; | 1254 | break; |
| 1233 | /* AUX */ | 1255 | /* AUX */ |
| 1234 | case BPF_S_ANC_PROTOCOL: | 1256 | case BPF_ANC | SKF_AD_PROTOCOL: |
| 1235 | /* A = ntohs(skb->protocol */ | 1257 | /* A = ntohs(skb->protocol */ |
| 1236 | ctx->flags |= SEEN_SKB | SEEN_OFF | SEEN_A; | 1258 | ctx->flags |= SEEN_SKB | SEEN_OFF | SEEN_A; |
| 1237 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 1259 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
| @@ -1256,7 +1278,7 @@ jmp_cmp: | |||
| 1256 | } | 1278 | } |
| 1257 | #endif | 1279 | #endif |
| 1258 | break; | 1280 | break; |
| 1259 | case BPF_S_ANC_CPU: | 1281 | case BPF_ANC | SKF_AD_CPU: |
| 1260 | ctx->flags |= SEEN_A | SEEN_OFF; | 1282 | ctx->flags |= SEEN_A | SEEN_OFF; |
| 1261 | /* A = current_thread_info()->cpu */ | 1283 | /* A = current_thread_info()->cpu */ |
| 1262 | BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info, | 1284 | BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info, |
| @@ -1265,11 +1287,12 @@ jmp_cmp: | |||
| 1265 | /* $28/gp points to the thread_info struct */ | 1287 | /* $28/gp points to the thread_info struct */ |
| 1266 | emit_load(r_A, 28, off, ctx); | 1288 | emit_load(r_A, 28, off, ctx); |
| 1267 | break; | 1289 | break; |
| 1268 | case BPF_S_ANC_IFINDEX: | 1290 | case BPF_ANC | SKF_AD_IFINDEX: |
| 1269 | /* A = skb->dev->ifindex */ | 1291 | /* A = skb->dev->ifindex */ |
| 1270 | ctx->flags |= SEEN_SKB | SEEN_A | SEEN_S0; | 1292 | ctx->flags |= SEEN_SKB | SEEN_A | SEEN_S0; |
| 1271 | off = offsetof(struct sk_buff, dev); | 1293 | off = offsetof(struct sk_buff, dev); |
| 1272 | emit_load(r_s0, r_skb, off, ctx); | 1294 | /* Load *dev pointer */ |
| 1295 | emit_load_ptr(r_s0, r_skb, off, ctx); | ||
| 1273 | /* error (0) in the delay slot */ | 1296 | /* error (0) in the delay slot */ |
| 1274 | emit_bcond(MIPS_COND_EQ, r_s0, r_zero, | 1297 | emit_bcond(MIPS_COND_EQ, r_s0, r_zero, |
| 1275 | b_imm(prog->len, ctx), ctx); | 1298 | b_imm(prog->len, ctx), ctx); |
| @@ -1279,31 +1302,36 @@ jmp_cmp: | |||
| 1279 | off = offsetof(struct net_device, ifindex); | 1302 | off = offsetof(struct net_device, ifindex); |
| 1280 | emit_load(r_A, r_s0, off, ctx); | 1303 | emit_load(r_A, r_s0, off, ctx); |
| 1281 | break; | 1304 | break; |
| 1282 | case BPF_S_ANC_MARK: | 1305 | case BPF_ANC | SKF_AD_MARK: |
| 1283 | ctx->flags |= SEEN_SKB | SEEN_A; | 1306 | ctx->flags |= SEEN_SKB | SEEN_A; |
| 1284 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4); | 1307 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4); |
| 1285 | off = offsetof(struct sk_buff, mark); | 1308 | off = offsetof(struct sk_buff, mark); |
| 1286 | emit_load(r_A, r_skb, off, ctx); | 1309 | emit_load(r_A, r_skb, off, ctx); |
| 1287 | break; | 1310 | break; |
| 1288 | case BPF_S_ANC_RXHASH: | 1311 | case BPF_ANC | SKF_AD_RXHASH: |
| 1289 | ctx->flags |= SEEN_SKB | SEEN_A; | 1312 | ctx->flags |= SEEN_SKB | SEEN_A; |
| 1290 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4); | 1313 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4); |
| 1291 | off = offsetof(struct sk_buff, hash); | 1314 | off = offsetof(struct sk_buff, hash); |
| 1292 | emit_load(r_A, r_skb, off, ctx); | 1315 | emit_load(r_A, r_skb, off, ctx); |
| 1293 | break; | 1316 | break; |
| 1294 | case BPF_S_ANC_VLAN_TAG: | 1317 | case BPF_ANC | SKF_AD_VLAN_TAG: |
| 1295 | case BPF_S_ANC_VLAN_TAG_PRESENT: | 1318 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: |
| 1296 | ctx->flags |= SEEN_SKB | SEEN_S0 | SEEN_A; | 1319 | ctx->flags |= SEEN_SKB | SEEN_S0 | SEEN_A; |
| 1297 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 1320 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
| 1298 | vlan_tci) != 2); | 1321 | vlan_tci) != 2); |
| 1299 | off = offsetof(struct sk_buff, vlan_tci); | 1322 | off = offsetof(struct sk_buff, vlan_tci); |
| 1300 | emit_half_load(r_s0, r_skb, off, ctx); | 1323 | emit_half_load(r_s0, r_skb, off, ctx); |
| 1301 | if (inst->code == BPF_S_ANC_VLAN_TAG) | 1324 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { |
| 1302 | emit_and(r_A, r_s0, VLAN_VID_MASK, ctx); | 1325 | emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx); |
| 1303 | else | 1326 | } else { |
| 1304 | emit_and(r_A, r_s0, VLAN_TAG_PRESENT, ctx); | 1327 | emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx); |
| 1328 | /* return 1 if present */ | ||
| 1329 | emit_sltu(r_A, r_zero, r_A, ctx); | ||
| 1330 | } | ||
| 1305 | break; | 1331 | break; |
| 1306 | case BPF_S_ANC_PKTTYPE: | 1332 | case BPF_ANC | SKF_AD_PKTTYPE: |
| 1333 | ctx->flags |= SEEN_SKB; | ||
| 1334 | |||
| 1307 | off = pkt_type_offset(); | 1335 | off = pkt_type_offset(); |
| 1308 | 1336 | ||
| 1309 | if (off < 0) | 1337 | if (off < 0) |
| @@ -1311,8 +1339,12 @@ jmp_cmp: | |||
| 1311 | emit_load_byte(r_tmp, r_skb, off, ctx); | 1339 | emit_load_byte(r_tmp, r_skb, off, ctx); |
| 1312 | /* Keep only the last 3 bits */ | 1340 | /* Keep only the last 3 bits */ |
| 1313 | emit_andi(r_A, r_tmp, PKT_TYPE_MAX, ctx); | 1341 | emit_andi(r_A, r_tmp, PKT_TYPE_MAX, ctx); |
| 1342 | #ifdef __BIG_ENDIAN_BITFIELD | ||
| 1343 | /* Get the actual packet type to the lower 3 bits */ | ||
| 1344 | emit_srl(r_A, r_A, 5, ctx); | ||
| 1345 | #endif | ||
| 1314 | break; | 1346 | break; |
| 1315 | case BPF_S_ANC_QUEUE: | 1347 | case BPF_ANC | SKF_AD_QUEUE: |
| 1316 | ctx->flags |= SEEN_SKB | SEEN_A; | 1348 | ctx->flags |= SEEN_SKB | SEEN_A; |
| 1317 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 1349 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
| 1318 | queue_mapping) != 2); | 1350 | queue_mapping) != 2); |
| @@ -1322,8 +1354,8 @@ jmp_cmp: | |||
| 1322 | emit_half_load(r_A, r_skb, off, ctx); | 1354 | emit_half_load(r_A, r_skb, off, ctx); |
| 1323 | break; | 1355 | break; |
| 1324 | default: | 1356 | default: |
| 1325 | pr_warn("%s: Unhandled opcode: 0x%02x\n", __FILE__, | 1357 | pr_debug("%s: Unhandled opcode: 0x%02x\n", __FILE__, |
| 1326 | inst->code); | 1358 | inst->code); |
| 1327 | return -1; | 1359 | return -1; |
| 1328 | } | 1360 | } |
| 1329 | } | 1361 | } |
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index 790352f93700..35d16bd2760b 100644 --- a/arch/powerpc/Kconfig.debug +++ b/arch/powerpc/Kconfig.debug | |||
| @@ -303,7 +303,6 @@ config PPC_EARLY_DEBUG_OPAL_VTERMNO | |||
| 303 | This correspond to which /dev/hvcN you want to use for early | 303 | This correspond to which /dev/hvcN you want to use for early |
| 304 | debug. | 304 | debug. |
| 305 | 305 | ||
| 306 | On OPAL v1 (takeover) this should always be 0 | ||
| 307 | On OPAL v2, this will be 0 for network console and 1 or 2 for | 306 | On OPAL v2, this will be 0 for network console and 1 or 2 for |
| 308 | the machine built-in serial ports. | 307 | the machine built-in serial ports. |
| 309 | 308 | ||
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h index 37991e154ef8..840a5509b3f1 100644 --- a/arch/powerpc/include/asm/code-patching.h +++ b/arch/powerpc/include/asm/code-patching.h | |||
| @@ -88,4 +88,15 @@ static inline unsigned long ppc_function_entry(void *func) | |||
| 88 | #endif | 88 | #endif |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | static inline unsigned long ppc_global_function_entry(void *func) | ||
| 92 | { | ||
| 93 | #if defined(CONFIG_PPC64) && defined(_CALL_ELF) && _CALL_ELF == 2 | ||
| 94 | /* PPC64 ABIv2 the global entry point is at the address */ | ||
| 95 | return (unsigned long)func; | ||
| 96 | #else | ||
| 97 | /* All other cases there is no change vs ppc_function_entry() */ | ||
| 98 | return ppc_function_entry(func); | ||
| 99 | #endif | ||
| 100 | } | ||
| 101 | |||
| 91 | #endif /* _ASM_POWERPC_CODE_PATCHING_H */ | 102 | #endif /* _ASM_POWERPC_CODE_PATCHING_H */ |
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 460018889ba9..0da1dbd42e02 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
| @@ -12,27 +12,7 @@ | |||
| 12 | #ifndef __OPAL_H | 12 | #ifndef __OPAL_H |
| 13 | #define __OPAL_H | 13 | #define __OPAL_H |
| 14 | 14 | ||
| 15 | /****** Takeover interface ********/ | ||
| 16 | |||
| 17 | /* PAPR H-Call used to querty the HAL existence and/or instanciate | ||
| 18 | * it from within pHyp (tech preview only). | ||
| 19 | * | ||
| 20 | * This is exclusively used in prom_init.c | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |
| 24 | |||
| 25 | struct opal_takeover_args { | ||
| 26 | u64 k_image; /* r4 */ | ||
| 27 | u64 k_size; /* r5 */ | ||
| 28 | u64 k_entry; /* r6 */ | ||
| 29 | u64 k_entry2; /* r7 */ | ||
| 30 | u64 hal_addr; /* r8 */ | ||
| 31 | u64 rd_image; /* r9 */ | ||
| 32 | u64 rd_size; /* r10 */ | ||
| 33 | u64 rd_loc; /* r11 */ | ||
| 34 | }; | ||
| 35 | |||
| 36 | /* | 16 | /* |
| 37 | * SG entry | 17 | * SG entry |
| 38 | * | 18 | * |
| @@ -55,15 +35,6 @@ struct opal_sg_list { | |||
| 55 | /* We calculate number of sg entries based on PAGE_SIZE */ | 35 | /* We calculate number of sg entries based on PAGE_SIZE */ |
| 56 | #define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry)) | 36 | #define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry)) |
| 57 | 37 | ||
| 58 | extern long opal_query_takeover(u64 *hal_size, u64 *hal_align); | ||
| 59 | |||
| 60 | extern long opal_do_takeover(struct opal_takeover_args *args); | ||
| 61 | |||
| 62 | struct rtas_args; | ||
| 63 | extern int opal_enter_rtas(struct rtas_args *args, | ||
| 64 | unsigned long data, | ||
| 65 | unsigned long entry); | ||
| 66 | |||
| 67 | #endif /* __ASSEMBLY__ */ | 38 | #endif /* __ASSEMBLY__ */ |
| 68 | 39 | ||
| 69 | /****** OPAL APIs ******/ | 40 | /****** OPAL APIs ******/ |
diff --git a/arch/powerpc/include/asm/swab.h b/arch/powerpc/include/asm/swab.h index b9bd1ca944d0..96f59de61855 100644 --- a/arch/powerpc/include/asm/swab.h +++ b/arch/powerpc/include/asm/swab.h | |||
| @@ -9,10 +9,6 @@ | |||
| 9 | 9 | ||
| 10 | #include <uapi/asm/swab.h> | 10 | #include <uapi/asm/swab.h> |
| 11 | 11 | ||
| 12 | #ifdef __GNUC__ | ||
| 13 | #ifndef __powerpc64__ | ||
| 14 | #endif /* __powerpc64__ */ | ||
| 15 | |||
| 16 | static __inline__ __u16 ld_le16(const volatile __u16 *addr) | 12 | static __inline__ __u16 ld_le16(const volatile __u16 *addr) |
| 17 | { | 13 | { |
| 18 | __u16 val; | 14 | __u16 val; |
| @@ -20,19 +16,12 @@ static __inline__ __u16 ld_le16(const volatile __u16 *addr) | |||
| 20 | __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); | 16 | __asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); |
| 21 | return val; | 17 | return val; |
| 22 | } | 18 | } |
| 23 | #define __arch_swab16p ld_le16 | ||
| 24 | 19 | ||
| 25 | static __inline__ void st_le16(volatile __u16 *addr, const __u16 val) | 20 | static __inline__ void st_le16(volatile __u16 *addr, const __u16 val) |
| 26 | { | 21 | { |
| 27 | __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); | 22 | __asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); |
| 28 | } | 23 | } |
| 29 | 24 | ||
| 30 | static inline void __arch_swab16s(__u16 *addr) | ||
| 31 | { | ||
| 32 | st_le16(addr, *addr); | ||
| 33 | } | ||
| 34 | #define __arch_swab16s __arch_swab16s | ||
| 35 | |||
| 36 | static __inline__ __u32 ld_le32(const volatile __u32 *addr) | 25 | static __inline__ __u32 ld_le32(const volatile __u32 *addr) |
| 37 | { | 26 | { |
| 38 | __u32 val; | 27 | __u32 val; |
| @@ -40,42 +29,10 @@ static __inline__ __u32 ld_le32(const volatile __u32 *addr) | |||
| 40 | __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); | 29 | __asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr)); |
| 41 | return val; | 30 | return val; |
| 42 | } | 31 | } |
| 43 | #define __arch_swab32p ld_le32 | ||
| 44 | 32 | ||
| 45 | static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) | 33 | static __inline__ void st_le32(volatile __u32 *addr, const __u32 val) |
| 46 | { | 34 | { |
| 47 | __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); | 35 | __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr)); |
| 48 | } | 36 | } |
| 49 | 37 | ||
| 50 | static inline void __arch_swab32s(__u32 *addr) | ||
| 51 | { | ||
| 52 | st_le32(addr, *addr); | ||
| 53 | } | ||
| 54 | #define __arch_swab32s __arch_swab32s | ||
| 55 | |||
| 56 | static inline __attribute_const__ __u16 __arch_swab16(__u16 value) | ||
| 57 | { | ||
| 58 | __u16 result; | ||
| 59 | |||
| 60 | __asm__("rlwimi %0,%1,8,16,23" | ||
| 61 | : "=r" (result) | ||
| 62 | : "r" (value), "0" (value >> 8)); | ||
| 63 | return result; | ||
| 64 | } | ||
| 65 | #define __arch_swab16 __arch_swab16 | ||
| 66 | |||
| 67 | static inline __attribute_const__ __u32 __arch_swab32(__u32 value) | ||
| 68 | { | ||
| 69 | __u32 result; | ||
| 70 | |||
| 71 | __asm__("rlwimi %0,%1,24,16,23\n\t" | ||
| 72 | "rlwimi %0,%1,8,8,15\n\t" | ||
| 73 | "rlwimi %0,%1,24,0,7" | ||
| 74 | : "=r" (result) | ||
| 75 | : "r" (value), "0" (value >> 24)); | ||
| 76 | return result; | ||
| 77 | } | ||
| 78 | #define __arch_swab32 __arch_swab32 | ||
| 79 | |||
| 80 | #endif /* __GNUC__ */ | ||
| 81 | #endif /* _ASM_POWERPC_SWAB_H */ | 38 | #endif /* _ASM_POWERPC_SWAB_H */ |
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index f202d0731b06..d178834fe508 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | * | 10 | * |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #define pr_fmt(fmt) "ftrace-powerpc: " fmt | ||
| 14 | |||
| 13 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| 14 | #include <linux/hardirq.h> | 16 | #include <linux/hardirq.h> |
| 15 | #include <linux/uaccess.h> | 17 | #include <linux/uaccess.h> |
| @@ -105,7 +107,7 @@ __ftrace_make_nop(struct module *mod, | |||
| 105 | struct dyn_ftrace *rec, unsigned long addr) | 107 | struct dyn_ftrace *rec, unsigned long addr) |
| 106 | { | 108 | { |
| 107 | unsigned int op; | 109 | unsigned int op; |
| 108 | unsigned long ptr; | 110 | unsigned long entry, ptr; |
| 109 | unsigned long ip = rec->ip; | 111 | unsigned long ip = rec->ip; |
| 110 | void *tramp; | 112 | void *tramp; |
| 111 | 113 | ||
| @@ -115,7 +117,7 @@ __ftrace_make_nop(struct module *mod, | |||
| 115 | 117 | ||
| 116 | /* Make sure that that this is still a 24bit jump */ | 118 | /* Make sure that that this is still a 24bit jump */ |
| 117 | if (!is_bl_op(op)) { | 119 | if (!is_bl_op(op)) { |
| 118 | printk(KERN_ERR "Not expected bl: opcode is %x\n", op); | 120 | pr_err("Not expected bl: opcode is %x\n", op); |
| 119 | return -EINVAL; | 121 | return -EINVAL; |
| 120 | } | 122 | } |
| 121 | 123 | ||
| @@ -125,21 +127,21 @@ __ftrace_make_nop(struct module *mod, | |||
| 125 | pr_devel("ip:%lx jumps to %p", ip, tramp); | 127 | pr_devel("ip:%lx jumps to %p", ip, tramp); |
| 126 | 128 | ||
| 127 | if (!is_module_trampoline(tramp)) { | 129 | if (!is_module_trampoline(tramp)) { |
| 128 | printk(KERN_ERR "Not a trampoline\n"); | 130 | pr_err("Not a trampoline\n"); |
| 129 | return -EINVAL; | 131 | return -EINVAL; |
| 130 | } | 132 | } |
| 131 | 133 | ||
| 132 | if (module_trampoline_target(mod, tramp, &ptr)) { | 134 | if (module_trampoline_target(mod, tramp, &ptr)) { |
| 133 | printk(KERN_ERR "Failed to get trampoline target\n"); | 135 | pr_err("Failed to get trampoline target\n"); |
| 134 | return -EFAULT; | 136 | return -EFAULT; |
| 135 | } | 137 | } |
| 136 | 138 | ||
| 137 | pr_devel("trampoline target %lx", ptr); | 139 | pr_devel("trampoline target %lx", ptr); |
| 138 | 140 | ||
| 141 | entry = ppc_global_function_entry((void *)addr); | ||
| 139 | /* This should match what was called */ | 142 | /* This should match what was called */ |
| 140 | if (ptr != ppc_function_entry((void *)addr)) { | 143 | if (ptr != entry) { |
| 141 | printk(KERN_ERR "addr %lx does not match expected %lx\n", | 144 | pr_err("addr %lx does not match expected %lx\n", ptr, entry); |
| 142 | ptr, ppc_function_entry((void *)addr)); | ||
| 143 | return -EINVAL; | 145 | return -EINVAL; |
| 144 | } | 146 | } |
| 145 | 147 | ||
| @@ -179,7 +181,7 @@ __ftrace_make_nop(struct module *mod, | |||
| 179 | 181 | ||
| 180 | /* Make sure that that this is still a 24bit jump */ | 182 | /* Make sure that that this is still a 24bit jump */ |
| 181 | if (!is_bl_op(op)) { | 183 | if (!is_bl_op(op)) { |
| 182 | printk(KERN_ERR "Not expected bl: opcode is %x\n", op); | 184 | pr_err("Not expected bl: opcode is %x\n", op); |
| 183 | return -EINVAL; | 185 | return -EINVAL; |
| 184 | } | 186 | } |
| 185 | 187 | ||
| @@ -198,7 +200,7 @@ __ftrace_make_nop(struct module *mod, | |||
| 198 | 200 | ||
| 199 | /* Find where the trampoline jumps to */ | 201 | /* Find where the trampoline jumps to */ |
| 200 | if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) { | 202 | if (probe_kernel_read(jmp, (void *)tramp, sizeof(jmp))) { |
| 201 | printk(KERN_ERR "Failed to read %lx\n", tramp); | 203 | pr_err("Failed to read %lx\n", tramp); |
| 202 | return -EFAULT; | 204 | return -EFAULT; |
| 203 | } | 205 | } |
| 204 | 206 | ||
| @@ -209,7 +211,7 @@ __ftrace_make_nop(struct module *mod, | |||
| 209 | ((jmp[1] & 0xffff0000) != 0x398c0000) || | 211 | ((jmp[1] & 0xffff0000) != 0x398c0000) || |
| 210 | (jmp[2] != 0x7d8903a6) || | 212 | (jmp[2] != 0x7d8903a6) || |
| 211 | (jmp[3] != 0x4e800420)) { | 213 | (jmp[3] != 0x4e800420)) { |
| 212 | printk(KERN_ERR "Not a trampoline\n"); | 214 | pr_err("Not a trampoline\n"); |
| 213 | return -EINVAL; | 215 | return -EINVAL; |
| 214 | } | 216 | } |
| 215 | 217 | ||
| @@ -221,8 +223,7 @@ __ftrace_make_nop(struct module *mod, | |||
| 221 | pr_devel(" %lx ", tramp); | 223 | pr_devel(" %lx ", tramp); |
| 222 | 224 | ||
| 223 | if (tramp != addr) { | 225 | if (tramp != addr) { |
| 224 | printk(KERN_ERR | 226 | pr_err("Trampoline location %08lx does not match addr\n", |
| 225 | "Trampoline location %08lx does not match addr\n", | ||
| 226 | tramp); | 227 | tramp); |
| 227 | return -EINVAL; | 228 | return -EINVAL; |
| 228 | } | 229 | } |
| @@ -263,15 +264,13 @@ int ftrace_make_nop(struct module *mod, | |||
| 263 | */ | 264 | */ |
| 264 | if (!rec->arch.mod) { | 265 | if (!rec->arch.mod) { |
| 265 | if (!mod) { | 266 | if (!mod) { |
| 266 | printk(KERN_ERR "No module loaded addr=%lx\n", | 267 | pr_err("No module loaded addr=%lx\n", addr); |
| 267 | addr); | ||
| 268 | return -EFAULT; | 268 | return -EFAULT; |
| 269 | } | 269 | } |
| 270 | rec->arch.mod = mod; | 270 | rec->arch.mod = mod; |
| 271 | } else if (mod) { | 271 | } else if (mod) { |
| 272 | if (mod != rec->arch.mod) { | 272 | if (mod != rec->arch.mod) { |
| 273 | printk(KERN_ERR | 273 | pr_err("Record mod %p not equal to passed in mod %p\n", |
| 274 | "Record mod %p not equal to passed in mod %p\n", | ||
| 275 | rec->arch.mod, mod); | 274 | rec->arch.mod, mod); |
| 276 | return -EINVAL; | 275 | return -EINVAL; |
| 277 | } | 276 | } |
| @@ -307,26 +306,25 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 307 | * The load offset is different depending on the ABI. For simplicity | 306 | * The load offset is different depending on the ABI. For simplicity |
| 308 | * just mask it out when doing the compare. | 307 | * just mask it out when doing the compare. |
| 309 | */ | 308 | */ |
| 310 | if ((op[0] != 0x48000008) || ((op[1] & 0xffff00000) != 0xe8410000)) { | 309 | if ((op[0] != 0x48000008) || ((op[1] & 0xffff0000) != 0xe8410000)) { |
| 311 | printk(KERN_ERR "Unexpected call sequence: %x %x\n", | 310 | pr_err("Unexpected call sequence: %x %x\n", op[0], op[1]); |
| 312 | op[0], op[1]); | ||
| 313 | return -EINVAL; | 311 | return -EINVAL; |
| 314 | } | 312 | } |
| 315 | 313 | ||
| 316 | /* If we never set up a trampoline to ftrace_caller, then bail */ | 314 | /* If we never set up a trampoline to ftrace_caller, then bail */ |
| 317 | if (!rec->arch.mod->arch.tramp) { | 315 | if (!rec->arch.mod->arch.tramp) { |
| 318 | printk(KERN_ERR "No ftrace trampoline\n"); | 316 | pr_err("No ftrace trampoline\n"); |
| 319 | return -EINVAL; | 317 | return -EINVAL; |
| 320 | } | 318 | } |
| 321 | 319 | ||
| 322 | /* Ensure branch is within 24 bits */ | 320 | /* Ensure branch is within 24 bits */ |
| 323 | if (create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { | 321 | if (!create_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { |
| 324 | printk(KERN_ERR "Branch out of range"); | 322 | pr_err("Branch out of range\n"); |
| 325 | return -EINVAL; | 323 | return -EINVAL; |
| 326 | } | 324 | } |
| 327 | 325 | ||
| 328 | if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { | 326 | if (patch_branch(ip, rec->arch.mod->arch.tramp, BRANCH_SET_LINK)) { |
| 329 | printk(KERN_ERR "REL24 out of range!\n"); | 327 | pr_err("REL24 out of range!\n"); |
| 330 | return -EINVAL; | 328 | return -EINVAL; |
| 331 | } | 329 | } |
| 332 | 330 | ||
| @@ -345,13 +343,13 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 345 | 343 | ||
| 346 | /* It should be pointing to a nop */ | 344 | /* It should be pointing to a nop */ |
| 347 | if (op != PPC_INST_NOP) { | 345 | if (op != PPC_INST_NOP) { |
| 348 | printk(KERN_ERR "Expected NOP but have %x\n", op); | 346 | pr_err("Expected NOP but have %x\n", op); |
| 349 | return -EINVAL; | 347 | return -EINVAL; |
| 350 | } | 348 | } |
| 351 | 349 | ||
| 352 | /* If we never set up a trampoline to ftrace_caller, then bail */ | 350 | /* If we never set up a trampoline to ftrace_caller, then bail */ |
| 353 | if (!rec->arch.mod->arch.tramp) { | 351 | if (!rec->arch.mod->arch.tramp) { |
| 354 | printk(KERN_ERR "No ftrace trampoline\n"); | 352 | pr_err("No ftrace trampoline\n"); |
| 355 | return -EINVAL; | 353 | return -EINVAL; |
| 356 | } | 354 | } |
| 357 | 355 | ||
| @@ -359,7 +357,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 359 | op = create_branch((unsigned int *)ip, | 357 | op = create_branch((unsigned int *)ip, |
| 360 | rec->arch.mod->arch.tramp, BRANCH_SET_LINK); | 358 | rec->arch.mod->arch.tramp, BRANCH_SET_LINK); |
| 361 | if (!op) { | 359 | if (!op) { |
| 362 | printk(KERN_ERR "REL24 out of range!\n"); | 360 | pr_err("REL24 out of range!\n"); |
| 363 | return -EINVAL; | 361 | return -EINVAL; |
| 364 | } | 362 | } |
| 365 | 363 | ||
| @@ -397,7 +395,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 397 | * already have a module defined. | 395 | * already have a module defined. |
| 398 | */ | 396 | */ |
| 399 | if (!rec->arch.mod) { | 397 | if (!rec->arch.mod) { |
| 400 | printk(KERN_ERR "No module loaded\n"); | 398 | pr_err("No module loaded\n"); |
| 401 | return -EINVAL; | 399 | return -EINVAL; |
| 402 | } | 400 | } |
| 403 | 401 | ||
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c index b82227e7e21b..12e48d56f771 100644 --- a/arch/powerpc/kernel/iomap.c +++ b/arch/powerpc/kernel/iomap.c | |||
| @@ -23,7 +23,7 @@ unsigned int ioread16(void __iomem *addr) | |||
| 23 | } | 23 | } |
| 24 | unsigned int ioread16be(void __iomem *addr) | 24 | unsigned int ioread16be(void __iomem *addr) |
| 25 | { | 25 | { |
| 26 | return in_be16(addr); | 26 | return readw_be(addr); |
| 27 | } | 27 | } |
| 28 | unsigned int ioread32(void __iomem *addr) | 28 | unsigned int ioread32(void __iomem *addr) |
| 29 | { | 29 | { |
| @@ -31,7 +31,7 @@ unsigned int ioread32(void __iomem *addr) | |||
| 31 | } | 31 | } |
| 32 | unsigned int ioread32be(void __iomem *addr) | 32 | unsigned int ioread32be(void __iomem *addr) |
| 33 | { | 33 | { |
| 34 | return in_be32(addr); | 34 | return readl_be(addr); |
| 35 | } | 35 | } |
| 36 | EXPORT_SYMBOL(ioread8); | 36 | EXPORT_SYMBOL(ioread8); |
| 37 | EXPORT_SYMBOL(ioread16); | 37 | EXPORT_SYMBOL(ioread16); |
| @@ -49,7 +49,7 @@ void iowrite16(u16 val, void __iomem *addr) | |||
| 49 | } | 49 | } |
| 50 | void iowrite16be(u16 val, void __iomem *addr) | 50 | void iowrite16be(u16 val, void __iomem *addr) |
| 51 | { | 51 | { |
| 52 | out_be16(addr, val); | 52 | writew_be(val, addr); |
| 53 | } | 53 | } |
| 54 | void iowrite32(u32 val, void __iomem *addr) | 54 | void iowrite32(u32 val, void __iomem *addr) |
| 55 | { | 55 | { |
| @@ -57,7 +57,7 @@ void iowrite32(u32 val, void __iomem *addr) | |||
| 57 | } | 57 | } |
| 58 | void iowrite32be(u32 val, void __iomem *addr) | 58 | void iowrite32be(u32 val, void __iomem *addr) |
| 59 | { | 59 | { |
| 60 | out_be32(addr, val); | 60 | writel_be(val, addr); |
| 61 | } | 61 | } |
| 62 | EXPORT_SYMBOL(iowrite8); | 62 | EXPORT_SYMBOL(iowrite8); |
| 63 | EXPORT_SYMBOL(iowrite16); | 63 | EXPORT_SYMBOL(iowrite16); |
| @@ -75,15 +75,15 @@ EXPORT_SYMBOL(iowrite32be); | |||
| 75 | */ | 75 | */ |
| 76 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) | 76 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) |
| 77 | { | 77 | { |
| 78 | _insb((u8 __iomem *) addr, dst, count); | 78 | readsb(addr, dst, count); |
| 79 | } | 79 | } |
| 80 | void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) | 80 | void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) |
| 81 | { | 81 | { |
| 82 | _insw_ns((u16 __iomem *) addr, dst, count); | 82 | readsw(addr, dst, count); |
| 83 | } | 83 | } |
| 84 | void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) | 84 | void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) |
| 85 | { | 85 | { |
| 86 | _insl_ns((u32 __iomem *) addr, dst, count); | 86 | readsl(addr, dst, count); |
| 87 | } | 87 | } |
| 88 | EXPORT_SYMBOL(ioread8_rep); | 88 | EXPORT_SYMBOL(ioread8_rep); |
| 89 | EXPORT_SYMBOL(ioread16_rep); | 89 | EXPORT_SYMBOL(ioread16_rep); |
| @@ -91,15 +91,15 @@ EXPORT_SYMBOL(ioread32_rep); | |||
| 91 | 91 | ||
| 92 | void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) | 92 | void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) |
| 93 | { | 93 | { |
| 94 | _outsb((u8 __iomem *) addr, src, count); | 94 | writesb(addr, src, count); |
| 95 | } | 95 | } |
| 96 | void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) | 96 | void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) |
| 97 | { | 97 | { |
| 98 | _outsw_ns((u16 __iomem *) addr, src, count); | 98 | writesw(addr, src, count); |
| 99 | } | 99 | } |
| 100 | void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) | 100 | void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) |
| 101 | { | 101 | { |
| 102 | _outsl_ns((u32 __iomem *) addr, src, count); | 102 | writesl(addr, src, count); |
| 103 | } | 103 | } |
| 104 | EXPORT_SYMBOL(iowrite8_rep); | 104 | EXPORT_SYMBOL(iowrite8_rep); |
| 105 | EXPORT_SYMBOL(iowrite16_rep); | 105 | EXPORT_SYMBOL(iowrite16_rep); |
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 90fab64d911d..2f72af82513c 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
| 33 | #include <linux/kdebug.h> | 33 | #include <linux/kdebug.h> |
| 34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
| 35 | #include <asm/code-patching.h> | ||
| 35 | #include <asm/cacheflush.h> | 36 | #include <asm/cacheflush.h> |
| 36 | #include <asm/sstep.h> | 37 | #include <asm/sstep.h> |
| 37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
| @@ -491,12 +492,10 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | |||
| 491 | return ret; | 492 | return ret; |
| 492 | } | 493 | } |
| 493 | 494 | ||
| 494 | #ifdef CONFIG_PPC64 | ||
| 495 | unsigned long arch_deref_entry_point(void *entry) | 495 | unsigned long arch_deref_entry_point(void *entry) |
| 496 | { | 496 | { |
| 497 | return ((func_descr_t *)entry)->entry; | 497 | return ppc_global_function_entry(entry); |
| 498 | } | 498 | } |
| 499 | #endif | ||
| 500 | 499 | ||
| 501 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | 500 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) |
| 502 | { | 501 | { |
| @@ -508,8 +507,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
| 508 | /* setup return addr to the jprobe handler routine */ | 507 | /* setup return addr to the jprobe handler routine */ |
| 509 | regs->nip = arch_deref_entry_point(jp->entry); | 508 | regs->nip = arch_deref_entry_point(jp->entry); |
| 510 | #ifdef CONFIG_PPC64 | 509 | #ifdef CONFIG_PPC64 |
| 510 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
| 511 | regs->gpr[12] = (unsigned long)jp->entry; | ||
| 512 | #else | ||
| 511 | regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); | 513 | regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); |
| 512 | #endif | 514 | #endif |
| 515 | #endif | ||
| 513 | 516 | ||
| 514 | return 1; | 517 | return 1; |
| 515 | } | 518 | } |
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index 077d2ce6c5a7..d807ee626af9 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c | |||
| @@ -315,8 +315,17 @@ static void dedotify_versions(struct modversion_info *vers, | |||
| 315 | struct modversion_info *end; | 315 | struct modversion_info *end; |
| 316 | 316 | ||
| 317 | for (end = (void *)vers + size; vers < end; vers++) | 317 | for (end = (void *)vers + size; vers < end; vers++) |
| 318 | if (vers->name[0] == '.') | 318 | if (vers->name[0] == '.') { |
| 319 | memmove(vers->name, vers->name+1, strlen(vers->name)); | 319 | memmove(vers->name, vers->name+1, strlen(vers->name)); |
| 320 | #ifdef ARCH_RELOCATES_KCRCTAB | ||
| 321 | /* The TOC symbol has no CRC computed. To avoid CRC | ||
| 322 | * check failing, we must force it to the expected | ||
| 323 | * value (see CRC check in module.c). | ||
| 324 | */ | ||
| 325 | if (!strcmp(vers->name, "TOC.")) | ||
| 326 | vers->crc = -(unsigned long)reloc_start; | ||
| 327 | #endif | ||
| 328 | } | ||
| 320 | } | 329 | } |
| 321 | 330 | ||
| 322 | /* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */ | 331 | /* Undefined symbols which refer to .funcname, hack to funcname (or .TOC.) */ |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 613a860a203c..b694b0730971 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
| @@ -662,13 +662,6 @@ void __init early_init_devtree(void *params) | |||
| 662 | of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL); | 662 | of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL); |
| 663 | #endif | 663 | #endif |
| 664 | 664 | ||
| 665 | /* Pre-initialize the cmd_line with the content of boot_commmand_line, | ||
| 666 | * which will be empty except when the content of the variable has | ||
| 667 | * been overriden by a bootloading mechanism. This happens typically | ||
| 668 | * with HAL takeover | ||
| 669 | */ | ||
| 670 | strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE); | ||
| 671 | |||
| 672 | /* Retrieve various informations from the /chosen node of the | 665 | /* Retrieve various informations from the /chosen node of the |
| 673 | * device-tree, including the platform type, initrd location and | 666 | * device-tree, including the platform type, initrd location and |
| 674 | * size, TCE reserve, and more ... | 667 | * size, TCE reserve, and more ... |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 078145acf7fb..1a85d8f96739 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
| @@ -1268,201 +1268,6 @@ static u64 __initdata prom_opal_base; | |||
| 1268 | static u64 __initdata prom_opal_entry; | 1268 | static u64 __initdata prom_opal_entry; |
| 1269 | #endif | 1269 | #endif |
| 1270 | 1270 | ||
| 1271 | #ifdef __BIG_ENDIAN__ | ||
| 1272 | /* XXX Don't change this structure without updating opal-takeover.S */ | ||
| 1273 | static struct opal_secondary_data { | ||
| 1274 | s64 ack; /* 0 */ | ||
| 1275 | u64 go; /* 8 */ | ||
| 1276 | struct opal_takeover_args args; /* 16 */ | ||
| 1277 | } opal_secondary_data; | ||
| 1278 | |||
| 1279 | static u64 __initdata prom_opal_align; | ||
| 1280 | static u64 __initdata prom_opal_size; | ||
| 1281 | static int __initdata prom_rtas_start_cpu; | ||
| 1282 | static u64 __initdata prom_rtas_data; | ||
| 1283 | static u64 __initdata prom_rtas_entry; | ||
| 1284 | |||
| 1285 | extern char opal_secondary_entry; | ||
| 1286 | |||
| 1287 | static void __init prom_query_opal(void) | ||
| 1288 | { | ||
| 1289 | long rc; | ||
| 1290 | |||
| 1291 | /* We must not query for OPAL presence on a machine that | ||
| 1292 | * supports TNK takeover (970 blades), as this uses the same | ||
| 1293 | * h-call with different arguments and will crash | ||
| 1294 | */ | ||
| 1295 | if (PHANDLE_VALID(call_prom("finddevice", 1, 1, | ||
| 1296 | ADDR("/tnk-memory-map")))) { | ||
| 1297 | prom_printf("TNK takeover detected, skipping OPAL check\n"); | ||
| 1298 | return; | ||
| 1299 | } | ||
| 1300 | |||
| 1301 | prom_printf("Querying for OPAL presence... "); | ||
| 1302 | |||
| 1303 | rc = opal_query_takeover(&prom_opal_size, | ||
| 1304 | &prom_opal_align); | ||
| 1305 | prom_debug("(rc = %ld) ", rc); | ||
| 1306 | if (rc != 0) { | ||
| 1307 | prom_printf("not there.\n"); | ||
| 1308 | return; | ||
| 1309 | } | ||
| 1310 | of_platform = PLATFORM_OPAL; | ||
| 1311 | prom_printf(" there !\n"); | ||
| 1312 | prom_debug(" opal_size = 0x%lx\n", prom_opal_size); | ||
| 1313 | prom_debug(" opal_align = 0x%lx\n", prom_opal_align); | ||
| 1314 | if (prom_opal_align < 0x10000) | ||
| 1315 | prom_opal_align = 0x10000; | ||
| 1316 | } | ||
| 1317 | |||
| 1318 | static int __init prom_rtas_call(int token, int nargs, int nret, | ||
| 1319 | int *outputs, ...) | ||
| 1320 | { | ||
| 1321 | struct rtas_args rtas_args; | ||
| 1322 | va_list list; | ||
| 1323 | int i; | ||
| 1324 | |||
| 1325 | rtas_args.token = token; | ||
| 1326 | rtas_args.nargs = nargs; | ||
| 1327 | rtas_args.nret = nret; | ||
| 1328 | rtas_args.rets = (rtas_arg_t *)&(rtas_args.args[nargs]); | ||
| 1329 | va_start(list, outputs); | ||
| 1330 | for (i = 0; i < nargs; ++i) | ||
| 1331 | rtas_args.args[i] = va_arg(list, rtas_arg_t); | ||
| 1332 | va_end(list); | ||
| 1333 | |||
| 1334 | for (i = 0; i < nret; ++i) | ||
| 1335 | rtas_args.rets[i] = 0; | ||
| 1336 | |||
| 1337 | opal_enter_rtas(&rtas_args, prom_rtas_data, | ||
| 1338 | prom_rtas_entry); | ||
| 1339 | |||
| 1340 | if (nret > 1 && outputs != NULL) | ||
| 1341 | for (i = 0; i < nret-1; ++i) | ||
| 1342 | outputs[i] = rtas_args.rets[i+1]; | ||
| 1343 | return (nret > 0)? rtas_args.rets[0]: 0; | ||
| 1344 | } | ||
| 1345 | |||
| 1346 | static void __init prom_opal_hold_cpus(void) | ||
| 1347 | { | ||
| 1348 | int i, cnt, cpu, rc; | ||
| 1349 | long j; | ||
| 1350 | phandle node; | ||
| 1351 | char type[64]; | ||
| 1352 | u32 servers[8]; | ||
| 1353 | void *entry = (unsigned long *)&opal_secondary_entry; | ||
| 1354 | struct opal_secondary_data *data = &opal_secondary_data; | ||
| 1355 | |||
| 1356 | prom_debug("prom_opal_hold_cpus: start...\n"); | ||
| 1357 | prom_debug(" - entry = 0x%x\n", entry); | ||
| 1358 | prom_debug(" - data = 0x%x\n", data); | ||
| 1359 | |||
| 1360 | data->ack = -1; | ||
| 1361 | data->go = 0; | ||
| 1362 | |||
| 1363 | /* look for cpus */ | ||
| 1364 | for (node = 0; prom_next_node(&node); ) { | ||
| 1365 | type[0] = 0; | ||
| 1366 | prom_getprop(node, "device_type", type, sizeof(type)); | ||
| 1367 | if (strcmp(type, "cpu") != 0) | ||
| 1368 | continue; | ||
| 1369 | |||
| 1370 | /* Skip non-configured cpus. */ | ||
| 1371 | if (prom_getprop(node, "status", type, sizeof(type)) > 0) | ||
| 1372 | if (strcmp(type, "okay") != 0) | ||
| 1373 | continue; | ||
| 1374 | |||
| 1375 | cnt = prom_getprop(node, "ibm,ppc-interrupt-server#s", servers, | ||
| 1376 | sizeof(servers)); | ||
| 1377 | if (cnt == PROM_ERROR) | ||
| 1378 | break; | ||
| 1379 | cnt >>= 2; | ||
| 1380 | for (i = 0; i < cnt; i++) { | ||
| 1381 | cpu = servers[i]; | ||
| 1382 | prom_debug("CPU %d ... ", cpu); | ||
| 1383 | if (cpu == prom.cpu) { | ||
| 1384 | prom_debug("booted !\n"); | ||
| 1385 | continue; | ||
| 1386 | } | ||
| 1387 | prom_debug("starting ... "); | ||
| 1388 | |||
| 1389 | /* Init the acknowledge var which will be reset by | ||
| 1390 | * the secondary cpu when it awakens from its OF | ||
| 1391 | * spinloop. | ||
| 1392 | */ | ||
| 1393 | data->ack = -1; | ||
| 1394 | rc = prom_rtas_call(prom_rtas_start_cpu, 3, 1, | ||
| 1395 | NULL, cpu, entry, data); | ||
| 1396 | prom_debug("rtas rc=%d ...", rc); | ||
| 1397 | |||
| 1398 | for (j = 0; j < 100000000 && data->ack == -1; j++) { | ||
| 1399 | HMT_low(); | ||
| 1400 | mb(); | ||
| 1401 | } | ||
| 1402 | HMT_medium(); | ||
| 1403 | if (data->ack != -1) | ||
| 1404 | prom_debug("done, PIR=0x%x\n", data->ack); | ||
| 1405 | else | ||
| 1406 | prom_debug("timeout !\n"); | ||
| 1407 | } | ||
| 1408 | } | ||
| 1409 | prom_debug("prom_opal_hold_cpus: end...\n"); | ||
| 1410 | } | ||
| 1411 | |||
| 1412 | static void __init prom_opal_takeover(void) | ||
| 1413 | { | ||
| 1414 | struct opal_secondary_data *data = &opal_secondary_data; | ||
| 1415 | struct opal_takeover_args *args = &data->args; | ||
| 1416 | u64 align = prom_opal_align; | ||
| 1417 | u64 top_addr, opal_addr; | ||
| 1418 | |||
| 1419 | args->k_image = (u64)_stext; | ||
| 1420 | args->k_size = _end - _stext; | ||
| 1421 | args->k_entry = 0; | ||
| 1422 | args->k_entry2 = 0x60; | ||
| 1423 | |||
| 1424 | top_addr = _ALIGN_UP(args->k_size, align); | ||
| 1425 | |||
| 1426 | if (prom_initrd_start != 0) { | ||
| 1427 | args->rd_image = prom_initrd_start; | ||
| 1428 | args->rd_size = prom_initrd_end - args->rd_image; | ||
| 1429 | args->rd_loc = top_addr; | ||
| 1430 | top_addr = _ALIGN_UP(args->rd_loc + args->rd_size, align); | ||
| 1431 | } | ||
| 1432 | |||
| 1433 | /* Pickup an address for the HAL. We want to go really high | ||
| 1434 | * up to avoid problem with future kexecs. On the other hand | ||
| 1435 | * we don't want to be all over the TCEs on P5IOC2 machines | ||
| 1436 | * which are going to be up there too. We assume the machine | ||
| 1437 | * has plenty of memory, and we ask for the HAL for now to | ||
| 1438 | * be just below the 1G point, or above the initrd | ||
| 1439 | */ | ||
| 1440 | opal_addr = _ALIGN_DOWN(0x40000000 - prom_opal_size, align); | ||
| 1441 | if (opal_addr < top_addr) | ||
| 1442 | opal_addr = top_addr; | ||
| 1443 | args->hal_addr = opal_addr; | ||
| 1444 | |||
| 1445 | /* Copy the command line to the kernel image */ | ||
| 1446 | strlcpy(boot_command_line, prom_cmd_line, | ||
| 1447 | COMMAND_LINE_SIZE); | ||
| 1448 | |||
| 1449 | prom_debug(" k_image = 0x%lx\n", args->k_image); | ||
| 1450 | prom_debug(" k_size = 0x%lx\n", args->k_size); | ||
| 1451 | prom_debug(" k_entry = 0x%lx\n", args->k_entry); | ||
| 1452 | prom_debug(" k_entry2 = 0x%lx\n", args->k_entry2); | ||
| 1453 | prom_debug(" hal_addr = 0x%lx\n", args->hal_addr); | ||
| 1454 | prom_debug(" rd_image = 0x%lx\n", args->rd_image); | ||
| 1455 | prom_debug(" rd_size = 0x%lx\n", args->rd_size); | ||
| 1456 | prom_debug(" rd_loc = 0x%lx\n", args->rd_loc); | ||
| 1457 | prom_printf("Performing OPAL takeover,this can take a few minutes..\n"); | ||
| 1458 | prom_close_stdin(); | ||
| 1459 | mb(); | ||
| 1460 | data->go = 1; | ||
| 1461 | for (;;) | ||
| 1462 | opal_do_takeover(args); | ||
| 1463 | } | ||
| 1464 | #endif /* __BIG_ENDIAN__ */ | ||
| 1465 | |||
| 1466 | /* | 1271 | /* |
| 1467 | * Allocate room for and instantiate OPAL | 1272 | * Allocate room for and instantiate OPAL |
| 1468 | */ | 1273 | */ |
| @@ -1597,12 +1402,6 @@ static void __init prom_instantiate_rtas(void) | |||
| 1597 | &val, sizeof(val)) != PROM_ERROR) | 1402 | &val, sizeof(val)) != PROM_ERROR) |
| 1598 | rtas_has_query_cpu_stopped = true; | 1403 | rtas_has_query_cpu_stopped = true; |
| 1599 | 1404 | ||
| 1600 | #if defined(CONFIG_PPC_POWERNV) && defined(__BIG_ENDIAN__) | ||
| 1601 | /* PowerVN takeover hack */ | ||
| 1602 | prom_rtas_data = base; | ||
| 1603 | prom_rtas_entry = entry; | ||
| 1604 | prom_getprop(rtas_node, "start-cpu", &prom_rtas_start_cpu, 4); | ||
| 1605 | #endif | ||
| 1606 | prom_debug("rtas base = 0x%x\n", base); | 1405 | prom_debug("rtas base = 0x%x\n", base); |
| 1607 | prom_debug("rtas entry = 0x%x\n", entry); | 1406 | prom_debug("rtas entry = 0x%x\n", entry); |
| 1608 | prom_debug("rtas size = 0x%x\n", (long)size); | 1407 | prom_debug("rtas size = 0x%x\n", (long)size); |
| @@ -3027,16 +2826,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
| 3027 | prom_instantiate_rtas(); | 2826 | prom_instantiate_rtas(); |
| 3028 | 2827 | ||
| 3029 | #ifdef CONFIG_PPC_POWERNV | 2828 | #ifdef CONFIG_PPC_POWERNV |
| 3030 | #ifdef __BIG_ENDIAN__ | ||
| 3031 | /* Detect HAL and try instanciating it & doing takeover */ | ||
| 3032 | if (of_platform == PLATFORM_PSERIES_LPAR) { | ||
| 3033 | prom_query_opal(); | ||
| 3034 | if (of_platform == PLATFORM_OPAL) { | ||
| 3035 | prom_opal_hold_cpus(); | ||
| 3036 | prom_opal_takeover(); | ||
| 3037 | } | ||
| 3038 | } else | ||
| 3039 | #endif /* __BIG_ENDIAN__ */ | ||
| 3040 | if (of_platform == PLATFORM_OPAL) | 2829 | if (of_platform == PLATFORM_OPAL) |
| 3041 | prom_instantiate_opal(); | 2830 | prom_instantiate_opal(); |
| 3042 | #endif /* CONFIG_PPC_POWERNV */ | 2831 | #endif /* CONFIG_PPC_POWERNV */ |
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh index 77aa1e95e904..fe8e54b9ef7d 100644 --- a/arch/powerpc/kernel/prom_init_check.sh +++ b/arch/powerpc/kernel/prom_init_check.sh | |||
| @@ -21,9 +21,7 @@ _end enter_prom memcpy memset reloc_offset __secondary_hold | |||
| 21 | __secondary_hold_acknowledge __secondary_hold_spinloop __start | 21 | __secondary_hold_acknowledge __secondary_hold_spinloop __start |
| 22 | strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224 | 22 | strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224 |
| 23 | reloc_got2 kernstart_addr memstart_addr linux_banner _stext | 23 | reloc_got2 kernstart_addr memstart_addr linux_banner _stext |
| 24 | opal_query_takeover opal_do_takeover opal_enter_rtas opal_secondary_entry | 24 | __prom_init_toc_start __prom_init_toc_end btext_setup_display TOC." |
| 25 | boot_command_line __prom_init_toc_start __prom_init_toc_end | ||
| 26 | btext_setup_display TOC." | ||
| 27 | 25 | ||
| 28 | NM="$1" | 26 | NM="$1" |
| 29 | OBJ="$2" | 27 | OBJ="$2" |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index e239df3768ac..e5b022c55ccd 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
| @@ -469,9 +469,17 @@ void __init smp_setup_cpu_maps(void) | |||
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) { | 471 | for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) { |
| 472 | bool avail; | ||
| 473 | |||
| 472 | DBG(" thread %d -> cpu %d (hard id %d)\n", | 474 | DBG(" thread %d -> cpu %d (hard id %d)\n", |
| 473 | j, cpu, be32_to_cpu(intserv[j])); | 475 | j, cpu, be32_to_cpu(intserv[j])); |
| 474 | set_cpu_present(cpu, of_device_is_available(dn)); | 476 | |
| 477 | avail = of_device_is_available(dn); | ||
| 478 | if (!avail) | ||
| 479 | avail = !of_property_match_string(dn, | ||
| 480 | "enable-method", "spin-table"); | ||
| 481 | |||
| 482 | set_cpu_present(cpu, avail); | ||
| 475 | set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j])); | 483 | set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j])); |
| 476 | set_cpu_possible(cpu, true); | 484 | set_cpu_possible(cpu, true); |
| 477 | cpu++; | 485 | cpu++; |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 4e47db686b5d..1bc5a1755ed4 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
| @@ -54,7 +54,6 @@ | |||
| 54 | 54 | ||
| 55 | #include "signal.h" | 55 | #include "signal.h" |
| 56 | 56 | ||
| 57 | #undef DEBUG_SIG | ||
| 58 | 57 | ||
| 59 | #ifdef CONFIG_PPC64 | 58 | #ifdef CONFIG_PPC64 |
| 60 | #define sys_rt_sigreturn compat_sys_rt_sigreturn | 59 | #define sys_rt_sigreturn compat_sys_rt_sigreturn |
| @@ -1063,10 +1062,6 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka, | |||
| 1063 | return 1; | 1062 | return 1; |
| 1064 | 1063 | ||
| 1065 | badframe: | 1064 | badframe: |
| 1066 | #ifdef DEBUG_SIG | ||
| 1067 | printk("badframe in handle_rt_signal, regs=%p frame=%p newsp=%lx\n", | ||
| 1068 | regs, frame, newsp); | ||
| 1069 | #endif | ||
| 1070 | if (show_unhandled_signals) | 1065 | if (show_unhandled_signals) |
| 1071 | printk_ratelimited(KERN_INFO | 1066 | printk_ratelimited(KERN_INFO |
| 1072 | "%s[%d]: bad frame in handle_rt_signal32: " | 1067 | "%s[%d]: bad frame in handle_rt_signal32: " |
| @@ -1484,10 +1479,6 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka, | |||
| 1484 | return 1; | 1479 | return 1; |
| 1485 | 1480 | ||
| 1486 | badframe: | 1481 | badframe: |
| 1487 | #ifdef DEBUG_SIG | ||
| 1488 | printk("badframe in handle_signal, regs=%p frame=%p newsp=%lx\n", | ||
| 1489 | regs, frame, newsp); | ||
| 1490 | #endif | ||
| 1491 | if (show_unhandled_signals) | 1482 | if (show_unhandled_signals) |
| 1492 | printk_ratelimited(KERN_INFO | 1483 | printk_ratelimited(KERN_INFO |
| 1493 | "%s[%d]: bad frame in handle_signal32: " | 1484 | "%s[%d]: bad frame in handle_signal32: " |
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index d501dc4dc3e6..97c1e4b683fc 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | #include "signal.h" | 39 | #include "signal.h" |
| 40 | 40 | ||
| 41 | #define DEBUG_SIG 0 | ||
| 42 | 41 | ||
| 43 | #define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) | 42 | #define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) |
| 44 | #define FP_REGS_SIZE sizeof(elf_fpregset_t) | 43 | #define FP_REGS_SIZE sizeof(elf_fpregset_t) |
| @@ -700,10 +699,6 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5, | |||
| 700 | return 0; | 699 | return 0; |
| 701 | 700 | ||
| 702 | badframe: | 701 | badframe: |
| 703 | #if DEBUG_SIG | ||
| 704 | printk("badframe in sys_rt_sigreturn, regs=%p uc=%p &uc->uc_mcontext=%p\n", | ||
| 705 | regs, uc, &uc->uc_mcontext); | ||
| 706 | #endif | ||
| 707 | if (show_unhandled_signals) | 702 | if (show_unhandled_signals) |
| 708 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, | 703 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, |
| 709 | current->comm, current->pid, "rt_sigreturn", | 704 | current->comm, current->pid, "rt_sigreturn", |
| @@ -809,10 +804,6 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info, | |||
| 809 | return 1; | 804 | return 1; |
| 810 | 805 | ||
| 811 | badframe: | 806 | badframe: |
| 812 | #if DEBUG_SIG | ||
| 813 | printk("badframe in setup_rt_frame, regs=%p frame=%p newsp=%lx\n", | ||
| 814 | regs, frame, newsp); | ||
| 815 | #endif | ||
| 816 | if (show_unhandled_signals) | 807 | if (show_unhandled_signals) |
| 817 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, | 808 | printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, |
| 818 | current->comm, current->pid, "setup_rt_frame", | 809 | current->comm, current->pid, "setup_rt_frame", |
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c index 94560db788bf..2c15ff094483 100644 --- a/arch/powerpc/platforms/cell/cbe_thermal.c +++ b/arch/powerpc/platforms/cell/cbe_thermal.c | |||
| @@ -125,7 +125,7 @@ static ssize_t show_throttle(struct cbe_pmd_regs __iomem *pmd_regs, char *buf, i | |||
| 125 | static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char *buf, size_t size, int pos) | 125 | static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char *buf, size_t size, int pos) |
| 126 | { | 126 | { |
| 127 | u64 reg_value; | 127 | u64 reg_value; |
| 128 | int temp; | 128 | unsigned int temp; |
| 129 | u64 new_value; | 129 | u64 new_value; |
| 130 | int ret; | 130 | int ret; |
| 131 | 131 | ||
diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile index d55891f89a2c..4ad227d04c1a 100644 --- a/arch/powerpc/platforms/powernv/Makefile +++ b/arch/powerpc/platforms/powernv/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | obj-y += setup.o opal-takeover.o opal-wrappers.o opal.o opal-async.o | 1 | obj-y += setup.o opal-wrappers.o opal.o opal-async.o |
| 2 | obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o | 2 | obj-y += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o |
| 3 | obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o | 3 | obj-y += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o |
| 4 | obj-y += opal-msglog.o | 4 | obj-y += opal-msglog.o |
diff --git a/arch/powerpc/platforms/powernv/opal-takeover.S b/arch/powerpc/platforms/powernv/opal-takeover.S deleted file mode 100644 index 11a3169ee583..000000000000 --- a/arch/powerpc/platforms/powernv/opal-takeover.S +++ /dev/null | |||
| @@ -1,140 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * PowerNV OPAL takeover assembly code, for use by prom_init.c | ||
| 3 | * | ||
| 4 | * Copyright 2011 IBM Corp. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License | ||
| 8 | * as published by the Free Software Foundation; either version | ||
| 9 | * 2 of the License, or (at your option) any later version. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <asm/ppc_asm.h> | ||
| 13 | #include <asm/hvcall.h> | ||
| 14 | #include <asm/asm-offsets.h> | ||
| 15 | #include <asm/opal.h> | ||
| 16 | |||
| 17 | #define H_HAL_TAKEOVER 0x5124 | ||
| 18 | #define H_HAL_TAKEOVER_QUERY_MAGIC -1 | ||
| 19 | |||
| 20 | .text | ||
| 21 | _GLOBAL(opal_query_takeover) | ||
| 22 | mfcr r0 | ||
| 23 | stw r0,8(r1) | ||
| 24 | stdu r1,-STACKFRAMESIZE(r1) | ||
| 25 | std r3,STK_PARAM(R3)(r1) | ||
| 26 | std r4,STK_PARAM(R4)(r1) | ||
| 27 | li r3,H_HAL_TAKEOVER | ||
| 28 | li r4,H_HAL_TAKEOVER_QUERY_MAGIC | ||
| 29 | HVSC | ||
| 30 | addi r1,r1,STACKFRAMESIZE | ||
| 31 | ld r10,STK_PARAM(R3)(r1) | ||
| 32 | std r4,0(r10) | ||
| 33 | ld r10,STK_PARAM(R4)(r1) | ||
| 34 | std r5,0(r10) | ||
| 35 | lwz r0,8(r1) | ||
| 36 | mtcrf 0xff,r0 | ||
| 37 | blr | ||
| 38 | |||
| 39 | _GLOBAL(opal_do_takeover) | ||
| 40 | mfcr r0 | ||
| 41 | stw r0,8(r1) | ||
| 42 | mflr r0 | ||
| 43 | std r0,16(r1) | ||
| 44 | bl __opal_do_takeover | ||
| 45 | ld r0,16(r1) | ||
| 46 | mtlr r0 | ||
| 47 | lwz r0,8(r1) | ||
| 48 | mtcrf 0xff,r0 | ||
| 49 | blr | ||
| 50 | |||
| 51 | __opal_do_takeover: | ||
| 52 | ld r4,0(r3) | ||
| 53 | ld r5,0x8(r3) | ||
| 54 | ld r6,0x10(r3) | ||
| 55 | ld r7,0x18(r3) | ||
| 56 | ld r8,0x20(r3) | ||
| 57 | ld r9,0x28(r3) | ||
| 58 | ld r10,0x30(r3) | ||
| 59 | ld r11,0x38(r3) | ||
| 60 | li r3,H_HAL_TAKEOVER | ||
| 61 | HVSC | ||
| 62 | blr | ||
| 63 | |||
| 64 | .globl opal_secondary_entry | ||
| 65 | opal_secondary_entry: | ||
| 66 | mr r31,r3 | ||
| 67 | mfmsr r11 | ||
| 68 | li r12,(MSR_SF | MSR_ISF)@highest | ||
| 69 | sldi r12,r12,48 | ||
| 70 | or r11,r11,r12 | ||
| 71 | mtmsrd r11 | ||
| 72 | isync | ||
| 73 | mfspr r4,SPRN_PIR | ||
| 74 | std r4,0(r3) | ||
| 75 | 1: HMT_LOW | ||
| 76 | ld r4,8(r3) | ||
| 77 | cmpli cr0,r4,0 | ||
| 78 | beq 1b | ||
| 79 | HMT_MEDIUM | ||
| 80 | 1: addi r3,r31,16 | ||
| 81 | bl __opal_do_takeover | ||
| 82 | b 1b | ||
| 83 | |||
| 84 | _GLOBAL(opal_enter_rtas) | ||
| 85 | mflr r0 | ||
| 86 | std r0,16(r1) | ||
| 87 | stdu r1,-PROM_FRAME_SIZE(r1) /* Save SP and create stack space */ | ||
| 88 | |||
| 89 | /* Because PROM is running in 32b mode, it clobbers the high order half | ||
| 90 | * of all registers that it saves. We therefore save those registers | ||
| 91 | * PROM might touch to the stack. (r0, r3-r13 are caller saved) | ||
| 92 | */ | ||
| 93 | SAVE_GPR(2, r1) | ||
| 94 | SAVE_GPR(13, r1) | ||
| 95 | SAVE_8GPRS(14, r1) | ||
| 96 | SAVE_10GPRS(22, r1) | ||
| 97 | mfcr r10 | ||
| 98 | mfmsr r11 | ||
| 99 | std r10,_CCR(r1) | ||
| 100 | std r11,_MSR(r1) | ||
| 101 | |||
| 102 | /* Get the PROM entrypoint */ | ||
| 103 | mtlr r5 | ||
| 104 | |||
| 105 | /* Switch MSR to 32 bits mode | ||
| 106 | */ | ||
| 107 | li r12,1 | ||
| 108 | rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG) | ||
| 109 | andc r11,r11,r12 | ||
| 110 | li r12,1 | ||
| 111 | rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG) | ||
| 112 | andc r11,r11,r12 | ||
| 113 | mtmsrd r11 | ||
| 114 | isync | ||
| 115 | |||
| 116 | /* Enter RTAS here... */ | ||
| 117 | blrl | ||
| 118 | |||
| 119 | /* Just make sure that r1 top 32 bits didn't get | ||
| 120 | * corrupt by OF | ||
| 121 | */ | ||
| 122 | rldicl r1,r1,0,32 | ||
| 123 | |||
| 124 | /* Restore the MSR (back to 64 bits) */ | ||
| 125 | ld r0,_MSR(r1) | ||
| 126 | MTMSRD(r0) | ||
| 127 | isync | ||
| 128 | |||
| 129 | /* Restore other registers */ | ||
| 130 | REST_GPR(2, r1) | ||
| 131 | REST_GPR(13, r1) | ||
| 132 | REST_8GPRS(14, r1) | ||
| 133 | REST_10GPRS(22, r1) | ||
| 134 | ld r4,_CCR(r1) | ||
| 135 | mtcr r4 | ||
| 136 | |||
| 137 | addi r1,r1,PROM_FRAME_SIZE | ||
| 138 | ld r0,16(r1) | ||
| 139 | mtlr r0 | ||
| 140 | blr | ||
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index 62c47bb76517..9e5353ff6d1b 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
| @@ -476,6 +476,11 @@ void __init alloc_dart_table(void) | |||
| 476 | */ | 476 | */ |
| 477 | dart_tablebase = (unsigned long) | 477 | dart_tablebase = (unsigned long) |
| 478 | __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); | 478 | __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); |
| 479 | /* | ||
| 480 | * The DART space is later unmapped from the kernel linear mapping and | ||
| 481 | * accessing dart_tablebase during kmemleak scanning will fault. | ||
| 482 | */ | ||
| 483 | kmemleak_no_scan((void *)dart_tablebase); | ||
| 479 | 484 | ||
| 480 | printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); | 485 | printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); |
| 481 | } | 486 | } |
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild index 6a9a9eb645f5..736637363d31 100644 --- a/arch/s390/include/uapi/asm/Kbuild +++ b/arch/s390/include/uapi/asm/Kbuild | |||
| @@ -36,6 +36,7 @@ header-y += signal.h | |||
| 36 | header-y += socket.h | 36 | header-y += socket.h |
| 37 | header-y += sockios.h | 37 | header-y += sockios.h |
| 38 | header-y += sclp_ctl.h | 38 | header-y += sclp_ctl.h |
| 39 | header-y += sie.h | ||
| 39 | header-y += stat.h | 40 | header-y += stat.h |
| 40 | header-y += statfs.h | 41 | header-y += statfs.h |
| 41 | header-y += swab.h | 42 | header-y += swab.h |
diff --git a/arch/s390/include/uapi/asm/sie.h b/arch/s390/include/uapi/asm/sie.h index 3d97f610198d..5d9cc19462c4 100644 --- a/arch/s390/include/uapi/asm/sie.h +++ b/arch/s390/include/uapi/asm/sie.h | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | #ifndef _UAPI_ASM_S390_SIE_H | 1 | #ifndef _UAPI_ASM_S390_SIE_H |
| 2 | #define _UAPI_ASM_S390_SIE_H | 2 | #define _UAPI_ASM_S390_SIE_H |
| 3 | 3 | ||
| 4 | #include <asm/sigp.h> | ||
| 5 | |||
| 6 | #define diagnose_codes \ | 4 | #define diagnose_codes \ |
| 7 | { 0x10, "DIAG (0x10) release pages" }, \ | 5 | { 0x10, "DIAG (0x10) release pages" }, \ |
| 8 | { 0x44, "DIAG (0x44) time slice end" }, \ | 6 | { 0x44, "DIAG (0x44) time slice end" }, \ |
| @@ -13,18 +11,18 @@ | |||
| 13 | { 0x500, "DIAG (0x500) KVM virtio functions" }, \ | 11 | { 0x500, "DIAG (0x500) KVM virtio functions" }, \ |
| 14 | { 0x501, "DIAG (0x501) KVM breakpoint" } | 12 | { 0x501, "DIAG (0x501) KVM breakpoint" } |
| 15 | 13 | ||
| 16 | #define sigp_order_codes \ | 14 | #define sigp_order_codes \ |
| 17 | { SIGP_SENSE, "SIGP sense" }, \ | 15 | { 0x01, "SIGP sense" }, \ |
| 18 | { SIGP_EXTERNAL_CALL, "SIGP external call" }, \ | 16 | { 0x02, "SIGP external call" }, \ |
| 19 | { SIGP_EMERGENCY_SIGNAL, "SIGP emergency signal" }, \ | 17 | { 0x03, "SIGP emergency signal" }, \ |
| 20 | { SIGP_STOP, "SIGP stop" }, \ | 18 | { 0x05, "SIGP stop" }, \ |
| 21 | { SIGP_STOP_AND_STORE_STATUS, "SIGP stop and store status" }, \ | 19 | { 0x06, "SIGP restart" }, \ |
| 22 | { SIGP_SET_ARCHITECTURE, "SIGP set architecture" }, \ | 20 | { 0x09, "SIGP stop and store status" }, \ |
| 23 | { SIGP_SET_PREFIX, "SIGP set prefix" }, \ | 21 | { 0x0b, "SIGP initial cpu reset" }, \ |
| 24 | { SIGP_SENSE_RUNNING, "SIGP sense running" }, \ | 22 | { 0x0d, "SIGP set prefix" }, \ |
| 25 | { SIGP_RESTART, "SIGP restart" }, \ | 23 | { 0x0e, "SIGP store status at address" }, \ |
| 26 | { SIGP_INITIAL_CPU_RESET, "SIGP initial cpu reset" }, \ | 24 | { 0x12, "SIGP set architecture" }, \ |
| 27 | { SIGP_STORE_STATUS_AT_ADDRESS, "SIGP store status at address" } | 25 | { 0x15, "SIGP sense running" } |
| 28 | 26 | ||
| 29 | #define icpt_prog_codes \ | 27 | #define icpt_prog_codes \ |
| 30 | { 0x0001, "Prog Operation" }, \ | 28 | { 0x0001, "Prog Operation" }, \ |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 49314155b66c..49205d01b9ad 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
| @@ -95,7 +95,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level) | |||
| 95 | #define KVM_REFILL_PAGES 25 | 95 | #define KVM_REFILL_PAGES 25 |
| 96 | #define KVM_MAX_CPUID_ENTRIES 80 | 96 | #define KVM_MAX_CPUID_ENTRIES 80 |
| 97 | #define KVM_NR_FIXED_MTRR_REGION 88 | 97 | #define KVM_NR_FIXED_MTRR_REGION 88 |
| 98 | #define KVM_NR_VAR_MTRR 8 | 98 | #define KVM_NR_VAR_MTRR 10 |
| 99 | 99 | ||
| 100 | #define ASYNC_PF_PER_VCPU 64 | 100 | #define ASYNC_PF_PER_VCPU 64 |
| 101 | 101 | ||
| @@ -461,7 +461,7 @@ struct kvm_vcpu_arch { | |||
| 461 | bool nmi_injected; /* Trying to inject an NMI this entry */ | 461 | bool nmi_injected; /* Trying to inject an NMI this entry */ |
| 462 | 462 | ||
| 463 | struct mtrr_state_type mtrr_state; | 463 | struct mtrr_state_type mtrr_state; |
| 464 | u32 pat; | 464 | u64 pat; |
| 465 | 465 | ||
| 466 | unsigned switch_db_regs; | 466 | unsigned switch_db_regs; |
| 467 | unsigned long db[KVM_NR_DB_REGS]; | 467 | unsigned long db[KVM_NR_DB_REGS]; |
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h index 14fd6fd75a19..6205f0c434db 100644 --- a/arch/x86/include/asm/ptrace.h +++ b/arch/x86/include/asm/ptrace.h | |||
| @@ -231,6 +231,22 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, | |||
| 231 | 231 | ||
| 232 | #define ARCH_HAS_USER_SINGLE_STEP_INFO | 232 | #define ARCH_HAS_USER_SINGLE_STEP_INFO |
| 233 | 233 | ||
| 234 | /* | ||
| 235 | * When hitting ptrace_stop(), we cannot return using SYSRET because | ||
| 236 | * that does not restore the full CPU state, only a minimal set. The | ||
| 237 | * ptracer can change arbitrary register values, which is usually okay | ||
| 238 | * because the usual ptrace stops run off the signal delivery path which | ||
| 239 | * forces IRET; however, ptrace_event() stops happen in arbitrary places | ||
| 240 | * in the kernel and don't force IRET path. | ||
| 241 | * | ||
| 242 | * So force IRET path after a ptrace stop. | ||
| 243 | */ | ||
| 244 | #define arch_ptrace_stop_needed(code, info) \ | ||
| 245 | ({ \ | ||
| 246 | set_thread_flag(TIF_NOTIFY_RESUME); \ | ||
| 247 | false; \ | ||
| 248 | }) | ||
| 249 | |||
| 234 | struct user_desc; | 250 | struct user_desc; |
| 235 | extern int do_get_thread_area(struct task_struct *p, int idx, | 251 | extern int do_get_thread_area(struct task_struct *p, int idx, |
| 236 | struct user_desc __user *info); | 252 | struct user_desc __user *info); |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index f0da82b8e634..dbaa23e78b36 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
| @@ -423,9 +423,10 @@ sysenter_past_esp: | |||
| 423 | jnz sysenter_audit | 423 | jnz sysenter_audit |
| 424 | sysenter_do_call: | 424 | sysenter_do_call: |
| 425 | cmpl $(NR_syscalls), %eax | 425 | cmpl $(NR_syscalls), %eax |
| 426 | jae syscall_badsys | 426 | jae sysenter_badsys |
| 427 | call *sys_call_table(,%eax,4) | 427 | call *sys_call_table(,%eax,4) |
| 428 | movl %eax,PT_EAX(%esp) | 428 | movl %eax,PT_EAX(%esp) |
| 429 | sysenter_after_call: | ||
| 429 | LOCKDEP_SYS_EXIT | 430 | LOCKDEP_SYS_EXIT |
| 430 | DISABLE_INTERRUPTS(CLBR_ANY) | 431 | DISABLE_INTERRUPTS(CLBR_ANY) |
| 431 | TRACE_IRQS_OFF | 432 | TRACE_IRQS_OFF |
| @@ -675,7 +676,12 @@ END(syscall_fault) | |||
| 675 | 676 | ||
| 676 | syscall_badsys: | 677 | syscall_badsys: |
| 677 | movl $-ENOSYS,PT_EAX(%esp) | 678 | movl $-ENOSYS,PT_EAX(%esp) |
| 678 | jmp resume_userspace | 679 | jmp syscall_exit |
| 680 | END(syscall_badsys) | ||
| 681 | |||
| 682 | sysenter_badsys: | ||
| 683 | movl $-ENOSYS,PT_EAX(%esp) | ||
| 684 | jmp sysenter_after_call | ||
| 679 | END(syscall_badsys) | 685 | END(syscall_badsys) |
| 680 | CFI_ENDPROC | 686 | CFI_ENDPROC |
| 681 | 687 | ||
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index a0da58db43a8..2851d63c1202 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
| @@ -363,7 +363,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, | |||
| 363 | 363 | ||
| 364 | /* Set up to return from userspace. */ | 364 | /* Set up to return from userspace. */ |
| 365 | restorer = current->mm->context.vdso + | 365 | restorer = current->mm->context.vdso + |
| 366 | selected_vdso32->sym___kernel_sigreturn; | 366 | selected_vdso32->sym___kernel_rt_sigreturn; |
| 367 | if (ksig->ka.sa.sa_flags & SA_RESTORER) | 367 | if (ksig->ka.sa.sa_flags & SA_RESTORER) |
| 368 | restorer = ksig->ka.sa.sa_restorer; | 368 | restorer = ksig->ka.sa.sa_restorer; |
| 369 | put_user_ex(restorer, &frame->pretcode); | 369 | put_user_ex(restorer, &frame->pretcode); |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index ec8366c5cfea..b5e994ad0135 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
| @@ -1462,6 +1462,7 @@ static void svm_get_segment(struct kvm_vcpu *vcpu, | |||
| 1462 | */ | 1462 | */ |
| 1463 | if (var->unusable) | 1463 | if (var->unusable) |
| 1464 | var->db = 0; | 1464 | var->db = 0; |
| 1465 | var->dpl = to_svm(vcpu)->vmcb->save.cpl; | ||
| 1465 | break; | 1466 | break; |
| 1466 | } | 1467 | } |
| 1467 | } | 1468 | } |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f32a02578c0d..f6449334ec45 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -1898,7 +1898,7 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
| 1898 | if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) | 1898 | if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) |
| 1899 | break; | 1899 | break; |
| 1900 | gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; | 1900 | gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; |
| 1901 | if (kvm_write_guest(kvm, data, | 1901 | if (kvm_write_guest(kvm, gfn << HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT, |
| 1902 | &tsc_ref, sizeof(tsc_ref))) | 1902 | &tsc_ref, sizeof(tsc_ref))) |
| 1903 | return 1; | 1903 | return 1; |
| 1904 | mark_page_dirty(kvm, gfn); | 1904 | mark_page_dirty(kvm, gfn); |
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile index 3c0809a0631f..61b04fe36e66 100644 --- a/arch/x86/vdso/Makefile +++ b/arch/x86/vdso/Makefile | |||
| @@ -11,7 +11,6 @@ VDSO32-$(CONFIG_COMPAT) := y | |||
| 11 | 11 | ||
| 12 | # files to link into the vdso | 12 | # files to link into the vdso |
| 13 | vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vdso-fakesections.o | 13 | vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vdso-fakesections.o |
| 14 | vobjs-nox32 := vdso-fakesections.o | ||
| 15 | 14 | ||
| 16 | # files to link into kernel | 15 | # files to link into kernel |
| 17 | obj-y += vma.o | 16 | obj-y += vma.o |
| @@ -67,7 +66,8 @@ $(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso2c FORCE | |||
| 67 | # | 66 | # |
| 68 | CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ | 67 | CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ |
| 69 | $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \ | 68 | $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \ |
| 70 | -fno-omit-frame-pointer -foptimize-sibling-calls | 69 | -fno-omit-frame-pointer -foptimize-sibling-calls \ |
| 70 | -DDISABLE_BRANCH_PROFILING | ||
| 71 | 71 | ||
| 72 | $(vobjs): KBUILD_CFLAGS += $(CFL) | 72 | $(vobjs): KBUILD_CFLAGS += $(CFL) |
| 73 | 73 | ||
| @@ -134,7 +134,7 @@ override obj-dirs = $(dir $(obj)) $(obj)/vdso32/ | |||
| 134 | 134 | ||
| 135 | targets += vdso32/vdso32.lds | 135 | targets += vdso32/vdso32.lds |
| 136 | targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o) | 136 | targets += vdso32/note.o vdso32/vclock_gettime.o $(vdso32.so-y:%=vdso32/%.o) |
| 137 | targets += vdso32/vclock_gettime.o | 137 | targets += vdso32/vclock_gettime.o vdso32/vdso-fakesections.o |
| 138 | 138 | ||
| 139 | $(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%) | 139 | $(obj)/vdso32.o: $(vdso32-images:%=$(obj)/%) |
| 140 | 140 | ||
| @@ -150,11 +150,13 @@ KBUILD_CFLAGS_32 += -m32 -msoft-float -mregparm=0 -fpic | |||
| 150 | KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector) | 150 | KBUILD_CFLAGS_32 += $(call cc-option, -fno-stack-protector) |
| 151 | KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) | 151 | KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) |
| 152 | KBUILD_CFLAGS_32 += -fno-omit-frame-pointer | 152 | KBUILD_CFLAGS_32 += -fno-omit-frame-pointer |
| 153 | KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING | ||
| 153 | $(vdso32-images:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) | 154 | $(vdso32-images:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) |
| 154 | 155 | ||
| 155 | $(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \ | 156 | $(vdso32-images:%=$(obj)/%.dbg): $(obj)/vdso32-%.so.dbg: FORCE \ |
| 156 | $(obj)/vdso32/vdso32.lds \ | 157 | $(obj)/vdso32/vdso32.lds \ |
| 157 | $(obj)/vdso32/vclock_gettime.o \ | 158 | $(obj)/vdso32/vclock_gettime.o \ |
| 159 | $(obj)/vdso32/vdso-fakesections.o \ | ||
| 158 | $(obj)/vdso32/note.o \ | 160 | $(obj)/vdso32/note.o \ |
| 159 | $(obj)/vdso32/%.o | 161 | $(obj)/vdso32/%.o |
| 160 | $(call if_changed,vdso) | 162 | $(call if_changed,vdso) |
| @@ -169,14 +171,24 @@ quiet_cmd_vdso = VDSO $@ | |||
| 169 | sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' | 171 | sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' |
| 170 | 172 | ||
| 171 | VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \ | 173 | VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \ |
| 172 | -Wl,-Bsymbolic $(LTO_CFLAGS) | 174 | $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS) |
| 173 | GCOV_PROFILE := n | 175 | GCOV_PROFILE := n |
| 174 | 176 | ||
| 175 | # | 177 | # |
| 176 | # Install the unstripped copies of vdso*.so. | 178 | # Install the unstripped copies of vdso*.so. If our toolchain supports |
| 179 | # build-id, install .build-id links as well. | ||
| 177 | # | 180 | # |
| 178 | quiet_cmd_vdso_install = INSTALL $(@:install_%=%) | 181 | quiet_cmd_vdso_install = INSTALL $(@:install_%=%) |
| 179 | cmd_vdso_install = cp $< $(MODLIB)/vdso/$(@:install_%=%) | 182 | define cmd_vdso_install |
| 183 | cp $< "$(MODLIB)/vdso/$(@:install_%=%)"; \ | ||
| 184 | if readelf -n $< |grep -q 'Build ID'; then \ | ||
| 185 | buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ | ||
| 186 | first=`echo $$buildid | cut -b-2`; \ | ||
| 187 | last=`echo $$buildid | cut -b3-`; \ | ||
| 188 | mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ | ||
| 189 | ln -sf "../../$(@:install_%=%)" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ | ||
| 190 | fi | ||
| 191 | endef | ||
| 180 | 192 | ||
| 181 | vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) | 193 | vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) |
| 182 | 194 | ||
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index b2e4f493e5b0..9793322751e0 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c | |||
| @@ -11,9 +11,6 @@ | |||
| 11 | * Check with readelf after changing. | 11 | * Check with readelf after changing. |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | /* Disable profiling for userspace code: */ | ||
| 15 | #define DISABLE_BRANCH_PROFILING | ||
| 16 | |||
| 17 | #include <uapi/linux/time.h> | 14 | #include <uapi/linux/time.h> |
| 18 | #include <asm/vgtod.h> | 15 | #include <asm/vgtod.h> |
| 19 | #include <asm/hpet.h> | 16 | #include <asm/hpet.h> |
diff --git a/arch/x86/vdso/vdso-fakesections.c b/arch/x86/vdso/vdso-fakesections.c index cb8a8d72c24b..aa5fbfab20a5 100644 --- a/arch/x86/vdso/vdso-fakesections.c +++ b/arch/x86/vdso/vdso-fakesections.c | |||
| @@ -2,31 +2,20 @@ | |||
| 2 | * Copyright 2014 Andy Lutomirski | 2 | * Copyright 2014 Andy Lutomirski |
| 3 | * Subject to the GNU Public License, v.2 | 3 | * Subject to the GNU Public License, v.2 |
| 4 | * | 4 | * |
| 5 | * Hack to keep broken Go programs working. | 5 | * String table for loadable section headers. See vdso2c.h for why |
| 6 | * | 6 | * this exists. |
| 7 | * The Go runtime had a couple of bugs: it would read the section table to try | ||
| 8 | * to figure out how many dynamic symbols there were (it shouldn't have looked | ||
| 9 | * at the section table at all) and, if there were no SHT_SYNDYM section table | ||
| 10 | * entry, it would use an uninitialized value for the number of symbols. As a | ||
| 11 | * workaround, we supply a minimal section table. vdso2c will adjust the | ||
| 12 | * in-memory image so that "vdso_fake_sections" becomes the section table. | ||
| 13 | * | ||
| 14 | * The bug was introduced by: | ||
| 15 | * https://code.google.com/p/go/source/detail?r=56ea40aac72b (2012-08-31) | ||
| 16 | * and is being addressed in the Go runtime in this issue: | ||
| 17 | * https://code.google.com/p/go/issues/detail?id=8197 | ||
| 18 | */ | 7 | */ |
| 19 | 8 | ||
| 20 | #ifndef __x86_64__ | 9 | const char fake_shstrtab[] __attribute__((section(".fake_shstrtab"))) = |
| 21 | #error This hack is specific to the 64-bit vDSO | 10 | ".hash\0" |
| 22 | #endif | 11 | ".dynsym\0" |
| 23 | 12 | ".dynstr\0" | |
| 24 | #include <linux/elf.h> | 13 | ".gnu.version\0" |
| 25 | 14 | ".gnu.version_d\0" | |
| 26 | extern const __visible struct elf64_shdr vdso_fake_sections[]; | 15 | ".dynamic\0" |
| 27 | const __visible struct elf64_shdr vdso_fake_sections[] = { | 16 | ".rodata\0" |
| 28 | { | 17 | ".fake_shstrtab\0" /* Yay, self-referential code. */ |
| 29 | .sh_type = SHT_DYNSYM, | 18 | ".note\0" |
| 30 | .sh_entsize = sizeof(Elf64_Sym), | 19 | ".eh_frame_hdr\0" |
| 31 | } | 20 | ".eh_frame\0" |
| 32 | }; | 21 | ".text"; |
diff --git a/arch/x86/vdso/vdso-layout.lds.S b/arch/x86/vdso/vdso-layout.lds.S index 2ec72f651ebf..9197544eea9a 100644 --- a/arch/x86/vdso/vdso-layout.lds.S +++ b/arch/x86/vdso/vdso-layout.lds.S | |||
| @@ -6,6 +6,16 @@ | |||
| 6 | * This script controls its layout. | 6 | * This script controls its layout. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #if defined(BUILD_VDSO64) | ||
| 10 | # define SHDR_SIZE 64 | ||
| 11 | #elif defined(BUILD_VDSO32) || defined(BUILD_VDSOX32) | ||
| 12 | # define SHDR_SIZE 40 | ||
| 13 | #else | ||
| 14 | # error unknown VDSO target | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #define NUM_FAKE_SHDRS 13 | ||
| 18 | |||
| 9 | SECTIONS | 19 | SECTIONS |
| 10 | { | 20 | { |
| 11 | . = SIZEOF_HEADERS; | 21 | . = SIZEOF_HEADERS; |
| @@ -18,36 +28,53 @@ SECTIONS | |||
| 18 | .gnu.version_d : { *(.gnu.version_d) } | 28 | .gnu.version_d : { *(.gnu.version_d) } |
| 19 | .gnu.version_r : { *(.gnu.version_r) } | 29 | .gnu.version_r : { *(.gnu.version_r) } |
| 20 | 30 | ||
| 31 | .dynamic : { *(.dynamic) } :text :dynamic | ||
| 32 | |||
| 33 | .rodata : { | ||
| 34 | *(.rodata*) | ||
| 35 | *(.data*) | ||
| 36 | *(.sdata*) | ||
| 37 | *(.got.plt) *(.got) | ||
| 38 | *(.gnu.linkonce.d.*) | ||
| 39 | *(.bss*) | ||
| 40 | *(.dynbss*) | ||
| 41 | *(.gnu.linkonce.b.*) | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Ideally this would live in a C file, but that won't | ||
| 45 | * work cleanly for x32 until we start building the x32 | ||
| 46 | * C code using an x32 toolchain. | ||
| 47 | */ | ||
| 48 | VDSO_FAKE_SECTION_TABLE_START = .; | ||
| 49 | . = . + NUM_FAKE_SHDRS * SHDR_SIZE; | ||
| 50 | VDSO_FAKE_SECTION_TABLE_END = .; | ||
| 51 | } :text | ||
| 52 | |||
| 53 | .fake_shstrtab : { *(.fake_shstrtab) } :text | ||
| 54 | |||
| 55 | |||
| 21 | .note : { *(.note.*) } :text :note | 56 | .note : { *(.note.*) } :text :note |
| 22 | 57 | ||
| 23 | .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr | 58 | .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr |
| 24 | .eh_frame : { KEEP (*(.eh_frame)) } :text | 59 | .eh_frame : { KEEP (*(.eh_frame)) } :text |
| 25 | 60 | ||
| 26 | .dynamic : { *(.dynamic) } :text :dynamic | ||
| 27 | |||
| 28 | .rodata : { *(.rodata*) } :text | ||
| 29 | .data : { | ||
| 30 | *(.data*) | ||
| 31 | *(.sdata*) | ||
| 32 | *(.got.plt) *(.got) | ||
| 33 | *(.gnu.linkonce.d.*) | ||
| 34 | *(.bss*) | ||
| 35 | *(.dynbss*) | ||
| 36 | *(.gnu.linkonce.b.*) | ||
| 37 | } | ||
| 38 | |||
| 39 | .altinstructions : { *(.altinstructions) } | ||
| 40 | .altinstr_replacement : { *(.altinstr_replacement) } | ||
| 41 | 61 | ||
| 42 | /* | 62 | /* |
| 43 | * Align the actual code well away from the non-instruction data. | 63 | * Text is well-separated from actual data: there's plenty of |
| 44 | * This is the best thing for the I-cache. | 64 | * stuff that isn't used at runtime in between. |
| 45 | */ | 65 | */ |
| 46 | . = ALIGN(0x100); | ||
| 47 | 66 | ||
| 48 | .text : { *(.text*) } :text =0x90909090, | 67 | .text : { *(.text*) } :text =0x90909090, |
| 49 | 68 | ||
| 50 | /* | 69 | /* |
| 70 | * At the end so that eu-elflint stays happy when vdso2c strips | ||
| 71 | * these. A better implementation would avoid allocating space | ||
| 72 | * for these. | ||
| 73 | */ | ||
| 74 | .altinstructions : { *(.altinstructions) } :text | ||
| 75 | .altinstr_replacement : { *(.altinstr_replacement) } :text | ||
| 76 | |||
| 77 | /* | ||
| 51 | * The remainder of the vDSO consists of special pages that are | 78 | * The remainder of the vDSO consists of special pages that are |
| 52 | * shared between the kernel and userspace. It needs to be at the | 79 | * shared between the kernel and userspace. It needs to be at the |
| 53 | * end so that it doesn't overlap the mapping of the actual | 80 | * end so that it doesn't overlap the mapping of the actual |
| @@ -75,6 +102,7 @@ SECTIONS | |||
| 75 | /DISCARD/ : { | 102 | /DISCARD/ : { |
| 76 | *(.discard) | 103 | *(.discard) |
| 77 | *(.discard.*) | 104 | *(.discard.*) |
| 105 | *(__bug_table) | ||
| 78 | } | 106 | } |
| 79 | } | 107 | } |
| 80 | 108 | ||
diff --git a/arch/x86/vdso/vdso.lds.S b/arch/x86/vdso/vdso.lds.S index 75e3404c83b1..6807932643c2 100644 --- a/arch/x86/vdso/vdso.lds.S +++ b/arch/x86/vdso/vdso.lds.S | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | * the DSO. | 6 | * the DSO. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #define BUILD_VDSO64 | ||
| 10 | |||
| 9 | #include "vdso-layout.lds.S" | 11 | #include "vdso-layout.lds.S" |
| 10 | 12 | ||
| 11 | /* | 13 | /* |
diff --git a/arch/x86/vdso/vdso2c.c b/arch/x86/vdso/vdso2c.c index 7a6bf50f9165..238dbe82776e 100644 --- a/arch/x86/vdso/vdso2c.c +++ b/arch/x86/vdso/vdso2c.c | |||
| @@ -23,6 +23,8 @@ enum { | |||
| 23 | sym_vvar_page, | 23 | sym_vvar_page, |
| 24 | sym_hpet_page, | 24 | sym_hpet_page, |
| 25 | sym_end_mapping, | 25 | sym_end_mapping, |
| 26 | sym_VDSO_FAKE_SECTION_TABLE_START, | ||
| 27 | sym_VDSO_FAKE_SECTION_TABLE_END, | ||
| 26 | }; | 28 | }; |
| 27 | 29 | ||
| 28 | const int special_pages[] = { | 30 | const int special_pages[] = { |
| @@ -30,15 +32,26 @@ const int special_pages[] = { | |||
| 30 | sym_hpet_page, | 32 | sym_hpet_page, |
| 31 | }; | 33 | }; |
| 32 | 34 | ||
| 33 | char const * const required_syms[] = { | 35 | struct vdso_sym { |
| 34 | [sym_vvar_page] = "vvar_page", | 36 | const char *name; |
| 35 | [sym_hpet_page] = "hpet_page", | 37 | bool export; |
| 36 | [sym_end_mapping] = "end_mapping", | 38 | }; |
| 37 | "VDSO32_NOTE_MASK", | 39 | |
| 38 | "VDSO32_SYSENTER_RETURN", | 40 | struct vdso_sym required_syms[] = { |
| 39 | "__kernel_vsyscall", | 41 | [sym_vvar_page] = {"vvar_page", true}, |
| 40 | "__kernel_sigreturn", | 42 | [sym_hpet_page] = {"hpet_page", true}, |
| 41 | "__kernel_rt_sigreturn", | 43 | [sym_end_mapping] = {"end_mapping", true}, |
| 44 | [sym_VDSO_FAKE_SECTION_TABLE_START] = { | ||
| 45 | "VDSO_FAKE_SECTION_TABLE_START", false | ||
| 46 | }, | ||
| 47 | [sym_VDSO_FAKE_SECTION_TABLE_END] = { | ||
| 48 | "VDSO_FAKE_SECTION_TABLE_END", false | ||
| 49 | }, | ||
| 50 | {"VDSO32_NOTE_MASK", true}, | ||
| 51 | {"VDSO32_SYSENTER_RETURN", true}, | ||
| 52 | {"__kernel_vsyscall", true}, | ||
| 53 | {"__kernel_sigreturn", true}, | ||
| 54 | {"__kernel_rt_sigreturn", true}, | ||
| 42 | }; | 55 | }; |
| 43 | 56 | ||
| 44 | __attribute__((format(printf, 1, 2))) __attribute__((noreturn)) | 57 | __attribute__((format(printf, 1, 2))) __attribute__((noreturn)) |
| @@ -83,37 +96,21 @@ extern void bad_put_le(void); | |||
| 83 | 96 | ||
| 84 | #define NSYMS (sizeof(required_syms) / sizeof(required_syms[0])) | 97 | #define NSYMS (sizeof(required_syms) / sizeof(required_syms[0])) |
| 85 | 98 | ||
| 86 | #define BITS 64 | 99 | #define BITSFUNC3(name, bits) name##bits |
| 87 | #define GOFUNC go64 | 100 | #define BITSFUNC2(name, bits) BITSFUNC3(name, bits) |
| 88 | #define Elf_Ehdr Elf64_Ehdr | 101 | #define BITSFUNC(name) BITSFUNC2(name, ELF_BITS) |
| 89 | #define Elf_Shdr Elf64_Shdr | 102 | |
| 90 | #define Elf_Phdr Elf64_Phdr | 103 | #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x |
| 91 | #define Elf_Sym Elf64_Sym | 104 | #define ELF_BITS_XFORM(bits, x) ELF_BITS_XFORM2(bits, x) |
| 92 | #define Elf_Dyn Elf64_Dyn | 105 | #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x) |
| 106 | |||
| 107 | #define ELF_BITS 64 | ||
| 93 | #include "vdso2c.h" | 108 | #include "vdso2c.h" |
| 94 | #undef BITS | 109 | #undef ELF_BITS |
| 95 | #undef GOFUNC | 110 | |
| 96 | #undef Elf_Ehdr | 111 | #define ELF_BITS 32 |
| 97 | #undef Elf_Shdr | ||
| 98 | #undef Elf_Phdr | ||
| 99 | #undef Elf_Sym | ||
| 100 | #undef Elf_Dyn | ||
| 101 | |||
| 102 | #define BITS 32 | ||
| 103 | #define GOFUNC go32 | ||
| 104 | #define Elf_Ehdr Elf32_Ehdr | ||
| 105 | #define Elf_Shdr Elf32_Shdr | ||
| 106 | #define Elf_Phdr Elf32_Phdr | ||
| 107 | #define Elf_Sym Elf32_Sym | ||
| 108 | #define Elf_Dyn Elf32_Dyn | ||
| 109 | #include "vdso2c.h" | 112 | #include "vdso2c.h" |
| 110 | #undef BITS | 113 | #undef ELF_BITS |
| 111 | #undef GOFUNC | ||
| 112 | #undef Elf_Ehdr | ||
| 113 | #undef Elf_Shdr | ||
| 114 | #undef Elf_Phdr | ||
| 115 | #undef Elf_Sym | ||
| 116 | #undef Elf_Dyn | ||
| 117 | 114 | ||
| 118 | static void go(void *addr, size_t len, FILE *outfile, const char *name) | 115 | static void go(void *addr, size_t len, FILE *outfile, const char *name) |
| 119 | { | 116 | { |
diff --git a/arch/x86/vdso/vdso2c.h b/arch/x86/vdso/vdso2c.h index c6eefaf389b9..df95a2fdff73 100644 --- a/arch/x86/vdso/vdso2c.h +++ b/arch/x86/vdso/vdso2c.h | |||
| @@ -4,23 +4,136 @@ | |||
| 4 | * are built for 32-bit userspace. | 4 | * are built for 32-bit userspace. |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | 7 | /* |
| 8 | * We're writing a section table for a few reasons: | ||
| 9 | * | ||
| 10 | * The Go runtime had a couple of bugs: it would read the section | ||
| 11 | * table to try to figure out how many dynamic symbols there were (it | ||
| 12 | * shouldn't have looked at the section table at all) and, if there | ||
| 13 | * were no SHT_SYNDYM section table entry, it would use an | ||
| 14 | * uninitialized value for the number of symbols. An empty DYNSYM | ||
| 15 | * table would work, but I see no reason not to write a valid one (and | ||
| 16 | * keep full performance for old Go programs). This hack is only | ||
| 17 | * needed on x86_64. | ||
| 18 | * | ||
| 19 | * The bug was introduced on 2012-08-31 by: | ||
| 20 | * https://code.google.com/p/go/source/detail?r=56ea40aac72b | ||
| 21 | * and was fixed on 2014-06-13 by: | ||
| 22 | * https://code.google.com/p/go/source/detail?r=fc1cd5e12595 | ||
| 23 | * | ||
| 24 | * Binutils has issues debugging the vDSO: it reads the section table to | ||
| 25 | * find SHT_NOTE; it won't look at PT_NOTE for the in-memory vDSO, which | ||
| 26 | * would break build-id if we removed the section table. Binutils | ||
| 27 | * also requires that shstrndx != 0. See: | ||
| 28 | * https://sourceware.org/bugzilla/show_bug.cgi?id=17064 | ||
| 29 | * | ||
| 30 | * elfutils might not look for PT_NOTE if there is a section table at | ||
| 31 | * all. I don't know whether this matters for any practical purpose. | ||
| 32 | * | ||
| 33 | * For simplicity, rather than hacking up a partial section table, we | ||
| 34 | * just write a mostly complete one. We omit non-dynamic symbols, | ||
| 35 | * though, since they're rather large. | ||
| 36 | * | ||
| 37 | * Once binutils gets fixed, we might be able to drop this for all but | ||
| 38 | * the 64-bit vdso, since build-id only works in kernel RPMs, and | ||
| 39 | * systems that update to new enough kernel RPMs will likely update | ||
| 40 | * binutils in sync. build-id has never worked for home-built kernel | ||
| 41 | * RPMs without manual symlinking, and I suspect that no one ever does | ||
| 42 | * that. | ||
| 43 | */ | ||
| 44 | struct BITSFUNC(fake_sections) | ||
| 45 | { | ||
| 46 | ELF(Shdr) *table; | ||
| 47 | unsigned long table_offset; | ||
| 48 | int count, max_count; | ||
| 49 | |||
| 50 | int in_shstrndx; | ||
| 51 | unsigned long shstr_offset; | ||
| 52 | const char *shstrtab; | ||
| 53 | size_t shstrtab_len; | ||
| 54 | |||
| 55 | int out_shstrndx; | ||
| 56 | }; | ||
| 57 | |||
| 58 | static unsigned int BITSFUNC(find_shname)(struct BITSFUNC(fake_sections) *out, | ||
| 59 | const char *name) | ||
| 60 | { | ||
| 61 | const char *outname = out->shstrtab; | ||
| 62 | while (outname - out->shstrtab < out->shstrtab_len) { | ||
| 63 | if (!strcmp(name, outname)) | ||
| 64 | return (outname - out->shstrtab) + out->shstr_offset; | ||
| 65 | outname += strlen(outname) + 1; | ||
| 66 | } | ||
| 67 | |||
| 68 | if (*name) | ||
| 69 | printf("Warning: could not find output name \"%s\"\n", name); | ||
| 70 | return out->shstr_offset + out->shstrtab_len - 1; /* Use a null. */ | ||
| 71 | } | ||
| 72 | |||
| 73 | static void BITSFUNC(init_sections)(struct BITSFUNC(fake_sections) *out) | ||
| 74 | { | ||
| 75 | if (!out->in_shstrndx) | ||
| 76 | fail("didn't find the fake shstrndx\n"); | ||
| 77 | |||
| 78 | memset(out->table, 0, out->max_count * sizeof(ELF(Shdr))); | ||
| 79 | |||
| 80 | if (out->max_count < 1) | ||
| 81 | fail("we need at least two fake output sections\n"); | ||
| 82 | |||
| 83 | PUT_LE(&out->table[0].sh_type, SHT_NULL); | ||
| 84 | PUT_LE(&out->table[0].sh_name, BITSFUNC(find_shname)(out, "")); | ||
| 85 | |||
| 86 | out->count = 1; | ||
| 87 | } | ||
| 88 | |||
| 89 | static void BITSFUNC(copy_section)(struct BITSFUNC(fake_sections) *out, | ||
| 90 | int in_idx, const ELF(Shdr) *in, | ||
| 91 | const char *name) | ||
| 92 | { | ||
| 93 | uint64_t flags = GET_LE(&in->sh_flags); | ||
| 94 | |||
| 95 | bool copy = flags & SHF_ALLOC && | ||
| 96 | strcmp(name, ".altinstructions") && | ||
| 97 | strcmp(name, ".altinstr_replacement"); | ||
| 98 | |||
| 99 | if (!copy) | ||
| 100 | return; | ||
| 101 | |||
| 102 | if (out->count >= out->max_count) | ||
| 103 | fail("too many copied sections (max = %d)\n", out->max_count); | ||
| 104 | |||
| 105 | if (in_idx == out->in_shstrndx) | ||
| 106 | out->out_shstrndx = out->count; | ||
| 107 | |||
| 108 | out->table[out->count] = *in; | ||
| 109 | PUT_LE(&out->table[out->count].sh_name, | ||
| 110 | BITSFUNC(find_shname)(out, name)); | ||
| 111 | |||
| 112 | /* elfutils requires that a strtab have the correct type. */ | ||
| 113 | if (!strcmp(name, ".fake_shstrtab")) | ||
| 114 | PUT_LE(&out->table[out->count].sh_type, SHT_STRTAB); | ||
| 115 | |||
| 116 | out->count++; | ||
| 117 | } | ||
| 118 | |||
| 119 | static void BITSFUNC(go)(void *addr, size_t len, | ||
| 120 | FILE *outfile, const char *name) | ||
| 8 | { | 121 | { |
| 9 | int found_load = 0; | 122 | int found_load = 0; |
| 10 | unsigned long load_size = -1; /* Work around bogus warning */ | 123 | unsigned long load_size = -1; /* Work around bogus warning */ |
| 11 | unsigned long data_size; | 124 | unsigned long data_size; |
| 12 | Elf_Ehdr *hdr = (Elf_Ehdr *)addr; | 125 | ELF(Ehdr) *hdr = (ELF(Ehdr) *)addr; |
| 13 | int i; | 126 | int i; |
| 14 | unsigned long j; | 127 | unsigned long j; |
| 15 | Elf_Shdr *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr, | 128 | ELF(Shdr) *symtab_hdr = NULL, *strtab_hdr, *secstrings_hdr, |
| 16 | *alt_sec = NULL; | 129 | *alt_sec = NULL; |
| 17 | Elf_Dyn *dyn = 0, *dyn_end = 0; | 130 | ELF(Dyn) *dyn = 0, *dyn_end = 0; |
| 18 | const char *secstrings; | 131 | const char *secstrings; |
| 19 | uint64_t syms[NSYMS] = {}; | 132 | uint64_t syms[NSYMS] = {}; |
| 20 | 133 | ||
| 21 | uint64_t fake_sections_value = 0, fake_sections_size = 0; | 134 | struct BITSFUNC(fake_sections) fake_sections = {}; |
| 22 | 135 | ||
| 23 | Elf_Phdr *pt = (Elf_Phdr *)(addr + GET_LE(&hdr->e_phoff)); | 136 | ELF(Phdr) *pt = (ELF(Phdr) *)(addr + GET_LE(&hdr->e_phoff)); |
| 24 | 137 | ||
| 25 | /* Walk the segment table. */ | 138 | /* Walk the segment table. */ |
| 26 | for (i = 0; i < GET_LE(&hdr->e_phnum); i++) { | 139 | for (i = 0; i < GET_LE(&hdr->e_phnum); i++) { |
| @@ -51,7 +164,7 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
| 51 | for (i = 0; dyn + i < dyn_end && | 164 | for (i = 0; dyn + i < dyn_end && |
| 52 | GET_LE(&dyn[i].d_tag) != DT_NULL; i++) { | 165 | GET_LE(&dyn[i].d_tag) != DT_NULL; i++) { |
| 53 | typeof(dyn[i].d_tag) tag = GET_LE(&dyn[i].d_tag); | 166 | typeof(dyn[i].d_tag) tag = GET_LE(&dyn[i].d_tag); |
| 54 | if (tag == DT_REL || tag == DT_RELSZ || | 167 | if (tag == DT_REL || tag == DT_RELSZ || tag == DT_RELA || |
| 55 | tag == DT_RELENT || tag == DT_TEXTREL) | 168 | tag == DT_RELENT || tag == DT_TEXTREL) |
| 56 | fail("vdso image contains dynamic relocations\n"); | 169 | fail("vdso image contains dynamic relocations\n"); |
| 57 | } | 170 | } |
| @@ -61,7 +174,7 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
| 61 | GET_LE(&hdr->e_shentsize)*GET_LE(&hdr->e_shstrndx); | 174 | GET_LE(&hdr->e_shentsize)*GET_LE(&hdr->e_shstrndx); |
| 62 | secstrings = addr + GET_LE(&secstrings_hdr->sh_offset); | 175 | secstrings = addr + GET_LE(&secstrings_hdr->sh_offset); |
| 63 | for (i = 0; i < GET_LE(&hdr->e_shnum); i++) { | 176 | for (i = 0; i < GET_LE(&hdr->e_shnum); i++) { |
| 64 | Elf_Shdr *sh = addr + GET_LE(&hdr->e_shoff) + | 177 | ELF(Shdr) *sh = addr + GET_LE(&hdr->e_shoff) + |
| 65 | GET_LE(&hdr->e_shentsize) * i; | 178 | GET_LE(&hdr->e_shentsize) * i; |
| 66 | if (GET_LE(&sh->sh_type) == SHT_SYMTAB) | 179 | if (GET_LE(&sh->sh_type) == SHT_SYMTAB) |
| 67 | symtab_hdr = sh; | 180 | symtab_hdr = sh; |
| @@ -82,29 +195,63 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
| 82 | i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize); | 195 | i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize); |
| 83 | i++) { | 196 | i++) { |
| 84 | int k; | 197 | int k; |
| 85 | Elf_Sym *sym = addr + GET_LE(&symtab_hdr->sh_offset) + | 198 | ELF(Sym) *sym = addr + GET_LE(&symtab_hdr->sh_offset) + |
| 86 | GET_LE(&symtab_hdr->sh_entsize) * i; | 199 | GET_LE(&symtab_hdr->sh_entsize) * i; |
| 87 | const char *name = addr + GET_LE(&strtab_hdr->sh_offset) + | 200 | const char *name = addr + GET_LE(&strtab_hdr->sh_offset) + |
| 88 | GET_LE(&sym->st_name); | 201 | GET_LE(&sym->st_name); |
| 89 | 202 | ||
| 90 | for (k = 0; k < NSYMS; k++) { | 203 | for (k = 0; k < NSYMS; k++) { |
| 91 | if (!strcmp(name, required_syms[k])) { | 204 | if (!strcmp(name, required_syms[k].name)) { |
| 92 | if (syms[k]) { | 205 | if (syms[k]) { |
| 93 | fail("duplicate symbol %s\n", | 206 | fail("duplicate symbol %s\n", |
| 94 | required_syms[k]); | 207 | required_syms[k].name); |
| 95 | } | 208 | } |
| 96 | syms[k] = GET_LE(&sym->st_value); | 209 | syms[k] = GET_LE(&sym->st_value); |
| 97 | } | 210 | } |
| 98 | } | 211 | } |
| 99 | 212 | ||
| 100 | if (!strcmp(name, "vdso_fake_sections")) { | 213 | if (!strcmp(name, "fake_shstrtab")) { |
| 101 | if (fake_sections_value) | 214 | ELF(Shdr) *sh; |
| 102 | fail("duplicate vdso_fake_sections\n"); | 215 | |
| 103 | fake_sections_value = GET_LE(&sym->st_value); | 216 | fake_sections.in_shstrndx = GET_LE(&sym->st_shndx); |
| 104 | fake_sections_size = GET_LE(&sym->st_size); | 217 | fake_sections.shstrtab = addr + GET_LE(&sym->st_value); |
| 218 | fake_sections.shstrtab_len = GET_LE(&sym->st_size); | ||
| 219 | sh = addr + GET_LE(&hdr->e_shoff) + | ||
| 220 | GET_LE(&hdr->e_shentsize) * | ||
| 221 | fake_sections.in_shstrndx; | ||
| 222 | fake_sections.shstr_offset = GET_LE(&sym->st_value) - | ||
| 223 | GET_LE(&sh->sh_addr); | ||
| 105 | } | 224 | } |
| 106 | } | 225 | } |
| 107 | 226 | ||
| 227 | /* Build the output section table. */ | ||
| 228 | if (!syms[sym_VDSO_FAKE_SECTION_TABLE_START] || | ||
| 229 | !syms[sym_VDSO_FAKE_SECTION_TABLE_END]) | ||
| 230 | fail("couldn't find fake section table\n"); | ||
| 231 | if ((syms[sym_VDSO_FAKE_SECTION_TABLE_END] - | ||
| 232 | syms[sym_VDSO_FAKE_SECTION_TABLE_START]) % sizeof(ELF(Shdr))) | ||
| 233 | fail("fake section table size isn't a multiple of sizeof(Shdr)\n"); | ||
| 234 | fake_sections.table = addr + syms[sym_VDSO_FAKE_SECTION_TABLE_START]; | ||
| 235 | fake_sections.table_offset = syms[sym_VDSO_FAKE_SECTION_TABLE_START]; | ||
| 236 | fake_sections.max_count = (syms[sym_VDSO_FAKE_SECTION_TABLE_END] - | ||
| 237 | syms[sym_VDSO_FAKE_SECTION_TABLE_START]) / | ||
| 238 | sizeof(ELF(Shdr)); | ||
| 239 | |||
| 240 | BITSFUNC(init_sections)(&fake_sections); | ||
| 241 | for (i = 0; i < GET_LE(&hdr->e_shnum); i++) { | ||
| 242 | ELF(Shdr) *sh = addr + GET_LE(&hdr->e_shoff) + | ||
| 243 | GET_LE(&hdr->e_shentsize) * i; | ||
| 244 | BITSFUNC(copy_section)(&fake_sections, i, sh, | ||
| 245 | secstrings + GET_LE(&sh->sh_name)); | ||
| 246 | } | ||
| 247 | if (!fake_sections.out_shstrndx) | ||
| 248 | fail("didn't generate shstrndx?!?\n"); | ||
| 249 | |||
| 250 | PUT_LE(&hdr->e_shoff, fake_sections.table_offset); | ||
| 251 | PUT_LE(&hdr->e_shentsize, sizeof(ELF(Shdr))); | ||
| 252 | PUT_LE(&hdr->e_shnum, fake_sections.count); | ||
| 253 | PUT_LE(&hdr->e_shstrndx, fake_sections.out_shstrndx); | ||
| 254 | |||
| 108 | /* Validate mapping addresses. */ | 255 | /* Validate mapping addresses. */ |
| 109 | for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) { | 256 | for (i = 0; i < sizeof(special_pages) / sizeof(special_pages[0]); i++) { |
| 110 | if (!syms[i]) | 257 | if (!syms[i]) |
| @@ -112,25 +259,17 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
| 112 | 259 | ||
| 113 | if (syms[i] % 4096) | 260 | if (syms[i] % 4096) |
| 114 | fail("%s must be a multiple of 4096\n", | 261 | fail("%s must be a multiple of 4096\n", |
| 115 | required_syms[i]); | 262 | required_syms[i].name); |
| 116 | if (syms[i] < data_size) | 263 | if (syms[i] < data_size) |
| 117 | fail("%s must be after the text mapping\n", | 264 | fail("%s must be after the text mapping\n", |
| 118 | required_syms[i]); | 265 | required_syms[i].name); |
| 119 | if (syms[sym_end_mapping] < syms[i] + 4096) | 266 | if (syms[sym_end_mapping] < syms[i] + 4096) |
| 120 | fail("%s overruns end_mapping\n", required_syms[i]); | 267 | fail("%s overruns end_mapping\n", |
| 268 | required_syms[i].name); | ||
| 121 | } | 269 | } |
| 122 | if (syms[sym_end_mapping] % 4096) | 270 | if (syms[sym_end_mapping] % 4096) |
| 123 | fail("end_mapping must be a multiple of 4096\n"); | 271 | fail("end_mapping must be a multiple of 4096\n"); |
| 124 | 272 | ||
| 125 | /* Remove sections or use fakes */ | ||
| 126 | if (fake_sections_size % sizeof(Elf_Shdr)) | ||
| 127 | fail("vdso_fake_sections size is not a multiple of %ld\n", | ||
| 128 | (long)sizeof(Elf_Shdr)); | ||
| 129 | PUT_LE(&hdr->e_shoff, fake_sections_value); | ||
| 130 | PUT_LE(&hdr->e_shentsize, fake_sections_value ? sizeof(Elf_Shdr) : 0); | ||
| 131 | PUT_LE(&hdr->e_shnum, fake_sections_size / sizeof(Elf_Shdr)); | ||
| 132 | PUT_LE(&hdr->e_shstrndx, SHN_UNDEF); | ||
| 133 | |||
| 134 | if (!name) { | 273 | if (!name) { |
| 135 | fwrite(addr, load_size, 1, outfile); | 274 | fwrite(addr, load_size, 1, outfile); |
| 136 | return; | 275 | return; |
| @@ -168,9 +307,9 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name) | |||
| 168 | (unsigned long)GET_LE(&alt_sec->sh_size)); | 307 | (unsigned long)GET_LE(&alt_sec->sh_size)); |
| 169 | } | 308 | } |
| 170 | for (i = 0; i < NSYMS; i++) { | 309 | for (i = 0; i < NSYMS; i++) { |
| 171 | if (syms[i]) | 310 | if (required_syms[i].export && syms[i]) |
| 172 | fprintf(outfile, "\t.sym_%s = 0x%" PRIx64 ",\n", | 311 | fprintf(outfile, "\t.sym_%s = 0x%" PRIx64 ",\n", |
| 173 | required_syms[i], syms[i]); | 312 | required_syms[i].name, syms[i]); |
| 174 | } | 313 | } |
| 175 | fprintf(outfile, "};\n"); | 314 | fprintf(outfile, "};\n"); |
| 176 | } | 315 | } |
diff --git a/arch/x86/vdso/vdso32/vdso-fakesections.c b/arch/x86/vdso/vdso32/vdso-fakesections.c new file mode 100644 index 000000000000..541468e25265 --- /dev/null +++ b/arch/x86/vdso/vdso32/vdso-fakesections.c | |||
| @@ -0,0 +1 @@ | |||
| #include "../vdso-fakesections.c" | |||
diff --git a/arch/x86/vdso/vdsox32.lds.S b/arch/x86/vdso/vdsox32.lds.S index 46b991b578a8..697c11ece90c 100644 --- a/arch/x86/vdso/vdsox32.lds.S +++ b/arch/x86/vdso/vdsox32.lds.S | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | * the DSO. | 6 | * the DSO. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #define BUILD_VDSOX32 | ||
| 10 | |||
| 9 | #include "vdso-layout.lds.S" | 11 | #include "vdso-layout.lds.S" |
| 10 | 12 | ||
| 11 | /* | 13 | /* |
diff --git a/block/bio.c b/block/bio.c index 8c2e55e39a1b..0ec61c9e536c 100644 --- a/block/bio.c +++ b/block/bio.c | |||
| @@ -746,6 +746,14 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page | |||
| 746 | 746 | ||
| 747 | goto done; | 747 | goto done; |
| 748 | } | 748 | } |
| 749 | |||
| 750 | /* | ||
| 751 | * If the queue doesn't support SG gaps and adding this | ||
| 752 | * offset would create a gap, disallow it. | ||
| 753 | */ | ||
| 754 | if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS) && | ||
| 755 | bvec_gap_to_prev(prev, offset)) | ||
| 756 | return 0; | ||
| 749 | } | 757 | } |
| 750 | 758 | ||
| 751 | if (bio->bi_vcnt >= bio->bi_max_vecs) | 759 | if (bio->bi_vcnt >= bio->bi_max_vecs) |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 069bc202ffe3..b9f4cc494ece 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
| @@ -80,7 +80,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct request_queue *q, | |||
| 80 | blkg->q = q; | 80 | blkg->q = q; |
| 81 | INIT_LIST_HEAD(&blkg->q_node); | 81 | INIT_LIST_HEAD(&blkg->q_node); |
| 82 | blkg->blkcg = blkcg; | 82 | blkg->blkcg = blkcg; |
| 83 | blkg->refcnt = 1; | 83 | atomic_set(&blkg->refcnt, 1); |
| 84 | 84 | ||
| 85 | /* root blkg uses @q->root_rl, init rl only for !root blkgs */ | 85 | /* root blkg uses @q->root_rl, init rl only for !root blkgs */ |
| 86 | if (blkcg != &blkcg_root) { | 86 | if (blkcg != &blkcg_root) { |
| @@ -399,11 +399,8 @@ void __blkg_release_rcu(struct rcu_head *rcu_head) | |||
| 399 | 399 | ||
| 400 | /* release the blkcg and parent blkg refs this blkg has been holding */ | 400 | /* release the blkcg and parent blkg refs this blkg has been holding */ |
| 401 | css_put(&blkg->blkcg->css); | 401 | css_put(&blkg->blkcg->css); |
| 402 | if (blkg->parent) { | 402 | if (blkg->parent) |
| 403 | spin_lock_irq(blkg->q->queue_lock); | ||
| 404 | blkg_put(blkg->parent); | 403 | blkg_put(blkg->parent); |
| 405 | spin_unlock_irq(blkg->q->queue_lock); | ||
| 406 | } | ||
| 407 | 404 | ||
| 408 | blkg_free(blkg); | 405 | blkg_free(blkg); |
| 409 | } | 406 | } |
| @@ -1093,7 +1090,7 @@ EXPORT_SYMBOL_GPL(blkcg_deactivate_policy); | |||
| 1093 | * Register @pol with blkcg core. Might sleep and @pol may be modified on | 1090 | * Register @pol with blkcg core. Might sleep and @pol may be modified on |
| 1094 | * successful registration. Returns 0 on success and -errno on failure. | 1091 | * successful registration. Returns 0 on success and -errno on failure. |
| 1095 | */ | 1092 | */ |
| 1096 | int __init blkcg_policy_register(struct blkcg_policy *pol) | 1093 | int blkcg_policy_register(struct blkcg_policy *pol) |
| 1097 | { | 1094 | { |
| 1098 | int i, ret; | 1095 | int i, ret; |
| 1099 | 1096 | ||
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h index cbb7f943f78a..d3fd7aa3d2a3 100644 --- a/block/blk-cgroup.h +++ b/block/blk-cgroup.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/seq_file.h> | 18 | #include <linux/seq_file.h> |
| 19 | #include <linux/radix-tree.h> | 19 | #include <linux/radix-tree.h> |
| 20 | #include <linux/blkdev.h> | 20 | #include <linux/blkdev.h> |
| 21 | #include <linux/atomic.h> | ||
| 21 | 22 | ||
| 22 | /* Max limits for throttle policy */ | 23 | /* Max limits for throttle policy */ |
| 23 | #define THROTL_IOPS_MAX UINT_MAX | 24 | #define THROTL_IOPS_MAX UINT_MAX |
| @@ -104,7 +105,7 @@ struct blkcg_gq { | |||
| 104 | struct request_list rl; | 105 | struct request_list rl; |
| 105 | 106 | ||
| 106 | /* reference count */ | 107 | /* reference count */ |
| 107 | int refcnt; | 108 | atomic_t refcnt; |
| 108 | 109 | ||
| 109 | /* is this blkg online? protected by both blkcg and q locks */ | 110 | /* is this blkg online? protected by both blkcg and q locks */ |
| 110 | bool online; | 111 | bool online; |
| @@ -145,7 +146,7 @@ void blkcg_drain_queue(struct request_queue *q); | |||
| 145 | void blkcg_exit_queue(struct request_queue *q); | 146 | void blkcg_exit_queue(struct request_queue *q); |
| 146 | 147 | ||
| 147 | /* Blkio controller policy registration */ | 148 | /* Blkio controller policy registration */ |
| 148 | int __init blkcg_policy_register(struct blkcg_policy *pol); | 149 | int blkcg_policy_register(struct blkcg_policy *pol); |
| 149 | void blkcg_policy_unregister(struct blkcg_policy *pol); | 150 | void blkcg_policy_unregister(struct blkcg_policy *pol); |
| 150 | int blkcg_activate_policy(struct request_queue *q, | 151 | int blkcg_activate_policy(struct request_queue *q, |
| 151 | const struct blkcg_policy *pol); | 152 | const struct blkcg_policy *pol); |
| @@ -257,13 +258,12 @@ static inline int blkg_path(struct blkcg_gq *blkg, char *buf, int buflen) | |||
| 257 | * blkg_get - get a blkg reference | 258 | * blkg_get - get a blkg reference |
| 258 | * @blkg: blkg to get | 259 | * @blkg: blkg to get |
| 259 | * | 260 | * |
| 260 | * The caller should be holding queue_lock and an existing reference. | 261 | * The caller should be holding an existing reference. |
| 261 | */ | 262 | */ |
| 262 | static inline void blkg_get(struct blkcg_gq *blkg) | 263 | static inline void blkg_get(struct blkcg_gq *blkg) |
| 263 | { | 264 | { |
| 264 | lockdep_assert_held(blkg->q->queue_lock); | 265 | WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0); |
| 265 | WARN_ON_ONCE(!blkg->refcnt); | 266 | atomic_inc(&blkg->refcnt); |
| 266 | blkg->refcnt++; | ||
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | void __blkg_release_rcu(struct rcu_head *rcu); | 269 | void __blkg_release_rcu(struct rcu_head *rcu); |
| @@ -271,14 +271,11 @@ void __blkg_release_rcu(struct rcu_head *rcu); | |||
| 271 | /** | 271 | /** |
| 272 | * blkg_put - put a blkg reference | 272 | * blkg_put - put a blkg reference |
| 273 | * @blkg: blkg to put | 273 | * @blkg: blkg to put |
| 274 | * | ||
| 275 | * The caller should be holding queue_lock. | ||
| 276 | */ | 274 | */ |
| 277 | static inline void blkg_put(struct blkcg_gq *blkg) | 275 | static inline void blkg_put(struct blkcg_gq *blkg) |
| 278 | { | 276 | { |
| 279 | lockdep_assert_held(blkg->q->queue_lock); | 277 | WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0); |
| 280 | WARN_ON_ONCE(blkg->refcnt <= 0); | 278 | if (atomic_dec_and_test(&blkg->refcnt)) |
| 281 | if (!--blkg->refcnt) | ||
| 282 | call_rcu(&blkg->rcu_head, __blkg_release_rcu); | 279 | call_rcu(&blkg->rcu_head, __blkg_release_rcu); |
| 283 | } | 280 | } |
| 284 | 281 | ||
| @@ -580,7 +577,7 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { ret | |||
| 580 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } | 577 | static inline int blkcg_init_queue(struct request_queue *q) { return 0; } |
| 581 | static inline void blkcg_drain_queue(struct request_queue *q) { } | 578 | static inline void blkcg_drain_queue(struct request_queue *q) { } |
| 582 | static inline void blkcg_exit_queue(struct request_queue *q) { } | 579 | static inline void blkcg_exit_queue(struct request_queue *q) { } |
| 583 | static inline int __init blkcg_policy_register(struct blkcg_policy *pol) { return 0; } | 580 | static inline int blkcg_policy_register(struct blkcg_policy *pol) { return 0; } |
| 584 | static inline void blkcg_policy_unregister(struct blkcg_policy *pol) { } | 581 | static inline void blkcg_policy_unregister(struct blkcg_policy *pol) { } |
| 585 | static inline int blkcg_activate_policy(struct request_queue *q, | 582 | static inline int blkcg_activate_policy(struct request_queue *q, |
| 586 | const struct blkcg_policy *pol) { return 0; } | 583 | const struct blkcg_policy *pol) { return 0; } |
diff --git a/block/blk-merge.c b/block/blk-merge.c index b3bf0df0f4c2..54535831f1e1 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
| @@ -568,6 +568,8 @@ int blk_attempt_req_merge(struct request_queue *q, struct request *rq, | |||
| 568 | 568 | ||
| 569 | bool blk_rq_merge_ok(struct request *rq, struct bio *bio) | 569 | bool blk_rq_merge_ok(struct request *rq, struct bio *bio) |
| 570 | { | 570 | { |
| 571 | struct request_queue *q = rq->q; | ||
| 572 | |||
| 571 | if (!rq_mergeable(rq) || !bio_mergeable(bio)) | 573 | if (!rq_mergeable(rq) || !bio_mergeable(bio)) |
| 572 | return false; | 574 | return false; |
| 573 | 575 | ||
| @@ -591,6 +593,14 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) | |||
| 591 | !blk_write_same_mergeable(rq->bio, bio)) | 593 | !blk_write_same_mergeable(rq->bio, bio)) |
| 592 | return false; | 594 | return false; |
| 593 | 595 | ||
| 596 | if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) { | ||
| 597 | struct bio_vec *bprev; | ||
| 598 | |||
| 599 | bprev = &rq->biotail->bi_io_vec[bio->bi_vcnt - 1]; | ||
| 600 | if (bvec_gap_to_prev(bprev, bio->bi_io_vec[0].bv_offset)) | ||
| 601 | return false; | ||
| 602 | } | ||
| 603 | |||
| 594 | return true; | 604 | return true; |
| 595 | } | 605 | } |
| 596 | 606 | ||
diff --git a/block/blk-mq.c b/block/blk-mq.c index 0ef2dc7f01bf..ad69ef657e85 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
| @@ -878,7 +878,7 @@ void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx) | |||
| 878 | clear_bit(BLK_MQ_S_STOPPED, &hctx->state); | 878 | clear_bit(BLK_MQ_S_STOPPED, &hctx->state); |
| 879 | 879 | ||
| 880 | preempt_disable(); | 880 | preempt_disable(); |
| 881 | __blk_mq_run_hw_queue(hctx); | 881 | blk_mq_run_hw_queue(hctx, false); |
| 882 | preempt_enable(); | 882 | preempt_enable(); |
| 883 | } | 883 | } |
| 884 | EXPORT_SYMBOL(blk_mq_start_hw_queue); | 884 | EXPORT_SYMBOL(blk_mq_start_hw_queue); |
diff --git a/block/elevator.c b/block/elevator.c index 34bded18910e..24c28b659bb3 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
| @@ -825,7 +825,7 @@ void elv_unregister_queue(struct request_queue *q) | |||
| 825 | } | 825 | } |
| 826 | EXPORT_SYMBOL(elv_unregister_queue); | 826 | EXPORT_SYMBOL(elv_unregister_queue); |
| 827 | 827 | ||
| 828 | int __init elv_register(struct elevator_type *e) | 828 | int elv_register(struct elevator_type *e) |
| 829 | { | 829 | { |
| 830 | char *def = ""; | 830 | char *def = ""; |
| 831 | 831 | ||
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index b6c8aaf4931b..5b17ec88ea05 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
| @@ -1337,8 +1337,11 @@ int drbd_submit_peer_request(struct drbd_device *device, | |||
| 1337 | return 0; | 1337 | return 0; |
| 1338 | } | 1338 | } |
| 1339 | 1339 | ||
| 1340 | /* Discards don't have any payload. | ||
| 1341 | * But the scsi layer still expects a bio_vec it can use internally, | ||
| 1342 | * see sd_setup_discard_cmnd() and blk_add_request_payload(). */ | ||
| 1340 | if (peer_req->flags & EE_IS_TRIM) | 1343 | if (peer_req->flags & EE_IS_TRIM) |
| 1341 | nr_pages = 0; /* discards don't have any payload. */ | 1344 | nr_pages = 1; |
| 1342 | 1345 | ||
| 1343 | /* In most cases, we will only need one bio. But in case the lower | 1346 | /* In most cases, we will only need one bio. But in case the lower |
| 1344 | * level restrictions happen to be different at this offset on this | 1347 | * level restrictions happen to be different at this offset on this |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 677db049f55a..56d46ffb08e1 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
| @@ -3777,7 +3777,7 @@ static void floppy_rb0_cb(struct bio *bio, int err) | |||
| 3777 | int drive = cbdata->drive; | 3777 | int drive = cbdata->drive; |
| 3778 | 3778 | ||
| 3779 | if (err) { | 3779 | if (err) { |
| 3780 | pr_info("floppy: error %d while reading block 0", err); | 3780 | pr_info("floppy: error %d while reading block 0\n", err); |
| 3781 | set_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); | 3781 | set_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); |
| 3782 | } | 3782 | } |
| 3783 | complete(&cbdata->complete); | 3783 | complete(&cbdata->complete); |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index bbeb404b3a07..b2c98c1bc037 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
| @@ -1431,6 +1431,14 @@ static bool obj_request_exists_test(struct rbd_obj_request *obj_request) | |||
| 1431 | return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0; | 1431 | return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0; |
| 1432 | } | 1432 | } |
| 1433 | 1433 | ||
| 1434 | static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request) | ||
| 1435 | { | ||
| 1436 | struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev; | ||
| 1437 | |||
| 1438 | return obj_request->img_offset < | ||
| 1439 | round_up(rbd_dev->parent_overlap, rbd_obj_bytes(&rbd_dev->header)); | ||
| 1440 | } | ||
| 1441 | |||
| 1434 | static void rbd_obj_request_get(struct rbd_obj_request *obj_request) | 1442 | static void rbd_obj_request_get(struct rbd_obj_request *obj_request) |
| 1435 | { | 1443 | { |
| 1436 | dout("%s: obj %p (was %d)\n", __func__, obj_request, | 1444 | dout("%s: obj %p (was %d)\n", __func__, obj_request, |
| @@ -2748,7 +2756,7 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request) | |||
| 2748 | */ | 2756 | */ |
| 2749 | if (!img_request_write_test(img_request) || | 2757 | if (!img_request_write_test(img_request) || |
| 2750 | !img_request_layered_test(img_request) || | 2758 | !img_request_layered_test(img_request) || |
| 2751 | rbd_dev->parent_overlap <= obj_request->img_offset || | 2759 | !obj_request_overlaps_parent(obj_request) || |
| 2752 | ((known = obj_request_known_test(obj_request)) && | 2760 | ((known = obj_request_known_test(obj_request)) && |
| 2753 | obj_request_exists_test(obj_request))) { | 2761 | obj_request_exists_test(obj_request))) { |
| 2754 | 2762 | ||
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 48eccb350180..089e72cd37be 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
| @@ -622,8 +622,10 @@ static void zram_reset_device(struct zram *zram, bool reset_capacity) | |||
| 622 | memset(&zram->stats, 0, sizeof(zram->stats)); | 622 | memset(&zram->stats, 0, sizeof(zram->stats)); |
| 623 | 623 | ||
| 624 | zram->disksize = 0; | 624 | zram->disksize = 0; |
| 625 | if (reset_capacity) | 625 | if (reset_capacity) { |
| 626 | set_capacity(zram->disk, 0); | 626 | set_capacity(zram->disk, 0); |
| 627 | revalidate_disk(zram->disk); | ||
| 628 | } | ||
| 627 | up_write(&zram->init_lock); | 629 | up_write(&zram->init_lock); |
| 628 | } | 630 | } |
| 629 | 631 | ||
| @@ -664,6 +666,7 @@ static ssize_t disksize_store(struct device *dev, | |||
| 664 | zram->comp = comp; | 666 | zram->comp = comp; |
| 665 | zram->disksize = disksize; | 667 | zram->disksize = disksize; |
| 666 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); | 668 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); |
| 669 | revalidate_disk(zram->disk); | ||
| 667 | up_write(&zram->init_lock); | 670 | up_write(&zram->init_lock); |
| 668 | return len; | 671 | return len; |
| 669 | 672 | ||
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 8d6420013a04..f71d55f5e6e5 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c | |||
| @@ -153,13 +153,10 @@ static void exynos4_mct_write(unsigned int value, unsigned long offset) | |||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | /* Clocksource handling */ | 155 | /* Clocksource handling */ |
| 156 | static void exynos4_mct_frc_start(u32 hi, u32 lo) | 156 | static void exynos4_mct_frc_start(void) |
| 157 | { | 157 | { |
| 158 | u32 reg; | 158 | u32 reg; |
| 159 | 159 | ||
| 160 | exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); | ||
| 161 | exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); | ||
| 162 | |||
| 163 | reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); | 160 | reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); |
| 164 | reg |= MCT_G_TCON_START; | 161 | reg |= MCT_G_TCON_START; |
| 165 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); | 162 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); |
| @@ -181,7 +178,7 @@ static cycle_t exynos4_frc_read(struct clocksource *cs) | |||
| 181 | 178 | ||
| 182 | static void exynos4_frc_resume(struct clocksource *cs) | 179 | static void exynos4_frc_resume(struct clocksource *cs) |
| 183 | { | 180 | { |
| 184 | exynos4_mct_frc_start(0, 0); | 181 | exynos4_mct_frc_start(); |
| 185 | } | 182 | } |
| 186 | 183 | ||
| 187 | struct clocksource mct_frc = { | 184 | struct clocksource mct_frc = { |
| @@ -200,7 +197,7 @@ static u64 notrace exynos4_read_sched_clock(void) | |||
| 200 | 197 | ||
| 201 | static void __init exynos4_clocksource_init(void) | 198 | static void __init exynos4_clocksource_init(void) |
| 202 | { | 199 | { |
| 203 | exynos4_mct_frc_start(0, 0); | 200 | exynos4_mct_frc_start(); |
| 204 | 201 | ||
| 205 | if (clocksource_register_hz(&mct_frc, clk_rate)) | 202 | if (clocksource_register_hz(&mct_frc, clk_rate)) |
| 206 | panic("%s: can't register clocksource\n", mct_frc.name); | 203 | panic("%s: can't register clocksource\n", mct_frc.name); |
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 4b9dc836dcf9..e992abc5ef26 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c | |||
| @@ -40,7 +40,7 @@ struct pstore_read_data { | |||
| 40 | static inline u64 generic_id(unsigned long timestamp, | 40 | static inline u64 generic_id(unsigned long timestamp, |
| 41 | unsigned int part, int count) | 41 | unsigned int part, int count) |
| 42 | { | 42 | { |
| 43 | return (timestamp * 100 + part) * 1000 + count; | 43 | return ((u64) timestamp * 100 + part) * 1000 + count; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | 46 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) |
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index cd36deb619fa..eff1a2f22f09 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
| @@ -353,10 +353,10 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, | |||
| 353 | int depth, void *data) | 353 | int depth, void *data) |
| 354 | { | 354 | { |
| 355 | struct param_info *info = data; | 355 | struct param_info *info = data; |
| 356 | void *prop, *dest; | 356 | const void *prop; |
| 357 | unsigned long len; | 357 | void *dest; |
| 358 | u64 val; | 358 | u64 val; |
| 359 | int i; | 359 | int i, len; |
| 360 | 360 | ||
| 361 | if (depth != 1 || | 361 | if (depth != 1 || |
| 362 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) | 362 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) |
diff --git a/drivers/firmware/efi/fdt.c b/drivers/firmware/efi/fdt.c index 5c6a8e8a9580..82d774161cc9 100644 --- a/drivers/firmware/efi/fdt.c +++ b/drivers/firmware/efi/fdt.c | |||
| @@ -63,7 +63,7 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
| 63 | */ | 63 | */ |
| 64 | prev = 0; | 64 | prev = 0; |
| 65 | for (;;) { | 65 | for (;;) { |
| 66 | const char *type, *name; | 66 | const char *type; |
| 67 | int len; | 67 | int len; |
| 68 | 68 | ||
| 69 | node = fdt_next_node(fdt, prev, NULL); | 69 | node = fdt_next_node(fdt, prev, NULL); |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 03711d00aaae..8218078b6133 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
| @@ -419,8 +419,9 @@ long drm_ioctl(struct file *filp, | |||
| 419 | retcode = -EFAULT; | 419 | retcode = -EFAULT; |
| 420 | goto err_i1; | 420 | goto err_i1; |
| 421 | } | 421 | } |
| 422 | } else | 422 | } else if (cmd & IOC_OUT) { |
| 423 | memset(kdata, 0, usize); | 423 | memset(kdata, 0, usize); |
| 424 | } | ||
| 424 | 425 | ||
| 425 | if (ioctl->flags & DRM_UNLOCKED) | 426 | if (ioctl->flags & DRM_UNLOCKED) |
| 426 | retcode = func(dev, kdata, file_priv); | 427 | retcode = func(dev, kdata, file_priv); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 482127f633c5..9e530f205ad2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c | |||
| @@ -40,7 +40,7 @@ exynos_dpi_detect(struct drm_connector *connector, bool force) | |||
| 40 | { | 40 | { |
| 41 | struct exynos_dpi *ctx = connector_to_dpi(connector); | 41 | struct exynos_dpi *ctx = connector_to_dpi(connector); |
| 42 | 42 | ||
| 43 | if (!ctx->panel->connector) | 43 | if (ctx->panel && !ctx->panel->connector) |
| 44 | drm_panel_attach(ctx->panel, &ctx->connector); | 44 | drm_panel_attach(ctx->panel, &ctx->connector); |
| 45 | 45 | ||
| 46 | return connector_status_connected; | 46 | return connector_status_connected; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index d91f27777537..ab7d182063c3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
| @@ -765,24 +765,24 @@ static int exynos_drm_init(void) | |||
| 765 | 765 | ||
| 766 | return 0; | 766 | return 0; |
| 767 | 767 | ||
| 768 | err_unregister_pd: | ||
| 769 | platform_device_unregister(exynos_drm_pdev); | ||
| 770 | |||
| 771 | err_remove_vidi: | 768 | err_remove_vidi: |
| 772 | #ifdef CONFIG_DRM_EXYNOS_VIDI | 769 | #ifdef CONFIG_DRM_EXYNOS_VIDI |
| 773 | exynos_drm_remove_vidi(); | 770 | exynos_drm_remove_vidi(); |
| 771 | |||
| 772 | err_unregister_pd: | ||
| 774 | #endif | 773 | #endif |
| 774 | platform_device_unregister(exynos_drm_pdev); | ||
| 775 | 775 | ||
| 776 | return ret; | 776 | return ret; |
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | static void exynos_drm_exit(void) | 779 | static void exynos_drm_exit(void) |
| 780 | { | 780 | { |
| 781 | platform_driver_unregister(&exynos_drm_platform_driver); | ||
| 781 | #ifdef CONFIG_DRM_EXYNOS_VIDI | 782 | #ifdef CONFIG_DRM_EXYNOS_VIDI |
| 782 | exynos_drm_remove_vidi(); | 783 | exynos_drm_remove_vidi(); |
| 783 | #endif | 784 | #endif |
| 784 | platform_device_unregister(exynos_drm_pdev); | 785 | platform_device_unregister(exynos_drm_pdev); |
| 785 | platform_driver_unregister(&exynos_drm_platform_driver); | ||
| 786 | } | 786 | } |
| 787 | 787 | ||
| 788 | module_init(exynos_drm_init); | 788 | module_init(exynos_drm_init); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 36535f398848..06cde4506278 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
| @@ -343,7 +343,7 @@ struct exynos_drm_display * exynos_dpi_probe(struct device *dev); | |||
| 343 | int exynos_dpi_remove(struct device *dev); | 343 | int exynos_dpi_remove(struct device *dev); |
| 344 | #else | 344 | #else |
| 345 | static inline struct exynos_drm_display * | 345 | static inline struct exynos_drm_display * |
| 346 | exynos_dpi_probe(struct device *dev) { return 0; } | 346 | exynos_dpi_probe(struct device *dev) { return NULL; } |
| 347 | static inline int exynos_dpi_remove(struct device *dev) { return 0; } | 347 | static inline int exynos_dpi_remove(struct device *dev) { return 0; } |
| 348 | #endif | 348 | #endif |
| 349 | 349 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index bb45ab2e7384..33161ad38201 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
| @@ -741,6 +741,8 @@ static void fimd_apply(struct exynos_drm_manager *mgr) | |||
| 741 | win_data = &ctx->win_data[i]; | 741 | win_data = &ctx->win_data[i]; |
| 742 | if (win_data->enabled) | 742 | if (win_data->enabled) |
| 743 | fimd_win_commit(mgr, i); | 743 | fimd_win_commit(mgr, i); |
| 744 | else | ||
| 745 | fimd_win_disable(mgr, i); | ||
| 744 | } | 746 | } |
| 745 | 747 | ||
| 746 | fimd_commit(mgr); | 748 | fimd_commit(mgr); |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index c104d0c9b385..aa259b0a873a 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
| @@ -2090,6 +2090,11 @@ out: | |||
| 2090 | 2090 | ||
| 2091 | static void hdmi_dpms(struct exynos_drm_display *display, int mode) | 2091 | static void hdmi_dpms(struct exynos_drm_display *display, int mode) |
| 2092 | { | 2092 | { |
| 2093 | struct hdmi_context *hdata = display->ctx; | ||
| 2094 | struct drm_encoder *encoder = hdata->encoder; | ||
| 2095 | struct drm_crtc *crtc = encoder->crtc; | ||
| 2096 | struct drm_crtc_helper_funcs *funcs = NULL; | ||
| 2097 | |||
| 2093 | DRM_DEBUG_KMS("mode %d\n", mode); | 2098 | DRM_DEBUG_KMS("mode %d\n", mode); |
| 2094 | 2099 | ||
| 2095 | switch (mode) { | 2100 | switch (mode) { |
| @@ -2099,6 +2104,20 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode) | |||
| 2099 | case DRM_MODE_DPMS_STANDBY: | 2104 | case DRM_MODE_DPMS_STANDBY: |
| 2100 | case DRM_MODE_DPMS_SUSPEND: | 2105 | case DRM_MODE_DPMS_SUSPEND: |
| 2101 | case DRM_MODE_DPMS_OFF: | 2106 | case DRM_MODE_DPMS_OFF: |
| 2107 | /* | ||
| 2108 | * The SFRs of VP and Mixer are updated by Vertical Sync of | ||
| 2109 | * Timing generator which is a part of HDMI so the sequence | ||
| 2110 | * to disable TV Subsystem should be as following, | ||
| 2111 | * VP -> Mixer -> HDMI | ||
| 2112 | * | ||
| 2113 | * Below codes will try to disable Mixer and VP(if used) | ||
| 2114 | * prior to disabling HDMI. | ||
| 2115 | */ | ||
| 2116 | if (crtc) | ||
| 2117 | funcs = crtc->helper_private; | ||
| 2118 | if (funcs && funcs->dpms) | ||
| 2119 | (*funcs->dpms)(crtc, mode); | ||
| 2120 | |||
| 2102 | hdmi_poweroff(display); | 2121 | hdmi_poweroff(display); |
| 2103 | break; | 2122 | break; |
| 2104 | default: | 2123 | default: |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4c5aed7e54c8..7529946d0a74 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
| @@ -377,6 +377,20 @@ static void mixer_run(struct mixer_context *ctx) | |||
| 377 | mixer_regs_dump(ctx); | 377 | mixer_regs_dump(ctx); |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | static void mixer_stop(struct mixer_context *ctx) | ||
| 381 | { | ||
| 382 | struct mixer_resources *res = &ctx->mixer_res; | ||
| 383 | int timeout = 20; | ||
| 384 | |||
| 385 | mixer_reg_writemask(res, MXR_STATUS, 0, MXR_STATUS_REG_RUN); | ||
| 386 | |||
| 387 | while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && | ||
| 388 | --timeout) | ||
| 389 | usleep_range(10000, 12000); | ||
| 390 | |||
| 391 | mixer_regs_dump(ctx); | ||
| 392 | } | ||
| 393 | |||
| 380 | static void vp_video_buffer(struct mixer_context *ctx, int win) | 394 | static void vp_video_buffer(struct mixer_context *ctx, int win) |
| 381 | { | 395 | { |
| 382 | struct mixer_resources *res = &ctx->mixer_res; | 396 | struct mixer_resources *res = &ctx->mixer_res; |
| @@ -497,13 +511,8 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
| 497 | static void mixer_layer_update(struct mixer_context *ctx) | 511 | static void mixer_layer_update(struct mixer_context *ctx) |
| 498 | { | 512 | { |
| 499 | struct mixer_resources *res = &ctx->mixer_res; | 513 | struct mixer_resources *res = &ctx->mixer_res; |
| 500 | u32 val; | ||
| 501 | |||
| 502 | val = mixer_reg_read(res, MXR_CFG); | ||
| 503 | 514 | ||
| 504 | /* allow one update per vsync only */ | 515 | mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE); |
| 505 | if (!(val & MXR_CFG_LAYER_UPDATE_COUNT_MASK)) | ||
| 506 | mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE); | ||
| 507 | } | 516 | } |
| 508 | 517 | ||
| 509 | static void mixer_graph_buffer(struct mixer_context *ctx, int win) | 518 | static void mixer_graph_buffer(struct mixer_context *ctx, int win) |
| @@ -1010,6 +1019,8 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) | |||
| 1010 | } | 1019 | } |
| 1011 | mutex_unlock(&mixer_ctx->mixer_mutex); | 1020 | mutex_unlock(&mixer_ctx->mixer_mutex); |
| 1012 | 1021 | ||
| 1022 | drm_vblank_get(mgr->crtc->dev, mixer_ctx->pipe); | ||
| 1023 | |||
| 1013 | atomic_set(&mixer_ctx->wait_vsync_event, 1); | 1024 | atomic_set(&mixer_ctx->wait_vsync_event, 1); |
| 1014 | 1025 | ||
| 1015 | /* | 1026 | /* |
| @@ -1020,6 +1031,8 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) | |||
| 1020 | !atomic_read(&mixer_ctx->wait_vsync_event), | 1031 | !atomic_read(&mixer_ctx->wait_vsync_event), |
| 1021 | HZ/20)) | 1032 | HZ/20)) |
| 1022 | DRM_DEBUG_KMS("vblank wait timed out.\n"); | 1033 | DRM_DEBUG_KMS("vblank wait timed out.\n"); |
| 1034 | |||
| 1035 | drm_vblank_put(mgr->crtc->dev, mixer_ctx->pipe); | ||
| 1023 | } | 1036 | } |
| 1024 | 1037 | ||
| 1025 | static void mixer_window_suspend(struct exynos_drm_manager *mgr) | 1038 | static void mixer_window_suspend(struct exynos_drm_manager *mgr) |
| @@ -1061,7 +1074,7 @@ static void mixer_poweron(struct exynos_drm_manager *mgr) | |||
| 1061 | mutex_unlock(&ctx->mixer_mutex); | 1074 | mutex_unlock(&ctx->mixer_mutex); |
| 1062 | return; | 1075 | return; |
| 1063 | } | 1076 | } |
| 1064 | ctx->powered = true; | 1077 | |
| 1065 | mutex_unlock(&ctx->mixer_mutex); | 1078 | mutex_unlock(&ctx->mixer_mutex); |
| 1066 | 1079 | ||
| 1067 | pm_runtime_get_sync(ctx->dev); | 1080 | pm_runtime_get_sync(ctx->dev); |
| @@ -1072,6 +1085,12 @@ static void mixer_poweron(struct exynos_drm_manager *mgr) | |||
| 1072 | clk_prepare_enable(res->sclk_mixer); | 1085 | clk_prepare_enable(res->sclk_mixer); |
| 1073 | } | 1086 | } |
| 1074 | 1087 | ||
| 1088 | mutex_lock(&ctx->mixer_mutex); | ||
| 1089 | ctx->powered = true; | ||
| 1090 | mutex_unlock(&ctx->mixer_mutex); | ||
| 1091 | |||
| 1092 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET); | ||
| 1093 | |||
| 1075 | mixer_reg_write(res, MXR_INT_EN, ctx->int_en); | 1094 | mixer_reg_write(res, MXR_INT_EN, ctx->int_en); |
| 1076 | mixer_win_reset(ctx); | 1095 | mixer_win_reset(ctx); |
| 1077 | 1096 | ||
| @@ -1084,14 +1103,21 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) | |||
| 1084 | struct mixer_resources *res = &ctx->mixer_res; | 1103 | struct mixer_resources *res = &ctx->mixer_res; |
| 1085 | 1104 | ||
| 1086 | mutex_lock(&ctx->mixer_mutex); | 1105 | mutex_lock(&ctx->mixer_mutex); |
| 1087 | if (!ctx->powered) | 1106 | if (!ctx->powered) { |
| 1088 | goto out; | 1107 | mutex_unlock(&ctx->mixer_mutex); |
| 1108 | return; | ||
| 1109 | } | ||
| 1089 | mutex_unlock(&ctx->mixer_mutex); | 1110 | mutex_unlock(&ctx->mixer_mutex); |
| 1090 | 1111 | ||
| 1112 | mixer_stop(ctx); | ||
| 1091 | mixer_window_suspend(mgr); | 1113 | mixer_window_suspend(mgr); |
| 1092 | 1114 | ||
| 1093 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); | 1115 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); |
| 1094 | 1116 | ||
| 1117 | mutex_lock(&ctx->mixer_mutex); | ||
| 1118 | ctx->powered = false; | ||
| 1119 | mutex_unlock(&ctx->mixer_mutex); | ||
| 1120 | |||
| 1095 | clk_disable_unprepare(res->mixer); | 1121 | clk_disable_unprepare(res->mixer); |
| 1096 | if (ctx->vp_enabled) { | 1122 | if (ctx->vp_enabled) { |
| 1097 | clk_disable_unprepare(res->vp); | 1123 | clk_disable_unprepare(res->vp); |
| @@ -1099,12 +1125,6 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) | |||
| 1099 | } | 1125 | } |
| 1100 | 1126 | ||
| 1101 | pm_runtime_put_sync(ctx->dev); | 1127 | pm_runtime_put_sync(ctx->dev); |
| 1102 | |||
| 1103 | mutex_lock(&ctx->mixer_mutex); | ||
| 1104 | ctx->powered = false; | ||
| 1105 | |||
| 1106 | out: | ||
| 1107 | mutex_unlock(&ctx->mixer_mutex); | ||
| 1108 | } | 1128 | } |
| 1109 | 1129 | ||
| 1110 | static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) | 1130 | static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) |
diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h index 4537026bc385..5f32e1a29411 100644 --- a/drivers/gpu/drm/exynos/regs-mixer.h +++ b/drivers/gpu/drm/exynos/regs-mixer.h | |||
| @@ -78,6 +78,7 @@ | |||
| 78 | #define MXR_STATUS_BIG_ENDIAN (1 << 3) | 78 | #define MXR_STATUS_BIG_ENDIAN (1 << 3) |
| 79 | #define MXR_STATUS_ENDIAN_MASK (1 << 3) | 79 | #define MXR_STATUS_ENDIAN_MASK (1 << 3) |
| 80 | #define MXR_STATUS_SYNC_ENABLE (1 << 2) | 80 | #define MXR_STATUS_SYNC_ENABLE (1 << 2) |
| 81 | #define MXR_STATUS_REG_IDLE (1 << 1) | ||
| 81 | #define MXR_STATUS_REG_RUN (1 << 0) | 82 | #define MXR_STATUS_REG_RUN (1 << 0) |
| 82 | 83 | ||
| 83 | /* bits for MXR_CFG */ | 84 | /* bits for MXR_CFG */ |
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 240c331405b9..ac357b02bd35 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c | |||
| @@ -810,6 +810,12 @@ static int | |||
| 810 | tda998x_encoder_mode_valid(struct drm_encoder *encoder, | 810 | tda998x_encoder_mode_valid(struct drm_encoder *encoder, |
| 811 | struct drm_display_mode *mode) | 811 | struct drm_display_mode *mode) |
| 812 | { | 812 | { |
| 813 | if (mode->clock > 150000) | ||
| 814 | return MODE_CLOCK_HIGH; | ||
| 815 | if (mode->htotal >= BIT(13)) | ||
| 816 | return MODE_BAD_HVALUE; | ||
| 817 | if (mode->vtotal >= BIT(11)) | ||
| 818 | return MODE_BAD_VVALUE; | ||
| 813 | return MODE_OK; | 819 | return MODE_OK; |
| 814 | } | 820 | } |
| 815 | 821 | ||
| @@ -1048,8 +1054,8 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, int blk) | |||
| 1048 | return i; | 1054 | return i; |
| 1049 | } | 1055 | } |
| 1050 | } else { | 1056 | } else { |
| 1051 | for (i = 10; i > 0; i--) { | 1057 | for (i = 100; i > 0; i--) { |
| 1052 | msleep(10); | 1058 | msleep(1); |
| 1053 | ret = reg_read(priv, REG_INT_FLAGS_2); | 1059 | ret = reg_read(priv, REG_INT_FLAGS_2); |
| 1054 | if (ret < 0) | 1060 | if (ret < 0) |
| 1055 | return ret; | 1061 | return ret; |
| @@ -1183,7 +1189,6 @@ static void | |||
| 1183 | tda998x_encoder_destroy(struct drm_encoder *encoder) | 1189 | tda998x_encoder_destroy(struct drm_encoder *encoder) |
| 1184 | { | 1190 | { |
| 1185 | struct tda998x_priv *priv = to_tda998x_priv(encoder); | 1191 | struct tda998x_priv *priv = to_tda998x_priv(encoder); |
| 1186 | drm_i2c_encoder_destroy(encoder); | ||
| 1187 | 1192 | ||
| 1188 | /* disable all IRQs and free the IRQ handler */ | 1193 | /* disable all IRQs and free the IRQ handler */ |
| 1189 | cec_write(priv, REG_CEC_RXSHPDINTENA, 0); | 1194 | cec_write(priv, REG_CEC_RXSHPDINTENA, 0); |
| @@ -1193,6 +1198,7 @@ tda998x_encoder_destroy(struct drm_encoder *encoder) | |||
| 1193 | 1198 | ||
| 1194 | if (priv->cec) | 1199 | if (priv->cec) |
| 1195 | i2c_unregister_device(priv->cec); | 1200 | i2c_unregister_device(priv->cec); |
| 1201 | drm_i2c_encoder_destroy(encoder); | ||
| 1196 | kfree(priv); | 1202 | kfree(priv); |
| 1197 | } | 1203 | } |
| 1198 | 1204 | ||
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 601caa88c092..b8c689202c40 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
| @@ -446,7 +446,9 @@ static int i915_gem_object_info(struct seq_file *m, void* data) | |||
| 446 | 446 | ||
| 447 | memset(&stats, 0, sizeof(stats)); | 447 | memset(&stats, 0, sizeof(stats)); |
| 448 | stats.file_priv = file->driver_priv; | 448 | stats.file_priv = file->driver_priv; |
| 449 | spin_lock(&file->table_lock); | ||
| 449 | idr_for_each(&file->object_idr, per_file_stats, &stats); | 450 | idr_for_each(&file->object_idr, per_file_stats, &stats); |
| 451 | spin_unlock(&file->table_lock); | ||
| 450 | /* | 452 | /* |
| 451 | * Although we have a valid reference on file->pid, that does | 453 | * Although we have a valid reference on file->pid, that does |
| 452 | * not guarantee that the task_struct who called get_pid() is | 454 | * not guarantee that the task_struct who called get_pid() is |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 49414d30e8d4..a47fbf60b781 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
| @@ -977,6 +977,8 @@ struct i915_power_well { | |||
| 977 | bool always_on; | 977 | bool always_on; |
| 978 | /* power well enable/disable usage count */ | 978 | /* power well enable/disable usage count */ |
| 979 | int count; | 979 | int count; |
| 980 | /* cached hw enabled state */ | ||
| 981 | bool hw_enabled; | ||
| 980 | unsigned long domains; | 982 | unsigned long domains; |
| 981 | unsigned long data; | 983 | unsigned long data; |
| 982 | const struct i915_power_well_ops *ops; | 984 | const struct i915_power_well_ops *ops; |
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 3ffe308d5893..a5ddf3bce9c3 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c | |||
| @@ -598,6 +598,7 @@ static int do_switch(struct intel_engine_cs *ring, | |||
| 598 | struct intel_context *from = ring->last_context; | 598 | struct intel_context *from = ring->last_context; |
| 599 | struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); | 599 | struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); |
| 600 | u32 hw_flags = 0; | 600 | u32 hw_flags = 0; |
| 601 | bool uninitialized = false; | ||
| 601 | int ret, i; | 602 | int ret, i; |
| 602 | 603 | ||
| 603 | if (from != NULL && ring == &dev_priv->ring[RCS]) { | 604 | if (from != NULL && ring == &dev_priv->ring[RCS]) { |
| @@ -696,19 +697,20 @@ static int do_switch(struct intel_engine_cs *ring, | |||
| 696 | i915_gem_context_unreference(from); | 697 | i915_gem_context_unreference(from); |
| 697 | } | 698 | } |
| 698 | 699 | ||
| 700 | uninitialized = !to->is_initialized && from == NULL; | ||
| 701 | to->is_initialized = true; | ||
| 702 | |||
| 699 | done: | 703 | done: |
| 700 | i915_gem_context_reference(to); | 704 | i915_gem_context_reference(to); |
| 701 | ring->last_context = to; | 705 | ring->last_context = to; |
| 702 | to->last_ring = ring; | 706 | to->last_ring = ring; |
| 703 | 707 | ||
| 704 | if (ring->id == RCS && !to->is_initialized && from == NULL) { | 708 | if (uninitialized) { |
| 705 | ret = i915_gem_render_state_init(ring); | 709 | ret = i915_gem_render_state_init(ring); |
| 706 | if (ret) | 710 | if (ret) |
| 707 | DRM_ERROR("init render state: %d\n", ret); | 711 | DRM_ERROR("init render state: %d\n", ret); |
| 708 | } | 712 | } |
| 709 | 713 | ||
| 710 | to->is_initialized = true; | ||
| 711 | |||
| 712 | return 0; | 714 | return 0; |
| 713 | 715 | ||
| 714 | unpin_out: | 716 | unpin_out: |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 1ee98f121a00..827498e081df 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
| @@ -315,9 +315,6 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb) | |||
| 315 | const struct bdb_lfp_backlight_data *backlight_data; | 315 | const struct bdb_lfp_backlight_data *backlight_data; |
| 316 | const struct bdb_lfp_backlight_data_entry *entry; | 316 | const struct bdb_lfp_backlight_data_entry *entry; |
| 317 | 317 | ||
| 318 | /* Err to enabling backlight if no backlight block. */ | ||
| 319 | dev_priv->vbt.backlight.present = true; | ||
| 320 | |||
| 321 | backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); | 318 | backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); |
| 322 | if (!backlight_data) | 319 | if (!backlight_data) |
| 323 | return; | 320 | return; |
| @@ -1088,6 +1085,9 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) | |||
| 1088 | 1085 | ||
| 1089 | dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC; | 1086 | dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC; |
| 1090 | 1087 | ||
| 1088 | /* Default to having backlight */ | ||
| 1089 | dev_priv->vbt.backlight.present = true; | ||
| 1090 | |||
| 1091 | /* LFP panel data */ | 1091 | /* LFP panel data */ |
| 1092 | dev_priv->vbt.lvds_dither = 1; | 1092 | dev_priv->vbt.lvds_dither = 1; |
| 1093 | dev_priv->vbt.lvds_vbt = 0; | 1093 | dev_priv->vbt.lvds_vbt = 0; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index efd3cf50cb0f..556c916dbf9d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -2087,6 +2087,7 @@ void intel_flush_primary_plane(struct drm_i915_private *dev_priv, | |||
| 2087 | static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, | 2087 | static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, |
| 2088 | enum plane plane, enum pipe pipe) | 2088 | enum plane plane, enum pipe pipe) |
| 2089 | { | 2089 | { |
| 2090 | struct drm_device *dev = dev_priv->dev; | ||
| 2090 | struct intel_crtc *intel_crtc = | 2091 | struct intel_crtc *intel_crtc = |
| 2091 | to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); | 2092 | to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); |
| 2092 | int reg; | 2093 | int reg; |
| @@ -2106,6 +2107,14 @@ static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, | |||
| 2106 | 2107 | ||
| 2107 | I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); | 2108 | I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); |
| 2108 | intel_flush_primary_plane(dev_priv, plane); | 2109 | intel_flush_primary_plane(dev_priv, plane); |
| 2110 | |||
| 2111 | /* | ||
| 2112 | * BDW signals flip done immediately if the plane | ||
| 2113 | * is disabled, even if the plane enable is already | ||
| 2114 | * armed to occur at the next vblank :( | ||
| 2115 | */ | ||
| 2116 | if (IS_BROADWELL(dev)) | ||
| 2117 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
| 2109 | } | 2118 | } |
| 2110 | 2119 | ||
| 2111 | /** | 2120 | /** |
| @@ -4564,7 +4573,10 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) | |||
| 4564 | if (intel_crtc->active) | 4573 | if (intel_crtc->active) |
| 4565 | return; | 4574 | return; |
| 4566 | 4575 | ||
| 4567 | vlv_prepare_pll(intel_crtc); | 4576 | is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI); |
| 4577 | |||
| 4578 | if (!is_dsi && !IS_CHERRYVIEW(dev)) | ||
| 4579 | vlv_prepare_pll(intel_crtc); | ||
| 4568 | 4580 | ||
| 4569 | /* Set up the display plane register */ | 4581 | /* Set up the display plane register */ |
| 4570 | dspcntr = DISPPLANE_GAMMA_ENABLE; | 4582 | dspcntr = DISPPLANE_GAMMA_ENABLE; |
| @@ -4598,8 +4610,6 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) | |||
| 4598 | if (encoder->pre_pll_enable) | 4610 | if (encoder->pre_pll_enable) |
| 4599 | encoder->pre_pll_enable(encoder); | 4611 | encoder->pre_pll_enable(encoder); |
| 4600 | 4612 | ||
| 4601 | is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI); | ||
| 4602 | |||
| 4603 | if (!is_dsi) { | 4613 | if (!is_dsi) { |
| 4604 | if (IS_CHERRYVIEW(dev)) | 4614 | if (IS_CHERRYVIEW(dev)) |
| 4605 | chv_enable_pll(intel_crtc); | 4615 | chv_enable_pll(intel_crtc); |
| @@ -11087,6 +11097,22 @@ const char *intel_output_name(int output) | |||
| 11087 | return names[output]; | 11097 | return names[output]; |
| 11088 | } | 11098 | } |
| 11089 | 11099 | ||
| 11100 | static bool intel_crt_present(struct drm_device *dev) | ||
| 11101 | { | ||
| 11102 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 11103 | |||
| 11104 | if (IS_ULT(dev)) | ||
| 11105 | return false; | ||
| 11106 | |||
| 11107 | if (IS_CHERRYVIEW(dev)) | ||
| 11108 | return false; | ||
| 11109 | |||
| 11110 | if (IS_VALLEYVIEW(dev) && !dev_priv->vbt.int_crt_support) | ||
| 11111 | return false; | ||
| 11112 | |||
| 11113 | return true; | ||
| 11114 | } | ||
| 11115 | |||
| 11090 | static void intel_setup_outputs(struct drm_device *dev) | 11116 | static void intel_setup_outputs(struct drm_device *dev) |
| 11091 | { | 11117 | { |
| 11092 | struct drm_i915_private *dev_priv = dev->dev_private; | 11118 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -11095,7 +11121,7 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
| 11095 | 11121 | ||
| 11096 | intel_lvds_init(dev); | 11122 | intel_lvds_init(dev); |
| 11097 | 11123 | ||
| 11098 | if (!IS_ULT(dev) && !IS_CHERRYVIEW(dev) && dev_priv->vbt.int_crt_support) | 11124 | if (intel_crt_present(dev)) |
| 11099 | intel_crt_init(dev); | 11125 | intel_crt_init(dev); |
| 11100 | 11126 | ||
| 11101 | if (HAS_DDI(dev)) { | 11127 | if (HAS_DDI(dev)) { |
| @@ -12411,8 +12437,8 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
| 12411 | 12437 | ||
| 12412 | for_each_pipe(i) { | 12438 | for_each_pipe(i) { |
| 12413 | error->pipe[i].power_domain_on = | 12439 | error->pipe[i].power_domain_on = |
| 12414 | intel_display_power_enabled_sw(dev_priv, | 12440 | intel_display_power_enabled_unlocked(dev_priv, |
| 12415 | POWER_DOMAIN_PIPE(i)); | 12441 | POWER_DOMAIN_PIPE(i)); |
| 12416 | if (!error->pipe[i].power_domain_on) | 12442 | if (!error->pipe[i].power_domain_on) |
| 12417 | continue; | 12443 | continue; |
| 12418 | 12444 | ||
| @@ -12447,7 +12473,7 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
| 12447 | enum transcoder cpu_transcoder = transcoders[i]; | 12473 | enum transcoder cpu_transcoder = transcoders[i]; |
| 12448 | 12474 | ||
| 12449 | error->transcoder[i].power_domain_on = | 12475 | error->transcoder[i].power_domain_on = |
| 12450 | intel_display_power_enabled_sw(dev_priv, | 12476 | intel_display_power_enabled_unlocked(dev_priv, |
| 12451 | POWER_DOMAIN_TRANSCODER(cpu_transcoder)); | 12477 | POWER_DOMAIN_TRANSCODER(cpu_transcoder)); |
| 12452 | if (!error->transcoder[i].power_domain_on) | 12478 | if (!error->transcoder[i].power_domain_on) |
| 12453 | continue; | 12479 | continue; |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index bda0ae3d80cc..eaa27ee9e367 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
| @@ -950,8 +950,8 @@ int intel_power_domains_init(struct drm_i915_private *); | |||
| 950 | void intel_power_domains_remove(struct drm_i915_private *); | 950 | void intel_power_domains_remove(struct drm_i915_private *); |
| 951 | bool intel_display_power_enabled(struct drm_i915_private *dev_priv, | 951 | bool intel_display_power_enabled(struct drm_i915_private *dev_priv, |
| 952 | enum intel_display_power_domain domain); | 952 | enum intel_display_power_domain domain); |
| 953 | bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, | 953 | bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv, |
| 954 | enum intel_display_power_domain domain); | 954 | enum intel_display_power_domain domain); |
| 955 | void intel_display_power_get(struct drm_i915_private *dev_priv, | 955 | void intel_display_power_get(struct drm_i915_private *dev_priv, |
| 956 | enum intel_display_power_domain domain); | 956 | enum intel_display_power_domain domain); |
| 957 | void intel_display_power_put(struct drm_i915_private *dev_priv, | 957 | void intel_display_power_put(struct drm_i915_private *dev_priv, |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 54242e4f6f4c..ee72807069e4 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
| @@ -3209,6 +3209,14 @@ void gen6_set_rps(struct drm_device *dev, u8 val) | |||
| 3209 | */ | 3209 | */ |
| 3210 | static void vlv_set_rps_idle(struct drm_i915_private *dev_priv) | 3210 | static void vlv_set_rps_idle(struct drm_i915_private *dev_priv) |
| 3211 | { | 3211 | { |
| 3212 | struct drm_device *dev = dev_priv->dev; | ||
| 3213 | |||
| 3214 | /* Latest VLV doesn't need to force the gfx clock */ | ||
| 3215 | if (dev->pdev->revision >= 0xd) { | ||
| 3216 | valleyview_set_rps(dev_priv->dev, dev_priv->rps.min_freq_softlimit); | ||
| 3217 | return; | ||
| 3218 | } | ||
| 3219 | |||
| 3212 | /* | 3220 | /* |
| 3213 | * When we are idle. Drop to min voltage state. | 3221 | * When we are idle. Drop to min voltage state. |
| 3214 | */ | 3222 | */ |
| @@ -5603,8 +5611,8 @@ static bool hsw_power_well_enabled(struct drm_i915_private *dev_priv, | |||
| 5603 | (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED); | 5611 | (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED); |
| 5604 | } | 5612 | } |
| 5605 | 5613 | ||
| 5606 | bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, | 5614 | bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv, |
| 5607 | enum intel_display_power_domain domain) | 5615 | enum intel_display_power_domain domain) |
| 5608 | { | 5616 | { |
| 5609 | struct i915_power_domains *power_domains; | 5617 | struct i915_power_domains *power_domains; |
| 5610 | struct i915_power_well *power_well; | 5618 | struct i915_power_well *power_well; |
| @@ -5615,16 +5623,19 @@ bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, | |||
| 5615 | return false; | 5623 | return false; |
| 5616 | 5624 | ||
| 5617 | power_domains = &dev_priv->power_domains; | 5625 | power_domains = &dev_priv->power_domains; |
| 5626 | |||
| 5618 | is_enabled = true; | 5627 | is_enabled = true; |
| 5628 | |||
| 5619 | for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { | 5629 | for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { |
| 5620 | if (power_well->always_on) | 5630 | if (power_well->always_on) |
| 5621 | continue; | 5631 | continue; |
| 5622 | 5632 | ||
| 5623 | if (!power_well->count) { | 5633 | if (!power_well->hw_enabled) { |
| 5624 | is_enabled = false; | 5634 | is_enabled = false; |
| 5625 | break; | 5635 | break; |
| 5626 | } | 5636 | } |
| 5627 | } | 5637 | } |
| 5638 | |||
| 5628 | return is_enabled; | 5639 | return is_enabled; |
| 5629 | } | 5640 | } |
| 5630 | 5641 | ||
| @@ -5632,30 +5643,15 @@ bool intel_display_power_enabled(struct drm_i915_private *dev_priv, | |||
| 5632 | enum intel_display_power_domain domain) | 5643 | enum intel_display_power_domain domain) |
| 5633 | { | 5644 | { |
| 5634 | struct i915_power_domains *power_domains; | 5645 | struct i915_power_domains *power_domains; |
| 5635 | struct i915_power_well *power_well; | 5646 | bool ret; |
| 5636 | bool is_enabled; | ||
| 5637 | int i; | ||
| 5638 | |||
| 5639 | if (dev_priv->pm.suspended) | ||
| 5640 | return false; | ||
| 5641 | 5647 | ||
| 5642 | power_domains = &dev_priv->power_domains; | 5648 | power_domains = &dev_priv->power_domains; |
| 5643 | 5649 | ||
| 5644 | is_enabled = true; | ||
| 5645 | |||
| 5646 | mutex_lock(&power_domains->lock); | 5650 | mutex_lock(&power_domains->lock); |
| 5647 | for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { | 5651 | ret = intel_display_power_enabled_unlocked(dev_priv, domain); |
| 5648 | if (power_well->always_on) | ||
| 5649 | continue; | ||
| 5650 | |||
| 5651 | if (!power_well->ops->is_enabled(dev_priv, power_well)) { | ||
| 5652 | is_enabled = false; | ||
| 5653 | break; | ||
| 5654 | } | ||
| 5655 | } | ||
| 5656 | mutex_unlock(&power_domains->lock); | 5652 | mutex_unlock(&power_domains->lock); |
| 5657 | 5653 | ||
| 5658 | return is_enabled; | 5654 | return ret; |
| 5659 | } | 5655 | } |
| 5660 | 5656 | ||
| 5661 | /* | 5657 | /* |
| @@ -5976,6 +5972,7 @@ void intel_display_power_get(struct drm_i915_private *dev_priv, | |||
| 5976 | if (!power_well->count++) { | 5972 | if (!power_well->count++) { |
| 5977 | DRM_DEBUG_KMS("enabling %s\n", power_well->name); | 5973 | DRM_DEBUG_KMS("enabling %s\n", power_well->name); |
| 5978 | power_well->ops->enable(dev_priv, power_well); | 5974 | power_well->ops->enable(dev_priv, power_well); |
| 5975 | power_well->hw_enabled = true; | ||
| 5979 | } | 5976 | } |
| 5980 | 5977 | ||
| 5981 | check_power_well_state(dev_priv, power_well); | 5978 | check_power_well_state(dev_priv, power_well); |
| @@ -6005,6 +6002,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, | |||
| 6005 | 6002 | ||
| 6006 | if (!--power_well->count && i915.disable_power_well) { | 6003 | if (!--power_well->count && i915.disable_power_well) { |
| 6007 | DRM_DEBUG_KMS("disabling %s\n", power_well->name); | 6004 | DRM_DEBUG_KMS("disabling %s\n", power_well->name); |
| 6005 | power_well->hw_enabled = false; | ||
| 6008 | power_well->ops->disable(dev_priv, power_well); | 6006 | power_well->ops->disable(dev_priv, power_well); |
| 6009 | } | 6007 | } |
| 6010 | 6008 | ||
| @@ -6048,6 +6046,27 @@ int i915_release_power_well(void) | |||
| 6048 | } | 6046 | } |
| 6049 | EXPORT_SYMBOL_GPL(i915_release_power_well); | 6047 | EXPORT_SYMBOL_GPL(i915_release_power_well); |
| 6050 | 6048 | ||
| 6049 | /* | ||
| 6050 | * Private interface for the audio driver to get CDCLK in kHz. | ||
| 6051 | * | ||
| 6052 | * Caller must request power well using i915_request_power_well() prior to | ||
| 6053 | * making the call. | ||
| 6054 | */ | ||
| 6055 | int i915_get_cdclk_freq(void) | ||
| 6056 | { | ||
| 6057 | struct drm_i915_private *dev_priv; | ||
| 6058 | |||
| 6059 | if (!hsw_pwr) | ||
| 6060 | return -ENODEV; | ||
| 6061 | |||
| 6062 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, | ||
| 6063 | power_domains); | ||
| 6064 | |||
| 6065 | return intel_ddi_get_cdclk_freq(dev_priv); | ||
| 6066 | } | ||
| 6067 | EXPORT_SYMBOL_GPL(i915_get_cdclk_freq); | ||
| 6068 | |||
| 6069 | |||
| 6051 | #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) | 6070 | #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) |
| 6052 | 6071 | ||
| 6053 | #define HSW_ALWAYS_ON_POWER_DOMAINS ( \ | 6072 | #define HSW_ALWAYS_ON_POWER_DOMAINS ( \ |
| @@ -6267,8 +6286,11 @@ static void intel_power_domains_resume(struct drm_i915_private *dev_priv) | |||
| 6267 | int i; | 6286 | int i; |
| 6268 | 6287 | ||
| 6269 | mutex_lock(&power_domains->lock); | 6288 | mutex_lock(&power_domains->lock); |
| 6270 | for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) | 6289 | for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) { |
| 6271 | power_well->ops->sync_hw(dev_priv, power_well); | 6290 | power_well->ops->sync_hw(dev_priv, power_well); |
| 6291 | power_well->hw_enabled = power_well->ops->is_enabled(dev_priv, | ||
| 6292 | power_well); | ||
| 6293 | } | ||
| 6272 | mutex_unlock(&power_domains->lock); | 6294 | mutex_unlock(&power_domains->lock); |
| 6273 | } | 6295 | } |
| 6274 | 6296 | ||
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 1b66ddcdfb33..9a17b4e92ef4 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
| @@ -691,6 +691,14 @@ intel_post_enable_primary(struct drm_crtc *crtc) | |||
| 691 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 691 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 692 | 692 | ||
| 693 | /* | 693 | /* |
| 694 | * BDW signals flip done immediately if the plane | ||
| 695 | * is disabled, even if the plane enable is already | ||
| 696 | * armed to occur at the next vblank :( | ||
| 697 | */ | ||
| 698 | if (IS_BROADWELL(dev)) | ||
| 699 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
| 700 | |||
| 701 | /* | ||
| 694 | * FIXME IPS should be fine as long as one plane is | 702 | * FIXME IPS should be fine as long as one plane is |
| 695 | * enabled, but in practice it seems to have problems | 703 | * enabled, but in practice it seems to have problems |
| 696 | * when going from primary only to sprite only and vice | 704 | * when going from primary only to sprite only and vice |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index ae750f6928c1..7f7aadef8a82 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c | |||
| @@ -277,6 +277,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
| 277 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; | 277 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; |
| 278 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; | 278 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; |
| 279 | static const char *hpd_clk_names[] = {"iface_clk", "core_clk", "mdp_core_clk"}; | 279 | static const char *hpd_clk_names[] = {"iface_clk", "core_clk", "mdp_core_clk"}; |
| 280 | static unsigned long hpd_clk_freq[] = {0, 19200000, 0}; | ||
| 280 | static const char *pwr_clk_names[] = {"extp_clk", "alt_iface_clk"}; | 281 | static const char *pwr_clk_names[] = {"extp_clk", "alt_iface_clk"}; |
| 281 | 282 | ||
| 282 | config.phy_init = hdmi_phy_8x74_init; | 283 | config.phy_init = hdmi_phy_8x74_init; |
| @@ -286,6 +287,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
| 286 | config.pwr_reg_names = pwr_reg_names; | 287 | config.pwr_reg_names = pwr_reg_names; |
| 287 | config.pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names); | 288 | config.pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names); |
| 288 | config.hpd_clk_names = hpd_clk_names; | 289 | config.hpd_clk_names = hpd_clk_names; |
| 290 | config.hpd_freq = hpd_clk_freq; | ||
| 289 | config.hpd_clk_cnt = ARRAY_SIZE(hpd_clk_names); | 291 | config.hpd_clk_cnt = ARRAY_SIZE(hpd_clk_names); |
| 290 | config.pwr_clk_names = pwr_clk_names; | 292 | config.pwr_clk_names = pwr_clk_names; |
| 291 | config.pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names); | 293 | config.pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names); |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index 9fafee6a3e43..9d7723c6528a 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h | |||
| @@ -87,6 +87,7 @@ struct hdmi_platform_config { | |||
| 87 | 87 | ||
| 88 | /* clks that need to be on for hpd: */ | 88 | /* clks that need to be on for hpd: */ |
| 89 | const char **hpd_clk_names; | 89 | const char **hpd_clk_names; |
| 90 | const long unsigned *hpd_freq; | ||
| 90 | int hpd_clk_cnt; | 91 | int hpd_clk_cnt; |
| 91 | 92 | ||
| 92 | /* clks that need to be on for screen pwr (ie pixel clk): */ | 93 | /* clks that need to be on for screen pwr (ie pixel clk): */ |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c index e56a6196867c..28f7e3ec6c28 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c | |||
| @@ -127,6 +127,14 @@ static int hpd_enable(struct hdmi_connector *hdmi_connector) | |||
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | for (i = 0; i < config->hpd_clk_cnt; i++) { | 129 | for (i = 0; i < config->hpd_clk_cnt; i++) { |
| 130 | if (config->hpd_freq && config->hpd_freq[i]) { | ||
| 131 | ret = clk_set_rate(hdmi->hpd_clks[i], | ||
| 132 | config->hpd_freq[i]); | ||
| 133 | if (ret) | ||
| 134 | dev_warn(dev->dev, "failed to set clk %s (%d)\n", | ||
| 135 | config->hpd_clk_names[i], ret); | ||
| 136 | } | ||
| 137 | |||
| 130 | ret = clk_prepare_enable(hdmi->hpd_clks[i]); | 138 | ret = clk_prepare_enable(hdmi->hpd_clks[i]); |
| 131 | if (ret) { | 139 | if (ret) { |
| 132 | dev_err(dev->dev, "failed to enable hpd clk: %s (%d)\n", | 140 | dev_err(dev->dev, "failed to enable hpd clk: %s (%d)\n", |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c index 42caf7fcb0b9..71510ee26e96 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | |||
| @@ -20,6 +20,10 @@ | |||
| 20 | #include "msm_mmu.h" | 20 | #include "msm_mmu.h" |
| 21 | #include "mdp5_kms.h" | 21 | #include "mdp5_kms.h" |
| 22 | 22 | ||
| 23 | static const char *iommu_ports[] = { | ||
| 24 | "mdp_0", | ||
| 25 | }; | ||
| 26 | |||
| 23 | static struct mdp5_platform_config *mdp5_get_config(struct platform_device *dev); | 27 | static struct mdp5_platform_config *mdp5_get_config(struct platform_device *dev); |
| 24 | 28 | ||
| 25 | static int mdp5_hw_init(struct msm_kms *kms) | 29 | static int mdp5_hw_init(struct msm_kms *kms) |
| @@ -104,6 +108,12 @@ static void mdp5_preclose(struct msm_kms *kms, struct drm_file *file) | |||
| 104 | static void mdp5_destroy(struct msm_kms *kms) | 108 | static void mdp5_destroy(struct msm_kms *kms) |
| 105 | { | 109 | { |
| 106 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); | 110 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); |
| 111 | struct msm_mmu *mmu = mdp5_kms->mmu; | ||
| 112 | |||
| 113 | if (mmu) { | ||
| 114 | mmu->funcs->detach(mmu, iommu_ports, ARRAY_SIZE(iommu_ports)); | ||
| 115 | mmu->funcs->destroy(mmu); | ||
| 116 | } | ||
| 107 | kfree(mdp5_kms); | 117 | kfree(mdp5_kms); |
| 108 | } | 118 | } |
| 109 | 119 | ||
| @@ -216,10 +226,6 @@ fail: | |||
| 216 | return ret; | 226 | return ret; |
| 217 | } | 227 | } |
| 218 | 228 | ||
| 219 | static const char *iommu_ports[] = { | ||
| 220 | "mdp_0", | ||
| 221 | }; | ||
| 222 | |||
| 223 | static int get_clk(struct platform_device *pdev, struct clk **clkp, | 229 | static int get_clk(struct platform_device *pdev, struct clk **clkp, |
| 224 | const char *name) | 230 | const char *name) |
| 225 | { | 231 | { |
| @@ -317,17 +323,23 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) | |||
| 317 | mmu = msm_iommu_new(dev, config->iommu); | 323 | mmu = msm_iommu_new(dev, config->iommu); |
| 318 | if (IS_ERR(mmu)) { | 324 | if (IS_ERR(mmu)) { |
| 319 | ret = PTR_ERR(mmu); | 325 | ret = PTR_ERR(mmu); |
| 326 | dev_err(dev->dev, "failed to init iommu: %d\n", ret); | ||
| 320 | goto fail; | 327 | goto fail; |
| 321 | } | 328 | } |
| 329 | |||
| 322 | ret = mmu->funcs->attach(mmu, iommu_ports, | 330 | ret = mmu->funcs->attach(mmu, iommu_ports, |
| 323 | ARRAY_SIZE(iommu_ports)); | 331 | ARRAY_SIZE(iommu_ports)); |
| 324 | if (ret) | 332 | if (ret) { |
| 333 | dev_err(dev->dev, "failed to attach iommu: %d\n", ret); | ||
| 334 | mmu->funcs->destroy(mmu); | ||
| 325 | goto fail; | 335 | goto fail; |
| 336 | } | ||
| 326 | } else { | 337 | } else { |
| 327 | dev_info(dev->dev, "no iommu, fallback to phys " | 338 | dev_info(dev->dev, "no iommu, fallback to phys " |
| 328 | "contig buffers for scanout\n"); | 339 | "contig buffers for scanout\n"); |
| 329 | mmu = NULL; | 340 | mmu = NULL; |
| 330 | } | 341 | } |
| 342 | mdp5_kms->mmu = mmu; | ||
| 331 | 343 | ||
| 332 | mdp5_kms->id = msm_register_mmu(dev, mmu); | 344 | mdp5_kms->id = msm_register_mmu(dev, mmu); |
| 333 | if (mdp5_kms->id < 0) { | 345 | if (mdp5_kms->id < 0) { |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h index c8b1a2522c25..6e981b692d1d 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | |||
| @@ -33,6 +33,7 @@ struct mdp5_kms { | |||
| 33 | 33 | ||
| 34 | /* mapper-id used to request GEM buffer mapped for scanout: */ | 34 | /* mapper-id used to request GEM buffer mapped for scanout: */ |
| 35 | int id; | 35 | int id; |
| 36 | struct msm_mmu *mmu; | ||
| 36 | 37 | ||
| 37 | /* for tracking smp allocation amongst pipes: */ | 38 | /* for tracking smp allocation amongst pipes: */ |
| 38 | mdp5_smp_state_t smp_state; | 39 | mdp5_smp_state_t smp_state; |
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 0d2562fb681e..9a5d87db5c23 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
| @@ -159,7 +159,7 @@ static int msm_unload(struct drm_device *dev) | |||
| 159 | static int get_mdp_ver(struct platform_device *pdev) | 159 | static int get_mdp_ver(struct platform_device *pdev) |
| 160 | { | 160 | { |
| 161 | #ifdef CONFIG_OF | 161 | #ifdef CONFIG_OF |
| 162 | const static struct of_device_id match_types[] = { { | 162 | static const struct of_device_id match_types[] = { { |
| 163 | .compatible = "qcom,mdss_mdp", | 163 | .compatible = "qcom,mdss_mdp", |
| 164 | .data = (void *)5, | 164 | .data = (void *)5, |
| 165 | }, { | 165 | }, { |
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index a752ab83b810..5107fc4826bc 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c | |||
| @@ -59,7 +59,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, | |||
| 59 | struct drm_framebuffer *fb = NULL; | 59 | struct drm_framebuffer *fb = NULL; |
| 60 | struct fb_info *fbi = NULL; | 60 | struct fb_info *fbi = NULL; |
| 61 | struct drm_mode_fb_cmd2 mode_cmd = {0}; | 61 | struct drm_mode_fb_cmd2 mode_cmd = {0}; |
| 62 | dma_addr_t paddr; | 62 | uint32_t paddr; |
| 63 | int ret, size; | 63 | int ret, size; |
| 64 | 64 | ||
| 65 | sizes->surface_bpp = 32; | 65 | sizes->surface_bpp = 32; |
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index bb8026daebc9..690d7e7b6d1e 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c | |||
| @@ -278,6 +278,7 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id, | |||
| 278 | uint32_t *iova) | 278 | uint32_t *iova) |
| 279 | { | 279 | { |
| 280 | struct msm_gem_object *msm_obj = to_msm_bo(obj); | 280 | struct msm_gem_object *msm_obj = to_msm_bo(obj); |
| 281 | struct drm_device *dev = obj->dev; | ||
| 281 | int ret = 0; | 282 | int ret = 0; |
| 282 | 283 | ||
| 283 | if (!msm_obj->domain[id].iova) { | 284 | if (!msm_obj->domain[id].iova) { |
| @@ -285,6 +286,11 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id, | |||
| 285 | struct msm_mmu *mmu = priv->mmus[id]; | 286 | struct msm_mmu *mmu = priv->mmus[id]; |
| 286 | struct page **pages = get_pages(obj); | 287 | struct page **pages = get_pages(obj); |
| 287 | 288 | ||
| 289 | if (!mmu) { | ||
| 290 | dev_err(dev->dev, "null MMU pointer\n"); | ||
| 291 | return -EINVAL; | ||
| 292 | } | ||
| 293 | |||
| 288 | if (IS_ERR(pages)) | 294 | if (IS_ERR(pages)) |
| 289 | return PTR_ERR(pages); | 295 | return PTR_ERR(pages); |
| 290 | 296 | ||
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index 92b745986231..4b2ad9181edf 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c | |||
| @@ -28,7 +28,7 @@ static int msm_fault_handler(struct iommu_domain *iommu, struct device *dev, | |||
| 28 | unsigned long iova, int flags, void *arg) | 28 | unsigned long iova, int flags, void *arg) |
| 29 | { | 29 | { |
| 30 | DBG("*** fault: iova=%08lx, flags=%d", iova, flags); | 30 | DBG("*** fault: iova=%08lx, flags=%d", iova, flags); |
| 31 | return 0; | 31 | return -ENOSYS; |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | 34 | static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) |
| @@ -40,8 +40,10 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | |||
| 40 | for (i = 0; i < cnt; i++) { | 40 | for (i = 0; i < cnt; i++) { |
| 41 | struct device *msm_iommu_get_ctx(const char *ctx_name); | 41 | struct device *msm_iommu_get_ctx(const char *ctx_name); |
| 42 | struct device *ctx = msm_iommu_get_ctx(names[i]); | 42 | struct device *ctx = msm_iommu_get_ctx(names[i]); |
| 43 | if (IS_ERR_OR_NULL(ctx)) | 43 | if (IS_ERR_OR_NULL(ctx)) { |
| 44 | dev_warn(dev->dev, "couldn't get %s context", names[i]); | ||
| 44 | continue; | 45 | continue; |
| 46 | } | ||
| 45 | ret = iommu_attach_device(iommu->domain, ctx); | 47 | ret = iommu_attach_device(iommu->domain, ctx); |
| 46 | if (ret) { | 48 | if (ret) { |
| 47 | dev_warn(dev->dev, "could not attach iommu to %s", names[i]); | 49 | dev_warn(dev->dev, "could not attach iommu to %s", names[i]); |
| @@ -52,6 +54,20 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | |||
| 52 | return 0; | 54 | return 0; |
| 53 | } | 55 | } |
| 54 | 56 | ||
| 57 | static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt) | ||
| 58 | { | ||
| 59 | struct msm_iommu *iommu = to_msm_iommu(mmu); | ||
| 60 | int i; | ||
| 61 | |||
| 62 | for (i = 0; i < cnt; i++) { | ||
| 63 | struct device *msm_iommu_get_ctx(const char *ctx_name); | ||
| 64 | struct device *ctx = msm_iommu_get_ctx(names[i]); | ||
| 65 | if (IS_ERR_OR_NULL(ctx)) | ||
| 66 | continue; | ||
| 67 | iommu_detach_device(iommu->domain, ctx); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 55 | static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, | 71 | static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, |
| 56 | struct sg_table *sgt, unsigned len, int prot) | 72 | struct sg_table *sgt, unsigned len, int prot) |
| 57 | { | 73 | { |
| @@ -110,7 +126,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova, | |||
| 110 | 126 | ||
| 111 | VERB("unmap[%d]: %08x(%x)", i, iova, bytes); | 127 | VERB("unmap[%d]: %08x(%x)", i, iova, bytes); |
| 112 | 128 | ||
| 113 | BUG_ON(!IS_ALIGNED(bytes, PAGE_SIZE)); | 129 | BUG_ON(!PAGE_ALIGNED(bytes)); |
| 114 | 130 | ||
| 115 | da += bytes; | 131 | da += bytes; |
| 116 | } | 132 | } |
| @@ -127,6 +143,7 @@ static void msm_iommu_destroy(struct msm_mmu *mmu) | |||
| 127 | 143 | ||
| 128 | static const struct msm_mmu_funcs funcs = { | 144 | static const struct msm_mmu_funcs funcs = { |
| 129 | .attach = msm_iommu_attach, | 145 | .attach = msm_iommu_attach, |
| 146 | .detach = msm_iommu_detach, | ||
| 130 | .map = msm_iommu_map, | 147 | .map = msm_iommu_map, |
| 131 | .unmap = msm_iommu_unmap, | 148 | .unmap = msm_iommu_unmap, |
| 132 | .destroy = msm_iommu_destroy, | 149 | .destroy = msm_iommu_destroy, |
diff --git a/drivers/gpu/drm/msm/msm_mmu.h b/drivers/gpu/drm/msm/msm_mmu.h index 030324482b4a..21da6d154f71 100644 --- a/drivers/gpu/drm/msm/msm_mmu.h +++ b/drivers/gpu/drm/msm/msm_mmu.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | struct msm_mmu_funcs { | 23 | struct msm_mmu_funcs { |
| 24 | int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); | 24 | int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); |
| 25 | void (*detach)(struct msm_mmu *mmu, const char **names, int cnt); | ||
| 25 | int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, | 26 | int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, |
| 26 | unsigned len, int prot); | 27 | unsigned len, int prot); |
| 27 | int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, | 28 | int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index c5b1f2da3954..35f4182c63b6 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
| @@ -403,16 +403,18 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
| 403 | { | 403 | { |
| 404 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; | 404 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; |
| 405 | u8 msg[DP_DPCD_SIZE]; | 405 | u8 msg[DP_DPCD_SIZE]; |
| 406 | int ret, i; | 406 | int ret; |
| 407 | |||
| 408 | char dpcd_hex_dump[DP_DPCD_SIZE * 3]; | ||
| 407 | 409 | ||
| 408 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, | 410 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
| 409 | DP_DPCD_SIZE); | 411 | DP_DPCD_SIZE); |
| 410 | if (ret > 0) { | 412 | if (ret > 0) { |
| 411 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 413 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
| 412 | DRM_DEBUG_KMS("DPCD: "); | 414 | |
| 413 | for (i = 0; i < DP_DPCD_SIZE; i++) | 415 | hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd), |
| 414 | DRM_DEBUG_KMS("%02x ", msg[i]); | 416 | 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); |
| 415 | DRM_DEBUG_KMS("\n"); | 417 | DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump); |
| 416 | 418 | ||
| 417 | radeon_dp_probe_oui(radeon_connector); | 419 | radeon_dp_probe_oui(radeon_connector); |
| 418 | 420 | ||
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h index ae88660f34ea..0c6e1b55d968 100644 --- a/drivers/gpu/drm/radeon/cikd.h +++ b/drivers/gpu/drm/radeon/cikd.h | |||
| @@ -1752,12 +1752,12 @@ | |||
| 1752 | #define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ | 1752 | #define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ |
| 1753 | #define EOP_TCL1_ACTION_EN (1 << 16) | 1753 | #define EOP_TCL1_ACTION_EN (1 << 16) |
| 1754 | #define EOP_TC_ACTION_EN (1 << 17) /* L2 */ | 1754 | #define EOP_TC_ACTION_EN (1 << 17) /* L2 */ |
| 1755 | #define EOP_TCL2_VOLATILE (1 << 24) | ||
| 1755 | #define EOP_CACHE_POLICY(x) ((x) << 25) | 1756 | #define EOP_CACHE_POLICY(x) ((x) << 25) |
| 1756 | /* 0 - LRU | 1757 | /* 0 - LRU |
| 1757 | * 1 - Stream | 1758 | * 1 - Stream |
| 1758 | * 2 - Bypass | 1759 | * 2 - Bypass |
| 1759 | */ | 1760 | */ |
| 1760 | #define EOP_TCL2_VOLATILE (1 << 27) | ||
| 1761 | #define DATA_SEL(x) ((x) << 29) | 1761 | #define DATA_SEL(x) ((x) << 29) |
| 1762 | /* 0 - discard | 1762 | /* 0 - discard |
| 1763 | * 1 - send low 32bit data | 1763 | * 1 - send low 32bit data |
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index 5a9a5f4d7888..47d31e915758 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c | |||
| @@ -1551,7 +1551,7 @@ int cypress_populate_smc_voltage_tables(struct radeon_device *rdev, | |||
| 1551 | 1551 | ||
| 1552 | table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0; | 1552 | table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0; |
| 1553 | table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] = | 1553 | table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] = |
| 1554 | cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); | 1554 | cpu_to_be32(eg_pi->vddci_voltage_table.mask_low); |
| 1555 | } | 1555 | } |
| 1556 | 1556 | ||
| 1557 | return 0; | 1557 | return 0; |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 3f6e817d97ee..9ef8c38f2d66 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
| @@ -2726,7 +2726,7 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
| 2726 | pi->caps_sclk_ds = true; | 2726 | pi->caps_sclk_ds = true; |
| 2727 | pi->enable_auto_thermal_throttling = true; | 2727 | pi->enable_auto_thermal_throttling = true; |
| 2728 | pi->disable_nb_ps3_in_battery = false; | 2728 | pi->disable_nb_ps3_in_battery = false; |
| 2729 | pi->bapm_enable = false; | 2729 | pi->bapm_enable = true; |
| 2730 | pi->voltage_drop_t = 0; | 2730 | pi->voltage_drop_t = 0; |
| 2731 | pi->caps_sclk_throttle_low_notification = false; | 2731 | pi->caps_sclk_throttle_low_notification = false; |
| 2732 | pi->caps_fps = false; /* true? */ | 2732 | pi->caps_fps = false; /* true? */ |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 004c931606c4..01fc4888e6fe 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
| @@ -1315,7 +1315,7 @@ static void ni_populate_smc_voltage_tables(struct radeon_device *rdev, | |||
| 1315 | 1315 | ||
| 1316 | table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0; | 1316 | table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0; |
| 1317 | table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = | 1317 | table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = |
| 1318 | cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); | 1318 | cpu_to_be32(eg_pi->vddci_voltage_table.mask_low); |
| 1319 | } | 1319 | } |
| 1320 | } | 1320 | } |
| 1321 | 1321 | ||
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4b0bbf88d5c0..29d9cc04c04e 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -102,6 +102,7 @@ extern int radeon_runtime_pm; | |||
| 102 | extern int radeon_hard_reset; | 102 | extern int radeon_hard_reset; |
| 103 | extern int radeon_vm_size; | 103 | extern int radeon_vm_size; |
| 104 | extern int radeon_vm_block_size; | 104 | extern int radeon_vm_block_size; |
| 105 | extern int radeon_deep_color; | ||
| 105 | 106 | ||
| 106 | /* | 107 | /* |
| 107 | * Copy from radeon_drv.h so we don't have to include both and have conflicting | 108 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
| @@ -749,10 +750,6 @@ union radeon_irq_stat_regs { | |||
| 749 | struct cik_irq_stat_regs cik; | 750 | struct cik_irq_stat_regs cik; |
| 750 | }; | 751 | }; |
| 751 | 752 | ||
| 752 | #define RADEON_MAX_HPD_PINS 7 | ||
| 753 | #define RADEON_MAX_CRTCS 6 | ||
| 754 | #define RADEON_MAX_AFMT_BLOCKS 7 | ||
| 755 | |||
| 756 | struct radeon_irq { | 753 | struct radeon_irq { |
| 757 | bool installed; | 754 | bool installed; |
| 758 | spinlock_t lock; | 755 | spinlock_t lock; |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 30844814c25a..173f378428a9 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
| @@ -1227,11 +1227,19 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
| 1227 | rdev->clock.default_dispclk = | 1227 | rdev->clock.default_dispclk = |
| 1228 | le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); | 1228 | le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); |
| 1229 | if (rdev->clock.default_dispclk == 0) { | 1229 | if (rdev->clock.default_dispclk == 0) { |
| 1230 | if (ASIC_IS_DCE5(rdev)) | 1230 | if (ASIC_IS_DCE6(rdev)) |
| 1231 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ | ||
| 1232 | else if (ASIC_IS_DCE5(rdev)) | ||
| 1231 | rdev->clock.default_dispclk = 54000; /* 540 Mhz */ | 1233 | rdev->clock.default_dispclk = 54000; /* 540 Mhz */ |
| 1232 | else | 1234 | else |
| 1233 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ | 1235 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ |
| 1234 | } | 1236 | } |
| 1237 | /* set a reasonable default for DP */ | ||
| 1238 | if (ASIC_IS_DCE6(rdev) && (rdev->clock.default_dispclk < 53900)) { | ||
| 1239 | DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n", | ||
| 1240 | rdev->clock.default_dispclk / 100); | ||
| 1241 | rdev->clock.default_dispclk = 60000; | ||
| 1242 | } | ||
| 1235 | rdev->clock.dp_extclk = | 1243 | rdev->clock.dp_extclk = |
| 1236 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); | 1244 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); |
| 1237 | rdev->clock.current_dispclk = rdev->clock.default_dispclk; | 1245 | rdev->clock.current_dispclk = rdev->clock.default_dispclk; |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 1b9177ed181f..44831197e82e 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -199,6 +199,9 @@ int radeon_get_monitor_bpc(struct drm_connector *connector) | |||
| 199 | } | 199 | } |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | if ((radeon_deep_color == 0) && (bpc > 8)) | ||
| 203 | bpc = 8; | ||
| 204 | |||
| 202 | DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n", | 205 | DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n", |
| 203 | connector->name, connector->display_info.bpc, bpc); | 206 | connector->name, connector->display_info.bpc, bpc); |
| 204 | 207 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8fc362aa6a1a..13896edcf0b6 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -285,7 +285,6 @@ static void radeon_unpin_work_func(struct work_struct *__work) | |||
| 285 | void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) | 285 | void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) |
| 286 | { | 286 | { |
| 287 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 287 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 288 | struct radeon_flip_work *work; | ||
| 289 | unsigned long flags; | 288 | unsigned long flags; |
| 290 | u32 update_pending; | 289 | u32 update_pending; |
| 291 | int vpos, hpos; | 290 | int vpos, hpos; |
| @@ -295,8 +294,11 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) | |||
| 295 | return; | 294 | return; |
| 296 | 295 | ||
| 297 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); | 296 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); |
| 298 | work = radeon_crtc->flip_work; | 297 | if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) { |
| 299 | if (work == NULL) { | 298 | DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != " |
| 299 | "RADEON_FLIP_SUBMITTED(%d)\n", | ||
| 300 | radeon_crtc->flip_status, | ||
| 301 | RADEON_FLIP_SUBMITTED); | ||
| 300 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 302 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
| 301 | return; | 303 | return; |
| 302 | } | 304 | } |
| @@ -344,12 +346,17 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) | |||
| 344 | 346 | ||
| 345 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); | 347 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); |
| 346 | work = radeon_crtc->flip_work; | 348 | work = radeon_crtc->flip_work; |
| 347 | if (work == NULL) { | 349 | if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) { |
| 350 | DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != " | ||
| 351 | "RADEON_FLIP_SUBMITTED(%d)\n", | ||
| 352 | radeon_crtc->flip_status, | ||
| 353 | RADEON_FLIP_SUBMITTED); | ||
| 348 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 354 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
| 349 | return; | 355 | return; |
| 350 | } | 356 | } |
| 351 | 357 | ||
| 352 | /* Pageflip completed. Clean up. */ | 358 | /* Pageflip completed. Clean up. */ |
| 359 | radeon_crtc->flip_status = RADEON_FLIP_NONE; | ||
| 353 | radeon_crtc->flip_work = NULL; | 360 | radeon_crtc->flip_work = NULL; |
| 354 | 361 | ||
| 355 | /* wakeup userspace */ | 362 | /* wakeup userspace */ |
| @@ -476,6 +483,7 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
| 476 | /* do the flip (mmio) */ | 483 | /* do the flip (mmio) */ |
| 477 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); | 484 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); |
| 478 | 485 | ||
| 486 | radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED; | ||
| 479 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 487 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
| 480 | up_read(&rdev->exclusive_lock); | 488 | up_read(&rdev->exclusive_lock); |
| 481 | 489 | ||
| @@ -544,7 +552,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
| 544 | /* We borrow the event spin lock for protecting flip_work */ | 552 | /* We borrow the event spin lock for protecting flip_work */ |
| 545 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | 553 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
| 546 | 554 | ||
| 547 | if (radeon_crtc->flip_work) { | 555 | if (radeon_crtc->flip_status != RADEON_FLIP_NONE) { |
| 548 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); | 556 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); |
| 549 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 557 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
| 550 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | 558 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); |
| @@ -552,6 +560,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
| 552 | kfree(work); | 560 | kfree(work); |
| 553 | return -EBUSY; | 561 | return -EBUSY; |
| 554 | } | 562 | } |
| 563 | radeon_crtc->flip_status = RADEON_FLIP_PENDING; | ||
| 555 | radeon_crtc->flip_work = work; | 564 | radeon_crtc->flip_work = work; |
| 556 | 565 | ||
| 557 | /* update crtc fb */ | 566 | /* update crtc fb */ |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 6e3017413386..cb1421369e3a 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
| @@ -175,6 +175,7 @@ int radeon_runtime_pm = -1; | |||
| 175 | int radeon_hard_reset = 0; | 175 | int radeon_hard_reset = 0; |
| 176 | int radeon_vm_size = 4096; | 176 | int radeon_vm_size = 4096; |
| 177 | int radeon_vm_block_size = 9; | 177 | int radeon_vm_block_size = 9; |
| 178 | int radeon_deep_color = 0; | ||
| 178 | 179 | ||
| 179 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); | 180 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); |
| 180 | module_param_named(no_wb, radeon_no_wb, int, 0444); | 181 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
| @@ -248,6 +249,9 @@ module_param_named(vm_size, radeon_vm_size, int, 0444); | |||
| 248 | MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)"); | 249 | MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)"); |
| 249 | module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); | 250 | module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); |
| 250 | 251 | ||
| 252 | MODULE_PARM_DESC(deep_color, "Deep Color support (1 = enable, 0 = disable (default))"); | ||
| 253 | module_param_named(deep_color, radeon_deep_color, int, 0444); | ||
| 254 | |||
| 251 | static struct pci_device_id pciidlist[] = { | 255 | static struct pci_device_id pciidlist[] = { |
| 252 | radeon_PCI_IDS | 256 | radeon_PCI_IDS |
| 253 | }; | 257 | }; |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index ad0e4b8cc7e3..0592ddb0904b 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
| @@ -46,6 +46,10 @@ struct radeon_device; | |||
| 46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) | 46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) |
| 47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) | 47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) |
| 48 | 48 | ||
| 49 | #define RADEON_MAX_HPD_PINS 7 | ||
| 50 | #define RADEON_MAX_CRTCS 6 | ||
| 51 | #define RADEON_MAX_AFMT_BLOCKS 7 | ||
| 52 | |||
| 49 | enum radeon_rmx_type { | 53 | enum radeon_rmx_type { |
| 50 | RMX_OFF, | 54 | RMX_OFF, |
| 51 | RMX_FULL, | 55 | RMX_FULL, |
| @@ -233,8 +237,8 @@ struct radeon_mode_info { | |||
| 233 | struct card_info *atom_card_info; | 237 | struct card_info *atom_card_info; |
| 234 | enum radeon_connector_table connector_table; | 238 | enum radeon_connector_table connector_table; |
| 235 | bool mode_config_initialized; | 239 | bool mode_config_initialized; |
| 236 | struct radeon_crtc *crtcs[6]; | 240 | struct radeon_crtc *crtcs[RADEON_MAX_CRTCS]; |
| 237 | struct radeon_afmt *afmt[7]; | 241 | struct radeon_afmt *afmt[RADEON_MAX_AFMT_BLOCKS]; |
| 238 | /* DVI-I properties */ | 242 | /* DVI-I properties */ |
| 239 | struct drm_property *coherent_mode_property; | 243 | struct drm_property *coherent_mode_property; |
| 240 | /* DAC enable load detect */ | 244 | /* DAC enable load detect */ |
| @@ -302,6 +306,12 @@ struct radeon_atom_ss { | |||
| 302 | uint16_t amount; | 306 | uint16_t amount; |
| 303 | }; | 307 | }; |
| 304 | 308 | ||
| 309 | enum radeon_flip_status { | ||
| 310 | RADEON_FLIP_NONE, | ||
| 311 | RADEON_FLIP_PENDING, | ||
| 312 | RADEON_FLIP_SUBMITTED | ||
| 313 | }; | ||
| 314 | |||
| 305 | struct radeon_crtc { | 315 | struct radeon_crtc { |
| 306 | struct drm_crtc base; | 316 | struct drm_crtc base; |
| 307 | int crtc_id; | 317 | int crtc_id; |
| @@ -327,6 +337,7 @@ struct radeon_crtc { | |||
| 327 | /* page flipping */ | 337 | /* page flipping */ |
| 328 | struct workqueue_struct *flip_queue; | 338 | struct workqueue_struct *flip_queue; |
| 329 | struct radeon_flip_work *flip_work; | 339 | struct radeon_flip_work *flip_work; |
| 340 | enum radeon_flip_status flip_status; | ||
| 330 | /* pll sharing */ | 341 | /* pll sharing */ |
| 331 | struct radeon_atom_ss ss; | 342 | struct radeon_atom_ss ss; |
| 332 | bool ss_enabled; | 343 | bool ss_enabled; |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 12c663e86ca1..e447e390d09a 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
| @@ -73,8 +73,10 @@ void radeon_pm_acpi_event_handler(struct radeon_device *rdev) | |||
| 73 | rdev->pm.dpm.ac_power = true; | 73 | rdev->pm.dpm.ac_power = true; |
| 74 | else | 74 | else |
| 75 | rdev->pm.dpm.ac_power = false; | 75 | rdev->pm.dpm.ac_power = false; |
| 76 | if (rdev->asic->dpm.enable_bapm) | 76 | if (rdev->family == CHIP_ARUBA) { |
| 77 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | 77 | if (rdev->asic->dpm.enable_bapm) |
| 78 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | ||
| 79 | } | ||
| 78 | mutex_unlock(&rdev->pm.mutex); | 80 | mutex_unlock(&rdev->pm.mutex); |
| 79 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { | 81 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { |
| 80 | if (rdev->pm.profile == PM_PROFILE_AUTO) { | 82 | if (rdev->pm.profile == PM_PROFILE_AUTO) { |
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c index 899d9126cad6..eecff6bbd341 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
| @@ -495,7 +495,7 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, | |||
| 495 | mutex_unlock(&vm->mutex); | 495 | mutex_unlock(&vm->mutex); |
| 496 | 496 | ||
| 497 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, | 497 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, |
| 498 | RADEON_GPU_PAGE_SIZE, false, | 498 | RADEON_GPU_PAGE_SIZE, true, |
| 499 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); | 499 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); |
| 500 | if (r) | 500 | if (r) |
| 501 | return r; | 501 | return r; |
| @@ -992,7 +992,7 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) | |||
| 992 | return -ENOMEM; | 992 | return -ENOMEM; |
| 993 | } | 993 | } |
| 994 | 994 | ||
| 995 | r = radeon_bo_create(rdev, pd_size, align, false, | 995 | r = radeon_bo_create(rdev, pd_size, align, true, |
| 996 | RADEON_GEM_DOMAIN_VRAM, NULL, | 996 | RADEON_GEM_DOMAIN_VRAM, NULL, |
| 997 | &vm->page_directory); | 997 | &vm->page_directory); |
| 998 | if (r) | 998 | if (r) |
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c index 2a2822c03329..20da6ff183df 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c | |||
| @@ -1874,7 +1874,15 @@ int trinity_dpm_init(struct radeon_device *rdev) | |||
| 1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) | 1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) |
| 1875 | pi->at[i] = TRINITY_AT_DFLT; | 1875 | pi->at[i] = TRINITY_AT_DFLT; |
| 1876 | 1876 | ||
| 1877 | pi->enable_bapm = false; | 1877 | /* There are stability issues reported on latops with |
| 1878 | * bapm installed when switching between AC and battery | ||
| 1879 | * power. At the same time, some desktop boards hang | ||
| 1880 | * if it's not enabled and dpm is enabled. | ||
| 1881 | */ | ||
| 1882 | if (rdev->flags & RADEON_IS_MOBILITY) | ||
| 1883 | pi->enable_bapm = false; | ||
| 1884 | else | ||
| 1885 | pi->enable_bapm = true; | ||
| 1878 | pi->enable_nbps_policy = true; | 1886 | pi->enable_nbps_policy = true; |
| 1879 | pi->enable_sclk_ds = true; | 1887 | pi->enable_sclk_ds = true; |
| 1880 | pi->enable_gfx_power_gating = true; | 1888 | pi->enable_gfx_power_gating = true; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c index a89ad938eacf..b031b48dbb3c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | |||
| @@ -179,7 +179,6 @@ static int vmw_fb_set_par(struct fb_info *info) | |||
| 179 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset); | 179 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset); |
| 180 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres); | 180 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres); |
| 181 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres); | 181 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres); |
| 182 | vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, info->fix.line_length); | ||
| 183 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); | 182 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); |
| 184 | } | 183 | } |
| 185 | 184 | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 08531a128f53..02d3d85829f3 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
| @@ -1052,7 +1052,7 @@ config SENSORS_PC87427 | |||
| 1052 | will be called pc87427. | 1052 | will be called pc87427. |
| 1053 | 1053 | ||
| 1054 | config SENSORS_NTC_THERMISTOR | 1054 | config SENSORS_NTC_THERMISTOR |
| 1055 | tristate "NTC thermistor support" | 1055 | tristate "NTC thermistor support from Murata" |
| 1056 | depends on !OF || IIO=n || IIO | 1056 | depends on !OF || IIO=n || IIO |
| 1057 | help | 1057 | help |
| 1058 | This driver supports NTC thermistors sensor reading and its | 1058 | This driver supports NTC thermistors sensor reading and its |
| @@ -1060,7 +1060,8 @@ config SENSORS_NTC_THERMISTOR | |||
| 1060 | send notifications about the temperature. | 1060 | send notifications about the temperature. |
| 1061 | 1061 | ||
| 1062 | Currently, this driver supports | 1062 | Currently, this driver supports |
| 1063 | NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333. | 1063 | NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333 |
| 1064 | from Murata. | ||
| 1064 | 1065 | ||
| 1065 | This driver can also be built as a module. If so, the module | 1066 | This driver can also be built as a module. If so, the module |
| 1066 | will be called ntc-thermistor. | 1067 | will be called ntc-thermistor. |
| @@ -1176,6 +1177,7 @@ config SENSORS_DME1737 | |||
| 1176 | config SENSORS_EMC1403 | 1177 | config SENSORS_EMC1403 |
| 1177 | tristate "SMSC EMC1403/23 thermal sensor" | 1178 | tristate "SMSC EMC1403/23 thermal sensor" |
| 1178 | depends on I2C | 1179 | depends on I2C |
| 1180 | select REGMAP_I2C | ||
| 1179 | help | 1181 | help |
| 1180 | If you say yes here you get support for the SMSC EMC1403/23 | 1182 | If you say yes here you get support for the SMSC EMC1403/23 |
| 1181 | temperature monitoring chip. | 1183 | temperature monitoring chip. |
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index ba35e4d530b5..2566c43dd1e9 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c | |||
| @@ -538,7 +538,7 @@ static int gpio_fan_probe(struct platform_device *pdev) | |||
| 538 | 538 | ||
| 539 | /* Make this driver part of hwmon class. */ | 539 | /* Make this driver part of hwmon class. */ |
| 540 | fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, | 540 | fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, |
| 541 | "gpio-fan", fan_data, | 541 | "gpio_fan", fan_data, |
| 542 | gpio_fan_groups); | 542 | gpio_fan_groups); |
| 543 | if (IS_ERR(fan_data->hwmon_dev)) | 543 | if (IS_ERR(fan_data->hwmon_dev)) |
| 544 | return PTR_ERR(fan_data->hwmon_dev); | 544 | return PTR_ERR(fan_data->hwmon_dev); |
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index e76feb86a1d4..bdfbe9114889 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c | |||
| @@ -163,6 +163,18 @@ static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata) | |||
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | static const struct of_device_id ntc_match[] = { | 165 | static const struct of_device_id ntc_match[] = { |
| 166 | { .compatible = "murata,ncp15wb473", | ||
| 167 | .data = &ntc_thermistor_id[0] }, | ||
| 168 | { .compatible = "murata,ncp18wb473", | ||
| 169 | .data = &ntc_thermistor_id[1] }, | ||
| 170 | { .compatible = "murata,ncp21wb473", | ||
| 171 | .data = &ntc_thermistor_id[2] }, | ||
| 172 | { .compatible = "murata,ncp03wb473", | ||
| 173 | .data = &ntc_thermistor_id[3] }, | ||
| 174 | { .compatible = "murata,ncp15wl333", | ||
| 175 | .data = &ntc_thermistor_id[4] }, | ||
| 176 | |||
| 177 | /* Usage of vendor name "ntc" is deprecated */ | ||
| 166 | { .compatible = "ntc,ncp15wb473", | 178 | { .compatible = "ntc,ncp15wb473", |
| 167 | .data = &ntc_thermistor_id[0] }, | 179 | .data = &ntc_thermistor_id[0] }, |
| 168 | { .compatible = "ntc,ncp18wb473", | 180 | { .compatible = "ntc,ncp18wb473", |
| @@ -534,7 +546,7 @@ static struct platform_driver ntc_thermistor_driver = { | |||
| 534 | 546 | ||
| 535 | module_platform_driver(ntc_thermistor_driver); | 547 | module_platform_driver(ntc_thermistor_driver); |
| 536 | 548 | ||
| 537 | MODULE_DESCRIPTION("NTC Thermistor Driver"); | 549 | MODULE_DESCRIPTION("NTC Thermistor Driver from Murata"); |
| 538 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); | 550 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); |
| 539 | MODULE_LICENSE("GPL"); | 551 | MODULE_LICENSE("GPL"); |
| 540 | MODULE_ALIAS("platform:ntc-thermistor"); | 552 | MODULE_ALIAS("platform:ntc-thermistor"); |
diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c index 6ed76ceb9270..32487c19cbfc 100644 --- a/drivers/hwmon/w83l786ng.c +++ b/drivers/hwmon/w83l786ng.c | |||
| @@ -249,7 +249,7 @@ static ssize_t show_##reg(struct device *dev, struct device_attribute *attr, \ | |||
| 249 | int nr = to_sensor_dev_attr(attr)->index; \ | 249 | int nr = to_sensor_dev_attr(attr)->index; \ |
| 250 | struct w83l786ng_data *data = w83l786ng_update_device(dev); \ | 250 | struct w83l786ng_data *data = w83l786ng_update_device(dev); \ |
| 251 | return sprintf(buf, "%d\n", \ | 251 | return sprintf(buf, "%d\n", \ |
| 252 | FAN_FROM_REG(data->fan[nr], DIV_FROM_REG(data->fan_div[nr]))); \ | 252 | FAN_FROM_REG(data->reg[nr], DIV_FROM_REG(data->fan_div[nr]))); \ |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | show_fan_reg(fan); | 255 | show_fan_reg(fan); |
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index 39b4cb48d738..6eba301ee03d 100644 --- a/drivers/iio/adc/ad799x.c +++ b/drivers/iio/adc/ad799x.c | |||
| @@ -427,9 +427,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev, | |||
| 427 | int ret; | 427 | int ret; |
| 428 | struct ad799x_state *st = iio_priv(indio_dev); | 428 | struct ad799x_state *st = iio_priv(indio_dev); |
| 429 | 429 | ||
| 430 | if (val < 0 || val > RES_MASK(chan->scan_type.realbits)) | ||
| 431 | return -EINVAL; | ||
| 432 | |||
| 430 | mutex_lock(&indio_dev->mlock); | 433 | mutex_lock(&indio_dev->mlock); |
| 431 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), | 434 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), |
| 432 | val); | 435 | val << chan->scan_type.shift); |
| 433 | mutex_unlock(&indio_dev->mlock); | 436 | mutex_unlock(&indio_dev->mlock); |
| 434 | 437 | ||
| 435 | return ret; | 438 | return ret; |
| @@ -452,7 +455,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev, | |||
| 452 | mutex_unlock(&indio_dev->mlock); | 455 | mutex_unlock(&indio_dev->mlock); |
| 453 | if (ret < 0) | 456 | if (ret < 0) |
| 454 | return ret; | 457 | return ret; |
| 455 | *val = valin; | 458 | *val = (valin >> chan->scan_type.shift) & |
| 459 | RES_MASK(chan->scan_type.realbits); | ||
| 456 | 460 | ||
| 457 | return IIO_VAL_INT; | 461 | return IIO_VAL_INT; |
| 458 | } | 462 | } |
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index d833d55052ea..c7497009d60a 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
| @@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
| 183 | else if (name && index >= 0) { | 183 | else if (name && index >= 0) { |
| 184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", | 184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", |
| 185 | np->full_name, name ? name : "", index); | 185 | np->full_name, name ? name : "", index); |
| 186 | return chan; | 186 | return NULL; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | /* | 189 | /* |
| @@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
| 193 | */ | 193 | */ |
| 194 | np = np->parent; | 194 | np = np->parent; |
| 195 | if (np && !of_get_property(np, "io-channel-ranges", NULL)) | 195 | if (np && !of_get_property(np, "io-channel-ranges", NULL)) |
| 196 | break; | 196 | return NULL; |
| 197 | } | 197 | } |
| 198 | |||
| 198 | return chan; | 199 | return chan; |
| 199 | } | 200 | } |
| 200 | 201 | ||
| @@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev, | |||
| 317 | if (channel != NULL) | 318 | if (channel != NULL) |
| 318 | return channel; | 319 | return channel; |
| 319 | } | 320 | } |
| 321 | |||
| 320 | return iio_channel_get_sys(name, channel_name); | 322 | return iio_channel_get_sys(name, channel_name); |
| 321 | } | 323 | } |
| 322 | EXPORT_SYMBOL_GPL(iio_channel_get); | 324 | EXPORT_SYMBOL_GPL(iio_channel_get); |
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c index d4daa05efe60..499b4366a98d 100644 --- a/drivers/iommu/amd_iommu_v2.c +++ b/drivers/iommu/amd_iommu_v2.c | |||
| @@ -45,7 +45,7 @@ struct pri_queue { | |||
| 45 | struct pasid_state { | 45 | struct pasid_state { |
| 46 | struct list_head list; /* For global state-list */ | 46 | struct list_head list; /* For global state-list */ |
| 47 | atomic_t count; /* Reference count */ | 47 | atomic_t count; /* Reference count */ |
| 48 | atomic_t mmu_notifier_count; /* Counting nested mmu_notifier | 48 | unsigned mmu_notifier_count; /* Counting nested mmu_notifier |
| 49 | calls */ | 49 | calls */ |
| 50 | struct task_struct *task; /* Task bound to this PASID */ | 50 | struct task_struct *task; /* Task bound to this PASID */ |
| 51 | struct mm_struct *mm; /* mm_struct for the faults */ | 51 | struct mm_struct *mm; /* mm_struct for the faults */ |
| @@ -53,7 +53,8 @@ struct pasid_state { | |||
| 53 | struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */ | 53 | struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */ |
| 54 | struct device_state *device_state; /* Link to our device_state */ | 54 | struct device_state *device_state; /* Link to our device_state */ |
| 55 | int pasid; /* PASID index */ | 55 | int pasid; /* PASID index */ |
| 56 | spinlock_t lock; /* Protect pri_queues */ | 56 | spinlock_t lock; /* Protect pri_queues and |
| 57 | mmu_notifer_count */ | ||
| 57 | wait_queue_head_t wq; /* To wait for count == 0 */ | 58 | wait_queue_head_t wq; /* To wait for count == 0 */ |
| 58 | }; | 59 | }; |
| 59 | 60 | ||
| @@ -431,15 +432,19 @@ static void mn_invalidate_range_start(struct mmu_notifier *mn, | |||
| 431 | { | 432 | { |
| 432 | struct pasid_state *pasid_state; | 433 | struct pasid_state *pasid_state; |
| 433 | struct device_state *dev_state; | 434 | struct device_state *dev_state; |
| 435 | unsigned long flags; | ||
| 434 | 436 | ||
| 435 | pasid_state = mn_to_state(mn); | 437 | pasid_state = mn_to_state(mn); |
| 436 | dev_state = pasid_state->device_state; | 438 | dev_state = pasid_state->device_state; |
| 437 | 439 | ||
| 438 | if (atomic_add_return(1, &pasid_state->mmu_notifier_count) == 1) { | 440 | spin_lock_irqsave(&pasid_state->lock, flags); |
| 441 | if (pasid_state->mmu_notifier_count == 0) { | ||
| 439 | amd_iommu_domain_set_gcr3(dev_state->domain, | 442 | amd_iommu_domain_set_gcr3(dev_state->domain, |
| 440 | pasid_state->pasid, | 443 | pasid_state->pasid, |
| 441 | __pa(empty_page_table)); | 444 | __pa(empty_page_table)); |
| 442 | } | 445 | } |
| 446 | pasid_state->mmu_notifier_count += 1; | ||
| 447 | spin_unlock_irqrestore(&pasid_state->lock, flags); | ||
| 443 | } | 448 | } |
| 444 | 449 | ||
| 445 | static void mn_invalidate_range_end(struct mmu_notifier *mn, | 450 | static void mn_invalidate_range_end(struct mmu_notifier *mn, |
| @@ -448,15 +453,19 @@ static void mn_invalidate_range_end(struct mmu_notifier *mn, | |||
| 448 | { | 453 | { |
| 449 | struct pasid_state *pasid_state; | 454 | struct pasid_state *pasid_state; |
| 450 | struct device_state *dev_state; | 455 | struct device_state *dev_state; |
| 456 | unsigned long flags; | ||
| 451 | 457 | ||
| 452 | pasid_state = mn_to_state(mn); | 458 | pasid_state = mn_to_state(mn); |
| 453 | dev_state = pasid_state->device_state; | 459 | dev_state = pasid_state->device_state; |
| 454 | 460 | ||
| 455 | if (atomic_dec_and_test(&pasid_state->mmu_notifier_count)) { | 461 | spin_lock_irqsave(&pasid_state->lock, flags); |
| 462 | pasid_state->mmu_notifier_count -= 1; | ||
| 463 | if (pasid_state->mmu_notifier_count == 0) { | ||
| 456 | amd_iommu_domain_set_gcr3(dev_state->domain, | 464 | amd_iommu_domain_set_gcr3(dev_state->domain, |
| 457 | pasid_state->pasid, | 465 | pasid_state->pasid, |
| 458 | __pa(pasid_state->mm->pgd)); | 466 | __pa(pasid_state->mm->pgd)); |
| 459 | } | 467 | } |
| 468 | spin_unlock_irqrestore(&pasid_state->lock, flags); | ||
| 460 | } | 469 | } |
| 461 | 470 | ||
| 462 | static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm) | 471 | static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm) |
| @@ -650,7 +659,6 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid, | |||
| 650 | goto out; | 659 | goto out; |
| 651 | 660 | ||
| 652 | atomic_set(&pasid_state->count, 1); | 661 | atomic_set(&pasid_state->count, 1); |
| 653 | atomic_set(&pasid_state->mmu_notifier_count, 0); | ||
| 654 | init_waitqueue_head(&pasid_state->wq); | 662 | init_waitqueue_head(&pasid_state->wq); |
| 655 | spin_lock_init(&pasid_state->lock); | 663 | spin_lock_init(&pasid_state->lock); |
| 656 | 664 | ||
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 6bb32773c3ac..51b6b77dc3e5 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -3816,14 +3816,11 @@ int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info) | |||
| 3816 | ((void *)rmrr) + rmrr->header.length, | 3816 | ((void *)rmrr) + rmrr->header.length, |
| 3817 | rmrr->segment, rmrru->devices, | 3817 | rmrr->segment, rmrru->devices, |
| 3818 | rmrru->devices_cnt); | 3818 | rmrru->devices_cnt); |
| 3819 | if (ret > 0) | 3819 | if(ret < 0) |
| 3820 | break; | ||
| 3821 | else if(ret < 0) | ||
| 3822 | return ret; | 3820 | return ret; |
| 3823 | } else if (info->event == BUS_NOTIFY_DEL_DEVICE) { | 3821 | } else if (info->event == BUS_NOTIFY_DEL_DEVICE) { |
| 3824 | if (dmar_remove_dev_scope(info, rmrr->segment, | 3822 | dmar_remove_dev_scope(info, rmrr->segment, |
| 3825 | rmrru->devices, rmrru->devices_cnt)) | 3823 | rmrru->devices, rmrru->devices_cnt); |
| 3826 | break; | ||
| 3827 | } | 3824 | } |
| 3828 | } | 3825 | } |
| 3829 | 3826 | ||
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index c887e6eebc41..574aba0eba4e 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c | |||
| @@ -334,6 +334,15 @@ static void armada_mpic_send_doorbell(const struct cpumask *mask, | |||
| 334 | 334 | ||
| 335 | static void armada_xp_mpic_smp_cpu_init(void) | 335 | static void armada_xp_mpic_smp_cpu_init(void) |
| 336 | { | 336 | { |
| 337 | u32 control; | ||
| 338 | int nr_irqs, i; | ||
| 339 | |||
| 340 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); | ||
| 341 | nr_irqs = (control >> 2) & 0x3ff; | ||
| 342 | |||
| 343 | for (i = 0; i < nr_irqs; i++) | ||
| 344 | writel(i, per_cpu_int_base + ARMADA_370_XP_INT_SET_MASK_OFFS); | ||
| 345 | |||
| 337 | /* Clear pending IPIs */ | 346 | /* Clear pending IPIs */ |
| 338 | writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); | 347 | writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); |
| 339 | 348 | ||
| @@ -474,7 +483,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, | |||
| 474 | struct device_node *parent) | 483 | struct device_node *parent) |
| 475 | { | 484 | { |
| 476 | struct resource main_int_res, per_cpu_int_res; | 485 | struct resource main_int_res, per_cpu_int_res; |
| 477 | int parent_irq; | 486 | int parent_irq, nr_irqs, i; |
| 478 | u32 control; | 487 | u32 control; |
| 479 | 488 | ||
| 480 | BUG_ON(of_address_to_resource(node, 0, &main_int_res)); | 489 | BUG_ON(of_address_to_resource(node, 0, &main_int_res)); |
| @@ -496,9 +505,13 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, | |||
| 496 | BUG_ON(!per_cpu_int_base); | 505 | BUG_ON(!per_cpu_int_base); |
| 497 | 506 | ||
| 498 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); | 507 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); |
| 508 | nr_irqs = (control >> 2) & 0x3ff; | ||
| 509 | |||
| 510 | for (i = 0; i < nr_irqs; i++) | ||
| 511 | writel(i, main_int_base + ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS); | ||
| 499 | 512 | ||
| 500 | armada_370_xp_mpic_domain = | 513 | armada_370_xp_mpic_domain = |
| 501 | irq_domain_add_linear(node, (control >> 2) & 0x3ff, | 514 | irq_domain_add_linear(node, nr_irqs, |
| 502 | &armada_370_xp_mpic_irq_ops, NULL); | 515 | &armada_370_xp_mpic_irq_ops, NULL); |
| 503 | 516 | ||
| 504 | BUG_ON(!armada_370_xp_mpic_domain); | 517 | BUG_ON(!armada_370_xp_mpic_domain); |
diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 8ee2a36d5840..c15c840987d2 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c | |||
| @@ -150,7 +150,7 @@ int __init brcmstb_l2_intc_of_init(struct device_node *np, | |||
| 150 | 150 | ||
| 151 | /* Allocate a single Generic IRQ chip for this node */ | 151 | /* Allocate a single Generic IRQ chip for this node */ |
| 152 | ret = irq_alloc_domain_generic_chips(data->domain, 32, 1, | 152 | ret = irq_alloc_domain_generic_chips(data->domain, 32, 1, |
| 153 | np->full_name, handle_level_irq, clr, 0, 0); | 153 | np->full_name, handle_edge_irq, clr, 0, 0); |
| 154 | if (ret) { | 154 | if (ret) { |
| 155 | pr_err("failed to allocate generic irq chip\n"); | 155 | pr_err("failed to allocate generic irq chip\n"); |
| 156 | goto out_free_domain; | 156 | goto out_free_domain; |
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c index 3fdda3a40269..6ce6bd3441bf 100644 --- a/drivers/irqchip/spear-shirq.c +++ b/drivers/irqchip/spear-shirq.c | |||
| @@ -125,7 +125,7 @@ static struct spear_shirq spear320_shirq_ras2 = { | |||
| 125 | }; | 125 | }; |
| 126 | 126 | ||
| 127 | static struct spear_shirq spear320_shirq_ras3 = { | 127 | static struct spear_shirq spear320_shirq_ras3 = { |
| 128 | .irq_nr = 3, | 128 | .irq_nr = 7, |
| 129 | .irq_bit_off = 0, | 129 | .irq_bit_off = 0, |
| 130 | .invalid_irq = 1, | 130 | .invalid_irq = 1, |
| 131 | .regs = { | 131 | .regs = { |
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig index d9edcc94c2a8..97465ac5a2d5 100644 --- a/drivers/isdn/hisax/Kconfig +++ b/drivers/isdn/hisax/Kconfig | |||
| @@ -16,7 +16,7 @@ config ISDN_DRV_HISAX | |||
| 16 | also to the configuration option of the driver for your particular | 16 | also to the configuration option of the driver for your particular |
| 17 | card, below. | 17 | card, below. |
| 18 | 18 | ||
| 19 | if ISDN_DRV_HISAX!=n | 19 | if ISDN_DRV_HISAX |
| 20 | 20 | ||
| 21 | comment "D-channel protocol features" | 21 | comment "D-channel protocol features" |
| 22 | 22 | ||
| @@ -348,10 +348,6 @@ config HISAX_ENTERNOW_PCI | |||
| 348 | This enables HiSax support for the Formula-n enter:now PCI | 348 | This enables HiSax support for the Formula-n enter:now PCI |
| 349 | ISDN card. | 349 | ISDN card. |
| 350 | 350 | ||
| 351 | endif | ||
| 352 | |||
| 353 | if ISDN_DRV_HISAX | ||
| 354 | |||
| 355 | config HISAX_DEBUG | 351 | config HISAX_DEBUG |
| 356 | bool "HiSax debugging" | 352 | bool "HiSax debugging" |
| 357 | help | 353 | help |
| @@ -420,11 +416,6 @@ config HISAX_FRITZ_PCIPNP | |||
| 420 | (the latter also needs you to select "ISA Plug and Play support" | 416 | (the latter also needs you to select "ISA Plug and Play support" |
| 421 | from the menu "Plug and Play configuration") | 417 | from the menu "Plug and Play configuration") |
| 422 | 418 | ||
| 423 | config HISAX_AVM_A1_PCMCIA | ||
| 424 | bool | ||
| 425 | depends on HISAX_AVM_A1_CS | ||
| 426 | default y | ||
| 427 | |||
| 428 | endif | 419 | endif |
| 429 | 420 | ||
| 430 | endmenu | 421 | endmenu |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 23b4a3b28dbc..4eab93aa570b 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
| @@ -1257,7 +1257,8 @@ static unsigned int smu_fpoll(struct file *file, poll_table *wait) | |||
| 1257 | if (pp->busy && pp->cmd.status != 1) | 1257 | if (pp->busy && pp->cmd.status != 1) |
| 1258 | mask |= POLLIN; | 1258 | mask |= POLLIN; |
| 1259 | spin_unlock_irqrestore(&pp->lock, flags); | 1259 | spin_unlock_irqrestore(&pp->lock, flags); |
| 1260 | } if (pp->mode == smu_file_events) { | 1260 | } |
| 1261 | if (pp->mode == smu_file_events) { | ||
| 1261 | /* Not yet implemented */ | 1262 | /* Not yet implemented */ |
| 1262 | } | 1263 | } |
| 1263 | return mask; | 1264 | return mask; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 34846856dbc6..32fc19c540d4 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -5599,7 +5599,7 @@ static int get_array_info(struct mddev * mddev, void __user * arg) | |||
| 5599 | if (mddev->in_sync) | 5599 | if (mddev->in_sync) |
| 5600 | info.state = (1<<MD_SB_CLEAN); | 5600 | info.state = (1<<MD_SB_CLEAN); |
| 5601 | if (mddev->bitmap && mddev->bitmap_info.offset) | 5601 | if (mddev->bitmap && mddev->bitmap_info.offset) |
| 5602 | info.state = (1<<MD_SB_BITMAP_PRESENT); | 5602 | info.state |= (1<<MD_SB_BITMAP_PRESENT); |
| 5603 | info.active_disks = insync; | 5603 | info.active_disks = insync; |
| 5604 | info.working_disks = working; | 5604 | info.working_disks = working; |
| 5605 | info.failed_disks = failed; | 5605 | info.failed_disks = failed; |
| @@ -7501,6 +7501,19 @@ void md_do_sync(struct md_thread *thread) | |||
| 7501 | rdev->recovery_offset < j) | 7501 | rdev->recovery_offset < j) |
| 7502 | j = rdev->recovery_offset; | 7502 | j = rdev->recovery_offset; |
| 7503 | rcu_read_unlock(); | 7503 | rcu_read_unlock(); |
| 7504 | |||
| 7505 | /* If there is a bitmap, we need to make sure all | ||
| 7506 | * writes that started before we added a spare | ||
| 7507 | * complete before we start doing a recovery. | ||
| 7508 | * Otherwise the write might complete and (via | ||
| 7509 | * bitmap_endwrite) set a bit in the bitmap after the | ||
| 7510 | * recovery has checked that bit and skipped that | ||
| 7511 | * region. | ||
| 7512 | */ | ||
| 7513 | if (mddev->bitmap) { | ||
| 7514 | mddev->pers->quiesce(mddev, 1); | ||
| 7515 | mddev->pers->quiesce(mddev, 0); | ||
| 7516 | } | ||
| 7504 | } | 7517 | } |
| 7505 | 7518 | ||
| 7506 | printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); | 7519 | printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index ee8204cc31e9..6cc4b6acc22a 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -760,6 +760,7 @@ config MFD_SYSCON | |||
| 760 | config MFD_DAVINCI_VOICECODEC | 760 | config MFD_DAVINCI_VOICECODEC |
| 761 | tristate | 761 | tristate |
| 762 | select MFD_CORE | 762 | select MFD_CORE |
| 763 | select REGMAP_MMIO | ||
| 763 | 764 | ||
| 764 | config MFD_TI_AM335X_TSCADC | 765 | config MFD_TI_AM335X_TSCADC |
| 765 | tristate "TI ADC / Touch Screen chip support" | 766 | tristate "TI ADC / Touch Screen chip support" |
| @@ -1225,7 +1226,7 @@ config MFD_WM8994 | |||
| 1225 | functionaltiy of the device other drivers must be enabled. | 1226 | functionaltiy of the device other drivers must be enabled. |
| 1226 | 1227 | ||
| 1227 | config MFD_STW481X | 1228 | config MFD_STW481X |
| 1228 | bool "Support for ST Microelectronics STw481x" | 1229 | tristate "Support for ST Microelectronics STw481x" |
| 1229 | depends on I2C && ARCH_NOMADIK | 1230 | depends on I2C && ARCH_NOMADIK |
| 1230 | select REGMAP_I2C | 1231 | select REGMAP_I2C |
| 1231 | select MFD_CORE | 1232 | select MFD_CORE |
| @@ -1248,7 +1249,7 @@ config MCP_SA11X0 | |||
| 1248 | 1249 | ||
| 1249 | # Chip drivers | 1250 | # Chip drivers |
| 1250 | config MCP_UCB1200 | 1251 | config MCP_UCB1200 |
| 1251 | bool "Support for UCB1200 / UCB1300" | 1252 | tristate "Support for UCB1200 / UCB1300" |
| 1252 | depends on MCP_SA11X0 | 1253 | depends on MCP_SA11X0 |
| 1253 | select MCP | 1254 | select MCP |
| 1254 | 1255 | ||
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index a8ee4a36a1d8..cf2e6a198c6b 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
| @@ -591,7 +591,7 @@ static int ab8500_irq_init(struct ab8500 *ab8500, struct device_node *np) | |||
| 591 | num_irqs = AB8500_NR_IRQS; | 591 | num_irqs = AB8500_NR_IRQS; |
| 592 | 592 | ||
| 593 | /* If ->irq_base is zero this will give a linear mapping */ | 593 | /* If ->irq_base is zero this will give a linear mapping */ |
| 594 | ab8500->domain = irq_domain_add_simple(NULL, | 594 | ab8500->domain = irq_domain_add_simple(ab8500->dev->of_node, |
| 595 | num_irqs, 0, | 595 | num_irqs, 0, |
| 596 | &ab8500_irq_ops, ab8500); | 596 | &ab8500_irq_ops, ab8500); |
| 597 | 597 | ||
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index a43d0c467274..ee9402324a23 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
| @@ -54,7 +54,7 @@ config AD525X_DPOT_SPI | |||
| 54 | config ATMEL_PWM | 54 | config ATMEL_PWM |
| 55 | tristate "Atmel AT32/AT91 PWM support" | 55 | tristate "Atmel AT32/AT91 PWM support" |
| 56 | depends on HAVE_CLK | 56 | depends on HAVE_CLK |
| 57 | depends on AVR32 || AT91SAM9263 || AT91SAM9RL || AT91SAM9G45 | 57 | depends on AVR32 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 |
| 58 | help | 58 | help |
| 59 | This option enables device driver support for the PWM channels | 59 | This option enables device driver support for the PWM channels |
| 60 | on certain Atmel processors. Pulse Width Modulation is used for | 60 | on certain Atmel processors. Pulse Width Modulation is used for |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 04f35f960cb8..3a451b6cd3d5 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -1025,10 +1025,14 @@ static netdev_features_t bond_fix_features(struct net_device *dev, | |||
| 1025 | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ | 1025 | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ |
| 1026 | NETIF_F_HIGHDMA | NETIF_F_LRO) | 1026 | NETIF_F_HIGHDMA | NETIF_F_LRO) |
| 1027 | 1027 | ||
| 1028 | #define BOND_ENC_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | NETIF_F_RXCSUM |\ | ||
| 1029 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL) | ||
| 1030 | |||
| 1028 | static void bond_compute_features(struct bonding *bond) | 1031 | static void bond_compute_features(struct bonding *bond) |
| 1029 | { | 1032 | { |
| 1030 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; | 1033 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; |
| 1031 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; | 1034 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; |
| 1035 | netdev_features_t enc_features = BOND_ENC_FEATURES; | ||
| 1032 | struct net_device *bond_dev = bond->dev; | 1036 | struct net_device *bond_dev = bond->dev; |
| 1033 | struct list_head *iter; | 1037 | struct list_head *iter; |
| 1034 | struct slave *slave; | 1038 | struct slave *slave; |
| @@ -1044,6 +1048,9 @@ static void bond_compute_features(struct bonding *bond) | |||
| 1044 | vlan_features = netdev_increment_features(vlan_features, | 1048 | vlan_features = netdev_increment_features(vlan_features, |
| 1045 | slave->dev->vlan_features, BOND_VLAN_FEATURES); | 1049 | slave->dev->vlan_features, BOND_VLAN_FEATURES); |
| 1046 | 1050 | ||
| 1051 | enc_features = netdev_increment_features(enc_features, | ||
| 1052 | slave->dev->hw_enc_features, | ||
| 1053 | BOND_ENC_FEATURES); | ||
| 1047 | dst_release_flag &= slave->dev->priv_flags; | 1054 | dst_release_flag &= slave->dev->priv_flags; |
| 1048 | if (slave->dev->hard_header_len > max_hard_header_len) | 1055 | if (slave->dev->hard_header_len > max_hard_header_len) |
| 1049 | max_hard_header_len = slave->dev->hard_header_len; | 1056 | max_hard_header_len = slave->dev->hard_header_len; |
| @@ -1054,6 +1061,7 @@ static void bond_compute_features(struct bonding *bond) | |||
| 1054 | 1061 | ||
| 1055 | done: | 1062 | done: |
| 1056 | bond_dev->vlan_features = vlan_features; | 1063 | bond_dev->vlan_features = vlan_features; |
| 1064 | bond_dev->hw_enc_features = enc_features; | ||
| 1057 | bond_dev->hard_header_len = max_hard_header_len; | 1065 | bond_dev->hard_header_len = max_hard_header_len; |
| 1058 | bond_dev->gso_max_segs = gso_max_segs; | 1066 | bond_dev->gso_max_segs = gso_max_segs; |
| 1059 | netif_set_gso_max_size(bond_dev, gso_max_size); | 1067 | netif_set_gso_max_size(bond_dev, gso_max_size); |
| @@ -3975,6 +3983,7 @@ void bond_setup(struct net_device *bond_dev) | |||
| 3975 | NETIF_F_HW_VLAN_CTAG_FILTER; | 3983 | NETIF_F_HW_VLAN_CTAG_FILTER; |
| 3976 | 3984 | ||
| 3977 | bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); | 3985 | bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); |
| 3986 | bond_dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
| 3978 | bond_dev->features |= bond_dev->hw_features; | 3987 | bond_dev->features |= bond_dev->hw_features; |
| 3979 | } | 3988 | } |
| 3980 | 3989 | ||
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index dcf9196f6316..ea4d4f1a6411 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
| @@ -52,6 +52,7 @@ | |||
| 52 | #include <linux/delay.h> | 52 | #include <linux/delay.h> |
| 53 | #include <linux/init.h> | 53 | #include <linux/init.h> |
| 54 | #include <linux/kernel.h> | 54 | #include <linux/kernel.h> |
| 55 | #include <linux/workqueue.h> | ||
| 55 | #include <linux/can.h> | 56 | #include <linux/can.h> |
| 56 | #include <linux/can/skb.h> | 57 | #include <linux/can/skb.h> |
| 57 | 58 | ||
| @@ -85,6 +86,7 @@ struct slcan { | |||
| 85 | struct tty_struct *tty; /* ptr to TTY structure */ | 86 | struct tty_struct *tty; /* ptr to TTY structure */ |
| 86 | struct net_device *dev; /* easy for intr handling */ | 87 | struct net_device *dev; /* easy for intr handling */ |
| 87 | spinlock_t lock; | 88 | spinlock_t lock; |
| 89 | struct work_struct tx_work; /* Flushes transmit buffer */ | ||
| 88 | 90 | ||
| 89 | /* These are pointers to the malloc()ed frame buffers. */ | 91 | /* These are pointers to the malloc()ed frame buffers. */ |
| 90 | unsigned char rbuff[SLC_MTU]; /* receiver buffer */ | 92 | unsigned char rbuff[SLC_MTU]; /* receiver buffer */ |
| @@ -309,36 +311,46 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf) | |||
| 309 | sl->dev->stats.tx_bytes += cf->can_dlc; | 311 | sl->dev->stats.tx_bytes += cf->can_dlc; |
| 310 | } | 312 | } |
| 311 | 313 | ||
| 312 | /* | 314 | /* Write out any remaining transmit buffer. Scheduled when tty is writable */ |
| 313 | * Called by the driver when there's room for more data. If we have | 315 | static void slcan_transmit(struct work_struct *work) |
| 314 | * more packets to send, we send them here. | ||
| 315 | */ | ||
| 316 | static void slcan_write_wakeup(struct tty_struct *tty) | ||
| 317 | { | 316 | { |
| 317 | struct slcan *sl = container_of(work, struct slcan, tx_work); | ||
| 318 | int actual; | 318 | int actual; |
| 319 | struct slcan *sl = (struct slcan *) tty->disc_data; | ||
| 320 | 319 | ||
| 320 | spin_lock_bh(&sl->lock); | ||
| 321 | /* First make sure we're connected. */ | 321 | /* First make sure we're connected. */ |
| 322 | if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) | 322 | if (!sl->tty || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) { |
| 323 | spin_unlock_bh(&sl->lock); | ||
| 323 | return; | 324 | return; |
| 325 | } | ||
| 324 | 326 | ||
| 325 | spin_lock_bh(&sl->lock); | ||
| 326 | if (sl->xleft <= 0) { | 327 | if (sl->xleft <= 0) { |
| 327 | /* Now serial buffer is almost free & we can start | 328 | /* Now serial buffer is almost free & we can start |
| 328 | * transmission of another packet */ | 329 | * transmission of another packet */ |
| 329 | sl->dev->stats.tx_packets++; | 330 | sl->dev->stats.tx_packets++; |
| 330 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 331 | clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
| 331 | spin_unlock_bh(&sl->lock); | 332 | spin_unlock_bh(&sl->lock); |
| 332 | netif_wake_queue(sl->dev); | 333 | netif_wake_queue(sl->dev); |
| 333 | return; | 334 | return; |
| 334 | } | 335 | } |
| 335 | 336 | ||
| 336 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); | 337 | actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft); |
| 337 | sl->xleft -= actual; | 338 | sl->xleft -= actual; |
| 338 | sl->xhead += actual; | 339 | sl->xhead += actual; |
| 339 | spin_unlock_bh(&sl->lock); | 340 | spin_unlock_bh(&sl->lock); |
| 340 | } | 341 | } |
| 341 | 342 | ||
| 343 | /* | ||
| 344 | * Called by the driver when there's room for more data. | ||
| 345 | * Schedule the transmit. | ||
| 346 | */ | ||
| 347 | static void slcan_write_wakeup(struct tty_struct *tty) | ||
| 348 | { | ||
| 349 | struct slcan *sl = tty->disc_data; | ||
| 350 | |||
| 351 | schedule_work(&sl->tx_work); | ||
| 352 | } | ||
| 353 | |||
| 342 | /* Send a can_frame to a TTY queue. */ | 354 | /* Send a can_frame to a TTY queue. */ |
| 343 | static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev) | 355 | static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev) |
| 344 | { | 356 | { |
| @@ -528,6 +540,7 @@ static struct slcan *slc_alloc(dev_t line) | |||
| 528 | sl->magic = SLCAN_MAGIC; | 540 | sl->magic = SLCAN_MAGIC; |
| 529 | sl->dev = dev; | 541 | sl->dev = dev; |
| 530 | spin_lock_init(&sl->lock); | 542 | spin_lock_init(&sl->lock); |
| 543 | INIT_WORK(&sl->tx_work, slcan_transmit); | ||
| 531 | slcan_devs[i] = dev; | 544 | slcan_devs[i] = dev; |
| 532 | 545 | ||
| 533 | return sl; | 546 | return sl; |
| @@ -626,8 +639,12 @@ static void slcan_close(struct tty_struct *tty) | |||
| 626 | if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty) | 639 | if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty) |
| 627 | return; | 640 | return; |
| 628 | 641 | ||
| 642 | spin_lock_bh(&sl->lock); | ||
| 629 | tty->disc_data = NULL; | 643 | tty->disc_data = NULL; |
| 630 | sl->tty = NULL; | 644 | sl->tty = NULL; |
| 645 | spin_unlock_bh(&sl->lock); | ||
| 646 | |||
| 647 | flush_work(&sl->tx_work); | ||
| 631 | 648 | ||
| 632 | /* Flush network side */ | 649 | /* Flush network side */ |
| 633 | unregister_netdev(sl->dev); | 650 | unregister_netdev(sl->dev); |
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 28460676b8ca..d81e7167a8b5 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c | |||
| @@ -736,6 +736,7 @@ static int emac_open(struct net_device *dev) | |||
| 736 | 736 | ||
| 737 | ret = emac_mdio_probe(dev); | 737 | ret = emac_mdio_probe(dev); |
| 738 | if (ret < 0) { | 738 | if (ret < 0) { |
| 739 | free_irq(dev->irq, dev); | ||
| 739 | netdev_err(dev, "cannot probe MDIO bus\n"); | 740 | netdev_err(dev, "cannot probe MDIO bus\n"); |
| 740 | return ret; | 741 | return ret; |
| 741 | } | 742 | } |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index df2792d8383d..8afa579e7c40 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -3224,7 +3224,7 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp, | |||
| 3224 | return 0; | 3224 | return 0; |
| 3225 | } | 3225 | } |
| 3226 | 3226 | ||
| 3227 | #define NVRAM_CMD_TIMEOUT 100 | 3227 | #define NVRAM_CMD_TIMEOUT 5000 |
| 3228 | 3228 | ||
| 3229 | static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) | 3229 | static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) |
| 3230 | { | 3230 | { |
| @@ -3232,7 +3232,7 @@ static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) | |||
| 3232 | 3232 | ||
| 3233 | tw32(NVRAM_CMD, nvram_cmd); | 3233 | tw32(NVRAM_CMD, nvram_cmd); |
| 3234 | for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) { | 3234 | for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) { |
| 3235 | udelay(10); | 3235 | usleep_range(10, 40); |
| 3236 | if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) { | 3236 | if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) { |
| 3237 | udelay(10); | 3237 | udelay(10); |
| 3238 | break; | 3238 | break; |
| @@ -7854,8 +7854,8 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb) | |||
| 7854 | netif_wake_queue(tp->dev); | 7854 | netif_wake_queue(tp->dev); |
| 7855 | } | 7855 | } |
| 7856 | 7856 | ||
| 7857 | segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO); | 7857 | segs = skb_gso_segment(skb, tp->dev->features & ~(NETIF_F_TSO | NETIF_F_TSO6)); |
| 7858 | if (IS_ERR(segs)) | 7858 | if (IS_ERR(segs) || !segs) |
| 7859 | goto tg3_tso_bug_end; | 7859 | goto tg3_tso_bug_end; |
| 7860 | 7860 | ||
| 7861 | do { | 7861 | do { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 2f8d6b910383..a83271cf17c3 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
| @@ -4057,22 +4057,19 @@ int cxgb4_unregister_uld(enum cxgb4_uld type) | |||
| 4057 | EXPORT_SYMBOL(cxgb4_unregister_uld); | 4057 | EXPORT_SYMBOL(cxgb4_unregister_uld); |
| 4058 | 4058 | ||
| 4059 | /* Check if netdev on which event is occured belongs to us or not. Return | 4059 | /* Check if netdev on which event is occured belongs to us or not. Return |
| 4060 | * suceess (1) if it belongs otherwise failure (0). | 4060 | * success (true) if it belongs otherwise failure (false). |
| 4061 | * Called with rcu_read_lock() held. | ||
| 4061 | */ | 4062 | */ |
| 4062 | static int cxgb4_netdev(struct net_device *netdev) | 4063 | static bool cxgb4_netdev(const struct net_device *netdev) |
| 4063 | { | 4064 | { |
| 4064 | struct adapter *adap; | 4065 | struct adapter *adap; |
| 4065 | int i; | 4066 | int i; |
| 4066 | 4067 | ||
| 4067 | spin_lock(&adap_rcu_lock); | ||
| 4068 | list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node) | 4068 | list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node) |
| 4069 | for (i = 0; i < MAX_NPORTS; i++) | 4069 | for (i = 0; i < MAX_NPORTS; i++) |
| 4070 | if (adap->port[i] == netdev) { | 4070 | if (adap->port[i] == netdev) |
| 4071 | spin_unlock(&adap_rcu_lock); | 4071 | return true; |
| 4072 | return 1; | 4072 | return false; |
| 4073 | } | ||
| 4074 | spin_unlock(&adap_rcu_lock); | ||
| 4075 | return 0; | ||
| 4076 | } | 4073 | } |
| 4077 | 4074 | ||
| 4078 | static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa, | 4075 | static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa, |
| @@ -6396,6 +6393,7 @@ static void remove_one(struct pci_dev *pdev) | |||
| 6396 | adapter->flags &= ~DEV_ENABLED; | 6393 | adapter->flags &= ~DEV_ENABLED; |
| 6397 | } | 6394 | } |
| 6398 | pci_release_regions(pdev); | 6395 | pci_release_regions(pdev); |
| 6396 | synchronize_rcu(); | ||
| 6399 | kfree(adapter); | 6397 | kfree(adapter); |
| 6400 | } else | 6398 | } else |
| 6401 | pci_release_regions(pdev); | 6399 | pci_release_regions(pdev); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index bba67681aeaa..931478e7bd28 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
| @@ -3962,6 +3962,7 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf) | |||
| 3962 | p->lport = j; | 3962 | p->lport = j; |
| 3963 | p->rss_size = rss_size; | 3963 | p->rss_size = rss_size; |
| 3964 | memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); | 3964 | memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); |
| 3965 | adap->port[i]->dev_port = j; | ||
| 3965 | 3966 | ||
| 3966 | ret = ntohl(c.u.info.lstatus_to_modtype); | 3967 | ret = ntohl(c.u.info.lstatus_to_modtype); |
| 3967 | p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ? | 3968 | p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ? |
diff --git a/drivers/net/ethernet/dec/tulip/timer.c b/drivers/net/ethernet/dec/tulip/timer.c index 768379b8aee9..523d9dde50a2 100644 --- a/drivers/net/ethernet/dec/tulip/timer.c +++ b/drivers/net/ethernet/dec/tulip/timer.c | |||
| @@ -158,7 +158,7 @@ void comet_timer(unsigned long data) | |||
| 158 | { | 158 | { |
| 159 | struct net_device *dev = (struct net_device *)data; | 159 | struct net_device *dev = (struct net_device *)data; |
| 160 | struct tulip_private *tp = netdev_priv(dev); | 160 | struct tulip_private *tp = netdev_priv(dev); |
| 161 | int next_tick = 60*HZ; | 161 | int next_tick = 2*HZ; |
| 162 | 162 | ||
| 163 | if (tulip_debug > 1) | 163 | if (tulip_debug > 1) |
| 164 | netdev_dbg(dev, "Comet link status %04x partner capability %04x\n", | 164 | netdev_dbg(dev, "Comet link status %04x partner capability %04x\n", |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 2e7c5553955e..c2f5d2d3b932 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
| @@ -557,9 +557,7 @@ static inline u16 be_max_qs(struct be_adapter *adapter) | |||
| 557 | #define be_pvid_tagging_enabled(adapter) (adapter->pvid) | 557 | #define be_pvid_tagging_enabled(adapter) (adapter->pvid) |
| 558 | 558 | ||
| 559 | /* Is BE in QNQ multi-channel mode */ | 559 | /* Is BE in QNQ multi-channel mode */ |
| 560 | #define be_is_qnq_mode(adapter) (adapter->mc_type == FLEX10 || \ | 560 | #define be_is_qnq_mode(adapter) (adapter->function_mode & QNQ_MODE) |
| 561 | adapter->mc_type == vNIC1 || \ | ||
| 562 | adapter->mc_type == UFP) | ||
| 563 | 561 | ||
| 564 | #define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \ | 562 | #define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \ |
| 565 | adapter->pdev->device == OC_DEVICE_ID4) | 563 | adapter->pdev->device == OC_DEVICE_ID4) |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 3e0a6b243806..59b3c056f329 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
| @@ -1091,7 +1091,7 @@ struct be_cmd_resp_modify_eq_delay { | |||
| 1091 | * based on the skew/IPL. | 1091 | * based on the skew/IPL. |
| 1092 | */ | 1092 | */ |
| 1093 | #define RDMA_ENABLED 0x4 | 1093 | #define RDMA_ENABLED 0x4 |
| 1094 | #define FLEX10_MODE 0x400 | 1094 | #define QNQ_MODE 0x400 |
| 1095 | #define VNIC_MODE 0x20000 | 1095 | #define VNIC_MODE 0x20000 |
| 1096 | #define UMC_ENABLED 0x1000000 | 1096 | #define UMC_ENABLED 0x1000000 |
| 1097 | struct be_cmd_req_query_fw_cfg { | 1097 | struct be_cmd_req_query_fw_cfg { |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 6822b3d76d85..34a26e42f19d 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -3254,9 +3254,9 @@ err: | |||
| 3254 | 3254 | ||
| 3255 | static u8 be_convert_mc_type(u32 function_mode) | 3255 | static u8 be_convert_mc_type(u32 function_mode) |
| 3256 | { | 3256 | { |
| 3257 | if (function_mode & VNIC_MODE && function_mode & FLEX10_MODE) | 3257 | if (function_mode & VNIC_MODE && function_mode & QNQ_MODE) |
| 3258 | return vNIC1; | 3258 | return vNIC1; |
| 3259 | else if (function_mode & FLEX10_MODE) | 3259 | else if (function_mode & QNQ_MODE) |
| 3260 | return FLEX10; | 3260 | return FLEX10; |
| 3261 | else if (function_mode & VNIC_MODE) | 3261 | else if (function_mode & VNIC_MODE) |
| 3262 | return vNIC2; | 3262 | return vNIC2; |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 38d9d276ab8b..77037fd377b8 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -320,6 +320,11 @@ static void *swap_buffer(void *bufaddr, int len) | |||
| 320 | return bufaddr; | 320 | return bufaddr; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | static inline bool is_ipv4_pkt(struct sk_buff *skb) | ||
| 324 | { | ||
| 325 | return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4; | ||
| 326 | } | ||
| 327 | |||
| 323 | static int | 328 | static int |
| 324 | fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) | 329 | fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) |
| 325 | { | 330 | { |
| @@ -330,7 +335,8 @@ fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) | |||
| 330 | if (unlikely(skb_cow_head(skb, 0))) | 335 | if (unlikely(skb_cow_head(skb, 0))) |
| 331 | return -1; | 336 | return -1; |
| 332 | 337 | ||
| 333 | ip_hdr(skb)->check = 0; | 338 | if (is_ipv4_pkt(skb)) |
| 339 | ip_hdr(skb)->check = 0; | ||
| 334 | *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0; | 340 | *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0; |
| 335 | 341 | ||
| 336 | return 0; | 342 | return 0; |
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 7f81ae66cc89..e912b6887d40 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
| @@ -4199,6 +4199,13 @@ static struct dmi_system_id skge_32bit_dma_boards[] = { | |||
| 4199 | DMI_MATCH(DMI_BOARD_NAME, "P5NSLI") | 4199 | DMI_MATCH(DMI_BOARD_NAME, "P5NSLI") |
| 4200 | }, | 4200 | }, |
| 4201 | }, | 4201 | }, |
| 4202 | { | ||
| 4203 | .ident = "FUJITSU SIEMENS A8NE-FM", | ||
| 4204 | .matches = { | ||
| 4205 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."), | ||
| 4206 | DMI_MATCH(DMI_BOARD_NAME, "A8NE-FM") | ||
| 4207 | }, | ||
| 4208 | }, | ||
| 4202 | {} | 4209 | {} |
| 4203 | }; | 4210 | }; |
| 4204 | 4211 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 5f42f6d6e4c6..82ab427290c3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
| @@ -2439,7 +2439,8 @@ slave_start: | |||
| 2439 | (num_vfs_argc > 1 || probe_vfs_argc > 1)) { | 2439 | (num_vfs_argc > 1 || probe_vfs_argc > 1)) { |
| 2440 | mlx4_err(dev, | 2440 | mlx4_err(dev, |
| 2441 | "Invalid syntax of num_vfs/probe_vfs with IB port - single port VFs syntax is only supported when all ports are configured as ethernet\n"); | 2441 | "Invalid syntax of num_vfs/probe_vfs with IB port - single port VFs syntax is only supported when all ports are configured as ethernet\n"); |
| 2442 | goto err_close; | 2442 | err = -EINVAL; |
| 2443 | goto err_master_mfunc; | ||
| 2443 | } | 2444 | } |
| 2444 | for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) { | 2445 | for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) { |
| 2445 | unsigned j; | 2446 | unsigned j; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index ff380dac6629..b988d16cd34e 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
| @@ -1212,7 +1212,12 @@ static int cpsw_ndo_open(struct net_device *ndev) | |||
| 1212 | for_each_slave(priv, cpsw_slave_open, priv); | 1212 | for_each_slave(priv, cpsw_slave_open, priv); |
| 1213 | 1213 | ||
| 1214 | /* Add default VLAN */ | 1214 | /* Add default VLAN */ |
| 1215 | cpsw_add_default_vlan(priv); | 1215 | if (!priv->data.dual_emac) |
| 1216 | cpsw_add_default_vlan(priv); | ||
| 1217 | else | ||
| 1218 | cpsw_ale_add_vlan(priv->ale, priv->data.default_vlan, | ||
| 1219 | ALE_ALL_PORTS << priv->host_port, | ||
| 1220 | ALE_ALL_PORTS << priv->host_port, 0, 0); | ||
| 1216 | 1221 | ||
| 1217 | if (!cpsw_common_res_usage_state(priv)) { | 1222 | if (!cpsw_common_res_usage_state(priv)) { |
| 1218 | /* setup tx dma to fixed prio and zero offset */ | 1223 | /* setup tx dma to fixed prio and zero offset */ |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 14389f841d43..4c70360967c2 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
| @@ -2191,7 +2191,6 @@ static void tile_net_setup(struct net_device *dev) | |||
| 2191 | static void tile_net_dev_init(const char *name, const uint8_t *mac) | 2191 | static void tile_net_dev_init(const char *name, const uint8_t *mac) |
| 2192 | { | 2192 | { |
| 2193 | int ret; | 2193 | int ret; |
| 2194 | int i; | ||
| 2195 | struct net_device *dev; | 2194 | struct net_device *dev; |
| 2196 | struct tile_net_priv *priv; | 2195 | struct tile_net_priv *priv; |
| 2197 | 2196 | ||
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index c041f63a6d30..4ed38eaecea8 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
| @@ -189,7 +189,7 @@ static int netvsc_destroy_buf(struct netvsc_device *net_device) | |||
| 189 | "unable to teardown send buffer's gpadl\n"); | 189 | "unable to teardown send buffer's gpadl\n"); |
| 190 | return ret; | 190 | return ret; |
| 191 | } | 191 | } |
| 192 | net_device->recv_buf_gpadl_handle = 0; | 192 | net_device->send_buf_gpadl_handle = 0; |
| 193 | } | 193 | } |
| 194 | if (net_device->send_buf) { | 194 | if (net_device->send_buf) { |
| 195 | /* Free up the receive buffer */ | 195 | /* Free up the receive buffer */ |
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 4517b149ed07..50899416f668 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
| @@ -1137,6 +1137,8 @@ static int at86rf230_probe(struct spi_device *spi) | |||
| 1137 | dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK; | 1137 | dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK; |
| 1138 | 1138 | ||
| 1139 | irq_type = irq_get_trigger_type(spi->irq); | 1139 | irq_type = irq_get_trigger_type(spi->irq); |
| 1140 | if (!irq_type) | ||
| 1141 | irq_type = IRQF_TRIGGER_RISING; | ||
| 1140 | if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { | 1142 | if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { |
| 1141 | irq_worker = at86rf230_irqwork; | 1143 | irq_worker = at86rf230_irqwork; |
| 1142 | irq_handler = at86rf230_isr; | 1144 | irq_handler = at86rf230_isr; |
| @@ -1168,7 +1170,8 @@ static int at86rf230_probe(struct spi_device *spi) | |||
| 1168 | if (rc) | 1170 | if (rc) |
| 1169 | goto err_hw_init; | 1171 | goto err_hw_init; |
| 1170 | 1172 | ||
| 1171 | rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, IRQF_SHARED, | 1173 | rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, |
| 1174 | IRQF_SHARED | irq_type, | ||
| 1172 | dev_name(&spi->dev), lp); | 1175 | dev_name(&spi->dev), lp); |
| 1173 | if (rc) | 1176 | if (rc) |
| 1174 | goto err_hw_init; | 1177 | goto err_hw_init; |
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 6c622aedbae1..fdc1b418fa6a 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c | |||
| @@ -16,9 +16,13 @@ | |||
| 16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
| 17 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
| 18 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
| 19 | #include <linux/of_gpio.h> | ||
| 20 | #include <linux/gpio/consumer.h> | ||
| 19 | 21 | ||
| 20 | #define AT803X_INTR_ENABLE 0x12 | 22 | #define AT803X_INTR_ENABLE 0x12 |
| 21 | #define AT803X_INTR_STATUS 0x13 | 23 | #define AT803X_INTR_STATUS 0x13 |
| 24 | #define AT803X_SMART_SPEED 0x14 | ||
| 25 | #define AT803X_LED_CONTROL 0x18 | ||
| 22 | #define AT803X_WOL_ENABLE 0x01 | 26 | #define AT803X_WOL_ENABLE 0x01 |
| 23 | #define AT803X_DEVICE_ADDR 0x03 | 27 | #define AT803X_DEVICE_ADDR 0x03 |
| 24 | #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C | 28 | #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C |
| @@ -35,10 +39,52 @@ | |||
| 35 | #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 | 39 | #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 |
| 36 | #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) | 40 | #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) |
| 37 | 41 | ||
| 42 | #define ATH8030_PHY_ID 0x004dd076 | ||
| 43 | #define ATH8031_PHY_ID 0x004dd074 | ||
| 44 | #define ATH8035_PHY_ID 0x004dd072 | ||
| 45 | |||
| 38 | MODULE_DESCRIPTION("Atheros 803x PHY driver"); | 46 | MODULE_DESCRIPTION("Atheros 803x PHY driver"); |
| 39 | MODULE_AUTHOR("Matus Ujhelyi"); | 47 | MODULE_AUTHOR("Matus Ujhelyi"); |
| 40 | MODULE_LICENSE("GPL"); | 48 | MODULE_LICENSE("GPL"); |
| 41 | 49 | ||
| 50 | struct at803x_priv { | ||
| 51 | bool phy_reset:1; | ||
| 52 | struct gpio_desc *gpiod_reset; | ||
| 53 | }; | ||
| 54 | |||
| 55 | struct at803x_context { | ||
| 56 | u16 bmcr; | ||
| 57 | u16 advertise; | ||
| 58 | u16 control1000; | ||
| 59 | u16 int_enable; | ||
| 60 | u16 smart_speed; | ||
| 61 | u16 led_control; | ||
| 62 | }; | ||
| 63 | |||
| 64 | /* save relevant PHY registers to private copy */ | ||
| 65 | static void at803x_context_save(struct phy_device *phydev, | ||
| 66 | struct at803x_context *context) | ||
| 67 | { | ||
| 68 | context->bmcr = phy_read(phydev, MII_BMCR); | ||
| 69 | context->advertise = phy_read(phydev, MII_ADVERTISE); | ||
| 70 | context->control1000 = phy_read(phydev, MII_CTRL1000); | ||
| 71 | context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE); | ||
| 72 | context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED); | ||
| 73 | context->led_control = phy_read(phydev, AT803X_LED_CONTROL); | ||
| 74 | } | ||
| 75 | |||
| 76 | /* restore relevant PHY registers from private copy */ | ||
| 77 | static void at803x_context_restore(struct phy_device *phydev, | ||
| 78 | const struct at803x_context *context) | ||
| 79 | { | ||
| 80 | phy_write(phydev, MII_BMCR, context->bmcr); | ||
| 81 | phy_write(phydev, MII_ADVERTISE, context->advertise); | ||
| 82 | phy_write(phydev, MII_CTRL1000, context->control1000); | ||
| 83 | phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable); | ||
| 84 | phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed); | ||
| 85 | phy_write(phydev, AT803X_LED_CONTROL, context->led_control); | ||
| 86 | } | ||
| 87 | |||
| 42 | static int at803x_set_wol(struct phy_device *phydev, | 88 | static int at803x_set_wol(struct phy_device *phydev, |
| 43 | struct ethtool_wolinfo *wol) | 89 | struct ethtool_wolinfo *wol) |
| 44 | { | 90 | { |
| @@ -142,6 +188,26 @@ static int at803x_resume(struct phy_device *phydev) | |||
| 142 | return 0; | 188 | return 0; |
| 143 | } | 189 | } |
| 144 | 190 | ||
| 191 | static int at803x_probe(struct phy_device *phydev) | ||
| 192 | { | ||
| 193 | struct device *dev = &phydev->dev; | ||
| 194 | struct at803x_priv *priv; | ||
| 195 | |||
| 196 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | ||
| 197 | if (!priv) | ||
| 198 | return -ENOMEM; | ||
| 199 | |||
| 200 | priv->gpiod_reset = devm_gpiod_get(dev, "reset"); | ||
| 201 | if (IS_ERR(priv->gpiod_reset)) | ||
| 202 | priv->gpiod_reset = NULL; | ||
| 203 | else | ||
| 204 | gpiod_direction_output(priv->gpiod_reset, 1); | ||
| 205 | |||
| 206 | phydev->priv = priv; | ||
| 207 | |||
| 208 | return 0; | ||
| 209 | } | ||
| 210 | |||
| 145 | static int at803x_config_init(struct phy_device *phydev) | 211 | static int at803x_config_init(struct phy_device *phydev) |
| 146 | { | 212 | { |
| 147 | int ret; | 213 | int ret; |
| @@ -189,58 +255,99 @@ static int at803x_config_intr(struct phy_device *phydev) | |||
| 189 | return err; | 255 | return err; |
| 190 | } | 256 | } |
| 191 | 257 | ||
| 258 | static void at803x_link_change_notify(struct phy_device *phydev) | ||
| 259 | { | ||
| 260 | struct at803x_priv *priv = phydev->priv; | ||
| 261 | |||
| 262 | /* | ||
| 263 | * Conduct a hardware reset for AT8030 every time a link loss is | ||
| 264 | * signalled. This is necessary to circumvent a hardware bug that | ||
| 265 | * occurs when the cable is unplugged while TX packets are pending | ||
| 266 | * in the FIFO. In such cases, the FIFO enters an error mode it | ||
| 267 | * cannot recover from by software. | ||
| 268 | */ | ||
| 269 | if (phydev->drv->phy_id == ATH8030_PHY_ID) { | ||
| 270 | if (phydev->state == PHY_NOLINK) { | ||
| 271 | if (priv->gpiod_reset && !priv->phy_reset) { | ||
| 272 | struct at803x_context context; | ||
| 273 | |||
| 274 | at803x_context_save(phydev, &context); | ||
| 275 | |||
| 276 | gpiod_set_value(priv->gpiod_reset, 0); | ||
| 277 | msleep(1); | ||
| 278 | gpiod_set_value(priv->gpiod_reset, 1); | ||
| 279 | msleep(1); | ||
| 280 | |||
| 281 | at803x_context_restore(phydev, &context); | ||
| 282 | |||
| 283 | dev_dbg(&phydev->dev, "%s(): phy was reset\n", | ||
| 284 | __func__); | ||
| 285 | priv->phy_reset = true; | ||
| 286 | } | ||
| 287 | } else { | ||
| 288 | priv->phy_reset = false; | ||
| 289 | } | ||
| 290 | } | ||
| 291 | } | ||
| 292 | |||
| 192 | static struct phy_driver at803x_driver[] = { | 293 | static struct phy_driver at803x_driver[] = { |
| 193 | { | 294 | { |
| 194 | /* ATHEROS 8035 */ | 295 | /* ATHEROS 8035 */ |
| 195 | .phy_id = 0x004dd072, | 296 | .phy_id = ATH8035_PHY_ID, |
| 196 | .name = "Atheros 8035 ethernet", | 297 | .name = "Atheros 8035 ethernet", |
| 197 | .phy_id_mask = 0xffffffef, | 298 | .phy_id_mask = 0xffffffef, |
| 198 | .config_init = at803x_config_init, | 299 | .probe = at803x_probe, |
| 199 | .set_wol = at803x_set_wol, | 300 | .config_init = at803x_config_init, |
| 200 | .get_wol = at803x_get_wol, | 301 | .link_change_notify = at803x_link_change_notify, |
| 201 | .suspend = at803x_suspend, | 302 | .set_wol = at803x_set_wol, |
| 202 | .resume = at803x_resume, | 303 | .get_wol = at803x_get_wol, |
| 203 | .features = PHY_GBIT_FEATURES, | 304 | .suspend = at803x_suspend, |
| 204 | .flags = PHY_HAS_INTERRUPT, | 305 | .resume = at803x_resume, |
| 205 | .config_aneg = genphy_config_aneg, | 306 | .features = PHY_GBIT_FEATURES, |
| 206 | .read_status = genphy_read_status, | 307 | .flags = PHY_HAS_INTERRUPT, |
| 207 | .driver = { | 308 | .config_aneg = genphy_config_aneg, |
| 309 | .read_status = genphy_read_status, | ||
| 310 | .driver = { | ||
| 208 | .owner = THIS_MODULE, | 311 | .owner = THIS_MODULE, |
| 209 | }, | 312 | }, |
| 210 | }, { | 313 | }, { |
| 211 | /* ATHEROS 8030 */ | 314 | /* ATHEROS 8030 */ |
| 212 | .phy_id = 0x004dd076, | 315 | .phy_id = ATH8030_PHY_ID, |
| 213 | .name = "Atheros 8030 ethernet", | 316 | .name = "Atheros 8030 ethernet", |
| 214 | .phy_id_mask = 0xffffffef, | 317 | .phy_id_mask = 0xffffffef, |
| 215 | .config_init = at803x_config_init, | 318 | .probe = at803x_probe, |
| 216 | .set_wol = at803x_set_wol, | 319 | .config_init = at803x_config_init, |
| 217 | .get_wol = at803x_get_wol, | 320 | .link_change_notify = at803x_link_change_notify, |
| 218 | .suspend = at803x_suspend, | 321 | .set_wol = at803x_set_wol, |
| 219 | .resume = at803x_resume, | 322 | .get_wol = at803x_get_wol, |
| 220 | .features = PHY_GBIT_FEATURES, | 323 | .suspend = at803x_suspend, |
| 221 | .flags = PHY_HAS_INTERRUPT, | 324 | .resume = at803x_resume, |
| 222 | .config_aneg = genphy_config_aneg, | 325 | .features = PHY_GBIT_FEATURES, |
| 223 | .read_status = genphy_read_status, | 326 | .flags = PHY_HAS_INTERRUPT, |
| 224 | .driver = { | 327 | .config_aneg = genphy_config_aneg, |
| 328 | .read_status = genphy_read_status, | ||
| 329 | .driver = { | ||
| 225 | .owner = THIS_MODULE, | 330 | .owner = THIS_MODULE, |
| 226 | }, | 331 | }, |
| 227 | }, { | 332 | }, { |
| 228 | /* ATHEROS 8031 */ | 333 | /* ATHEROS 8031 */ |
| 229 | .phy_id = 0x004dd074, | 334 | .phy_id = ATH8031_PHY_ID, |
| 230 | .name = "Atheros 8031 ethernet", | 335 | .name = "Atheros 8031 ethernet", |
| 231 | .phy_id_mask = 0xffffffef, | 336 | .phy_id_mask = 0xffffffef, |
| 232 | .config_init = at803x_config_init, | 337 | .probe = at803x_probe, |
| 233 | .set_wol = at803x_set_wol, | 338 | .config_init = at803x_config_init, |
| 234 | .get_wol = at803x_get_wol, | 339 | .link_change_notify = at803x_link_change_notify, |
| 235 | .suspend = at803x_suspend, | 340 | .set_wol = at803x_set_wol, |
| 236 | .resume = at803x_resume, | 341 | .get_wol = at803x_get_wol, |
| 237 | .features = PHY_GBIT_FEATURES, | 342 | .suspend = at803x_suspend, |
| 238 | .flags = PHY_HAS_INTERRUPT, | 343 | .resume = at803x_resume, |
| 239 | .config_aneg = genphy_config_aneg, | 344 | .features = PHY_GBIT_FEATURES, |
| 240 | .read_status = genphy_read_status, | 345 | .flags = PHY_HAS_INTERRUPT, |
| 241 | .ack_interrupt = &at803x_ack_interrupt, | 346 | .config_aneg = genphy_config_aneg, |
| 242 | .config_intr = &at803x_config_intr, | 347 | .read_status = genphy_read_status, |
| 243 | .driver = { | 348 | .ack_interrupt = &at803x_ack_interrupt, |
| 349 | .config_intr = &at803x_config_intr, | ||
| 350 | .driver = { | ||
| 244 | .owner = THIS_MODULE, | 351 | .owner = THIS_MODULE, |
| 245 | }, | 352 | }, |
| 246 | } }; | 353 | } }; |
| @@ -260,9 +367,9 @@ module_init(atheros_init); | |||
| 260 | module_exit(atheros_exit); | 367 | module_exit(atheros_exit); |
| 261 | 368 | ||
| 262 | static struct mdio_device_id __maybe_unused atheros_tbl[] = { | 369 | static struct mdio_device_id __maybe_unused atheros_tbl[] = { |
| 263 | { 0x004dd076, 0xffffffef }, | 370 | { ATH8030_PHY_ID, 0xffffffef }, |
| 264 | { 0x004dd074, 0xffffffef }, | 371 | { ATH8031_PHY_ID, 0xffffffef }, |
| 265 | { 0x004dd072, 0xffffffef }, | 372 | { ATH8035_PHY_ID, 0xffffffef }, |
| 266 | { } | 373 | { } |
| 267 | }; | 374 | }; |
| 268 | 375 | ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 3bc079a67a3d..f7c61812ea4a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
| @@ -720,6 +720,9 @@ void phy_state_machine(struct work_struct *work) | |||
| 720 | 720 | ||
| 721 | mutex_lock(&phydev->lock); | 721 | mutex_lock(&phydev->lock); |
| 722 | 722 | ||
| 723 | if (phydev->drv->link_change_notify) | ||
| 724 | phydev->drv->link_change_notify(phydev); | ||
| 725 | |||
| 723 | switch (phydev->state) { | 726 | switch (phydev->state) { |
| 724 | case PHY_DOWN: | 727 | case PHY_DOWN: |
| 725 | case PHY_STARTING: | 728 | case PHY_STARTING: |
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index ad4a94e9ff57..87526443841f 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c | |||
| @@ -83,6 +83,7 @@ | |||
| 83 | #include <linux/delay.h> | 83 | #include <linux/delay.h> |
| 84 | #include <linux/init.h> | 84 | #include <linux/init.h> |
| 85 | #include <linux/slab.h> | 85 | #include <linux/slab.h> |
| 86 | #include <linux/workqueue.h> | ||
| 86 | #include "slip.h" | 87 | #include "slip.h" |
| 87 | #ifdef CONFIG_INET | 88 | #ifdef CONFIG_INET |
| 88 | #include <linux/ip.h> | 89 | #include <linux/ip.h> |
| @@ -416,36 +417,46 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len) | |||
| 416 | #endif | 417 | #endif |
| 417 | } | 418 | } |
| 418 | 419 | ||
| 419 | /* | 420 | /* Write out any remaining transmit buffer. Scheduled when tty is writable */ |
| 420 | * Called by the driver when there's room for more data. If we have | 421 | static void slip_transmit(struct work_struct *work) |
| 421 | * more packets to send, we send them here. | ||
| 422 | */ | ||
| 423 | static void slip_write_wakeup(struct tty_struct *tty) | ||
| 424 | { | 422 | { |
| 423 | struct slip *sl = container_of(work, struct slip, tx_work); | ||
| 425 | int actual; | 424 | int actual; |
| 426 | struct slip *sl = tty->disc_data; | ||
| 427 | 425 | ||
| 426 | spin_lock_bh(&sl->lock); | ||
| 428 | /* First make sure we're connected. */ | 427 | /* First make sure we're connected. */ |
| 429 | if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) | 428 | if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) { |
| 429 | spin_unlock_bh(&sl->lock); | ||
| 430 | return; | 430 | return; |
| 431 | } | ||
| 431 | 432 | ||
| 432 | spin_lock_bh(&sl->lock); | ||
| 433 | if (sl->xleft <= 0) { | 433 | if (sl->xleft <= 0) { |
| 434 | /* Now serial buffer is almost free & we can start | 434 | /* Now serial buffer is almost free & we can start |
| 435 | * transmission of another packet */ | 435 | * transmission of another packet */ |
| 436 | sl->dev->stats.tx_packets++; | 436 | sl->dev->stats.tx_packets++; |
| 437 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 437 | clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
| 438 | spin_unlock_bh(&sl->lock); | 438 | spin_unlock_bh(&sl->lock); |
| 439 | sl_unlock(sl); | 439 | sl_unlock(sl); |
| 440 | return; | 440 | return; |
| 441 | } | 441 | } |
| 442 | 442 | ||
| 443 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); | 443 | actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft); |
| 444 | sl->xleft -= actual; | 444 | sl->xleft -= actual; |
| 445 | sl->xhead += actual; | 445 | sl->xhead += actual; |
| 446 | spin_unlock_bh(&sl->lock); | 446 | spin_unlock_bh(&sl->lock); |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | /* | ||
| 450 | * Called by the driver when there's room for more data. | ||
| 451 | * Schedule the transmit. | ||
| 452 | */ | ||
| 453 | static void slip_write_wakeup(struct tty_struct *tty) | ||
| 454 | { | ||
| 455 | struct slip *sl = tty->disc_data; | ||
| 456 | |||
| 457 | schedule_work(&sl->tx_work); | ||
| 458 | } | ||
| 459 | |||
| 449 | static void sl_tx_timeout(struct net_device *dev) | 460 | static void sl_tx_timeout(struct net_device *dev) |
| 450 | { | 461 | { |
| 451 | struct slip *sl = netdev_priv(dev); | 462 | struct slip *sl = netdev_priv(dev); |
| @@ -749,6 +760,7 @@ static struct slip *sl_alloc(dev_t line) | |||
| 749 | sl->magic = SLIP_MAGIC; | 760 | sl->magic = SLIP_MAGIC; |
| 750 | sl->dev = dev; | 761 | sl->dev = dev; |
| 751 | spin_lock_init(&sl->lock); | 762 | spin_lock_init(&sl->lock); |
| 763 | INIT_WORK(&sl->tx_work, slip_transmit); | ||
| 752 | sl->mode = SL_MODE_DEFAULT; | 764 | sl->mode = SL_MODE_DEFAULT; |
| 753 | #ifdef CONFIG_SLIP_SMART | 765 | #ifdef CONFIG_SLIP_SMART |
| 754 | /* initialize timer_list struct */ | 766 | /* initialize timer_list struct */ |
| @@ -872,8 +884,12 @@ static void slip_close(struct tty_struct *tty) | |||
| 872 | if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty) | 884 | if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty) |
| 873 | return; | 885 | return; |
| 874 | 886 | ||
| 887 | spin_lock_bh(&sl->lock); | ||
| 875 | tty->disc_data = NULL; | 888 | tty->disc_data = NULL; |
| 876 | sl->tty = NULL; | 889 | sl->tty = NULL; |
| 890 | spin_unlock_bh(&sl->lock); | ||
| 891 | |||
| 892 | flush_work(&sl->tx_work); | ||
| 877 | 893 | ||
| 878 | /* VSV = very important to remove timers */ | 894 | /* VSV = very important to remove timers */ |
| 879 | #ifdef CONFIG_SLIP_SMART | 895 | #ifdef CONFIG_SLIP_SMART |
diff --git a/drivers/net/slip/slip.h b/drivers/net/slip/slip.h index 67673cf1266b..cf32aadf508f 100644 --- a/drivers/net/slip/slip.h +++ b/drivers/net/slip/slip.h | |||
| @@ -53,6 +53,7 @@ struct slip { | |||
| 53 | struct tty_struct *tty; /* ptr to TTY structure */ | 53 | struct tty_struct *tty; /* ptr to TTY structure */ |
| 54 | struct net_device *dev; /* easy for intr handling */ | 54 | struct net_device *dev; /* easy for intr handling */ |
| 55 | spinlock_t lock; | 55 | spinlock_t lock; |
| 56 | struct work_struct tx_work; /* Flushes transmit buffer */ | ||
| 56 | 57 | ||
| 57 | #ifdef SL_INCLUDE_CSLIP | 58 | #ifdef SL_INCLUDE_CSLIP |
| 58 | struct slcompress *slcomp; /* for header compression */ | 59 | struct slcompress *slcomp; /* for header compression */ |
diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c index f9822bc75425..5d95a13dbe2a 100644 --- a/drivers/net/usb/huawei_cdc_ncm.c +++ b/drivers/net/usb/huawei_cdc_ncm.c | |||
| @@ -84,12 +84,13 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev, | |||
| 84 | ctx = drvstate->ctx; | 84 | ctx = drvstate->ctx; |
| 85 | 85 | ||
| 86 | if (usbnet_dev->status) | 86 | if (usbnet_dev->status) |
| 87 | /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 | 87 | /* The wMaxCommand buffer must be big enough to hold |
| 88 | * decimal (0x100)" | 88 | * any message from the modem. Experience has shown |
| 89 | * that some replies are more than 256 bytes long | ||
| 89 | */ | 90 | */ |
| 90 | subdriver = usb_cdc_wdm_register(ctx->control, | 91 | subdriver = usb_cdc_wdm_register(ctx->control, |
| 91 | &usbnet_dev->status->desc, | 92 | &usbnet_dev->status->desc, |
| 92 | 256, /* wMaxCommand */ | 93 | 1024, /* wMaxCommand */ |
| 93 | huawei_cdc_ncm_wdm_manage_power); | 94 | huawei_cdc_ncm_wdm_manage_power); |
| 94 | if (IS_ERR(subdriver)) { | 95 | if (IS_ERR(subdriver)) { |
| 95 | ret = PTR_ERR(subdriver); | 96 | ret = PTR_ERR(subdriver); |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 97394345e5dd..b76f7dcde0db 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
| @@ -2589,8 +2589,8 @@ vmxnet3_open(struct net_device *netdev) | |||
| 2589 | for (i = 0; i < adapter->num_tx_queues; i++) | 2589 | for (i = 0; i < adapter->num_tx_queues; i++) |
| 2590 | spin_lock_init(&adapter->tx_queue[i].tx_lock); | 2590 | spin_lock_init(&adapter->tx_queue[i].tx_lock); |
| 2591 | 2591 | ||
| 2592 | err = vmxnet3_create_queues(adapter, VMXNET3_DEF_TX_RING_SIZE, | 2592 | err = vmxnet3_create_queues(adapter, adapter->tx_ring_size, |
| 2593 | VMXNET3_DEF_RX_RING_SIZE, | 2593 | adapter->rx_ring_size, |
| 2594 | VMXNET3_DEF_RX_RING_SIZE); | 2594 | VMXNET3_DEF_RX_RING_SIZE); |
| 2595 | if (err) | 2595 | if (err) |
| 2596 | goto queue_err; | 2596 | goto queue_err; |
| @@ -2968,6 +2968,9 @@ vmxnet3_probe_device(struct pci_dev *pdev, | |||
| 2968 | adapter->netdev = netdev; | 2968 | adapter->netdev = netdev; |
| 2969 | adapter->pdev = pdev; | 2969 | adapter->pdev = pdev; |
| 2970 | 2970 | ||
| 2971 | adapter->tx_ring_size = VMXNET3_DEF_TX_RING_SIZE; | ||
| 2972 | adapter->rx_ring_size = VMXNET3_DEF_RX_RING_SIZE; | ||
| 2973 | |||
| 2971 | spin_lock_init(&adapter->cmd_lock); | 2974 | spin_lock_init(&adapter->cmd_lock); |
| 2972 | adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter, | 2975 | adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter, |
| 2973 | sizeof(struct vmxnet3_adapter), | 2976 | sizeof(struct vmxnet3_adapter), |
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 40c1c7b0d9e0..b725fd9e7803 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | |||
| @@ -449,8 +449,8 @@ vmxnet3_get_ringparam(struct net_device *netdev, | |||
| 449 | param->rx_mini_max_pending = 0; | 449 | param->rx_mini_max_pending = 0; |
| 450 | param->rx_jumbo_max_pending = 0; | 450 | param->rx_jumbo_max_pending = 0; |
| 451 | 451 | ||
| 452 | param->rx_pending = adapter->rx_queue[0].rx_ring[0].size; | 452 | param->rx_pending = adapter->rx_ring_size; |
| 453 | param->tx_pending = adapter->tx_queue[0].tx_ring.size; | 453 | param->tx_pending = adapter->tx_ring_size; |
| 454 | param->rx_mini_pending = 0; | 454 | param->rx_mini_pending = 0; |
| 455 | param->rx_jumbo_pending = 0; | 455 | param->rx_jumbo_pending = 0; |
| 456 | } | 456 | } |
| @@ -529,9 +529,11 @@ vmxnet3_set_ringparam(struct net_device *netdev, | |||
| 529 | * size */ | 529 | * size */ |
| 530 | netdev_err(netdev, "failed to apply new sizes, " | 530 | netdev_err(netdev, "failed to apply new sizes, " |
| 531 | "try the default ones\n"); | 531 | "try the default ones\n"); |
| 532 | new_rx_ring_size = VMXNET3_DEF_RX_RING_SIZE; | ||
| 533 | new_tx_ring_size = VMXNET3_DEF_TX_RING_SIZE; | ||
| 532 | err = vmxnet3_create_queues(adapter, | 534 | err = vmxnet3_create_queues(adapter, |
| 533 | VMXNET3_DEF_TX_RING_SIZE, | 535 | new_tx_ring_size, |
| 534 | VMXNET3_DEF_RX_RING_SIZE, | 536 | new_rx_ring_size, |
| 535 | VMXNET3_DEF_RX_RING_SIZE); | 537 | VMXNET3_DEF_RX_RING_SIZE); |
| 536 | if (err) { | 538 | if (err) { |
| 537 | netdev_err(netdev, "failed to create queues " | 539 | netdev_err(netdev, "failed to create queues " |
| @@ -545,6 +547,8 @@ vmxnet3_set_ringparam(struct net_device *netdev, | |||
| 545 | netdev_err(netdev, "failed to re-activate, error %d." | 547 | netdev_err(netdev, "failed to re-activate, error %d." |
| 546 | " Closing it\n", err); | 548 | " Closing it\n", err); |
| 547 | } | 549 | } |
| 550 | adapter->tx_ring_size = new_tx_ring_size; | ||
| 551 | adapter->rx_ring_size = new_rx_ring_size; | ||
| 548 | 552 | ||
| 549 | out: | 553 | out: |
| 550 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); | 554 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); |
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 190569d02450..29ee77f2c97f 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
| @@ -349,6 +349,11 @@ struct vmxnet3_adapter { | |||
| 349 | u32 link_speed; /* in mbps */ | 349 | u32 link_speed; /* in mbps */ |
| 350 | 350 | ||
| 351 | u64 tx_timeout_count; | 351 | u64 tx_timeout_count; |
| 352 | |||
| 353 | /* Ring sizes */ | ||
| 354 | u32 tx_ring_size; | ||
| 355 | u32 rx_ring_size; | ||
| 356 | |||
| 352 | struct work_struct work; | 357 | struct work_struct work; |
| 353 | 358 | ||
| 354 | unsigned long state; /* VMXNET3_STATE_BIT_xxx */ | 359 | unsigned long state; /* VMXNET3_STATE_BIT_xxx */ |
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index e3f67b8d3f80..40fd9b7b1426 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
| @@ -36,7 +36,7 @@ config B43_SSB | |||
| 36 | choice | 36 | choice |
| 37 | prompt "Supported bus types" | 37 | prompt "Supported bus types" |
| 38 | depends on B43 | 38 | depends on B43 |
| 39 | default B43_BCMA_AND_SSB | 39 | default B43_BUSES_BCMA_AND_SSB |
| 40 | 40 | ||
| 41 | config B43_BUSES_BCMA_AND_SSB | 41 | config B43_BUSES_BCMA_AND_SSB |
| 42 | bool "BCMA and SSB" | 42 | bool "BCMA and SSB" |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 32538ac5f7e4..0d6a0bb1f876 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -5221,6 +5221,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
| 5221 | /* We don't support 5 GHz on some PHYs yet */ | 5221 | /* We don't support 5 GHz on some PHYs yet */ |
| 5222 | switch (dev->phy.type) { | 5222 | switch (dev->phy.type) { |
| 5223 | case B43_PHYTYPE_A: | 5223 | case B43_PHYTYPE_A: |
| 5224 | case B43_PHYTYPE_G: | ||
| 5224 | case B43_PHYTYPE_N: | 5225 | case B43_PHYTYPE_N: |
| 5225 | case B43_PHYTYPE_LP: | 5226 | case B43_PHYTYPE_LP: |
| 5226 | case B43_PHYTYPE_HT: | 5227 | case B43_PHYTYPE_HT: |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 4f38f19b8e3d..6e6ef3fc2247 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
| @@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
| 811 | break; | 811 | break; |
| 812 | case B43_PHYTYPE_G: | 812 | case B43_PHYTYPE_G: |
| 813 | status.band = IEEE80211_BAND_2GHZ; | 813 | status.band = IEEE80211_BAND_2GHZ; |
| 814 | /* chanid is the radio channel cookie value as used | 814 | /* Somewhere between 478.104 and 508.1084 firmware for G-PHY |
| 815 | * to tune the radio. */ | 815 | * has been modified to be compatible with N-PHY and others. |
| 816 | status.freq = chanid + 2400; | 816 | */ |
| 817 | if (dev->fw.rev >= 508) | ||
| 818 | status.freq = ieee80211_channel_to_frequency(chanid, status.band); | ||
| 819 | else | ||
| 820 | status.freq = chanid + 2400; | ||
| 817 | break; | 821 | break; |
| 818 | case B43_PHYTYPE_N: | 822 | case B43_PHYTYPE_N: |
| 819 | case B43_PHYTYPE_LP: | 823 | case B43_PHYTYPE_LP: |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 574d4b597468..2cc9b6fca490 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
| @@ -50,7 +50,7 @@ mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, | |||
| 50 | return -1; | 50 | return -1; |
| 51 | } | 51 | } |
| 52 | mapping.len = size; | 52 | mapping.len = size; |
| 53 | memcpy(skb->cb, &mapping, sizeof(mapping)); | 53 | mwifiex_store_mapping(skb, &mapping); |
| 54 | return 0; | 54 | return 0; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| @@ -60,7 +60,7 @@ static void mwifiex_unmap_pci_memory(struct mwifiex_adapter *adapter, | |||
| 60 | struct pcie_service_card *card = adapter->card; | 60 | struct pcie_service_card *card = adapter->card; |
| 61 | struct mwifiex_dma_mapping mapping; | 61 | struct mwifiex_dma_mapping mapping; |
| 62 | 62 | ||
| 63 | MWIFIEX_SKB_PACB(skb, &mapping); | 63 | mwifiex_get_mapping(skb, &mapping); |
| 64 | pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); | 64 | pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); |
| 65 | } | 65 | } |
| 66 | 66 | ||
diff --git a/drivers/net/wireless/mwifiex/util.h b/drivers/net/wireless/mwifiex/util.h index ddae57021397..caadb3737b9e 100644 --- a/drivers/net/wireless/mwifiex/util.h +++ b/drivers/net/wireless/mwifiex/util.h | |||
| @@ -20,32 +20,55 @@ | |||
| 20 | #ifndef _MWIFIEX_UTIL_H_ | 20 | #ifndef _MWIFIEX_UTIL_H_ |
| 21 | #define _MWIFIEX_UTIL_H_ | 21 | #define _MWIFIEX_UTIL_H_ |
| 22 | 22 | ||
| 23 | struct mwifiex_dma_mapping { | ||
| 24 | dma_addr_t addr; | ||
| 25 | size_t len; | ||
| 26 | }; | ||
| 27 | |||
| 28 | struct mwifiex_cb { | ||
| 29 | struct mwifiex_dma_mapping dma_mapping; | ||
| 30 | union { | ||
| 31 | struct mwifiex_rxinfo rx_info; | ||
| 32 | struct mwifiex_txinfo tx_info; | ||
| 33 | }; | ||
| 34 | }; | ||
| 35 | |||
| 23 | static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) | 36 | static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) |
| 24 | { | 37 | { |
| 25 | return (struct mwifiex_rxinfo *)(skb->cb + sizeof(dma_addr_t)); | 38 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
| 39 | |||
| 40 | BUILD_BUG_ON(sizeof(struct mwifiex_cb) > sizeof(skb->cb)); | ||
| 41 | return &cb->rx_info; | ||
| 26 | } | 42 | } |
| 27 | 43 | ||
| 28 | static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) | 44 | static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) |
| 29 | { | 45 | { |
| 30 | return (struct mwifiex_txinfo *)(skb->cb + sizeof(dma_addr_t)); | 46 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
| 47 | |||
| 48 | return &cb->tx_info; | ||
| 31 | } | 49 | } |
| 32 | 50 | ||
| 33 | struct mwifiex_dma_mapping { | 51 | static inline void mwifiex_store_mapping(struct sk_buff *skb, |
| 34 | dma_addr_t addr; | 52 | struct mwifiex_dma_mapping *mapping) |
| 35 | size_t len; | 53 | { |
| 36 | }; | 54 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
| 55 | |||
| 56 | memcpy(&cb->dma_mapping, mapping, sizeof(*mapping)); | ||
| 57 | } | ||
| 37 | 58 | ||
| 38 | static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb, | 59 | static inline void mwifiex_get_mapping(struct sk_buff *skb, |
| 39 | struct mwifiex_dma_mapping *mapping) | 60 | struct mwifiex_dma_mapping *mapping) |
| 40 | { | 61 | { |
| 41 | memcpy(mapping, skb->cb, sizeof(*mapping)); | 62 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
| 63 | |||
| 64 | memcpy(mapping, &cb->dma_mapping, sizeof(*mapping)); | ||
| 42 | } | 65 | } |
| 43 | 66 | ||
| 44 | static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) | 67 | static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) |
| 45 | { | 68 | { |
| 46 | struct mwifiex_dma_mapping mapping; | 69 | struct mwifiex_dma_mapping mapping; |
| 47 | 70 | ||
| 48 | MWIFIEX_SKB_PACB(skb, &mapping); | 71 | mwifiex_get_mapping(skb, &mapping); |
| 49 | 72 | ||
| 50 | return mapping.addr; | 73 | return mapping.addr; |
| 51 | } | 74 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 2f1cd929c6f6..a511cccc9f01 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
| @@ -1681,8 +1681,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
| 1681 | /* | 1681 | /* |
| 1682 | * Detect if this device has an hardware controlled radio. | 1682 | * Detect if this device has an hardware controlled radio. |
| 1683 | */ | 1683 | */ |
| 1684 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1684 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) { |
| 1685 | __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); | 1685 | __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); |
| 1686 | /* | ||
| 1687 | * On this device RFKILL initialized during probe does not work. | ||
| 1688 | */ | ||
| 1689 | __set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags); | ||
| 1690 | } | ||
| 1686 | 1691 | ||
| 1687 | /* | 1692 | /* |
| 1688 | * Check if the BBP tuning should be enabled. | 1693 | * Check if the BBP tuning should be enabled. |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index a49c3d73ea2c..e11dab2216c6 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
| @@ -229,6 +229,27 @@ static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer) | |||
| 229 | /* | 229 | /* |
| 230 | * Firmware functions | 230 | * Firmware functions |
| 231 | */ | 231 | */ |
| 232 | static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) | ||
| 233 | { | ||
| 234 | __le32 reg; | ||
| 235 | u32 fw_mode; | ||
| 236 | |||
| 237 | /* cannot use rt2x00usb_register_read here as it uses different | ||
| 238 | * mode (MULTI_READ vs. DEVICE_MODE) and does not pass the | ||
| 239 | * magic value USB_MODE_AUTORUN (0x11) to the device, thus the | ||
| 240 | * returned value would be invalid. | ||
| 241 | */ | ||
| 242 | rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, | ||
| 243 | USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN, | ||
| 244 | ®, sizeof(reg), REGISTER_TIMEOUT_FIRMWARE); | ||
| 245 | fw_mode = le32_to_cpu(reg); | ||
| 246 | |||
| 247 | if ((fw_mode & 0x00000003) == 2) | ||
| 248 | return 1; | ||
| 249 | |||
| 250 | return 0; | ||
| 251 | } | ||
| 252 | |||
| 232 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 253 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
| 233 | { | 254 | { |
| 234 | return FIRMWARE_RT2870; | 255 | return FIRMWARE_RT2870; |
| @@ -257,8 +278,13 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
| 257 | /* | 278 | /* |
| 258 | * Write firmware to device. | 279 | * Write firmware to device. |
| 259 | */ | 280 | */ |
| 260 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | 281 | if (rt2800usb_autorun_detect(rt2x00dev)) { |
| 261 | data + offset, length); | 282 | rt2x00_info(rt2x00dev, |
| 283 | "Firmware loading not required - NIC in AutoRun mode\n"); | ||
| 284 | } else { | ||
| 285 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | ||
| 286 | data + offset, length); | ||
| 287 | } | ||
| 262 | 288 | ||
| 263 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 289 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
| 264 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); | 290 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); |
| @@ -735,11 +761,18 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
| 735 | /* | 761 | /* |
| 736 | * Device probe functions. | 762 | * Device probe functions. |
| 737 | */ | 763 | */ |
| 764 | static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev) | ||
| 765 | { | ||
| 766 | if (rt2800usb_autorun_detect(rt2x00dev)) | ||
| 767 | return 1; | ||
| 768 | return rt2800_efuse_detect(rt2x00dev); | ||
| 769 | } | ||
| 770 | |||
| 738 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) | 771 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) |
| 739 | { | 772 | { |
| 740 | int retval; | 773 | int retval; |
| 741 | 774 | ||
| 742 | if (rt2800_efuse_detect(rt2x00dev)) | 775 | if (rt2800usb_efuse_detect(rt2x00dev)) |
| 743 | retval = rt2800_read_eeprom_efuse(rt2x00dev); | 776 | retval = rt2800_read_eeprom_efuse(rt2x00dev); |
| 744 | else | 777 | else |
| 745 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, | 778 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 010b76505243..d13f25cd70d5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
| @@ -693,6 +693,7 @@ enum rt2x00_capability_flags { | |||
| 693 | REQUIRE_SW_SEQNO, | 693 | REQUIRE_SW_SEQNO, |
| 694 | REQUIRE_HT_TX_DESC, | 694 | REQUIRE_HT_TX_DESC, |
| 695 | REQUIRE_PS_AUTOWAKE, | 695 | REQUIRE_PS_AUTOWAKE, |
| 696 | REQUIRE_DELAYED_RFKILL, | ||
| 696 | 697 | ||
| 697 | /* | 698 | /* |
| 698 | * Capabilities | 699 | * Capabilities |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 2bde6729f5e6..4fa43a2eeb73 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
| @@ -1126,9 +1126,10 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
| 1126 | return; | 1126 | return; |
| 1127 | 1127 | ||
| 1128 | /* | 1128 | /* |
| 1129 | * Unregister extra components. | 1129 | * Stop rfkill polling. |
| 1130 | */ | 1130 | */ |
| 1131 | rt2x00rfkill_unregister(rt2x00dev); | 1131 | if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) |
| 1132 | rt2x00rfkill_unregister(rt2x00dev); | ||
| 1132 | 1133 | ||
| 1133 | /* | 1134 | /* |
| 1134 | * Allow the HW to uninitialize. | 1135 | * Allow the HW to uninitialize. |
| @@ -1166,6 +1167,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
| 1166 | 1167 | ||
| 1167 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); | 1168 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); |
| 1168 | 1169 | ||
| 1170 | /* | ||
| 1171 | * Start rfkill polling. | ||
| 1172 | */ | ||
| 1173 | if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
| 1174 | rt2x00rfkill_register(rt2x00dev); | ||
| 1175 | |||
| 1169 | return 0; | 1176 | return 0; |
| 1170 | } | 1177 | } |
| 1171 | 1178 | ||
| @@ -1375,7 +1382,12 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
| 1375 | rt2x00link_register(rt2x00dev); | 1382 | rt2x00link_register(rt2x00dev); |
| 1376 | rt2x00leds_register(rt2x00dev); | 1383 | rt2x00leds_register(rt2x00dev); |
| 1377 | rt2x00debug_register(rt2x00dev); | 1384 | rt2x00debug_register(rt2x00dev); |
| 1378 | rt2x00rfkill_register(rt2x00dev); | 1385 | |
| 1386 | /* | ||
| 1387 | * Start rfkill polling. | ||
| 1388 | */ | ||
| 1389 | if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
| 1390 | rt2x00rfkill_register(rt2x00dev); | ||
| 1379 | 1391 | ||
| 1380 | return 0; | 1392 | return 0; |
| 1381 | 1393 | ||
| @@ -1391,6 +1403,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
| 1391 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | 1403 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
| 1392 | 1404 | ||
| 1393 | /* | 1405 | /* |
| 1406 | * Stop rfkill polling. | ||
| 1407 | */ | ||
| 1408 | if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
| 1409 | rt2x00rfkill_unregister(rt2x00dev); | ||
| 1410 | |||
| 1411 | /* | ||
| 1394 | * Disable radio. | 1412 | * Disable radio. |
| 1395 | */ | 1413 | */ |
| 1396 | rt2x00lib_disable_radio(rt2x00dev); | 1414 | rt2x00lib_disable_radio(rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 212ac4842c16..004dff9b962d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
| @@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
| 487 | crypto.cipher = rt2x00crypto_key_to_cipher(key); | 487 | crypto.cipher = rt2x00crypto_key_to_cipher(key); |
| 488 | if (crypto.cipher == CIPHER_NONE) | 488 | if (crypto.cipher == CIPHER_NONE) |
| 489 | return -EOPNOTSUPP; | 489 | return -EOPNOTSUPP; |
| 490 | if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev)) | ||
| 491 | return -EOPNOTSUPP; | ||
| 490 | 492 | ||
| 491 | crypto.cmd = cmd; | 493 | crypto.cmd = cmd; |
| 492 | 494 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index e7bcf62347d5..831b65f93feb 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
| @@ -93,6 +93,7 @@ enum rt2x00usb_mode_offset { | |||
| 93 | USB_MODE_SLEEP = 7, /* RT73USB */ | 93 | USB_MODE_SLEEP = 7, /* RT73USB */ |
| 94 | USB_MODE_FIRMWARE = 8, /* RT73USB */ | 94 | USB_MODE_FIRMWARE = 8, /* RT73USB */ |
| 95 | USB_MODE_WAKEUP = 9, /* RT73USB */ | 95 | USB_MODE_WAKEUP = 9, /* RT73USB */ |
| 96 | USB_MODE_AUTORUN = 17, /* RT2800USB */ | ||
| 96 | }; | 97 | }; |
| 97 | 98 | ||
| 98 | /** | 99 | /** |
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index 4dd7c4a1923b..2532ce85d718 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
| @@ -222,6 +222,7 @@ struct xenvif { | |||
| 222 | 222 | ||
| 223 | /* Queues */ | 223 | /* Queues */ |
| 224 | struct xenvif_queue *queues; | 224 | struct xenvif_queue *queues; |
| 225 | unsigned int num_queues; /* active queues, resource allocated */ | ||
| 225 | 226 | ||
| 226 | /* Miscellaneous private stuff. */ | 227 | /* Miscellaneous private stuff. */ |
| 227 | struct net_device *dev; | 228 | struct net_device *dev; |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 852da34b8961..9e97c7ca0ddd 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
| @@ -137,32 +137,11 @@ static void xenvif_wake_queue_callback(unsigned long data) | |||
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, | ||
| 141 | void *accel_priv, select_queue_fallback_t fallback) | ||
| 142 | { | ||
| 143 | unsigned int num_queues = dev->real_num_tx_queues; | ||
| 144 | u32 hash; | ||
| 145 | u16 queue_index; | ||
| 146 | |||
| 147 | /* First, check if there is only one queue to optimise the | ||
| 148 | * single-queue or old frontend scenario. | ||
| 149 | */ | ||
| 150 | if (num_queues == 1) { | ||
| 151 | queue_index = 0; | ||
| 152 | } else { | ||
| 153 | /* Use skb_get_hash to obtain an L4 hash if available */ | ||
| 154 | hash = skb_get_hash(skb); | ||
| 155 | queue_index = hash % num_queues; | ||
| 156 | } | ||
| 157 | |||
| 158 | return queue_index; | ||
| 159 | } | ||
| 160 | |||
| 161 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) | 140 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) |
| 162 | { | 141 | { |
| 163 | struct xenvif *vif = netdev_priv(dev); | 142 | struct xenvif *vif = netdev_priv(dev); |
| 164 | struct xenvif_queue *queue = NULL; | 143 | struct xenvif_queue *queue = NULL; |
| 165 | unsigned int num_queues = dev->real_num_tx_queues; | 144 | unsigned int num_queues = vif->num_queues; |
| 166 | u16 index; | 145 | u16 index; |
| 167 | int min_slots_needed; | 146 | int min_slots_needed; |
| 168 | 147 | ||
| @@ -225,7 +204,7 @@ static struct net_device_stats *xenvif_get_stats(struct net_device *dev) | |||
| 225 | { | 204 | { |
| 226 | struct xenvif *vif = netdev_priv(dev); | 205 | struct xenvif *vif = netdev_priv(dev); |
| 227 | struct xenvif_queue *queue = NULL; | 206 | struct xenvif_queue *queue = NULL; |
| 228 | unsigned int num_queues = dev->real_num_tx_queues; | 207 | unsigned int num_queues = vif->num_queues; |
| 229 | unsigned long rx_bytes = 0; | 208 | unsigned long rx_bytes = 0; |
| 230 | unsigned long rx_packets = 0; | 209 | unsigned long rx_packets = 0; |
| 231 | unsigned long tx_bytes = 0; | 210 | unsigned long tx_bytes = 0; |
| @@ -256,7 +235,7 @@ out: | |||
| 256 | static void xenvif_up(struct xenvif *vif) | 235 | static void xenvif_up(struct xenvif *vif) |
| 257 | { | 236 | { |
| 258 | struct xenvif_queue *queue = NULL; | 237 | struct xenvif_queue *queue = NULL; |
| 259 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 238 | unsigned int num_queues = vif->num_queues; |
| 260 | unsigned int queue_index; | 239 | unsigned int queue_index; |
| 261 | 240 | ||
| 262 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { | 241 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { |
| @@ -272,7 +251,7 @@ static void xenvif_up(struct xenvif *vif) | |||
| 272 | static void xenvif_down(struct xenvif *vif) | 251 | static void xenvif_down(struct xenvif *vif) |
| 273 | { | 252 | { |
| 274 | struct xenvif_queue *queue = NULL; | 253 | struct xenvif_queue *queue = NULL; |
| 275 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 254 | unsigned int num_queues = vif->num_queues; |
| 276 | unsigned int queue_index; | 255 | unsigned int queue_index; |
| 277 | 256 | ||
| 278 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { | 257 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { |
| @@ -379,7 +358,7 @@ static void xenvif_get_ethtool_stats(struct net_device *dev, | |||
| 379 | struct ethtool_stats *stats, u64 * data) | 358 | struct ethtool_stats *stats, u64 * data) |
| 380 | { | 359 | { |
| 381 | struct xenvif *vif = netdev_priv(dev); | 360 | struct xenvif *vif = netdev_priv(dev); |
| 382 | unsigned int num_queues = dev->real_num_tx_queues; | 361 | unsigned int num_queues = vif->num_queues; |
| 383 | int i; | 362 | int i; |
| 384 | unsigned int queue_index; | 363 | unsigned int queue_index; |
| 385 | struct xenvif_stats *vif_stats; | 364 | struct xenvif_stats *vif_stats; |
| @@ -424,7 +403,6 @@ static const struct net_device_ops xenvif_netdev_ops = { | |||
| 424 | .ndo_fix_features = xenvif_fix_features, | 403 | .ndo_fix_features = xenvif_fix_features, |
| 425 | .ndo_set_mac_address = eth_mac_addr, | 404 | .ndo_set_mac_address = eth_mac_addr, |
| 426 | .ndo_validate_addr = eth_validate_addr, | 405 | .ndo_validate_addr = eth_validate_addr, |
| 427 | .ndo_select_queue = xenvif_select_queue, | ||
| 428 | }; | 406 | }; |
| 429 | 407 | ||
| 430 | struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | 408 | struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, |
| @@ -438,7 +416,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
| 438 | snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); | 416 | snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); |
| 439 | /* Allocate a netdev with the max. supported number of queues. | 417 | /* Allocate a netdev with the max. supported number of queues. |
| 440 | * When the guest selects the desired number, it will be updated | 418 | * When the guest selects the desired number, it will be updated |
| 441 | * via netif_set_real_num_tx_queues(). | 419 | * via netif_set_real_num_*_queues(). |
| 442 | */ | 420 | */ |
| 443 | dev = alloc_netdev_mq(sizeof(struct xenvif), name, ether_setup, | 421 | dev = alloc_netdev_mq(sizeof(struct xenvif), name, ether_setup, |
| 444 | xenvif_max_queues); | 422 | xenvif_max_queues); |
| @@ -458,11 +436,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
| 458 | vif->dev = dev; | 436 | vif->dev = dev; |
| 459 | vif->disabled = false; | 437 | vif->disabled = false; |
| 460 | 438 | ||
| 461 | /* Start out with no queues. The call below does not require | 439 | /* Start out with no queues. */ |
| 462 | * rtnl_lock() as it happens before register_netdev(). | ||
| 463 | */ | ||
| 464 | vif->queues = NULL; | 440 | vif->queues = NULL; |
| 465 | netif_set_real_num_tx_queues(dev, 0); | 441 | vif->num_queues = 0; |
| 466 | 442 | ||
| 467 | dev->netdev_ops = &xenvif_netdev_ops; | 443 | dev->netdev_ops = &xenvif_netdev_ops; |
| 468 | dev->hw_features = NETIF_F_SG | | 444 | dev->hw_features = NETIF_F_SG | |
| @@ -677,7 +653,7 @@ static void xenvif_wait_unmap_timeout(struct xenvif_queue *queue, | |||
| 677 | void xenvif_disconnect(struct xenvif *vif) | 653 | void xenvif_disconnect(struct xenvif *vif) |
| 678 | { | 654 | { |
| 679 | struct xenvif_queue *queue = NULL; | 655 | struct xenvif_queue *queue = NULL; |
| 680 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 656 | unsigned int num_queues = vif->num_queues; |
| 681 | unsigned int queue_index; | 657 | unsigned int queue_index; |
| 682 | 658 | ||
| 683 | if (netif_carrier_ok(vif->dev)) | 659 | if (netif_carrier_ok(vif->dev)) |
| @@ -724,7 +700,7 @@ void xenvif_deinit_queue(struct xenvif_queue *queue) | |||
| 724 | void xenvif_free(struct xenvif *vif) | 700 | void xenvif_free(struct xenvif *vif) |
| 725 | { | 701 | { |
| 726 | struct xenvif_queue *queue = NULL; | 702 | struct xenvif_queue *queue = NULL; |
| 727 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 703 | unsigned int num_queues = vif->num_queues; |
| 728 | unsigned int queue_index; | 704 | unsigned int queue_index; |
| 729 | /* Here we want to avoid timeout messages if an skb can be legitimately | 705 | /* Here we want to avoid timeout messages if an skb can be legitimately |
| 730 | * stuck somewhere else. Realistically this could be an another vif's | 706 | * stuck somewhere else. Realistically this could be an another vif's |
| @@ -748,12 +724,9 @@ void xenvif_free(struct xenvif *vif) | |||
| 748 | xenvif_deinit_queue(queue); | 724 | xenvif_deinit_queue(queue); |
| 749 | } | 725 | } |
| 750 | 726 | ||
| 751 | /* Free the array of queues. The call below does not require | ||
| 752 | * rtnl_lock() because it happens after unregister_netdev(). | ||
| 753 | */ | ||
| 754 | netif_set_real_num_tx_queues(vif->dev, 0); | ||
| 755 | vfree(vif->queues); | 727 | vfree(vif->queues); |
| 756 | vif->queues = NULL; | 728 | vif->queues = NULL; |
| 729 | vif->num_queues = 0; | ||
| 757 | 730 | ||
| 758 | free_netdev(vif->dev); | 731 | free_netdev(vif->dev); |
| 759 | 732 | ||
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 96c63dc2509e..3d85acd84bad 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
| @@ -527,9 +527,7 @@ static void connect(struct backend_info *be) | |||
| 527 | /* Use the number of queues requested by the frontend */ | 527 | /* Use the number of queues requested by the frontend */ |
| 528 | be->vif->queues = vzalloc(requested_num_queues * | 528 | be->vif->queues = vzalloc(requested_num_queues * |
| 529 | sizeof(struct xenvif_queue)); | 529 | sizeof(struct xenvif_queue)); |
| 530 | rtnl_lock(); | 530 | be->vif->num_queues = requested_num_queues; |
| 531 | netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); | ||
| 532 | rtnl_unlock(); | ||
| 533 | 531 | ||
| 534 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { | 532 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { |
| 535 | queue = &be->vif->queues[queue_index]; | 533 | queue = &be->vif->queues[queue_index]; |
| @@ -546,9 +544,7 @@ static void connect(struct backend_info *be) | |||
| 546 | * earlier queues can be destroyed using the regular | 544 | * earlier queues can be destroyed using the regular |
| 547 | * disconnect logic. | 545 | * disconnect logic. |
| 548 | */ | 546 | */ |
| 549 | rtnl_lock(); | 547 | be->vif->num_queues = queue_index; |
| 550 | netif_set_real_num_tx_queues(be->vif->dev, queue_index); | ||
| 551 | rtnl_unlock(); | ||
| 552 | goto err; | 548 | goto err; |
| 553 | } | 549 | } |
| 554 | 550 | ||
| @@ -561,13 +557,19 @@ static void connect(struct backend_info *be) | |||
| 561 | * and also clean up any previously initialised queues. | 557 | * and also clean up any previously initialised queues. |
| 562 | */ | 558 | */ |
| 563 | xenvif_deinit_queue(queue); | 559 | xenvif_deinit_queue(queue); |
| 564 | rtnl_lock(); | 560 | be->vif->num_queues = queue_index; |
| 565 | netif_set_real_num_tx_queues(be->vif->dev, queue_index); | ||
| 566 | rtnl_unlock(); | ||
| 567 | goto err; | 561 | goto err; |
| 568 | } | 562 | } |
| 569 | } | 563 | } |
| 570 | 564 | ||
| 565 | /* Initialisation completed, tell core driver the number of | ||
| 566 | * active queues. | ||
| 567 | */ | ||
| 568 | rtnl_lock(); | ||
| 569 | netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); | ||
| 570 | netif_set_real_num_rx_queues(be->vif->dev, requested_num_queues); | ||
| 571 | rtnl_unlock(); | ||
| 572 | |||
| 571 | xenvif_carrier_on(be->vif); | 573 | xenvif_carrier_on(be->vif); |
| 572 | 574 | ||
| 573 | unregister_hotplug_status_watch(be); | 575 | unregister_hotplug_status_watch(be); |
| @@ -582,13 +584,11 @@ static void connect(struct backend_info *be) | |||
| 582 | return; | 584 | return; |
| 583 | 585 | ||
| 584 | err: | 586 | err: |
| 585 | if (be->vif->dev->real_num_tx_queues > 0) | 587 | if (be->vif->num_queues > 0) |
| 586 | xenvif_disconnect(be->vif); /* Clean up existing queues */ | 588 | xenvif_disconnect(be->vif); /* Clean up existing queues */ |
| 587 | vfree(be->vif->queues); | 589 | vfree(be->vif->queues); |
| 588 | be->vif->queues = NULL; | 590 | be->vif->queues = NULL; |
| 589 | rtnl_lock(); | 591 | be->vif->num_queues = 0; |
| 590 | netif_set_real_num_tx_queues(be->vif->dev, 0); | ||
| 591 | rtnl_unlock(); | ||
| 592 | return; | 592 | return; |
| 593 | } | 593 | } |
| 594 | 594 | ||
| @@ -596,7 +596,7 @@ err: | |||
| 596 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue) | 596 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue) |
| 597 | { | 597 | { |
| 598 | struct xenbus_device *dev = be->dev; | 598 | struct xenbus_device *dev = be->dev; |
| 599 | unsigned int num_queues = queue->vif->dev->real_num_tx_queues; | 599 | unsigned int num_queues = queue->vif->num_queues; |
| 600 | unsigned long tx_ring_ref, rx_ring_ref; | 600 | unsigned long tx_ring_ref, rx_ring_ref; |
| 601 | unsigned int tx_evtchn, rx_evtchn; | 601 | unsigned int tx_evtchn, rx_evtchn; |
| 602 | int err; | 602 | int err; |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 5a7872ac3566..2ccb4a02368b 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
| @@ -1287,7 +1287,7 @@ static irqreturn_t xennet_rx_interrupt(int irq, void *dev_id) | |||
| 1287 | 1287 | ||
| 1288 | if (likely(netif_carrier_ok(dev) && | 1288 | if (likely(netif_carrier_ok(dev) && |
| 1289 | RING_HAS_UNCONSUMED_RESPONSES(&queue->rx))) | 1289 | RING_HAS_UNCONSUMED_RESPONSES(&queue->rx))) |
| 1290 | napi_schedule(&queue->napi); | 1290 | napi_schedule(&queue->napi); |
| 1291 | 1291 | ||
| 1292 | return IRQ_HANDLED; | 1292 | return IRQ_HANDLED; |
| 1293 | } | 1293 | } |
| @@ -1437,10 +1437,11 @@ static void xennet_end_access(int ref, void *page) | |||
| 1437 | static void xennet_disconnect_backend(struct netfront_info *info) | 1437 | static void xennet_disconnect_backend(struct netfront_info *info) |
| 1438 | { | 1438 | { |
| 1439 | unsigned int i = 0; | 1439 | unsigned int i = 0; |
| 1440 | struct netfront_queue *queue = NULL; | ||
| 1441 | unsigned int num_queues = info->netdev->real_num_tx_queues; | 1440 | unsigned int num_queues = info->netdev->real_num_tx_queues; |
| 1442 | 1441 | ||
| 1443 | for (i = 0; i < num_queues; ++i) { | 1442 | for (i = 0; i < num_queues; ++i) { |
| 1443 | struct netfront_queue *queue = &info->queues[i]; | ||
| 1444 | |||
| 1444 | /* Stop old i/f to prevent errors whilst we rebuild the state. */ | 1445 | /* Stop old i/f to prevent errors whilst we rebuild the state. */ |
| 1445 | spin_lock_bh(&queue->rx_lock); | 1446 | spin_lock_bh(&queue->rx_lock); |
| 1446 | spin_lock_irq(&queue->tx_lock); | 1447 | spin_lock_irq(&queue->tx_lock); |
| @@ -1698,8 +1699,6 @@ static int xennet_init_queue(struct netfront_queue *queue) | |||
| 1698 | goto exit_free_tx; | 1699 | goto exit_free_tx; |
| 1699 | } | 1700 | } |
| 1700 | 1701 | ||
| 1701 | netif_napi_add(queue->info->netdev, &queue->napi, xennet_poll, 64); | ||
| 1702 | |||
| 1703 | return 0; | 1702 | return 0; |
| 1704 | 1703 | ||
| 1705 | exit_free_tx: | 1704 | exit_free_tx: |
| @@ -1790,6 +1789,70 @@ error: | |||
| 1790 | return err; | 1789 | return err; |
| 1791 | } | 1790 | } |
| 1792 | 1791 | ||
| 1792 | static void xennet_destroy_queues(struct netfront_info *info) | ||
| 1793 | { | ||
| 1794 | unsigned int i; | ||
| 1795 | |||
| 1796 | rtnl_lock(); | ||
| 1797 | |||
| 1798 | for (i = 0; i < info->netdev->real_num_tx_queues; i++) { | ||
| 1799 | struct netfront_queue *queue = &info->queues[i]; | ||
| 1800 | |||
| 1801 | if (netif_running(info->netdev)) | ||
| 1802 | napi_disable(&queue->napi); | ||
| 1803 | netif_napi_del(&queue->napi); | ||
| 1804 | } | ||
| 1805 | |||
| 1806 | rtnl_unlock(); | ||
| 1807 | |||
| 1808 | kfree(info->queues); | ||
| 1809 | info->queues = NULL; | ||
| 1810 | } | ||
| 1811 | |||
| 1812 | static int xennet_create_queues(struct netfront_info *info, | ||
| 1813 | unsigned int num_queues) | ||
| 1814 | { | ||
| 1815 | unsigned int i; | ||
| 1816 | int ret; | ||
| 1817 | |||
| 1818 | info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), | ||
| 1819 | GFP_KERNEL); | ||
| 1820 | if (!info->queues) | ||
| 1821 | return -ENOMEM; | ||
| 1822 | |||
| 1823 | rtnl_lock(); | ||
| 1824 | |||
| 1825 | for (i = 0; i < num_queues; i++) { | ||
| 1826 | struct netfront_queue *queue = &info->queues[i]; | ||
| 1827 | |||
| 1828 | queue->id = i; | ||
| 1829 | queue->info = info; | ||
| 1830 | |||
| 1831 | ret = xennet_init_queue(queue); | ||
| 1832 | if (ret < 0) { | ||
| 1833 | dev_warn(&info->netdev->dev, "only created %d queues\n", | ||
| 1834 | num_queues); | ||
| 1835 | num_queues = i; | ||
| 1836 | break; | ||
| 1837 | } | ||
| 1838 | |||
| 1839 | netif_napi_add(queue->info->netdev, &queue->napi, | ||
| 1840 | xennet_poll, 64); | ||
| 1841 | if (netif_running(info->netdev)) | ||
| 1842 | napi_enable(&queue->napi); | ||
| 1843 | } | ||
| 1844 | |||
| 1845 | netif_set_real_num_tx_queues(info->netdev, num_queues); | ||
| 1846 | |||
| 1847 | rtnl_unlock(); | ||
| 1848 | |||
| 1849 | if (num_queues == 0) { | ||
| 1850 | dev_err(&info->netdev->dev, "no queues\n"); | ||
| 1851 | return -EINVAL; | ||
| 1852 | } | ||
| 1853 | return 0; | ||
| 1854 | } | ||
| 1855 | |||
| 1793 | /* Common code used when first setting up, and when resuming. */ | 1856 | /* Common code used when first setting up, and when resuming. */ |
| 1794 | static int talk_to_netback(struct xenbus_device *dev, | 1857 | static int talk_to_netback(struct xenbus_device *dev, |
| 1795 | struct netfront_info *info) | 1858 | struct netfront_info *info) |
| @@ -1826,42 +1889,20 @@ static int talk_to_netback(struct xenbus_device *dev, | |||
| 1826 | goto out; | 1889 | goto out; |
| 1827 | } | 1890 | } |
| 1828 | 1891 | ||
| 1829 | /* Allocate array of queues */ | 1892 | if (info->queues) |
| 1830 | info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), GFP_KERNEL); | 1893 | xennet_destroy_queues(info); |
| 1831 | if (!info->queues) { | 1894 | |
| 1832 | err = -ENOMEM; | 1895 | err = xennet_create_queues(info, num_queues); |
| 1833 | goto out; | 1896 | if (err < 0) |
| 1834 | } | 1897 | goto destroy_ring; |
| 1835 | rtnl_lock(); | ||
| 1836 | netif_set_real_num_tx_queues(info->netdev, num_queues); | ||
| 1837 | rtnl_unlock(); | ||
| 1838 | 1898 | ||
| 1839 | /* Create shared ring, alloc event channel -- for each queue */ | 1899 | /* Create shared ring, alloc event channel -- for each queue */ |
| 1840 | for (i = 0; i < num_queues; ++i) { | 1900 | for (i = 0; i < num_queues; ++i) { |
| 1841 | queue = &info->queues[i]; | 1901 | queue = &info->queues[i]; |
| 1842 | queue->id = i; | ||
| 1843 | queue->info = info; | ||
| 1844 | err = xennet_init_queue(queue); | ||
| 1845 | if (err) { | ||
| 1846 | /* xennet_init_queue() cleans up after itself on failure, | ||
| 1847 | * but we still have to clean up any previously initialised | ||
| 1848 | * queues. If i > 0, set num_queues to i, then goto | ||
| 1849 | * destroy_ring, which calls xennet_disconnect_backend() | ||
| 1850 | * to tidy up. | ||
| 1851 | */ | ||
| 1852 | if (i > 0) { | ||
| 1853 | rtnl_lock(); | ||
| 1854 | netif_set_real_num_tx_queues(info->netdev, i); | ||
| 1855 | rtnl_unlock(); | ||
| 1856 | goto destroy_ring; | ||
| 1857 | } else { | ||
| 1858 | goto out; | ||
| 1859 | } | ||
| 1860 | } | ||
| 1861 | err = setup_netfront(dev, queue, feature_split_evtchn); | 1902 | err = setup_netfront(dev, queue, feature_split_evtchn); |
| 1862 | if (err) { | 1903 | if (err) { |
| 1863 | /* As for xennet_init_queue(), setup_netfront() will tidy | 1904 | /* setup_netfront() will tidy up the current |
| 1864 | * up the current queue on error, but we need to clean up | 1905 | * queue on error, but we need to clean up |
| 1865 | * those already allocated. | 1906 | * those already allocated. |
| 1866 | */ | 1907 | */ |
| 1867 | if (i > 0) { | 1908 | if (i > 0) { |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index fb4a59830648..a3bf2122a8d5 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
| @@ -323,11 +323,13 @@ int of_phy_register_fixed_link(struct device_node *np) | |||
| 323 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); | 323 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); |
| 324 | if (fixed_link_node) { | 324 | if (fixed_link_node) { |
| 325 | status.link = 1; | 325 | status.link = 1; |
| 326 | status.duplex = of_property_read_bool(np, "full-duplex"); | 326 | status.duplex = of_property_read_bool(fixed_link_node, |
| 327 | "full-duplex"); | ||
| 327 | if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) | 328 | if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) |
| 328 | return -EINVAL; | 329 | return -EINVAL; |
| 329 | status.pause = of_property_read_bool(np, "pause"); | 330 | status.pause = of_property_read_bool(fixed_link_node, "pause"); |
| 330 | status.asym_pause = of_property_read_bool(np, "asym-pause"); | 331 | status.asym_pause = of_property_read_bool(fixed_link_node, |
| 332 | "asym-pause"); | ||
| 331 | of_node_put(fixed_link_node); | 333 | of_node_put(fixed_link_node); |
| 332 | return fixed_phy_register(PHY_POLL, &status, np); | 334 | return fixed_phy_register(PHY_POLL, &status, np); |
| 333 | } | 335 | } |
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig index 6aea373547f6..ee3de3421f2d 100644 --- a/drivers/ptp/Kconfig +++ b/drivers/ptp/Kconfig | |||
| @@ -74,7 +74,7 @@ config DP83640_PHY | |||
| 74 | 74 | ||
| 75 | config PTP_1588_CLOCK_PCH | 75 | config PTP_1588_CLOCK_PCH |
| 76 | tristate "Intel PCH EG20T as PTP clock" | 76 | tristate "Intel PCH EG20T as PTP clock" |
| 77 | depends on X86 || COMPILE_TEST | 77 | depends on X86_32 || COMPILE_TEST |
| 78 | depends on HAS_IOMEM && NET | 78 | depends on HAS_IOMEM && NET |
| 79 | select PTP_1588_CLOCK | 79 | select PTP_1588_CLOCK |
| 80 | help | 80 | help |
diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c index 57544e254a78..58ece59367ae 100644 --- a/drivers/regulator/bcm590xx-regulator.c +++ b/drivers/regulator/bcm590xx-regulator.c | |||
| @@ -119,6 +119,10 @@ static const unsigned int ldo_c_table[] = { | |||
| 119 | 2900000, 3000000, 3300000, | 119 | 2900000, 3000000, 3300000, |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | static const unsigned int ldo_vbus[] = { | ||
| 123 | 5000000, | ||
| 124 | }; | ||
| 125 | |||
| 122 | /* DCDC group CSR: supported voltages in microvolts */ | 126 | /* DCDC group CSR: supported voltages in microvolts */ |
| 123 | static const struct regulator_linear_range dcdc_csr_ranges[] = { | 127 | static const struct regulator_linear_range dcdc_csr_ranges[] = { |
| 124 | REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), | 128 | REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), |
| @@ -192,6 +196,7 @@ static struct bcm590xx_info bcm590xx_regs[] = { | |||
| 192 | BCM590XX_REG_TABLE(gpldo4, ldo_a_table), | 196 | BCM590XX_REG_TABLE(gpldo4, ldo_a_table), |
| 193 | BCM590XX_REG_TABLE(gpldo5, ldo_a_table), | 197 | BCM590XX_REG_TABLE(gpldo5, ldo_a_table), |
| 194 | BCM590XX_REG_TABLE(gpldo6, ldo_a_table), | 198 | BCM590XX_REG_TABLE(gpldo6, ldo_a_table), |
| 199 | BCM590XX_REG_TABLE(vbus, ldo_vbus), | ||
| 195 | }; | 200 | }; |
| 196 | 201 | ||
| 197 | struct bcm590xx_reg { | 202 | struct bcm590xx_reg { |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index b982f0ff4e01..93b4ad842901 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
| @@ -325,6 +325,10 @@ static int palmas_set_mode_smps(struct regulator_dev *dev, unsigned int mode) | |||
| 325 | if (rail_enable) | 325 | if (rail_enable) |
| 326 | palmas_smps_write(pmic->palmas, | 326 | palmas_smps_write(pmic->palmas, |
| 327 | palmas_regs_info[id].ctrl_addr, reg); | 327 | palmas_regs_info[id].ctrl_addr, reg); |
| 328 | |||
| 329 | /* Switch the enable value to ensure this is used for enable */ | ||
| 330 | pmic->desc[id].enable_val = pmic->current_reg_mode[id]; | ||
| 331 | |||
| 328 | return 0; | 332 | return 0; |
| 329 | } | 333 | } |
| 330 | 334 | ||
| @@ -964,6 +968,14 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
| 964 | return ret; | 968 | return ret; |
| 965 | pmic->current_reg_mode[id] = reg & | 969 | pmic->current_reg_mode[id] = reg & |
| 966 | PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; | 970 | PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; |
| 971 | |||
| 972 | pmic->desc[id].enable_reg = | ||
| 973 | PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, | ||
| 974 | palmas_regs_info[id].ctrl_addr); | ||
| 975 | pmic->desc[id].enable_mask = | ||
| 976 | PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; | ||
| 977 | /* set_mode overrides this value */ | ||
| 978 | pmic->desc[id].enable_val = SMPS_CTRL_MODE_ON; | ||
| 967 | } | 979 | } |
| 968 | 980 | ||
| 969 | pmic->desc[id].type = REGULATOR_VOLTAGE; | 981 | pmic->desc[id].type = REGULATOR_VOLTAGE; |
diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c index 69b4b7750410..9effe48c605e 100644 --- a/drivers/regulator/tps65218-regulator.c +++ b/drivers/regulator/tps65218-regulator.c | |||
| @@ -209,7 +209,7 @@ static const struct regulator_desc regulators[] = { | |||
| 209 | 1, -1, -1, TPS65218_REG_ENABLE1, | 209 | 1, -1, -1, TPS65218_REG_ENABLE1, |
| 210 | TPS65218_ENABLE1_DC6_EN, NULL, NULL, 0, 0), | 210 | TPS65218_ENABLE1_DC6_EN, NULL, NULL, 0, 0), |
| 211 | TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64, | 211 | TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64, |
| 212 | TPS65218_REG_CONTROL_DCDC4, | 212 | TPS65218_REG_CONTROL_LDO1, |
| 213 | TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, | 213 | TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, |
| 214 | TPS65218_ENABLE2_LDO1_EN, NULL, ldo1_dcdc3_ranges, | 214 | TPS65218_ENABLE2_LDO1_EN, NULL, ldo1_dcdc3_ranges, |
| 215 | 2, 0), | 215 | 2, 0), |
| @@ -240,6 +240,7 @@ static int tps65218_regulator_probe(struct platform_device *pdev) | |||
| 240 | config.init_data = init_data; | 240 | config.init_data = init_data; |
| 241 | config.driver_data = tps; | 241 | config.driver_data = tps; |
| 242 | config.regmap = tps->regmap; | 242 | config.regmap = tps->regmap; |
| 243 | config.of_node = pdev->dev.of_node; | ||
| 243 | 244 | ||
| 244 | rdev = devm_regulator_register(&pdev->dev, ®ulators[id], &config); | 245 | rdev = devm_regulator_register(&pdev->dev, ®ulators[id], &config); |
| 245 | if (IS_ERR(rdev)) { | 246 | if (IS_ERR(rdev)) { |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e9689d57ccb6..6825eda1114a 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -2441,7 +2441,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) | |||
| 2441 | } | 2441 | } |
| 2442 | 2442 | ||
| 2443 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; | 2443 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; |
| 2444 | if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | 2444 | if (sdp->broken_fua) { |
| 2445 | sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n"); | ||
| 2446 | sdkp->DPOFUA = 0; | ||
| 2447 | } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | ||
| 2445 | sd_first_printk(KERN_NOTICE, sdkp, | 2448 | sd_first_printk(KERN_NOTICE, sdkp, |
| 2446 | "Uses READ/WRITE(6), disabling FUA\n"); | 2449 | "Uses READ/WRITE(6), disabling FUA\n"); |
| 2447 | sdkp->DPOFUA = 0; | 2450 | sdkp->DPOFUA = 0; |
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index a98df7eeb42d..fe792106bdc5 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
| @@ -118,6 +118,7 @@ static void lpss_ssp_setup(struct driver_data *drv_data) | |||
| 118 | */ | 118 | */ |
| 119 | orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); | 119 | orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
| 120 | 120 | ||
| 121 | /* Test SPI_CS_CONTROL_SW_MODE bit enabling */ | ||
| 121 | value = orig | SPI_CS_CONTROL_SW_MODE; | 122 | value = orig | SPI_CS_CONTROL_SW_MODE; |
| 122 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); | 123 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); |
| 123 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); | 124 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
| @@ -126,10 +127,13 @@ static void lpss_ssp_setup(struct driver_data *drv_data) | |||
| 126 | goto detection_done; | 127 | goto detection_done; |
| 127 | } | 128 | } |
| 128 | 129 | ||
| 129 | value &= ~SPI_CS_CONTROL_SW_MODE; | 130 | orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
| 131 | |||
| 132 | /* Test SPI_CS_CONTROL_SW_MODE bit disabling */ | ||
| 133 | value = orig & ~SPI_CS_CONTROL_SW_MODE; | ||
| 130 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); | 134 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); |
| 131 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); | 135 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
| 132 | if (value != orig) { | 136 | if (value != (orig & ~SPI_CS_CONTROL_SW_MODE)) { |
| 133 | offset = 0x800; | 137 | offset = 0x800; |
| 134 | goto detection_done; | 138 | goto detection_done; |
| 135 | } | 139 | } |
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index fc1de86d3c8a..c08da380cb23 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c | |||
| @@ -424,31 +424,6 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) | |||
| 424 | return 0; | 424 | return 0; |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | static void spi_qup_set_cs(struct spi_device *spi, bool enable) | ||
| 428 | { | ||
| 429 | struct spi_qup *controller = spi_master_get_devdata(spi->master); | ||
| 430 | |||
| 431 | u32 iocontol, mask; | ||
| 432 | |||
| 433 | iocontol = readl_relaxed(controller->base + SPI_IO_CONTROL); | ||
| 434 | |||
| 435 | /* Disable auto CS toggle and use manual */ | ||
| 436 | iocontol &= ~SPI_IO_C_MX_CS_MODE; | ||
| 437 | iocontol |= SPI_IO_C_FORCE_CS; | ||
| 438 | |||
| 439 | iocontol &= ~SPI_IO_C_CS_SELECT_MASK; | ||
| 440 | iocontol |= SPI_IO_C_CS_SELECT(spi->chip_select); | ||
| 441 | |||
| 442 | mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select; | ||
| 443 | |||
| 444 | if (enable) | ||
| 445 | iocontol |= mask; | ||
| 446 | else | ||
| 447 | iocontol &= ~mask; | ||
| 448 | |||
| 449 | writel_relaxed(iocontol, controller->base + SPI_IO_CONTROL); | ||
| 450 | } | ||
| 451 | |||
| 452 | static int spi_qup_transfer_one(struct spi_master *master, | 427 | static int spi_qup_transfer_one(struct spi_master *master, |
| 453 | struct spi_device *spi, | 428 | struct spi_device *spi, |
| 454 | struct spi_transfer *xfer) | 429 | struct spi_transfer *xfer) |
| @@ -571,12 +546,16 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 571 | return -ENOMEM; | 546 | return -ENOMEM; |
| 572 | } | 547 | } |
| 573 | 548 | ||
| 549 | /* use num-cs unless not present or out of range */ | ||
| 550 | if (of_property_read_u16(dev->of_node, "num-cs", | ||
| 551 | &master->num_chipselect) || | ||
| 552 | (master->num_chipselect > SPI_NUM_CHIPSELECTS)) | ||
| 553 | master->num_chipselect = SPI_NUM_CHIPSELECTS; | ||
| 554 | |||
| 574 | master->bus_num = pdev->id; | 555 | master->bus_num = pdev->id; |
| 575 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; | 556 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; |
| 576 | master->num_chipselect = SPI_NUM_CHIPSELECTS; | ||
| 577 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); | 557 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); |
| 578 | master->max_speed_hz = max_freq; | 558 | master->max_speed_hz = max_freq; |
| 579 | master->set_cs = spi_qup_set_cs; | ||
| 580 | master->transfer_one = spi_qup_transfer_one; | 559 | master->transfer_one = spi_qup_transfer_one; |
| 581 | master->dev.of_node = pdev->dev.of_node; | 560 | master->dev.of_node = pdev->dev.of_node; |
| 582 | master->auto_runtime_pm = true; | 561 | master->auto_runtime_pm = true; |
| @@ -640,16 +619,19 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 640 | if (ret) | 619 | if (ret) |
| 641 | goto error; | 620 | goto error; |
| 642 | 621 | ||
| 643 | ret = devm_spi_register_master(dev, master); | ||
| 644 | if (ret) | ||
| 645 | goto error; | ||
| 646 | |||
| 647 | pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); | 622 | pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); |
| 648 | pm_runtime_use_autosuspend(dev); | 623 | pm_runtime_use_autosuspend(dev); |
| 649 | pm_runtime_set_active(dev); | 624 | pm_runtime_set_active(dev); |
| 650 | pm_runtime_enable(dev); | 625 | pm_runtime_enable(dev); |
| 626 | |||
| 627 | ret = devm_spi_register_master(dev, master); | ||
| 628 | if (ret) | ||
| 629 | goto disable_pm; | ||
| 630 | |||
| 651 | return 0; | 631 | return 0; |
| 652 | 632 | ||
| 633 | disable_pm: | ||
| 634 | pm_runtime_disable(&pdev->dev); | ||
| 653 | error: | 635 | error: |
| 654 | clk_disable_unprepare(cclk); | 636 | clk_disable_unprepare(cclk); |
| 655 | clk_disable_unprepare(iclk); | 637 | clk_disable_unprepare(iclk); |
diff --git a/drivers/spi/spi-sh-sci.c b/drivers/spi/spi-sh-sci.c index 1f56ef651d1a..b83dd733684c 100644 --- a/drivers/spi/spi-sh-sci.c +++ b/drivers/spi/spi-sh-sci.c | |||
| @@ -175,9 +175,9 @@ static int sh_sci_spi_remove(struct platform_device *dev) | |||
| 175 | { | 175 | { |
| 176 | struct sh_sci_spi *sp = platform_get_drvdata(dev); | 176 | struct sh_sci_spi *sp = platform_get_drvdata(dev); |
| 177 | 177 | ||
| 178 | iounmap(sp->membase); | ||
| 179 | setbits(sp, PIN_INIT, 0); | ||
| 180 | spi_bitbang_stop(&sp->bitbang); | 178 | spi_bitbang_stop(&sp->bitbang); |
| 179 | setbits(sp, PIN_INIT, 0); | ||
| 180 | iounmap(sp->membase); | ||
| 181 | spi_master_put(sp->bitbang.master); | 181 | spi_master_put(sp->bitbang.master); |
| 182 | return 0; | 182 | return 0; |
| 183 | } | 183 | } |
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c index 357cef2a6f4c..7194bd138762 100644 --- a/drivers/staging/iio/adc/ad7291.c +++ b/drivers/staging/iio/adc/ad7291.c | |||
| @@ -465,7 +465,7 @@ static int ad7291_probe(struct i2c_client *client, | |||
| 465 | struct ad7291_platform_data *pdata = client->dev.platform_data; | 465 | struct ad7291_platform_data *pdata = client->dev.platform_data; |
| 466 | struct ad7291_chip_info *chip; | 466 | struct ad7291_chip_info *chip; |
| 467 | struct iio_dev *indio_dev; | 467 | struct iio_dev *indio_dev; |
| 468 | int ret = 0; | 468 | int ret; |
| 469 | 469 | ||
| 470 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); | 470 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); |
| 471 | if (!indio_dev) | 471 | if (!indio_dev) |
| @@ -475,7 +475,7 @@ static int ad7291_probe(struct i2c_client *client, | |||
| 475 | if (pdata && pdata->use_external_ref) { | 475 | if (pdata && pdata->use_external_ref) { |
| 476 | chip->reg = devm_regulator_get(&client->dev, "vref"); | 476 | chip->reg = devm_regulator_get(&client->dev, "vref"); |
| 477 | if (IS_ERR(chip->reg)) | 477 | if (IS_ERR(chip->reg)) |
| 478 | return ret; | 478 | return PTR_ERR(chip->reg); |
| 479 | 479 | ||
| 480 | ret = regulator_enable(chip->reg); | 480 | ret = regulator_enable(chip->reg); |
| 481 | if (ret) | 481 | if (ret) |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 8945b4e3a2a6..cb50120ed7b5 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
| @@ -280,8 +280,10 @@ static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt) | |||
| 280 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); | 280 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); |
| 281 | 281 | ||
| 282 | /* Wait until the state has moved to ON */ | 282 | /* Wait until the state has moved to ON */ |
| 283 | while (*pdata->dsp_prm_read(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST)& | 283 | while ((*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD, |
| 284 | OMAP_INTRANSITION_MASK); | 284 | OMAP2_PM_PWSTST) & |
| 285 | OMAP_INTRANSITION_MASK) | ||
| 286 | ; | ||
| 285 | /* Disable Automatic transition */ | 287 | /* Disable Automatic transition */ |
| 286 | (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, | 288 | (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, |
| 287 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); | 289 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 5663f4d19d02..1f4c794f5fcc 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
| @@ -1309,7 +1309,7 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf, | |||
| 1309 | if (cmd->data_direction != DMA_TO_DEVICE) { | 1309 | if (cmd->data_direction != DMA_TO_DEVICE) { |
| 1310 | pr_err("Command ITT: 0x%08x received DataOUT for a" | 1310 | pr_err("Command ITT: 0x%08x received DataOUT for a" |
| 1311 | " NON-WRITE command.\n", cmd->init_task_tag); | 1311 | " NON-WRITE command.\n", cmd->init_task_tag); |
| 1312 | return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf); | 1312 | return iscsit_dump_data_payload(conn, payload_length, 1); |
| 1313 | } | 1313 | } |
| 1314 | se_cmd = &cmd->se_cmd; | 1314 | se_cmd = &cmd->se_cmd; |
| 1315 | iscsit_mod_dataout_timer(cmd); | 1315 | iscsit_mod_dataout_timer(cmd); |
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index 19b842c3e0b3..ab4915c0d933 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
| @@ -174,7 +174,6 @@ static int chap_server_compute_md5( | |||
| 174 | char *nr_out_ptr, | 174 | char *nr_out_ptr, |
| 175 | unsigned int *nr_out_len) | 175 | unsigned int *nr_out_len) |
| 176 | { | 176 | { |
| 177 | char *endptr; | ||
| 178 | unsigned long id; | 177 | unsigned long id; |
| 179 | unsigned char id_as_uchar; | 178 | unsigned char id_as_uchar; |
| 180 | unsigned char digest[MD5_SIGNATURE_SIZE]; | 179 | unsigned char digest[MD5_SIGNATURE_SIZE]; |
| @@ -320,9 +319,14 @@ static int chap_server_compute_md5( | |||
| 320 | } | 319 | } |
| 321 | 320 | ||
| 322 | if (type == HEX) | 321 | if (type == HEX) |
| 323 | id = simple_strtoul(&identifier[2], &endptr, 0); | 322 | ret = kstrtoul(&identifier[2], 0, &id); |
| 324 | else | 323 | else |
| 325 | id = simple_strtoul(identifier, &endptr, 0); | 324 | ret = kstrtoul(identifier, 0, &id); |
| 325 | |||
| 326 | if (ret < 0) { | ||
| 327 | pr_err("kstrtoul() failed for CHAP identifier: %d\n", ret); | ||
| 328 | goto out; | ||
| 329 | } | ||
| 326 | if (id > 255) { | 330 | if (id > 255) { |
| 327 | pr_err("chap identifier: %lu greater than 255\n", id); | 331 | pr_err("chap identifier: %lu greater than 255\n", id); |
| 328 | goto out; | 332 | goto out; |
| @@ -351,6 +355,10 @@ static int chap_server_compute_md5( | |||
| 351 | pr_err("Unable to convert incoming challenge\n"); | 355 | pr_err("Unable to convert incoming challenge\n"); |
| 352 | goto out; | 356 | goto out; |
| 353 | } | 357 | } |
| 358 | if (challenge_len > 1024) { | ||
| 359 | pr_err("CHAP_C exceeds maximum binary size of 1024 bytes\n"); | ||
| 360 | goto out; | ||
| 361 | } | ||
| 354 | /* | 362 | /* |
| 355 | * During mutual authentication, the CHAP_C generated by the | 363 | * During mutual authentication, the CHAP_C generated by the |
| 356 | * initiator must not match the original CHAP_C generated by | 364 | * initiator must not match the original CHAP_C generated by |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index fecb69535a15..5e71ac609418 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
| @@ -1216,7 +1216,7 @@ old_sess_out: | |||
| 1216 | static int __iscsi_target_login_thread(struct iscsi_np *np) | 1216 | static int __iscsi_target_login_thread(struct iscsi_np *np) |
| 1217 | { | 1217 | { |
| 1218 | u8 *buffer, zero_tsih = 0; | 1218 | u8 *buffer, zero_tsih = 0; |
| 1219 | int ret = 0, rc, stop; | 1219 | int ret = 0, rc; |
| 1220 | struct iscsi_conn *conn = NULL; | 1220 | struct iscsi_conn *conn = NULL; |
| 1221 | struct iscsi_login *login; | 1221 | struct iscsi_login *login; |
| 1222 | struct iscsi_portal_group *tpg = NULL; | 1222 | struct iscsi_portal_group *tpg = NULL; |
| @@ -1230,6 +1230,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) | |||
| 1230 | if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { | 1230 | if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { |
| 1231 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; | 1231 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; |
| 1232 | complete(&np->np_restart_comp); | 1232 | complete(&np->np_restart_comp); |
| 1233 | } else if (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN) { | ||
| 1234 | spin_unlock_bh(&np->np_thread_lock); | ||
| 1235 | goto exit; | ||
| 1233 | } else { | 1236 | } else { |
| 1234 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; | 1237 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; |
| 1235 | } | 1238 | } |
| @@ -1422,10 +1425,8 @@ old_sess_out: | |||
| 1422 | } | 1425 | } |
| 1423 | 1426 | ||
| 1424 | out: | 1427 | out: |
| 1425 | stop = kthread_should_stop(); | 1428 | return 1; |
| 1426 | /* Wait for another socket.. */ | 1429 | |
| 1427 | if (!stop) | ||
| 1428 | return 1; | ||
| 1429 | exit: | 1430 | exit: |
| 1430 | iscsi_stop_login_thread_timer(np); | 1431 | iscsi_stop_login_thread_timer(np); |
| 1431 | spin_lock_bh(&np->np_thread_lock); | 1432 | spin_lock_bh(&np->np_thread_lock); |
| @@ -1442,7 +1443,7 @@ int iscsi_target_login_thread(void *arg) | |||
| 1442 | 1443 | ||
| 1443 | allow_signal(SIGINT); | 1444 | allow_signal(SIGINT); |
| 1444 | 1445 | ||
| 1445 | while (!kthread_should_stop()) { | 1446 | while (1) { |
| 1446 | ret = __iscsi_target_login_thread(np); | 1447 | ret = __iscsi_target_login_thread(np); |
| 1447 | /* | 1448 | /* |
| 1448 | * We break and exit here unless another sock_accept() call | 1449 | * We break and exit here unless another sock_accept() call |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 53e157cb8c54..fd90b28f1d94 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
| @@ -1295,6 +1295,8 @@ int iscsit_tx_login_rsp(struct iscsi_conn *conn, u8 status_class, u8 status_deta | |||
| 1295 | login->login_failed = 1; | 1295 | login->login_failed = 1; |
| 1296 | iscsit_collect_login_stats(conn, status_class, status_detail); | 1296 | iscsit_collect_login_stats(conn, status_class, status_detail); |
| 1297 | 1297 | ||
| 1298 | memset(&login->rsp[0], 0, ISCSI_HDR_LEN); | ||
| 1299 | |||
| 1298 | hdr = (struct iscsi_login_rsp *)&login->rsp[0]; | 1300 | hdr = (struct iscsi_login_rsp *)&login->rsp[0]; |
| 1299 | hdr->opcode = ISCSI_OP_LOGIN_RSP; | 1301 | hdr->opcode = ISCSI_OP_LOGIN_RSP; |
| 1300 | hdr->status_class = status_class; | 1302 | hdr->status_class = status_class; |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 6d2f37578b29..8c64b8776a96 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
| @@ -239,6 +239,7 @@ static void tcm_loop_submission_work(struct work_struct *work) | |||
| 239 | return; | 239 | return; |
| 240 | 240 | ||
| 241 | out_done: | 241 | out_done: |
| 242 | kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); | ||
| 242 | sc->scsi_done(sc); | 243 | sc->scsi_done(sc); |
| 243 | return; | 244 | return; |
| 244 | } | 245 | } |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 11d26fe65bfb..98da90167159 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
| @@ -616,6 +616,7 @@ void core_dev_unexport( | |||
| 616 | dev->export_count--; | 616 | dev->export_count--; |
| 617 | spin_unlock(&hba->device_lock); | 617 | spin_unlock(&hba->device_lock); |
| 618 | 618 | ||
| 619 | lun->lun_sep = NULL; | ||
| 619 | lun->lun_se_dev = NULL; | 620 | lun->lun_se_dev = NULL; |
| 620 | } | 621 | } |
| 621 | 622 | ||
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c index a8aaf6ac2ae2..946562389ca8 100644 --- a/drivers/tc/tc.c +++ b/drivers/tc/tc.c | |||
| @@ -129,7 +129,10 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus) | |||
| 129 | 129 | ||
| 130 | tc_device_get_irq(tdev); | 130 | tc_device_get_irq(tdev); |
| 131 | 131 | ||
| 132 | device_register(&tdev->dev); | 132 | if (device_register(&tdev->dev)) { |
| 133 | put_device(&tdev->dev); | ||
| 134 | goto out_err; | ||
| 135 | } | ||
| 133 | list_add_tail(&tdev->node, &tbus->devices); | 136 | list_add_tail(&tdev->node, &tbus->devices); |
| 134 | 137 | ||
| 135 | out_err: | 138 | out_err: |
| @@ -148,7 +151,10 @@ static int __init tc_init(void) | |||
| 148 | 151 | ||
| 149 | INIT_LIST_HEAD(&tc_bus.devices); | 152 | INIT_LIST_HEAD(&tc_bus.devices); |
| 150 | dev_set_name(&tc_bus.dev, "tc"); | 153 | dev_set_name(&tc_bus.dev, "tc"); |
| 151 | device_register(&tc_bus.dev); | 154 | if (device_register(&tc_bus.dev)) { |
| 155 | put_device(&tc_bus.dev); | ||
| 156 | return 0; | ||
| 157 | } | ||
| 152 | 158 | ||
| 153 | if (tc_bus.info.slot_size) { | 159 | if (tc_bus.info.slot_size) { |
| 154 | unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000; | 160 | unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000; |
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index c41aca4dfc43..72000a6d5af0 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c | |||
| @@ -991,7 +991,7 @@ static const struct of_device_id msm_uartdm_table[] = { | |||
| 991 | { } | 991 | { } |
| 992 | }; | 992 | }; |
| 993 | 993 | ||
| 994 | static int __init msm_serial_probe(struct platform_device *pdev) | 994 | static int msm_serial_probe(struct platform_device *pdev) |
| 995 | { | 995 | { |
| 996 | struct msm_port *msm_port; | 996 | struct msm_port *msm_port; |
| 997 | struct resource *resource; | 997 | struct resource *resource; |
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 69425b3cb6b7..9d2b673f90e3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
| @@ -1321,6 +1321,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
| 1321 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); | 1321 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
| 1322 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); | 1322 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); |
| 1323 | unsigned long flags; | 1323 | unsigned long flags; |
| 1324 | struct td_node *node, *tmpnode; | ||
| 1324 | 1325 | ||
| 1325 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || | 1326 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || |
| 1326 | hwep->ep.desc == NULL || list_empty(&hwreq->queue) || | 1327 | hwep->ep.desc == NULL || list_empty(&hwreq->queue) || |
| @@ -1331,6 +1332,12 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
| 1331 | 1332 | ||
| 1332 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); | 1333 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); |
| 1333 | 1334 | ||
| 1335 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { | ||
| 1336 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); | ||
| 1337 | list_del(&node->td); | ||
| 1338 | kfree(node); | ||
| 1339 | } | ||
| 1340 | |||
| 1334 | /* pop request */ | 1341 | /* pop request */ |
| 1335 | list_del_init(&hwreq->queue); | 1342 | list_del_init(&hwreq->queue); |
| 1336 | 1343 | ||
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index 8eb996e4f058..261c3b428220 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig | |||
| @@ -45,6 +45,7 @@ comment "Platform Glue Driver Support" | |||
| 45 | config USB_DWC3_OMAP | 45 | config USB_DWC3_OMAP |
| 46 | tristate "Texas Instruments OMAP5 and similar Platforms" | 46 | tristate "Texas Instruments OMAP5 and similar Platforms" |
| 47 | depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) | 47 | depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) |
| 48 | depends on OF | ||
| 48 | default USB_DWC3 | 49 | default USB_DWC3 |
| 49 | help | 50 | help |
| 50 | Some platforms from Texas Instruments like OMAP5, DRA7xxx and | 51 | Some platforms from Texas Instruments like OMAP5, DRA7xxx and |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 4af4c3567656..07a736acd0f2 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
| @@ -322,7 +322,7 @@ static int dwc3_omap_remove_core(struct device *dev, void *c) | |||
| 322 | { | 322 | { |
| 323 | struct platform_device *pdev = to_platform_device(dev); | 323 | struct platform_device *pdev = to_platform_device(dev); |
| 324 | 324 | ||
| 325 | platform_device_unregister(pdev); | 325 | of_device_unregister(pdev); |
| 326 | 326 | ||
| 327 | return 0; | 327 | return 0; |
| 328 | } | 328 | } |
| @@ -599,7 +599,7 @@ static int dwc3_omap_prepare(struct device *dev) | |||
| 599 | { | 599 | { |
| 600 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 600 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
| 601 | 601 | ||
| 602 | dwc3_omap_disable_irqs(omap); | 602 | dwc3_omap_write_irqmisc_set(omap, 0x00); |
| 603 | 603 | ||
| 604 | return 0; | 604 | return 0; |
| 605 | } | 605 | } |
| @@ -607,8 +607,19 @@ static int dwc3_omap_prepare(struct device *dev) | |||
| 607 | static void dwc3_omap_complete(struct device *dev) | 607 | static void dwc3_omap_complete(struct device *dev) |
| 608 | { | 608 | { |
| 609 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 609 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
| 610 | u32 reg; | ||
| 610 | 611 | ||
| 611 | dwc3_omap_enable_irqs(omap); | 612 | reg = (USBOTGSS_IRQMISC_OEVT | |
| 613 | USBOTGSS_IRQMISC_DRVVBUS_RISE | | ||
| 614 | USBOTGSS_IRQMISC_CHRGVBUS_RISE | | ||
| 615 | USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | | ||
| 616 | USBOTGSS_IRQMISC_IDPULLUP_RISE | | ||
| 617 | USBOTGSS_IRQMISC_DRVVBUS_FALL | | ||
| 618 | USBOTGSS_IRQMISC_CHRGVBUS_FALL | | ||
| 619 | USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | | ||
| 620 | USBOTGSS_IRQMISC_IDPULLUP_FALL); | ||
| 621 | |||
| 622 | dwc3_omap_write_irqmisc_set(omap, reg); | ||
| 612 | } | 623 | } |
| 613 | 624 | ||
| 614 | static int dwc3_omap_suspend(struct device *dev) | 625 | static int dwc3_omap_suspend(struct device *dev) |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9d64dd02c57e..dab7927d1009 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
| @@ -828,10 +828,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
| 828 | length, last ? " last" : "", | 828 | length, last ? " last" : "", |
| 829 | chain ? " chain" : ""); | 829 | chain ? " chain" : ""); |
| 830 | 830 | ||
| 831 | /* Skip the LINK-TRB on ISOC */ | ||
| 832 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
| 833 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
| 834 | dep->free_slot++; | ||
| 835 | 831 | ||
| 836 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; | 832 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; |
| 837 | 833 | ||
| @@ -843,6 +839,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
| 843 | } | 839 | } |
| 844 | 840 | ||
| 845 | dep->free_slot++; | 841 | dep->free_slot++; |
| 842 | /* Skip the LINK-TRB on ISOC */ | ||
| 843 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
| 844 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
| 845 | dep->free_slot++; | ||
| 846 | 846 | ||
| 847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); | 847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); |
| 848 | trb->bpl = lower_32_bits(dma); | 848 | trb->bpl = lower_32_bits(dma); |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 2ddcd635ca2a..97142146eead 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
| @@ -1145,15 +1145,15 @@ static struct configfs_item_operations interf_item_ops = { | |||
| 1145 | .store_attribute = usb_os_desc_attr_store, | 1145 | .store_attribute = usb_os_desc_attr_store, |
| 1146 | }; | 1146 | }; |
| 1147 | 1147 | ||
| 1148 | static ssize_t rndis_grp_compatible_id_show(struct usb_os_desc *desc, | 1148 | static ssize_t interf_grp_compatible_id_show(struct usb_os_desc *desc, |
| 1149 | char *page) | 1149 | char *page) |
| 1150 | { | 1150 | { |
| 1151 | memcpy(page, desc->ext_compat_id, 8); | 1151 | memcpy(page, desc->ext_compat_id, 8); |
| 1152 | return 8; | 1152 | return 8; |
| 1153 | } | 1153 | } |
| 1154 | 1154 | ||
| 1155 | static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc, | 1155 | static ssize_t interf_grp_compatible_id_store(struct usb_os_desc *desc, |
| 1156 | const char *page, size_t len) | 1156 | const char *page, size_t len) |
| 1157 | { | 1157 | { |
| 1158 | int l; | 1158 | int l; |
| 1159 | 1159 | ||
| @@ -1171,20 +1171,20 @@ static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc, | |||
| 1171 | return len; | 1171 | return len; |
| 1172 | } | 1172 | } |
| 1173 | 1173 | ||
| 1174 | static struct usb_os_desc_attribute rndis_grp_attr_compatible_id = | 1174 | static struct usb_os_desc_attribute interf_grp_attr_compatible_id = |
| 1175 | __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR, | 1175 | __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR, |
| 1176 | rndis_grp_compatible_id_show, | 1176 | interf_grp_compatible_id_show, |
| 1177 | rndis_grp_compatible_id_store); | 1177 | interf_grp_compatible_id_store); |
| 1178 | 1178 | ||
| 1179 | static ssize_t rndis_grp_sub_compatible_id_show(struct usb_os_desc *desc, | 1179 | static ssize_t interf_grp_sub_compatible_id_show(struct usb_os_desc *desc, |
| 1180 | char *page) | 1180 | char *page) |
| 1181 | { | 1181 | { |
| 1182 | memcpy(page, desc->ext_compat_id + 8, 8); | 1182 | memcpy(page, desc->ext_compat_id + 8, 8); |
| 1183 | return 8; | 1183 | return 8; |
| 1184 | } | 1184 | } |
| 1185 | 1185 | ||
| 1186 | static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc, | 1186 | static ssize_t interf_grp_sub_compatible_id_store(struct usb_os_desc *desc, |
| 1187 | const char *page, size_t len) | 1187 | const char *page, size_t len) |
| 1188 | { | 1188 | { |
| 1189 | int l; | 1189 | int l; |
| 1190 | 1190 | ||
| @@ -1202,20 +1202,21 @@ static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc, | |||
| 1202 | return len; | 1202 | return len; |
| 1203 | } | 1203 | } |
| 1204 | 1204 | ||
| 1205 | static struct usb_os_desc_attribute rndis_grp_attr_sub_compatible_id = | 1205 | static struct usb_os_desc_attribute interf_grp_attr_sub_compatible_id = |
| 1206 | __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR, | 1206 | __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR, |
| 1207 | rndis_grp_sub_compatible_id_show, | 1207 | interf_grp_sub_compatible_id_show, |
| 1208 | rndis_grp_sub_compatible_id_store); | 1208 | interf_grp_sub_compatible_id_store); |
| 1209 | 1209 | ||
| 1210 | static struct configfs_attribute *interf_grp_attrs[] = { | 1210 | static struct configfs_attribute *interf_grp_attrs[] = { |
| 1211 | &rndis_grp_attr_compatible_id.attr, | 1211 | &interf_grp_attr_compatible_id.attr, |
| 1212 | &rndis_grp_attr_sub_compatible_id.attr, | 1212 | &interf_grp_attr_sub_compatible_id.attr, |
| 1213 | NULL | 1213 | NULL |
| 1214 | }; | 1214 | }; |
| 1215 | 1215 | ||
| 1216 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, | 1216 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, |
| 1217 | int n_interf, | 1217 | int n_interf, |
| 1218 | struct usb_os_desc **desc, | 1218 | struct usb_os_desc **desc, |
| 1219 | char **names, | ||
| 1219 | struct module *owner) | 1220 | struct module *owner) |
| 1220 | { | 1221 | { |
| 1221 | struct config_group **f_default_groups, *os_desc_group, | 1222 | struct config_group **f_default_groups, *os_desc_group, |
| @@ -1257,8 +1258,8 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent, | |||
| 1257 | d = desc[n_interf]; | 1258 | d = desc[n_interf]; |
| 1258 | d->owner = owner; | 1259 | d->owner = owner; |
| 1259 | config_group_init_type_name(&d->group, "", interface_type); | 1260 | config_group_init_type_name(&d->group, "", interface_type); |
| 1260 | config_item_set_name(&d->group.cg_item, "interface.%d", | 1261 | config_item_set_name(&d->group.cg_item, "interface.%s", |
| 1261 | n_interf); | 1262 | names[n_interf]); |
| 1262 | interface_groups[n_interf] = &d->group; | 1263 | interface_groups[n_interf] = &d->group; |
| 1263 | } | 1264 | } |
| 1264 | 1265 | ||
diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h index a14ac792c698..36c468c4f5e9 100644 --- a/drivers/usb/gadget/configfs.h +++ b/drivers/usb/gadget/configfs.h | |||
| @@ -8,6 +8,7 @@ void unregister_gadget_item(struct config_item *item); | |||
| 8 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, | 8 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, |
| 9 | int n_interf, | 9 | int n_interf, |
| 10 | struct usb_os_desc **desc, | 10 | struct usb_os_desc **desc, |
| 11 | char **names, | ||
| 11 | struct module *owner); | 12 | struct module *owner); |
| 12 | 13 | ||
| 13 | static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item) | 14 | static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item) |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 74202d67f911..8598c27c7d43 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
| @@ -1483,11 +1483,13 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) | |||
| 1483 | ffs->ep0req->context = ffs; | 1483 | ffs->ep0req->context = ffs; |
| 1484 | 1484 | ||
| 1485 | lang = ffs->stringtabs; | 1485 | lang = ffs->stringtabs; |
| 1486 | for (lang = ffs->stringtabs; *lang; ++lang) { | 1486 | if (lang) { |
| 1487 | struct usb_string *str = (*lang)->strings; | 1487 | for (; *lang; ++lang) { |
| 1488 | int id = first_id; | 1488 | struct usb_string *str = (*lang)->strings; |
| 1489 | for (; str->s; ++id, ++str) | 1489 | int id = first_id; |
| 1490 | str->id = id; | 1490 | for (; str->s; ++id, ++str) |
| 1491 | str->id = id; | ||
| 1492 | } | ||
| 1491 | } | 1493 | } |
| 1492 | 1494 | ||
| 1493 | ffs->gadget = cdev->gadget; | 1495 | ffs->gadget = cdev->gadget; |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index eed3ad878047..9c41e9515b8e 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
| @@ -687,7 +687,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 687 | f->os_desc_table = kzalloc(sizeof(*f->os_desc_table), | 687 | f->os_desc_table = kzalloc(sizeof(*f->os_desc_table), |
| 688 | GFP_KERNEL); | 688 | GFP_KERNEL); |
| 689 | if (!f->os_desc_table) | 689 | if (!f->os_desc_table) |
| 690 | return PTR_ERR(f->os_desc_table); | 690 | return -ENOMEM; |
| 691 | f->os_desc_n = 1; | 691 | f->os_desc_n = 1; |
| 692 | f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc; | 692 | f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc; |
| 693 | } | 693 | } |
| @@ -905,6 +905,7 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
| 905 | { | 905 | { |
| 906 | struct f_rndis_opts *opts; | 906 | struct f_rndis_opts *opts; |
| 907 | struct usb_os_desc *descs[1]; | 907 | struct usb_os_desc *descs[1]; |
| 908 | char *names[1]; | ||
| 908 | 909 | ||
| 909 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); | 910 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); |
| 910 | if (!opts) | 911 | if (!opts) |
| @@ -922,8 +923,9 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
| 922 | INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); | 923 | INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); |
| 923 | 924 | ||
| 924 | descs[0] = &opts->rndis_os_desc; | 925 | descs[0] = &opts->rndis_os_desc; |
| 926 | names[0] = "rndis"; | ||
| 925 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, | 927 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, |
| 926 | THIS_MODULE); | 928 | names, THIS_MODULE); |
| 927 | config_group_init_type_name(&opts->func_inst.group, "", | 929 | config_group_init_type_name(&opts->func_inst.group, "", |
| 928 | &rndis_func_type); | 930 | &rndis_func_type); |
| 929 | 931 | ||
diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c index 99a37ed03e27..c7004ee89c90 100644 --- a/drivers/usb/gadget/gr_udc.c +++ b/drivers/usb/gadget/gr_udc.c | |||
| @@ -1532,8 +1532,9 @@ static int gr_ep_enable(struct usb_ep *_ep, | |||
| 1532 | "%s mode: multiple trans./microframe not valid\n", | 1532 | "%s mode: multiple trans./microframe not valid\n", |
| 1533 | (mode == 2 ? "Bulk" : "Control")); | 1533 | (mode == 2 ? "Bulk" : "Control")); |
| 1534 | return -EINVAL; | 1534 | return -EINVAL; |
| 1535 | } else if (nt == 0x11) { | 1535 | } else if (nt == 0x3) { |
| 1536 | dev_err(dev->dev, "Invalid value for trans./microframe\n"); | 1536 | dev_err(dev->dev, |
| 1537 | "Invalid value 0x3 for additional trans./microframe\n"); | ||
| 1537 | return -EINVAL; | 1538 | return -EINVAL; |
| 1538 | } else if ((nt + 1) * max > buffer_size) { | 1539 | } else if ((nt + 1) * max > buffer_size) { |
| 1539 | dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", | 1540 | dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index ee6c16416c30..2e4ce7704908 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
| @@ -1264,8 +1264,13 @@ dev_release (struct inode *inode, struct file *fd) | |||
| 1264 | 1264 | ||
| 1265 | kfree (dev->buf); | 1265 | kfree (dev->buf); |
| 1266 | dev->buf = NULL; | 1266 | dev->buf = NULL; |
| 1267 | put_dev (dev); | ||
| 1268 | 1267 | ||
| 1268 | /* other endpoints were all decoupled from this device */ | ||
| 1269 | spin_lock_irq(&dev->lock); | ||
| 1270 | dev->state = STATE_DEV_DISABLED; | ||
| 1271 | spin_unlock_irq(&dev->lock); | ||
| 1272 | |||
| 1273 | put_dev (dev); | ||
| 1269 | return 0; | 1274 | return 0; |
| 1270 | } | 1275 | } |
| 1271 | 1276 | ||
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 3d78a8844e43..97b027724ee7 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
| @@ -1120,7 +1120,10 @@ void gether_disconnect(struct gether *link) | |||
| 1120 | 1120 | ||
| 1121 | DBG(dev, "%s\n", __func__); | 1121 | DBG(dev, "%s\n", __func__); |
| 1122 | 1122 | ||
| 1123 | netif_tx_lock(dev->net); | ||
| 1123 | netif_stop_queue(dev->net); | 1124 | netif_stop_queue(dev->net); |
| 1125 | netif_tx_unlock(dev->net); | ||
| 1126 | |||
| 1124 | netif_carrier_off(dev->net); | 1127 | netif_carrier_off(dev->net); |
| 1125 | 1128 | ||
| 1126 | /* disable endpoints, forcing (synchronous) completion | 1129 | /* disable endpoints, forcing (synchronous) completion |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 61b7817bd66b..03314f861bee 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
| @@ -176,7 +176,7 @@ config USB_EHCI_HCD_AT91 | |||
| 176 | 176 | ||
| 177 | config USB_EHCI_MSM | 177 | config USB_EHCI_MSM |
| 178 | tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" | 178 | tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" |
| 179 | depends on ARCH_MSM | 179 | depends on ARCH_MSM || ARCH_QCOM |
| 180 | select USB_EHCI_ROOT_HUB_TT | 180 | select USB_EHCI_ROOT_HUB_TT |
| 181 | ---help--- | 181 | ---help--- |
| 182 | Enables support for the USB Host controller present on the | 182 | Enables support for the USB Host controller present on the |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 2b998c60faf2..aa79e8749040 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/device.h> | ||
| 25 | #include <asm/unaligned.h> | 26 | #include <asm/unaligned.h> |
| 26 | 27 | ||
| 27 | #include "xhci.h" | 28 | #include "xhci.h" |
| @@ -1139,7 +1140,9 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
| 1139 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME | 1140 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME |
| 1140 | * is enabled, so also enable remote wake here. | 1141 | * is enabled, so also enable remote wake here. |
| 1141 | */ | 1142 | */ |
| 1142 | if (hcd->self.root_hub->do_remote_wakeup) { | 1143 | if (hcd->self.root_hub->do_remote_wakeup |
| 1144 | && device_may_wakeup(hcd->self.controller)) { | ||
| 1145 | |||
| 1143 | if (t1 & PORT_CONNECT) { | 1146 | if (t1 & PORT_CONNECT) { |
| 1144 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; | 1147 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; |
| 1145 | t2 &= ~PORT_WKCONN_E; | 1148 | t2 &= ~PORT_WKCONN_E; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d67ff71209f5..749fc68eb5c1 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -1433,8 +1433,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
| 1433 | xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); | 1433 | xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); |
| 1434 | break; | 1434 | break; |
| 1435 | case TRB_RESET_DEV: | 1435 | case TRB_RESET_DEV: |
| 1436 | WARN_ON(slot_id != TRB_TO_SLOT_ID( | 1436 | /* SLOT_ID field in reset device cmd completion event TRB is 0. |
| 1437 | le32_to_cpu(cmd_trb->generic.field[3]))); | 1437 | * Use the SLOT_ID from the command TRB instead (xhci 4.6.11) |
| 1438 | */ | ||
| 1439 | slot_id = TRB_TO_SLOT_ID( | ||
| 1440 | le32_to_cpu(cmd_trb->generic.field[3])); | ||
| 1438 | xhci_handle_cmd_reset_dev(xhci, slot_id, event); | 1441 | xhci_handle_cmd_reset_dev(xhci, slot_id, event); |
| 1439 | break; | 1442 | break; |
| 1440 | case TRB_NEC_GET_FW: | 1443 | case TRB_NEC_GET_FW: |
| @@ -3534,7 +3537,7 @@ static unsigned int xhci_get_burst_count(struct xhci_hcd *xhci, | |||
| 3534 | return 0; | 3537 | return 0; |
| 3535 | 3538 | ||
| 3536 | max_burst = urb->ep->ss_ep_comp.bMaxBurst; | 3539 | max_burst = urb->ep->ss_ep_comp.bMaxBurst; |
| 3537 | return roundup(total_packet_count, max_burst + 1) - 1; | 3540 | return DIV_ROUND_UP(total_packet_count, max_burst + 1) - 1; |
| 3538 | } | 3541 | } |
| 3539 | 3542 | ||
| 3540 | /* | 3543 | /* |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2b8d9a24af09..7436d5f5e67a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -936,7 +936,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
| 936 | */ | 936 | */ |
| 937 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | 937 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
| 938 | { | 938 | { |
| 939 | u32 command, temp = 0; | 939 | u32 command, temp = 0, status; |
| 940 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 940 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
| 941 | struct usb_hcd *secondary_hcd; | 941 | struct usb_hcd *secondary_hcd; |
| 942 | int retval = 0; | 942 | int retval = 0; |
| @@ -1054,8 +1054,12 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 1054 | 1054 | ||
| 1055 | done: | 1055 | done: |
| 1056 | if (retval == 0) { | 1056 | if (retval == 0) { |
| 1057 | usb_hcd_resume_root_hub(hcd); | 1057 | /* Resume root hubs only when have pending events. */ |
| 1058 | usb_hcd_resume_root_hub(xhci->shared_hcd); | 1058 | status = readl(&xhci->op_regs->status); |
| 1059 | if (status & STS_EINT) { | ||
| 1060 | usb_hcd_resume_root_hub(hcd); | ||
| 1061 | usb_hcd_resume_root_hub(xhci->shared_hcd); | ||
| 1062 | } | ||
| 1059 | } | 1063 | } |
| 1060 | 1064 | ||
| 1061 | /* | 1065 | /* |
diff --git a/drivers/usb/musb/musb_am335x.c b/drivers/usb/musb/musb_am335x.c index d2353781bd2d..1e58ed2361cc 100644 --- a/drivers/usb/musb/musb_am335x.c +++ b/drivers/usb/musb/musb_am335x.c | |||
| @@ -19,21 +19,6 @@ err: | |||
| 19 | return ret; | 19 | return ret; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | static int of_remove_populated_child(struct device *dev, void *d) | ||
| 23 | { | ||
| 24 | struct platform_device *pdev = to_platform_device(dev); | ||
| 25 | |||
| 26 | of_device_unregister(pdev); | ||
| 27 | return 0; | ||
| 28 | } | ||
| 29 | |||
| 30 | static int am335x_child_remove(struct platform_device *pdev) | ||
| 31 | { | ||
| 32 | device_for_each_child(&pdev->dev, NULL, of_remove_populated_child); | ||
| 33 | pm_runtime_disable(&pdev->dev); | ||
| 34 | return 0; | ||
| 35 | } | ||
| 36 | |||
| 37 | static const struct of_device_id am335x_child_of_match[] = { | 22 | static const struct of_device_id am335x_child_of_match[] = { |
| 38 | { .compatible = "ti,am33xx-usb" }, | 23 | { .compatible = "ti,am33xx-usb" }, |
| 39 | { }, | 24 | { }, |
| @@ -42,13 +27,17 @@ MODULE_DEVICE_TABLE(of, am335x_child_of_match); | |||
| 42 | 27 | ||
| 43 | static struct platform_driver am335x_child_driver = { | 28 | static struct platform_driver am335x_child_driver = { |
| 44 | .probe = am335x_child_probe, | 29 | .probe = am335x_child_probe, |
| 45 | .remove = am335x_child_remove, | ||
| 46 | .driver = { | 30 | .driver = { |
| 47 | .name = "am335x-usb-childs", | 31 | .name = "am335x-usb-childs", |
| 48 | .of_match_table = am335x_child_of_match, | 32 | .of_match_table = am335x_child_of_match, |
| 49 | }, | 33 | }, |
| 50 | }; | 34 | }; |
| 51 | 35 | ||
| 52 | module_platform_driver(am335x_child_driver); | 36 | static int __init am335x_child_init(void) |
| 37 | { | ||
| 38 | return platform_driver_register(&am335x_child_driver); | ||
| 39 | } | ||
| 40 | module_init(am335x_child_init); | ||
| 41 | |||
| 53 | MODULE_DESCRIPTION("AM33xx child devices"); | 42 | MODULE_DESCRIPTION("AM33xx child devices"); |
| 54 | MODULE_LICENSE("GPL v2"); | 43 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 61da471b7aed..eff3c5cf84f4 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -849,7 +849,7 @@ b_host: | |||
| 849 | } | 849 | } |
| 850 | 850 | ||
| 851 | /* handle babble condition */ | 851 | /* handle babble condition */ |
| 852 | if (int_usb & MUSB_INTR_BABBLE) | 852 | if (int_usb & MUSB_INTR_BABBLE && is_host_active(musb)) |
| 853 | schedule_work(&musb->recover_work); | 853 | schedule_work(&musb->recover_work); |
| 854 | 854 | ||
| 855 | #if 0 | 855 | #if 0 |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 7b8bbf53127e..5341bb223b7c 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
| @@ -318,7 +318,7 @@ static void cppi41_dma_callback(void *private_data) | |||
| 318 | } | 318 | } |
| 319 | list_add_tail(&cppi41_channel->tx_check, | 319 | list_add_tail(&cppi41_channel->tx_check, |
| 320 | &controller->early_tx_list); | 320 | &controller->early_tx_list); |
| 321 | if (!hrtimer_active(&controller->early_tx)) { | 321 | if (!hrtimer_is_queued(&controller->early_tx)) { |
| 322 | hrtimer_start_range_ns(&controller->early_tx, | 322 | hrtimer_start_range_ns(&controller->early_tx, |
| 323 | ktime_set(0, 140 * NSEC_PER_USEC), | 323 | ktime_set(0, 140 * NSEC_PER_USEC), |
| 324 | 40 * NSEC_PER_USEC, | 324 | 40 * NSEC_PER_USEC, |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 51beb13c7e1a..09529f94e72d 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
| @@ -494,10 +494,9 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
| 494 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); | 494 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); |
| 495 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 495 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
| 496 | void __iomem *ctrl_base = musb->ctrl_base; | 496 | void __iomem *ctrl_base = musb->ctrl_base; |
| 497 | void __iomem *base = musb->mregs; | ||
| 498 | u32 reg; | 497 | u32 reg; |
| 499 | 498 | ||
| 500 | reg = dsps_readl(base, wrp->mode); | 499 | reg = dsps_readl(ctrl_base, wrp->mode); |
| 501 | 500 | ||
| 502 | switch (mode) { | 501 | switch (mode) { |
| 503 | case MUSB_HOST: | 502 | case MUSB_HOST: |
| @@ -510,7 +509,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
| 510 | */ | 509 | */ |
| 511 | reg |= (1 << wrp->iddig_mux); | 510 | reg |= (1 << wrp->iddig_mux); |
| 512 | 511 | ||
| 513 | dsps_writel(base, wrp->mode, reg); | 512 | dsps_writel(ctrl_base, wrp->mode, reg); |
| 514 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); | 513 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); |
| 515 | break; | 514 | break; |
| 516 | case MUSB_PERIPHERAL: | 515 | case MUSB_PERIPHERAL: |
| @@ -523,10 +522,10 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
| 523 | */ | 522 | */ |
| 524 | reg |= (1 << wrp->iddig_mux); | 523 | reg |= (1 << wrp->iddig_mux); |
| 525 | 524 | ||
| 526 | dsps_writel(base, wrp->mode, reg); | 525 | dsps_writel(ctrl_base, wrp->mode, reg); |
| 527 | break; | 526 | break; |
| 528 | case MUSB_OTG: | 527 | case MUSB_OTG: |
| 529 | dsps_writel(base, wrp->phy_utmi, 0x02); | 528 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); |
| 530 | break; | 529 | break; |
| 531 | default: | 530 | default: |
| 532 | dev_err(glue->dev, "unsupported mode %d\n", mode); | 531 | dev_err(glue->dev, "unsupported mode %d\n", mode); |
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index c2e45e632723..f202e5088461 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
| @@ -274,7 +274,6 @@ static int ux500_probe(struct platform_device *pdev) | |||
| 274 | musb->dev.parent = &pdev->dev; | 274 | musb->dev.parent = &pdev->dev; |
| 275 | musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; | 275 | musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
| 276 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; | 276 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; |
| 277 | musb->dev.of_node = pdev->dev.of_node; | ||
| 278 | 277 | ||
| 279 | glue->dev = &pdev->dev; | 278 | glue->dev = &pdev->dev; |
| 280 | glue->musb = musb; | 279 | glue->musb = musb; |
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index ced34f39bdd4..c929370cdaa6 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c | |||
| @@ -1229,7 +1229,9 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
| 1229 | motg->chg_state = USB_CHG_STATE_UNDEFINED; | 1229 | motg->chg_state = USB_CHG_STATE_UNDEFINED; |
| 1230 | motg->chg_type = USB_INVALID_CHARGER; | 1230 | motg->chg_type = USB_INVALID_CHARGER; |
| 1231 | } | 1231 | } |
| 1232 | pm_runtime_put_sync(otg->phy->dev); | 1232 | |
| 1233 | if (otg->phy->state == OTG_STATE_B_IDLE) | ||
| 1234 | pm_runtime_put_sync(otg->phy->dev); | ||
| 1233 | break; | 1235 | break; |
| 1234 | case OTG_STATE_B_PERIPHERAL: | 1236 | case OTG_STATE_B_PERIPHERAL: |
| 1235 | dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); | 1237 | dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index d49f9c326035..4fd36530bfa3 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
| @@ -681,6 +681,14 @@ usbhs_fifo_read_end: | |||
| 681 | usbhs_pipe_number(pipe), | 681 | usbhs_pipe_number(pipe), |
| 682 | pkt->length, pkt->actual, *is_done, pkt->zero); | 682 | pkt->length, pkt->actual, *is_done, pkt->zero); |
| 683 | 683 | ||
| 684 | /* | ||
| 685 | * Transmission end | ||
| 686 | */ | ||
| 687 | if (*is_done) { | ||
| 688 | if (usbhs_pipe_is_dcp(pipe)) | ||
| 689 | usbhs_dcp_control_transfer_done(pipe); | ||
| 690 | } | ||
| 691 | |||
| 684 | usbhs_fifo_read_busy: | 692 | usbhs_fifo_read_busy: |
| 685 | usbhsf_fifo_unselect(pipe, fifo); | 693 | usbhsf_fifo_unselect(pipe, fifo); |
| 686 | 694 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index edf3b124583c..115662c16dcc 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -1566,14 +1566,17 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port) | |||
| 1566 | struct usb_device *udev = serial->dev; | 1566 | struct usb_device *udev = serial->dev; |
| 1567 | 1567 | ||
| 1568 | struct usb_interface *interface = serial->interface; | 1568 | struct usb_interface *interface = serial->interface; |
| 1569 | struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc; | 1569 | struct usb_endpoint_descriptor *ep_desc; |
| 1570 | 1570 | ||
| 1571 | unsigned num_endpoints; | 1571 | unsigned num_endpoints; |
| 1572 | int i; | 1572 | unsigned i; |
| 1573 | 1573 | ||
| 1574 | num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; | 1574 | num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; |
| 1575 | dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); | 1575 | dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); |
| 1576 | 1576 | ||
| 1577 | if (!num_endpoints) | ||
| 1578 | return; | ||
| 1579 | |||
| 1577 | /* NOTE: some customers have programmed FT232R/FT245R devices | 1580 | /* NOTE: some customers have programmed FT232R/FT245R devices |
| 1578 | * with an endpoint size of 0 - not good. In this case, we | 1581 | * with an endpoint size of 0 - not good. In this case, we |
| 1579 | * want to override the endpoint descriptor setting and use a | 1582 | * want to override the endpoint descriptor setting and use a |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 59c3108cc136..ac73f49cd9f0 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -352,6 +352,9 @@ static void option_instat_callback(struct urb *urb); | |||
| 352 | /* Zoom */ | 352 | /* Zoom */ |
| 353 | #define ZOOM_PRODUCT_4597 0x9607 | 353 | #define ZOOM_PRODUCT_4597 0x9607 |
| 354 | 354 | ||
| 355 | /* SpeedUp SU9800 usb 3g modem */ | ||
| 356 | #define SPEEDUP_PRODUCT_SU9800 0x9800 | ||
| 357 | |||
| 355 | /* Haier products */ | 358 | /* Haier products */ |
| 356 | #define HAIER_VENDOR_ID 0x201e | 359 | #define HAIER_VENDOR_ID 0x201e |
| 357 | #define HAIER_PRODUCT_CE100 0x2009 | 360 | #define HAIER_PRODUCT_CE100 0x2009 |
| @@ -372,8 +375,12 @@ static void option_instat_callback(struct urb *urb); | |||
| 372 | /* Olivetti products */ | 375 | /* Olivetti products */ |
| 373 | #define OLIVETTI_VENDOR_ID 0x0b3c | 376 | #define OLIVETTI_VENDOR_ID 0x0b3c |
| 374 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 | 377 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 |
| 378 | #define OLIVETTI_PRODUCT_OLICARD120 0xc001 | ||
| 379 | #define OLIVETTI_PRODUCT_OLICARD140 0xc002 | ||
| 375 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 | 380 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 |
| 381 | #define OLIVETTI_PRODUCT_OLICARD155 0xc004 | ||
| 376 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 | 382 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 |
| 383 | #define OLIVETTI_PRODUCT_OLICARD160 0xc00a | ||
| 377 | #define OLIVETTI_PRODUCT_OLICARD500 0xc00b | 384 | #define OLIVETTI_PRODUCT_OLICARD500 0xc00b |
| 378 | 385 | ||
| 379 | /* Celot products */ | 386 | /* Celot products */ |
| @@ -1577,6 +1584,7 @@ static const struct usb_device_id option_ids[] = { | |||
| 1577 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), | 1584 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), |
| 1578 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist | 1585 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist |
| 1579 | }, | 1586 | }, |
| 1587 | { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) }, | ||
| 1580 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, | 1588 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, |
| 1581 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, | 1589 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, |
| 1582 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, | 1590 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, |
| @@ -1611,15 +1619,21 @@ static const struct usb_device_id option_ids[] = { | |||
| 1611 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, | 1619 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, |
| 1612 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ | 1620 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ |
| 1613 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | 1621 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
| 1614 | 1622 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), | |
| 1615 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 1623 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 1624 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120), | ||
| 1625 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 1626 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD140), | ||
| 1627 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 1616 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, | 1628 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, |
| 1629 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD155), | ||
| 1630 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, | ||
| 1617 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), | 1631 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), |
| 1618 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist | 1632 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, |
| 1619 | }, | 1633 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD160), |
| 1634 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, | ||
| 1620 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), | 1635 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), |
| 1621 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist | 1636 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 1622 | }, | ||
| 1623 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 1637 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
| 1624 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ | 1638 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ |
| 1625 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, | 1639 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 9d38ddc8da49..866b5df36ed1 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
| @@ -256,6 +256,10 @@ static int slave_configure(struct scsi_device *sdev) | |||
| 256 | if (us->fflags & US_FL_WRITE_CACHE) | 256 | if (us->fflags & US_FL_WRITE_CACHE) |
| 257 | sdev->wce_default_on = 1; | 257 | sdev->wce_default_on = 1; |
| 258 | 258 | ||
| 259 | /* A few buggy USB-ATA bridges don't understand FUA */ | ||
| 260 | if (us->fflags & US_FL_BROKEN_FUA) | ||
| 261 | sdev->broken_fua = 1; | ||
| 262 | |||
| 259 | } else { | 263 | } else { |
| 260 | 264 | ||
| 261 | /* Non-disk-type devices don't need to blacklist any pages | 265 | /* Non-disk-type devices don't need to blacklist any pages |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 174a447868cd..80a5b366255f 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -1936,6 +1936,13 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, | |||
| 1936 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1936 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
| 1937 | US_FL_IGNORE_RESIDUE ), | 1937 | US_FL_IGNORE_RESIDUE ), |
| 1938 | 1938 | ||
| 1939 | /* Reported by Michael Büsch <m@bues.ch> */ | ||
| 1940 | UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114, | ||
| 1941 | "JMicron", | ||
| 1942 | "USB to ATA/ATAPI Bridge", | ||
| 1943 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
| 1944 | US_FL_BROKEN_FUA ), | ||
| 1945 | |||
| 1939 | /* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> | 1946 | /* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> |
| 1940 | * JMicron responds to USN and several other SCSI ioctls with a | 1947 | * JMicron responds to USN and several other SCSI ioctls with a |
| 1941 | * residue that causes subsequent I/O requests to fail. */ | 1948 | * residue that causes subsequent I/O requests to fail. */ |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 971a760af4a1..8dae2f724a35 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
| @@ -700,14 +700,6 @@ static void handle_rx_net(struct vhost_work *work) | |||
| 700 | handle_rx(net); | 700 | handle_rx(net); |
| 701 | } | 701 | } |
| 702 | 702 | ||
| 703 | static void vhost_net_free(void *addr) | ||
| 704 | { | ||
| 705 | if (is_vmalloc_addr(addr)) | ||
| 706 | vfree(addr); | ||
| 707 | else | ||
| 708 | kfree(addr); | ||
| 709 | } | ||
| 710 | |||
| 711 | static int vhost_net_open(struct inode *inode, struct file *f) | 703 | static int vhost_net_open(struct inode *inode, struct file *f) |
| 712 | { | 704 | { |
| 713 | struct vhost_net *n; | 705 | struct vhost_net *n; |
| @@ -723,7 +715,7 @@ static int vhost_net_open(struct inode *inode, struct file *f) | |||
| 723 | } | 715 | } |
| 724 | vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL); | 716 | vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL); |
| 725 | if (!vqs) { | 717 | if (!vqs) { |
| 726 | vhost_net_free(n); | 718 | kvfree(n); |
| 727 | return -ENOMEM; | 719 | return -ENOMEM; |
| 728 | } | 720 | } |
| 729 | 721 | ||
| @@ -840,7 +832,7 @@ static int vhost_net_release(struct inode *inode, struct file *f) | |||
| 840 | * since jobs can re-queue themselves. */ | 832 | * since jobs can re-queue themselves. */ |
| 841 | vhost_net_flush(n); | 833 | vhost_net_flush(n); |
| 842 | kfree(n->dev.vqs); | 834 | kfree(n->dev.vqs); |
| 843 | vhost_net_free(n); | 835 | kvfree(n); |
| 844 | return 0; | 836 | return 0; |
| 845 | } | 837 | } |
| 846 | 838 | ||
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4f4ffa4c604e..69906cacd04f 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
| @@ -1503,14 +1503,6 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | |||
| 1503 | return 0; | 1503 | return 0; |
| 1504 | } | 1504 | } |
| 1505 | 1505 | ||
| 1506 | static void vhost_scsi_free(struct vhost_scsi *vs) | ||
| 1507 | { | ||
| 1508 | if (is_vmalloc_addr(vs)) | ||
| 1509 | vfree(vs); | ||
| 1510 | else | ||
| 1511 | kfree(vs); | ||
| 1512 | } | ||
| 1513 | |||
| 1514 | static int vhost_scsi_open(struct inode *inode, struct file *f) | 1506 | static int vhost_scsi_open(struct inode *inode, struct file *f) |
| 1515 | { | 1507 | { |
| 1516 | struct vhost_scsi *vs; | 1508 | struct vhost_scsi *vs; |
| @@ -1550,7 +1542,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) | |||
| 1550 | return 0; | 1542 | return 0; |
| 1551 | 1543 | ||
| 1552 | err_vqs: | 1544 | err_vqs: |
| 1553 | vhost_scsi_free(vs); | 1545 | kvfree(vs); |
| 1554 | err_vs: | 1546 | err_vs: |
| 1555 | return r; | 1547 | return r; |
| 1556 | } | 1548 | } |
| @@ -1569,7 +1561,7 @@ static int vhost_scsi_release(struct inode *inode, struct file *f) | |||
| 1569 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ | 1561 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ |
| 1570 | vhost_scsi_flush(vs); | 1562 | vhost_scsi_flush(vs); |
| 1571 | kfree(vs->dev.vqs); | 1563 | kfree(vs->dev.vqs); |
| 1572 | vhost_scsi_free(vs); | 1564 | kvfree(vs); |
| 1573 | return 0; | 1565 | return 0; |
| 1574 | } | 1566 | } |
| 1575 | 1567 | ||
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index e683b6ef9594..d36e830d6fc6 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
| @@ -1057,6 +1057,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
| 1057 | goto put_display_node; | 1057 | goto put_display_node; |
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| 1060 | INIT_LIST_HEAD(&pdata->pwr_gpios); | ||
| 1060 | ret = -ENOMEM; | 1061 | ret = -ENOMEM; |
| 1061 | for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { | 1062 | for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { |
| 1062 | gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", | 1063 | gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", |
| @@ -1082,6 +1083,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
| 1082 | dev_err(dev, "set direction output gpio %d failed\n", gpio); | 1083 | dev_err(dev, "set direction output gpio %d failed\n", gpio); |
| 1083 | goto put_display_node; | 1084 | goto put_display_node; |
| 1084 | } | 1085 | } |
| 1086 | list_add(&og->list, &pdata->pwr_gpios); | ||
| 1085 | } | 1087 | } |
| 1086 | 1088 | ||
| 1087 | if (is_gpio_power) | 1089 | if (is_gpio_power) |
diff --git a/drivers/video/fbdev/bfin_adv7393fb.c b/drivers/video/fbdev/bfin_adv7393fb.c index a54f7f7d763b..8fe41caac38e 100644 --- a/drivers/video/fbdev/bfin_adv7393fb.c +++ b/drivers/video/fbdev/bfin_adv7393fb.c | |||
| @@ -408,7 +408,7 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client, | |||
| 408 | /* Workaround "PPI Does Not Start Properly In Specific Mode" */ | 408 | /* Workaround "PPI Does Not Start Properly In Specific Mode" */ |
| 409 | if (ANOMALY_05000400) { | 409 | if (ANOMALY_05000400) { |
| 410 | ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW, | 410 | ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW, |
| 411 | "PPI0_FS3") | 411 | "PPI0_FS3"); |
| 412 | if (ret) { | 412 | if (ret) { |
| 413 | dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); | 413 | dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); |
| 414 | ret = -EBUSY; | 414 | ret = -EBUSY; |
diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c index 99af9e88b2d8..2f0822ee3ff9 100644 --- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c +++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c | |||
| @@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root) | |||
| 121 | { | 121 | { |
| 122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), | 122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), |
| 123 | GFP_KERNEL); | 123 | GFP_KERNEL); |
| 124 | n->node = node; | 124 | if (n) { |
| 125 | n->root = root; | 125 | n->node = node; |
| 126 | list_add(&n->list, &dss_conv_list); | 126 | n->root = root; |
| 127 | list_add(&n->list, &dss_conv_list); | ||
| 128 | } | ||
| 127 | } | 129 | } |
| 128 | 130 | ||
| 129 | static bool __init omapdss_list_contains(const struct device_node *node) | 131 | static bool __init omapdss_list_contains(const struct device_node *node) |
diff --git a/drivers/video/fbdev/vt8500lcdfb.c b/drivers/video/fbdev/vt8500lcdfb.c index a8f2b280f796..a1134c3f6c11 100644 --- a/drivers/video/fbdev/vt8500lcdfb.c +++ b/drivers/video/fbdev/vt8500lcdfb.c | |||
| @@ -474,8 +474,6 @@ static int vt8500lcd_remove(struct platform_device *pdev) | |||
| 474 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 474 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 475 | release_mem_region(res->start, resource_size(res)); | 475 | release_mem_region(res->start, resource_size(res)); |
| 476 | 476 | ||
| 477 | kfree(fbi); | ||
| 478 | |||
| 479 | return 0; | 477 | return 0; |
| 480 | } | 478 | } |
| 481 | 479 | ||
| @@ -1021,6 +1021,7 @@ void aio_complete(struct kiocb *iocb, long res, long res2) | |||
| 1021 | 1021 | ||
| 1022 | /* everything turned out well, dispose of the aiocb. */ | 1022 | /* everything turned out well, dispose of the aiocb. */ |
| 1023 | kiocb_free(iocb); | 1023 | kiocb_free(iocb); |
| 1024 | put_reqs_available(ctx, 1); | ||
| 1024 | 1025 | ||
| 1025 | /* | 1026 | /* |
| 1026 | * We have to order our ring_info tail store above and test | 1027 | * We have to order our ring_info tail store above and test |
| @@ -1062,6 +1063,9 @@ static long aio_read_events_ring(struct kioctx *ctx, | |||
| 1062 | if (head == tail) | 1063 | if (head == tail) |
| 1063 | goto out; | 1064 | goto out; |
| 1064 | 1065 | ||
| 1066 | head %= ctx->nr_events; | ||
| 1067 | tail %= ctx->nr_events; | ||
| 1068 | |||
| 1065 | while (ret < nr) { | 1069 | while (ret < nr) { |
| 1066 | long avail; | 1070 | long avail; |
| 1067 | struct io_event *ev; | 1071 | struct io_event *ev; |
| @@ -1100,8 +1104,6 @@ static long aio_read_events_ring(struct kioctx *ctx, | |||
| 1100 | flush_dcache_page(ctx->ring_pages[0]); | 1104 | flush_dcache_page(ctx->ring_pages[0]); |
| 1101 | 1105 | ||
| 1102 | pr_debug("%li h%u t%u\n", ret, head, tail); | 1106 | pr_debug("%li h%u t%u\n", ret, head, tail); |
| 1103 | |||
| 1104 | put_reqs_available(ctx, ret); | ||
| 1105 | out: | 1107 | out: |
| 1106 | mutex_unlock(&ctx->ring_lock); | 1108 | mutex_unlock(&ctx->ring_lock); |
| 1107 | 1109 | ||
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index d7bd395ab586..1c55388ae633 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
| @@ -210,7 +210,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
| 210 | int pipefd; | 210 | int pipefd; |
| 211 | struct autofs_sb_info *sbi; | 211 | struct autofs_sb_info *sbi; |
| 212 | struct autofs_info *ino; | 212 | struct autofs_info *ino; |
| 213 | int pgrp; | 213 | int pgrp = 0; |
| 214 | bool pgrp_set = false; | 214 | bool pgrp_set = false; |
| 215 | int ret = -EINVAL; | 215 | int ret = -EINVAL; |
| 216 | 216 | ||
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 92371c414228..1daea0b47187 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
| @@ -821,7 +821,7 @@ static void free_workspace(int type, struct list_head *workspace) | |||
| 821 | 821 | ||
| 822 | spin_lock(workspace_lock); | 822 | spin_lock(workspace_lock); |
| 823 | if (*num_workspace < num_online_cpus()) { | 823 | if (*num_workspace < num_online_cpus()) { |
| 824 | list_add_tail(workspace, idle_workspace); | 824 | list_add(workspace, idle_workspace); |
| 825 | (*num_workspace)++; | 825 | (*num_workspace)++; |
| 826 | spin_unlock(workspace_lock); | 826 | spin_unlock(workspace_lock); |
| 827 | goto wake; | 827 | goto wake; |
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 2af6e66fe788..eea26e1b2fda 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include "check-integrity.h" | 36 | #include "check-integrity.h" |
| 37 | #include "rcu-string.h" | 37 | #include "rcu-string.h" |
| 38 | #include "dev-replace.h" | 38 | #include "dev-replace.h" |
| 39 | #include "sysfs.h" | ||
| 39 | 40 | ||
| 40 | static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | 41 | static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, |
| 41 | int scrub_ret); | 42 | int scrub_ret); |
| @@ -562,6 +563,10 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
| 562 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; | 563 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; |
| 563 | list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); | 564 | list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); |
| 564 | 565 | ||
| 566 | /* replace the sysfs entry */ | ||
| 567 | btrfs_kobj_rm_device(fs_info, src_device); | ||
| 568 | btrfs_kobj_add_device(fs_info, tgt_device); | ||
| 569 | |||
| 565 | btrfs_rm_dev_replace_blocked(fs_info); | 570 | btrfs_rm_dev_replace_blocked(fs_info); |
| 566 | 571 | ||
| 567 | btrfs_rm_dev_replace_srcdev(fs_info, src_device); | 572 | btrfs_rm_dev_replace_srcdev(fs_info, src_device); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8bb4aa19898f..08e65e9cf2aa 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -369,7 +369,8 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, | |||
| 369 | out: | 369 | out: |
| 370 | unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1, | 370 | unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1, |
| 371 | &cached_state, GFP_NOFS); | 371 | &cached_state, GFP_NOFS); |
| 372 | btrfs_tree_read_unlock_blocking(eb); | 372 | if (need_lock) |
| 373 | btrfs_tree_read_unlock_blocking(eb); | ||
| 373 | return ret; | 374 | return ret; |
| 374 | } | 375 | } |
| 375 | 376 | ||
| @@ -2904,7 +2905,9 @@ retry_root_backup: | |||
| 2904 | if (ret) | 2905 | if (ret) |
| 2905 | goto fail_qgroup; | 2906 | goto fail_qgroup; |
| 2906 | 2907 | ||
| 2908 | mutex_lock(&fs_info->cleaner_mutex); | ||
| 2907 | ret = btrfs_recover_relocation(tree_root); | 2909 | ret = btrfs_recover_relocation(tree_root); |
| 2910 | mutex_unlock(&fs_info->cleaner_mutex); | ||
| 2908 | if (ret < 0) { | 2911 | if (ret < 0) { |
| 2909 | printk(KERN_WARNING | 2912 | printk(KERN_WARNING |
| 2910 | "BTRFS: failed to recover relocation\n"); | 2913 | "BTRFS: failed to recover relocation\n"); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 99c253918208..813537f362f9 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -5678,7 +5678,6 @@ void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, | |||
| 5678 | struct btrfs_caching_control *next; | 5678 | struct btrfs_caching_control *next; |
| 5679 | struct btrfs_caching_control *caching_ctl; | 5679 | struct btrfs_caching_control *caching_ctl; |
| 5680 | struct btrfs_block_group_cache *cache; | 5680 | struct btrfs_block_group_cache *cache; |
| 5681 | struct btrfs_space_info *space_info; | ||
| 5682 | 5681 | ||
| 5683 | down_write(&fs_info->commit_root_sem); | 5682 | down_write(&fs_info->commit_root_sem); |
| 5684 | 5683 | ||
| @@ -5701,9 +5700,6 @@ void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, | |||
| 5701 | 5700 | ||
| 5702 | up_write(&fs_info->commit_root_sem); | 5701 | up_write(&fs_info->commit_root_sem); |
| 5703 | 5702 | ||
| 5704 | list_for_each_entry_rcu(space_info, &fs_info->space_info, list) | ||
| 5705 | percpu_counter_set(&space_info->total_bytes_pinned, 0); | ||
| 5706 | |||
| 5707 | update_global_block_rsv(fs_info); | 5703 | update_global_block_rsv(fs_info); |
| 5708 | } | 5704 | } |
| 5709 | 5705 | ||
| @@ -5741,6 +5737,7 @@ static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end) | |||
| 5741 | spin_lock(&cache->lock); | 5737 | spin_lock(&cache->lock); |
| 5742 | cache->pinned -= len; | 5738 | cache->pinned -= len; |
| 5743 | space_info->bytes_pinned -= len; | 5739 | space_info->bytes_pinned -= len; |
| 5740 | percpu_counter_add(&space_info->total_bytes_pinned, -len); | ||
| 5744 | if (cache->ro) { | 5741 | if (cache->ro) { |
| 5745 | space_info->bytes_readonly += len; | 5742 | space_info->bytes_readonly += len; |
| 5746 | readonly = true; | 5743 | readonly = true; |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0d321c23069a..47aceb494d1d 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -136,19 +136,22 @@ static unsigned int btrfs_flags_to_ioctl(unsigned int flags) | |||
| 136 | void btrfs_update_iflags(struct inode *inode) | 136 | void btrfs_update_iflags(struct inode *inode) |
| 137 | { | 137 | { |
| 138 | struct btrfs_inode *ip = BTRFS_I(inode); | 138 | struct btrfs_inode *ip = BTRFS_I(inode); |
| 139 | 139 | unsigned int new_fl = 0; | |
| 140 | inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); | ||
| 141 | 140 | ||
| 142 | if (ip->flags & BTRFS_INODE_SYNC) | 141 | if (ip->flags & BTRFS_INODE_SYNC) |
| 143 | inode->i_flags |= S_SYNC; | 142 | new_fl |= S_SYNC; |
| 144 | if (ip->flags & BTRFS_INODE_IMMUTABLE) | 143 | if (ip->flags & BTRFS_INODE_IMMUTABLE) |
| 145 | inode->i_flags |= S_IMMUTABLE; | 144 | new_fl |= S_IMMUTABLE; |
| 146 | if (ip->flags & BTRFS_INODE_APPEND) | 145 | if (ip->flags & BTRFS_INODE_APPEND) |
| 147 | inode->i_flags |= S_APPEND; | 146 | new_fl |= S_APPEND; |
| 148 | if (ip->flags & BTRFS_INODE_NOATIME) | 147 | if (ip->flags & BTRFS_INODE_NOATIME) |
| 149 | inode->i_flags |= S_NOATIME; | 148 | new_fl |= S_NOATIME; |
| 150 | if (ip->flags & BTRFS_INODE_DIRSYNC) | 149 | if (ip->flags & BTRFS_INODE_DIRSYNC) |
| 151 | inode->i_flags |= S_DIRSYNC; | 150 | new_fl |= S_DIRSYNC; |
| 151 | |||
| 152 | set_mask_bits(&inode->i_flags, | ||
| 153 | S_SYNC | S_APPEND | S_IMMUTABLE | S_NOATIME | S_DIRSYNC, | ||
| 154 | new_fl); | ||
| 152 | } | 155 | } |
| 153 | 156 | ||
| 154 | /* | 157 | /* |
| @@ -3139,7 +3142,6 @@ out: | |||
| 3139 | static void clone_update_extent_map(struct inode *inode, | 3142 | static void clone_update_extent_map(struct inode *inode, |
| 3140 | const struct btrfs_trans_handle *trans, | 3143 | const struct btrfs_trans_handle *trans, |
| 3141 | const struct btrfs_path *path, | 3144 | const struct btrfs_path *path, |
| 3142 | struct btrfs_file_extent_item *fi, | ||
| 3143 | const u64 hole_offset, | 3145 | const u64 hole_offset, |
| 3144 | const u64 hole_len) | 3146 | const u64 hole_len) |
| 3145 | { | 3147 | { |
| @@ -3154,7 +3156,11 @@ static void clone_update_extent_map(struct inode *inode, | |||
| 3154 | return; | 3156 | return; |
| 3155 | } | 3157 | } |
| 3156 | 3158 | ||
| 3157 | if (fi) { | 3159 | if (path) { |
| 3160 | struct btrfs_file_extent_item *fi; | ||
| 3161 | |||
| 3162 | fi = btrfs_item_ptr(path->nodes[0], path->slots[0], | ||
| 3163 | struct btrfs_file_extent_item); | ||
| 3158 | btrfs_extent_item_to_extent_map(inode, path, fi, false, em); | 3164 | btrfs_extent_item_to_extent_map(inode, path, fi, false, em); |
| 3159 | em->generation = -1; | 3165 | em->generation = -1; |
| 3160 | if (btrfs_file_extent_type(path->nodes[0], fi) == | 3166 | if (btrfs_file_extent_type(path->nodes[0], fi) == |
| @@ -3508,18 +3514,15 @@ process_slot: | |||
| 3508 | btrfs_item_ptr_offset(leaf, slot), | 3514 | btrfs_item_ptr_offset(leaf, slot), |
| 3509 | size); | 3515 | size); |
| 3510 | inode_add_bytes(inode, datal); | 3516 | inode_add_bytes(inode, datal); |
| 3511 | extent = btrfs_item_ptr(leaf, slot, | ||
| 3512 | struct btrfs_file_extent_item); | ||
| 3513 | } | 3517 | } |
| 3514 | 3518 | ||
| 3515 | /* If we have an implicit hole (NO_HOLES feature). */ | 3519 | /* If we have an implicit hole (NO_HOLES feature). */ |
| 3516 | if (drop_start < new_key.offset) | 3520 | if (drop_start < new_key.offset) |
| 3517 | clone_update_extent_map(inode, trans, | 3521 | clone_update_extent_map(inode, trans, |
| 3518 | path, NULL, drop_start, | 3522 | NULL, drop_start, |
| 3519 | new_key.offset - drop_start); | 3523 | new_key.offset - drop_start); |
| 3520 | 3524 | ||
| 3521 | clone_update_extent_map(inode, trans, path, | 3525 | clone_update_extent_map(inode, trans, path, 0, 0); |
| 3522 | extent, 0, 0); | ||
| 3523 | 3526 | ||
| 3524 | btrfs_mark_buffer_dirty(leaf); | 3527 | btrfs_mark_buffer_dirty(leaf); |
| 3525 | btrfs_release_path(path); | 3528 | btrfs_release_path(path); |
| @@ -3562,12 +3565,10 @@ process_slot: | |||
| 3562 | btrfs_end_transaction(trans, root); | 3565 | btrfs_end_transaction(trans, root); |
| 3563 | goto out; | 3566 | goto out; |
| 3564 | } | 3567 | } |
| 3568 | clone_update_extent_map(inode, trans, NULL, last_dest_end, | ||
| 3569 | destoff + len - last_dest_end); | ||
| 3565 | ret = clone_finish_inode_update(trans, inode, destoff + len, | 3570 | ret = clone_finish_inode_update(trans, inode, destoff + len, |
| 3566 | destoff, olen); | 3571 | destoff, olen); |
| 3567 | if (ret) | ||
| 3568 | goto out; | ||
| 3569 | clone_update_extent_map(inode, trans, path, NULL, last_dest_end, | ||
| 3570 | destoff + len - last_dest_end); | ||
| 3571 | } | 3572 | } |
| 3572 | 3573 | ||
| 3573 | out: | 3574 | out: |
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index 6efd70d3b64f..9626b4ad3b9a 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
| @@ -54,7 +54,7 @@ static void print_extent_data_ref(struct extent_buffer *eb, | |||
| 54 | btrfs_extent_data_ref_count(eb, ref)); | 54 | btrfs_extent_data_ref_count(eb, ref)); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static void print_extent_item(struct extent_buffer *eb, int slot) | 57 | static void print_extent_item(struct extent_buffer *eb, int slot, int type) |
| 58 | { | 58 | { |
| 59 | struct btrfs_extent_item *ei; | 59 | struct btrfs_extent_item *ei; |
| 60 | struct btrfs_extent_inline_ref *iref; | 60 | struct btrfs_extent_inline_ref *iref; |
| @@ -63,7 +63,6 @@ static void print_extent_item(struct extent_buffer *eb, int slot) | |||
| 63 | struct btrfs_disk_key key; | 63 | struct btrfs_disk_key key; |
| 64 | unsigned long end; | 64 | unsigned long end; |
| 65 | unsigned long ptr; | 65 | unsigned long ptr; |
| 66 | int type; | ||
| 67 | u32 item_size = btrfs_item_size_nr(eb, slot); | 66 | u32 item_size = btrfs_item_size_nr(eb, slot); |
| 68 | u64 flags; | 67 | u64 flags; |
| 69 | u64 offset; | 68 | u64 offset; |
| @@ -88,7 +87,8 @@ static void print_extent_item(struct extent_buffer *eb, int slot) | |||
| 88 | btrfs_extent_refs(eb, ei), btrfs_extent_generation(eb, ei), | 87 | btrfs_extent_refs(eb, ei), btrfs_extent_generation(eb, ei), |
| 89 | flags); | 88 | flags); |
| 90 | 89 | ||
| 91 | if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { | 90 | if ((type == BTRFS_EXTENT_ITEM_KEY) && |
| 91 | flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { | ||
| 92 | struct btrfs_tree_block_info *info; | 92 | struct btrfs_tree_block_info *info; |
| 93 | info = (struct btrfs_tree_block_info *)(ei + 1); | 93 | info = (struct btrfs_tree_block_info *)(ei + 1); |
| 94 | btrfs_tree_block_key(eb, info, &key); | 94 | btrfs_tree_block_key(eb, info, &key); |
| @@ -223,7 +223,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) | |||
| 223 | btrfs_disk_root_refs(l, ri)); | 223 | btrfs_disk_root_refs(l, ri)); |
| 224 | break; | 224 | break; |
| 225 | case BTRFS_EXTENT_ITEM_KEY: | 225 | case BTRFS_EXTENT_ITEM_KEY: |
| 226 | print_extent_item(l, i); | 226 | case BTRFS_METADATA_ITEM_KEY: |
| 227 | print_extent_item(l, i, type); | ||
| 227 | break; | 228 | break; |
| 228 | case BTRFS_TREE_BLOCK_REF_KEY: | 229 | case BTRFS_TREE_BLOCK_REF_KEY: |
| 229 | printk(KERN_INFO "\t\ttree block backref\n"); | 230 | printk(KERN_INFO "\t\ttree block backref\n"); |
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 4055291a523e..4a88f073fdd7 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c | |||
| @@ -1956,9 +1956,10 @@ static int __raid56_parity_recover(struct btrfs_raid_bio *rbio) | |||
| 1956 | * pages are going to be uptodate. | 1956 | * pages are going to be uptodate. |
| 1957 | */ | 1957 | */ |
| 1958 | for (stripe = 0; stripe < bbio->num_stripes; stripe++) { | 1958 | for (stripe = 0; stripe < bbio->num_stripes; stripe++) { |
| 1959 | if (rbio->faila == stripe || | 1959 | if (rbio->faila == stripe || rbio->failb == stripe) { |
| 1960 | rbio->failb == stripe) | 1960 | atomic_inc(&rbio->bbio->error); |
| 1961 | continue; | 1961 | continue; |
| 1962 | } | ||
| 1962 | 1963 | ||
| 1963 | for (pagenr = 0; pagenr < nr_pages; pagenr++) { | 1964 | for (pagenr = 0; pagenr < nr_pages; pagenr++) { |
| 1964 | struct page *p; | 1965 | struct page *p; |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 4662d92a4b73..8e16bca69c56 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -522,9 +522,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
| 522 | case Opt_ssd_spread: | 522 | case Opt_ssd_spread: |
| 523 | btrfs_set_and_info(root, SSD_SPREAD, | 523 | btrfs_set_and_info(root, SSD_SPREAD, |
| 524 | "use spread ssd allocation scheme"); | 524 | "use spread ssd allocation scheme"); |
| 525 | btrfs_set_opt(info->mount_opt, SSD); | ||
| 525 | break; | 526 | break; |
| 526 | case Opt_nossd: | 527 | case Opt_nossd: |
| 527 | btrfs_clear_and_info(root, NOSSD, | 528 | btrfs_set_and_info(root, NOSSD, |
| 528 | "not using ssd allocation scheme"); | 529 | "not using ssd allocation scheme"); |
| 529 | btrfs_clear_opt(info->mount_opt, SSD); | 530 | btrfs_clear_opt(info->mount_opt, SSD); |
| 530 | break; | 531 | break; |
| @@ -1467,7 +1468,9 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
| 1467 | goto restore; | 1468 | goto restore; |
| 1468 | 1469 | ||
| 1469 | /* recover relocation */ | 1470 | /* recover relocation */ |
| 1471 | mutex_lock(&fs_info->cleaner_mutex); | ||
| 1470 | ret = btrfs_recover_relocation(root); | 1472 | ret = btrfs_recover_relocation(root); |
| 1473 | mutex_unlock(&fs_info->cleaner_mutex); | ||
| 1471 | if (ret) | 1474 | if (ret) |
| 1472 | goto restore; | 1475 | goto restore; |
| 1473 | 1476 | ||
| @@ -1808,6 +1811,8 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root) | |||
| 1808 | list_for_each_entry(dev, head, dev_list) { | 1811 | list_for_each_entry(dev, head, dev_list) { |
| 1809 | if (dev->missing) | 1812 | if (dev->missing) |
| 1810 | continue; | 1813 | continue; |
| 1814 | if (!dev->name) | ||
| 1815 | continue; | ||
| 1811 | if (!first_dev || dev->devid < first_dev->devid) | 1816 | if (!first_dev || dev->devid < first_dev->devid) |
| 1812 | first_dev = dev; | 1817 | first_dev = dev; |
| 1813 | } | 1818 | } |
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index df39458f1487..78699364f537 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c | |||
| @@ -605,14 +605,37 @@ static void init_feature_attrs(void) | |||
| 605 | } | 605 | } |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | static int add_device_membership(struct btrfs_fs_info *fs_info) | 608 | int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info, |
| 609 | struct btrfs_device *one_device) | ||
| 610 | { | ||
| 611 | struct hd_struct *disk; | ||
| 612 | struct kobject *disk_kobj; | ||
| 613 | |||
| 614 | if (!fs_info->device_dir_kobj) | ||
| 615 | return -EINVAL; | ||
| 616 | |||
| 617 | if (one_device) { | ||
| 618 | disk = one_device->bdev->bd_part; | ||
| 619 | disk_kobj = &part_to_dev(disk)->kobj; | ||
| 620 | |||
| 621 | sysfs_remove_link(fs_info->device_dir_kobj, | ||
| 622 | disk_kobj->name); | ||
| 623 | } | ||
| 624 | |||
| 625 | return 0; | ||
| 626 | } | ||
| 627 | |||
| 628 | int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info, | ||
| 629 | struct btrfs_device *one_device) | ||
| 609 | { | 630 | { |
| 610 | int error = 0; | 631 | int error = 0; |
| 611 | struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; | 632 | struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; |
| 612 | struct btrfs_device *dev; | 633 | struct btrfs_device *dev; |
| 613 | 634 | ||
| 614 | fs_info->device_dir_kobj = kobject_create_and_add("devices", | 635 | if (!fs_info->device_dir_kobj) |
| 636 | fs_info->device_dir_kobj = kobject_create_and_add("devices", | ||
| 615 | &fs_info->super_kobj); | 637 | &fs_info->super_kobj); |
| 638 | |||
| 616 | if (!fs_info->device_dir_kobj) | 639 | if (!fs_info->device_dir_kobj) |
| 617 | return -ENOMEM; | 640 | return -ENOMEM; |
| 618 | 641 | ||
| @@ -623,6 +646,9 @@ static int add_device_membership(struct btrfs_fs_info *fs_info) | |||
| 623 | if (!dev->bdev) | 646 | if (!dev->bdev) |
| 624 | continue; | 647 | continue; |
| 625 | 648 | ||
| 649 | if (one_device && one_device != dev) | ||
| 650 | continue; | ||
| 651 | |||
| 626 | disk = dev->bdev->bd_part; | 652 | disk = dev->bdev->bd_part; |
| 627 | disk_kobj = &part_to_dev(disk)->kobj; | 653 | disk_kobj = &part_to_dev(disk)->kobj; |
| 628 | 654 | ||
| @@ -666,7 +692,7 @@ int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info) | |||
| 666 | if (error) | 692 | if (error) |
| 667 | goto failure; | 693 | goto failure; |
| 668 | 694 | ||
| 669 | error = add_device_membership(fs_info); | 695 | error = btrfs_kobj_add_device(fs_info, NULL); |
| 670 | if (error) | 696 | if (error) |
| 671 | goto failure; | 697 | goto failure; |
| 672 | 698 | ||
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h index 9ab576318a84..ac46df37504c 100644 --- a/fs/btrfs/sysfs.h +++ b/fs/btrfs/sysfs.h | |||
| @@ -66,4 +66,8 @@ char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags); | |||
| 66 | extern const char * const btrfs_feature_set_names[3]; | 66 | extern const char * const btrfs_feature_set_names[3]; |
| 67 | extern struct kobj_type space_info_ktype; | 67 | extern struct kobj_type space_info_ktype; |
| 68 | extern struct kobj_type btrfs_raid_ktype; | 68 | extern struct kobj_type btrfs_raid_ktype; |
| 69 | int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info, | ||
| 70 | struct btrfs_device *one_device); | ||
| 71 | int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info, | ||
| 72 | struct btrfs_device *one_device); | ||
| 69 | #endif /* _BTRFS_SYSFS_H_ */ | 73 | #endif /* _BTRFS_SYSFS_H_ */ |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 511839c04f11..5f379affdf23 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -386,11 +386,13 @@ start_transaction(struct btrfs_root *root, u64 num_items, unsigned int type, | |||
| 386 | bool reloc_reserved = false; | 386 | bool reloc_reserved = false; |
| 387 | int ret; | 387 | int ret; |
| 388 | 388 | ||
| 389 | /* Send isn't supposed to start transactions. */ | ||
| 390 | ASSERT(current->journal_info != (void *)BTRFS_SEND_TRANS_STUB); | ||
| 391 | |||
| 389 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) | 392 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) |
| 390 | return ERR_PTR(-EROFS); | 393 | return ERR_PTR(-EROFS); |
| 391 | 394 | ||
| 392 | if (current->journal_info && | 395 | if (current->journal_info) { |
| 393 | current->journal_info != (void *)BTRFS_SEND_TRANS_STUB) { | ||
| 394 | WARN_ON(type & TRANS_EXTWRITERS); | 396 | WARN_ON(type & TRANS_EXTWRITERS); |
| 395 | h = current->journal_info; | 397 | h = current->journal_info; |
| 396 | h->use_count++; | 398 | h->use_count++; |
| @@ -491,6 +493,7 @@ again: | |||
| 491 | smp_mb(); | 493 | smp_mb(); |
| 492 | if (cur_trans->state >= TRANS_STATE_BLOCKED && | 494 | if (cur_trans->state >= TRANS_STATE_BLOCKED && |
| 493 | may_wait_transaction(root, type)) { | 495 | may_wait_transaction(root, type)) { |
| 496 | current->journal_info = h; | ||
| 494 | btrfs_commit_transaction(h, root); | 497 | btrfs_commit_transaction(h, root); |
| 495 | goto again; | 498 | goto again; |
| 496 | } | 499 | } |
| @@ -1615,11 +1618,6 @@ static int btrfs_flush_all_pending_stuffs(struct btrfs_trans_handle *trans, | |||
| 1615 | int ret; | 1618 | int ret; |
| 1616 | 1619 | ||
| 1617 | ret = btrfs_run_delayed_items(trans, root); | 1620 | ret = btrfs_run_delayed_items(trans, root); |
| 1618 | /* | ||
| 1619 | * running the delayed items may have added new refs. account | ||
| 1620 | * them now so that they hinder processing of more delayed refs | ||
| 1621 | * as little as possible. | ||
| 1622 | */ | ||
| 1623 | if (ret) | 1621 | if (ret) |
| 1624 | return ret; | 1622 | return ret; |
| 1625 | 1623 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c83b24251e53..6104676857f5 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include "rcu-string.h" | 40 | #include "rcu-string.h" |
| 41 | #include "math.h" | 41 | #include "math.h" |
| 42 | #include "dev-replace.h" | 42 | #include "dev-replace.h" |
| 43 | #include "sysfs.h" | ||
| 43 | 44 | ||
| 44 | static int init_first_rw_device(struct btrfs_trans_handle *trans, | 45 | static int init_first_rw_device(struct btrfs_trans_handle *trans, |
| 45 | struct btrfs_root *root, | 46 | struct btrfs_root *root, |
| @@ -554,12 +555,14 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) | |||
| 554 | * This is ok to do without rcu read locked because we hold the | 555 | * This is ok to do without rcu read locked because we hold the |
| 555 | * uuid mutex so nothing we touch in here is going to disappear. | 556 | * uuid mutex so nothing we touch in here is going to disappear. |
| 556 | */ | 557 | */ |
| 557 | name = rcu_string_strdup(orig_dev->name->str, GFP_NOFS); | 558 | if (orig_dev->name) { |
| 558 | if (!name) { | 559 | name = rcu_string_strdup(orig_dev->name->str, GFP_NOFS); |
| 559 | kfree(device); | 560 | if (!name) { |
| 560 | goto error; | 561 | kfree(device); |
| 562 | goto error; | ||
| 563 | } | ||
| 564 | rcu_assign_pointer(device->name, name); | ||
| 561 | } | 565 | } |
| 562 | rcu_assign_pointer(device->name, name); | ||
| 563 | 566 | ||
| 564 | list_add(&device->dev_list, &fs_devices->devices); | 567 | list_add(&device->dev_list, &fs_devices->devices); |
| 565 | device->fs_devices = fs_devices; | 568 | device->fs_devices = fs_devices; |
| @@ -1680,6 +1683,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
| 1680 | if (device->bdev) | 1683 | if (device->bdev) |
| 1681 | device->fs_devices->open_devices--; | 1684 | device->fs_devices->open_devices--; |
| 1682 | 1685 | ||
| 1686 | /* remove sysfs entry */ | ||
| 1687 | btrfs_kobj_rm_device(root->fs_info, device); | ||
| 1688 | |||
| 1683 | call_rcu(&device->rcu, free_device); | 1689 | call_rcu(&device->rcu, free_device); |
| 1684 | 1690 | ||
| 1685 | num_devices = btrfs_super_num_devices(root->fs_info->super_copy) - 1; | 1691 | num_devices = btrfs_super_num_devices(root->fs_info->super_copy) - 1; |
| @@ -2143,9 +2149,14 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
| 2143 | total_bytes = btrfs_super_num_devices(root->fs_info->super_copy); | 2149 | total_bytes = btrfs_super_num_devices(root->fs_info->super_copy); |
| 2144 | btrfs_set_super_num_devices(root->fs_info->super_copy, | 2150 | btrfs_set_super_num_devices(root->fs_info->super_copy, |
| 2145 | total_bytes + 1); | 2151 | total_bytes + 1); |
| 2152 | |||
| 2153 | /* add sysfs device entry */ | ||
| 2154 | btrfs_kobj_add_device(root->fs_info, device); | ||
| 2155 | |||
| 2146 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 2156 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); |
| 2147 | 2157 | ||
| 2148 | if (seeding_dev) { | 2158 | if (seeding_dev) { |
| 2159 | char fsid_buf[BTRFS_UUID_UNPARSED_SIZE]; | ||
| 2149 | ret = init_first_rw_device(trans, root, device); | 2160 | ret = init_first_rw_device(trans, root, device); |
| 2150 | if (ret) { | 2161 | if (ret) { |
| 2151 | btrfs_abort_transaction(trans, root, ret); | 2162 | btrfs_abort_transaction(trans, root, ret); |
| @@ -2156,6 +2167,14 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
| 2156 | btrfs_abort_transaction(trans, root, ret); | 2167 | btrfs_abort_transaction(trans, root, ret); |
| 2157 | goto error_trans; | 2168 | goto error_trans; |
| 2158 | } | 2169 | } |
| 2170 | |||
| 2171 | /* Sprouting would change fsid of the mounted root, | ||
| 2172 | * so rename the fsid on the sysfs | ||
| 2173 | */ | ||
| 2174 | snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU", | ||
| 2175 | root->fs_info->fsid); | ||
| 2176 | if (kobject_rename(&root->fs_info->super_kobj, fsid_buf)) | ||
| 2177 | goto error_trans; | ||
| 2159 | } else { | 2178 | } else { |
| 2160 | ret = btrfs_add_device(trans, root, device); | 2179 | ret = btrfs_add_device(trans, root, device); |
| 2161 | if (ret) { | 2180 | if (ret) { |
| @@ -2205,6 +2224,7 @@ error_trans: | |||
| 2205 | unlock_chunks(root); | 2224 | unlock_chunks(root); |
| 2206 | btrfs_end_transaction(trans, root); | 2225 | btrfs_end_transaction(trans, root); |
| 2207 | rcu_string_free(device->name); | 2226 | rcu_string_free(device->name); |
| 2227 | btrfs_kobj_rm_device(root->fs_info, device); | ||
| 2208 | kfree(device); | 2228 | kfree(device); |
| 2209 | error: | 2229 | error: |
| 2210 | blkdev_put(bdev, FMODE_EXCL); | 2230 | blkdev_put(bdev, FMODE_EXCL); |
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index 4f196314c0c1..b67d8fc81277 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c | |||
| @@ -136,7 +136,7 @@ static int zlib_compress_pages(struct list_head *ws, | |||
| 136 | if (workspace->def_strm.total_in > 8192 && | 136 | if (workspace->def_strm.total_in > 8192 && |
| 137 | workspace->def_strm.total_in < | 137 | workspace->def_strm.total_in < |
| 138 | workspace->def_strm.total_out) { | 138 | workspace->def_strm.total_out) { |
| 139 | ret = -EIO; | 139 | ret = -E2BIG; |
| 140 | goto out; | 140 | goto out; |
| 141 | } | 141 | } |
| 142 | /* we need another page for writing out. Test this | 142 | /* we need another page for writing out. Test this |
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index 0227b45ef00a..15e9505aa35f 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
| @@ -290,7 +290,8 @@ int | |||
| 290 | cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | 290 | cifsConvertToUTF16(__le16 *target, const char *source, int srclen, |
| 291 | const struct nls_table *cp, int mapChars) | 291 | const struct nls_table *cp, int mapChars) |
| 292 | { | 292 | { |
| 293 | int i, j, charlen; | 293 | int i, charlen; |
| 294 | int j = 0; | ||
| 294 | char src_char; | 295 | char src_char; |
| 295 | __le16 dst_char; | 296 | __le16 dst_char; |
| 296 | wchar_t tmp; | 297 | wchar_t tmp; |
| @@ -298,12 +299,11 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | |||
| 298 | if (!mapChars) | 299 | if (!mapChars) |
| 299 | return cifs_strtoUTF16(target, source, PATH_MAX, cp); | 300 | return cifs_strtoUTF16(target, source, PATH_MAX, cp); |
| 300 | 301 | ||
| 301 | for (i = 0, j = 0; i < srclen; j++) { | 302 | for (i = 0; i < srclen; j++) { |
| 302 | src_char = source[i]; | 303 | src_char = source[i]; |
| 303 | charlen = 1; | 304 | charlen = 1; |
| 304 | switch (src_char) { | 305 | switch (src_char) { |
| 305 | case 0: | 306 | case 0: |
| 306 | put_unaligned(0, &target[j]); | ||
| 307 | goto ctoUTF16_out; | 307 | goto ctoUTF16_out; |
| 308 | case ':': | 308 | case ':': |
| 309 | dst_char = cpu_to_le16(UNI_COLON); | 309 | dst_char = cpu_to_le16(UNI_COLON); |
| @@ -350,6 +350,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | |||
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | ctoUTF16_out: | 352 | ctoUTF16_out: |
| 353 | put_unaligned(0, &target[j]); /* Null terminate target unicode string */ | ||
| 353 | return j; | 354 | return j; |
| 354 | } | 355 | } |
| 355 | 356 | ||
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 2c90d07c0b3a..888398067420 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -725,6 +725,19 @@ out_nls: | |||
| 725 | goto out; | 725 | goto out; |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | static ssize_t | ||
| 729 | cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter) | ||
| 730 | { | ||
| 731 | ssize_t rc; | ||
| 732 | struct inode *inode = file_inode(iocb->ki_filp); | ||
| 733 | |||
| 734 | rc = cifs_revalidate_mapping(inode); | ||
| 735 | if (rc) | ||
| 736 | return rc; | ||
| 737 | |||
| 738 | return generic_file_read_iter(iocb, iter); | ||
| 739 | } | ||
| 740 | |||
| 728 | static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | 741 | static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) |
| 729 | { | 742 | { |
| 730 | struct inode *inode = file_inode(iocb->ki_filp); | 743 | struct inode *inode = file_inode(iocb->ki_filp); |
| @@ -881,7 +894,7 @@ const struct inode_operations cifs_symlink_inode_ops = { | |||
| 881 | const struct file_operations cifs_file_ops = { | 894 | const struct file_operations cifs_file_ops = { |
| 882 | .read = new_sync_read, | 895 | .read = new_sync_read, |
| 883 | .write = new_sync_write, | 896 | .write = new_sync_write, |
| 884 | .read_iter = generic_file_read_iter, | 897 | .read_iter = cifs_loose_read_iter, |
| 885 | .write_iter = cifs_file_write_iter, | 898 | .write_iter = cifs_file_write_iter, |
| 886 | .open = cifs_open, | 899 | .open = cifs_open, |
| 887 | .release = cifs_close, | 900 | .release = cifs_close, |
| @@ -939,7 +952,7 @@ const struct file_operations cifs_file_direct_ops = { | |||
| 939 | const struct file_operations cifs_file_nobrl_ops = { | 952 | const struct file_operations cifs_file_nobrl_ops = { |
| 940 | .read = new_sync_read, | 953 | .read = new_sync_read, |
| 941 | .write = new_sync_write, | 954 | .write = new_sync_write, |
| 942 | .read_iter = generic_file_read_iter, | 955 | .read_iter = cifs_loose_read_iter, |
| 943 | .write_iter = cifs_file_write_iter, | 956 | .write_iter = cifs_file_write_iter, |
| 944 | .open = cifs_open, | 957 | .open = cifs_open, |
| 945 | .release = cifs_close, | 958 | .release = cifs_close, |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 264ece71bdb2..68559fd557fb 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
| @@ -374,7 +374,7 @@ cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, | |||
| 374 | oparms.cifs_sb = cifs_sb; | 374 | oparms.cifs_sb = cifs_sb; |
| 375 | oparms.desired_access = GENERIC_WRITE; | 375 | oparms.desired_access = GENERIC_WRITE; |
| 376 | oparms.create_options = create_options; | 376 | oparms.create_options = create_options; |
| 377 | oparms.disposition = FILE_OPEN; | 377 | oparms.disposition = FILE_CREATE; |
| 378 | oparms.path = path; | 378 | oparms.path = path; |
| 379 | oparms.fid = &fid; | 379 | oparms.fid = &fid; |
| 380 | oparms.reconnect = false; | 380 | oparms.reconnect = false; |
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 0762d143e252..fca382037ddd 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
| @@ -194,7 +194,16 @@ static void ext4_init_block_bitmap(struct super_block *sb, | |||
| 194 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { | 194 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { |
| 195 | ext4_error(sb, "Checksum bad for group %u", block_group); | 195 | ext4_error(sb, "Checksum bad for group %u", block_group); |
| 196 | grp = ext4_get_group_info(sb, block_group); | 196 | grp = ext4_get_group_info(sb, block_group); |
| 197 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 198 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 199 | grp->bb_free); | ||
| 197 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 200 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 201 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
| 202 | int count; | ||
| 203 | count = ext4_free_inodes_count(sb, gdp); | ||
| 204 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
| 205 | count); | ||
| 206 | } | ||
| 198 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 207 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 199 | return; | 208 | return; |
| 200 | } | 209 | } |
| @@ -359,6 +368,7 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
| 359 | { | 368 | { |
| 360 | ext4_fsblk_t blk; | 369 | ext4_fsblk_t blk; |
| 361 | struct ext4_group_info *grp = ext4_get_group_info(sb, block_group); | 370 | struct ext4_group_info *grp = ext4_get_group_info(sb, block_group); |
| 371 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 362 | 372 | ||
| 363 | if (buffer_verified(bh)) | 373 | if (buffer_verified(bh)) |
| 364 | return; | 374 | return; |
| @@ -369,6 +379,9 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
| 369 | ext4_unlock_group(sb, block_group); | 379 | ext4_unlock_group(sb, block_group); |
| 370 | ext4_error(sb, "bg %u: block %llu: invalid block bitmap", | 380 | ext4_error(sb, "bg %u: block %llu: invalid block bitmap", |
| 371 | block_group, blk); | 381 | block_group, blk); |
| 382 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 383 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 384 | grp->bb_free); | ||
| 372 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 385 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 373 | return; | 386 | return; |
| 374 | } | 387 | } |
| @@ -376,6 +389,9 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
| 376 | desc, bh))) { | 389 | desc, bh))) { |
| 377 | ext4_unlock_group(sb, block_group); | 390 | ext4_unlock_group(sb, block_group); |
| 378 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); | 391 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); |
| 392 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 393 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 394 | grp->bb_free); | ||
| 379 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 395 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 380 | return; | 396 | return; |
| 381 | } | 397 | } |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 0ee59a6644e2..a87455df38bc 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
| @@ -71,6 +71,7 @@ static unsigned ext4_init_inode_bitmap(struct super_block *sb, | |||
| 71 | struct ext4_group_desc *gdp) | 71 | struct ext4_group_desc *gdp) |
| 72 | { | 72 | { |
| 73 | struct ext4_group_info *grp; | 73 | struct ext4_group_info *grp; |
| 74 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 74 | J_ASSERT_BH(bh, buffer_locked(bh)); | 75 | J_ASSERT_BH(bh, buffer_locked(bh)); |
| 75 | 76 | ||
| 76 | /* If checksum is bad mark all blocks and inodes use to prevent | 77 | /* If checksum is bad mark all blocks and inodes use to prevent |
| @@ -78,7 +79,16 @@ static unsigned ext4_init_inode_bitmap(struct super_block *sb, | |||
| 78 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { | 79 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { |
| 79 | ext4_error(sb, "Checksum bad for group %u", block_group); | 80 | ext4_error(sb, "Checksum bad for group %u", block_group); |
| 80 | grp = ext4_get_group_info(sb, block_group); | 81 | grp = ext4_get_group_info(sb, block_group); |
| 82 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 83 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 84 | grp->bb_free); | ||
| 81 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 85 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 86 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
| 87 | int count; | ||
| 88 | count = ext4_free_inodes_count(sb, gdp); | ||
| 89 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
| 90 | count); | ||
| 91 | } | ||
| 82 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 92 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 83 | return 0; | 93 | return 0; |
| 84 | } | 94 | } |
| @@ -116,6 +126,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) | |||
| 116 | struct buffer_head *bh = NULL; | 126 | struct buffer_head *bh = NULL; |
| 117 | ext4_fsblk_t bitmap_blk; | 127 | ext4_fsblk_t bitmap_blk; |
| 118 | struct ext4_group_info *grp; | 128 | struct ext4_group_info *grp; |
| 129 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 119 | 130 | ||
| 120 | desc = ext4_get_group_desc(sb, block_group, NULL); | 131 | desc = ext4_get_group_desc(sb, block_group, NULL); |
| 121 | if (!desc) | 132 | if (!desc) |
| @@ -185,6 +196,12 @@ verify: | |||
| 185 | ext4_error(sb, "Corrupt inode bitmap - block_group = %u, " | 196 | ext4_error(sb, "Corrupt inode bitmap - block_group = %u, " |
| 186 | "inode_bitmap = %llu", block_group, bitmap_blk); | 197 | "inode_bitmap = %llu", block_group, bitmap_blk); |
| 187 | grp = ext4_get_group_info(sb, block_group); | 198 | grp = ext4_get_group_info(sb, block_group); |
| 199 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
| 200 | int count; | ||
| 201 | count = ext4_free_inodes_count(sb, desc); | ||
| 202 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
| 203 | count); | ||
| 204 | } | ||
| 188 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 205 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 189 | return NULL; | 206 | return NULL; |
| 190 | } | 207 | } |
| @@ -321,6 +338,12 @@ out: | |||
| 321 | fatal = err; | 338 | fatal = err; |
| 322 | } else { | 339 | } else { |
| 323 | ext4_error(sb, "bit already cleared for inode %lu", ino); | 340 | ext4_error(sb, "bit already cleared for inode %lu", ino); |
| 341 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
| 342 | int count; | ||
| 343 | count = ext4_free_inodes_count(sb, gdp); | ||
| 344 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
| 345 | count); | ||
| 346 | } | ||
| 324 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 347 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 325 | } | 348 | } |
| 326 | 349 | ||
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 8a57e9fcd1b9..fd69da194826 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
| @@ -389,7 +389,13 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode, | |||
| 389 | return 0; | 389 | return 0; |
| 390 | failed: | 390 | failed: |
| 391 | for (; i >= 0; i--) { | 391 | for (; i >= 0; i--) { |
| 392 | if (i != indirect_blks && branch[i].bh) | 392 | /* |
| 393 | * We want to ext4_forget() only freshly allocated indirect | ||
| 394 | * blocks. Buffer for new_blocks[i-1] is at branch[i].bh and | ||
| 395 | * buffer at branch[0].bh is indirect block / inode already | ||
| 396 | * existing before ext4_alloc_branch() was called. | ||
| 397 | */ | ||
| 398 | if (i > 0 && i != indirect_blks && branch[i].bh) | ||
| 393 | ext4_forget(handle, 1, inode, branch[i].bh, | 399 | ext4_forget(handle, 1, inode, branch[i].bh, |
| 394 | branch[i].bh->b_blocknr); | 400 | branch[i].bh->b_blocknr); |
| 395 | ext4_free_blocks(handle, inode, NULL, new_blocks[i], | 401 | ext4_free_blocks(handle, inode, NULL, new_blocks[i], |
| @@ -1310,16 +1316,24 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode, | |||
| 1310 | blk = *i_data; | 1316 | blk = *i_data; |
| 1311 | if (level > 0) { | 1317 | if (level > 0) { |
| 1312 | ext4_lblk_t first2; | 1318 | ext4_lblk_t first2; |
| 1319 | ext4_lblk_t count2; | ||
| 1320 | |||
| 1313 | bh = sb_bread(inode->i_sb, le32_to_cpu(blk)); | 1321 | bh = sb_bread(inode->i_sb, le32_to_cpu(blk)); |
| 1314 | if (!bh) { | 1322 | if (!bh) { |
| 1315 | EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk), | 1323 | EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk), |
| 1316 | "Read failure"); | 1324 | "Read failure"); |
| 1317 | return -EIO; | 1325 | return -EIO; |
| 1318 | } | 1326 | } |
| 1319 | first2 = (first > offset) ? first - offset : 0; | 1327 | if (first > offset) { |
| 1328 | first2 = first - offset; | ||
| 1329 | count2 = count; | ||
| 1330 | } else { | ||
| 1331 | first2 = 0; | ||
| 1332 | count2 = count - (offset - first); | ||
| 1333 | } | ||
| 1320 | ret = free_hole_blocks(handle, inode, bh, | 1334 | ret = free_hole_blocks(handle, inode, bh, |
| 1321 | (__le32 *)bh->b_data, level - 1, | 1335 | (__le32 *)bh->b_data, level - 1, |
| 1322 | first2, count - offset, | 1336 | first2, count2, |
| 1323 | inode->i_sb->s_blocksize >> 2); | 1337 | inode->i_sb->s_blocksize >> 2); |
| 1324 | if (ret) { | 1338 | if (ret) { |
| 1325 | brelse(bh); | 1339 | brelse(bh); |
| @@ -1329,8 +1343,8 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode, | |||
| 1329 | if (level == 0 || | 1343 | if (level == 0 || |
| 1330 | (bh && all_zeroes((__le32 *)bh->b_data, | 1344 | (bh && all_zeroes((__le32 *)bh->b_data, |
| 1331 | (__le32 *)bh->b_data + addr_per_block))) { | 1345 | (__le32 *)bh->b_data + addr_per_block))) { |
| 1332 | ext4_free_data(handle, inode, parent_bh, &blk, &blk+1); | 1346 | ext4_free_data(handle, inode, parent_bh, |
| 1333 | *i_data = 0; | 1347 | i_data, i_data + 1); |
| 1334 | } | 1348 | } |
| 1335 | brelse(bh); | 1349 | brelse(bh); |
| 1336 | bh = NULL; | 1350 | bh = NULL; |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 59e31622cc6e..7f72f50a8fa7 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
| @@ -722,6 +722,7 @@ void ext4_mb_generate_buddy(struct super_block *sb, | |||
| 722 | void *buddy, void *bitmap, ext4_group_t group) | 722 | void *buddy, void *bitmap, ext4_group_t group) |
| 723 | { | 723 | { |
| 724 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); | 724 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); |
| 725 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 725 | ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb); | 726 | ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb); |
| 726 | ext4_grpblk_t i = 0; | 727 | ext4_grpblk_t i = 0; |
| 727 | ext4_grpblk_t first; | 728 | ext4_grpblk_t first; |
| @@ -759,6 +760,9 @@ void ext4_mb_generate_buddy(struct super_block *sb, | |||
| 759 | * corrupt and update bb_free using bitmap value | 760 | * corrupt and update bb_free using bitmap value |
| 760 | */ | 761 | */ |
| 761 | grp->bb_free = free; | 762 | grp->bb_free = free; |
| 763 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 764 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 765 | grp->bb_free); | ||
| 762 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 766 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 763 | } | 767 | } |
| 764 | mb_set_largest_free_order(sb, grp); | 768 | mb_set_largest_free_order(sb, grp); |
| @@ -1431,6 +1435,7 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | |||
| 1431 | right_is_free = !mb_test_bit(last + 1, e4b->bd_bitmap); | 1435 | right_is_free = !mb_test_bit(last + 1, e4b->bd_bitmap); |
| 1432 | 1436 | ||
| 1433 | if (unlikely(block != -1)) { | 1437 | if (unlikely(block != -1)) { |
| 1438 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 1434 | ext4_fsblk_t blocknr; | 1439 | ext4_fsblk_t blocknr; |
| 1435 | 1440 | ||
| 1436 | blocknr = ext4_group_first_block_no(sb, e4b->bd_group); | 1441 | blocknr = ext4_group_first_block_no(sb, e4b->bd_group); |
| @@ -1441,6 +1446,9 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | |||
| 1441 | "freeing already freed block " | 1446 | "freeing already freed block " |
| 1442 | "(bit %u); block bitmap corrupt.", | 1447 | "(bit %u); block bitmap corrupt.", |
| 1443 | block); | 1448 | block); |
| 1449 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info)) | ||
| 1450 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 1451 | e4b->bd_info->bb_free); | ||
| 1444 | /* Mark the block group as corrupt. */ | 1452 | /* Mark the block group as corrupt. */ |
| 1445 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, | 1453 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, |
| 1446 | &e4b->bd_info->bb_state); | 1454 | &e4b->bd_info->bb_state); |
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index e3d37f607f97..d895b4b7b661 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c | |||
| @@ -39,6 +39,19 @@ struct kernfs_open_node { | |||
| 39 | struct list_head files; /* goes through kernfs_open_file.list */ | 39 | struct list_head files; /* goes through kernfs_open_file.list */ |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | /* | ||
| 43 | * kernfs_notify() may be called from any context and bounces notifications | ||
| 44 | * through a work item. To minimize space overhead in kernfs_node, the | ||
| 45 | * pending queue is implemented as a singly linked list of kernfs_nodes. | ||
| 46 | * The list is terminated with the self pointer so that whether a | ||
| 47 | * kernfs_node is on the list or not can be determined by testing the next | ||
| 48 | * pointer for NULL. | ||
| 49 | */ | ||
| 50 | #define KERNFS_NOTIFY_EOL ((void *)&kernfs_notify_list) | ||
| 51 | |||
| 52 | static DEFINE_SPINLOCK(kernfs_notify_lock); | ||
| 53 | static struct kernfs_node *kernfs_notify_list = KERNFS_NOTIFY_EOL; | ||
| 54 | |||
| 42 | static struct kernfs_open_file *kernfs_of(struct file *file) | 55 | static struct kernfs_open_file *kernfs_of(struct file *file) |
| 43 | { | 56 | { |
| 44 | return ((struct seq_file *)file->private_data)->private; | 57 | return ((struct seq_file *)file->private_data)->private; |
| @@ -783,24 +796,25 @@ static unsigned int kernfs_fop_poll(struct file *filp, poll_table *wait) | |||
| 783 | return DEFAULT_POLLMASK|POLLERR|POLLPRI; | 796 | return DEFAULT_POLLMASK|POLLERR|POLLPRI; |
| 784 | } | 797 | } |
| 785 | 798 | ||
| 786 | /** | 799 | static void kernfs_notify_workfn(struct work_struct *work) |
| 787 | * kernfs_notify - notify a kernfs file | ||
| 788 | * @kn: file to notify | ||
| 789 | * | ||
| 790 | * Notify @kn such that poll(2) on @kn wakes up. | ||
| 791 | */ | ||
| 792 | void kernfs_notify(struct kernfs_node *kn) | ||
| 793 | { | 800 | { |
| 794 | struct kernfs_root *root = kernfs_root(kn); | 801 | struct kernfs_node *kn; |
| 795 | struct kernfs_open_node *on; | 802 | struct kernfs_open_node *on; |
| 796 | struct kernfs_super_info *info; | 803 | struct kernfs_super_info *info; |
| 797 | unsigned long flags; | 804 | repeat: |
| 798 | 805 | /* pop one off the notify_list */ | |
| 799 | if (WARN_ON(kernfs_type(kn) != KERNFS_FILE)) | 806 | spin_lock_irq(&kernfs_notify_lock); |
| 807 | kn = kernfs_notify_list; | ||
| 808 | if (kn == KERNFS_NOTIFY_EOL) { | ||
| 809 | spin_unlock_irq(&kernfs_notify_lock); | ||
| 800 | return; | 810 | return; |
| 811 | } | ||
| 812 | kernfs_notify_list = kn->attr.notify_next; | ||
| 813 | kn->attr.notify_next = NULL; | ||
| 814 | spin_unlock_irq(&kernfs_notify_lock); | ||
| 801 | 815 | ||
| 802 | /* kick poll */ | 816 | /* kick poll */ |
| 803 | spin_lock_irqsave(&kernfs_open_node_lock, flags); | 817 | spin_lock_irq(&kernfs_open_node_lock); |
| 804 | 818 | ||
| 805 | on = kn->attr.open; | 819 | on = kn->attr.open; |
| 806 | if (on) { | 820 | if (on) { |
| @@ -808,12 +822,12 @@ void kernfs_notify(struct kernfs_node *kn) | |||
| 808 | wake_up_interruptible(&on->poll); | 822 | wake_up_interruptible(&on->poll); |
| 809 | } | 823 | } |
| 810 | 824 | ||
| 811 | spin_unlock_irqrestore(&kernfs_open_node_lock, flags); | 825 | spin_unlock_irq(&kernfs_open_node_lock); |
| 812 | 826 | ||
| 813 | /* kick fsnotify */ | 827 | /* kick fsnotify */ |
| 814 | mutex_lock(&kernfs_mutex); | 828 | mutex_lock(&kernfs_mutex); |
| 815 | 829 | ||
| 816 | list_for_each_entry(info, &root->supers, node) { | 830 | list_for_each_entry(info, &kernfs_root(kn)->supers, node) { |
| 817 | struct inode *inode; | 831 | struct inode *inode; |
| 818 | struct dentry *dentry; | 832 | struct dentry *dentry; |
| 819 | 833 | ||
| @@ -833,6 +847,33 @@ void kernfs_notify(struct kernfs_node *kn) | |||
| 833 | } | 847 | } |
| 834 | 848 | ||
| 835 | mutex_unlock(&kernfs_mutex); | 849 | mutex_unlock(&kernfs_mutex); |
| 850 | kernfs_put(kn); | ||
| 851 | goto repeat; | ||
| 852 | } | ||
| 853 | |||
| 854 | /** | ||
| 855 | * kernfs_notify - notify a kernfs file | ||
| 856 | * @kn: file to notify | ||
| 857 | * | ||
| 858 | * Notify @kn such that poll(2) on @kn wakes up. Maybe be called from any | ||
| 859 | * context. | ||
| 860 | */ | ||
| 861 | void kernfs_notify(struct kernfs_node *kn) | ||
| 862 | { | ||
| 863 | static DECLARE_WORK(kernfs_notify_work, kernfs_notify_workfn); | ||
| 864 | unsigned long flags; | ||
| 865 | |||
| 866 | if (WARN_ON(kernfs_type(kn) != KERNFS_FILE)) | ||
| 867 | return; | ||
| 868 | |||
| 869 | spin_lock_irqsave(&kernfs_notify_lock, flags); | ||
| 870 | if (!kn->attr.notify_next) { | ||
| 871 | kernfs_get(kn); | ||
| 872 | kn->attr.notify_next = kernfs_notify_list; | ||
| 873 | kernfs_notify_list = kn; | ||
| 874 | schedule_work(&kernfs_notify_work); | ||
| 875 | } | ||
| 876 | spin_unlock_irqrestore(&kernfs_notify_lock, flags); | ||
| 836 | } | 877 | } |
| 837 | EXPORT_SYMBOL_GPL(kernfs_notify); | 878 | EXPORT_SYMBOL_GPL(kernfs_notify); |
| 838 | 879 | ||
diff --git a/fs/mbcache.c b/fs/mbcache.c index bf166e388f0d..187477ded6b3 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c | |||
| @@ -73,6 +73,7 @@ | |||
| 73 | #include <linux/mbcache.h> | 73 | #include <linux/mbcache.h> |
| 74 | #include <linux/init.h> | 74 | #include <linux/init.h> |
| 75 | #include <linux/blockgroup_lock.h> | 75 | #include <linux/blockgroup_lock.h> |
| 76 | #include <linux/log2.h> | ||
| 76 | 77 | ||
| 77 | #ifdef MB_CACHE_DEBUG | 78 | #ifdef MB_CACHE_DEBUG |
| 78 | # define mb_debug(f...) do { \ | 79 | # define mb_debug(f...) do { \ |
| @@ -93,7 +94,7 @@ | |||
| 93 | 94 | ||
| 94 | #define MB_CACHE_WRITER ((unsigned short)~0U >> 1) | 95 | #define MB_CACHE_WRITER ((unsigned short)~0U >> 1) |
| 95 | 96 | ||
| 96 | #define MB_CACHE_ENTRY_LOCK_BITS __builtin_log2(NR_BG_LOCKS) | 97 | #define MB_CACHE_ENTRY_LOCK_BITS ilog2(NR_BG_LOCKS) |
| 97 | #define MB_CACHE_ENTRY_LOCK_INDEX(ce) \ | 98 | #define MB_CACHE_ENTRY_LOCK_INDEX(ce) \ |
| 98 | (hash_long((unsigned long)ce, MB_CACHE_ENTRY_LOCK_BITS)) | 99 | (hash_long((unsigned long)ce, MB_CACHE_ENTRY_LOCK_BITS)) |
| 99 | 100 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index c496f8a74639..9927913c97c2 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
| @@ -147,6 +147,17 @@ int nfs_sync_mapping(struct address_space *mapping) | |||
| 147 | return ret; | 147 | return ret; |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags) | ||
| 151 | { | ||
| 152 | struct nfs_inode *nfsi = NFS_I(inode); | ||
| 153 | |||
| 154 | if (inode->i_mapping->nrpages == 0) | ||
| 155 | flags &= ~NFS_INO_INVALID_DATA; | ||
| 156 | nfsi->cache_validity |= flags; | ||
| 157 | if (flags & NFS_INO_INVALID_DATA) | ||
| 158 | nfs_fscache_invalidate(inode); | ||
| 159 | } | ||
| 160 | |||
| 150 | /* | 161 | /* |
| 151 | * Invalidate the local caches | 162 | * Invalidate the local caches |
| 152 | */ | 163 | */ |
| @@ -162,17 +173,16 @@ static void nfs_zap_caches_locked(struct inode *inode) | |||
| 162 | 173 | ||
| 163 | memset(NFS_I(inode)->cookieverf, 0, sizeof(NFS_I(inode)->cookieverf)); | 174 | memset(NFS_I(inode)->cookieverf, 0, sizeof(NFS_I(inode)->cookieverf)); |
| 164 | if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) { | 175 | if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) { |
| 165 | nfs_fscache_invalidate(inode); | 176 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR |
| 166 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | ||
| 167 | | NFS_INO_INVALID_DATA | 177 | | NFS_INO_INVALID_DATA |
| 168 | | NFS_INO_INVALID_ACCESS | 178 | | NFS_INO_INVALID_ACCESS |
| 169 | | NFS_INO_INVALID_ACL | 179 | | NFS_INO_INVALID_ACL |
| 170 | | NFS_INO_REVAL_PAGECACHE; | 180 | | NFS_INO_REVAL_PAGECACHE); |
| 171 | } else | 181 | } else |
| 172 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | 182 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR |
| 173 | | NFS_INO_INVALID_ACCESS | 183 | | NFS_INO_INVALID_ACCESS |
| 174 | | NFS_INO_INVALID_ACL | 184 | | NFS_INO_INVALID_ACL |
| 175 | | NFS_INO_REVAL_PAGECACHE; | 185 | | NFS_INO_REVAL_PAGECACHE); |
| 176 | nfs_zap_label_cache_locked(nfsi); | 186 | nfs_zap_label_cache_locked(nfsi); |
| 177 | } | 187 | } |
| 178 | 188 | ||
| @@ -187,8 +197,7 @@ void nfs_zap_mapping(struct inode *inode, struct address_space *mapping) | |||
| 187 | { | 197 | { |
| 188 | if (mapping->nrpages != 0) { | 198 | if (mapping->nrpages != 0) { |
| 189 | spin_lock(&inode->i_lock); | 199 | spin_lock(&inode->i_lock); |
| 190 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA; | 200 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); |
| 191 | nfs_fscache_invalidate(inode); | ||
| 192 | spin_unlock(&inode->i_lock); | 201 | spin_unlock(&inode->i_lock); |
| 193 | } | 202 | } |
| 194 | } | 203 | } |
| @@ -209,7 +218,7 @@ EXPORT_SYMBOL_GPL(nfs_zap_acl_cache); | |||
| 209 | void nfs_invalidate_atime(struct inode *inode) | 218 | void nfs_invalidate_atime(struct inode *inode) |
| 210 | { | 219 | { |
| 211 | spin_lock(&inode->i_lock); | 220 | spin_lock(&inode->i_lock); |
| 212 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME; | 221 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATIME); |
| 213 | spin_unlock(&inode->i_lock); | 222 | spin_unlock(&inode->i_lock); |
| 214 | } | 223 | } |
| 215 | EXPORT_SYMBOL_GPL(nfs_invalidate_atime); | 224 | EXPORT_SYMBOL_GPL(nfs_invalidate_atime); |
| @@ -369,7 +378,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st | |||
| 369 | inode->i_mode = fattr->mode; | 378 | inode->i_mode = fattr->mode; |
| 370 | if ((fattr->valid & NFS_ATTR_FATTR_MODE) == 0 | 379 | if ((fattr->valid & NFS_ATTR_FATTR_MODE) == 0 |
| 371 | && nfs_server_capable(inode, NFS_CAP_MODE)) | 380 | && nfs_server_capable(inode, NFS_CAP_MODE)) |
| 372 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 381 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
| 373 | /* Why so? Because we want revalidate for devices/FIFOs, and | 382 | /* Why so? Because we want revalidate for devices/FIFOs, and |
| 374 | * that's precisely what we have in nfs_file_inode_operations. | 383 | * that's precisely what we have in nfs_file_inode_operations. |
| 375 | */ | 384 | */ |
| @@ -415,36 +424,36 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st | |||
| 415 | if (fattr->valid & NFS_ATTR_FATTR_ATIME) | 424 | if (fattr->valid & NFS_ATTR_FATTR_ATIME) |
| 416 | inode->i_atime = fattr->atime; | 425 | inode->i_atime = fattr->atime; |
| 417 | else if (nfs_server_capable(inode, NFS_CAP_ATIME)) | 426 | else if (nfs_server_capable(inode, NFS_CAP_ATIME)) |
| 418 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 427 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
| 419 | if (fattr->valid & NFS_ATTR_FATTR_MTIME) | 428 | if (fattr->valid & NFS_ATTR_FATTR_MTIME) |
| 420 | inode->i_mtime = fattr->mtime; | 429 | inode->i_mtime = fattr->mtime; |
| 421 | else if (nfs_server_capable(inode, NFS_CAP_MTIME)) | 430 | else if (nfs_server_capable(inode, NFS_CAP_MTIME)) |
| 422 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 431 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
| 423 | if (fattr->valid & NFS_ATTR_FATTR_CTIME) | 432 | if (fattr->valid & NFS_ATTR_FATTR_CTIME) |
| 424 | inode->i_ctime = fattr->ctime; | 433 | inode->i_ctime = fattr->ctime; |
| 425 | else if (nfs_server_capable(inode, NFS_CAP_CTIME)) | 434 | else if (nfs_server_capable(inode, NFS_CAP_CTIME)) |
| 426 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 435 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
| 427 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) | 436 | if (fattr->valid & NFS_ATTR_FATTR_CHANGE) |
| 428 | inode->i_version = fattr->change_attr; | 437 | inode->i_version = fattr->change_attr; |
| 429 | else if (nfs_server_capable(inode, NFS_CAP_CHANGE_ATTR)) | 438 | else if (nfs_server_capable(inode, NFS_CAP_CHANGE_ATTR)) |
| 430 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 439 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
| 431 | if (fattr->valid & NFS_ATTR_FATTR_SIZE) | 440 | if (fattr->valid & NFS_ATTR_FATTR_SIZE) |
| 432 | inode->i_size = nfs_size_to_loff_t(fattr->size); | 441 | inode->i_size = nfs_size_to_loff_t(fattr->size); |
| 433 | else | 442 | else |
| 434 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | 443 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR |
| 435 | | NFS_INO_REVAL_PAGECACHE; | 444 | | NFS_INO_REVAL_PAGECACHE); |
| 436 | if (fattr->valid & NFS_ATTR_FATTR_NLINK) | 445 | if (fattr->valid & NFS_ATTR_FATTR_NLINK) |
| 437 | set_nlink(inode, fattr->nlink); | 446 | set_nlink(inode, fattr->nlink); |
| 438 | else if (nfs_server_capable(inode, NFS_CAP_NLINK)) | 447 | else if (nfs_server_capable(inode, NFS_CAP_NLINK)) |
| 439 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 448 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
| 440 | if (fattr->valid & NFS_ATTR_FATTR_OWNER) | 449 | if (fattr->valid & NFS_ATTR_FATTR_OWNER) |
| 441 | inode->i_uid = fattr->uid; | 450 | inode->i_uid = fattr->uid; |
| 442 | else if (nfs_server_capable(inode, NFS_CAP_OWNER)) | 451 | else if (nfs_server_capable(inode, NFS_CAP_OWNER)) |
| 443 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 452 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
| 444 | if (fattr->valid & NFS_ATTR_FATTR_GROUP) | 453 | if (fattr->valid & NFS_ATTR_FATTR_GROUP) |
| 445 | inode->i_gid = fattr->gid; | 454 | inode->i_gid = fattr->gid; |
| 446 | else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP)) | 455 | else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP)) |
| 447 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 456 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR); |
| 448 | if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) | 457 | if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED) |
| 449 | inode->i_blocks = fattr->du.nfs2.blocks; | 458 | inode->i_blocks = fattr->du.nfs2.blocks; |
| 450 | if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { | 459 | if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) { |
| @@ -550,6 +559,9 @@ static int nfs_vmtruncate(struct inode * inode, loff_t offset) | |||
| 550 | 559 | ||
| 551 | spin_lock(&inode->i_lock); | 560 | spin_lock(&inode->i_lock); |
| 552 | i_size_write(inode, offset); | 561 | i_size_write(inode, offset); |
| 562 | /* Optimisation */ | ||
| 563 | if (offset == 0) | ||
| 564 | NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_DATA; | ||
| 553 | spin_unlock(&inode->i_lock); | 565 | spin_unlock(&inode->i_lock); |
| 554 | 566 | ||
| 555 | truncate_pagecache(inode, offset); | 567 | truncate_pagecache(inode, offset); |
| @@ -578,7 +590,8 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr) | |||
| 578 | inode->i_uid = attr->ia_uid; | 590 | inode->i_uid = attr->ia_uid; |
| 579 | if ((attr->ia_valid & ATTR_GID) != 0) | 591 | if ((attr->ia_valid & ATTR_GID) != 0) |
| 580 | inode->i_gid = attr->ia_gid; | 592 | inode->i_gid = attr->ia_gid; |
| 581 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | 593 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ACCESS |
| 594 | | NFS_INO_INVALID_ACL); | ||
| 582 | spin_unlock(&inode->i_lock); | 595 | spin_unlock(&inode->i_lock); |
| 583 | } | 596 | } |
| 584 | if ((attr->ia_valid & ATTR_SIZE) != 0) { | 597 | if ((attr->ia_valid & ATTR_SIZE) != 0) { |
| @@ -1101,7 +1114,7 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr | |||
| 1101 | && inode->i_version == fattr->pre_change_attr) { | 1114 | && inode->i_version == fattr->pre_change_attr) { |
| 1102 | inode->i_version = fattr->change_attr; | 1115 | inode->i_version = fattr->change_attr; |
| 1103 | if (S_ISDIR(inode->i_mode)) | 1116 | if (S_ISDIR(inode->i_mode)) |
| 1104 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 1117 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); |
| 1105 | ret |= NFS_INO_INVALID_ATTR; | 1118 | ret |= NFS_INO_INVALID_ATTR; |
| 1106 | } | 1119 | } |
| 1107 | /* If we have atomic WCC data, we may update some attributes */ | 1120 | /* If we have atomic WCC data, we may update some attributes */ |
| @@ -1117,7 +1130,7 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr | |||
| 1117 | && timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) { | 1130 | && timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) { |
| 1118 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); | 1131 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); |
| 1119 | if (S_ISDIR(inode->i_mode)) | 1132 | if (S_ISDIR(inode->i_mode)) |
| 1120 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 1133 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); |
| 1121 | ret |= NFS_INO_INVALID_ATTR; | 1134 | ret |= NFS_INO_INVALID_ATTR; |
| 1122 | } | 1135 | } |
| 1123 | if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE) | 1136 | if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE) |
| @@ -1128,9 +1141,6 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr | |||
| 1128 | ret |= NFS_INO_INVALID_ATTR; | 1141 | ret |= NFS_INO_INVALID_ATTR; |
| 1129 | } | 1142 | } |
| 1130 | 1143 | ||
| 1131 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) | ||
| 1132 | nfs_fscache_invalidate(inode); | ||
| 1133 | |||
| 1134 | return ret; | 1144 | return ret; |
| 1135 | } | 1145 | } |
| 1136 | 1146 | ||
| @@ -1189,7 +1199,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat | |||
| 1189 | invalid |= NFS_INO_INVALID_ATIME; | 1199 | invalid |= NFS_INO_INVALID_ATIME; |
| 1190 | 1200 | ||
| 1191 | if (invalid != 0) | 1201 | if (invalid != 0) |
| 1192 | nfsi->cache_validity |= invalid; | 1202 | nfs_set_cache_invalid(inode, invalid); |
| 1193 | 1203 | ||
| 1194 | nfsi->read_cache_jiffies = fattr->time_start; | 1204 | nfsi->read_cache_jiffies = fattr->time_start; |
| 1195 | return 0; | 1205 | return 0; |
| @@ -1402,13 +1412,11 @@ EXPORT_SYMBOL_GPL(nfs_refresh_inode); | |||
| 1402 | 1412 | ||
| 1403 | static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr *fattr) | 1413 | static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr *fattr) |
| 1404 | { | 1414 | { |
| 1405 | struct nfs_inode *nfsi = NFS_I(inode); | 1415 | unsigned long invalid = NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; |
| 1406 | 1416 | ||
| 1407 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; | 1417 | if (S_ISDIR(inode->i_mode)) |
| 1408 | if (S_ISDIR(inode->i_mode)) { | 1418 | invalid |= NFS_INO_INVALID_DATA; |
| 1409 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 1419 | nfs_set_cache_invalid(inode, invalid); |
| 1410 | nfs_fscache_invalidate(inode); | ||
| 1411 | } | ||
| 1412 | if ((fattr->valid & NFS_ATTR_FATTR) == 0) | 1420 | if ((fattr->valid & NFS_ATTR_FATTR) == 0) |
| 1413 | return 0; | 1421 | return 0; |
| 1414 | return nfs_refresh_inode_locked(inode, fattr); | 1422 | return nfs_refresh_inode_locked(inode, fattr); |
| @@ -1601,6 +1609,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
| 1601 | if ((nfsi->npages == 0) || new_isize > cur_isize) { | 1609 | if ((nfsi->npages == 0) || new_isize > cur_isize) { |
| 1602 | i_size_write(inode, new_isize); | 1610 | i_size_write(inode, new_isize); |
| 1603 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; | 1611 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; |
| 1612 | invalid &= ~NFS_INO_REVAL_PAGECACHE; | ||
| 1604 | } | 1613 | } |
| 1605 | dprintk("NFS: isize change on server for file %s/%ld " | 1614 | dprintk("NFS: isize change on server for file %s/%ld " |
| 1606 | "(%Ld to %Ld)\n", | 1615 | "(%Ld to %Ld)\n", |
| @@ -1702,10 +1711,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
| 1702 | invalid &= ~NFS_INO_INVALID_DATA; | 1711 | invalid &= ~NFS_INO_INVALID_DATA; |
| 1703 | if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ) || | 1712 | if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ) || |
| 1704 | (save_cache_validity & NFS_INO_REVAL_FORCED)) | 1713 | (save_cache_validity & NFS_INO_REVAL_FORCED)) |
| 1705 | nfsi->cache_validity |= invalid; | 1714 | nfs_set_cache_invalid(inode, invalid); |
| 1706 | |||
| 1707 | if (invalid & NFS_INO_INVALID_DATA) | ||
| 1708 | nfs_fscache_invalidate(inode); | ||
| 1709 | 1715 | ||
| 1710 | return 0; | 1716 | return 0; |
| 1711 | out_err: | 1717 | out_err: |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index f63cb87cd730..ba2affa51941 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
| @@ -230,7 +230,7 @@ int nfs_atomic_open(struct inode *, struct dentry *, struct file *, | |||
| 230 | extern struct file_system_type nfs4_fs_type; | 230 | extern struct file_system_type nfs4_fs_type; |
| 231 | 231 | ||
| 232 | /* nfs4namespace.c */ | 232 | /* nfs4namespace.c */ |
| 233 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *, struct inode *, struct qstr *); | 233 | struct rpc_clnt *nfs4_negotiate_security(struct rpc_clnt *, struct inode *, struct qstr *); |
| 234 | struct vfsmount *nfs4_submount(struct nfs_server *, struct dentry *, | 234 | struct vfsmount *nfs4_submount(struct nfs_server *, struct dentry *, |
| 235 | struct nfs_fh *, struct nfs_fattr *); | 235 | struct nfs_fh *, struct nfs_fattr *); |
| 236 | int nfs4_replace_transport(struct nfs_server *server, | 236 | int nfs4_replace_transport(struct nfs_server *server, |
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 3d5dbf80d46a..3d83cb1fdc70 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
| @@ -139,16 +139,22 @@ static size_t nfs_parse_server_name(char *string, size_t len, | |||
| 139 | * @server: NFS server struct | 139 | * @server: NFS server struct |
| 140 | * @flavors: List of security tuples returned by SECINFO procedure | 140 | * @flavors: List of security tuples returned by SECINFO procedure |
| 141 | * | 141 | * |
| 142 | * Return the pseudoflavor of the first security mechanism in | 142 | * Return an rpc client that uses the first security mechanism in |
| 143 | * "flavors" that is locally supported. Return RPC_AUTH_UNIX if | 143 | * "flavors" that is locally supported. The "flavors" array |
| 144 | * no matching flavor is found in the array. The "flavors" array | ||
| 145 | * is searched in the order returned from the server, per RFC 3530 | 144 | * is searched in the order returned from the server, per RFC 3530 |
| 146 | * recommendation. | 145 | * recommendation and each flavor is checked for membership in the |
| 146 | * sec= mount option list if it exists. | ||
| 147 | * | ||
| 148 | * Return -EPERM if no matching flavor is found in the array. | ||
| 149 | * | ||
| 150 | * Please call rpc_shutdown_client() when you are done with this rpc client. | ||
| 151 | * | ||
| 147 | */ | 152 | */ |
| 148 | static rpc_authflavor_t nfs_find_best_sec(struct nfs_server *server, | 153 | static struct rpc_clnt *nfs_find_best_sec(struct rpc_clnt *clnt, |
| 154 | struct nfs_server *server, | ||
| 149 | struct nfs4_secinfo_flavors *flavors) | 155 | struct nfs4_secinfo_flavors *flavors) |
| 150 | { | 156 | { |
| 151 | rpc_authflavor_t pseudoflavor; | 157 | rpc_authflavor_t pflavor; |
| 152 | struct nfs4_secinfo4 *secinfo; | 158 | struct nfs4_secinfo4 *secinfo; |
| 153 | unsigned int i; | 159 | unsigned int i; |
| 154 | 160 | ||
| @@ -159,62 +165,73 @@ static rpc_authflavor_t nfs_find_best_sec(struct nfs_server *server, | |||
| 159 | case RPC_AUTH_NULL: | 165 | case RPC_AUTH_NULL: |
| 160 | case RPC_AUTH_UNIX: | 166 | case RPC_AUTH_UNIX: |
| 161 | case RPC_AUTH_GSS: | 167 | case RPC_AUTH_GSS: |
| 162 | pseudoflavor = rpcauth_get_pseudoflavor(secinfo->flavor, | 168 | pflavor = rpcauth_get_pseudoflavor(secinfo->flavor, |
| 163 | &secinfo->flavor_info); | 169 | &secinfo->flavor_info); |
| 164 | /* make sure pseudoflavor matches sec= mount opt */ | 170 | /* does the pseudoflavor match a sec= mount opt? */ |
| 165 | if (pseudoflavor != RPC_AUTH_MAXFLAVOR && | 171 | if (pflavor != RPC_AUTH_MAXFLAVOR && |
| 166 | nfs_auth_info_match(&server->auth_info, | 172 | nfs_auth_info_match(&server->auth_info, pflavor)) { |
| 167 | pseudoflavor)) | 173 | struct rpc_clnt *new; |
| 168 | return pseudoflavor; | 174 | struct rpc_cred *cred; |
| 169 | break; | 175 | |
| 176 | /* Cloning creates an rpc_auth for the flavor */ | ||
| 177 | new = rpc_clone_client_set_auth(clnt, pflavor); | ||
| 178 | if (IS_ERR(new)) | ||
| 179 | continue; | ||
| 180 | /** | ||
| 181 | * Check that the user actually can use the | ||
| 182 | * flavor. This is mostly for RPC_AUTH_GSS | ||
| 183 | * where cr_init obtains a gss context | ||
| 184 | */ | ||
| 185 | cred = rpcauth_lookupcred(new->cl_auth, 0); | ||
| 186 | if (IS_ERR(cred)) { | ||
| 187 | rpc_shutdown_client(new); | ||
| 188 | continue; | ||
| 189 | } | ||
| 190 | put_rpccred(cred); | ||
| 191 | return new; | ||
| 192 | } | ||
| 170 | } | 193 | } |
| 171 | } | 194 | } |
| 172 | 195 | return ERR_PTR(-EPERM); | |
| 173 | /* if there were any sec= options then nothing matched */ | ||
| 174 | if (server->auth_info.flavor_len > 0) | ||
| 175 | return -EPERM; | ||
| 176 | |||
| 177 | return RPC_AUTH_UNIX; | ||
| 178 | } | 196 | } |
| 179 | 197 | ||
| 180 | static rpc_authflavor_t nfs4_negotiate_security(struct inode *inode, struct qstr *name) | 198 | /** |
| 199 | * nfs4_negotiate_security - in response to an NFS4ERR_WRONGSEC on lookup, | ||
| 200 | * return an rpc_clnt that uses the best available security flavor with | ||
| 201 | * respect to the secinfo flavor list and the sec= mount options. | ||
| 202 | * | ||
| 203 | * @clnt: RPC client to clone | ||
| 204 | * @inode: directory inode | ||
| 205 | * @name: lookup name | ||
| 206 | * | ||
| 207 | * Please call rpc_shutdown_client() when you are done with this rpc client. | ||
| 208 | */ | ||
| 209 | struct rpc_clnt * | ||
| 210 | nfs4_negotiate_security(struct rpc_clnt *clnt, struct inode *inode, | ||
| 211 | struct qstr *name) | ||
| 181 | { | 212 | { |
| 182 | struct page *page; | 213 | struct page *page; |
| 183 | struct nfs4_secinfo_flavors *flavors; | 214 | struct nfs4_secinfo_flavors *flavors; |
| 184 | rpc_authflavor_t flavor; | 215 | struct rpc_clnt *new; |
| 185 | int err; | 216 | int err; |
| 186 | 217 | ||
| 187 | page = alloc_page(GFP_KERNEL); | 218 | page = alloc_page(GFP_KERNEL); |
| 188 | if (!page) | 219 | if (!page) |
| 189 | return -ENOMEM; | 220 | return ERR_PTR(-ENOMEM); |
| 221 | |||
| 190 | flavors = page_address(page); | 222 | flavors = page_address(page); |
| 191 | 223 | ||
| 192 | err = nfs4_proc_secinfo(inode, name, flavors); | 224 | err = nfs4_proc_secinfo(inode, name, flavors); |
| 193 | if (err < 0) { | 225 | if (err < 0) { |
| 194 | flavor = err; | 226 | new = ERR_PTR(err); |
| 195 | goto out; | 227 | goto out; |
| 196 | } | 228 | } |
| 197 | 229 | ||
| 198 | flavor = nfs_find_best_sec(NFS_SERVER(inode), flavors); | 230 | new = nfs_find_best_sec(clnt, NFS_SERVER(inode), flavors); |
| 199 | 231 | ||
| 200 | out: | 232 | out: |
| 201 | put_page(page); | 233 | put_page(page); |
| 202 | return flavor; | 234 | return new; |
| 203 | } | ||
| 204 | |||
| 205 | /* | ||
| 206 | * Please call rpc_shutdown_client() when you are done with this client. | ||
| 207 | */ | ||
| 208 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *clnt, struct inode *inode, | ||
| 209 | struct qstr *name) | ||
| 210 | { | ||
| 211 | rpc_authflavor_t flavor; | ||
| 212 | |||
| 213 | flavor = nfs4_negotiate_security(inode, name); | ||
| 214 | if ((int)flavor < 0) | ||
| 215 | return ERR_PTR((int)flavor); | ||
| 216 | |||
| 217 | return rpc_clone_client_set_auth(clnt, flavor); | ||
| 218 | } | 235 | } |
| 219 | 236 | ||
| 220 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, | 237 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, |
| @@ -397,11 +414,6 @@ struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry, | |||
| 397 | 414 | ||
| 398 | if (client->cl_auth->au_flavor != flavor) | 415 | if (client->cl_auth->au_flavor != flavor) |
| 399 | flavor = client->cl_auth->au_flavor; | 416 | flavor = client->cl_auth->au_flavor; |
| 400 | else { | ||
| 401 | rpc_authflavor_t new = nfs4_negotiate_security(dir, name); | ||
| 402 | if ((int)new >= 0) | ||
| 403 | flavor = new; | ||
| 404 | } | ||
| 405 | mnt = nfs_do_submount(dentry, fh, fattr, flavor); | 417 | mnt = nfs_do_submount(dentry, fh, fattr, flavor); |
| 406 | out: | 418 | out: |
| 407 | rpc_shutdown_client(client); | 419 | rpc_shutdown_client(client); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 285ad5334018..4bf3d97cc5a0 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -3247,7 +3247,7 @@ static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, | |||
| 3247 | err = -EPERM; | 3247 | err = -EPERM; |
| 3248 | if (client != *clnt) | 3248 | if (client != *clnt) |
| 3249 | goto out; | 3249 | goto out; |
| 3250 | client = nfs4_create_sec_client(client, dir, name); | 3250 | client = nfs4_negotiate_security(client, dir, name); |
| 3251 | if (IS_ERR(client)) | 3251 | if (IS_ERR(client)) |
| 3252 | return PTR_ERR(client); | 3252 | return PTR_ERR(client); |
| 3253 | 3253 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 3ee5af4e738e..98ff061ccaf3 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
| @@ -934,12 +934,14 @@ static bool nfs_write_pageuptodate(struct page *page, struct inode *inode) | |||
| 934 | 934 | ||
| 935 | if (nfs_have_delegated_attributes(inode)) | 935 | if (nfs_have_delegated_attributes(inode)) |
| 936 | goto out; | 936 | goto out; |
| 937 | if (nfsi->cache_validity & (NFS_INO_INVALID_DATA|NFS_INO_REVAL_PAGECACHE)) | 937 | if (nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) |
| 938 | return false; | 938 | return false; |
| 939 | smp_rmb(); | 939 | smp_rmb(); |
| 940 | if (test_bit(NFS_INO_INVALIDATING, &nfsi->flags)) | 940 | if (test_bit(NFS_INO_INVALIDATING, &nfsi->flags)) |
| 941 | return false; | 941 | return false; |
| 942 | out: | 942 | out: |
| 943 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) | ||
| 944 | return false; | ||
| 943 | return PageUptodate(page) != 0; | 945 | return PageUptodate(page) != 0; |
| 944 | } | 946 | } |
| 945 | 947 | ||
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 6851b003f2a4..8f029db5d271 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
| @@ -617,15 +617,6 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 617 | 617 | ||
| 618 | switch (create->cr_type) { | 618 | switch (create->cr_type) { |
| 619 | case NF4LNK: | 619 | case NF4LNK: |
| 620 | /* ugh! we have to null-terminate the linktext, or | ||
| 621 | * vfs_symlink() will choke. it is always safe to | ||
| 622 | * null-terminate by brute force, since at worst we | ||
| 623 | * will overwrite the first byte of the create namelen | ||
| 624 | * in the XDR buffer, which has already been extracted | ||
| 625 | * during XDR decode. | ||
| 626 | */ | ||
| 627 | create->cr_linkname[create->cr_linklen] = 0; | ||
| 628 | |||
| 629 | status = nfsd_symlink(rqstp, &cstate->current_fh, | 620 | status = nfsd_symlink(rqstp, &cstate->current_fh, |
| 630 | create->cr_name, create->cr_namelen, | 621 | create->cr_name, create->cr_namelen, |
| 631 | create->cr_linkname, create->cr_linklen, | 622 | create->cr_linkname, create->cr_linklen, |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 83baf2bfe9e9..2fc7abebeb9b 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
| @@ -600,7 +600,18 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create | |||
| 600 | READ_BUF(4); | 600 | READ_BUF(4); |
| 601 | create->cr_linklen = be32_to_cpup(p++); | 601 | create->cr_linklen = be32_to_cpup(p++); |
| 602 | READ_BUF(create->cr_linklen); | 602 | READ_BUF(create->cr_linklen); |
| 603 | SAVEMEM(create->cr_linkname, create->cr_linklen); | 603 | /* |
| 604 | * The VFS will want a null-terminated string, and | ||
| 605 | * null-terminating in place isn't safe since this might | ||
| 606 | * end on a page boundary: | ||
| 607 | */ | ||
| 608 | create->cr_linkname = | ||
| 609 | kmalloc(create->cr_linklen + 1, GFP_KERNEL); | ||
| 610 | if (!create->cr_linkname) | ||
| 611 | return nfserr_jukebox; | ||
| 612 | memcpy(create->cr_linkname, p, create->cr_linklen); | ||
| 613 | create->cr_linkname[create->cr_linklen] = '\0'; | ||
| 614 | defer_free(argp, kfree, create->cr_linkname); | ||
| 604 | break; | 615 | break; |
| 605 | case NF4BLK: | 616 | case NF4BLK: |
| 606 | case NF4CHR: | 617 | case NF4CHR: |
| @@ -3267,7 +3278,7 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd | |||
| 3267 | 3278 | ||
| 3268 | wire_count = htonl(maxcount); | 3279 | wire_count = htonl(maxcount); |
| 3269 | write_bytes_to_xdr_buf(xdr->buf, length_offset, &wire_count, 4); | 3280 | write_bytes_to_xdr_buf(xdr->buf, length_offset, &wire_count, 4); |
| 3270 | xdr_truncate_encode(xdr, length_offset + 4 + maxcount); | 3281 | xdr_truncate_encode(xdr, length_offset + 4 + ALIGN(maxcount, 4)); |
| 3271 | if (maxcount & 3) | 3282 | if (maxcount & 3) |
| 3272 | write_bytes_to_xdr_buf(xdr->buf, length_offset + 4 + maxcount, | 3283 | write_bytes_to_xdr_buf(xdr->buf, length_offset + 4 + maxcount, |
| 3273 | &zero, 4 - (maxcount&3)); | 3284 | &zero, 4 - (maxcount&3)); |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 9d231e9e5f0e..bf2d03f8fd3e 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
| @@ -184,29 +184,11 @@ static int show_stat(struct seq_file *p, void *v) | |||
| 184 | 184 | ||
| 185 | static int stat_open(struct inode *inode, struct file *file) | 185 | static int stat_open(struct inode *inode, struct file *file) |
| 186 | { | 186 | { |
| 187 | size_t size = 1024 + 128 * num_possible_cpus(); | 187 | size_t size = 1024 + 128 * num_online_cpus(); |
| 188 | char *buf; | ||
| 189 | struct seq_file *m; | ||
| 190 | int res; | ||
| 191 | 188 | ||
| 192 | /* minimum size to display an interrupt count : 2 bytes */ | 189 | /* minimum size to display an interrupt count : 2 bytes */ |
| 193 | size += 2 * nr_irqs; | 190 | size += 2 * nr_irqs; |
| 194 | 191 | return single_open_size(file, show_stat, NULL, size); | |
| 195 | /* don't ask for more than the kmalloc() max size */ | ||
| 196 | if (size > KMALLOC_MAX_SIZE) | ||
| 197 | size = KMALLOC_MAX_SIZE; | ||
| 198 | buf = kmalloc(size, GFP_KERNEL); | ||
| 199 | if (!buf) | ||
| 200 | return -ENOMEM; | ||
| 201 | |||
| 202 | res = single_open(file, show_stat, NULL); | ||
| 203 | if (!res) { | ||
| 204 | m = file->private_data; | ||
| 205 | m->buf = buf; | ||
| 206 | m->size = ksize(buf); | ||
| 207 | } else | ||
| 208 | kfree(buf); | ||
| 209 | return res; | ||
| 210 | } | 192 | } |
| 211 | 193 | ||
| 212 | static const struct file_operations proc_stat_operations = { | 194 | static const struct file_operations proc_stat_operations = { |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 1d641bb108d2..3857b720cb1b 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
| @@ -8,8 +8,10 @@ | |||
| 8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
| 9 | #include <linux/export.h> | 9 | #include <linux/export.h> |
| 10 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
| 11 | #include <linux/vmalloc.h> | ||
| 11 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
| 12 | #include <linux/cred.h> | 13 | #include <linux/cred.h> |
| 14 | #include <linux/mm.h> | ||
| 13 | 15 | ||
| 14 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
| 15 | #include <asm/page.h> | 17 | #include <asm/page.h> |
| @@ -30,6 +32,16 @@ static void seq_set_overflow(struct seq_file *m) | |||
| 30 | m->count = m->size; | 32 | m->count = m->size; |
| 31 | } | 33 | } |
| 32 | 34 | ||
| 35 | static void *seq_buf_alloc(unsigned long size) | ||
| 36 | { | ||
| 37 | void *buf; | ||
| 38 | |||
| 39 | buf = kmalloc(size, GFP_KERNEL | __GFP_NOWARN); | ||
| 40 | if (!buf && size > PAGE_SIZE) | ||
| 41 | buf = vmalloc(size); | ||
| 42 | return buf; | ||
| 43 | } | ||
| 44 | |||
| 33 | /** | 45 | /** |
| 34 | * seq_open - initialize sequential file | 46 | * seq_open - initialize sequential file |
| 35 | * @file: file we initialize | 47 | * @file: file we initialize |
| @@ -96,7 +108,7 @@ static int traverse(struct seq_file *m, loff_t offset) | |||
| 96 | return 0; | 108 | return 0; |
| 97 | } | 109 | } |
| 98 | if (!m->buf) { | 110 | if (!m->buf) { |
| 99 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | 111 | m->buf = seq_buf_alloc(m->size = PAGE_SIZE); |
| 100 | if (!m->buf) | 112 | if (!m->buf) |
| 101 | return -ENOMEM; | 113 | return -ENOMEM; |
| 102 | } | 114 | } |
| @@ -135,9 +147,9 @@ static int traverse(struct seq_file *m, loff_t offset) | |||
| 135 | 147 | ||
| 136 | Eoverflow: | 148 | Eoverflow: |
| 137 | m->op->stop(m, p); | 149 | m->op->stop(m, p); |
| 138 | kfree(m->buf); | 150 | kvfree(m->buf); |
| 139 | m->count = 0; | 151 | m->count = 0; |
| 140 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | 152 | m->buf = seq_buf_alloc(m->size <<= 1); |
| 141 | return !m->buf ? -ENOMEM : -EAGAIN; | 153 | return !m->buf ? -ENOMEM : -EAGAIN; |
| 142 | } | 154 | } |
| 143 | 155 | ||
| @@ -192,7 +204,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
| 192 | 204 | ||
| 193 | /* grab buffer if we didn't have one */ | 205 | /* grab buffer if we didn't have one */ |
| 194 | if (!m->buf) { | 206 | if (!m->buf) { |
| 195 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | 207 | m->buf = seq_buf_alloc(m->size = PAGE_SIZE); |
| 196 | if (!m->buf) | 208 | if (!m->buf) |
| 197 | goto Enomem; | 209 | goto Enomem; |
| 198 | } | 210 | } |
| @@ -232,9 +244,9 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
| 232 | if (m->count < m->size) | 244 | if (m->count < m->size) |
| 233 | goto Fill; | 245 | goto Fill; |
| 234 | m->op->stop(m, p); | 246 | m->op->stop(m, p); |
| 235 | kfree(m->buf); | 247 | kvfree(m->buf); |
| 236 | m->count = 0; | 248 | m->count = 0; |
| 237 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | 249 | m->buf = seq_buf_alloc(m->size <<= 1); |
| 238 | if (!m->buf) | 250 | if (!m->buf) |
| 239 | goto Enomem; | 251 | goto Enomem; |
| 240 | m->version = 0; | 252 | m->version = 0; |
| @@ -350,7 +362,7 @@ EXPORT_SYMBOL(seq_lseek); | |||
| 350 | int seq_release(struct inode *inode, struct file *file) | 362 | int seq_release(struct inode *inode, struct file *file) |
| 351 | { | 363 | { |
| 352 | struct seq_file *m = file->private_data; | 364 | struct seq_file *m = file->private_data; |
| 353 | kfree(m->buf); | 365 | kvfree(m->buf); |
| 354 | kfree(m); | 366 | kfree(m); |
| 355 | return 0; | 367 | return 0; |
| 356 | } | 368 | } |
| @@ -605,13 +617,13 @@ EXPORT_SYMBOL(single_open); | |||
| 605 | int single_open_size(struct file *file, int (*show)(struct seq_file *, void *), | 617 | int single_open_size(struct file *file, int (*show)(struct seq_file *, void *), |
| 606 | void *data, size_t size) | 618 | void *data, size_t size) |
| 607 | { | 619 | { |
| 608 | char *buf = kmalloc(size, GFP_KERNEL); | 620 | char *buf = seq_buf_alloc(size); |
| 609 | int ret; | 621 | int ret; |
| 610 | if (!buf) | 622 | if (!buf) |
| 611 | return -ENOMEM; | 623 | return -ENOMEM; |
| 612 | ret = single_open(file, show, data); | 624 | ret = single_open(file, show, data); |
| 613 | if (ret) { | 625 | if (ret) { |
| 614 | kfree(buf); | 626 | kvfree(buf); |
| 615 | return ret; | 627 | return ret; |
| 616 | } | 628 | } |
| 617 | ((struct seq_file *)file->private_data)->buf = buf; | 629 | ((struct seq_file *)file->private_data)->buf = buf; |
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h index 0572035673f3..a70d45647898 100644 --- a/include/drm/i915_pciids.h +++ b/include/drm/i915_pciids.h | |||
| @@ -237,13 +237,21 @@ | |||
| 237 | #define INTEL_BDW_GT3D_IDS(info) \ | 237 | #define INTEL_BDW_GT3D_IDS(info) \ |
| 238 | _INTEL_BDW_D_IDS(3, info) | 238 | _INTEL_BDW_D_IDS(3, info) |
| 239 | 239 | ||
| 240 | #define INTEL_BDW_RSVDM_IDS(info) \ | ||
| 241 | _INTEL_BDW_M_IDS(4, info) | ||
| 242 | |||
| 243 | #define INTEL_BDW_RSVDD_IDS(info) \ | ||
| 244 | _INTEL_BDW_D_IDS(4, info) | ||
| 245 | |||
| 240 | #define INTEL_BDW_M_IDS(info) \ | 246 | #define INTEL_BDW_M_IDS(info) \ |
| 241 | INTEL_BDW_GT12M_IDS(info), \ | 247 | INTEL_BDW_GT12M_IDS(info), \ |
| 242 | INTEL_BDW_GT3M_IDS(info) | 248 | INTEL_BDW_GT3M_IDS(info), \ |
| 249 | INTEL_BDW_RSVDM_IDS(info) | ||
| 243 | 250 | ||
| 244 | #define INTEL_BDW_D_IDS(info) \ | 251 | #define INTEL_BDW_D_IDS(info) \ |
| 245 | INTEL_BDW_GT12D_IDS(info), \ | 252 | INTEL_BDW_GT12D_IDS(info), \ |
| 246 | INTEL_BDW_GT3D_IDS(info) | 253 | INTEL_BDW_GT3D_IDS(info), \ |
| 254 | INTEL_BDW_RSVDD_IDS(info) | ||
| 247 | 255 | ||
| 248 | #define INTEL_CHV_IDS(info) \ | 256 | #define INTEL_CHV_IDS(info) \ |
| 249 | INTEL_VGA_DEVICE(0x22b0, info), \ | 257 | INTEL_VGA_DEVICE(0x22b0, info), \ |
diff --git a/include/drm/i915_powerwell.h b/include/drm/i915_powerwell.h index 2baba9996094..baa6f11b1837 100644 --- a/include/drm/i915_powerwell.h +++ b/include/drm/i915_powerwell.h | |||
| @@ -32,5 +32,6 @@ | |||
| 32 | /* For use by hda_i915 driver */ | 32 | /* For use by hda_i915 driver */ |
| 33 | extern int i915_request_power_well(void); | 33 | extern int i915_request_power_well(void); |
| 34 | extern int i915_release_power_well(void); | 34 | extern int i915_release_power_well(void); |
| 35 | extern int i915_get_cdclk_freq(void); | ||
| 35 | 36 | ||
| 36 | #endif /* _I915_POWERWELL_H_ */ | 37 | #endif /* _I915_POWERWELL_H_ */ |
diff --git a/include/dt-bindings/clock/imx6sl-clock.h b/include/dt-bindings/clock/imx6sl-clock.h index 7cf5c9969336..b91dd462ba85 100644 --- a/include/dt-bindings/clock/imx6sl-clock.h +++ b/include/dt-bindings/clock/imx6sl-clock.h | |||
| @@ -145,6 +145,7 @@ | |||
| 145 | #define IMX6SL_CLK_USDHC4 132 | 145 | #define IMX6SL_CLK_USDHC4 132 |
| 146 | #define IMX6SL_CLK_PLL4_AUDIO_DIV 133 | 146 | #define IMX6SL_CLK_PLL4_AUDIO_DIV 133 |
| 147 | #define IMX6SL_CLK_SPBA 134 | 147 | #define IMX6SL_CLK_SPBA 134 |
| 148 | #define IMX6SL_CLK_END 135 | 148 | #define IMX6SL_CLK_ENET 135 |
| 149 | #define IMX6SL_CLK_END 136 | ||
| 149 | 150 | ||
| 150 | #endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */ | 151 | #endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */ |
diff --git a/include/dt-bindings/clock/stih415-clks.h b/include/dt-bindings/clock/stih415-clks.h index 0d2c7397e028..d80caa68aebd 100644 --- a/include/dt-bindings/clock/stih415-clks.h +++ b/include/dt-bindings/clock/stih415-clks.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #define CLK_ETH1_PHY 4 | 10 | #define CLK_ETH1_PHY 4 |
| 11 | 11 | ||
| 12 | /* CLOCKGEN A1 */ | 12 | /* CLOCKGEN A1 */ |
| 13 | #define CLK_ICN_IF_2 0 | ||
| 13 | #define CLK_GMAC0_PHY 3 | 14 | #define CLK_GMAC0_PHY 3 |
| 14 | 15 | ||
| 15 | #endif | 16 | #endif |
diff --git a/include/dt-bindings/clock/stih416-clks.h b/include/dt-bindings/clock/stih416-clks.h index 552c779eb6af..f9bdbd13568d 100644 --- a/include/dt-bindings/clock/stih416-clks.h +++ b/include/dt-bindings/clock/stih416-clks.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #define CLK_ETH1_PHY 4 | 10 | #define CLK_ETH1_PHY 4 |
| 11 | 11 | ||
| 12 | /* CLOCKGEN A1 */ | 12 | /* CLOCKGEN A1 */ |
| 13 | #define CLK_ICN_IF_2 0 | ||
| 13 | #define CLK_GMAC0_PHY 3 | 14 | #define CLK_GMAC0_PHY 3 |
| 14 | 15 | ||
| 15 | #endif | 16 | #endif |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 5a645769f020..d2633ee099d9 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -186,6 +186,15 @@ static inline void *bio_data(struct bio *bio) | |||
| 186 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ | 186 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ |
| 187 | __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q))) | 187 | __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q))) |
| 188 | 188 | ||
| 189 | /* | ||
| 190 | * Check if adding a bio_vec after bprv with offset would create a gap in | ||
| 191 | * the SG list. Most drivers don't care about this, but some do. | ||
| 192 | */ | ||
| 193 | static inline bool bvec_gap_to_prev(struct bio_vec *bprv, unsigned int offset) | ||
| 194 | { | ||
| 195 | return offset || ((bprv->bv_offset + bprv->bv_len) & (PAGE_SIZE - 1)); | ||
| 196 | } | ||
| 197 | |||
| 189 | #define bio_io_error(bio) bio_endio((bio), -EIO) | 198 | #define bio_io_error(bio) bio_endio((bio), -EIO) |
| 190 | 199 | ||
| 191 | /* | 200 | /* |
| @@ -644,10 +653,6 @@ struct biovec_slab { | |||
| 644 | 653 | ||
| 645 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | 654 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
| 646 | 655 | ||
| 647 | |||
| 648 | |||
| 649 | #define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) | ||
| 650 | |||
| 651 | #define bip_for_each_vec(bvl, bip, iter) \ | 656 | #define bip_for_each_vec(bvl, bip, iter) \ |
| 652 | for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter) | 657 | for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter) |
| 653 | 658 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 713f8b62b435..8699bcf5f099 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -512,6 +512,7 @@ struct request_queue { | |||
| 512 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ | 512 | #define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ |
| 513 | #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ | 513 | #define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ |
| 514 | #define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ | 514 | #define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/ |
| 515 | #define QUEUE_FLAG_SG_GAPS 22 /* queue doesn't support SG gaps */ | ||
| 515 | 516 | ||
| 516 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 517 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
| 517 | (1 << QUEUE_FLAG_STACKABLE) | \ | 518 | (1 << QUEUE_FLAG_STACKABLE) | \ |
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index e2a6bd7fb133..45a91474487d 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h | |||
| @@ -143,7 +143,7 @@ extern void elv_drain_elevator(struct request_queue *); | |||
| 143 | * io scheduler registration | 143 | * io scheduler registration |
| 144 | */ | 144 | */ |
| 145 | extern void __init load_default_elevator_module(void); | 145 | extern void __init load_default_elevator_module(void); |
| 146 | extern int __init elv_register(struct elevator_type *); | 146 | extern int elv_register(struct elevator_type *); |
| 147 | extern void elv_unregister(struct elevator_type *); | 147 | extern void elv_unregister(struct elevator_type *); |
| 148 | 148 | ||
| 149 | /* | 149 | /* |
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 17aa1cce6f8e..145375ea0bd9 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
| @@ -91,6 +91,7 @@ struct kernfs_elem_attr { | |||
| 91 | const struct kernfs_ops *ops; | 91 | const struct kernfs_ops *ops; |
| 92 | struct kernfs_open_node *open; | 92 | struct kernfs_open_node *open; |
| 93 | loff_t size; | 93 | loff_t size; |
| 94 | struct kernfs_node *notify_next; /* for kernfs_notify() */ | ||
| 94 | }; | 95 | }; |
| 95 | 96 | ||
| 96 | /* | 97 | /* |
diff --git a/include/linux/phy.h b/include/linux/phy.h index 864ddafad8cc..68041446c450 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -536,6 +536,15 @@ struct phy_driver { | |||
| 536 | /* See set_wol, but for checking whether Wake on LAN is enabled. */ | 536 | /* See set_wol, but for checking whether Wake on LAN is enabled. */ |
| 537 | void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); | 537 | void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); |
| 538 | 538 | ||
| 539 | /* | ||
| 540 | * Called to inform a PHY device driver when the core is about to | ||
| 541 | * change the link state. This callback is supposed to be used as | ||
| 542 | * fixup hook for drivers that need to take action when the link | ||
| 543 | * state changes. Drivers are by no means allowed to mess with the | ||
| 544 | * PHY device structure in their implementations. | ||
| 545 | */ | ||
| 546 | void (*link_change_notify)(struct phy_device *dev); | ||
| 547 | |||
| 539 | struct device_driver driver; | 548 | struct device_driver driver; |
| 540 | }; | 549 | }; |
| 541 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) | 550 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 077904c8b70d..cc79eff4a1ad 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -334,6 +334,9 @@ static inline void user_single_step_siginfo(struct task_struct *tsk, | |||
| 334 | * calling arch_ptrace_stop() when it would be superfluous. For example, | 334 | * calling arch_ptrace_stop() when it would be superfluous. For example, |
| 335 | * if the thread has not been back to user mode since the last stop, the | 335 | * if the thread has not been back to user mode since the last stop, the |
| 336 | * thread state might indicate that nothing needs to be done. | 336 | * thread state might indicate that nothing needs to be done. |
| 337 | * | ||
| 338 | * This is guaranteed to be invoked once before a task stops for ptrace and | ||
| 339 | * may include arch-specific operations necessary prior to a ptrace stop. | ||
| 337 | */ | 340 | */ |
| 338 | #define arch_ptrace_stop_needed(code, info) (0) | 341 | #define arch_ptrace_stop_needed(code, info) (0) |
| 339 | #endif | 342 | #endif |
diff --git a/include/linux/socket.h b/include/linux/socket.h index 8e98297f1388..ec538fc287a6 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
| @@ -305,8 +305,6 @@ struct ucred { | |||
| 305 | /* IPX options */ | 305 | /* IPX options */ |
| 306 | #define IPX_TYPE 1 | 306 | #define IPX_TYPE 1 |
| 307 | 307 | ||
| 308 | extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | ||
| 309 | int offset, int len); | ||
| 310 | extern int csum_partial_copy_fromiovecend(unsigned char *kdata, | 308 | extern int csum_partial_copy_fromiovecend(unsigned char *kdata, |
| 311 | struct iovec *iov, | 309 | struct iovec *iov, |
| 312 | int offset, | 310 | int offset, |
| @@ -315,8 +313,6 @@ extern unsigned long iov_pages(const struct iovec *iov, int offset, | |||
| 315 | unsigned long nr_segs); | 313 | unsigned long nr_segs); |
| 316 | 314 | ||
| 317 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); | 315 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); |
| 318 | extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, | ||
| 319 | int offset, int len); | ||
| 320 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); | 316 | extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); |
| 321 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); | 317 | extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); |
| 322 | 318 | ||
diff --git a/include/linux/uio.h b/include/linux/uio.h index e2231e47cec1..09a7cffc224e 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
| @@ -94,8 +94,20 @@ static inline size_t iov_iter_count(struct iov_iter *i) | |||
| 94 | return i->count; | 94 | return i->count; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static inline void iov_iter_truncate(struct iov_iter *i, size_t count) | 97 | /* |
| 98 | * Cap the iov_iter by given limit; note that the second argument is | ||
| 99 | * *not* the new size - it's upper limit for such. Passing it a value | ||
| 100 | * greater than the amount of data in iov_iter is fine - it'll just do | ||
| 101 | * nothing in that case. | ||
| 102 | */ | ||
| 103 | static inline void iov_iter_truncate(struct iov_iter *i, u64 count) | ||
| 98 | { | 104 | { |
| 105 | /* | ||
| 106 | * count doesn't have to fit in size_t - comparison extends both | ||
| 107 | * operands to u64 here and any value that would be truncated by | ||
| 108 | * conversion in assignement is by definition greater than all | ||
| 109 | * values of size_t, including old i->count. | ||
| 110 | */ | ||
| 99 | if (i->count > count) | 111 | if (i->count > count) |
| 100 | i->count = count; | 112 | i->count = count; |
| 101 | } | 113 | } |
| @@ -111,6 +123,9 @@ static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) | |||
| 111 | 123 | ||
| 112 | int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); | 124 | int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); |
| 113 | int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); | 125 | int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); |
| 114 | 126 | int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | |
| 127 | int offset, int len); | ||
| 128 | int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, | ||
| 129 | int offset, int len); | ||
| 115 | 130 | ||
| 116 | #endif | 131 | #endif |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index 1a64b26046ed..9b7de1b46437 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
| @@ -70,7 +70,9 @@ | |||
| 70 | US_FLAG(NEEDS_CAP16, 0x00400000) \ | 70 | US_FLAG(NEEDS_CAP16, 0x00400000) \ |
| 71 | /* cannot handle READ_CAPACITY_10 */ \ | 71 | /* cannot handle READ_CAPACITY_10 */ \ |
| 72 | US_FLAG(IGNORE_UAS, 0x00800000) \ | 72 | US_FLAG(IGNORE_UAS, 0x00800000) \ |
| 73 | /* Device advertises UAS but it is broken */ | 73 | /* Device advertises UAS but it is broken */ \ |
| 74 | US_FLAG(BROKEN_FUA, 0x01000000) \ | ||
| 75 | /* Cannot handle FUA in WRITE or READ CDBs */ \ | ||
| 74 | 76 | ||
| 75 | #define US_FLAG(name, value) US_FL_##name = value , | 77 | #define US_FLAG(name, value) US_FL_##name = value , |
| 76 | enum { US_DO_ALL_FLAGS }; | 78 | enum { US_DO_ALL_FLAGS }; |
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 7ee6ce6564ae..713b0b88bd5a 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
| @@ -503,9 +503,9 @@ enum nft_chain_flags { | |||
| 503 | * @net: net namespace that this chain belongs to | 503 | * @net: net namespace that this chain belongs to |
| 504 | * @table: table that this chain belongs to | 504 | * @table: table that this chain belongs to |
| 505 | * @handle: chain handle | 505 | * @handle: chain handle |
| 506 | * @flags: bitmask of enum nft_chain_flags | ||
| 507 | * @use: number of jump references to this chain | 506 | * @use: number of jump references to this chain |
| 508 | * @level: length of longest path to this chain | 507 | * @level: length of longest path to this chain |
| 508 | * @flags: bitmask of enum nft_chain_flags | ||
| 509 | * @name: name of the chain | 509 | * @name: name of the chain |
| 510 | */ | 510 | */ |
| 511 | struct nft_chain { | 511 | struct nft_chain { |
| @@ -514,9 +514,9 @@ struct nft_chain { | |||
| 514 | struct net *net; | 514 | struct net *net; |
| 515 | struct nft_table *table; | 515 | struct nft_table *table; |
| 516 | u64 handle; | 516 | u64 handle; |
| 517 | u8 flags; | 517 | u32 use; |
| 518 | u16 use; | ||
| 519 | u16 level; | 518 | u16 level; |
| 519 | u8 flags; | ||
| 520 | char name[NFT_CHAIN_MAXNAMELEN]; | 520 | char name[NFT_CHAIN_MAXNAMELEN]; |
| 521 | }; | 521 | }; |
| 522 | 522 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index 07b7fcd60d80..173cae485de1 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -1730,8 +1730,8 @@ sk_dst_get(struct sock *sk) | |||
| 1730 | 1730 | ||
| 1731 | rcu_read_lock(); | 1731 | rcu_read_lock(); |
| 1732 | dst = rcu_dereference(sk->sk_dst_cache); | 1732 | dst = rcu_dereference(sk->sk_dst_cache); |
| 1733 | if (dst) | 1733 | if (dst && !atomic_inc_not_zero(&dst->__refcnt)) |
| 1734 | dst_hold(dst); | 1734 | dst = NULL; |
| 1735 | rcu_read_unlock(); | 1735 | rcu_read_unlock(); |
| 1736 | return dst; | 1736 | return dst; |
| 1737 | } | 1737 | } |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 5853c913d2b0..27ab31017f09 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
| @@ -173,6 +173,7 @@ struct scsi_device { | |||
| 173 | unsigned is_visible:1; /* is the device visible in sysfs */ | 173 | unsigned is_visible:1; /* is the device visible in sysfs */ |
| 174 | unsigned wce_default_on:1; /* Cache is ON by default */ | 174 | unsigned wce_default_on:1; /* Cache is ON by default */ |
| 175 | unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ | 175 | unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ |
| 176 | unsigned broken_fua:1; /* Don't set FUA bit */ | ||
| 176 | 177 | ||
| 177 | atomic_t disk_events_disable_depth; /* disable depth for disk events */ | 178 | atomic_t disk_events_disable_depth; /* disable depth for disk events */ |
| 178 | 179 | ||
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 0fd06fef9fac..26b4f2e13275 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
| @@ -44,6 +44,12 @@ | |||
| 44 | #undef __field_ext | 44 | #undef __field_ext |
| 45 | #define __field_ext(type, item, filter_type) type item; | 45 | #define __field_ext(type, item, filter_type) type item; |
| 46 | 46 | ||
| 47 | #undef __field_struct | ||
| 48 | #define __field_struct(type, item) type item; | ||
| 49 | |||
| 50 | #undef __field_struct_ext | ||
| 51 | #define __field_struct_ext(type, item, filter_type) type item; | ||
| 52 | |||
| 47 | #undef __array | 53 | #undef __array |
| 48 | #define __array(type, item, len) type item[len]; | 54 | #define __array(type, item, len) type item[len]; |
| 49 | 55 | ||
| @@ -122,6 +128,12 @@ | |||
| 122 | #undef __field_ext | 128 | #undef __field_ext |
| 123 | #define __field_ext(type, item, filter_type) | 129 | #define __field_ext(type, item, filter_type) |
| 124 | 130 | ||
| 131 | #undef __field_struct | ||
| 132 | #define __field_struct(type, item) | ||
| 133 | |||
| 134 | #undef __field_struct_ext | ||
| 135 | #define __field_struct_ext(type, item, filter_type) | ||
| 136 | |||
| 125 | #undef __array | 137 | #undef __array |
| 126 | #define __array(type, item, len) | 138 | #define __array(type, item, len) |
| 127 | 139 | ||
| @@ -315,9 +327,21 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \ | |||
| 315 | if (ret) \ | 327 | if (ret) \ |
| 316 | return ret; | 328 | return ret; |
| 317 | 329 | ||
| 330 | #undef __field_struct_ext | ||
| 331 | #define __field_struct_ext(type, item, filter_type) \ | ||
| 332 | ret = trace_define_field(event_call, #type, #item, \ | ||
| 333 | offsetof(typeof(field), item), \ | ||
| 334 | sizeof(field.item), \ | ||
| 335 | 0, filter_type); \ | ||
| 336 | if (ret) \ | ||
| 337 | return ret; | ||
| 338 | |||
| 318 | #undef __field | 339 | #undef __field |
| 319 | #define __field(type, item) __field_ext(type, item, FILTER_OTHER) | 340 | #define __field(type, item) __field_ext(type, item, FILTER_OTHER) |
| 320 | 341 | ||
| 342 | #undef __field_struct | ||
| 343 | #define __field_struct(type, item) __field_struct_ext(type, item, FILTER_OTHER) | ||
| 344 | |||
| 321 | #undef __array | 345 | #undef __array |
| 322 | #define __array(type, item, len) \ | 346 | #define __array(type, item, len) \ |
| 323 | do { \ | 347 | do { \ |
| @@ -379,6 +403,12 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ | |||
| 379 | #undef __field_ext | 403 | #undef __field_ext |
| 380 | #define __field_ext(type, item, filter_type) | 404 | #define __field_ext(type, item, filter_type) |
| 381 | 405 | ||
| 406 | #undef __field_struct | ||
| 407 | #define __field_struct(type, item) | ||
| 408 | |||
| 409 | #undef __field_struct_ext | ||
| 410 | #define __field_struct_ext(type, item, filter_type) | ||
| 411 | |||
| 382 | #undef __array | 412 | #undef __array |
| 383 | #define __array(type, item, len) | 413 | #define __array(type, item, len) |
| 384 | 414 | ||
| @@ -550,6 +580,9 @@ static inline notrace int ftrace_get_offsets_##call( \ | |||
| 550 | #undef __field | 580 | #undef __field |
| 551 | #define __field(type, item) | 581 | #define __field(type, item) |
| 552 | 582 | ||
| 583 | #undef __field_struct | ||
| 584 | #define __field_struct(type, item) | ||
| 585 | |||
| 553 | #undef __array | 586 | #undef __array |
| 554 | #define __array(type, item, len) | 587 | #define __array(type, item, len) |
| 555 | 588 | ||
diff --git a/include/trace/syscall.h b/include/trace/syscall.h index fed853f3d7aa..9674145e2f6a 100644 --- a/include/trace/syscall.h +++ b/include/trace/syscall.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/tracepoint.h> | 4 | #include <linux/tracepoint.h> |
| 5 | #include <linux/unistd.h> | 5 | #include <linux/unistd.h> |
| 6 | #include <linux/ftrace_event.h> | 6 | #include <linux/ftrace_event.h> |
| 7 | #include <linux/thread_info.h> | ||
| 7 | 8 | ||
| 8 | #include <asm/ptrace.h> | 9 | #include <asm/ptrace.h> |
| 9 | 10 | ||
| @@ -32,4 +33,18 @@ struct syscall_metadata { | |||
| 32 | struct ftrace_event_call *exit_event; | 33 | struct ftrace_event_call *exit_event; |
| 33 | }; | 34 | }; |
| 34 | 35 | ||
| 36 | #if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) | ||
| 37 | static inline void syscall_tracepoint_update(struct task_struct *p) | ||
| 38 | { | ||
| 39 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | ||
| 40 | set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT); | ||
| 41 | else | ||
| 42 | clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT); | ||
| 43 | } | ||
| 44 | #else | ||
| 45 | static inline void syscall_tracepoint_update(struct task_struct *p) | ||
| 46 | { | ||
| 47 | } | ||
| 48 | #endif | ||
| 49 | |||
| 35 | #endif /* _TRACE_SYSCALL_H */ | 50 | #endif /* _TRACE_SYSCALL_H */ |
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h index 6f9c38ce45c7..2f47824e7a36 100644 --- a/include/uapi/linux/btrfs.h +++ b/include/uapi/linux/btrfs.h | |||
| @@ -38,6 +38,7 @@ struct btrfs_ioctl_vol_args { | |||
| 38 | #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) | 38 | #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) |
| 39 | #define BTRFS_FSID_SIZE 16 | 39 | #define BTRFS_FSID_SIZE 16 |
| 40 | #define BTRFS_UUID_SIZE 16 | 40 | #define BTRFS_UUID_SIZE 16 |
| 41 | #define BTRFS_UUID_UNPARSED_SIZE 37 | ||
| 41 | 42 | ||
| 42 | #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) | 43 | #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) |
| 43 | 44 | ||
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h index 2a4b4a72a4f9..24b68c59dcf8 100644 --- a/include/uapi/linux/usb/functionfs.h +++ b/include/uapi/linux/usb/functionfs.h | |||
| @@ -33,6 +33,13 @@ struct usb_endpoint_descriptor_no_audio { | |||
| 33 | __u8 bInterval; | 33 | __u8 bInterval; |
| 34 | } __attribute__((packed)); | 34 | } __attribute__((packed)); |
| 35 | 35 | ||
| 36 | /* Legacy format, deprecated as of 3.14. */ | ||
| 37 | struct usb_functionfs_descs_head { | ||
| 38 | __le32 magic; | ||
| 39 | __le32 length; | ||
| 40 | __le32 fs_count; | ||
| 41 | __le32 hs_count; | ||
| 42 | } __attribute__((packed, deprecated)); | ||
| 36 | 43 | ||
| 37 | /* | 44 | /* |
| 38 | * Descriptors format: | 45 | * Descriptors format: |
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h index 21eed488783f..1964026b5e09 100644 --- a/include/uapi/sound/compress_offload.h +++ b/include/uapi/sound/compress_offload.h | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | struct snd_compressed_buffer { | 39 | struct snd_compressed_buffer { |
| 40 | __u32 fragment_size; | 40 | __u32 fragment_size; |
| 41 | __u32 fragments; | 41 | __u32 fragments; |
| 42 | }; | 42 | } __attribute__((packed, aligned(4))); |
| 43 | 43 | ||
| 44 | /** | 44 | /** |
| 45 | * struct snd_compr_params: compressed stream params | 45 | * struct snd_compr_params: compressed stream params |
| @@ -51,7 +51,7 @@ struct snd_compr_params { | |||
| 51 | struct snd_compressed_buffer buffer; | 51 | struct snd_compressed_buffer buffer; |
| 52 | struct snd_codec codec; | 52 | struct snd_codec codec; |
| 53 | __u8 no_wake_mode; | 53 | __u8 no_wake_mode; |
| 54 | }; | 54 | } __attribute__((packed, aligned(4))); |
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| 57 | * struct snd_compr_tstamp: timestamp descriptor | 57 | * struct snd_compr_tstamp: timestamp descriptor |
| @@ -70,7 +70,7 @@ struct snd_compr_tstamp { | |||
| 70 | __u32 pcm_frames; | 70 | __u32 pcm_frames; |
| 71 | __u32 pcm_io_frames; | 71 | __u32 pcm_io_frames; |
| 72 | __u32 sampling_rate; | 72 | __u32 sampling_rate; |
| 73 | }; | 73 | } __attribute__((packed, aligned(4))); |
| 74 | 74 | ||
| 75 | /** | 75 | /** |
| 76 | * struct snd_compr_avail: avail descriptor | 76 | * struct snd_compr_avail: avail descriptor |
| @@ -80,7 +80,7 @@ struct snd_compr_tstamp { | |||
| 80 | struct snd_compr_avail { | 80 | struct snd_compr_avail { |
| 81 | __u64 avail; | 81 | __u64 avail; |
| 82 | struct snd_compr_tstamp tstamp; | 82 | struct snd_compr_tstamp tstamp; |
| 83 | } __attribute__((packed)); | 83 | } __attribute__((packed, aligned(4))); |
| 84 | 84 | ||
| 85 | enum snd_compr_direction { | 85 | enum snd_compr_direction { |
| 86 | SND_COMPRESS_PLAYBACK = 0, | 86 | SND_COMPRESS_PLAYBACK = 0, |
| @@ -107,7 +107,7 @@ struct snd_compr_caps { | |||
| 107 | __u32 max_fragments; | 107 | __u32 max_fragments; |
| 108 | __u32 codecs[MAX_NUM_CODECS]; | 108 | __u32 codecs[MAX_NUM_CODECS]; |
| 109 | __u32 reserved[11]; | 109 | __u32 reserved[11]; |
| 110 | }; | 110 | } __attribute__((packed, aligned(4))); |
| 111 | 111 | ||
| 112 | /** | 112 | /** |
| 113 | * struct snd_compr_codec_caps: query capability of codec | 113 | * struct snd_compr_codec_caps: query capability of codec |
| @@ -119,7 +119,7 @@ struct snd_compr_codec_caps { | |||
| 119 | __u32 codec; | 119 | __u32 codec; |
| 120 | __u32 num_descriptors; | 120 | __u32 num_descriptors; |
| 121 | struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; | 121 | struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; |
| 122 | }; | 122 | } __attribute__((packed, aligned(4))); |
| 123 | 123 | ||
| 124 | /** | 124 | /** |
| 125 | * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the | 125 | * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the |
| @@ -140,7 +140,7 @@ enum { | |||
| 140 | struct snd_compr_metadata { | 140 | struct snd_compr_metadata { |
| 141 | __u32 key; | 141 | __u32 key; |
| 142 | __u32 value[8]; | 142 | __u32 value[8]; |
| 143 | }; | 143 | } __attribute__((packed, aligned(4))); |
| 144 | 144 | ||
| 145 | /** | 145 | /** |
| 146 | * compress path ioctl definitions | 146 | * compress path ioctl definitions |
diff --git a/include/uapi/sound/compress_params.h b/include/uapi/sound/compress_params.h index 165e7059de75..d9bd9ca0d5b0 100644 --- a/include/uapi/sound/compress_params.h +++ b/include/uapi/sound/compress_params.h | |||
| @@ -268,7 +268,7 @@ struct snd_enc_vorbis { | |||
| 268 | __u32 max_bit_rate; | 268 | __u32 max_bit_rate; |
| 269 | __u32 min_bit_rate; | 269 | __u32 min_bit_rate; |
| 270 | __u32 downmix; | 270 | __u32 downmix; |
| 271 | }; | 271 | } __attribute__((packed, aligned(4))); |
| 272 | 272 | ||
| 273 | 273 | ||
| 274 | /** | 274 | /** |
| @@ -284,7 +284,7 @@ struct snd_enc_real { | |||
| 284 | __u32 quant_bits; | 284 | __u32 quant_bits; |
| 285 | __u32 start_region; | 285 | __u32 start_region; |
| 286 | __u32 num_regions; | 286 | __u32 num_regions; |
| 287 | }; | 287 | } __attribute__((packed, aligned(4))); |
| 288 | 288 | ||
| 289 | /** | 289 | /** |
| 290 | * struct snd_enc_flac | 290 | * struct snd_enc_flac |
| @@ -308,12 +308,12 @@ struct snd_enc_real { | |||
| 308 | struct snd_enc_flac { | 308 | struct snd_enc_flac { |
| 309 | __u32 num; | 309 | __u32 num; |
| 310 | __u32 gain; | 310 | __u32 gain; |
| 311 | }; | 311 | } __attribute__((packed, aligned(4))); |
| 312 | 312 | ||
| 313 | struct snd_enc_generic { | 313 | struct snd_enc_generic { |
| 314 | __u32 bw; /* encoder bandwidth */ | 314 | __u32 bw; /* encoder bandwidth */ |
| 315 | __s32 reserved[15]; | 315 | __s32 reserved[15]; |
| 316 | }; | 316 | } __attribute__((packed, aligned(4))); |
| 317 | 317 | ||
| 318 | union snd_codec_options { | 318 | union snd_codec_options { |
| 319 | struct snd_enc_wma wma; | 319 | struct snd_enc_wma wma; |
| @@ -321,7 +321,7 @@ union snd_codec_options { | |||
| 321 | struct snd_enc_real real; | 321 | struct snd_enc_real real; |
| 322 | struct snd_enc_flac flac; | 322 | struct snd_enc_flac flac; |
| 323 | struct snd_enc_generic generic; | 323 | struct snd_enc_generic generic; |
| 324 | }; | 324 | } __attribute__((packed, aligned(4))); |
| 325 | 325 | ||
| 326 | /** struct snd_codec_desc - description of codec capabilities | 326 | /** struct snd_codec_desc - description of codec capabilities |
| 327 | * @max_ch: Maximum number of audio channels | 327 | * @max_ch: Maximum number of audio channels |
| @@ -358,7 +358,7 @@ struct snd_codec_desc { | |||
| 358 | __u32 formats; | 358 | __u32 formats; |
| 359 | __u32 min_buffer; | 359 | __u32 min_buffer; |
| 360 | __u32 reserved[15]; | 360 | __u32 reserved[15]; |
| 361 | }; | 361 | } __attribute__((packed, aligned(4))); |
| 362 | 362 | ||
| 363 | /** struct snd_codec | 363 | /** struct snd_codec |
| 364 | * @id: Identifies the supported audio encoder/decoder. | 364 | * @id: Identifies the supported audio encoder/decoder. |
| @@ -399,6 +399,6 @@ struct snd_codec { | |||
| 399 | __u32 align; | 399 | __u32 align; |
| 400 | union snd_codec_options options; | 400 | union snd_codec_options options; |
| 401 | __u32 reserved[3]; | 401 | __u32 reserved[3]; |
| 402 | }; | 402 | } __attribute__((packed, aligned(4))); |
| 403 | 403 | ||
| 404 | #endif | 404 | #endif |
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index c445e392e93f..6f3254e8c137 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
| @@ -846,7 +846,7 @@ static void __uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *u | |||
| 846 | { | 846 | { |
| 847 | int err; | 847 | int err; |
| 848 | 848 | ||
| 849 | if (!consumer_del(uprobe, uc)) /* WARN? */ | 849 | if (WARN_ON(!consumer_del(uprobe, uc))) |
| 850 | return; | 850 | return; |
| 851 | 851 | ||
| 852 | err = register_for_each_vma(uprobe, NULL); | 852 | err = register_for_each_vma(uprobe, NULL); |
| @@ -927,7 +927,7 @@ int uprobe_apply(struct inode *inode, loff_t offset, | |||
| 927 | int ret = -ENOENT; | 927 | int ret = -ENOENT; |
| 928 | 928 | ||
| 929 | uprobe = find_uprobe(inode, offset); | 929 | uprobe = find_uprobe(inode, offset); |
| 930 | if (!uprobe) | 930 | if (WARN_ON(!uprobe)) |
| 931 | return ret; | 931 | return ret; |
| 932 | 932 | ||
| 933 | down_write(&uprobe->register_rwsem); | 933 | down_write(&uprobe->register_rwsem); |
| @@ -952,7 +952,7 @@ void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consume | |||
| 952 | struct uprobe *uprobe; | 952 | struct uprobe *uprobe; |
| 953 | 953 | ||
| 954 | uprobe = find_uprobe(inode, offset); | 954 | uprobe = find_uprobe(inode, offset); |
| 955 | if (!uprobe) | 955 | if (WARN_ON(!uprobe)) |
| 956 | return; | 956 | return; |
| 957 | 957 | ||
| 958 | down_write(&uprobe->register_rwsem); | 958 | down_write(&uprobe->register_rwsem); |
diff --git a/kernel/fork.c b/kernel/fork.c index d2799d1fc952..6a13c46cd87d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -1487,7 +1487,9 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
| 1487 | 1487 | ||
| 1488 | total_forks++; | 1488 | total_forks++; |
| 1489 | spin_unlock(¤t->sighand->siglock); | 1489 | spin_unlock(¤t->sighand->siglock); |
| 1490 | syscall_tracepoint_update(p); | ||
| 1490 | write_unlock_irq(&tasklist_lock); | 1491 | write_unlock_irq(&tasklist_lock); |
| 1492 | |||
| 1491 | proc_fork_connector(p); | 1493 | proc_fork_connector(p); |
| 1492 | cgroup_post_fork(p); | 1494 | cgroup_post_fork(p); |
| 1493 | if (clone_flags & CLONE_THREAD) | 1495 | if (clone_flags & CLONE_THREAD) |
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 7339e42a85ab..1487a123db5c 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c | |||
| @@ -455,9 +455,9 @@ EXPORT_SYMBOL_GPL(irq_alloc_hwirqs); | |||
| 455 | */ | 455 | */ |
| 456 | void irq_free_hwirqs(unsigned int from, int cnt) | 456 | void irq_free_hwirqs(unsigned int from, int cnt) |
| 457 | { | 457 | { |
| 458 | int i; | 458 | int i, j; |
| 459 | 459 | ||
| 460 | for (i = from; cnt > 0; i++, cnt--) { | 460 | for (i = from, j = cnt; j > 0; i++, j--) { |
| 461 | irq_set_status_flags(i, _IRQ_NOREQUEST | _IRQ_NOPROBE); | 461 | irq_set_status_flags(i, _IRQ_NOREQUEST | _IRQ_NOPROBE); |
| 462 | arch_teardown_hwirq(i); | 462 | arch_teardown_hwirq(i); |
| 463 | } | 463 | } |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ea2d5f6962ed..13e839dbca07 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
| @@ -1416,9 +1416,10 @@ static int have_callable_console(void) | |||
| 1416 | /* | 1416 | /* |
| 1417 | * Can we actually use the console at this time on this cpu? | 1417 | * Can we actually use the console at this time on this cpu? |
| 1418 | * | 1418 | * |
| 1419 | * Console drivers may assume that per-cpu resources have been allocated. So | 1419 | * Console drivers may assume that per-cpu resources have |
| 1420 | * unless they're explicitly marked as being able to cope (CON_ANYTIME) don't | 1420 | * been allocated. So unless they're explicitly marked as |
| 1421 | * call them until this CPU is officially up. | 1421 | * being able to cope (CON_ANYTIME) don't call them until |
| 1422 | * this CPU is officially up. | ||
| 1422 | */ | 1423 | */ |
| 1423 | static inline int can_use_console(unsigned int cpu) | 1424 | static inline int can_use_console(unsigned int cpu) |
| 1424 | { | 1425 | { |
| @@ -1431,10 +1432,8 @@ static inline int can_use_console(unsigned int cpu) | |||
| 1431 | * console_lock held, and 'console_locked' set) if it | 1432 | * console_lock held, and 'console_locked' set) if it |
| 1432 | * is successful, false otherwise. | 1433 | * is successful, false otherwise. |
| 1433 | */ | 1434 | */ |
| 1434 | static int console_trylock_for_printk(void) | 1435 | static int console_trylock_for_printk(unsigned int cpu) |
| 1435 | { | 1436 | { |
| 1436 | unsigned int cpu = smp_processor_id(); | ||
| 1437 | |||
| 1438 | if (!console_trylock()) | 1437 | if (!console_trylock()) |
| 1439 | return 0; | 1438 | return 0; |
| 1440 | /* | 1439 | /* |
| @@ -1609,8 +1608,7 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
| 1609 | */ | 1608 | */ |
| 1610 | if (!oops_in_progress && !lockdep_recursing(current)) { | 1609 | if (!oops_in_progress && !lockdep_recursing(current)) { |
| 1611 | recursion_bug = 1; | 1610 | recursion_bug = 1; |
| 1612 | local_irq_restore(flags); | 1611 | goto out_restore_irqs; |
| 1613 | return 0; | ||
| 1614 | } | 1612 | } |
| 1615 | zap_locks(); | 1613 | zap_locks(); |
| 1616 | } | 1614 | } |
| @@ -1718,27 +1716,21 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
| 1718 | 1716 | ||
| 1719 | logbuf_cpu = UINT_MAX; | 1717 | logbuf_cpu = UINT_MAX; |
| 1720 | raw_spin_unlock(&logbuf_lock); | 1718 | raw_spin_unlock(&logbuf_lock); |
| 1721 | lockdep_on(); | ||
| 1722 | local_irq_restore(flags); | ||
| 1723 | 1719 | ||
| 1724 | /* If called from the scheduler, we can not call up(). */ | 1720 | /* If called from the scheduler, we can not call up(). */ |
| 1725 | if (in_sched) | 1721 | if (!in_sched) { |
| 1726 | return printed_len; | 1722 | /* |
| 1727 | 1723 | * Try to acquire and then immediately release the console | |
| 1728 | /* | 1724 | * semaphore. The release will print out buffers and wake up |
| 1729 | * Disable preemption to avoid being preempted while holding | 1725 | * /dev/kmsg and syslog() users. |
| 1730 | * console_sem which would prevent anyone from printing to console | 1726 | */ |
| 1731 | */ | 1727 | if (console_trylock_for_printk(this_cpu)) |
| 1732 | preempt_disable(); | 1728 | console_unlock(); |
| 1733 | /* | 1729 | } |
| 1734 | * Try to acquire and then immediately release the console semaphore. | ||
| 1735 | * The release will print out buffers and wake up /dev/kmsg and syslog() | ||
| 1736 | * users. | ||
| 1737 | */ | ||
| 1738 | if (console_trylock_for_printk()) | ||
| 1739 | console_unlock(); | ||
| 1740 | preempt_enable(); | ||
| 1741 | 1730 | ||
| 1731 | lockdep_on(); | ||
| 1732 | out_restore_irqs: | ||
| 1733 | local_irq_restore(flags); | ||
| 1742 | return printed_len; | 1734 | return printed_len; |
| 1743 | } | 1735 | } |
| 1744 | EXPORT_SYMBOL(vprintk_emit); | 1736 | EXPORT_SYMBOL(vprintk_emit); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 384ede311717..f243444a3772 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -1396,7 +1396,6 @@ void tracing_start(void) | |||
| 1396 | 1396 | ||
| 1397 | arch_spin_unlock(&global_trace.max_lock); | 1397 | arch_spin_unlock(&global_trace.max_lock); |
| 1398 | 1398 | ||
| 1399 | ftrace_start(); | ||
| 1400 | out: | 1399 | out: |
| 1401 | raw_spin_unlock_irqrestore(&global_trace.start_lock, flags); | 1400 | raw_spin_unlock_irqrestore(&global_trace.start_lock, flags); |
| 1402 | } | 1401 | } |
| @@ -1443,7 +1442,6 @@ void tracing_stop(void) | |||
| 1443 | struct ring_buffer *buffer; | 1442 | struct ring_buffer *buffer; |
| 1444 | unsigned long flags; | 1443 | unsigned long flags; |
| 1445 | 1444 | ||
| 1446 | ftrace_stop(); | ||
| 1447 | raw_spin_lock_irqsave(&global_trace.start_lock, flags); | 1445 | raw_spin_lock_irqsave(&global_trace.start_lock, flags); |
| 1448 | if (global_trace.stop_count++) | 1446 | if (global_trace.stop_count++) |
| 1449 | goto out; | 1447 | goto out; |
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 04fdb5de823c..3c9b97e6b1f4 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
| @@ -893,6 +893,9 @@ probe_event_enable(struct trace_uprobe *tu, struct ftrace_event_file *file, | |||
| 893 | int ret; | 893 | int ret; |
| 894 | 894 | ||
| 895 | if (file) { | 895 | if (file) { |
| 896 | if (tu->tp.flags & TP_FLAG_PROFILE) | ||
| 897 | return -EINTR; | ||
| 898 | |||
| 896 | link = kmalloc(sizeof(*link), GFP_KERNEL); | 899 | link = kmalloc(sizeof(*link), GFP_KERNEL); |
| 897 | if (!link) | 900 | if (!link) |
| 898 | return -ENOMEM; | 901 | return -ENOMEM; |
| @@ -901,29 +904,40 @@ probe_event_enable(struct trace_uprobe *tu, struct ftrace_event_file *file, | |||
| 901 | list_add_tail_rcu(&link->list, &tu->tp.files); | 904 | list_add_tail_rcu(&link->list, &tu->tp.files); |
| 902 | 905 | ||
| 903 | tu->tp.flags |= TP_FLAG_TRACE; | 906 | tu->tp.flags |= TP_FLAG_TRACE; |
| 904 | } else | 907 | } else { |
| 905 | tu->tp.flags |= TP_FLAG_PROFILE; | 908 | if (tu->tp.flags & TP_FLAG_TRACE) |
| 909 | return -EINTR; | ||
| 906 | 910 | ||
| 907 | ret = uprobe_buffer_enable(); | 911 | tu->tp.flags |= TP_FLAG_PROFILE; |
| 908 | if (ret < 0) | 912 | } |
| 909 | return ret; | ||
| 910 | 913 | ||
| 911 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); | 914 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); |
| 912 | 915 | ||
| 913 | if (enabled) | 916 | if (enabled) |
| 914 | return 0; | 917 | return 0; |
| 915 | 918 | ||
| 919 | ret = uprobe_buffer_enable(); | ||
| 920 | if (ret) | ||
| 921 | goto err_flags; | ||
| 922 | |||
| 916 | tu->consumer.filter = filter; | 923 | tu->consumer.filter = filter; |
| 917 | ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); | 924 | ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); |
| 918 | if (ret) { | 925 | if (ret) |
| 919 | if (file) { | 926 | goto err_buffer; |
| 920 | list_del(&link->list); | ||
| 921 | kfree(link); | ||
| 922 | tu->tp.flags &= ~TP_FLAG_TRACE; | ||
| 923 | } else | ||
| 924 | tu->tp.flags &= ~TP_FLAG_PROFILE; | ||
| 925 | } | ||
| 926 | 927 | ||
| 928 | return 0; | ||
| 929 | |||
| 930 | err_buffer: | ||
| 931 | uprobe_buffer_disable(); | ||
| 932 | |||
| 933 | err_flags: | ||
| 934 | if (file) { | ||
| 935 | list_del(&link->list); | ||
| 936 | kfree(link); | ||
| 937 | tu->tp.flags &= ~TP_FLAG_TRACE; | ||
| 938 | } else { | ||
| 939 | tu->tp.flags &= ~TP_FLAG_PROFILE; | ||
| 940 | } | ||
| 927 | return ret; | 941 | return ret; |
| 928 | } | 942 | } |
| 929 | 943 | ||
| @@ -1201,12 +1215,6 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) | |||
| 1201 | 1215 | ||
| 1202 | current->utask->vaddr = (unsigned long) &udd; | 1216 | current->utask->vaddr = (unsigned long) &udd; |
| 1203 | 1217 | ||
| 1204 | #ifdef CONFIG_PERF_EVENTS | ||
| 1205 | if ((tu->tp.flags & TP_FLAG_TRACE) == 0 && | ||
| 1206 | !uprobe_perf_filter(&tu->consumer, 0, current->mm)) | ||
| 1207 | return UPROBE_HANDLER_REMOVE; | ||
| 1208 | #endif | ||
| 1209 | |||
| 1210 | if (WARN_ON_ONCE(!uprobe_cpu_buffer)) | 1218 | if (WARN_ON_ONCE(!uprobe_cpu_buffer)) |
| 1211 | return 0; | 1219 | return 0; |
| 1212 | 1220 | ||
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 33cbd8c203f8..3490407dc7b7 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c | |||
| @@ -492,33 +492,29 @@ static int sys_tracepoint_refcount; | |||
| 492 | 492 | ||
| 493 | void syscall_regfunc(void) | 493 | void syscall_regfunc(void) |
| 494 | { | 494 | { |
| 495 | unsigned long flags; | 495 | struct task_struct *p, *t; |
| 496 | struct task_struct *g, *t; | ||
| 497 | 496 | ||
| 498 | if (!sys_tracepoint_refcount) { | 497 | if (!sys_tracepoint_refcount) { |
| 499 | read_lock_irqsave(&tasklist_lock, flags); | 498 | read_lock(&tasklist_lock); |
| 500 | do_each_thread(g, t) { | 499 | for_each_process_thread(p, t) { |
| 501 | /* Skip kernel threads. */ | 500 | set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); |
| 502 | if (t->mm) | 501 | } |
| 503 | set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); | 502 | read_unlock(&tasklist_lock); |
| 504 | } while_each_thread(g, t); | ||
| 505 | read_unlock_irqrestore(&tasklist_lock, flags); | ||
| 506 | } | 503 | } |
| 507 | sys_tracepoint_refcount++; | 504 | sys_tracepoint_refcount++; |
| 508 | } | 505 | } |
| 509 | 506 | ||
| 510 | void syscall_unregfunc(void) | 507 | void syscall_unregfunc(void) |
| 511 | { | 508 | { |
| 512 | unsigned long flags; | 509 | struct task_struct *p, *t; |
| 513 | struct task_struct *g, *t; | ||
| 514 | 510 | ||
| 515 | sys_tracepoint_refcount--; | 511 | sys_tracepoint_refcount--; |
| 516 | if (!sys_tracepoint_refcount) { | 512 | if (!sys_tracepoint_refcount) { |
| 517 | read_lock_irqsave(&tasklist_lock, flags); | 513 | read_lock(&tasklist_lock); |
| 518 | do_each_thread(g, t) { | 514 | for_each_process_thread(p, t) { |
| 519 | clear_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); | 515 | clear_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); |
| 520 | } while_each_thread(g, t); | 516 | } |
| 521 | read_unlock_irqrestore(&tasklist_lock, flags); | 517 | read_unlock(&tasklist_lock); |
| 522 | } | 518 | } |
| 523 | } | 519 | } |
| 524 | #endif | 520 | #endif |
diff --git a/lib/iovec.c b/lib/iovec.c index 454baa88bf27..7a7c2da4cddf 100644 --- a/lib/iovec.c +++ b/lib/iovec.c | |||
| @@ -51,3 +51,58 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) | |||
| 51 | return 0; | 51 | return 0; |
| 52 | } | 52 | } |
| 53 | EXPORT_SYMBOL(memcpy_toiovec); | 53 | EXPORT_SYMBOL(memcpy_toiovec); |
| 54 | |||
| 55 | /* | ||
| 56 | * Copy kernel to iovec. Returns -EFAULT on error. | ||
| 57 | */ | ||
| 58 | |||
| 59 | int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, | ||
| 60 | int offset, int len) | ||
| 61 | { | ||
| 62 | int copy; | ||
| 63 | for (; len > 0; ++iov) { | ||
| 64 | /* Skip over the finished iovecs */ | ||
| 65 | if (unlikely(offset >= iov->iov_len)) { | ||
| 66 | offset -= iov->iov_len; | ||
| 67 | continue; | ||
| 68 | } | ||
| 69 | copy = min_t(unsigned int, iov->iov_len - offset, len); | ||
| 70 | if (copy_to_user(iov->iov_base + offset, kdata, copy)) | ||
| 71 | return -EFAULT; | ||
| 72 | offset = 0; | ||
| 73 | kdata += copy; | ||
| 74 | len -= copy; | ||
| 75 | } | ||
| 76 | |||
| 77 | return 0; | ||
| 78 | } | ||
| 79 | EXPORT_SYMBOL(memcpy_toiovecend); | ||
| 80 | |||
| 81 | /* | ||
| 82 | * Copy iovec to kernel. Returns -EFAULT on error. | ||
| 83 | */ | ||
| 84 | |||
| 85 | int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | ||
| 86 | int offset, int len) | ||
| 87 | { | ||
| 88 | /* Skip over the finished iovecs */ | ||
| 89 | while (offset >= iov->iov_len) { | ||
| 90 | offset -= iov->iov_len; | ||
| 91 | iov++; | ||
| 92 | } | ||
| 93 | |||
| 94 | while (len > 0) { | ||
| 95 | u8 __user *base = iov->iov_base + offset; | ||
| 96 | int copy = min_t(unsigned int, len, iov->iov_len - offset); | ||
| 97 | |||
| 98 | offset = 0; | ||
| 99 | if (copy_from_user(kdata, base, copy)) | ||
| 100 | return -EFAULT; | ||
| 101 | len -= copy; | ||
| 102 | kdata += copy; | ||
| 103 | iov++; | ||
| 104 | } | ||
| 105 | |||
| 106 | return 0; | ||
| 107 | } | ||
| 108 | EXPORT_SYMBOL(memcpy_fromiovecend); | ||
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index 99a03acb7d47..7a85967060a5 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c | |||
| @@ -108,6 +108,8 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
| 108 | if (length == ML_MASK) { | 108 | if (length == ML_MASK) { |
| 109 | for (; *ip == 255; length += 255) | 109 | for (; *ip == 255; length += 255) |
| 110 | ip++; | 110 | ip++; |
| 111 | if (unlikely(length > (size_t)(length + *ip))) | ||
| 112 | goto _output_error; | ||
| 111 | length += *ip++; | 113 | length += *ip++; |
| 112 | } | 114 | } |
| 113 | 115 | ||
| @@ -157,7 +159,7 @@ static int lz4_uncompress(const char *source, char *dest, int osize) | |||
| 157 | 159 | ||
| 158 | /* write overflow error detected */ | 160 | /* write overflow error detected */ |
| 159 | _output_error: | 161 | _output_error: |
| 160 | return (int) (-(((char *)ip) - source)); | 162 | return -1; |
| 161 | } | 163 | } |
| 162 | 164 | ||
| 163 | static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | 165 | static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, |
| @@ -190,6 +192,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
| 190 | int s = 255; | 192 | int s = 255; |
| 191 | while ((ip < iend) && (s == 255)) { | 193 | while ((ip < iend) && (s == 255)) { |
| 192 | s = *ip++; | 194 | s = *ip++; |
| 195 | if (unlikely(length > (size_t)(length + s))) | ||
| 196 | goto _output_error; | ||
| 193 | length += s; | 197 | length += s; |
| 194 | } | 198 | } |
| 195 | } | 199 | } |
| @@ -230,6 +234,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
| 230 | if (length == ML_MASK) { | 234 | if (length == ML_MASK) { |
| 231 | while (ip < iend) { | 235 | while (ip < iend) { |
| 232 | int s = *ip++; | 236 | int s = *ip++; |
| 237 | if (unlikely(length > (size_t)(length + s))) | ||
| 238 | goto _output_error; | ||
| 233 | length += s; | 239 | length += s; |
| 234 | if (s == 255) | 240 | if (s == 255) |
| 235 | continue; | 241 | continue; |
| @@ -282,7 +288,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
| 282 | 288 | ||
| 283 | /* write overflow error detected */ | 289 | /* write overflow error detected */ |
| 284 | _output_error: | 290 | _output_error: |
| 285 | return (int) (-(((char *) ip) - source)); | 291 | return -1; |
| 286 | } | 292 | } |
| 287 | 293 | ||
| 288 | int lz4_decompress(const unsigned char *src, size_t *src_len, | 294 | int lz4_decompress(const unsigned char *src, size_t *src_len, |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 649d097853a1..4abda074ea45 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
| @@ -86,6 +86,7 @@ static unsigned int io_tlb_index; | |||
| 86 | * We need to save away the original address corresponding to a mapped entry | 86 | * We need to save away the original address corresponding to a mapped entry |
| 87 | * for the sync operations. | 87 | * for the sync operations. |
| 88 | */ | 88 | */ |
| 89 | #define INVALID_PHYS_ADDR (~(phys_addr_t)0) | ||
| 89 | static phys_addr_t *io_tlb_orig_addr; | 90 | static phys_addr_t *io_tlb_orig_addr; |
| 90 | 91 | ||
| 91 | /* | 92 | /* |
| @@ -188,12 +189,14 @@ int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) | |||
| 188 | io_tlb_list = memblock_virt_alloc( | 189 | io_tlb_list = memblock_virt_alloc( |
| 189 | PAGE_ALIGN(io_tlb_nslabs * sizeof(int)), | 190 | PAGE_ALIGN(io_tlb_nslabs * sizeof(int)), |
| 190 | PAGE_SIZE); | 191 | PAGE_SIZE); |
| 191 | for (i = 0; i < io_tlb_nslabs; i++) | ||
| 192 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
| 193 | io_tlb_index = 0; | ||
| 194 | io_tlb_orig_addr = memblock_virt_alloc( | 192 | io_tlb_orig_addr = memblock_virt_alloc( |
| 195 | PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t)), | 193 | PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t)), |
| 196 | PAGE_SIZE); | 194 | PAGE_SIZE); |
| 195 | for (i = 0; i < io_tlb_nslabs; i++) { | ||
| 196 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
| 197 | io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; | ||
| 198 | } | ||
| 199 | io_tlb_index = 0; | ||
| 197 | 200 | ||
| 198 | if (verbose) | 201 | if (verbose) |
| 199 | swiotlb_print_info(); | 202 | swiotlb_print_info(); |
| @@ -313,10 +316,6 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) | |||
| 313 | if (!io_tlb_list) | 316 | if (!io_tlb_list) |
| 314 | goto cleanup3; | 317 | goto cleanup3; |
| 315 | 318 | ||
| 316 | for (i = 0; i < io_tlb_nslabs; i++) | ||
| 317 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
| 318 | io_tlb_index = 0; | ||
| 319 | |||
| 320 | io_tlb_orig_addr = (phys_addr_t *) | 319 | io_tlb_orig_addr = (phys_addr_t *) |
| 321 | __get_free_pages(GFP_KERNEL, | 320 | __get_free_pages(GFP_KERNEL, |
| 322 | get_order(io_tlb_nslabs * | 321 | get_order(io_tlb_nslabs * |
| @@ -324,7 +323,11 @@ swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs) | |||
| 324 | if (!io_tlb_orig_addr) | 323 | if (!io_tlb_orig_addr) |
| 325 | goto cleanup4; | 324 | goto cleanup4; |
| 326 | 325 | ||
| 327 | memset(io_tlb_orig_addr, 0, io_tlb_nslabs * sizeof(phys_addr_t)); | 326 | for (i = 0; i < io_tlb_nslabs; i++) { |
| 327 | io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE); | ||
| 328 | io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; | ||
| 329 | } | ||
| 330 | io_tlb_index = 0; | ||
| 328 | 331 | ||
| 329 | swiotlb_print_info(); | 332 | swiotlb_print_info(); |
| 330 | 333 | ||
| @@ -556,7 +559,8 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr, | |||
| 556 | /* | 559 | /* |
| 557 | * First, sync the memory before unmapping the entry | 560 | * First, sync the memory before unmapping the entry |
| 558 | */ | 561 | */ |
| 559 | if (orig_addr && ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL))) | 562 | if (orig_addr != INVALID_PHYS_ADDR && |
| 563 | ((dir == DMA_FROM_DEVICE) || (dir == DMA_BIDIRECTIONAL))) | ||
| 560 | swiotlb_bounce(orig_addr, tlb_addr, size, DMA_FROM_DEVICE); | 564 | swiotlb_bounce(orig_addr, tlb_addr, size, DMA_FROM_DEVICE); |
| 561 | 565 | ||
| 562 | /* | 566 | /* |
| @@ -573,8 +577,10 @@ void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr, | |||
| 573 | * Step 1: return the slots to the free list, merging the | 577 | * Step 1: return the slots to the free list, merging the |
| 574 | * slots with superceeding slots | 578 | * slots with superceeding slots |
| 575 | */ | 579 | */ |
| 576 | for (i = index + nslots - 1; i >= index; i--) | 580 | for (i = index + nslots - 1; i >= index; i--) { |
| 577 | io_tlb_list[i] = ++count; | 581 | io_tlb_list[i] = ++count; |
| 582 | io_tlb_orig_addr[i] = INVALID_PHYS_ADDR; | ||
| 583 | } | ||
| 578 | /* | 584 | /* |
| 579 | * Step 2: merge the returned slots with the preceding slots, | 585 | * Step 2: merge the returned slots with the preceding slots, |
| 580 | * if available (non zero) | 586 | * if available (non zero) |
| @@ -593,6 +599,8 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr, | |||
| 593 | int index = (tlb_addr - io_tlb_start) >> IO_TLB_SHIFT; | 599 | int index = (tlb_addr - io_tlb_start) >> IO_TLB_SHIFT; |
| 594 | phys_addr_t orig_addr = io_tlb_orig_addr[index]; | 600 | phys_addr_t orig_addr = io_tlb_orig_addr[index]; |
| 595 | 601 | ||
| 602 | if (orig_addr == INVALID_PHYS_ADDR) | ||
| 603 | return; | ||
| 596 | orig_addr += (unsigned long)tlb_addr & ((1 << IO_TLB_SHIFT) - 1); | 604 | orig_addr += (unsigned long)tlb_addr & ((1 << IO_TLB_SHIFT) - 1); |
| 597 | 605 | ||
| 598 | switch (target) { | 606 | switch (target) { |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index cd8989c1027e..c6399e328931 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
| @@ -895,7 +895,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
| 895 | struct page *hpage = *hpagep; | 895 | struct page *hpage = *hpagep; |
| 896 | struct page *ppage; | 896 | struct page *ppage; |
| 897 | 897 | ||
| 898 | if (PageReserved(p) || PageSlab(p)) | 898 | if (PageReserved(p) || PageSlab(p) || !PageLRU(p)) |
| 899 | return SWAP_SUCCESS; | 899 | return SWAP_SUCCESS; |
| 900 | 900 | ||
| 901 | /* | 901 | /* |
| @@ -1159,9 +1159,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
| 1159 | action_result(pfn, "free buddy, 2nd try", DELAYED); | 1159 | action_result(pfn, "free buddy, 2nd try", DELAYED); |
| 1160 | return 0; | 1160 | return 0; |
| 1161 | } | 1161 | } |
| 1162 | action_result(pfn, "non LRU", IGNORED); | ||
| 1163 | put_page(p); | ||
| 1164 | return -EBUSY; | ||
| 1165 | } | 1162 | } |
| 1166 | } | 1163 | } |
| 1167 | 1164 | ||
| @@ -1194,6 +1191,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
| 1194 | return 0; | 1191 | return 0; |
| 1195 | } | 1192 | } |
| 1196 | 1193 | ||
| 1194 | if (!PageHuge(p) && !PageTransTail(p) && !PageLRU(p)) | ||
| 1195 | goto identify_page_state; | ||
| 1196 | |||
| 1197 | /* | 1197 | /* |
| 1198 | * For error on the tail page, we should set PG_hwpoison | 1198 | * For error on the tail page, we should set PG_hwpoison |
| 1199 | * on the head page to show that the hugepage is hwpoisoned | 1199 | * on the head page to show that the hugepage is hwpoisoned |
| @@ -1243,6 +1243,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
| 1243 | goto out; | 1243 | goto out; |
| 1244 | } | 1244 | } |
| 1245 | 1245 | ||
| 1246 | identify_page_state: | ||
| 1246 | res = -EBUSY; | 1247 | res = -EBUSY; |
| 1247 | /* | 1248 | /* |
| 1248 | * The first check uses the current page flags which may not have any | 1249 | * The first check uses the current page flags which may not have any |
diff --git a/mm/msync.c b/mm/msync.c index a5c673669ca6..992a1673d488 100644 --- a/mm/msync.c +++ b/mm/msync.c | |||
| @@ -78,7 +78,8 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) | |||
| 78 | goto out_unlock; | 78 | goto out_unlock; |
| 79 | } | 79 | } |
| 80 | file = vma->vm_file; | 80 | file = vma->vm_file; |
| 81 | fstart = start + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); | 81 | fstart = (start - vma->vm_start) + |
| 82 | ((loff_t)vma->vm_pgoff << PAGE_SHIFT); | ||
| 82 | fend = fstart + (min(end, vma->vm_end) - start) - 1; | 83 | fend = fstart + (min(end, vma->vm_end) - start) - 1; |
| 83 | start = vma->vm_end; | 84 | start = vma->vm_end; |
| 84 | if ((flags & MS_SYNC) && file && | 85 | if ((flags & MS_SYNC) && file && |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 20d17f8266fe..0ea758b898fd 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
| @@ -816,9 +816,21 @@ void __init init_cma_reserved_pageblock(struct page *page) | |||
| 816 | set_page_count(p, 0); | 816 | set_page_count(p, 0); |
| 817 | } while (++p, --i); | 817 | } while (++p, --i); |
| 818 | 818 | ||
| 819 | set_page_refcounted(page); | ||
| 820 | set_pageblock_migratetype(page, MIGRATE_CMA); | 819 | set_pageblock_migratetype(page, MIGRATE_CMA); |
| 821 | __free_pages(page, pageblock_order); | 820 | |
| 821 | if (pageblock_order >= MAX_ORDER) { | ||
| 822 | i = pageblock_nr_pages; | ||
| 823 | p = page; | ||
| 824 | do { | ||
| 825 | set_page_refcounted(p); | ||
| 826 | __free_pages(p, MAX_ORDER - 1); | ||
| 827 | p += MAX_ORDER_NR_PAGES; | ||
| 828 | } while (i -= MAX_ORDER_NR_PAGES); | ||
| 829 | } else { | ||
| 830 | set_page_refcounted(page); | ||
| 831 | __free_pages(page, pageblock_order); | ||
| 832 | } | ||
| 833 | |||
| 822 | adjust_managed_page_count(page, pageblock_nr_pages); | 834 | adjust_managed_page_count(page, pageblock_nr_pages); |
| 823 | } | 835 | } |
| 824 | #endif | 836 | #endif |
diff --git a/mm/shmem.c b/mm/shmem.c index 8f419cff9e34..1140f49b6ded 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
| @@ -1029,6 +1029,9 @@ repeat: | |||
| 1029 | goto failed; | 1029 | goto failed; |
| 1030 | } | 1030 | } |
| 1031 | 1031 | ||
| 1032 | if (page && sgp == SGP_WRITE) | ||
| 1033 | mark_page_accessed(page); | ||
| 1034 | |||
| 1032 | /* fallocated page? */ | 1035 | /* fallocated page? */ |
| 1033 | if (page && !PageUptodate(page)) { | 1036 | if (page && !PageUptodate(page)) { |
| 1034 | if (sgp != SGP_READ) | 1037 | if (sgp != SGP_READ) |
| @@ -1110,6 +1113,9 @@ repeat: | |||
| 1110 | shmem_recalc_inode(inode); | 1113 | shmem_recalc_inode(inode); |
| 1111 | spin_unlock(&info->lock); | 1114 | spin_unlock(&info->lock); |
| 1112 | 1115 | ||
| 1116 | if (sgp == SGP_WRITE) | ||
| 1117 | mark_page_accessed(page); | ||
| 1118 | |||
| 1113 | delete_from_swap_cache(page); | 1119 | delete_from_swap_cache(page); |
| 1114 | set_page_dirty(page); | 1120 | set_page_dirty(page); |
| 1115 | swap_free(swap); | 1121 | swap_free(swap); |
| @@ -1136,6 +1142,9 @@ repeat: | |||
| 1136 | 1142 | ||
| 1137 | __SetPageSwapBacked(page); | 1143 | __SetPageSwapBacked(page); |
| 1138 | __set_page_locked(page); | 1144 | __set_page_locked(page); |
| 1145 | if (sgp == SGP_WRITE) | ||
| 1146 | init_page_accessed(page); | ||
| 1147 | |||
| 1139 | error = mem_cgroup_charge_file(page, current->mm, | 1148 | error = mem_cgroup_charge_file(page, current->mm, |
| 1140 | gfp & GFP_RECLAIM_MASK); | 1149 | gfp & GFP_RECLAIM_MASK); |
| 1141 | if (error) | 1150 | if (error) |
| @@ -1412,13 +1421,9 @@ shmem_write_begin(struct file *file, struct address_space *mapping, | |||
| 1412 | loff_t pos, unsigned len, unsigned flags, | 1421 | loff_t pos, unsigned len, unsigned flags, |
| 1413 | struct page **pagep, void **fsdata) | 1422 | struct page **pagep, void **fsdata) |
| 1414 | { | 1423 | { |
| 1415 | int ret; | ||
| 1416 | struct inode *inode = mapping->host; | 1424 | struct inode *inode = mapping->host; |
| 1417 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; | 1425 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; |
| 1418 | ret = shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); | 1426 | return shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); |
| 1419 | if (ret == 0 && *pagep) | ||
| 1420 | init_page_accessed(*pagep); | ||
| 1421 | return ret; | ||
| 1422 | } | 1427 | } |
| 1423 | 1428 | ||
| 1424 | static int | 1429 | static int |
| @@ -1881,7 +1881,7 @@ redo: | |||
| 1881 | 1881 | ||
| 1882 | new.frozen = 0; | 1882 | new.frozen = 0; |
| 1883 | 1883 | ||
| 1884 | if (!new.inuse && n->nr_partial > s->min_partial) | 1884 | if (!new.inuse && n->nr_partial >= s->min_partial) |
| 1885 | m = M_FREE; | 1885 | m = M_FREE; |
| 1886 | else if (new.freelist) { | 1886 | else if (new.freelist) { |
| 1887 | m = M_PARTIAL; | 1887 | m = M_PARTIAL; |
| @@ -1992,7 +1992,7 @@ static void unfreeze_partials(struct kmem_cache *s, | |||
| 1992 | new.freelist, new.counters, | 1992 | new.freelist, new.counters, |
| 1993 | "unfreezing slab")); | 1993 | "unfreezing slab")); |
| 1994 | 1994 | ||
| 1995 | if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) { | 1995 | if (unlikely(!new.inuse && n->nr_partial >= s->min_partial)) { |
| 1996 | page->next = discard_page; | 1996 | page->next = discard_page; |
| 1997 | discard_page = page; | 1997 | discard_page = page; |
| 1998 | } else { | 1998 | } else { |
| @@ -2620,7 +2620,7 @@ static void __slab_free(struct kmem_cache *s, struct page *page, | |||
| 2620 | return; | 2620 | return; |
| 2621 | } | 2621 | } |
| 2622 | 2622 | ||
| 2623 | if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) | 2623 | if (unlikely(!new.inuse && n->nr_partial >= s->min_partial)) |
| 2624 | goto slab_empty; | 2624 | goto slab_empty; |
| 2625 | 2625 | ||
| 2626 | /* | 2626 | /* |
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 9012b1c922b6..75d427763992 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
| @@ -114,8 +114,11 @@ EXPORT_SYMBOL(vlan_dev_vlan_proto); | |||
| 114 | 114 | ||
| 115 | static struct sk_buff *vlan_reorder_header(struct sk_buff *skb) | 115 | static struct sk_buff *vlan_reorder_header(struct sk_buff *skb) |
| 116 | { | 116 | { |
| 117 | if (skb_cow(skb, skb_headroom(skb)) < 0) | 117 | if (skb_cow(skb, skb_headroom(skb)) < 0) { |
| 118 | kfree_skb(skb); | ||
| 118 | return NULL; | 119 | return NULL; |
| 120 | } | ||
| 121 | |||
| 119 | memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN); | 122 | memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN); |
| 120 | skb->mac_header += VLAN_HLEN; | 123 | skb->mac_header += VLAN_HLEN; |
| 121 | return skb; | 124 | return skb; |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 8671bc79a35b..ca01d1861854 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
| @@ -610,11 +610,6 @@ static void hci_req_add_le_create_conn(struct hci_request *req, | |||
| 610 | if (hci_update_random_address(req, false, &own_addr_type)) | 610 | if (hci_update_random_address(req, false, &own_addr_type)) |
| 611 | return; | 611 | return; |
| 612 | 612 | ||
| 613 | /* Save the address type used for this connnection attempt so we able | ||
| 614 | * to retrieve this information if we need it. | ||
| 615 | */ | ||
| 616 | conn->src_type = own_addr_type; | ||
| 617 | |||
| 618 | cp.scan_interval = cpu_to_le16(hdev->le_scan_interval); | 613 | cp.scan_interval = cpu_to_le16(hdev->le_scan_interval); |
| 619 | cp.scan_window = cpu_to_le16(hdev->le_scan_window); | 614 | cp.scan_window = cpu_to_le16(hdev->le_scan_window); |
| 620 | bacpy(&cp.peer_addr, &conn->dst); | 615 | bacpy(&cp.peer_addr, &conn->dst); |
| @@ -894,7 +889,7 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
| 894 | /* If we're already encrypted set the REAUTH_PEND flag, | 889 | /* If we're already encrypted set the REAUTH_PEND flag, |
| 895 | * otherwise set the ENCRYPT_PEND. | 890 | * otherwise set the ENCRYPT_PEND. |
| 896 | */ | 891 | */ |
| 897 | if (conn->key_type != 0xff) | 892 | if (conn->link_mode & HCI_LM_ENCRYPT) |
| 898 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); | 893 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); |
| 899 | else | 894 | else |
| 900 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | 895 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 21e5913d12e0..640c54ec1bd2 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -48,6 +48,10 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) | |||
| 48 | smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ | 48 | smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ |
| 49 | wake_up_bit(&hdev->flags, HCI_INQUIRY); | 49 | wake_up_bit(&hdev->flags, HCI_INQUIRY); |
| 50 | 50 | ||
| 51 | hci_dev_lock(hdev); | ||
| 52 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | ||
| 53 | hci_dev_unlock(hdev); | ||
| 54 | |||
| 51 | hci_conn_check_pending(hdev); | 55 | hci_conn_check_pending(hdev); |
| 52 | } | 56 | } |
| 53 | 57 | ||
| @@ -3537,7 +3541,11 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
| 3537 | cp.authentication = conn->auth_type; | 3541 | cp.authentication = conn->auth_type; |
| 3538 | 3542 | ||
| 3539 | /* Request MITM protection if our IO caps allow it | 3543 | /* Request MITM protection if our IO caps allow it |
| 3540 | * except for the no-bonding case | 3544 | * except for the no-bonding case. |
| 3545 | * conn->auth_type is not updated here since | ||
| 3546 | * that might cause the user confirmation to be | ||
| 3547 | * rejected in case the remote doesn't have the | ||
| 3548 | * IO capabilities for MITM. | ||
| 3541 | */ | 3549 | */ |
| 3542 | if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && | 3550 | if (conn->io_capability != HCI_IO_NO_INPUT_OUTPUT && |
| 3543 | cp.authentication != HCI_AT_NO_BONDING) | 3551 | cp.authentication != HCI_AT_NO_BONDING) |
| @@ -3628,8 +3636,11 @@ static void hci_user_confirm_request_evt(struct hci_dev *hdev, | |||
| 3628 | 3636 | ||
| 3629 | /* If we're not the initiators request authorization to | 3637 | /* If we're not the initiators request authorization to |
| 3630 | * proceed from user space (mgmt_user_confirm with | 3638 | * proceed from user space (mgmt_user_confirm with |
| 3631 | * confirm_hint set to 1). */ | 3639 | * confirm_hint set to 1). The exception is if neither |
| 3632 | if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { | 3640 | * side had MITM in which case we do auto-accept. |
| 3641 | */ | ||
| 3642 | if (!test_bit(HCI_CONN_AUTH_PEND, &conn->flags) && | ||
| 3643 | (loc_mitm || rem_mitm)) { | ||
| 3633 | BT_DBG("Confirming auto-accept as acceptor"); | 3644 | BT_DBG("Confirming auto-accept as acceptor"); |
| 3634 | confirm_hint = 1; | 3645 | confirm_hint = 1; |
| 3635 | goto confirm; | 3646 | goto confirm; |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 6eabbe05fe54..323f23cd2c37 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
| @@ -1663,7 +1663,13 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err) | |||
| 1663 | kfree_skb(conn->rx_skb); | 1663 | kfree_skb(conn->rx_skb); |
| 1664 | 1664 | ||
| 1665 | skb_queue_purge(&conn->pending_rx); | 1665 | skb_queue_purge(&conn->pending_rx); |
| 1666 | flush_work(&conn->pending_rx_work); | 1666 | |
| 1667 | /* We can not call flush_work(&conn->pending_rx_work) here since we | ||
| 1668 | * might block if we are running on a worker from the same workqueue | ||
| 1669 | * pending_rx_work is waiting on. | ||
| 1670 | */ | ||
| 1671 | if (work_pending(&conn->pending_rx_work)) | ||
| 1672 | cancel_work_sync(&conn->pending_rx_work); | ||
| 1667 | 1673 | ||
| 1668 | l2cap_unregister_all_users(conn); | 1674 | l2cap_unregister_all_users(conn); |
| 1669 | 1675 | ||
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index ade3fb4c23bc..e1378693cc90 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
| @@ -787,11 +787,6 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, | |||
| 787 | 787 | ||
| 788 | /*change security for LE channels */ | 788 | /*change security for LE channels */ |
| 789 | if (chan->scid == L2CAP_CID_ATT) { | 789 | if (chan->scid == L2CAP_CID_ATT) { |
| 790 | if (!conn->hcon->out) { | ||
| 791 | err = -EINVAL; | ||
| 792 | break; | ||
| 793 | } | ||
| 794 | |||
| 795 | if (smp_conn_security(conn->hcon, sec.level)) | 790 | if (smp_conn_security(conn->hcon, sec.level)) |
| 796 | break; | 791 | break; |
| 797 | sk->sk_state = BT_CONFIG; | 792 | sk->sk_state = BT_CONFIG; |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 0fce54412ffd..af8e0a6243b7 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
| @@ -1047,6 +1047,43 @@ static void clean_up_hci_complete(struct hci_dev *hdev, u8 status) | |||
| 1047 | } | 1047 | } |
| 1048 | } | 1048 | } |
| 1049 | 1049 | ||
| 1050 | static void hci_stop_discovery(struct hci_request *req) | ||
| 1051 | { | ||
| 1052 | struct hci_dev *hdev = req->hdev; | ||
| 1053 | struct hci_cp_remote_name_req_cancel cp; | ||
| 1054 | struct inquiry_entry *e; | ||
| 1055 | |||
| 1056 | switch (hdev->discovery.state) { | ||
| 1057 | case DISCOVERY_FINDING: | ||
| 1058 | if (test_bit(HCI_INQUIRY, &hdev->flags)) { | ||
| 1059 | hci_req_add(req, HCI_OP_INQUIRY_CANCEL, 0, NULL); | ||
| 1060 | } else { | ||
| 1061 | cancel_delayed_work(&hdev->le_scan_disable); | ||
| 1062 | hci_req_add_le_scan_disable(req); | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | break; | ||
| 1066 | |||
| 1067 | case DISCOVERY_RESOLVING: | ||
| 1068 | e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, | ||
| 1069 | NAME_PENDING); | ||
| 1070 | if (!e) | ||
| 1071 | return; | ||
| 1072 | |||
| 1073 | bacpy(&cp.bdaddr, &e->data.bdaddr); | ||
| 1074 | hci_req_add(req, HCI_OP_REMOTE_NAME_REQ_CANCEL, sizeof(cp), | ||
| 1075 | &cp); | ||
| 1076 | |||
| 1077 | break; | ||
| 1078 | |||
| 1079 | default: | ||
| 1080 | /* Passive scanning */ | ||
| 1081 | if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) | ||
| 1082 | hci_req_add_le_scan_disable(req); | ||
| 1083 | break; | ||
| 1084 | } | ||
| 1085 | } | ||
| 1086 | |||
| 1050 | static int clean_up_hci_state(struct hci_dev *hdev) | 1087 | static int clean_up_hci_state(struct hci_dev *hdev) |
| 1051 | { | 1088 | { |
| 1052 | struct hci_request req; | 1089 | struct hci_request req; |
| @@ -1063,9 +1100,7 @@ static int clean_up_hci_state(struct hci_dev *hdev) | |||
| 1063 | if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) | 1100 | if (test_bit(HCI_ADVERTISING, &hdev->dev_flags)) |
| 1064 | disable_advertising(&req); | 1101 | disable_advertising(&req); |
| 1065 | 1102 | ||
| 1066 | if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) { | 1103 | hci_stop_discovery(&req); |
| 1067 | hci_req_add_le_scan_disable(&req); | ||
| 1068 | } | ||
| 1069 | 1104 | ||
| 1070 | list_for_each_entry(conn, &hdev->conn_hash.list, list) { | 1105 | list_for_each_entry(conn, &hdev->conn_hash.list, list) { |
| 1071 | struct hci_cp_disconnect dc; | 1106 | struct hci_cp_disconnect dc; |
| @@ -2996,8 +3031,13 @@ static int user_pairing_resp(struct sock *sk, struct hci_dev *hdev, | |||
| 2996 | } | 3031 | } |
| 2997 | 3032 | ||
| 2998 | if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) { | 3033 | if (addr->type == BDADDR_LE_PUBLIC || addr->type == BDADDR_LE_RANDOM) { |
| 2999 | /* Continue with pairing via SMP */ | 3034 | /* Continue with pairing via SMP. The hdev lock must be |
| 3035 | * released as SMP may try to recquire it for crypto | ||
| 3036 | * purposes. | ||
| 3037 | */ | ||
| 3038 | hci_dev_unlock(hdev); | ||
| 3000 | err = smp_user_confirm_reply(conn, mgmt_op, passkey); | 3039 | err = smp_user_confirm_reply(conn, mgmt_op, passkey); |
| 3040 | hci_dev_lock(hdev); | ||
| 3001 | 3041 | ||
| 3002 | if (!err) | 3042 | if (!err) |
| 3003 | err = cmd_complete(sk, hdev->id, mgmt_op, | 3043 | err = cmd_complete(sk, hdev->id, mgmt_op, |
| @@ -3574,8 +3614,6 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data, | |||
| 3574 | { | 3614 | { |
| 3575 | struct mgmt_cp_stop_discovery *mgmt_cp = data; | 3615 | struct mgmt_cp_stop_discovery *mgmt_cp = data; |
| 3576 | struct pending_cmd *cmd; | 3616 | struct pending_cmd *cmd; |
| 3577 | struct hci_cp_remote_name_req_cancel cp; | ||
| 3578 | struct inquiry_entry *e; | ||
| 3579 | struct hci_request req; | 3617 | struct hci_request req; |
| 3580 | int err; | 3618 | int err; |
| 3581 | 3619 | ||
| @@ -3605,52 +3643,22 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data, | |||
| 3605 | 3643 | ||
| 3606 | hci_req_init(&req, hdev); | 3644 | hci_req_init(&req, hdev); |
| 3607 | 3645 | ||
| 3608 | switch (hdev->discovery.state) { | 3646 | hci_stop_discovery(&req); |
| 3609 | case DISCOVERY_FINDING: | ||
| 3610 | if (test_bit(HCI_INQUIRY, &hdev->flags)) { | ||
| 3611 | hci_req_add(&req, HCI_OP_INQUIRY_CANCEL, 0, NULL); | ||
| 3612 | } else { | ||
| 3613 | cancel_delayed_work(&hdev->le_scan_disable); | ||
| 3614 | |||
| 3615 | hci_req_add_le_scan_disable(&req); | ||
| 3616 | } | ||
| 3617 | |||
| 3618 | break; | ||
| 3619 | 3647 | ||
| 3620 | case DISCOVERY_RESOLVING: | 3648 | err = hci_req_run(&req, stop_discovery_complete); |
| 3621 | e = hci_inquiry_cache_lookup_resolve(hdev, BDADDR_ANY, | 3649 | if (!err) { |
| 3622 | NAME_PENDING); | 3650 | hci_discovery_set_state(hdev, DISCOVERY_STOPPING); |
| 3623 | if (!e) { | ||
| 3624 | mgmt_pending_remove(cmd); | ||
| 3625 | err = cmd_complete(sk, hdev->id, | ||
| 3626 | MGMT_OP_STOP_DISCOVERY, 0, | ||
| 3627 | &mgmt_cp->type, | ||
| 3628 | sizeof(mgmt_cp->type)); | ||
| 3629 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | ||
| 3630 | goto unlock; | ||
| 3631 | } | ||
| 3632 | |||
| 3633 | bacpy(&cp.bdaddr, &e->data.bdaddr); | ||
| 3634 | hci_req_add(&req, HCI_OP_REMOTE_NAME_REQ_CANCEL, sizeof(cp), | ||
| 3635 | &cp); | ||
| 3636 | |||
| 3637 | break; | ||
| 3638 | |||
| 3639 | default: | ||
| 3640 | BT_DBG("unknown discovery state %u", hdev->discovery.state); | ||
| 3641 | |||
| 3642 | mgmt_pending_remove(cmd); | ||
| 3643 | err = cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, | ||
| 3644 | MGMT_STATUS_FAILED, &mgmt_cp->type, | ||
| 3645 | sizeof(mgmt_cp->type)); | ||
| 3646 | goto unlock; | 3651 | goto unlock; |
| 3647 | } | 3652 | } |
| 3648 | 3653 | ||
| 3649 | err = hci_req_run(&req, stop_discovery_complete); | 3654 | mgmt_pending_remove(cmd); |
| 3650 | if (err < 0) | 3655 | |
| 3651 | mgmt_pending_remove(cmd); | 3656 | /* If no HCI commands were sent we're done */ |
| 3652 | else | 3657 | if (err == -ENODATA) { |
| 3653 | hci_discovery_set_state(hdev, DISCOVERY_STOPPING); | 3658 | err = cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY, 0, |
| 3659 | &mgmt_cp->type, sizeof(mgmt_cp->type)); | ||
| 3660 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | ||
| 3661 | } | ||
| 3654 | 3662 | ||
| 3655 | unlock: | 3663 | unlock: |
| 3656 | hci_dev_unlock(hdev); | 3664 | hci_dev_unlock(hdev); |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 3d1cc164557d..f2829a7932e2 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
| @@ -544,7 +544,7 @@ static u8 smp_random(struct smp_chan *smp) | |||
| 544 | hci_le_start_enc(hcon, ediv, rand, stk); | 544 | hci_le_start_enc(hcon, ediv, rand, stk); |
| 545 | hcon->enc_key_size = smp->enc_key_size; | 545 | hcon->enc_key_size = smp->enc_key_size; |
| 546 | } else { | 546 | } else { |
| 547 | u8 stk[16]; | 547 | u8 stk[16], auth; |
| 548 | __le64 rand = 0; | 548 | __le64 rand = 0; |
| 549 | __le16 ediv = 0; | 549 | __le16 ediv = 0; |
| 550 | 550 | ||
| @@ -556,8 +556,13 @@ static u8 smp_random(struct smp_chan *smp) | |||
| 556 | memset(stk + smp->enc_key_size, 0, | 556 | memset(stk + smp->enc_key_size, 0, |
| 557 | SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size); | 557 | SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size); |
| 558 | 558 | ||
| 559 | if (hcon->pending_sec_level == BT_SECURITY_HIGH) | ||
| 560 | auth = 1; | ||
| 561 | else | ||
| 562 | auth = 0; | ||
| 563 | |||
| 559 | hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, | 564 | hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, |
| 560 | HCI_SMP_STK_SLAVE, 0, stk, smp->enc_key_size, | 565 | HCI_SMP_STK_SLAVE, auth, stk, smp->enc_key_size, |
| 561 | ediv, rand); | 566 | ediv, rand); |
| 562 | } | 567 | } |
| 563 | 568 | ||
diff --git a/net/core/dst.c b/net/core/dst.c index 80d6286c8b62..a028409ee438 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
| @@ -269,6 +269,15 @@ again: | |||
| 269 | } | 269 | } |
| 270 | EXPORT_SYMBOL(dst_destroy); | 270 | EXPORT_SYMBOL(dst_destroy); |
| 271 | 271 | ||
| 272 | static void dst_destroy_rcu(struct rcu_head *head) | ||
| 273 | { | ||
| 274 | struct dst_entry *dst = container_of(head, struct dst_entry, rcu_head); | ||
| 275 | |||
| 276 | dst = dst_destroy(dst); | ||
| 277 | if (dst) | ||
| 278 | __dst_free(dst); | ||
| 279 | } | ||
| 280 | |||
| 272 | void dst_release(struct dst_entry *dst) | 281 | void dst_release(struct dst_entry *dst) |
| 273 | { | 282 | { |
| 274 | if (dst) { | 283 | if (dst) { |
| @@ -276,11 +285,8 @@ void dst_release(struct dst_entry *dst) | |||
| 276 | 285 | ||
| 277 | newrefcnt = atomic_dec_return(&dst->__refcnt); | 286 | newrefcnt = atomic_dec_return(&dst->__refcnt); |
| 278 | WARN_ON(newrefcnt < 0); | 287 | WARN_ON(newrefcnt < 0); |
| 279 | if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) { | 288 | if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) |
| 280 | dst = dst_destroy(dst); | 289 | call_rcu(&dst->rcu_head, dst_destroy_rcu); |
| 281 | if (dst) | ||
| 282 | __dst_free(dst); | ||
| 283 | } | ||
| 284 | } | 290 | } |
| 285 | } | 291 | } |
| 286 | EXPORT_SYMBOL(dst_release); | 292 | EXPORT_SYMBOL(dst_release); |
diff --git a/net/core/filter.c b/net/core/filter.c index 735fad897496..1dbf6462f766 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
| @@ -840,11 +840,11 @@ int sk_convert_filter(struct sock_filter *prog, int len, | |||
| 840 | BUILD_BUG_ON(BPF_MEMWORDS * sizeof(u32) > MAX_BPF_STACK); | 840 | BUILD_BUG_ON(BPF_MEMWORDS * sizeof(u32) > MAX_BPF_STACK); |
| 841 | BUILD_BUG_ON(BPF_REG_FP + 1 != MAX_BPF_REG); | 841 | BUILD_BUG_ON(BPF_REG_FP + 1 != MAX_BPF_REG); |
| 842 | 842 | ||
| 843 | if (len <= 0 || len >= BPF_MAXINSNS) | 843 | if (len <= 0 || len > BPF_MAXINSNS) |
| 844 | return -EINVAL; | 844 | return -EINVAL; |
| 845 | 845 | ||
| 846 | if (new_prog) { | 846 | if (new_prog) { |
| 847 | addrs = kzalloc(len * sizeof(*addrs), GFP_KERNEL); | 847 | addrs = kcalloc(len, sizeof(*addrs), GFP_KERNEL); |
| 848 | if (!addrs) | 848 | if (!addrs) |
| 849 | return -ENOMEM; | 849 | return -ENOMEM; |
| 850 | } | 850 | } |
| @@ -1101,7 +1101,7 @@ static int check_load_and_stores(struct sock_filter *filter, int flen) | |||
| 1101 | 1101 | ||
| 1102 | BUILD_BUG_ON(BPF_MEMWORDS > 16); | 1102 | BUILD_BUG_ON(BPF_MEMWORDS > 16); |
| 1103 | 1103 | ||
| 1104 | masks = kmalloc(flen * sizeof(*masks), GFP_KERNEL); | 1104 | masks = kmalloc_array(flen, sizeof(*masks), GFP_KERNEL); |
| 1105 | if (!masks) | 1105 | if (!masks) |
| 1106 | return -ENOMEM; | 1106 | return -ENOMEM; |
| 1107 | 1107 | ||
| @@ -1382,7 +1382,7 @@ static struct sk_filter *__sk_migrate_realloc(struct sk_filter *fp, | |||
| 1382 | fp_new = sock_kmalloc(sk, len, GFP_KERNEL); | 1382 | fp_new = sock_kmalloc(sk, len, GFP_KERNEL); |
| 1383 | if (fp_new) { | 1383 | if (fp_new) { |
| 1384 | *fp_new = *fp; | 1384 | *fp_new = *fp; |
| 1385 | /* As we're kepping orig_prog in fp_new along, | 1385 | /* As we're keeping orig_prog in fp_new along, |
| 1386 | * we need to make sure we're not evicting it | 1386 | * we need to make sure we're not evicting it |
| 1387 | * from the old fp. | 1387 | * from the old fp. |
| 1388 | */ | 1388 | */ |
| @@ -1524,8 +1524,8 @@ static struct sk_filter *__sk_prepare_filter(struct sk_filter *fp, | |||
| 1524 | 1524 | ||
| 1525 | /** | 1525 | /** |
| 1526 | * sk_unattached_filter_create - create an unattached filter | 1526 | * sk_unattached_filter_create - create an unattached filter |
| 1527 | * @fprog: the filter program | ||
| 1528 | * @pfp: the unattached filter that is created | 1527 | * @pfp: the unattached filter that is created |
| 1528 | * @fprog: the filter program | ||
| 1529 | * | 1529 | * |
| 1530 | * Create a filter independent of any socket. We first run some | 1530 | * Create a filter independent of any socket. We first run some |
| 1531 | * sanity checks on it to make sure it does not explode on us later. | 1531 | * sanity checks on it to make sure it does not explode on us later. |
diff --git a/net/core/iovec.c b/net/core/iovec.c index b61869429f4c..827dd6beb49c 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c | |||
| @@ -75,61 +75,6 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *a | |||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | /* | 77 | /* |
| 78 | * Copy kernel to iovec. Returns -EFAULT on error. | ||
| 79 | */ | ||
| 80 | |||
| 81 | int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata, | ||
| 82 | int offset, int len) | ||
| 83 | { | ||
| 84 | int copy; | ||
| 85 | for (; len > 0; ++iov) { | ||
| 86 | /* Skip over the finished iovecs */ | ||
| 87 | if (unlikely(offset >= iov->iov_len)) { | ||
| 88 | offset -= iov->iov_len; | ||
| 89 | continue; | ||
| 90 | } | ||
| 91 | copy = min_t(unsigned int, iov->iov_len - offset, len); | ||
| 92 | if (copy_to_user(iov->iov_base + offset, kdata, copy)) | ||
| 93 | return -EFAULT; | ||
| 94 | offset = 0; | ||
| 95 | kdata += copy; | ||
| 96 | len -= copy; | ||
| 97 | } | ||
| 98 | |||
| 99 | return 0; | ||
| 100 | } | ||
| 101 | EXPORT_SYMBOL(memcpy_toiovecend); | ||
| 102 | |||
| 103 | /* | ||
| 104 | * Copy iovec to kernel. Returns -EFAULT on error. | ||
| 105 | */ | ||
| 106 | |||
| 107 | int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, | ||
| 108 | int offset, int len) | ||
| 109 | { | ||
| 110 | /* Skip over the finished iovecs */ | ||
| 111 | while (offset >= iov->iov_len) { | ||
| 112 | offset -= iov->iov_len; | ||
| 113 | iov++; | ||
| 114 | } | ||
| 115 | |||
| 116 | while (len > 0) { | ||
| 117 | u8 __user *base = iov->iov_base + offset; | ||
| 118 | int copy = min_t(unsigned int, len, iov->iov_len - offset); | ||
| 119 | |||
| 120 | offset = 0; | ||
| 121 | if (copy_from_user(kdata, base, copy)) | ||
| 122 | return -EFAULT; | ||
| 123 | len -= copy; | ||
| 124 | kdata += copy; | ||
| 125 | iov++; | ||
| 126 | } | ||
| 127 | |||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | EXPORT_SYMBOL(memcpy_fromiovecend); | ||
| 131 | |||
| 132 | /* | ||
| 133 | * And now for the all-in-one: copy and checksum from a user iovec | 78 | * And now for the all-in-one: copy and checksum from a user iovec |
| 134 | * directly to a datagram | 79 | * directly to a datagram |
| 135 | * Calls to csum_partial but the last must be in 32 bit chunks | 80 | * Calls to csum_partial but the last must be in 32 bit chunks |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 9cd5344fad73..c1a33033cbe2 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -2993,7 +2993,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, | |||
| 2993 | skb_put(nskb, len), | 2993 | skb_put(nskb, len), |
| 2994 | len, 0); | 2994 | len, 0); |
| 2995 | SKB_GSO_CB(nskb)->csum_start = | 2995 | SKB_GSO_CB(nskb)->csum_start = |
| 2996 | skb_headroom(nskb) + offset; | 2996 | skb_headroom(nskb) + doffset; |
| 2997 | continue; | 2997 | continue; |
| 2998 | } | 2998 | } |
| 2999 | 2999 | ||
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 097b3e7c1e8f..54b6731dab55 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
| @@ -73,12 +73,7 @@ static void __tunnel_dst_set(struct ip_tunnel_dst *idst, | |||
| 73 | { | 73 | { |
| 74 | struct dst_entry *old_dst; | 74 | struct dst_entry *old_dst; |
| 75 | 75 | ||
| 76 | if (dst) { | 76 | dst_clone(dst); |
| 77 | if (dst->flags & DST_NOCACHE) | ||
| 78 | dst = NULL; | ||
| 79 | else | ||
| 80 | dst_clone(dst); | ||
| 81 | } | ||
| 82 | old_dst = xchg((__force struct dst_entry **)&idst->dst, dst); | 77 | old_dst = xchg((__force struct dst_entry **)&idst->dst, dst); |
| 83 | dst_release(old_dst); | 78 | dst_release(old_dst); |
| 84 | } | 79 | } |
| @@ -108,13 +103,14 @@ static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, u32 cookie) | |||
| 108 | 103 | ||
| 109 | rcu_read_lock(); | 104 | rcu_read_lock(); |
| 110 | dst = rcu_dereference(this_cpu_ptr(t->dst_cache)->dst); | 105 | dst = rcu_dereference(this_cpu_ptr(t->dst_cache)->dst); |
| 106 | if (dst && !atomic_inc_not_zero(&dst->__refcnt)) | ||
| 107 | dst = NULL; | ||
| 111 | if (dst) { | 108 | if (dst) { |
| 112 | if (dst->obsolete && dst->ops->check(dst, cookie) == NULL) { | 109 | if (dst->obsolete && dst->ops->check(dst, cookie) == NULL) { |
| 113 | rcu_read_unlock(); | ||
| 114 | tunnel_dst_reset(t); | 110 | tunnel_dst_reset(t); |
| 115 | return NULL; | 111 | dst_release(dst); |
| 112 | dst = NULL; | ||
| 116 | } | 113 | } |
| 117 | dst_hold(dst); | ||
| 118 | } | 114 | } |
| 119 | rcu_read_unlock(); | 115 | rcu_read_unlock(); |
| 120 | return (struct rtable *)dst; | 116 | return (struct rtable *)dst; |
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 62e48cf84e60..9771563ab564 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c | |||
| @@ -131,7 +131,7 @@ static bool tcp_fastopen_create_child(struct sock *sk, | |||
| 131 | struct dst_entry *dst, | 131 | struct dst_entry *dst, |
| 132 | struct request_sock *req) | 132 | struct request_sock *req) |
| 133 | { | 133 | { |
| 134 | struct tcp_sock *tp = tcp_sk(sk); | 134 | struct tcp_sock *tp; |
| 135 | struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue; | 135 | struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue; |
| 136 | struct sock *child; | 136 | struct sock *child; |
| 137 | 137 | ||
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 40661fc1e233..b5c23756965a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -1162,7 +1162,7 @@ static int tcp_match_skb_to_sack(struct sock *sk, struct sk_buff *skb, | |||
| 1162 | unsigned int new_len = (pkt_len / mss) * mss; | 1162 | unsigned int new_len = (pkt_len / mss) * mss; |
| 1163 | if (!in_sack && new_len < pkt_len) { | 1163 | if (!in_sack && new_len < pkt_len) { |
| 1164 | new_len += mss; | 1164 | new_len += mss; |
| 1165 | if (new_len > skb->len) | 1165 | if (new_len >= skb->len) |
| 1166 | return 0; | 1166 | return 0; |
| 1167 | } | 1167 | } |
| 1168 | pkt_len = new_len; | 1168 | pkt_len = new_len; |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index c42e83d2751c..581a6584ed0c 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
| @@ -3778,6 +3778,7 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) | |||
| 3778 | cancel_delayed_work_sync(&ipvs->defense_work); | 3778 | cancel_delayed_work_sync(&ipvs->defense_work); |
| 3779 | cancel_work_sync(&ipvs->defense_work.work); | 3779 | cancel_work_sync(&ipvs->defense_work.work); |
| 3780 | unregister_net_sysctl_table(ipvs->sysctl_hdr); | 3780 | unregister_net_sysctl_table(ipvs->sysctl_hdr); |
| 3781 | ip_vs_stop_estimator(net, &ipvs->tot_stats); | ||
| 3781 | } | 3782 | } |
| 3782 | 3783 | ||
| 3783 | #else | 3784 | #else |
| @@ -3840,7 +3841,6 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net) | |||
| 3840 | struct netns_ipvs *ipvs = net_ipvs(net); | 3841 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 3841 | 3842 | ||
| 3842 | ip_vs_trash_cleanup(net); | 3843 | ip_vs_trash_cleanup(net); |
| 3843 | ip_vs_stop_estimator(net, &ipvs->tot_stats); | ||
| 3844 | ip_vs_control_net_cleanup_sysctl(net); | 3844 | ip_vs_control_net_cleanup_sysctl(net); |
| 3845 | remove_proc_entry("ip_vs_stats_percpu", net->proc_net); | 3845 | remove_proc_entry("ip_vs_stats_percpu", net->proc_net); |
| 3846 | remove_proc_entry("ip_vs_stats", net->proc_net); | 3846 | remove_proc_entry("ip_vs_stats", net->proc_net); |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 58579634427d..300ed1eec729 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
| @@ -597,6 +597,9 @@ ctnetlink_nlmsg_size(const struct nf_conn *ct) | |||
| 597 | #ifdef CONFIG_NF_CONNTRACK_MARK | 597 | #ifdef CONFIG_NF_CONNTRACK_MARK |
| 598 | + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ | 598 | + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ |
| 599 | #endif | 599 | #endif |
| 600 | #ifdef CONFIG_NF_CONNTRACK_ZONES | ||
| 601 | + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE */ | ||
| 602 | #endif | ||
| 600 | + ctnetlink_proto_size(ct) | 603 | + ctnetlink_proto_size(ct) |
| 601 | + ctnetlink_label_size(ct) | 604 | + ctnetlink_label_size(ct) |
| 602 | ; | 605 | ; |
| @@ -1150,7 +1153,7 @@ static int ctnetlink_done_list(struct netlink_callback *cb) | |||
| 1150 | static int | 1153 | static int |
| 1151 | ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying) | 1154 | ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying) |
| 1152 | { | 1155 | { |
| 1153 | struct nf_conn *ct, *last = NULL; | 1156 | struct nf_conn *ct, *last; |
| 1154 | struct nf_conntrack_tuple_hash *h; | 1157 | struct nf_conntrack_tuple_hash *h; |
| 1155 | struct hlist_nulls_node *n; | 1158 | struct hlist_nulls_node *n; |
| 1156 | struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); | 1159 | struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh); |
| @@ -1163,8 +1166,7 @@ ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying | |||
| 1163 | if (cb->args[2]) | 1166 | if (cb->args[2]) |
| 1164 | return 0; | 1167 | return 0; |
| 1165 | 1168 | ||
| 1166 | if (cb->args[0] == nr_cpu_ids) | 1169 | last = (struct nf_conn *)cb->args[1]; |
| 1167 | return 0; | ||
| 1168 | 1170 | ||
| 1169 | for (cpu = cb->args[0]; cpu < nr_cpu_ids; cpu++) { | 1171 | for (cpu = cb->args[0]; cpu < nr_cpu_ids; cpu++) { |
| 1170 | struct ct_pcpu *pcpu; | 1172 | struct ct_pcpu *pcpu; |
| @@ -1174,7 +1176,6 @@ ctnetlink_dump_list(struct sk_buff *skb, struct netlink_callback *cb, bool dying | |||
| 1174 | 1176 | ||
| 1175 | pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); | 1177 | pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); |
| 1176 | spin_lock_bh(&pcpu->lock); | 1178 | spin_lock_bh(&pcpu->lock); |
| 1177 | last = (struct nf_conn *)cb->args[1]; | ||
| 1178 | list = dying ? &pcpu->dying : &pcpu->unconfirmed; | 1179 | list = dying ? &pcpu->dying : &pcpu->unconfirmed; |
| 1179 | restart: | 1180 | restart: |
| 1180 | hlist_nulls_for_each_entry(h, n, list, hnnode) { | 1181 | hlist_nulls_for_each_entry(h, n, list, hnnode) { |
| @@ -1193,7 +1194,9 @@ restart: | |||
| 1193 | ct); | 1194 | ct); |
| 1194 | rcu_read_unlock(); | 1195 | rcu_read_unlock(); |
| 1195 | if (res < 0) { | 1196 | if (res < 0) { |
| 1196 | nf_conntrack_get(&ct->ct_general); | 1197 | if (!atomic_inc_not_zero(&ct->ct_general.use)) |
| 1198 | continue; | ||
| 1199 | cb->args[0] = cpu; | ||
| 1197 | cb->args[1] = (unsigned long)ct; | 1200 | cb->args[1] = (unsigned long)ct; |
| 1198 | spin_unlock_bh(&pcpu->lock); | 1201 | spin_unlock_bh(&pcpu->lock); |
| 1199 | goto out; | 1202 | goto out; |
| @@ -1202,10 +1205,10 @@ restart: | |||
| 1202 | if (cb->args[1]) { | 1205 | if (cb->args[1]) { |
| 1203 | cb->args[1] = 0; | 1206 | cb->args[1] = 0; |
| 1204 | goto restart; | 1207 | goto restart; |
| 1205 | } else | 1208 | } |
| 1206 | cb->args[2] = 1; | ||
| 1207 | spin_unlock_bh(&pcpu->lock); | 1209 | spin_unlock_bh(&pcpu->lock); |
| 1208 | } | 1210 | } |
| 1211 | cb->args[2] = 1; | ||
| 1209 | out: | 1212 | out: |
| 1210 | if (last) | 1213 | if (last) |
| 1211 | nf_ct_put(last); | 1214 | nf_ct_put(last); |
| @@ -2040,6 +2043,9 @@ ctnetlink_nfqueue_build_size(const struct nf_conn *ct) | |||
| 2040 | #ifdef CONFIG_NF_CONNTRACK_MARK | 2043 | #ifdef CONFIG_NF_CONNTRACK_MARK |
| 2041 | + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ | 2044 | + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */ |
| 2042 | #endif | 2045 | #endif |
| 2046 | #ifdef CONFIG_NF_CONNTRACK_ZONES | ||
| 2047 | + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE */ | ||
| 2048 | #endif | ||
| 2043 | + ctnetlink_proto_size(ct) | 2049 | + ctnetlink_proto_size(ct) |
| 2044 | ; | 2050 | ; |
| 2045 | } | 2051 | } |
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c index 09096a670c45..a49907b1dabc 100644 --- a/net/netfilter/nf_nat_core.c +++ b/net/netfilter/nf_nat_core.c | |||
| @@ -525,6 +525,39 @@ static int nf_nat_proto_remove(struct nf_conn *i, void *data) | |||
| 525 | return i->status & IPS_NAT_MASK ? 1 : 0; | 525 | return i->status & IPS_NAT_MASK ? 1 : 0; |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | static int nf_nat_proto_clean(struct nf_conn *ct, void *data) | ||
| 529 | { | ||
| 530 | struct nf_conn_nat *nat = nfct_nat(ct); | ||
| 531 | |||
| 532 | if (nf_nat_proto_remove(ct, data)) | ||
| 533 | return 1; | ||
| 534 | |||
| 535 | if (!nat || !nat->ct) | ||
| 536 | return 0; | ||
| 537 | |||
| 538 | /* This netns is being destroyed, and conntrack has nat null binding. | ||
| 539 | * Remove it from bysource hash, as the table will be freed soon. | ||
| 540 | * | ||
| 541 | * Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack() | ||
| 542 | * will delete entry from already-freed table. | ||
| 543 | */ | ||
| 544 | if (!del_timer(&ct->timeout)) | ||
| 545 | return 1; | ||
| 546 | |||
| 547 | spin_lock_bh(&nf_nat_lock); | ||
| 548 | hlist_del_rcu(&nat->bysource); | ||
| 549 | ct->status &= ~IPS_NAT_DONE_MASK; | ||
| 550 | nat->ct = NULL; | ||
| 551 | spin_unlock_bh(&nf_nat_lock); | ||
| 552 | |||
| 553 | add_timer(&ct->timeout); | ||
| 554 | |||
| 555 | /* don't delete conntrack. Although that would make things a lot | ||
| 556 | * simpler, we'd end up flushing all conntracks on nat rmmod. | ||
| 557 | */ | ||
| 558 | return 0; | ||
| 559 | } | ||
| 560 | |||
| 528 | static void nf_nat_l4proto_clean(u8 l3proto, u8 l4proto) | 561 | static void nf_nat_l4proto_clean(u8 l3proto, u8 l4proto) |
| 529 | { | 562 | { |
| 530 | struct nf_nat_proto_clean clean = { | 563 | struct nf_nat_proto_clean clean = { |
| @@ -795,7 +828,7 @@ static void __net_exit nf_nat_net_exit(struct net *net) | |||
| 795 | { | 828 | { |
| 796 | struct nf_nat_proto_clean clean = {}; | 829 | struct nf_nat_proto_clean clean = {}; |
| 797 | 830 | ||
| 798 | nf_ct_iterate_cleanup(net, &nf_nat_proto_remove, &clean, 0, 0); | 831 | nf_ct_iterate_cleanup(net, nf_nat_proto_clean, &clean, 0, 0); |
| 799 | synchronize_rcu(); | 832 | synchronize_rcu(); |
| 800 | nf_ct_free_hashtable(net->ct.nat_bysource, net->ct.nat_htable_size); | 833 | nf_ct_free_hashtable(net->ct.nat_bysource, net->ct.nat_htable_size); |
| 801 | } | 834 | } |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 624e083125b9..ab4566cfcbe4 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
| @@ -1730,6 +1730,9 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | |||
| 1730 | if (!create || nlh->nlmsg_flags & NLM_F_REPLACE) | 1730 | if (!create || nlh->nlmsg_flags & NLM_F_REPLACE) |
| 1731 | return -EINVAL; | 1731 | return -EINVAL; |
| 1732 | handle = nf_tables_alloc_handle(table); | 1732 | handle = nf_tables_alloc_handle(table); |
| 1733 | |||
| 1734 | if (chain->use == UINT_MAX) | ||
| 1735 | return -EOVERFLOW; | ||
| 1733 | } | 1736 | } |
| 1734 | 1737 | ||
| 1735 | if (nla[NFTA_RULE_POSITION]) { | 1738 | if (nla[NFTA_RULE_POSITION]) { |
| @@ -1789,14 +1792,15 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | |||
| 1789 | 1792 | ||
| 1790 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { | 1793 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { |
| 1791 | if (nft_rule_is_active_next(net, old_rule)) { | 1794 | if (nft_rule_is_active_next(net, old_rule)) { |
| 1792 | trans = nft_trans_rule_add(&ctx, NFT_MSG_NEWRULE, | 1795 | trans = nft_trans_rule_add(&ctx, NFT_MSG_DELRULE, |
| 1793 | old_rule); | 1796 | old_rule); |
| 1794 | if (trans == NULL) { | 1797 | if (trans == NULL) { |
| 1795 | err = -ENOMEM; | 1798 | err = -ENOMEM; |
| 1796 | goto err2; | 1799 | goto err2; |
| 1797 | } | 1800 | } |
| 1798 | nft_rule_disactivate_next(net, old_rule); | 1801 | nft_rule_disactivate_next(net, old_rule); |
| 1799 | list_add_tail(&rule->list, &old_rule->list); | 1802 | chain->use--; |
| 1803 | list_add_tail_rcu(&rule->list, &old_rule->list); | ||
| 1800 | } else { | 1804 | } else { |
| 1801 | err = -ENOENT; | 1805 | err = -ENOENT; |
| 1802 | goto err2; | 1806 | goto err2; |
| @@ -1826,6 +1830,7 @@ err3: | |||
| 1826 | list_del_rcu(&nft_trans_rule(trans)->list); | 1830 | list_del_rcu(&nft_trans_rule(trans)->list); |
| 1827 | nft_rule_clear(net, nft_trans_rule(trans)); | 1831 | nft_rule_clear(net, nft_trans_rule(trans)); |
| 1828 | nft_trans_destroy(trans); | 1832 | nft_trans_destroy(trans); |
| 1833 | chain->use++; | ||
| 1829 | } | 1834 | } |
| 1830 | err2: | 1835 | err2: |
| 1831 | nf_tables_rule_destroy(&ctx, rule); | 1836 | nf_tables_rule_destroy(&ctx, rule); |
| @@ -2845,7 +2850,7 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 2845 | goto nla_put_failure; | 2850 | goto nla_put_failure; |
| 2846 | 2851 | ||
| 2847 | nfmsg = nlmsg_data(nlh); | 2852 | nfmsg = nlmsg_data(nlh); |
| 2848 | nfmsg->nfgen_family = NFPROTO_UNSPEC; | 2853 | nfmsg->nfgen_family = ctx.afi->family; |
| 2849 | nfmsg->version = NFNETLINK_V0; | 2854 | nfmsg->version = NFNETLINK_V0; |
| 2850 | nfmsg->res_id = 0; | 2855 | nfmsg->res_id = 0; |
| 2851 | 2856 | ||
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 8a779be832fb..1840989092ed 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
| @@ -195,6 +195,15 @@ static void | |||
| 195 | nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) | 195 | nft_target_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) |
| 196 | { | 196 | { |
| 197 | struct xt_target *target = expr->ops->data; | 197 | struct xt_target *target = expr->ops->data; |
| 198 | void *info = nft_expr_priv(expr); | ||
| 199 | struct xt_tgdtor_param par; | ||
| 200 | |||
| 201 | par.net = ctx->net; | ||
| 202 | par.target = target; | ||
| 203 | par.targinfo = info; | ||
| 204 | par.family = ctx->afi->family; | ||
| 205 | if (par.target->destroy != NULL) | ||
| 206 | par.target->destroy(&par); | ||
| 198 | 207 | ||
| 199 | module_put(target->me); | 208 | module_put(target->me); |
| 200 | } | 209 | } |
| @@ -382,6 +391,15 @@ static void | |||
| 382 | nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) | 391 | nft_match_destroy(const struct nft_ctx *ctx, const struct nft_expr *expr) |
| 383 | { | 392 | { |
| 384 | struct xt_match *match = expr->ops->data; | 393 | struct xt_match *match = expr->ops->data; |
| 394 | void *info = nft_expr_priv(expr); | ||
| 395 | struct xt_mtdtor_param par; | ||
| 396 | |||
| 397 | par.net = ctx->net; | ||
| 398 | par.match = match; | ||
| 399 | par.matchinfo = info; | ||
| 400 | par.family = ctx->afi->family; | ||
| 401 | if (par.match->destroy != NULL) | ||
| 402 | par.match->destroy(&par); | ||
| 385 | 403 | ||
| 386 | module_put(match->me); | 404 | module_put(match->me); |
| 387 | } | 405 | } |
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c index a0195d28bcfc..79ff58cd36dc 100644 --- a/net/netfilter/nft_nat.c +++ b/net/netfilter/nft_nat.c | |||
| @@ -175,12 +175,14 @@ static int nft_nat_dump(struct sk_buff *skb, const struct nft_expr *expr) | |||
| 175 | if (nla_put_be32(skb, | 175 | if (nla_put_be32(skb, |
| 176 | NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) | 176 | NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) |
| 177 | goto nla_put_failure; | 177 | goto nla_put_failure; |
| 178 | if (nla_put_be32(skb, | 178 | if (priv->sreg_proto_min) { |
| 179 | NFTA_NAT_REG_PROTO_MIN, htonl(priv->sreg_proto_min))) | 179 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN, |
| 180 | goto nla_put_failure; | 180 | htonl(priv->sreg_proto_min))) |
| 181 | if (nla_put_be32(skb, | 181 | goto nla_put_failure; |
| 182 | NFTA_NAT_REG_PROTO_MAX, htonl(priv->sreg_proto_max))) | 182 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX, |
| 183 | goto nla_put_failure; | 183 | htonl(priv->sreg_proto_max))) |
| 184 | goto nla_put_failure; | ||
| 185 | } | ||
| 184 | return 0; | 186 | return 0; |
| 185 | 187 | ||
| 186 | nla_put_failure: | 188 | nla_put_failure: |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index dcb19592761e..12c7e01c2677 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
| @@ -321,41 +321,40 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write, | |||
| 321 | loff_t *ppos) | 321 | loff_t *ppos) |
| 322 | { | 322 | { |
| 323 | struct net *net = current->nsproxy->net_ns; | 323 | struct net *net = current->nsproxy->net_ns; |
| 324 | char tmp[8]; | ||
| 325 | struct ctl_table tbl; | 324 | struct ctl_table tbl; |
| 326 | int ret; | 325 | bool changed = false; |
| 327 | int changed = 0; | ||
| 328 | char *none = "none"; | 326 | char *none = "none"; |
| 327 | char tmp[8]; | ||
| 328 | int ret; | ||
| 329 | 329 | ||
| 330 | memset(&tbl, 0, sizeof(struct ctl_table)); | 330 | memset(&tbl, 0, sizeof(struct ctl_table)); |
| 331 | 331 | ||
| 332 | if (write) { | 332 | if (write) { |
| 333 | tbl.data = tmp; | 333 | tbl.data = tmp; |
| 334 | tbl.maxlen = 8; | 334 | tbl.maxlen = sizeof(tmp); |
| 335 | } else { | 335 | } else { |
| 336 | tbl.data = net->sctp.sctp_hmac_alg ? : none; | 336 | tbl.data = net->sctp.sctp_hmac_alg ? : none; |
| 337 | tbl.maxlen = strlen(tbl.data); | 337 | tbl.maxlen = strlen(tbl.data); |
| 338 | } | 338 | } |
| 339 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); | ||
| 340 | 339 | ||
| 341 | if (write) { | 340 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
| 341 | if (write && ret == 0) { | ||
| 342 | #ifdef CONFIG_CRYPTO_MD5 | 342 | #ifdef CONFIG_CRYPTO_MD5 |
| 343 | if (!strncmp(tmp, "md5", 3)) { | 343 | if (!strncmp(tmp, "md5", 3)) { |
| 344 | net->sctp.sctp_hmac_alg = "md5"; | 344 | net->sctp.sctp_hmac_alg = "md5"; |
| 345 | changed = 1; | 345 | changed = true; |
| 346 | } | 346 | } |
| 347 | #endif | 347 | #endif |
| 348 | #ifdef CONFIG_CRYPTO_SHA1 | 348 | #ifdef CONFIG_CRYPTO_SHA1 |
| 349 | if (!strncmp(tmp, "sha1", 4)) { | 349 | if (!strncmp(tmp, "sha1", 4)) { |
| 350 | net->sctp.sctp_hmac_alg = "sha1"; | 350 | net->sctp.sctp_hmac_alg = "sha1"; |
| 351 | changed = 1; | 351 | changed = true; |
| 352 | } | 352 | } |
| 353 | #endif | 353 | #endif |
| 354 | if (!strncmp(tmp, "none", 4)) { | 354 | if (!strncmp(tmp, "none", 4)) { |
| 355 | net->sctp.sctp_hmac_alg = NULL; | 355 | net->sctp.sctp_hmac_alg = NULL; |
| 356 | changed = 1; | 356 | changed = true; |
| 357 | } | 357 | } |
| 358 | |||
| 359 | if (!changed) | 358 | if (!changed) |
| 360 | ret = -EINVAL; | 359 | ret = -EINVAL; |
| 361 | } | 360 | } |
| @@ -368,11 +367,10 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, | |||
| 368 | loff_t *ppos) | 367 | loff_t *ppos) |
| 369 | { | 368 | { |
| 370 | struct net *net = current->nsproxy->net_ns; | 369 | struct net *net = current->nsproxy->net_ns; |
| 371 | int new_value; | ||
| 372 | struct ctl_table tbl; | ||
| 373 | unsigned int min = *(unsigned int *) ctl->extra1; | 370 | unsigned int min = *(unsigned int *) ctl->extra1; |
| 374 | unsigned int max = *(unsigned int *) ctl->extra2; | 371 | unsigned int max = *(unsigned int *) ctl->extra2; |
| 375 | int ret; | 372 | struct ctl_table tbl; |
| 373 | int ret, new_value; | ||
| 376 | 374 | ||
| 377 | memset(&tbl, 0, sizeof(struct ctl_table)); | 375 | memset(&tbl, 0, sizeof(struct ctl_table)); |
| 378 | tbl.maxlen = sizeof(unsigned int); | 376 | tbl.maxlen = sizeof(unsigned int); |
| @@ -381,12 +379,15 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, | |||
| 381 | tbl.data = &new_value; | 379 | tbl.data = &new_value; |
| 382 | else | 380 | else |
| 383 | tbl.data = &net->sctp.rto_min; | 381 | tbl.data = &net->sctp.rto_min; |
| 382 | |||
| 384 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); | 383 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); |
| 385 | if (write) { | 384 | if (write && ret == 0) { |
| 386 | if (ret || new_value > max || new_value < min) | 385 | if (new_value > max || new_value < min) |
| 387 | return -EINVAL; | 386 | return -EINVAL; |
| 387 | |||
| 388 | net->sctp.rto_min = new_value; | 388 | net->sctp.rto_min = new_value; |
| 389 | } | 389 | } |
| 390 | |||
| 390 | return ret; | 391 | return ret; |
| 391 | } | 392 | } |
| 392 | 393 | ||
| @@ -395,11 +396,10 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, | |||
| 395 | loff_t *ppos) | 396 | loff_t *ppos) |
| 396 | { | 397 | { |
| 397 | struct net *net = current->nsproxy->net_ns; | 398 | struct net *net = current->nsproxy->net_ns; |
| 398 | int new_value; | ||
| 399 | struct ctl_table tbl; | ||
| 400 | unsigned int min = *(unsigned int *) ctl->extra1; | 399 | unsigned int min = *(unsigned int *) ctl->extra1; |
| 401 | unsigned int max = *(unsigned int *) ctl->extra2; | 400 | unsigned int max = *(unsigned int *) ctl->extra2; |
| 402 | int ret; | 401 | struct ctl_table tbl; |
| 402 | int ret, new_value; | ||
| 403 | 403 | ||
| 404 | memset(&tbl, 0, sizeof(struct ctl_table)); | 404 | memset(&tbl, 0, sizeof(struct ctl_table)); |
| 405 | tbl.maxlen = sizeof(unsigned int); | 405 | tbl.maxlen = sizeof(unsigned int); |
| @@ -408,12 +408,15 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, | |||
| 408 | tbl.data = &new_value; | 408 | tbl.data = &new_value; |
| 409 | else | 409 | else |
| 410 | tbl.data = &net->sctp.rto_max; | 410 | tbl.data = &net->sctp.rto_max; |
| 411 | |||
| 411 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); | 412 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); |
| 412 | if (write) { | 413 | if (write && ret == 0) { |
| 413 | if (ret || new_value > max || new_value < min) | 414 | if (new_value > max || new_value < min) |
| 414 | return -EINVAL; | 415 | return -EINVAL; |
| 416 | |||
| 415 | net->sctp.rto_max = new_value; | 417 | net->sctp.rto_max = new_value; |
| 416 | } | 418 | } |
| 419 | |||
| 417 | return ret; | 420 | return ret; |
| 418 | } | 421 | } |
| 419 | 422 | ||
| @@ -444,8 +447,7 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write, | |||
| 444 | tbl.data = &net->sctp.auth_enable; | 447 | tbl.data = &net->sctp.auth_enable; |
| 445 | 448 | ||
| 446 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); | 449 | ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); |
| 447 | 450 | if (write && ret == 0) { | |
| 448 | if (write) { | ||
| 449 | struct sock *sk = net->sctp.ctl_sock; | 451 | struct sock *sk = net->sctp.ctl_sock; |
| 450 | 452 | ||
| 451 | net->sctp.auth_enable = new_value; | 453 | net->sctp.auth_enable = new_value; |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 247e973544bf..f77366717420 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
| @@ -592,6 +592,7 @@ rpcauth_lookupcred(struct rpc_auth *auth, int flags) | |||
| 592 | put_group_info(acred.group_info); | 592 | put_group_info(acred.group_info); |
| 593 | return ret; | 593 | return ret; |
| 594 | } | 594 | } |
| 595 | EXPORT_SYMBOL_GPL(rpcauth_lookupcred); | ||
| 595 | 596 | ||
| 596 | void | 597 | void |
| 597 | rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, | 598 | rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, |
diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 6af373236d73..4b0113f73ee9 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h | |||
| @@ -56,7 +56,8 @@ | |||
| 56 | * struct: This defines the way the data will be stored in the ring buffer. | 56 | * struct: This defines the way the data will be stored in the ring buffer. |
| 57 | * There are currently two types of elements. __field and __array. | 57 | * There are currently two types of elements. __field and __array. |
| 58 | * a __field is broken up into (type, name). Where type can be any | 58 | * a __field is broken up into (type, name). Where type can be any |
| 59 | * type but an array. | 59 | * primitive type (integer, long or pointer). __field_struct() can |
| 60 | * be any static complex data value (struct, union, but not an array). | ||
| 60 | * For an array. there are three fields. (type, name, size). The | 61 | * For an array. there are three fields. (type, name, size). The |
| 61 | * type of elements in the array, the name of the field and the size | 62 | * type of elements in the array, the name of the field and the size |
| 62 | * of the array. | 63 | * of the array. |
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h index 9d1421e63ff8..49b582a225b0 100644 --- a/scripts/recordmcount.h +++ b/scripts/recordmcount.h | |||
| @@ -163,11 +163,11 @@ static int mcount_adjust = 0; | |||
| 163 | 163 | ||
| 164 | static int MIPS_is_fake_mcount(Elf_Rel const *rp) | 164 | static int MIPS_is_fake_mcount(Elf_Rel const *rp) |
| 165 | { | 165 | { |
| 166 | static Elf_Addr old_r_offset; | 166 | static Elf_Addr old_r_offset = ~(Elf_Addr)0; |
| 167 | Elf_Addr current_r_offset = _w(rp->r_offset); | 167 | Elf_Addr current_r_offset = _w(rp->r_offset); |
| 168 | int is_fake; | 168 | int is_fake; |
| 169 | 169 | ||
| 170 | is_fake = old_r_offset && | 170 | is_fake = (old_r_offset != ~(Elf_Addr)0) && |
| 171 | (current_r_offset - old_r_offset == MIPS_FAKEMCOUNT_OFFSET); | 171 | (current_r_offset - old_r_offset == MIPS_FAKEMCOUNT_OFFSET); |
| 172 | old_r_offset = current_r_offset; | 172 | old_r_offset = current_r_offset; |
| 173 | 173 | ||
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index b684c6e4f301..dabe41975a9d 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c | |||
| @@ -898,6 +898,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, | |||
| 898 | if (!strcmp(codec->modelname, models->name)) { | 898 | if (!strcmp(codec->modelname, models->name)) { |
| 899 | codec->fixup_id = models->id; | 899 | codec->fixup_id = models->id; |
| 900 | codec->fixup_name = models->name; | 900 | codec->fixup_name = models->name; |
| 901 | codec->fixup_list = fixlist; | ||
| 901 | codec->fixup_forced = 1; | 902 | codec->fixup_forced = 1; |
| 902 | return; | 903 | return; |
| 903 | } | 904 | } |
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c index e9e8a4a4a9a1..8b4940ba33d6 100644 --- a/sound/pci/hda/hda_i915.c +++ b/sound/pci/hda/hda_i915.c | |||
| @@ -20,10 +20,20 @@ | |||
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <sound/core.h> | 21 | #include <sound/core.h> |
| 22 | #include <drm/i915_powerwell.h> | 22 | #include <drm/i915_powerwell.h> |
| 23 | #include "hda_priv.h" | ||
| 23 | #include "hda_i915.h" | 24 | #include "hda_i915.h" |
| 24 | 25 | ||
| 26 | /* Intel HSW/BDW display HDA controller Extended Mode registers. | ||
| 27 | * EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display | ||
| 28 | * Clock) to 24MHz BCLK: BCLK = CDCLK * M / N | ||
| 29 | * The values will be lost when the display power well is disabled. | ||
| 30 | */ | ||
| 31 | #define ICH6_REG_EM4 0x100c | ||
| 32 | #define ICH6_REG_EM5 0x1010 | ||
| 33 | |||
| 25 | static int (*get_power)(void); | 34 | static int (*get_power)(void); |
| 26 | static int (*put_power)(void); | 35 | static int (*put_power)(void); |
| 36 | static int (*get_cdclk)(void); | ||
| 27 | 37 | ||
| 28 | int hda_display_power(bool enable) | 38 | int hda_display_power(bool enable) |
| 29 | { | 39 | { |
| @@ -38,6 +48,43 @@ int hda_display_power(bool enable) | |||
| 38 | return put_power(); | 48 | return put_power(); |
| 39 | } | 49 | } |
| 40 | 50 | ||
| 51 | void haswell_set_bclk(struct azx *chip) | ||
| 52 | { | ||
| 53 | int cdclk_freq; | ||
| 54 | unsigned int bclk_m, bclk_n; | ||
| 55 | |||
| 56 | if (!get_cdclk) | ||
| 57 | return; | ||
| 58 | |||
| 59 | cdclk_freq = get_cdclk(); | ||
| 60 | switch (cdclk_freq) { | ||
| 61 | case 337500: | ||
| 62 | bclk_m = 16; | ||
| 63 | bclk_n = 225; | ||
| 64 | break; | ||
| 65 | |||
| 66 | case 450000: | ||
| 67 | default: /* default CDCLK 450MHz */ | ||
| 68 | bclk_m = 4; | ||
| 69 | bclk_n = 75; | ||
| 70 | break; | ||
| 71 | |||
| 72 | case 540000: | ||
| 73 | bclk_m = 4; | ||
| 74 | bclk_n = 90; | ||
| 75 | break; | ||
| 76 | |||
| 77 | case 675000: | ||
| 78 | bclk_m = 8; | ||
| 79 | bclk_n = 225; | ||
| 80 | break; | ||
| 81 | } | ||
| 82 | |||
| 83 | azx_writew(chip, EM4, bclk_m); | ||
| 84 | azx_writew(chip, EM5, bclk_n); | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 41 | int hda_i915_init(void) | 88 | int hda_i915_init(void) |
| 42 | { | 89 | { |
| 43 | int err = 0; | 90 | int err = 0; |
| @@ -55,6 +102,10 @@ int hda_i915_init(void) | |||
| 55 | return -ENODEV; | 102 | return -ENODEV; |
| 56 | } | 103 | } |
| 57 | 104 | ||
| 105 | get_cdclk = symbol_request(i915_get_cdclk_freq); | ||
| 106 | if (!get_cdclk) /* may have abnormal BCLK and audio playback rate */ | ||
| 107 | pr_warn("hda-i915: get_cdclk symbol get fail\n"); | ||
| 108 | |||
| 58 | pr_debug("HDA driver get symbol successfully from i915 module\n"); | 109 | pr_debug("HDA driver get symbol successfully from i915 module\n"); |
| 59 | 110 | ||
| 60 | return err; | 111 | return err; |
| @@ -70,6 +121,10 @@ int hda_i915_exit(void) | |||
| 70 | symbol_put(i915_release_power_well); | 121 | symbol_put(i915_release_power_well); |
| 71 | put_power = NULL; | 122 | put_power = NULL; |
| 72 | } | 123 | } |
| 124 | if (get_cdclk) { | ||
| 125 | symbol_put(i915_get_cdclk_freq); | ||
| 126 | get_cdclk = NULL; | ||
| 127 | } | ||
| 73 | 128 | ||
| 74 | return 0; | 129 | return 0; |
| 75 | } | 130 | } |
diff --git a/sound/pci/hda/hda_i915.h b/sound/pci/hda/hda_i915.h index bfd835f8f1aa..e6072c627583 100644 --- a/sound/pci/hda/hda_i915.h +++ b/sound/pci/hda/hda_i915.h | |||
| @@ -18,10 +18,12 @@ | |||
| 18 | 18 | ||
| 19 | #ifdef CONFIG_SND_HDA_I915 | 19 | #ifdef CONFIG_SND_HDA_I915 |
| 20 | int hda_display_power(bool enable); | 20 | int hda_display_power(bool enable); |
| 21 | void haswell_set_bclk(struct azx *chip); | ||
| 21 | int hda_i915_init(void); | 22 | int hda_i915_init(void); |
| 22 | int hda_i915_exit(void); | 23 | int hda_i915_exit(void); |
| 23 | #else | 24 | #else |
| 24 | static inline int hda_display_power(bool enable) { return 0; } | 25 | static inline int hda_display_power(bool enable) { return 0; } |
| 26 | static inline void haswell_set_bclk(struct azx *chip) { return; } | ||
| 25 | static inline int hda_i915_init(void) | 27 | static inline int hda_i915_init(void) |
| 26 | { | 28 | { |
| 27 | return -ENODEV; | 29 | return -ENODEV; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 23fd6b9aecca..b6b4e71a0b0b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -62,9 +62,9 @@ | |||
| 62 | #include <linux/vga_switcheroo.h> | 62 | #include <linux/vga_switcheroo.h> |
| 63 | #include <linux/firmware.h> | 63 | #include <linux/firmware.h> |
| 64 | #include "hda_codec.h" | 64 | #include "hda_codec.h" |
| 65 | #include "hda_i915.h" | ||
| 66 | #include "hda_controller.h" | 65 | #include "hda_controller.h" |
| 67 | #include "hda_priv.h" | 66 | #include "hda_priv.h" |
| 67 | #include "hda_i915.h" | ||
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 70 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| @@ -288,6 +288,11 @@ static char *driver_short_names[] = { | |||
| 288 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", | 288 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", |
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | struct hda_intel { | ||
| 292 | struct azx chip; | ||
| 293 | }; | ||
| 294 | |||
| 295 | |||
| 291 | #ifdef CONFIG_X86 | 296 | #ifdef CONFIG_X86 |
| 292 | static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) | 297 | static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) |
| 293 | { | 298 | { |
| @@ -606,6 +611,7 @@ static int azx_suspend(struct device *dev) | |||
| 606 | free_irq(chip->irq, chip); | 611 | free_irq(chip->irq, chip); |
| 607 | chip->irq = -1; | 612 | chip->irq = -1; |
| 608 | } | 613 | } |
| 614 | |||
| 609 | if (chip->msi) | 615 | if (chip->msi) |
| 610 | pci_disable_msi(chip->pci); | 616 | pci_disable_msi(chip->pci); |
| 611 | pci_disable_device(pci); | 617 | pci_disable_device(pci); |
| @@ -625,8 +631,10 @@ static int azx_resume(struct device *dev) | |||
| 625 | if (chip->disabled) | 631 | if (chip->disabled) |
| 626 | return 0; | 632 | return 0; |
| 627 | 633 | ||
| 628 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 634 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
| 629 | hda_display_power(true); | 635 | hda_display_power(true); |
| 636 | haswell_set_bclk(chip); | ||
| 637 | } | ||
| 630 | pci_set_power_state(pci, PCI_D0); | 638 | pci_set_power_state(pci, PCI_D0); |
| 631 | pci_restore_state(pci); | 639 | pci_restore_state(pci); |
| 632 | if (pci_enable_device(pci) < 0) { | 640 | if (pci_enable_device(pci) < 0) { |
| @@ -672,6 +680,7 @@ static int azx_runtime_suspend(struct device *dev) | |||
| 672 | azx_clear_irq_pending(chip); | 680 | azx_clear_irq_pending(chip); |
| 673 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 681 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
| 674 | hda_display_power(false); | 682 | hda_display_power(false); |
| 683 | |||
| 675 | return 0; | 684 | return 0; |
| 676 | } | 685 | } |
| 677 | 686 | ||
| @@ -689,8 +698,10 @@ static int azx_runtime_resume(struct device *dev) | |||
| 689 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) | 698 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) |
| 690 | return 0; | 699 | return 0; |
| 691 | 700 | ||
| 692 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 701 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
| 693 | hda_display_power(true); | 702 | hda_display_power(true); |
| 703 | haswell_set_bclk(chip); | ||
| 704 | } | ||
| 694 | 705 | ||
| 695 | /* Read STATESTS before controller reset */ | 706 | /* Read STATESTS before controller reset */ |
| 696 | status = azx_readw(chip, STATESTS); | 707 | status = azx_readw(chip, STATESTS); |
| @@ -883,6 +894,8 @@ static int register_vga_switcheroo(struct azx *chip) | |||
| 883 | static int azx_free(struct azx *chip) | 894 | static int azx_free(struct azx *chip) |
| 884 | { | 895 | { |
| 885 | struct pci_dev *pci = chip->pci; | 896 | struct pci_dev *pci = chip->pci; |
| 897 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); | ||
| 898 | |||
| 886 | int i; | 899 | int i; |
| 887 | 900 | ||
| 888 | if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) | 901 | if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) |
| @@ -930,7 +943,7 @@ static int azx_free(struct azx *chip) | |||
| 930 | hda_display_power(false); | 943 | hda_display_power(false); |
| 931 | hda_i915_exit(); | 944 | hda_i915_exit(); |
| 932 | } | 945 | } |
| 933 | kfree(chip); | 946 | kfree(hda); |
| 934 | 947 | ||
| 935 | return 0; | 948 | return 0; |
| 936 | } | 949 | } |
| @@ -1174,6 +1187,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, | |||
| 1174 | static struct snd_device_ops ops = { | 1187 | static struct snd_device_ops ops = { |
| 1175 | .dev_free = azx_dev_free, | 1188 | .dev_free = azx_dev_free, |
| 1176 | }; | 1189 | }; |
| 1190 | struct hda_intel *hda; | ||
| 1177 | struct azx *chip; | 1191 | struct azx *chip; |
| 1178 | int err; | 1192 | int err; |
| 1179 | 1193 | ||
| @@ -1183,13 +1197,14 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, | |||
| 1183 | if (err < 0) | 1197 | if (err < 0) |
| 1184 | return err; | 1198 | return err; |
| 1185 | 1199 | ||
| 1186 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1200 | hda = kzalloc(sizeof(*hda), GFP_KERNEL); |
| 1187 | if (!chip) { | 1201 | if (!hda) { |
| 1188 | dev_err(card->dev, "Cannot allocate chip\n"); | 1202 | dev_err(card->dev, "Cannot allocate hda\n"); |
| 1189 | pci_disable_device(pci); | 1203 | pci_disable_device(pci); |
| 1190 | return -ENOMEM; | 1204 | return -ENOMEM; |
| 1191 | } | 1205 | } |
| 1192 | 1206 | ||
| 1207 | chip = &hda->chip; | ||
| 1193 | spin_lock_init(&chip->reg_lock); | 1208 | spin_lock_init(&chip->reg_lock); |
| 1194 | mutex_init(&chip->open_mutex); | 1209 | mutex_init(&chip->open_mutex); |
| 1195 | chip->card = card; | 1210 | chip->card = card; |
| @@ -1375,6 +1390,10 @@ static int azx_first_init(struct azx *chip) | |||
| 1375 | 1390 | ||
| 1376 | /* initialize chip */ | 1391 | /* initialize chip */ |
| 1377 | azx_init_pci(chip); | 1392 | azx_init_pci(chip); |
| 1393 | |||
| 1394 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | ||
| 1395 | haswell_set_bclk(chip); | ||
| 1396 | |||
| 1378 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); | 1397 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); |
| 1379 | 1398 | ||
| 1380 | /* codec detection */ | 1399 | /* codec detection */ |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index ebd1fa6f015c..4e2d4863daa1 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
| @@ -417,6 +417,27 @@ struct snd_hda_pin_quirk { | |||
| 417 | int value; /* quirk value */ | 417 | int value; /* quirk value */ |
| 418 | }; | 418 | }; |
| 419 | 419 | ||
| 420 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
| 421 | |||
| 422 | #define SND_HDA_PIN_QUIRK(_codec, _subvendor, _name, _value, _pins...) \ | ||
| 423 | { .codec = _codec,\ | ||
| 424 | .subvendor = _subvendor,\ | ||
| 425 | .name = _name,\ | ||
| 426 | .value = _value,\ | ||
| 427 | .pins = (const struct hda_pintbl[]) { _pins } \ | ||
| 428 | } | ||
| 429 | #else | ||
| 430 | |||
| 431 | #define SND_HDA_PIN_QUIRK(_codec, _subvendor, _name, _value, _pins...) \ | ||
| 432 | { .codec = _codec,\ | ||
| 433 | .subvendor = _subvendor,\ | ||
| 434 | .value = _value,\ | ||
| 435 | .pins = (const struct hda_pintbl[]) { _pins } \ | ||
| 436 | } | ||
| 437 | |||
| 438 | #endif | ||
| 439 | |||
| 440 | |||
| 420 | /* fixup types */ | 441 | /* fixup types */ |
| 421 | enum { | 442 | enum { |
| 422 | HDA_FIXUP_INVALID, | 443 | HDA_FIXUP_INVALID, |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 3e4417b0ddbe..4fe876b65fda 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
| @@ -2204,7 +2204,7 @@ static int generic_hdmi_resume(struct hda_codec *codec) | |||
| 2204 | struct hdmi_spec *spec = codec->spec; | 2204 | struct hdmi_spec *spec = codec->spec; |
| 2205 | int pin_idx; | 2205 | int pin_idx; |
| 2206 | 2206 | ||
| 2207 | generic_hdmi_init(codec); | 2207 | codec->patch_ops.init(codec); |
| 2208 | snd_hda_codec_resume_amp(codec); | 2208 | snd_hda_codec_resume_amp(codec); |
| 2209 | snd_hda_codec_resume_cache(codec); | 2209 | snd_hda_codec_resume_cache(codec); |
| 2210 | 2210 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index af76995fa966..b60824e90408 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -4880,6 +4880,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
| 4880 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), | 4880 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), |
| 4881 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), | 4881 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), |
| 4882 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), | 4882 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), |
| 4883 | SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), | ||
| 4883 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4884 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 4884 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4885 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 4885 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4886 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| @@ -4962,228 +4963,141 @@ static const struct hda_model_fixup alc269_fixup_models[] = { | |||
| 4962 | }; | 4963 | }; |
| 4963 | 4964 | ||
| 4964 | static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | 4965 | static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
| 4965 | { | 4966 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 4966 | .codec = 0x10ec0255, | 4967 | {0x12, 0x90a60140}, |
| 4967 | .subvendor = 0x1028, | 4968 | {0x14, 0x90170110}, |
| 4968 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 4969 | {0x17, 0x40000000}, |
| 4969 | .name = "Dell", | 4970 | {0x18, 0x411111f0}, |
| 4970 | #endif | 4971 | {0x19, 0x411111f0}, |
| 4971 | .pins = (const struct hda_pintbl[]) { | 4972 | {0x1a, 0x411111f0}, |
| 4972 | {0x12, 0x90a60140}, | 4973 | {0x1b, 0x411111f0}, |
| 4973 | {0x14, 0x90170110}, | 4974 | {0x1d, 0x40700001}, |
| 4974 | {0x17, 0x40000000}, | 4975 | {0x1e, 0x411111f0}, |
| 4975 | {0x18, 0x411111f0}, | 4976 | {0x21, 0x02211020}), |
| 4976 | {0x19, 0x411111f0}, | 4977 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 4977 | {0x1a, 0x411111f0}, | 4978 | {0x12, 0x90a60160}, |
| 4978 | {0x1b, 0x411111f0}, | 4979 | {0x14, 0x90170120}, |
| 4979 | {0x1d, 0x40700001}, | 4980 | {0x17, 0x40000000}, |
| 4980 | {0x1e, 0x411111f0}, | 4981 | {0x18, 0x411111f0}, |
| 4981 | {0x21, 0x02211020}, | 4982 | {0x19, 0x411111f0}, |
| 4982 | }, | 4983 | {0x1a, 0x411111f0}, |
| 4983 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 4984 | {0x1b, 0x411111f0}, |
| 4984 | }, | 4985 | {0x1d, 0x40700001}, |
| 4985 | { | 4986 | {0x1e, 0x411111f0}, |
| 4986 | .codec = 0x10ec0255, | 4987 | {0x21, 0x02211030}), |
| 4987 | .subvendor = 0x1028, | 4988 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 4988 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 4989 | {0x12, 0x90a60160}, |
| 4989 | .name = "Dell", | 4990 | {0x14, 0x90170120}, |
| 4990 | #endif | 4991 | {0x17, 0x90170140}, |
| 4991 | .pins = (const struct hda_pintbl[]) { | 4992 | {0x18, 0x40000000}, |
| 4992 | {0x12, 0x90a60160}, | 4993 | {0x19, 0x411111f0}, |
| 4993 | {0x14, 0x90170120}, | 4994 | {0x1a, 0x411111f0}, |
| 4994 | {0x17, 0x40000000}, | 4995 | {0x1b, 0x411111f0}, |
| 4995 | {0x18, 0x411111f0}, | 4996 | {0x1d, 0x41163b05}, |
| 4996 | {0x19, 0x411111f0}, | 4997 | {0x1e, 0x411111f0}, |
| 4997 | {0x1a, 0x411111f0}, | 4998 | {0x21, 0x0321102f}), |
| 4998 | {0x1b, 0x411111f0}, | 4999 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 4999 | {0x1d, 0x40700001}, | 5000 | {0x12, 0x90a60160}, |
| 5000 | {0x1e, 0x411111f0}, | 5001 | {0x14, 0x90170130}, |
| 5001 | {0x21, 0x02211030}, | 5002 | {0x17, 0x40000000}, |
| 5002 | }, | 5003 | {0x18, 0x411111f0}, |
| 5003 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5004 | {0x19, 0x411111f0}, |
| 5004 | }, | 5005 | {0x1a, 0x411111f0}, |
| 5005 | { | 5006 | {0x1b, 0x411111f0}, |
| 5006 | .codec = 0x10ec0255, | 5007 | {0x1d, 0x40700001}, |
| 5007 | .subvendor = 0x1028, | 5008 | {0x1e, 0x411111f0}, |
| 5008 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5009 | {0x21, 0x02211040}), |
| 5009 | .name = "Dell", | 5010 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 5010 | #endif | 5011 | {0x12, 0x90a60160}, |
| 5011 | .pins = (const struct hda_pintbl[]) { | 5012 | {0x14, 0x90170140}, |
| 5012 | {0x12, 0x90a60160}, | 5013 | {0x17, 0x40000000}, |
| 5013 | {0x14, 0x90170120}, | 5014 | {0x18, 0x411111f0}, |
| 5014 | {0x17, 0x90170140}, | 5015 | {0x19, 0x411111f0}, |
| 5015 | {0x18, 0x40000000}, | 5016 | {0x1a, 0x411111f0}, |
| 5016 | {0x19, 0x411111f0}, | 5017 | {0x1b, 0x411111f0}, |
| 5017 | {0x1a, 0x411111f0}, | 5018 | {0x1d, 0x40700001}, |
| 5018 | {0x1b, 0x411111f0}, | 5019 | {0x1e, 0x411111f0}, |
| 5019 | {0x1d, 0x41163b05}, | 5020 | {0x21, 0x02211050}), |
| 5020 | {0x1e, 0x411111f0}, | 5021 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 5021 | {0x21, 0x0321102f}, | 5022 | {0x12, 0x90a60170}, |
| 5022 | }, | 5023 | {0x14, 0x90170120}, |
| 5023 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5024 | {0x17, 0x40000000}, |
| 5024 | }, | 5025 | {0x18, 0x411111f0}, |
| 5025 | { | 5026 | {0x19, 0x411111f0}, |
| 5026 | .codec = 0x10ec0255, | 5027 | {0x1a, 0x411111f0}, |
| 5027 | .subvendor = 0x1028, | 5028 | {0x1b, 0x411111f0}, |
| 5028 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5029 | {0x1d, 0x40700001}, |
| 5029 | .name = "Dell", | 5030 | {0x1e, 0x411111f0}, |
| 5030 | #endif | 5031 | {0x21, 0x02211030}), |
| 5031 | .pins = (const struct hda_pintbl[]) { | 5032 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 5032 | {0x12, 0x90a60160}, | 5033 | {0x12, 0x90a60170}, |
| 5033 | {0x14, 0x90170130}, | 5034 | {0x14, 0x90170130}, |
| 5034 | {0x17, 0x40000000}, | 5035 | {0x17, 0x40000000}, |
| 5035 | {0x18, 0x411111f0}, | 5036 | {0x18, 0x411111f0}, |
| 5036 | {0x19, 0x411111f0}, | 5037 | {0x19, 0x411111f0}, |
| 5037 | {0x1a, 0x411111f0}, | 5038 | {0x1a, 0x411111f0}, |
| 5038 | {0x1b, 0x411111f0}, | 5039 | {0x1b, 0x411111f0}, |
| 5039 | {0x1d, 0x40700001}, | 5040 | {0x1d, 0x40700001}, |
| 5040 | {0x1e, 0x411111f0}, | 5041 | {0x1e, 0x411111f0}, |
| 5041 | {0x21, 0x02211040}, | 5042 | {0x21, 0x02211040}), |
| 5042 | }, | 5043 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 5043 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5044 | {0x12, 0x90a60130}, |
| 5044 | }, | 5045 | {0x14, 0x90170110}, |
| 5045 | { | 5046 | {0x17, 0x40020008}, |
| 5046 | .codec = 0x10ec0255, | 5047 | {0x18, 0x411111f0}, |
| 5047 | .subvendor = 0x1028, | 5048 | {0x19, 0x411111f0}, |
| 5048 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5049 | {0x1a, 0x411111f0}, |
| 5049 | .name = "Dell", | 5050 | {0x1b, 0x411111f0}, |
| 5050 | #endif | 5051 | {0x1d, 0x40e00001}, |
| 5051 | .pins = (const struct hda_pintbl[]) { | 5052 | {0x1e, 0x411111f0}, |
| 5052 | {0x12, 0x90a60160}, | 5053 | {0x21, 0x0321101f}), |
| 5053 | {0x14, 0x90170140}, | 5054 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 5054 | {0x17, 0x40000000}, | 5055 | {0x12, 0x90a60160}, |
| 5055 | {0x18, 0x411111f0}, | 5056 | {0x14, 0x90170120}, |
| 5056 | {0x19, 0x411111f0}, | 5057 | {0x17, 0x40000000}, |
| 5057 | {0x1a, 0x411111f0}, | 5058 | {0x18, 0x411111f0}, |
| 5058 | {0x1b, 0x411111f0}, | 5059 | {0x19, 0x411111f0}, |
| 5059 | {0x1d, 0x40700001}, | 5060 | {0x1a, 0x411111f0}, |
| 5060 | {0x1e, 0x411111f0}, | 5061 | {0x1b, 0x411111f0}, |
| 5061 | {0x21, 0x02211050}, | 5062 | {0x1d, 0x40700001}, |
| 5062 | }, | 5063 | {0x1e, 0x411111f0}, |
| 5063 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5064 | {0x21, 0x02211030}), |
| 5064 | }, | 5065 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, |
| 5065 | { | 5066 | {0x12, 0x90a60140}, |
| 5066 | .codec = 0x10ec0255, | 5067 | {0x13, 0x411111f0}, |
| 5067 | .subvendor = 0x1028, | 5068 | {0x14, 0x90170110}, |
| 5068 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5069 | {0x15, 0x0221401f}, |
| 5069 | .name = "Dell", | 5070 | {0x16, 0x411111f0}, |
| 5070 | #endif | 5071 | {0x18, 0x411111f0}, |
| 5071 | .pins = (const struct hda_pintbl[]) { | 5072 | {0x19, 0x411111f0}, |
| 5072 | {0x12, 0x90a60170}, | 5073 | {0x1a, 0x411111f0}, |
| 5073 | {0x14, 0x90170120}, | 5074 | {0x1b, 0x411111f0}, |
| 5074 | {0x17, 0x40000000}, | 5075 | {0x1d, 0x40700001}, |
| 5075 | {0x18, 0x411111f0}, | 5076 | {0x1e, 0x411111f0}), |
| 5076 | {0x19, 0x411111f0}, | 5077 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 5077 | {0x1a, 0x411111f0}, | 5078 | {0x12, 0x40000000}, |
| 5078 | {0x1b, 0x411111f0}, | 5079 | {0x13, 0x90a60140}, |
| 5079 | {0x1d, 0x40700001}, | 5080 | {0x14, 0x90170110}, |
| 5080 | {0x1e, 0x411111f0}, | 5081 | {0x15, 0x0221401f}, |
| 5081 | {0x21, 0x02211030}, | 5082 | {0x16, 0x21014020}, |
| 5082 | }, | 5083 | {0x18, 0x411111f0}, |
| 5083 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5084 | {0x19, 0x21a19030}, |
| 5084 | }, | 5085 | {0x1a, 0x411111f0}, |
| 5085 | { | 5086 | {0x1b, 0x411111f0}, |
| 5086 | .codec = 0x10ec0255, | 5087 | {0x1d, 0x40700001}, |
| 5087 | .subvendor = 0x1028, | 5088 | {0x1e, 0x411111f0}), |
| 5088 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5089 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 5089 | .name = "Dell", | 5090 | {0x12, 0x40000000}, |
| 5090 | #endif | 5091 | {0x13, 0x90a60140}, |
| 5091 | .pins = (const struct hda_pintbl[]) { | 5092 | {0x14, 0x90170110}, |
| 5092 | {0x12, 0x90a60170}, | 5093 | {0x15, 0x0221401f}, |
| 5093 | {0x14, 0x90170130}, | 5094 | {0x16, 0x411111f0}, |
| 5094 | {0x17, 0x40000000}, | 5095 | {0x18, 0x411111f0}, |
| 5095 | {0x18, 0x411111f0}, | 5096 | {0x19, 0x411111f0}, |
| 5096 | {0x19, 0x411111f0}, | 5097 | {0x1a, 0x411111f0}, |
| 5097 | {0x1a, 0x411111f0}, | 5098 | {0x1b, 0x411111f0}, |
| 5098 | {0x1b, 0x411111f0}, | 5099 | {0x1d, 0x40700001}, |
| 5099 | {0x1d, 0x40700001}, | 5100 | {0x1e, 0x411111f0}), |
| 5100 | {0x1e, 0x411111f0}, | ||
| 5101 | {0x21, 0x02211040}, | ||
| 5102 | }, | ||
| 5103 | .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
| 5104 | }, | ||
| 5105 | { | ||
| 5106 | .codec = 0x10ec0283, | ||
| 5107 | .subvendor = 0x1028, | ||
| 5108 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
| 5109 | .name = "Dell", | ||
| 5110 | #endif | ||
| 5111 | .pins = (const struct hda_pintbl[]) { | ||
| 5112 | {0x12, 0x90a60130}, | ||
| 5113 | {0x14, 0x90170110}, | ||
| 5114 | {0x17, 0x40020008}, | ||
| 5115 | {0x18, 0x411111f0}, | ||
| 5116 | {0x19, 0x411111f0}, | ||
| 5117 | {0x1a, 0x411111f0}, | ||
| 5118 | {0x1b, 0x411111f0}, | ||
| 5119 | {0x1d, 0x40e00001}, | ||
| 5120 | {0x1e, 0x411111f0}, | ||
| 5121 | {0x21, 0x0321101f}, | ||
| 5122 | }, | ||
| 5123 | .value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
| 5124 | }, | ||
| 5125 | { | ||
| 5126 | .codec = 0x10ec0283, | ||
| 5127 | .subvendor = 0x1028, | ||
| 5128 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
| 5129 | .name = "Dell", | ||
| 5130 | #endif | ||
| 5131 | .pins = (const struct hda_pintbl[]) { | ||
| 5132 | {0x12, 0x90a60160}, | ||
| 5133 | {0x14, 0x90170120}, | ||
| 5134 | {0x17, 0x40000000}, | ||
| 5135 | {0x18, 0x411111f0}, | ||
| 5136 | {0x19, 0x411111f0}, | ||
| 5137 | {0x1a, 0x411111f0}, | ||
| 5138 | {0x1b, 0x411111f0}, | ||
| 5139 | {0x1d, 0x40700001}, | ||
| 5140 | {0x1e, 0x411111f0}, | ||
| 5141 | {0x21, 0x02211030}, | ||
| 5142 | }, | ||
| 5143 | .value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
| 5144 | }, | ||
| 5145 | { | ||
| 5146 | .codec = 0x10ec0292, | ||
| 5147 | .subvendor = 0x1028, | ||
| 5148 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
| 5149 | .name = "Dell", | ||
| 5150 | #endif | ||
| 5151 | .pins = (const struct hda_pintbl[]) { | ||
| 5152 | {0x12, 0x90a60140}, | ||
| 5153 | {0x13, 0x411111f0}, | ||
| 5154 | {0x14, 0x90170110}, | ||
| 5155 | {0x15, 0x0221401f}, | ||
| 5156 | {0x16, 0x411111f0}, | ||
| 5157 | {0x18, 0x411111f0}, | ||
| 5158 | {0x19, 0x411111f0}, | ||
| 5159 | {0x1a, 0x411111f0}, | ||
| 5160 | {0x1b, 0x411111f0}, | ||
| 5161 | {0x1d, 0x40700001}, | ||
| 5162 | {0x1e, 0x411111f0}, | ||
| 5163 | }, | ||
| 5164 | .value = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, | ||
| 5165 | }, | ||
| 5166 | { | ||
| 5167 | .codec = 0x10ec0293, | ||
| 5168 | .subvendor = 0x1028, | ||
| 5169 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
| 5170 | .name = "Dell", | ||
| 5171 | #endif | ||
| 5172 | .pins = (const struct hda_pintbl[]) { | ||
| 5173 | {0x12, 0x40000000}, | ||
| 5174 | {0x13, 0x90a60140}, | ||
| 5175 | {0x14, 0x90170110}, | ||
| 5176 | {0x15, 0x0221401f}, | ||
| 5177 | {0x16, 0x21014020}, | ||
| 5178 | {0x18, 0x411111f0}, | ||
| 5179 | {0x19, 0x21a19030}, | ||
| 5180 | {0x1a, 0x411111f0}, | ||
| 5181 | {0x1b, 0x411111f0}, | ||
| 5182 | {0x1d, 0x40700001}, | ||
| 5183 | {0x1e, 0x411111f0}, | ||
| 5184 | }, | ||
| 5185 | .value = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
| 5186 | }, | ||
| 5187 | {} | 5101 | {} |
| 5188 | }; | 5102 | }; |
| 5189 | 5103 | ||
| @@ -6039,90 +5953,66 @@ static const struct hda_model_fixup alc662_fixup_models[] = { | |||
| 6039 | }; | 5953 | }; |
| 6040 | 5954 | ||
| 6041 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { | 5955 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { |
| 6042 | { | 5956 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
| 6043 | .codec = 0x10ec0668, | 5957 | {0x12, 0x99a30130}, |
| 6044 | .subvendor = 0x1028, | 5958 | {0x14, 0x90170110}, |
| 6045 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5959 | {0x15, 0x0321101f}, |
| 6046 | .name = "Dell", | 5960 | {0x16, 0x03011020}, |
| 6047 | #endif | 5961 | {0x18, 0x40000008}, |
| 6048 | .pins = (const struct hda_pintbl[]) { | 5962 | {0x19, 0x411111f0}, |
| 6049 | {0x12, 0x99a30130}, | 5963 | {0x1a, 0x411111f0}, |
| 6050 | {0x14, 0x90170110}, | 5964 | {0x1b, 0x411111f0}, |
| 6051 | {0x15, 0x0321101f}, | 5965 | {0x1d, 0x41000001}, |
| 6052 | {0x16, 0x03011020}, | 5966 | {0x1e, 0x411111f0}, |
| 6053 | {0x18, 0x40000008}, | 5967 | {0x1f, 0x411111f0}), |
| 6054 | {0x19, 0x411111f0}, | 5968 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
| 6055 | {0x1a, 0x411111f0}, | 5969 | {0x12, 0x99a30140}, |
| 6056 | {0x1b, 0x411111f0}, | 5970 | {0x14, 0x90170110}, |
| 6057 | {0x1d, 0x41000001}, | 5971 | {0x15, 0x0321101f}, |
| 6058 | {0x1e, 0x411111f0}, | 5972 | {0x16, 0x03011020}, |
| 6059 | {0x1f, 0x411111f0}, | 5973 | {0x18, 0x40000008}, |
| 6060 | }, | 5974 | {0x19, 0x411111f0}, |
| 6061 | .value = ALC668_FIXUP_AUTO_MUTE, | 5975 | {0x1a, 0x411111f0}, |
| 6062 | }, | 5976 | {0x1b, 0x411111f0}, |
| 6063 | { | 5977 | {0x1d, 0x41000001}, |
| 6064 | .codec = 0x10ec0668, | 5978 | {0x1e, 0x411111f0}, |
| 6065 | .subvendor = 0x1028, | 5979 | {0x1f, 0x411111f0}), |
| 6066 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 5980 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
| 6067 | .name = "Dell", | 5981 | {0x12, 0x99a30150}, |
| 6068 | #endif | 5982 | {0x14, 0x90170110}, |
| 6069 | .pins = (const struct hda_pintbl[]) { | 5983 | {0x15, 0x0321101f}, |
| 6070 | {0x12, 0x99a30140}, | 5984 | {0x16, 0x03011020}, |
| 6071 | {0x14, 0x90170110}, | 5985 | {0x18, 0x40000008}, |
| 6072 | {0x15, 0x0321101f}, | 5986 | {0x19, 0x411111f0}, |
| 6073 | {0x16, 0x03011020}, | 5987 | {0x1a, 0x411111f0}, |
| 6074 | {0x18, 0x40000008}, | 5988 | {0x1b, 0x411111f0}, |
| 6075 | {0x19, 0x411111f0}, | 5989 | {0x1d, 0x41000001}, |
| 6076 | {0x1a, 0x411111f0}, | 5990 | {0x1e, 0x411111f0}, |
| 6077 | {0x1b, 0x411111f0}, | 5991 | {0x1f, 0x411111f0}), |
| 6078 | {0x1d, 0x41000001}, | 5992 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
| 6079 | {0x1e, 0x411111f0}, | 5993 | {0x12, 0x411111f0}, |
| 6080 | {0x1f, 0x411111f0}, | 5994 | {0x14, 0x90170110}, |
| 6081 | }, | 5995 | {0x15, 0x0321101f}, |
| 6082 | .value = ALC668_FIXUP_AUTO_MUTE, | 5996 | {0x16, 0x03011020}, |
| 6083 | }, | 5997 | {0x18, 0x40000008}, |
| 6084 | { | 5998 | {0x19, 0x411111f0}, |
| 6085 | .codec = 0x10ec0668, | 5999 | {0x1a, 0x411111f0}, |
| 6086 | .subvendor = 0x1028, | 6000 | {0x1b, 0x411111f0}, |
| 6087 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 6001 | {0x1d, 0x41000001}, |
| 6088 | .name = "Dell", | 6002 | {0x1e, 0x411111f0}, |
| 6089 | #endif | 6003 | {0x1f, 0x411111f0}), |
| 6090 | .pins = (const struct hda_pintbl[]) { | 6004 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE, |
| 6091 | {0x12, 0x99a30150}, | 6005 | {0x12, 0x90a60130}, |
| 6092 | {0x14, 0x90170110}, | 6006 | {0x14, 0x90170110}, |
| 6093 | {0x15, 0x0321101f}, | 6007 | {0x15, 0x0321101f}, |
| 6094 | {0x16, 0x03011020}, | 6008 | {0x16, 0x40000000}, |
| 6095 | {0x18, 0x40000008}, | 6009 | {0x18, 0x411111f0}, |
| 6096 | {0x19, 0x411111f0}, | 6010 | {0x19, 0x411111f0}, |
| 6097 | {0x1a, 0x411111f0}, | 6011 | {0x1a, 0x411111f0}, |
| 6098 | {0x1b, 0x411111f0}, | 6012 | {0x1b, 0x411111f0}, |
| 6099 | {0x1d, 0x41000001}, | 6013 | {0x1d, 0x40d6832d}, |
| 6100 | {0x1e, 0x411111f0}, | 6014 | {0x1e, 0x411111f0}, |
| 6101 | {0x1f, 0x411111f0}, | 6015 | {0x1f, 0x411111f0}), |
| 6102 | }, | ||
| 6103 | .value = ALC668_FIXUP_AUTO_MUTE, | ||
| 6104 | }, | ||
| 6105 | { | ||
| 6106 | .codec = 0x10ec0668, | ||
| 6107 | .subvendor = 0x1028, | ||
| 6108 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
| 6109 | .name = "Dell", | ||
| 6110 | #endif | ||
| 6111 | .pins = (const struct hda_pintbl[]) { | ||
| 6112 | {0x12, 0x411111f0}, | ||
| 6113 | {0x14, 0x90170110}, | ||
| 6114 | {0x15, 0x0321101f}, | ||
| 6115 | {0x16, 0x03011020}, | ||
| 6116 | {0x18, 0x40000008}, | ||
| 6117 | {0x19, 0x411111f0}, | ||
| 6118 | {0x1a, 0x411111f0}, | ||
| 6119 | {0x1b, 0x411111f0}, | ||
| 6120 | {0x1d, 0x41000001}, | ||
| 6121 | {0x1e, 0x411111f0}, | ||
| 6122 | {0x1f, 0x411111f0}, | ||
| 6123 | }, | ||
| 6124 | .value = ALC668_FIXUP_AUTO_MUTE, | ||
| 6125 | }, | ||
| 6126 | {} | 6016 | {} |
| 6127 | }; | 6017 | }; |
| 6128 | 6018 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 7f40a150899c..3744ea4e843d 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -122,6 +122,12 @@ enum { | |||
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | enum { | 124 | enum { |
| 125 | STAC_92HD95_HP_LED, | ||
| 126 | STAC_92HD95_HP_BASS, | ||
| 127 | STAC_92HD95_MODELS | ||
| 128 | }; | ||
| 129 | |||
| 130 | enum { | ||
| 125 | STAC_925x_REF, | 131 | STAC_925x_REF, |
| 126 | STAC_M1, | 132 | STAC_M1, |
| 127 | STAC_M1_2, | 133 | STAC_M1_2, |
| @@ -4128,6 +4134,48 @@ static const struct snd_pci_quirk stac9205_fixup_tbl[] = { | |||
| 4128 | {} /* terminator */ | 4134 | {} /* terminator */ |
| 4129 | }; | 4135 | }; |
| 4130 | 4136 | ||
| 4137 | static void stac92hd95_fixup_hp_led(struct hda_codec *codec, | ||
| 4138 | const struct hda_fixup *fix, int action) | ||
| 4139 | { | ||
| 4140 | struct sigmatel_spec *spec = codec->spec; | ||
| 4141 | |||
| 4142 | if (action != HDA_FIXUP_ACT_PRE_PROBE) | ||
| 4143 | return; | ||
| 4144 | |||
| 4145 | if (find_mute_led_cfg(codec, spec->default_polarity)) | ||
| 4146 | codec_dbg(codec, "mute LED gpio %d polarity %d\n", | ||
| 4147 | spec->gpio_led, | ||
| 4148 | spec->gpio_led_polarity); | ||
| 4149 | } | ||
| 4150 | |||
| 4151 | static const struct hda_fixup stac92hd95_fixups[] = { | ||
| 4152 | [STAC_92HD95_HP_LED] = { | ||
| 4153 | .type = HDA_FIXUP_FUNC, | ||
| 4154 | .v.func = stac92hd95_fixup_hp_led, | ||
| 4155 | }, | ||
| 4156 | [STAC_92HD95_HP_BASS] = { | ||
| 4157 | .type = HDA_FIXUP_VERBS, | ||
| 4158 | .v.verbs = (const struct hda_verb[]) { | ||
| 4159 | {0x1a, 0x795, 0x00}, /* HPF to 100Hz */ | ||
| 4160 | {} | ||
| 4161 | }, | ||
| 4162 | .chained = true, | ||
| 4163 | .chain_id = STAC_92HD95_HP_LED, | ||
| 4164 | }, | ||
| 4165 | }; | ||
| 4166 | |||
| 4167 | static const struct snd_pci_quirk stac92hd95_fixup_tbl[] = { | ||
| 4168 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1911, "HP Spectre 13", STAC_92HD95_HP_BASS), | ||
| 4169 | {} /* terminator */ | ||
| 4170 | }; | ||
| 4171 | |||
| 4172 | static const struct hda_model_fixup stac92hd95_models[] = { | ||
| 4173 | { .id = STAC_92HD95_HP_LED, .name = "hp-led" }, | ||
| 4174 | { .id = STAC_92HD95_HP_BASS, .name = "hp-bass" }, | ||
| 4175 | {} | ||
| 4176 | }; | ||
| 4177 | |||
| 4178 | |||
| 4131 | static int stac_parse_auto_config(struct hda_codec *codec) | 4179 | static int stac_parse_auto_config(struct hda_codec *codec) |
| 4132 | { | 4180 | { |
| 4133 | struct sigmatel_spec *spec = codec->spec; | 4181 | struct sigmatel_spec *spec = codec->spec; |
| @@ -4580,10 +4628,16 @@ static int patch_stac92hd95(struct hda_codec *codec) | |||
| 4580 | spec->gen.beep_nid = 0x19; /* digital beep */ | 4628 | spec->gen.beep_nid = 0x19; /* digital beep */ |
| 4581 | spec->pwr_nids = stac92hd95_pwr_nids; | 4629 | spec->pwr_nids = stac92hd95_pwr_nids; |
| 4582 | spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids); | 4630 | spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids); |
| 4583 | spec->default_polarity = -1; /* no default cfg */ | 4631 | spec->default_polarity = 0; |
| 4584 | 4632 | ||
| 4585 | codec->patch_ops = stac_patch_ops; | 4633 | codec->patch_ops = stac_patch_ops; |
| 4586 | 4634 | ||
| 4635 | snd_hda_pick_fixup(codec, stac92hd95_models, stac92hd95_fixup_tbl, | ||
| 4636 | stac92hd95_fixups); | ||
| 4637 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | ||
| 4638 | |||
| 4639 | stac_setup_gpio(codec); | ||
| 4640 | |||
| 4587 | err = stac_parse_auto_config(codec); | 4641 | err = stac_parse_auto_config(codec); |
| 4588 | if (err < 0) { | 4642 | if (err < 0) { |
| 4589 | stac_free(codec); | 4643 | stac_free(codec); |
| @@ -4592,6 +4646,8 @@ static int patch_stac92hd95(struct hda_codec *codec) | |||
| 4592 | 4646 | ||
| 4593 | codec->proc_widget_hook = stac92hd_proc_hook; | 4647 | codec->proc_widget_hook = stac92hd_proc_hook; |
| 4594 | 4648 | ||
| 4649 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); | ||
| 4650 | |||
| 4595 | return 0; | 4651 | return 0; |
| 4596 | } | 4652 | } |
| 4597 | 4653 | ||
diff --git a/sound/usb/card.c b/sound/usb/card.c index c3b5b7dca1c3..a09e5f3519e3 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
| @@ -307,6 +307,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) | |||
| 307 | 307 | ||
| 308 | static int snd_usb_audio_free(struct snd_usb_audio *chip) | 308 | static int snd_usb_audio_free(struct snd_usb_audio *chip) |
| 309 | { | 309 | { |
| 310 | struct list_head *p, *n; | ||
| 311 | |||
| 312 | list_for_each_safe(p, n, &chip->ep_list) | ||
| 313 | snd_usb_endpoint_free(p); | ||
| 314 | |||
| 310 | mutex_destroy(&chip->mutex); | 315 | mutex_destroy(&chip->mutex); |
| 311 | kfree(chip); | 316 | kfree(chip); |
| 312 | return 0; | 317 | return 0; |
| @@ -585,7 +590,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
| 585 | struct snd_usb_audio *chip) | 590 | struct snd_usb_audio *chip) |
| 586 | { | 591 | { |
| 587 | struct snd_card *card; | 592 | struct snd_card *card; |
| 588 | struct list_head *p, *n; | 593 | struct list_head *p; |
| 589 | 594 | ||
| 590 | if (chip == (void *)-1L) | 595 | if (chip == (void *)-1L) |
| 591 | return; | 596 | return; |
| @@ -598,14 +603,16 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
| 598 | mutex_lock(®ister_mutex); | 603 | mutex_lock(®ister_mutex); |
| 599 | chip->num_interfaces--; | 604 | chip->num_interfaces--; |
| 600 | if (chip->num_interfaces <= 0) { | 605 | if (chip->num_interfaces <= 0) { |
| 606 | struct snd_usb_endpoint *ep; | ||
| 607 | |||
| 601 | snd_card_disconnect(card); | 608 | snd_card_disconnect(card); |
| 602 | /* release the pcm resources */ | 609 | /* release the pcm resources */ |
| 603 | list_for_each(p, &chip->pcm_list) { | 610 | list_for_each(p, &chip->pcm_list) { |
| 604 | snd_usb_stream_disconnect(p); | 611 | snd_usb_stream_disconnect(p); |
| 605 | } | 612 | } |
| 606 | /* release the endpoint resources */ | 613 | /* release the endpoint resources */ |
| 607 | list_for_each_safe(p, n, &chip->ep_list) { | 614 | list_for_each_entry(ep, &chip->ep_list, list) { |
| 608 | snd_usb_endpoint_free(p); | 615 | snd_usb_endpoint_release(ep); |
| 609 | } | 616 | } |
| 610 | /* release the midi resources */ | 617 | /* release the midi resources */ |
| 611 | list_for_each(p, &chip->midi_list) { | 618 | list_for_each(p, &chip->midi_list) { |
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 289f582c9130..114e3e7ff511 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
| @@ -987,19 +987,30 @@ void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep) | |||
| 987 | } | 987 | } |
| 988 | 988 | ||
| 989 | /** | 989 | /** |
| 990 | * snd_usb_endpoint_release: Tear down an snd_usb_endpoint | ||
| 991 | * | ||
| 992 | * @ep: the endpoint to release | ||
| 993 | * | ||
| 994 | * This function does not care for the endpoint's use count but will tear | ||
| 995 | * down all the streaming URBs immediately. | ||
| 996 | */ | ||
| 997 | void snd_usb_endpoint_release(struct snd_usb_endpoint *ep) | ||
| 998 | { | ||
| 999 | release_urbs(ep, 1); | ||
| 1000 | } | ||
| 1001 | |||
| 1002 | /** | ||
| 990 | * snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint | 1003 | * snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint |
| 991 | * | 1004 | * |
| 992 | * @ep: the list header of the endpoint to free | 1005 | * @ep: the list header of the endpoint to free |
| 993 | * | 1006 | * |
| 994 | * This function does not care for the endpoint's use count but will tear | 1007 | * This free all resources of the given ep. |
| 995 | * down all the streaming URBs immediately and free all resources. | ||
| 996 | */ | 1008 | */ |
| 997 | void snd_usb_endpoint_free(struct list_head *head) | 1009 | void snd_usb_endpoint_free(struct list_head *head) |
| 998 | { | 1010 | { |
| 999 | struct snd_usb_endpoint *ep; | 1011 | struct snd_usb_endpoint *ep; |
| 1000 | 1012 | ||
| 1001 | ep = list_entry(head, struct snd_usb_endpoint, list); | 1013 | ep = list_entry(head, struct snd_usb_endpoint, list); |
| 1002 | release_urbs(ep, 1); | ||
| 1003 | kfree(ep); | 1014 | kfree(ep); |
| 1004 | } | 1015 | } |
| 1005 | 1016 | ||
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h index 1c7e8ee48abc..e61ee5c356a3 100644 --- a/sound/usb/endpoint.h +++ b/sound/usb/endpoint.h | |||
| @@ -23,6 +23,7 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep); | |||
| 23 | void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); | 23 | void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); |
| 24 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); | 24 | int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); |
| 25 | void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); | 25 | void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); |
| 26 | void snd_usb_endpoint_release(struct snd_usb_endpoint *ep); | ||
| 26 | void snd_usb_endpoint_free(struct list_head *head); | 27 | void snd_usb_endpoint_free(struct list_head *head); |
| 27 | 28 | ||
| 28 | int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); | 29 | int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); |
diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu-hotplug/Makefile index ae5faf9aade2..790c23a9db44 100644 --- a/tools/testing/selftests/cpu-hotplug/Makefile +++ b/tools/testing/selftests/cpu-hotplug/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | all: | 1 | all: |
| 2 | 2 | ||
| 3 | run_tests: | 3 | run_tests: |
| 4 | @/bin/sh ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" |
| 5 | 5 | ||
| 6 | clean: | 6 | clean: |
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index aa290c0de6f5..552f0810bffb 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c | |||
| @@ -193,6 +193,11 @@ int main(int argc, char **argv) | |||
| 193 | int msg, pid, err; | 193 | int msg, pid, err; |
| 194 | struct msgque_data msgque; | 194 | struct msgque_data msgque; |
| 195 | 195 | ||
| 196 | if (getuid() != 0) { | ||
| 197 | printf("Please run the test as root - Exiting.\n"); | ||
| 198 | exit(1); | ||
| 199 | } | ||
| 200 | |||
| 196 | msgque.key = ftok(argv[0], 822155650); | 201 | msgque.key = ftok(argv[0], 822155650); |
| 197 | if (msgque.key == -1) { | 202 | if (msgque.key == -1) { |
| 198 | printf("Can't make key\n"); | 203 | printf("Can't make key\n"); |
diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile index 350bfeda3aa8..058c76f5d102 100644 --- a/tools/testing/selftests/memory-hotplug/Makefile +++ b/tools/testing/selftests/memory-hotplug/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | all: | 1 | all: |
| 2 | 2 | ||
| 3 | run_tests: | 3 | run_tests: |
| 4 | @/bin/sh ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" |
| 5 | 5 | ||
| 6 | clean: | 6 | clean: |
diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile index 51267f4184a6..2cede239a074 100644 --- a/tools/testing/selftests/powerpc/tm/Makefile +++ b/tools/testing/selftests/powerpc/tm/Makefile | |||
| @@ -2,7 +2,7 @@ PROGS := tm-resched-dscr | |||
| 2 | 2 | ||
| 3 | all: $(PROGS) | 3 | all: $(PROGS) |
| 4 | 4 | ||
| 5 | $(PROGS): | 5 | $(PROGS): ../harness.c |
| 6 | 6 | ||
| 7 | run_tests: all | 7 | run_tests: all |
| 8 | @-for PROG in $(PROGS); do \ | 8 | @-for PROG in $(PROGS); do \ |
diff --git a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c index ee98e3886af2..42d4c8caad81 100644 --- a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c +++ b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <assert.h> | 28 | #include <assert.h> |
| 29 | #include <asm/tm.h> | 29 | #include <asm/tm.h> |
| 30 | 30 | ||
| 31 | #include "utils.h" | ||
| 32 | |||
| 31 | #define TBEGIN ".long 0x7C00051D ;" | 33 | #define TBEGIN ".long 0x7C00051D ;" |
| 32 | #define TEND ".long 0x7C00055D ;" | 34 | #define TEND ".long 0x7C00055D ;" |
| 33 | #define TCHECK ".long 0x7C00059C ;" | 35 | #define TCHECK ".long 0x7C00059C ;" |
| @@ -36,7 +38,8 @@ | |||
| 36 | #define SPRN_TEXASR 0x82 | 38 | #define SPRN_TEXASR 0x82 |
| 37 | #define SPRN_DSCR 0x03 | 39 | #define SPRN_DSCR 0x03 |
| 38 | 40 | ||
| 39 | int main(void) { | 41 | int test_body(void) |
| 42 | { | ||
| 40 | uint64_t rv, dscr1 = 1, dscr2, texasr; | 43 | uint64_t rv, dscr1 = 1, dscr2, texasr; |
| 41 | 44 | ||
| 42 | printf("Check DSCR TM context switch: "); | 45 | printf("Check DSCR TM context switch: "); |
| @@ -81,10 +84,15 @@ int main(void) { | |||
| 81 | } | 84 | } |
| 82 | if (dscr2 != dscr1) { | 85 | if (dscr2 != dscr1) { |
| 83 | printf(" FAIL\n"); | 86 | printf(" FAIL\n"); |
| 84 | exit(EXIT_FAILURE); | 87 | return 1; |
| 85 | } else { | 88 | } else { |
| 86 | printf(" OK\n"); | 89 | printf(" OK\n"); |
| 87 | exit(EXIT_SUCCESS); | 90 | return 0; |
| 88 | } | 91 | } |
| 89 | } | 92 | } |
| 90 | } | 93 | } |
| 94 | |||
| 95 | int main(void) | ||
| 96 | { | ||
| 97 | return test_harness(test_body, "tm_resched_dscr"); | ||
| 98 | } | ||
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c index fe1e66b6ef40..a87e99f37c52 100644 --- a/tools/usb/ffs-test.c +++ b/tools/usb/ffs-test.c | |||
| @@ -116,8 +116,8 @@ static const struct { | |||
| 116 | .header = { | 116 | .header = { |
| 117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), | 117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), |
| 118 | .length = cpu_to_le32(sizeof descriptors), | 118 | .length = cpu_to_le32(sizeof descriptors), |
| 119 | .fs_count = 3, | 119 | .fs_count = cpu_to_le32(3), |
| 120 | .hs_count = 3, | 120 | .hs_count = cpu_to_le32(3), |
| 121 | }, | 121 | }, |
| 122 | .fs_descs = { | 122 | .fs_descs = { |
| 123 | .intf = { | 123 | .intf = { |
