diff options
| author | Ingo Molnar <mingo@elte.hu> | 2012-01-04 09:00:43 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2012-01-04 09:01:28 -0500 |
| commit | adaf4ed2abbd285c93808060924eeec3af483aee (patch) | |
| tree | 425c6c37c08af0b69efaa7457c9b428eda347c36 | |
| parent | ca3d30cc02f780f68771087040ce935add6ba2b7 (diff) | |
| parent | 5f0a6e2d503896062f641639dacfe5055c2f593b (diff) | |
Merge commit 'v3.2-rc7' into x86/asm
Merge reason: Update from -rc4 to -rc7.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
537 files changed, 7130 insertions, 3993 deletions
| @@ -688,10 +688,13 @@ S: Oxfordshire, UK. | |||
| 688 | 688 | ||
| 689 | N: Kees Cook | 689 | N: Kees Cook |
| 690 | E: kees@outflux.net | 690 | E: kees@outflux.net |
| 691 | W: http://outflux.net/ | 691 | E: kees@ubuntu.com |
| 692 | P: 1024D/17063E6D 9FA3 C49C 23C9 D1BC 2E30 1975 1FFF 4BA9 1706 3E6D | 692 | E: keescook@chromium.org |
| 693 | D: Minor updates to SCSI types, added /proc/pid/maps protection | 693 | W: http://outflux.net/blog/ |
| 694 | P: 4096R/DC6DC026 A5C3 F68F 229D D60F 723E 6E13 8972 F4DF DC6D C026 | ||
| 695 | D: Various security things, bug fixes, and documentation. | ||
| 694 | S: (ask for current address) | 696 | S: (ask for current address) |
| 697 | S: Portland, Oregon | ||
| 695 | S: USA | 698 | S: USA |
| 696 | 699 | ||
| 697 | N: Robin Cornelius | 700 | N: Robin Cornelius |
diff --git a/Documentation/ABI/testing/sysfs-bus-rbd b/Documentation/ABI/testing/sysfs-bus-rbd index fa72ccb2282e..dbedafb095e2 100644 --- a/Documentation/ABI/testing/sysfs-bus-rbd +++ b/Documentation/ABI/testing/sysfs-bus-rbd | |||
| @@ -57,13 +57,6 @@ create_snap | |||
| 57 | 57 | ||
| 58 | $ echo <snap-name> > /sys/bus/rbd/devices/<dev-id>/snap_create | 58 | $ echo <snap-name> > /sys/bus/rbd/devices/<dev-id>/snap_create |
| 59 | 59 | ||
| 60 | rollback_snap | ||
| 61 | |||
| 62 | Rolls back data to the specified snapshot. This goes over the entire | ||
| 63 | list of rados blocks and sends a rollback command to each. | ||
| 64 | |||
| 65 | $ echo <snap-name> > /sys/bus/rbd/devices/<dev-id>/snap_rollback | ||
| 66 | |||
| 67 | snap_* | 60 | snap_* |
| 68 | 61 | ||
| 69 | A directory per each snapshot | 62 | A directory per each snapshot |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index ce7fc8b3e2c0..6c04e9160c63 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -315,12 +315,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 315 | CPU-intensive style benchmark, and it can vary highly in | 315 | CPU-intensive style benchmark, and it can vary highly in |
| 316 | a microbenchmark depending on workload and compiler. | 316 | a microbenchmark depending on workload and compiler. |
| 317 | 317 | ||
| 318 | 1: only for 32-bit processes | 318 | 32: only for 32-bit processes |
| 319 | 2: only for 64-bit processes | 319 | 64: only for 64-bit processes |
| 320 | on: enable for both 32- and 64-bit processes | 320 | on: enable for both 32- and 64-bit processes |
| 321 | off: disable for both 32- and 64-bit processes | 321 | off: disable for both 32- and 64-bit processes |
| 322 | 322 | ||
| 323 | amd_iommu= [HW,X86-84] | 323 | amd_iommu= [HW,X86-64] |
| 324 | Pass parameters to the AMD IOMMU driver in the system. | 324 | Pass parameters to the AMD IOMMU driver in the system. |
| 325 | Possible values are: | 325 | Possible values are: |
| 326 | fullflush - enable flushing of IO/TLB entries when | 326 | fullflush - enable flushing of IO/TLB entries when |
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index f049a1ca186f..589f2da5d545 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
| @@ -282,11 +282,11 @@ tcp_max_ssthresh - INTEGER | |||
| 282 | Default: 0 (off) | 282 | Default: 0 (off) |
| 283 | 283 | ||
| 284 | tcp_max_syn_backlog - INTEGER | 284 | tcp_max_syn_backlog - INTEGER |
| 285 | Maximal number of remembered connection requests, which are | 285 | Maximal number of remembered connection requests, which have not |
| 286 | still did not receive an acknowledgment from connecting client. | 286 | received an acknowledgment from connecting client. |
| 287 | Default value is 1024 for systems with more than 128Mb of memory, | 287 | The minimal value is 128 for low memory machines, and it will |
| 288 | and 128 for low memory machines. If server suffers of overload, | 288 | increase in proportion to the memory of machine. |
| 289 | try to increase this number. | 289 | If server suffers from overload, try increasing this number. |
| 290 | 290 | ||
| 291 | tcp_max_tw_buckets - INTEGER | 291 | tcp_max_tw_buckets - INTEGER |
| 292 | Maximal number of timewait sockets held by system simultaneously. | 292 | Maximal number of timewait sockets held by system simultaneously. |
diff --git a/Documentation/sound/alsa/soc/machine.txt b/Documentation/sound/alsa/soc/machine.txt index 3e2ec9cbf397..d50c14df3411 100644 --- a/Documentation/sound/alsa/soc/machine.txt +++ b/Documentation/sound/alsa/soc/machine.txt | |||
| @@ -50,8 +50,7 @@ Machine DAI Configuration | |||
| 50 | The machine DAI configuration glues all the codec and CPU DAIs together. It can | 50 | The machine DAI configuration glues all the codec and CPU DAIs together. It can |
| 51 | also be used to set up the DAI system clock and for any machine related DAI | 51 | also be used to set up the DAI system clock and for any machine related DAI |
| 52 | initialisation e.g. the machine audio map can be connected to the codec audio | 52 | initialisation e.g. the machine audio map can be connected to the codec audio |
| 53 | map, unconnected codec pins can be set as such. Please see corgi.c, spitz.c | 53 | map, unconnected codec pins can be set as such. |
| 54 | for examples. | ||
| 55 | 54 | ||
| 56 | struct snd_soc_dai_link is used to set up each DAI in your machine. e.g. | 55 | struct snd_soc_dai_link is used to set up each DAI in your machine. e.g. |
| 57 | 56 | ||
| @@ -83,8 +82,7 @@ Machine Power Map | |||
| 83 | The machine driver can optionally extend the codec power map and to become an | 82 | The machine driver can optionally extend the codec power map and to become an |
| 84 | audio power map of the audio subsystem. This allows for automatic power up/down | 83 | audio power map of the audio subsystem. This allows for automatic power up/down |
| 85 | of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack | 84 | of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack |
| 86 | sockets in the machine init function. See soc/pxa/spitz.c and dapm.txt for | 85 | sockets in the machine init function. |
| 87 | details. | ||
| 88 | 86 | ||
| 89 | 87 | ||
| 90 | Machine Controls | 88 | Machine Controls |
diff --git a/MAINTAINERS b/MAINTAINERS index 447560284996..6afba60c3904 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -511,8 +511,8 @@ M: Joerg Roedel <joerg.roedel@amd.com> | |||
| 511 | L: iommu@lists.linux-foundation.org | 511 | L: iommu@lists.linux-foundation.org |
| 512 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git | 512 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git |
| 513 | S: Supported | 513 | S: Supported |
| 514 | F: arch/x86/kernel/amd_iommu*.c | 514 | F: drivers/iommu/amd_iommu*.[ch] |
| 515 | F: arch/x86/include/asm/amd_iommu*.h | 515 | F: include/linux/amd-iommu.h |
| 516 | 516 | ||
| 517 | AMD MICROCODE UPDATE SUPPORT | 517 | AMD MICROCODE UPDATE SUPPORT |
| 518 | M: Andreas Herrmann <andreas.herrmann3@amd.com> | 518 | M: Andreas Herrmann <andreas.herrmann3@amd.com> |
| @@ -1054,35 +1054,18 @@ ARM/SAMSUNG ARM ARCHITECTURES | |||
| 1054 | M: Ben Dooks <ben-linux@fluff.org> | 1054 | M: Ben Dooks <ben-linux@fluff.org> |
| 1055 | M: Kukjin Kim <kgene.kim@samsung.com> | 1055 | M: Kukjin Kim <kgene.kim@samsung.com> |
| 1056 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1056 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1057 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | ||
| 1057 | W: http://www.fluff.org/ben/linux/ | 1058 | W: http://www.fluff.org/ben/linux/ |
| 1058 | S: Maintained | 1059 | S: Maintained |
| 1059 | F: arch/arm/plat-samsung/ | 1060 | F: arch/arm/plat-samsung/ |
| 1060 | F: arch/arm/plat-s3c24xx/ | 1061 | F: arch/arm/plat-s3c24xx/ |
| 1061 | F: arch/arm/plat-s5p/ | 1062 | F: arch/arm/plat-s5p/ |
| 1063 | F: arch/arm/mach-s3c24*/ | ||
| 1064 | F: arch/arm/mach-s3c64xx/ | ||
| 1062 | F: drivers/*/*s3c2410* | 1065 | F: drivers/*/*s3c2410* |
| 1063 | F: drivers/*/*/*s3c2410* | 1066 | F: drivers/*/*/*s3c2410* |
| 1064 | 1067 | F: drivers/spi/spi-s3c* | |
| 1065 | ARM/S3C2410 ARM ARCHITECTURE | 1068 | F: sound/soc/samsung/* |
| 1066 | M: Ben Dooks <ben-linux@fluff.org> | ||
| 1067 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
| 1068 | W: http://www.fluff.org/ben/linux/ | ||
| 1069 | S: Maintained | ||
| 1070 | F: arch/arm/mach-s3c2410/ | ||
| 1071 | |||
| 1072 | ARM/S3C244x ARM ARCHITECTURE | ||
| 1073 | M: Ben Dooks <ben-linux@fluff.org> | ||
| 1074 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
| 1075 | W: http://www.fluff.org/ben/linux/ | ||
| 1076 | S: Maintained | ||
| 1077 | F: arch/arm/mach-s3c2440/ | ||
| 1078 | F: arch/arm/mach-s3c2443/ | ||
| 1079 | |||
| 1080 | ARM/S3C64xx ARM ARCHITECTURE | ||
| 1081 | M: Ben Dooks <ben-linux@fluff.org> | ||
| 1082 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
| 1083 | W: http://www.fluff.org/ben/linux/ | ||
| 1084 | S: Maintained | ||
| 1085 | F: arch/arm/mach-s3c64xx/ | ||
| 1086 | 1069 | ||
| 1087 | ARM/S5P EXYNOS ARM ARCHITECTURES | 1070 | ARM/S5P EXYNOS ARM ARCHITECTURES |
| 1088 | M: Kukjin Kim <kgene.kim@samsung.com> | 1071 | M: Kukjin Kim <kgene.kim@samsung.com> |
| @@ -3118,6 +3101,7 @@ F: include/linux/hid* | |||
| 3118 | 3101 | ||
| 3119 | HIGH-RESOLUTION TIMERS, CLOCKEVENTS, DYNTICKS | 3102 | HIGH-RESOLUTION TIMERS, CLOCKEVENTS, DYNTICKS |
| 3120 | M: Thomas Gleixner <tglx@linutronix.de> | 3103 | M: Thomas Gleixner <tglx@linutronix.de> |
| 3104 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core | ||
| 3121 | S: Maintained | 3105 | S: Maintained |
| 3122 | F: Documentation/timers/ | 3106 | F: Documentation/timers/ |
| 3123 | F: kernel/hrtimer.c | 3107 | F: kernel/hrtimer.c |
| @@ -3627,7 +3611,7 @@ F: net/irda/ | |||
| 3627 | IRQ SUBSYSTEM | 3611 | IRQ SUBSYSTEM |
| 3628 | M: Thomas Gleixner <tglx@linutronix.de> | 3612 | M: Thomas Gleixner <tglx@linutronix.de> |
| 3629 | S: Maintained | 3613 | S: Maintained |
| 3630 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq/core | 3614 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core |
| 3631 | F: kernel/irq/ | 3615 | F: kernel/irq/ |
| 3632 | 3616 | ||
| 3633 | ISAPNP | 3617 | ISAPNP |
| @@ -4115,7 +4099,7 @@ F: drivers/hwmon/lm90.c | |||
| 4115 | LOCKDEP AND LOCKSTAT | 4099 | LOCKDEP AND LOCKSTAT |
| 4116 | M: Peter Zijlstra <peterz@infradead.org> | 4100 | M: Peter Zijlstra <peterz@infradead.org> |
| 4117 | M: Ingo Molnar <mingo@redhat.com> | 4101 | M: Ingo Molnar <mingo@redhat.com> |
| 4118 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-lockdep.git | 4102 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/locking |
| 4119 | S: Maintained | 4103 | S: Maintained |
| 4120 | F: Documentation/lockdep*.txt | 4104 | F: Documentation/lockdep*.txt |
| 4121 | F: Documentation/lockstat.txt | 4105 | F: Documentation/lockstat.txt |
| @@ -4297,7 +4281,9 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | |||
| 4297 | S: Maintained | 4281 | S: Maintained |
| 4298 | F: Documentation/dvb/ | 4282 | F: Documentation/dvb/ |
| 4299 | F: Documentation/video4linux/ | 4283 | F: Documentation/video4linux/ |
| 4284 | F: Documentation/DocBook/media/ | ||
| 4300 | F: drivers/media/ | 4285 | F: drivers/media/ |
| 4286 | F: drivers/staging/media/ | ||
| 4301 | F: include/media/ | 4287 | F: include/media/ |
| 4302 | F: include/linux/dvb/ | 4288 | F: include/linux/dvb/ |
| 4303 | F: include/linux/videodev*.h | 4289 | F: include/linux/videodev*.h |
| @@ -4319,8 +4305,9 @@ F: include/linux/mm.h | |||
| 4319 | F: mm/ | 4305 | F: mm/ |
| 4320 | 4306 | ||
| 4321 | MEMORY RESOURCE CONTROLLER | 4307 | MEMORY RESOURCE CONTROLLER |
| 4308 | M: Johannes Weiner <hannes@cmpxchg.org> | ||
| 4309 | M: Michal Hocko <mhocko@suse.cz> | ||
| 4322 | M: Balbir Singh <bsingharora@gmail.com> | 4310 | M: Balbir Singh <bsingharora@gmail.com> |
| 4323 | M: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | ||
| 4324 | M: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 4311 | M: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> |
| 4325 | L: cgroups@vger.kernel.org | 4312 | L: cgroups@vger.kernel.org |
| 4326 | L: linux-mm@kvack.org | 4313 | L: linux-mm@kvack.org |
| @@ -5102,6 +5089,7 @@ M: Peter Zijlstra <a.p.zijlstra@chello.nl> | |||
| 5102 | M: Paul Mackerras <paulus@samba.org> | 5089 | M: Paul Mackerras <paulus@samba.org> |
| 5103 | M: Ingo Molnar <mingo@elte.hu> | 5090 | M: Ingo Molnar <mingo@elte.hu> |
| 5104 | M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 5091 | M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> |
| 5092 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core | ||
| 5105 | S: Supported | 5093 | S: Supported |
| 5106 | F: kernel/events/* | 5094 | F: kernel/events/* |
| 5107 | F: include/linux/perf_event.h | 5095 | F: include/linux/perf_event.h |
| @@ -5181,6 +5169,7 @@ F: drivers/scsi/pm8001/ | |||
| 5181 | 5169 | ||
| 5182 | POSIX CLOCKS and TIMERS | 5170 | POSIX CLOCKS and TIMERS |
| 5183 | M: Thomas Gleixner <tglx@linutronix.de> | 5171 | M: Thomas Gleixner <tglx@linutronix.de> |
| 5172 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core | ||
| 5184 | S: Supported | 5173 | S: Supported |
| 5185 | F: fs/timerfd.c | 5174 | F: fs/timerfd.c |
| 5186 | F: include/linux/timer* | 5175 | F: include/linux/timer* |
| @@ -5696,6 +5685,7 @@ F: drivers/dma/dw_dmac.c | |||
| 5696 | TIMEKEEPING, NTP | 5685 | TIMEKEEPING, NTP |
| 5697 | M: John Stultz <johnstul@us.ibm.com> | 5686 | M: John Stultz <johnstul@us.ibm.com> |
| 5698 | M: Thomas Gleixner <tglx@linutronix.de> | 5687 | M: Thomas Gleixner <tglx@linutronix.de> |
| 5688 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core | ||
| 5699 | S: Supported | 5689 | S: Supported |
| 5700 | F: include/linux/clocksource.h | 5690 | F: include/linux/clocksource.h |
| 5701 | F: include/linux/time.h | 5691 | F: include/linux/time.h |
| @@ -5720,6 +5710,7 @@ F: drivers/watchdog/sc1200wdt.c | |||
| 5720 | SCHEDULER | 5710 | SCHEDULER |
| 5721 | M: Ingo Molnar <mingo@elte.hu> | 5711 | M: Ingo Molnar <mingo@elte.hu> |
| 5722 | M: Peter Zijlstra <peterz@infradead.org> | 5712 | M: Peter Zijlstra <peterz@infradead.org> |
| 5713 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core | ||
| 5723 | S: Maintained | 5714 | S: Maintained |
| 5724 | F: kernel/sched* | 5715 | F: kernel/sched* |
| 5725 | F: include/linux/sched.h | 5716 | F: include/linux/sched.h |
| @@ -6647,7 +6638,7 @@ TRACING | |||
| 6647 | M: Steven Rostedt <rostedt@goodmis.org> | 6638 | M: Steven Rostedt <rostedt@goodmis.org> |
| 6648 | M: Frederic Weisbecker <fweisbec@gmail.com> | 6639 | M: Frederic Weisbecker <fweisbec@gmail.com> |
| 6649 | M: Ingo Molnar <mingo@redhat.com> | 6640 | M: Ingo Molnar <mingo@redhat.com> |
| 6650 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf/core | 6641 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core |
| 6651 | S: Maintained | 6642 | S: Maintained |
| 6652 | F: Documentation/trace/ftrace.txt | 6643 | F: Documentation/trace/ftrace.txt |
| 6653 | F: arch/*/*/*/ftrace.h | 6644 | F: arch/*/*/*/ftrace.h |
| @@ -7397,7 +7388,7 @@ M: Thomas Gleixner <tglx@linutronix.de> | |||
| 7397 | M: Ingo Molnar <mingo@redhat.com> | 7388 | M: Ingo Molnar <mingo@redhat.com> |
| 7398 | M: "H. Peter Anvin" <hpa@zytor.com> | 7389 | M: "H. Peter Anvin" <hpa@zytor.com> |
| 7399 | M: x86@kernel.org | 7390 | M: x86@kernel.org |
| 7400 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git | 7391 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core |
| 7401 | S: Maintained | 7392 | S: Maintained |
| 7402 | F: Documentation/x86/ | 7393 | F: Documentation/x86/ |
| 7403 | F: arch/x86/ | 7394 | F: arch/x86/ |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 3 | 1 | VERSION = 3 |
| 2 | PATCHLEVEL = 2 | 2 | PATCHLEVEL = 2 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc7 |
| 5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index e084b7e981e8..776d76b8cb69 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -220,8 +220,9 @@ config NEED_MACH_MEMORY_H | |||
| 220 | be avoided when possible. | 220 | be avoided when possible. |
| 221 | 221 | ||
| 222 | config PHYS_OFFSET | 222 | config PHYS_OFFSET |
| 223 | hex "Physical address of main memory" | 223 | hex "Physical address of main memory" if MMU |
| 224 | depends on !ARM_PATCH_PHYS_VIRT && !NEED_MACH_MEMORY_H | 224 | depends on !ARM_PATCH_PHYS_VIRT && !NEED_MACH_MEMORY_H |
| 225 | default DRAM_BASE if !MMU | ||
| 225 | help | 226 | help |
| 226 | Please provide the physical address corresponding to the | 227 | Please provide the physical address corresponding to the |
| 227 | location of main memory in your system. | 228 | location of main memory in your system. |
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig index a7e777581378..945a34f2a34d 100644 --- a/arch/arm/configs/omap1_defconfig +++ b/arch/arm/configs/omap1_defconfig | |||
| @@ -48,12 +48,7 @@ CONFIG_MACH_SX1=y | |||
| 48 | CONFIG_MACH_NOKIA770=y | 48 | CONFIG_MACH_NOKIA770=y |
| 49 | CONFIG_MACH_AMS_DELTA=y | 49 | CONFIG_MACH_AMS_DELTA=y |
| 50 | CONFIG_MACH_OMAP_GENERIC=y | 50 | CONFIG_MACH_OMAP_GENERIC=y |
| 51 | CONFIG_OMAP_ARM_216MHZ=y | ||
| 52 | CONFIG_OMAP_ARM_195MHZ=y | ||
| 53 | CONFIG_OMAP_ARM_192MHZ=y | ||
| 54 | CONFIG_OMAP_ARM_182MHZ=y | 51 | CONFIG_OMAP_ARM_182MHZ=y |
| 55 | CONFIG_OMAP_ARM_168MHZ=y | ||
| 56 | # CONFIG_OMAP_ARM_60MHZ is not set | ||
| 57 | # CONFIG_ARM_THUMB is not set | 52 | # CONFIG_ARM_THUMB is not set |
| 58 | CONFIG_PCCARD=y | 53 | CONFIG_PCCARD=y |
| 59 | CONFIG_OMAP_CF=y | 54 | CONFIG_OMAP_CF=y |
diff --git a/arch/arm/include/asm/unwind.h b/arch/arm/include/asm/unwind.h index a5edf421005c..d1c3f3a71c94 100644 --- a/arch/arm/include/asm/unwind.h +++ b/arch/arm/include/asm/unwind.h | |||
| @@ -30,14 +30,15 @@ enum unwind_reason_code { | |||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | struct unwind_idx { | 32 | struct unwind_idx { |
| 33 | unsigned long addr; | 33 | unsigned long addr_offset; |
| 34 | unsigned long insn; | 34 | unsigned long insn; |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | struct unwind_table { | 37 | struct unwind_table { |
| 38 | struct list_head list; | 38 | struct list_head list; |
| 39 | struct unwind_idx *start; | 39 | const struct unwind_idx *start; |
| 40 | struct unwind_idx *stop; | 40 | const struct unwind_idx *origin; |
| 41 | const struct unwind_idx *stop; | ||
| 41 | unsigned long begin_addr; | 42 | unsigned long begin_addr; |
| 42 | unsigned long end_addr; | 43 | unsigned long end_addr; |
| 43 | }; | 44 | }; |
| @@ -49,15 +50,6 @@ extern struct unwind_table *unwind_table_add(unsigned long start, | |||
| 49 | extern void unwind_table_del(struct unwind_table *tab); | 50 | extern void unwind_table_del(struct unwind_table *tab); |
| 50 | extern void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk); | 51 | extern void unwind_backtrace(struct pt_regs *regs, struct task_struct *tsk); |
| 51 | 52 | ||
| 52 | #ifdef CONFIG_ARM_UNWIND | ||
| 53 | extern int __init unwind_init(void); | ||
| 54 | #else | ||
| 55 | static inline int __init unwind_init(void) | ||
| 56 | { | ||
| 57 | return 0; | ||
| 58 | } | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #endif /* !__ASSEMBLY__ */ | 53 | #endif /* !__ASSEMBLY__ */ |
| 62 | 54 | ||
| 63 | #ifdef CONFIG_ARM_UNWIND | 55 | #ifdef CONFIG_ARM_UNWIND |
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index c475379199b1..88b0941ce51e 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
| @@ -353,15 +353,15 @@ validate_group(struct perf_event *event) | |||
| 353 | fake_pmu.used_mask = fake_used_mask; | 353 | fake_pmu.used_mask = fake_used_mask; |
| 354 | 354 | ||
| 355 | if (!validate_event(&fake_pmu, leader)) | 355 | if (!validate_event(&fake_pmu, leader)) |
| 356 | return -ENOSPC; | 356 | return -EINVAL; |
| 357 | 357 | ||
| 358 | list_for_each_entry(sibling, &leader->sibling_list, group_entry) { | 358 | list_for_each_entry(sibling, &leader->sibling_list, group_entry) { |
| 359 | if (!validate_event(&fake_pmu, sibling)) | 359 | if (!validate_event(&fake_pmu, sibling)) |
| 360 | return -ENOSPC; | 360 | return -EINVAL; |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | if (!validate_event(&fake_pmu, event)) | 363 | if (!validate_event(&fake_pmu, event)) |
| 364 | return -ENOSPC; | 364 | return -EINVAL; |
| 365 | 365 | ||
| 366 | return 0; | 366 | return 0; |
| 367 | } | 367 | } |
| @@ -640,6 +640,9 @@ static struct platform_device_id armpmu_plat_device_ids[] = { | |||
| 640 | 640 | ||
| 641 | static int __devinit armpmu_device_probe(struct platform_device *pdev) | 641 | static int __devinit armpmu_device_probe(struct platform_device *pdev) |
| 642 | { | 642 | { |
| 643 | if (!cpu_pmu) | ||
| 644 | return -ENODEV; | ||
| 645 | |||
| 643 | cpu_pmu->plat_device = pdev; | 646 | cpu_pmu->plat_device = pdev; |
| 644 | return 0; | 647 | return 0; |
| 645 | } | 648 | } |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 3448a3f9cc8c..8fc2c8fcbdc6 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
| @@ -895,8 +895,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 895 | { | 895 | { |
| 896 | struct machine_desc *mdesc; | 896 | struct machine_desc *mdesc; |
| 897 | 897 | ||
| 898 | unwind_init(); | ||
| 899 | |||
| 900 | setup_processor(); | 898 | setup_processor(); |
| 901 | mdesc = setup_machine_fdt(__atags_pointer); | 899 | mdesc = setup_machine_fdt(__atags_pointer); |
| 902 | if (!mdesc) | 900 | if (!mdesc) |
| @@ -904,6 +902,12 @@ void __init setup_arch(char **cmdline_p) | |||
| 904 | machine_desc = mdesc; | 902 | machine_desc = mdesc; |
| 905 | machine_name = mdesc->name; | 903 | machine_name = mdesc->name; |
| 906 | 904 | ||
| 905 | #ifdef CONFIG_ZONE_DMA | ||
| 906 | if (mdesc->dma_zone_size) { | ||
| 907 | extern unsigned long arm_dma_zone_size; | ||
| 908 | arm_dma_zone_size = mdesc->dma_zone_size; | ||
| 909 | } | ||
| 910 | #endif | ||
| 907 | if (mdesc->soft_reboot) | 911 | if (mdesc->soft_reboot) |
| 908 | reboot_setup("s"); | 912 | reboot_setup("s"); |
| 909 | 913 | ||
| @@ -934,12 +938,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 934 | 938 | ||
| 935 | tcm_init(); | 939 | tcm_init(); |
| 936 | 940 | ||
| 937 | #ifdef CONFIG_ZONE_DMA | ||
| 938 | if (mdesc->dma_zone_size) { | ||
| 939 | extern unsigned long arm_dma_zone_size; | ||
| 940 | arm_dma_zone_size = mdesc->dma_zone_size; | ||
| 941 | } | ||
| 942 | #endif | ||
| 943 | #ifdef CONFIG_MULTI_IRQ_HANDLER | 941 | #ifdef CONFIG_MULTI_IRQ_HANDLER |
| 944 | handle_arch_irq = mdesc->handle_irq; | 942 | handle_arch_irq = mdesc->handle_irq; |
| 945 | #endif | 943 | #endif |
diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c index e7e8365795c3..00df012c4678 100644 --- a/arch/arm/kernel/unwind.c +++ b/arch/arm/kernel/unwind.c | |||
| @@ -67,7 +67,7 @@ EXPORT_SYMBOL(__aeabi_unwind_cpp_pr2); | |||
| 67 | 67 | ||
| 68 | struct unwind_ctrl_block { | 68 | struct unwind_ctrl_block { |
| 69 | unsigned long vrs[16]; /* virtual register set */ | 69 | unsigned long vrs[16]; /* virtual register set */ |
| 70 | unsigned long *insn; /* pointer to the current instructions word */ | 70 | const unsigned long *insn; /* pointer to the current instructions word */ |
| 71 | int entries; /* number of entries left to interpret */ | 71 | int entries; /* number of entries left to interpret */ |
| 72 | int byte; /* current byte number in the instructions word */ | 72 | int byte; /* current byte number in the instructions word */ |
| 73 | }; | 73 | }; |
| @@ -83,8 +83,9 @@ enum regs { | |||
| 83 | PC = 15 | 83 | PC = 15 |
| 84 | }; | 84 | }; |
| 85 | 85 | ||
| 86 | extern struct unwind_idx __start_unwind_idx[]; | 86 | extern const struct unwind_idx __start_unwind_idx[]; |
| 87 | extern struct unwind_idx __stop_unwind_idx[]; | 87 | static const struct unwind_idx *__origin_unwind_idx; |
| 88 | extern const struct unwind_idx __stop_unwind_idx[]; | ||
| 88 | 89 | ||
| 89 | static DEFINE_SPINLOCK(unwind_lock); | 90 | static DEFINE_SPINLOCK(unwind_lock); |
| 90 | static LIST_HEAD(unwind_tables); | 91 | static LIST_HEAD(unwind_tables); |
| @@ -98,45 +99,99 @@ static LIST_HEAD(unwind_tables); | |||
| 98 | }) | 99 | }) |
| 99 | 100 | ||
| 100 | /* | 101 | /* |
| 101 | * Binary search in the unwind index. The entries entries are | 102 | * Binary search in the unwind index. The entries are |
| 102 | * guaranteed to be sorted in ascending order by the linker. | 103 | * guaranteed to be sorted in ascending order by the linker. |
| 104 | * | ||
| 105 | * start = first entry | ||
| 106 | * origin = first entry with positive offset (or stop if there is no such entry) | ||
| 107 | * stop - 1 = last entry | ||
| 103 | */ | 108 | */ |
| 104 | static struct unwind_idx *search_index(unsigned long addr, | 109 | static const struct unwind_idx *search_index(unsigned long addr, |
| 105 | struct unwind_idx *first, | 110 | const struct unwind_idx *start, |
| 106 | struct unwind_idx *last) | 111 | const struct unwind_idx *origin, |
| 112 | const struct unwind_idx *stop) | ||
| 107 | { | 113 | { |
| 108 | pr_debug("%s(%08lx, %p, %p)\n", __func__, addr, first, last); | 114 | unsigned long addr_prel31; |
| 115 | |||
| 116 | pr_debug("%s(%08lx, %p, %p, %p)\n", | ||
| 117 | __func__, addr, start, origin, stop); | ||
| 118 | |||
| 119 | /* | ||
| 120 | * only search in the section with the matching sign. This way the | ||
| 121 | * prel31 numbers can be compared as unsigned longs. | ||
| 122 | */ | ||
| 123 | if (addr < (unsigned long)start) | ||
| 124 | /* negative offsets: [start; origin) */ | ||
| 125 | stop = origin; | ||
| 126 | else | ||
| 127 | /* positive offsets: [origin; stop) */ | ||
| 128 | start = origin; | ||
| 129 | |||
| 130 | /* prel31 for address relavive to start */ | ||
| 131 | addr_prel31 = (addr - (unsigned long)start) & 0x7fffffff; | ||
| 109 | 132 | ||
| 110 | if (addr < first->addr) { | 133 | while (start < stop - 1) { |
| 134 | const struct unwind_idx *mid = start + ((stop - start) >> 1); | ||
| 135 | |||
| 136 | /* | ||
| 137 | * As addr_prel31 is relative to start an offset is needed to | ||
| 138 | * make it relative to mid. | ||
| 139 | */ | ||
| 140 | if (addr_prel31 - ((unsigned long)mid - (unsigned long)start) < | ||
| 141 | mid->addr_offset) | ||
| 142 | stop = mid; | ||
| 143 | else { | ||
| 144 | /* keep addr_prel31 relative to start */ | ||
| 145 | addr_prel31 -= ((unsigned long)mid - | ||
| 146 | (unsigned long)start); | ||
| 147 | start = mid; | ||
| 148 | } | ||
| 149 | } | ||
| 150 | |||
| 151 | if (likely(start->addr_offset <= addr_prel31)) | ||
| 152 | return start; | ||
| 153 | else { | ||
| 111 | pr_warning("unwind: Unknown symbol address %08lx\n", addr); | 154 | pr_warning("unwind: Unknown symbol address %08lx\n", addr); |
| 112 | return NULL; | 155 | return NULL; |
| 113 | } else if (addr >= last->addr) | 156 | } |
| 114 | return last; | 157 | } |
| 115 | 158 | ||
| 116 | while (first < last - 1) { | 159 | static const struct unwind_idx *unwind_find_origin( |
| 117 | struct unwind_idx *mid = first + ((last - first + 1) >> 1); | 160 | const struct unwind_idx *start, const struct unwind_idx *stop) |
| 161 | { | ||
| 162 | pr_debug("%s(%p, %p)\n", __func__, start, stop); | ||
| 163 | while (start < stop) { | ||
| 164 | const struct unwind_idx *mid = start + ((stop - start) >> 1); | ||
| 118 | 165 | ||
| 119 | if (addr < mid->addr) | 166 | if (mid->addr_offset >= 0x40000000) |
| 120 | last = mid; | 167 | /* negative offset */ |
| 168 | start = mid + 1; | ||
| 121 | else | 169 | else |
| 122 | first = mid; | 170 | /* positive offset */ |
| 171 | stop = mid; | ||
| 123 | } | 172 | } |
| 124 | 173 | pr_debug("%s -> %p\n", __func__, stop); | |
| 125 | return first; | 174 | return stop; |
| 126 | } | 175 | } |
| 127 | 176 | ||
| 128 | static struct unwind_idx *unwind_find_idx(unsigned long addr) | 177 | static const struct unwind_idx *unwind_find_idx(unsigned long addr) |
| 129 | { | 178 | { |
| 130 | struct unwind_idx *idx = NULL; | 179 | const struct unwind_idx *idx = NULL; |
| 131 | unsigned long flags; | 180 | unsigned long flags; |
| 132 | 181 | ||
| 133 | pr_debug("%s(%08lx)\n", __func__, addr); | 182 | pr_debug("%s(%08lx)\n", __func__, addr); |
| 134 | 183 | ||
| 135 | if (core_kernel_text(addr)) | 184 | if (core_kernel_text(addr)) { |
| 185 | if (unlikely(!__origin_unwind_idx)) | ||
| 186 | __origin_unwind_idx = | ||
| 187 | unwind_find_origin(__start_unwind_idx, | ||
| 188 | __stop_unwind_idx); | ||
| 189 | |||
| 136 | /* main unwind table */ | 190 | /* main unwind table */ |
| 137 | idx = search_index(addr, __start_unwind_idx, | 191 | idx = search_index(addr, __start_unwind_idx, |
| 138 | __stop_unwind_idx - 1); | 192 | __origin_unwind_idx, |
| 139 | else { | 193 | __stop_unwind_idx); |
| 194 | } else { | ||
| 140 | /* module unwind tables */ | 195 | /* module unwind tables */ |
| 141 | struct unwind_table *table; | 196 | struct unwind_table *table; |
| 142 | 197 | ||
| @@ -145,7 +200,8 @@ static struct unwind_idx *unwind_find_idx(unsigned long addr) | |||
| 145 | if (addr >= table->begin_addr && | 200 | if (addr >= table->begin_addr && |
| 146 | addr < table->end_addr) { | 201 | addr < table->end_addr) { |
| 147 | idx = search_index(addr, table->start, | 202 | idx = search_index(addr, table->start, |
| 148 | table->stop - 1); | 203 | table->origin, |
| 204 | table->stop); | ||
| 149 | /* Move-to-front to exploit common traces */ | 205 | /* Move-to-front to exploit common traces */ |
| 150 | list_move(&table->list, &unwind_tables); | 206 | list_move(&table->list, &unwind_tables); |
| 151 | break; | 207 | break; |
| @@ -274,7 +330,7 @@ static int unwind_exec_insn(struct unwind_ctrl_block *ctrl) | |||
| 274 | int unwind_frame(struct stackframe *frame) | 330 | int unwind_frame(struct stackframe *frame) |
| 275 | { | 331 | { |
| 276 | unsigned long high, low; | 332 | unsigned long high, low; |
| 277 | struct unwind_idx *idx; | 333 | const struct unwind_idx *idx; |
| 278 | struct unwind_ctrl_block ctrl; | 334 | struct unwind_ctrl_block ctrl; |
| 279 | 335 | ||
| 280 | /* only go to a higher address on the stack */ | 336 | /* only go to a higher address on the stack */ |
| @@ -399,7 +455,6 @@ struct unwind_table *unwind_table_add(unsigned long start, unsigned long size, | |||
| 399 | unsigned long text_size) | 455 | unsigned long text_size) |
| 400 | { | 456 | { |
| 401 | unsigned long flags; | 457 | unsigned long flags; |
| 402 | struct unwind_idx *idx; | ||
| 403 | struct unwind_table *tab = kmalloc(sizeof(*tab), GFP_KERNEL); | 458 | struct unwind_table *tab = kmalloc(sizeof(*tab), GFP_KERNEL); |
| 404 | 459 | ||
| 405 | pr_debug("%s(%08lx, %08lx, %08lx, %08lx)\n", __func__, start, size, | 460 | pr_debug("%s(%08lx, %08lx, %08lx, %08lx)\n", __func__, start, size, |
| @@ -408,15 +463,12 @@ struct unwind_table *unwind_table_add(unsigned long start, unsigned long size, | |||
| 408 | if (!tab) | 463 | if (!tab) |
| 409 | return tab; | 464 | return tab; |
| 410 | 465 | ||
| 411 | tab->start = (struct unwind_idx *)start; | 466 | tab->start = (const struct unwind_idx *)start; |
| 412 | tab->stop = (struct unwind_idx *)(start + size); | 467 | tab->stop = (const struct unwind_idx *)(start + size); |
| 468 | tab->origin = unwind_find_origin(tab->start, tab->stop); | ||
| 413 | tab->begin_addr = text_addr; | 469 | tab->begin_addr = text_addr; |
| 414 | tab->end_addr = text_addr + text_size; | 470 | tab->end_addr = text_addr + text_size; |
| 415 | 471 | ||
| 416 | /* Convert the symbol addresses to absolute values */ | ||
| 417 | for (idx = tab->start; idx < tab->stop; idx++) | ||
| 418 | idx->addr = prel31_to_addr(&idx->addr); | ||
| 419 | |||
| 420 | spin_lock_irqsave(&unwind_lock, flags); | 472 | spin_lock_irqsave(&unwind_lock, flags); |
| 421 | list_add_tail(&tab->list, &unwind_tables); | 473 | list_add_tail(&tab->list, &unwind_tables); |
| 422 | spin_unlock_irqrestore(&unwind_lock, flags); | 474 | spin_unlock_irqrestore(&unwind_lock, flags); |
| @@ -437,16 +489,3 @@ void unwind_table_del(struct unwind_table *tab) | |||
| 437 | 489 | ||
| 438 | kfree(tab); | 490 | kfree(tab); |
| 439 | } | 491 | } |
| 440 | |||
| 441 | int __init unwind_init(void) | ||
| 442 | { | ||
| 443 | struct unwind_idx *idx; | ||
| 444 | |||
| 445 | /* Convert the symbol addresses to absolute values */ | ||
| 446 | for (idx = __start_unwind_idx; idx < __stop_unwind_idx; idx++) | ||
| 447 | idx->addr = prel31_to_addr(&idx->addr); | ||
| 448 | |||
| 449 | pr_debug("unwind: ARM stack unwinding initialised\n"); | ||
| 450 | |||
| 451 | return 0; | ||
| 452 | } | ||
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index 66591fa53e05..ad930688358c 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
| @@ -83,7 +83,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
| 83 | * USB Device (Gadget) | 83 | * USB Device (Gadget) |
| 84 | * -------------------------------------------------------------------- */ | 84 | * -------------------------------------------------------------------- */ |
| 85 | 85 | ||
| 86 | #ifdef CONFIG_USB_GADGET_AT91 | 86 | #ifdef CONFIG_USB_AT91 |
| 87 | static struct at91_udc_data udc_data; | 87 | static struct at91_udc_data udc_data; |
| 88 | 88 | ||
| 89 | static struct resource udc_resources[] = { | 89 | static struct resource udc_resources[] = { |
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index b84a9f642f59..0d20677fbef0 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c | |||
| @@ -195,9 +195,9 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
| 195 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), | 195 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), |
| 196 | CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk), | 196 | CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk), |
| 197 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk), | 197 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk), |
| 198 | CLKDEV_CON_DEV_ID("t3_clk", "atmel_tcb.1", &tc3_clk), | 198 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk), |
| 199 | CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk), | 199 | CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk), |
| 200 | CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk), | 200 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk), |
| 201 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), | 201 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), |
| 202 | /* more usart lookup table for DT entries */ | 202 | /* more usart lookup table for DT entries */ |
| 203 | CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), | 203 | CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 25e3464fb07f..629fa9774972 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
| @@ -84,7 +84,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
| 84 | * USB Device (Gadget) | 84 | * USB Device (Gadget) |
| 85 | * -------------------------------------------------------------------- */ | 85 | * -------------------------------------------------------------------- */ |
| 86 | 86 | ||
| 87 | #ifdef CONFIG_USB_GADGET_AT91 | 87 | #ifdef CONFIG_USB_AT91 |
| 88 | static struct at91_udc_data udc_data; | 88 | static struct at91_udc_data udc_data; |
| 89 | 89 | ||
| 90 | static struct resource udc_resources[] = { | 90 | static struct resource udc_resources[] = { |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index ae78f4d03b73..a178b58b0b9c 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
| @@ -87,7 +87,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
| 87 | * USB Device (Gadget) | 87 | * USB Device (Gadget) |
| 88 | * -------------------------------------------------------------------- */ | 88 | * -------------------------------------------------------------------- */ |
| 89 | 89 | ||
| 90 | #ifdef CONFIG_USB_GADGET_AT91 | 90 | #ifdef CONFIG_USB_AT91 |
| 91 | static struct at91_udc_data udc_data; | 91 | static struct at91_udc_data udc_data; |
| 92 | 92 | ||
| 93 | static struct resource udc_resources[] = { | 93 | static struct resource udc_resources[] = { |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index ad017eb1f8df..d5fbac9ff4fa 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
| @@ -92,7 +92,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
| 92 | * USB Device (Gadget) | 92 | * USB Device (Gadget) |
| 93 | * -------------------------------------------------------------------- */ | 93 | * -------------------------------------------------------------------- */ |
| 94 | 94 | ||
| 95 | #ifdef CONFIG_USB_GADGET_AT91 | 95 | #ifdef CONFIG_USB_AT91 |
| 96 | static struct at91_udc_data udc_data; | 96 | static struct at91_udc_data udc_data; |
| 97 | 97 | ||
| 98 | static struct resource udc_resources[] = { | 98 | static struct resource udc_resources[] = { |
diff --git a/arch/arm/mach-at91/include/mach/system_rev.h b/arch/arm/mach-at91/include/mach/system_rev.h index 8f4866045b41..ec164a4124c9 100644 --- a/arch/arm/mach-at91/include/mach/system_rev.h +++ b/arch/arm/mach-at91/include/mach/system_rev.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | #define BOARD_HAVE_NAND_16BIT (1 << 31) | 19 | #define BOARD_HAVE_NAND_16BIT (1 << 31) |
| 20 | static inline int board_have_nand_16bit(void) | 20 | static inline int board_have_nand_16bit(void) |
| 21 | { | 21 | { |
| 22 | return system_rev & BOARD_HAVE_NAND_16BIT; | 22 | return (system_rev & BOARD_HAVE_NAND_16BIT) ? 1 : 0; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | #endif /* __ARCH_SYSTEM_REV_H__ */ | 25 | #endif /* __ARCH_SYSTEM_REV_H__ */ |
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 1d7d24995226..6659a90dbcad 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c | |||
| @@ -753,7 +753,7 @@ static struct snd_platform_data da850_evm_snd_data = { | |||
| 753 | .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), | 753 | .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), |
| 754 | .tdm_slots = 2, | 754 | .tdm_slots = 2, |
| 755 | .serial_dir = da850_iis_serializer_direction, | 755 | .serial_dir = da850_iis_serializer_direction, |
| 756 | .asp_chan_q = EVENTQ_1, | 756 | .asp_chan_q = EVENTQ_0, |
| 757 | .version = MCASP_VERSION_2, | 757 | .version = MCASP_VERSION_2, |
| 758 | .txnumevt = 1, | 758 | .txnumevt = 1, |
| 759 | .rxnumevt = 1, | 759 | .rxnumevt = 1, |
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index 1918ae711428..46e1f4173b97 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c | |||
| @@ -107,7 +107,7 @@ static struct mtd_partition davinci_nand_partitions[] = { | |||
| 107 | /* UBL (a few copies) plus U-Boot */ | 107 | /* UBL (a few copies) plus U-Boot */ |
| 108 | .name = "bootloader", | 108 | .name = "bootloader", |
| 109 | .offset = 0, | 109 | .offset = 0, |
| 110 | .size = 28 * NAND_BLOCK_SIZE, | 110 | .size = 30 * NAND_BLOCK_SIZE, |
| 111 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | 111 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 112 | }, { | 112 | }, { |
| 113 | /* U-Boot environment */ | 113 | /* U-Boot environment */ |
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index e574d7f837a8..635bf7740157 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c | |||
| @@ -564,7 +564,7 @@ static int setup_vpif_input_channel_mode(int mux_mode) | |||
| 564 | int val; | 564 | int val; |
| 565 | u32 value; | 565 | u32 value; |
| 566 | 566 | ||
| 567 | if (!vpif_vsclkdis_reg || !cpld_client) | 567 | if (!vpif_vidclkctl_reg || !cpld_client) |
| 568 | return -ENXIO; | 568 | return -ENXIO; |
| 569 | 569 | ||
| 570 | val = i2c_smbus_read_byte(cpld_client); | 570 | val = i2c_smbus_read_byte(cpld_client); |
| @@ -572,7 +572,7 @@ static int setup_vpif_input_channel_mode(int mux_mode) | |||
| 572 | return val; | 572 | return val; |
| 573 | 573 | ||
| 574 | spin_lock_irqsave(&vpif_reg_lock, flags); | 574 | spin_lock_irqsave(&vpif_reg_lock, flags); |
| 575 | value = __raw_readl(vpif_vsclkdis_reg); | 575 | value = __raw_readl(vpif_vidclkctl_reg); |
| 576 | if (mux_mode) { | 576 | if (mux_mode) { |
| 577 | val &= VPIF_INPUT_TWO_CHANNEL; | 577 | val &= VPIF_INPUT_TWO_CHANNEL; |
| 578 | value |= VIDCH1CLK; | 578 | value |= VIDCH1CLK; |
| @@ -580,7 +580,7 @@ static int setup_vpif_input_channel_mode(int mux_mode) | |||
| 580 | val |= VPIF_INPUT_ONE_CHANNEL; | 580 | val |= VPIF_INPUT_ONE_CHANNEL; |
| 581 | value &= ~VIDCH1CLK; | 581 | value &= ~VIDCH1CLK; |
| 582 | } | 582 | } |
| 583 | __raw_writel(value, vpif_vsclkdis_reg); | 583 | __raw_writel(value, vpif_vidclkctl_reg); |
| 584 | spin_unlock_irqrestore(&vpif_reg_lock, flags); | 584 | spin_unlock_irqrestore(&vpif_reg_lock, flags); |
| 585 | 585 | ||
| 586 | err = i2c_smbus_write_byte(cpld_client, val); | 586 | err = i2c_smbus_write_byte(cpld_client, val); |
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 0b68ed534f8e..af27c130595f 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c | |||
| @@ -161,7 +161,6 @@ static struct clk dsp_clk = { | |||
| 161 | .name = "dsp", | 161 | .name = "dsp", |
| 162 | .parent = &pll1_sysclk1, | 162 | .parent = &pll1_sysclk1, |
| 163 | .lpsc = DM646X_LPSC_C64X_CPU, | 163 | .lpsc = DM646X_LPSC_C64X_CPU, |
| 164 | .flags = PSC_DSP, | ||
| 165 | .usecount = 1, /* REVISIT how to disable? */ | 164 | .usecount = 1, /* REVISIT how to disable? */ |
| 166 | }; | 165 | }; |
| 167 | 166 | ||
diff --git a/arch/arm/mach-davinci/include/mach/psc.h b/arch/arm/mach-davinci/include/mach/psc.h index fa59c097223d..8bc3fc256171 100644 --- a/arch/arm/mach-davinci/include/mach/psc.h +++ b/arch/arm/mach-davinci/include/mach/psc.h | |||
| @@ -233,7 +233,7 @@ | |||
| 233 | #define PTCMD 0x120 | 233 | #define PTCMD 0x120 |
| 234 | #define PTSTAT 0x128 | 234 | #define PTSTAT 0x128 |
| 235 | #define PDSTAT 0x200 | 235 | #define PDSTAT 0x200 |
| 236 | #define PDCTL1 0x304 | 236 | #define PDCTL 0x300 |
| 237 | #define MDSTAT 0x800 | 237 | #define MDSTAT 0x800 |
| 238 | #define MDCTL 0xA00 | 238 | #define MDCTL 0xA00 |
| 239 | 239 | ||
| @@ -244,7 +244,10 @@ | |||
| 244 | #define PSC_STATE_ENABLE 3 | 244 | #define PSC_STATE_ENABLE 3 |
| 245 | 245 | ||
| 246 | #define MDSTAT_STATE_MASK 0x3f | 246 | #define MDSTAT_STATE_MASK 0x3f |
| 247 | #define PDSTAT_STATE_MASK 0x1f | ||
| 247 | #define MDCTL_FORCE BIT(31) | 248 | #define MDCTL_FORCE BIT(31) |
| 249 | #define PDCTL_NEXT BIT(1) | ||
| 250 | #define PDCTL_EPCGOOD BIT(8) | ||
| 248 | 251 | ||
| 249 | #ifndef __ASSEMBLER__ | 252 | #ifndef __ASSEMBLER__ |
| 250 | 253 | ||
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c index 1fb6bdff38c1..d7e210f4b55c 100644 --- a/arch/arm/mach-davinci/psc.c +++ b/arch/arm/mach-davinci/psc.c | |||
| @@ -52,7 +52,7 @@ int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id) | |||
| 52 | void davinci_psc_config(unsigned int domain, unsigned int ctlr, | 52 | void davinci_psc_config(unsigned int domain, unsigned int ctlr, |
| 53 | unsigned int id, bool enable, u32 flags) | 53 | unsigned int id, bool enable, u32 flags) |
| 54 | { | 54 | { |
| 55 | u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl; | 55 | u32 epcpr, ptcmd, ptstat, pdstat, pdctl, mdstat, mdctl; |
| 56 | void __iomem *psc_base; | 56 | void __iomem *psc_base; |
| 57 | struct davinci_soc_info *soc_info = &davinci_soc_info; | 57 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 58 | u32 next_state = PSC_STATE_ENABLE; | 58 | u32 next_state = PSC_STATE_ENABLE; |
| @@ -79,11 +79,11 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr, | |||
| 79 | mdctl |= MDCTL_FORCE; | 79 | mdctl |= MDCTL_FORCE; |
| 80 | __raw_writel(mdctl, psc_base + MDCTL + 4 * id); | 80 | __raw_writel(mdctl, psc_base + MDCTL + 4 * id); |
| 81 | 81 | ||
| 82 | pdstat = __raw_readl(psc_base + PDSTAT); | 82 | pdstat = __raw_readl(psc_base + PDSTAT + 4 * domain); |
| 83 | if ((pdstat & 0x00000001) == 0) { | 83 | if ((pdstat & PDSTAT_STATE_MASK) == 0) { |
| 84 | pdctl1 = __raw_readl(psc_base + PDCTL1); | 84 | pdctl = __raw_readl(psc_base + PDCTL + 4 * domain); |
| 85 | pdctl1 |= 0x1; | 85 | pdctl |= PDCTL_NEXT; |
| 86 | __raw_writel(pdctl1, psc_base + PDCTL1); | 86 | __raw_writel(pdctl, psc_base + PDCTL + 4 * domain); |
| 87 | 87 | ||
| 88 | ptcmd = 1 << domain; | 88 | ptcmd = 1 << domain; |
| 89 | __raw_writel(ptcmd, psc_base + PTCMD); | 89 | __raw_writel(ptcmd, psc_base + PTCMD); |
| @@ -92,9 +92,9 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr, | |||
| 92 | epcpr = __raw_readl(psc_base + EPCPR); | 92 | epcpr = __raw_readl(psc_base + EPCPR); |
| 93 | } while ((((epcpr >> domain) & 1) == 0)); | 93 | } while ((((epcpr >> domain) & 1) == 0)); |
| 94 | 94 | ||
| 95 | pdctl1 = __raw_readl(psc_base + PDCTL1); | 95 | pdctl = __raw_readl(psc_base + PDCTL + 4 * domain); |
| 96 | pdctl1 |= 0x100; | 96 | pdctl |= PDCTL_EPCGOOD; |
| 97 | __raw_writel(pdctl1, psc_base + PDCTL1); | 97 | __raw_writel(pdctl, psc_base + PDCTL + 4 * domain); |
| 98 | } else { | 98 | } else { |
| 99 | ptcmd = 1 << domain; | 99 | ptcmd = 1 << domain; |
| 100 | __raw_writel(ptcmd, psc_base + PTCMD); | 100 | __raw_writel(ptcmd, psc_base + PTCMD); |
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c index 97343df8f132..85b5527d0918 100644 --- a/arch/arm/mach-exynos/mct.c +++ b/arch/arm/mach-exynos/mct.c | |||
| @@ -44,8 +44,6 @@ struct mct_clock_event_device { | |||
| 44 | char name[10]; | 44 | char name[10]; |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | static DEFINE_PER_CPU(struct mct_clock_event_device, percpu_mct_tick); | ||
| 48 | |||
| 49 | static void exynos4_mct_write(unsigned int value, void *addr) | 47 | static void exynos4_mct_write(unsigned int value, void *addr) |
| 50 | { | 48 | { |
| 51 | void __iomem *stat_addr; | 49 | void __iomem *stat_addr; |
| @@ -264,6 +262,9 @@ static void exynos4_clockevent_init(void) | |||
| 264 | } | 262 | } |
| 265 | 263 | ||
| 266 | #ifdef CONFIG_LOCAL_TIMERS | 264 | #ifdef CONFIG_LOCAL_TIMERS |
| 265 | |||
| 266 | static DEFINE_PER_CPU(struct mct_clock_event_device, percpu_mct_tick); | ||
| 267 | |||
| 267 | /* Clock event handling */ | 268 | /* Clock event handling */ |
| 268 | static void exynos4_mct_tick_stop(struct mct_clock_event_device *mevt) | 269 | static void exynos4_mct_tick_stop(struct mct_clock_event_device *mevt) |
| 269 | { | 270 | { |
| @@ -428,9 +429,13 @@ int __cpuinit local_timer_setup(struct clock_event_device *evt) | |||
| 428 | 429 | ||
| 429 | void local_timer_stop(struct clock_event_device *evt) | 430 | void local_timer_stop(struct clock_event_device *evt) |
| 430 | { | 431 | { |
| 432 | unsigned int cpu = smp_processor_id(); | ||
| 431 | evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); | 433 | evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); |
| 432 | if (mct_int_type == MCT_INT_SPI) | 434 | if (mct_int_type == MCT_INT_SPI) |
| 433 | disable_irq(evt->irq); | 435 | if (cpu == 0) |
| 436 | remove_irq(evt->irq, &mct_tick0_event_irq); | ||
| 437 | else | ||
| 438 | remove_irq(evt->irq, &mct_tick1_event_irq); | ||
| 434 | else | 439 | else |
| 435 | disable_percpu_irq(IRQ_MCT_LOCALTIMER); | 440 | disable_percpu_irq(IRQ_MCT_LOCALTIMER); |
| 436 | } | 441 | } |
| @@ -443,6 +448,7 @@ static void __init exynos4_timer_resources(void) | |||
| 443 | 448 | ||
| 444 | clk_rate = clk_get_rate(mct_clk); | 449 | clk_rate = clk_get_rate(mct_clk); |
| 445 | 450 | ||
| 451 | #ifdef CONFIG_LOCAL_TIMERS | ||
| 446 | if (mct_int_type == MCT_INT_PPI) { | 452 | if (mct_int_type == MCT_INT_PPI) { |
| 447 | int err; | 453 | int err; |
| 448 | 454 | ||
| @@ -452,6 +458,7 @@ static void __init exynos4_timer_resources(void) | |||
| 452 | WARN(err, "MCT: can't request IRQ %d (%d)\n", | 458 | WARN(err, "MCT: can't request IRQ %d (%d)\n", |
| 453 | IRQ_MCT_LOCALTIMER, err); | 459 | IRQ_MCT_LOCALTIMER, err); |
| 454 | } | 460 | } |
| 461 | #endif /* CONFIG_LOCAL_TIMERS */ | ||
| 455 | } | 462 | } |
| 456 | 463 | ||
| 457 | static void __init exynos4_timer_init(void) | 464 | static void __init exynos4_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 9cd860a27af5..8deb012189b5 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c | |||
| @@ -37,14 +37,15 @@ static void __init imx6q_map_io(void) | |||
| 37 | imx6q_clock_map_io(); | 37 | imx6q_clock_map_io(); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | static void __init imx6q_gpio_add_irq_domain(struct device_node *np, | 40 | static int __init imx6q_gpio_add_irq_domain(struct device_node *np, |
| 41 | struct device_node *interrupt_parent) | 41 | struct device_node *interrupt_parent) |
| 42 | { | 42 | { |
| 43 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS - | 43 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
| 44 | 32 * 7; /* imx6q gets 7 gpio ports */ | ||
| 45 | 44 | ||
| 45 | gpio_irq_base -= 32; | ||
| 46 | irq_domain_add_simple(np, gpio_irq_base); | 46 | irq_domain_add_simple(np, gpio_irq_base); |
| 47 | gpio_irq_base += 32; | 47 | |
| 48 | return 0; | ||
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | static const struct of_device_id imx6q_irq_match[] __initconst = { | 51 | static const struct of_device_id imx6q_irq_match[] __initconst = { |
diff --git a/arch/arm/mach-msm/devices-iommu.c b/arch/arm/mach-msm/devices-iommu.c index 24030d0da6e3..0fb7a17df398 100644 --- a/arch/arm/mach-msm/devices-iommu.c +++ b/arch/arm/mach-msm/devices-iommu.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
| 20 | #include <linux/bootmem.h> | 20 | #include <linux/bootmem.h> |
| 21 | #include <linux/module.h> | ||
| 21 | #include <mach/irqs.h> | 22 | #include <mach/irqs.h> |
| 22 | #include <mach/iommu.h> | 23 | #include <mach/iommu.h> |
| 23 | 24 | ||
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c index 5c837603ff0f..24994bb52147 100644 --- a/arch/arm/mach-mx5/board-mx51_babbage.c +++ b/arch/arm/mach-mx5/board-mx51_babbage.c | |||
| @@ -362,7 +362,7 @@ static void __init mx51_babbage_init(void) | |||
| 362 | { | 362 | { |
| 363 | iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; | 363 | iomux_v3_cfg_t usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; |
| 364 | iomux_v3_cfg_t power_key = NEW_PAD_CTRL(MX51_PAD_EIM_A27__GPIO2_21, | 364 | iomux_v3_cfg_t power_key = NEW_PAD_CTRL(MX51_PAD_EIM_A27__GPIO2_21, |
| 365 | PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP); | 365 | PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH); |
| 366 | 366 | ||
| 367 | imx51_soc_init(); | 367 | imx51_soc_init(); |
| 368 | 368 | ||
diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c index 6bea31ab8f85..64bbfcea6f35 100644 --- a/arch/arm/mach-mx5/board-mx53_evk.c +++ b/arch/arm/mach-mx5/board-mx53_evk.c | |||
| @@ -106,7 +106,7 @@ static inline void mx53_evk_fec_reset(void) | |||
| 106 | gpio_set_value(MX53_EVK_FEC_PHY_RST, 1); | 106 | gpio_set_value(MX53_EVK_FEC_PHY_RST, 1); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | static struct fec_platform_data mx53_evk_fec_pdata = { | 109 | static const struct fec_platform_data mx53_evk_fec_pdata __initconst = { |
| 110 | .phy = PHY_INTERFACE_MODE_RMII, | 110 | .phy = PHY_INTERFACE_MODE_RMII, |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c index 7678f7734db6..237bdecd9331 100644 --- a/arch/arm/mach-mx5/board-mx53_loco.c +++ b/arch/arm/mach-mx5/board-mx53_loco.c | |||
| @@ -242,7 +242,7 @@ static inline void mx53_loco_fec_reset(void) | |||
| 242 | gpio_set_value(LOCO_FEC_PHY_RST, 1); | 242 | gpio_set_value(LOCO_FEC_PHY_RST, 1); |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | static struct fec_platform_data mx53_loco_fec_data = { | 245 | static const struct fec_platform_data mx53_loco_fec_data __initconst = { |
| 246 | .phy = PHY_INTERFACE_MODE_RMII, | 246 | .phy = PHY_INTERFACE_MODE_RMII, |
| 247 | }; | 247 | }; |
| 248 | 248 | ||
diff --git a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c index 59c0845eb4a6..d42132a80e8f 100644 --- a/arch/arm/mach-mx5/board-mx53_smd.c +++ b/arch/arm/mach-mx5/board-mx53_smd.c | |||
| @@ -104,7 +104,7 @@ static inline void mx53_smd_fec_reset(void) | |||
| 104 | gpio_set_value(SMD_FEC_PHY_RST, 1); | 104 | gpio_set_value(SMD_FEC_PHY_RST, 1); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | static struct fec_platform_data mx53_smd_fec_data = { | 107 | static const struct fec_platform_data mx53_smd_fec_data __initconst = { |
| 108 | .phy = PHY_INTERFACE_MODE_RMII, | 108 | .phy = PHY_INTERFACE_MODE_RMII, |
| 109 | }; | 109 | }; |
| 110 | 110 | ||
diff --git a/arch/arm/mach-mx5/imx51-dt.c b/arch/arm/mach-mx5/imx51-dt.c index ccc61585659b..596edd967dbf 100644 --- a/arch/arm/mach-mx5/imx51-dt.c +++ b/arch/arm/mach-mx5/imx51-dt.c | |||
| @@ -44,20 +44,22 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = { | |||
| 44 | { /* sentinel */ } | 44 | { /* sentinel */ } |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | static void __init imx51_tzic_add_irq_domain(struct device_node *np, | 47 | static int __init imx51_tzic_add_irq_domain(struct device_node *np, |
| 48 | struct device_node *interrupt_parent) | 48 | struct device_node *interrupt_parent) |
| 49 | { | 49 | { |
| 50 | irq_domain_add_simple(np, 0); | 50 | irq_domain_add_simple(np, 0); |
| 51 | return 0; | ||
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | static void __init imx51_gpio_add_irq_domain(struct device_node *np, | 54 | static int __init imx51_gpio_add_irq_domain(struct device_node *np, |
| 54 | struct device_node *interrupt_parent) | 55 | struct device_node *interrupt_parent) |
| 55 | { | 56 | { |
| 56 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS - | 57 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
| 57 | 32 * 4; /* imx51 gets 4 gpio ports */ | ||
| 58 | 58 | ||
| 59 | gpio_irq_base -= 32; | ||
| 59 | irq_domain_add_simple(np, gpio_irq_base); | 60 | irq_domain_add_simple(np, gpio_irq_base); |
| 60 | gpio_irq_base += 32; | 61 | |
| 62 | return 0; | ||
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | static const struct of_device_id imx51_irq_match[] __initconst = { | 65 | static const struct of_device_id imx51_irq_match[] __initconst = { |
diff --git a/arch/arm/mach-mx5/imx53-dt.c b/arch/arm/mach-mx5/imx53-dt.c index ccaa0b81b768..85bfd5ff21b0 100644 --- a/arch/arm/mach-mx5/imx53-dt.c +++ b/arch/arm/mach-mx5/imx53-dt.c | |||
| @@ -48,20 +48,22 @@ static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = { | |||
| 48 | { /* sentinel */ } | 48 | { /* sentinel */ } |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | static void __init imx53_tzic_add_irq_domain(struct device_node *np, | 51 | static int __init imx53_tzic_add_irq_domain(struct device_node *np, |
| 52 | struct device_node *interrupt_parent) | 52 | struct device_node *interrupt_parent) |
| 53 | { | 53 | { |
| 54 | irq_domain_add_simple(np, 0); | 54 | irq_domain_add_simple(np, 0); |
| 55 | return 0; | ||
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | static void __init imx53_gpio_add_irq_domain(struct device_node *np, | 58 | static int __init imx53_gpio_add_irq_domain(struct device_node *np, |
| 58 | struct device_node *interrupt_parent) | 59 | struct device_node *interrupt_parent) |
| 59 | { | 60 | { |
| 60 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS - | 61 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
| 61 | 32 * 7; /* imx53 gets 7 gpio ports */ | ||
| 62 | 62 | ||
| 63 | gpio_irq_base -= 32; | ||
| 63 | irq_domain_add_simple(np, gpio_irq_base); | 64 | irq_domain_add_simple(np, gpio_irq_base); |
| 64 | gpio_irq_base += 32; | 65 | |
| 66 | return 0; | ||
| 65 | } | 67 | } |
| 66 | 68 | ||
| 67 | static const struct of_device_id imx53_irq_match[] __initconst = { | 69 | static const struct of_device_id imx53_irq_match[] __initconst = { |
diff --git a/arch/arm/mach-mxs/include/mach/mx28.h b/arch/arm/mach-mxs/include/mach/mx28.h index 75d86118b76a..30c7990f3c01 100644 --- a/arch/arm/mach-mxs/include/mach/mx28.h +++ b/arch/arm/mach-mxs/include/mach/mx28.h | |||
| @@ -104,8 +104,8 @@ | |||
| 104 | #define MX28_INT_CAN1 9 | 104 | #define MX28_INT_CAN1 9 |
| 105 | #define MX28_INT_LRADC_TOUCH 10 | 105 | #define MX28_INT_LRADC_TOUCH 10 |
| 106 | #define MX28_INT_HSADC 13 | 106 | #define MX28_INT_HSADC 13 |
| 107 | #define MX28_INT_IRADC_THRESH0 14 | 107 | #define MX28_INT_LRADC_THRESH0 14 |
| 108 | #define MX28_INT_IRADC_THRESH1 15 | 108 | #define MX28_INT_LRADC_THRESH1 15 |
| 109 | #define MX28_INT_LRADC_CH0 16 | 109 | #define MX28_INT_LRADC_CH0 16 |
| 110 | #define MX28_INT_LRADC_CH1 17 | 110 | #define MX28_INT_LRADC_CH1 17 |
| 111 | #define MX28_INT_LRADC_CH2 18 | 111 | #define MX28_INT_LRADC_CH2 18 |
diff --git a/arch/arm/mach-mxs/include/mach/mxs.h b/arch/arm/mach-mxs/include/mach/mxs.h index 0d2d2b470998..bde5f6634747 100644 --- a/arch/arm/mach-mxs/include/mach/mxs.h +++ b/arch/arm/mach-mxs/include/mach/mxs.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | */ | 30 | */ |
| 31 | #define cpu_is_mx23() ( \ | 31 | #define cpu_is_mx23() ( \ |
| 32 | machine_is_mx23evk() || \ | 32 | machine_is_mx23evk() || \ |
| 33 | machine_is_stmp378x() || \ | ||
| 33 | 0) | 34 | 0) |
| 34 | #define cpu_is_mx28() ( \ | 35 | #define cpu_is_mx28() ( \ |
| 35 | machine_is_mx28evk() || \ | 36 | machine_is_mx28evk() || \ |
diff --git a/arch/arm/mach-mxs/mach-m28evk.c b/arch/arm/mach-mxs/mach-m28evk.c index 3b1681e4f49a..6b00577b7025 100644 --- a/arch/arm/mach-mxs/mach-m28evk.c +++ b/arch/arm/mach-mxs/mach-m28evk.c | |||
| @@ -361,6 +361,6 @@ static struct sys_timer m28evk_timer = { | |||
| 361 | MACHINE_START(M28EVK, "DENX M28 EVK") | 361 | MACHINE_START(M28EVK, "DENX M28 EVK") |
| 362 | .map_io = mx28_map_io, | 362 | .map_io = mx28_map_io, |
| 363 | .init_irq = mx28_init_irq, | 363 | .init_irq = mx28_init_irq, |
| 364 | .init_machine = m28evk_init, | ||
| 365 | .timer = &m28evk_timer, | 364 | .timer = &m28evk_timer, |
| 365 | .init_machine = m28evk_init, | ||
| 366 | MACHINE_END | 366 | MACHINE_END |
diff --git a/arch/arm/mach-mxs/mach-stmp378x_devb.c b/arch/arm/mach-mxs/mach-stmp378x_devb.c index 177e53123a02..6834dea38c04 100644 --- a/arch/arm/mach-mxs/mach-stmp378x_devb.c +++ b/arch/arm/mach-mxs/mach-stmp378x_devb.c | |||
| @@ -115,6 +115,6 @@ static struct sys_timer stmp378x_dvb_timer = { | |||
| 115 | MACHINE_START(STMP378X, "STMP378X") | 115 | MACHINE_START(STMP378X, "STMP378X") |
| 116 | .map_io = mx23_map_io, | 116 | .map_io = mx23_map_io, |
| 117 | .init_irq = mx23_init_irq, | 117 | .init_irq = mx23_init_irq, |
| 118 | .init_machine = stmp378x_dvb_init, | ||
| 119 | .timer = &stmp378x_dvb_timer, | 118 | .timer = &stmp378x_dvb_timer, |
| 119 | .init_machine = stmp378x_dvb_init, | ||
| 120 | MACHINE_END | 120 | MACHINE_END |
diff --git a/arch/arm/mach-mxs/module-tx28.c b/arch/arm/mach-mxs/module-tx28.c index 0fcff47009cf..9a7b08b2a925 100644 --- a/arch/arm/mach-mxs/module-tx28.c +++ b/arch/arm/mach-mxs/module-tx28.c | |||
| @@ -66,11 +66,11 @@ static const iomux_cfg_t tx28_fec1_pads[] __initconst = { | |||
| 66 | MX28_PAD_ENET0_CRS__ENET1_RX_EN, | 66 | MX28_PAD_ENET0_CRS__ENET1_RX_EN, |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | static struct fec_platform_data tx28_fec0_data = { | 69 | static const struct fec_platform_data tx28_fec0_data __initconst = { |
| 70 | .phy = PHY_INTERFACE_MODE_RMII, | 70 | .phy = PHY_INTERFACE_MODE_RMII, |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | static struct fec_platform_data tx28_fec1_data = { | 73 | static const struct fec_platform_data tx28_fec1_data __initconst = { |
| 74 | .phy = PHY_INTERFACE_MODE_RMII, | 74 | .phy = PHY_INTERFACE_MODE_RMII, |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index 1297bb58869c..9ff90a744a21 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | 16 | ||
| 17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
| 18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
| 19 | #include <linux/cpufreq.h> | ||
| 20 | #include <linux/delay.h> | ||
| 19 | #include <linux/io.h> | 21 | #include <linux/io.h> |
| 20 | 22 | ||
| 21 | #include <asm/mach-types.h> /* for machine_is_* */ | 23 | #include <asm/mach-types.h> /* for machine_is_* */ |
| @@ -927,16 +929,22 @@ int __init omap1_clk_init(void) | |||
| 927 | 929 | ||
| 928 | void __init omap1_clk_late_init(void) | 930 | void __init omap1_clk_late_init(void) |
| 929 | { | 931 | { |
| 930 | if (ck_dpll1.rate >= OMAP1_DPLL1_SANE_VALUE) | 932 | unsigned long rate = ck_dpll1.rate; |
| 933 | |||
| 934 | if (rate >= OMAP1_DPLL1_SANE_VALUE) | ||
| 931 | return; | 935 | return; |
| 932 | 936 | ||
| 937 | /* System booting at unusable rate, force reprogramming of DPLL1 */ | ||
| 938 | ck_dpll1_p->rate = 0; | ||
| 939 | |||
| 933 | /* Find the highest supported frequency and enable it */ | 940 | /* Find the highest supported frequency and enable it */ |
| 934 | if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) { | 941 | if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) { |
| 935 | pr_err("System frequencies not set, using default. Check your config.\n"); | 942 | pr_err("System frequencies not set, using default. Check your config.\n"); |
| 936 | omap_writew(0x2290, DPLL_CTL); | 943 | omap_writew(0x2290, DPLL_CTL); |
| 937 | omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL); | 944 | omap_writew(cpu_is_omap7xx() ? 0x2005 : 0x0005, ARM_CKCTL); |
| 938 | ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE; | 945 | ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE; |
| 939 | } | 946 | } |
| 940 | propagate_rate(&ck_dpll1); | 947 | propagate_rate(&ck_dpll1); |
| 941 | omap1_show_rates(); | 948 | omap1_show_rates(); |
| 949 | loops_per_jiffy = cpufreq_scale(loops_per_jiffy, rate, ck_dpll1.rate); | ||
| 942 | } | 950 | } |
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index ba1aa07bdb29..c15c5c9c9085 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
| @@ -193,7 +193,7 @@ static struct platform_device rx51_charger_device = { | |||
| 193 | static void __init rx51_charger_init(void) | 193 | static void __init rx51_charger_init(void) |
| 194 | { | 194 | { |
| 195 | WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO, | 195 | WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO, |
| 196 | GPIOF_OUT_INIT_LOW, "isp1704_reset")); | 196 | GPIOF_OUT_INIT_HIGH, "isp1704_reset")); |
| 197 | 197 | ||
| 198 | platform_device_register(&rx51_charger_device); | 198 | platform_device_register(&rx51_charger_device); |
| 199 | } | 199 | } |
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 292eee3be15f..28fcb27005d2 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
| @@ -145,6 +145,9 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | |||
| 145 | pdata->reg_size = 4; | 145 | pdata->reg_size = 4; |
| 146 | pdata->has_ccr = true; | 146 | pdata->has_ccr = true; |
| 147 | } | 147 | } |
| 148 | pdata->set_clk_src = omap2_mcbsp_set_clk_src; | ||
| 149 | if (id == 1) | ||
| 150 | pdata->mux_signal = omap2_mcbsp1_mux_rx_clk; | ||
| 148 | 151 | ||
| 149 | if (oh->class->rev == MCBSP_CONFIG_TYPE3) { | 152 | if (oh->class->rev == MCBSP_CONFIG_TYPE3) { |
| 150 | if (id == 2) | 153 | if (id == 2) |
| @@ -174,9 +177,6 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) | |||
| 174 | name, oh->name); | 177 | name, oh->name); |
| 175 | return PTR_ERR(pdev); | 178 | return PTR_ERR(pdev); |
| 176 | } | 179 | } |
| 177 | pdata->set_clk_src = omap2_mcbsp_set_clk_src; | ||
| 178 | if (id == 1) | ||
| 179 | pdata->mux_signal = omap2_mcbsp1_mux_rx_clk; | ||
| 180 | omap_mcbsp_count++; | 180 | omap_mcbsp_count++; |
| 181 | return 0; | 181 | return 0; |
| 182 | } | 182 | } |
diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c index cb53160f6c5d..26ebb57719df 100644 --- a/arch/arm/mach-prima2/pm.c +++ b/arch/arm/mach-prima2/pm.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 10 | #include <linux/suspend.h> | 10 | #include <linux/suspend.h> |
| 11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
| 12 | #include <linux/module.h> | ||
| 12 | #include <linux/of.h> | 13 | #include <linux/of.h> |
| 13 | #include <linux/of_address.h> | 14 | #include <linux/of_address.h> |
| 14 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
diff --git a/arch/arm/mach-prima2/prima2.c b/arch/arm/mach-prima2/prima2.c index ef555c041962..a12b689a8702 100644 --- a/arch/arm/mach-prima2/prima2.c +++ b/arch/arm/mach-prima2/prima2.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
| 10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
| 11 | #include <asm/sizes.h> | ||
| 11 | #include <asm/mach-types.h> | 12 | #include <asm/mach-types.h> |
| 12 | #include <asm/mach/arch.h> | 13 | #include <asm/mach/arch.h> |
| 13 | #include <linux/of.h> | 14 | #include <linux/of.h> |
diff --git a/arch/arm/mach-s3c64xx/dev-spi.c b/arch/arm/mach-s3c64xx/dev-spi.c index 5e6b42089eb4..3341fd118723 100644 --- a/arch/arm/mach-s3c64xx/dev-spi.c +++ b/arch/arm/mach-s3c64xx/dev-spi.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
| 12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
| 13 | #include <linux/export.h> | ||
| 13 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
| 14 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
| 15 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c index 7a3bc32df425..51c00f2453c6 100644 --- a/arch/arm/mach-s3c64xx/s3c6400.c +++ b/arch/arm/mach-s3c64xx/s3c6400.c | |||
| @@ -70,7 +70,7 @@ void __init s3c6400_init_irq(void) | |||
| 70 | s3c64xx_init_irq(~0 & ~(0xf << 5), ~0); | 70 | s3c64xx_init_irq(~0 & ~(0xf << 5), ~0); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | struct sysdev_class s3c6400_sysclass = { | 73 | static struct sysdev_class s3c6400_sysclass = { |
| 74 | .name = "s3c6400-core", | 74 | .name = "s3c6400-core", |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
diff --git a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c index 83d2afb79e9f..2cf80026c58d 100644 --- a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c +++ b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <plat/fb.h> | 20 | #include <plat/fb.h> |
| 21 | #include <plat/gpio-cfg.h> | 21 | #include <plat/gpio-cfg.h> |
| 22 | 22 | ||
| 23 | extern void s3c64xx_fb_gpio_setup_24bpp(void) | 23 | void s3c64xx_fb_gpio_setup_24bpp(void) |
| 24 | { | 24 | { |
| 25 | s3c_gpio_cfgrange_nopull(S3C64XX_GPI(0), 16, S3C_GPIO_SFN(2)); | 25 | s3c_gpio_cfgrange_nopull(S3C64XX_GPI(0), 16, S3C_GPIO_SFN(2)); |
| 26 | s3c_gpio_cfgrange_nopull(S3C64XX_GPJ(0), 12, S3C_GPIO_SFN(2)); | 26 | s3c_gpio_cfgrange_nopull(S3C64XX_GPJ(0), 12, S3C_GPIO_SFN(2)); |
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c index a9106c392398..8662ef6e5681 100644 --- a/arch/arm/mach-s5pv210/mach-smdkv210.c +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c | |||
| @@ -273,6 +273,7 @@ static struct samsung_bl_gpio_info smdkv210_bl_gpio_info = { | |||
| 273 | 273 | ||
| 274 | static struct platform_pwm_backlight_data smdkv210_bl_data = { | 274 | static struct platform_pwm_backlight_data smdkv210_bl_data = { |
| 275 | .pwm_id = 3, | 275 | .pwm_id = 3, |
| 276 | .pwm_period_ns = 1000, | ||
| 276 | }; | 277 | }; |
| 277 | 278 | ||
| 278 | static void __init smdkv210_map_io(void) | 279 | static void __init smdkv210_map_io(void) |
diff --git a/arch/arm/mach-sa1100/Makefile.boot b/arch/arm/mach-sa1100/Makefile.boot index 5a616f6e5612..f7951aa04562 100644 --- a/arch/arm/mach-sa1100/Makefile.boot +++ b/arch/arm/mach-sa1100/Makefile.boot | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ifeq ($(CONFIG_ARCH_SA1100),y) | 1 | ifeq ($(CONFIG_SA1111),y) |
| 2 | zreladdr-$(CONFIG_SA1111) += 0xc0208000 | 2 | zreladdr-y += 0xc0208000 |
| 3 | else | 3 | else |
| 4 | zreladdr-y += 0xc0008000 | 4 | zreladdr-y += 0xc0008000 |
| 5 | endif | 5 | endif |
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index b862e9f81e3e..7119b87cbfa0 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
| @@ -607,6 +607,7 @@ struct sys_timer ag5evm_timer = { | |||
| 607 | 607 | ||
| 608 | MACHINE_START(AG5EVM, "ag5evm") | 608 | MACHINE_START(AG5EVM, "ag5evm") |
| 609 | .map_io = ag5evm_map_io, | 609 | .map_io = ag5evm_map_io, |
| 610 | .nr_irqs = NR_IRQS_LEGACY, | ||
| 610 | .init_irq = sh73a0_init_irq, | 611 | .init_irq = sh73a0_init_irq, |
| 611 | .handle_irq = shmobile_handle_irq_gic, | 612 | .handle_irq = shmobile_handle_irq_gic, |
| 612 | .init_machine = ag5evm_init, | 613 | .init_machine = ag5evm_init, |
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c index bd9a78424d6b..f44150b5ae46 100644 --- a/arch/arm/mach-shmobile/board-kota2.c +++ b/arch/arm/mach-shmobile/board-kota2.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/input/sh_keysc.h> | 33 | #include <linux/input/sh_keysc.h> |
| 34 | #include <linux/gpio_keys.h> | 34 | #include <linux/gpio_keys.h> |
| 35 | #include <linux/leds.h> | 35 | #include <linux/leds.h> |
| 36 | #include <linux/platform_data/leds-renesas-tpu.h> | ||
| 36 | #include <linux/mmc/host.h> | 37 | #include <linux/mmc/host.h> |
| 37 | #include <linux/mmc/sh_mmcif.h> | 38 | #include <linux/mmc/sh_mmcif.h> |
| 38 | #include <linux/mfd/tmio.h> | 39 | #include <linux/mfd/tmio.h> |
| @@ -56,7 +57,7 @@ static struct resource smsc9220_resources[] = { | |||
| 56 | .flags = IORESOURCE_MEM, | 57 | .flags = IORESOURCE_MEM, |
| 57 | }, | 58 | }, |
| 58 | [1] = { | 59 | [1] = { |
| 59 | .start = gic_spi(33), /* PINTA2 @ PORT144 */ | 60 | .start = SH73A0_PINT0_IRQ(2), /* PINTA2 */ |
| 60 | .flags = IORESOURCE_IRQ, | 61 | .flags = IORESOURCE_IRQ, |
| 61 | }, | 62 | }, |
| 62 | }; | 63 | }; |
| @@ -157,10 +158,6 @@ static struct platform_device gpio_keys_device = { | |||
| 157 | #define GPIO_LED(n, g) { .name = n, .gpio = g } | 158 | #define GPIO_LED(n, g) { .name = n, .gpio = g } |
| 158 | 159 | ||
| 159 | static struct gpio_led gpio_leds[] = { | 160 | static struct gpio_led gpio_leds[] = { |
| 160 | GPIO_LED("V2513", GPIO_PORT153), /* PORT153 [TPU1T02] -> V2513 */ | ||
| 161 | GPIO_LED("V2514", GPIO_PORT199), /* PORT199 [TPU4TO1] -> V2514 */ | ||
| 162 | GPIO_LED("V2515", GPIO_PORT197), /* PORT197 [TPU2TO1] -> V2515 */ | ||
| 163 | GPIO_LED("KEYLED", GPIO_PORT163), /* PORT163 [TPU3TO0] -> KEYLED */ | ||
| 164 | GPIO_LED("G", GPIO_PORT20), /* PORT20 [GPO0] -> LED7 -> "G" */ | 161 | GPIO_LED("G", GPIO_PORT20), /* PORT20 [GPO0] -> LED7 -> "G" */ |
| 165 | GPIO_LED("H", GPIO_PORT21), /* PORT21 [GPO1] -> LED8 -> "H" */ | 162 | GPIO_LED("H", GPIO_PORT21), /* PORT21 [GPO1] -> LED8 -> "H" */ |
| 166 | GPIO_LED("J", GPIO_PORT22), /* PORT22 [GPO2] -> LED9 -> "J" */ | 163 | GPIO_LED("J", GPIO_PORT22), /* PORT22 [GPO2] -> LED9 -> "J" */ |
| @@ -179,6 +176,119 @@ static struct platform_device gpio_leds_device = { | |||
| 179 | }, | 176 | }, |
| 180 | }; | 177 | }; |
| 181 | 178 | ||
| 179 | /* TPU LED */ | ||
| 180 | static struct led_renesas_tpu_config led_renesas_tpu12_pdata = { | ||
| 181 | .name = "V2513", | ||
| 182 | .pin_gpio_fn = GPIO_FN_TPU1TO2, | ||
| 183 | .pin_gpio = GPIO_PORT153, | ||
| 184 | .channel_offset = 0x90, | ||
| 185 | .timer_bit = 2, | ||
| 186 | .max_brightness = 1000, | ||
| 187 | }; | ||
| 188 | |||
| 189 | static struct resource tpu12_resources[] = { | ||
| 190 | [0] = { | ||
| 191 | .name = "TPU12", | ||
| 192 | .start = 0xe6610090, | ||
| 193 | .end = 0xe66100b5, | ||
| 194 | .flags = IORESOURCE_MEM, | ||
| 195 | }, | ||
| 196 | }; | ||
| 197 | |||
| 198 | static struct platform_device leds_tpu12_device = { | ||
| 199 | .name = "leds-renesas-tpu", | ||
| 200 | .id = 12, | ||
| 201 | .dev = { | ||
| 202 | .platform_data = &led_renesas_tpu12_pdata, | ||
| 203 | }, | ||
| 204 | .num_resources = ARRAY_SIZE(tpu12_resources), | ||
| 205 | .resource = tpu12_resources, | ||
| 206 | }; | ||
| 207 | |||
| 208 | static struct led_renesas_tpu_config led_renesas_tpu41_pdata = { | ||
| 209 | .name = "V2514", | ||
| 210 | .pin_gpio_fn = GPIO_FN_TPU4TO1, | ||
| 211 | .pin_gpio = GPIO_PORT199, | ||
| 212 | .channel_offset = 0x50, | ||
| 213 | .timer_bit = 1, | ||
| 214 | .max_brightness = 1000, | ||
| 215 | }; | ||
| 216 | |||
| 217 | static struct resource tpu41_resources[] = { | ||
| 218 | [0] = { | ||
| 219 | .name = "TPU41", | ||
| 220 | .start = 0xe6640050, | ||
| 221 | .end = 0xe6640075, | ||
| 222 | .flags = IORESOURCE_MEM, | ||
| 223 | }, | ||
| 224 | }; | ||
| 225 | |||
| 226 | static struct platform_device leds_tpu41_device = { | ||
| 227 | .name = "leds-renesas-tpu", | ||
| 228 | .id = 41, | ||
| 229 | .dev = { | ||
| 230 | .platform_data = &led_renesas_tpu41_pdata, | ||
| 231 | }, | ||
| 232 | .num_resources = ARRAY_SIZE(tpu41_resources), | ||
| 233 | .resource = tpu41_resources, | ||
| 234 | }; | ||
| 235 | |||
| 236 | static struct led_renesas_tpu_config led_renesas_tpu21_pdata = { | ||
| 237 | .name = "V2515", | ||
| 238 | .pin_gpio_fn = GPIO_FN_TPU2TO1, | ||
| 239 | .pin_gpio = GPIO_PORT197, | ||
| 240 | .channel_offset = 0x50, | ||
| 241 | .timer_bit = 1, | ||
| 242 | .max_brightness = 1000, | ||
| 243 | }; | ||
| 244 | |||
| 245 | static struct resource tpu21_resources[] = { | ||
| 246 | [0] = { | ||
| 247 | .name = "TPU21", | ||
| 248 | .start = 0xe6620050, | ||
| 249 | .end = 0xe6620075, | ||
| 250 | .flags = IORESOURCE_MEM, | ||
| 251 | }, | ||
| 252 | }; | ||
| 253 | |||
| 254 | static struct platform_device leds_tpu21_device = { | ||
| 255 | .name = "leds-renesas-tpu", | ||
| 256 | .id = 21, | ||
| 257 | .dev = { | ||
| 258 | .platform_data = &led_renesas_tpu21_pdata, | ||
| 259 | }, | ||
| 260 | .num_resources = ARRAY_SIZE(tpu21_resources), | ||
| 261 | .resource = tpu21_resources, | ||
| 262 | }; | ||
| 263 | |||
| 264 | static struct led_renesas_tpu_config led_renesas_tpu30_pdata = { | ||
| 265 | .name = "KEYLED", | ||
| 266 | .pin_gpio_fn = GPIO_FN_TPU3TO0, | ||
| 267 | .pin_gpio = GPIO_PORT163, | ||
| 268 | .channel_offset = 0x10, | ||
| 269 | .timer_bit = 0, | ||
| 270 | .max_brightness = 1000, | ||
| 271 | }; | ||
| 272 | |||
| 273 | static struct resource tpu30_resources[] = { | ||
| 274 | [0] = { | ||
| 275 | .name = "TPU30", | ||
| 276 | .start = 0xe6630010, | ||
| 277 | .end = 0xe6630035, | ||
| 278 | .flags = IORESOURCE_MEM, | ||
| 279 | }, | ||
| 280 | }; | ||
| 281 | |||
| 282 | static struct platform_device leds_tpu30_device = { | ||
| 283 | .name = "leds-renesas-tpu", | ||
| 284 | .id = 30, | ||
| 285 | .dev = { | ||
| 286 | .platform_data = &led_renesas_tpu30_pdata, | ||
| 287 | }, | ||
| 288 | .num_resources = ARRAY_SIZE(tpu30_resources), | ||
| 289 | .resource = tpu30_resources, | ||
| 290 | }; | ||
| 291 | |||
| 182 | /* MMCIF */ | 292 | /* MMCIF */ |
| 183 | static struct resource mmcif_resources[] = { | 293 | static struct resource mmcif_resources[] = { |
| 184 | [0] = { | 294 | [0] = { |
| @@ -291,6 +401,10 @@ static struct platform_device *kota2_devices[] __initdata = { | |||
| 291 | &keysc_device, | 401 | &keysc_device, |
| 292 | &gpio_keys_device, | 402 | &gpio_keys_device, |
| 293 | &gpio_leds_device, | 403 | &gpio_leds_device, |
| 404 | &leds_tpu12_device, | ||
| 405 | &leds_tpu41_device, | ||
| 406 | &leds_tpu21_device, | ||
| 407 | &leds_tpu30_device, | ||
| 294 | &mmcif_device, | 408 | &mmcif_device, |
| 295 | &sdhi0_device, | 409 | &sdhi0_device, |
| 296 | &sdhi1_device, | 410 | &sdhi1_device, |
| @@ -317,18 +431,6 @@ static void __init kota2_map_io(void) | |||
| 317 | shmobile_setup_console(); | 431 | shmobile_setup_console(); |
| 318 | } | 432 | } |
| 319 | 433 | ||
| 320 | #define PINTER0A 0xe69000a0 | ||
| 321 | #define PINTCR0A 0xe69000b0 | ||
| 322 | |||
| 323 | void __init kota2_init_irq(void) | ||
| 324 | { | ||
| 325 | sh73a0_init_irq(); | ||
| 326 | |||
| 327 | /* setup PINT: enable PINTA2 as active low */ | ||
| 328 | __raw_writel(1 << 29, PINTER0A); | ||
| 329 | __raw_writew(2 << 10, PINTCR0A); | ||
| 330 | } | ||
| 331 | |||
| 332 | static void __init kota2_init(void) | 434 | static void __init kota2_init(void) |
| 333 | { | 435 | { |
| 334 | sh73a0_pinmux_init(); | 436 | sh73a0_pinmux_init(); |
| @@ -447,7 +549,8 @@ struct sys_timer kota2_timer = { | |||
| 447 | 549 | ||
| 448 | MACHINE_START(KOTA2, "kota2") | 550 | MACHINE_START(KOTA2, "kota2") |
| 449 | .map_io = kota2_map_io, | 551 | .map_io = kota2_map_io, |
| 450 | .init_irq = kota2_init_irq, | 552 | .nr_irqs = NR_IRQS_LEGACY, |
| 553 | .init_irq = sh73a0_init_irq, | ||
| 451 | .handle_irq = shmobile_handle_irq_gic, | 554 | .handle_irq = shmobile_handle_irq_gic, |
| 452 | .init_machine = kota2_init, | 555 | .init_machine = kota2_init, |
| 453 | .timer = &kota2_timer, | 556 | .timer = &kota2_timer, |
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 61a846bb30f2..1370a89ca358 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
| @@ -113,6 +113,12 @@ static struct clk main_clk = { | |||
| 113 | .ops = &main_clk_ops, | 113 | .ops = &main_clk_ops, |
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | /* Divide Main clock by two */ | ||
| 117 | static struct clk main_div2_clk = { | ||
| 118 | .ops = &div2_clk_ops, | ||
| 119 | .parent = &main_clk, | ||
| 120 | }; | ||
| 121 | |||
| 116 | /* PLL0, PLL1, PLL2, PLL3 */ | 122 | /* PLL0, PLL1, PLL2, PLL3 */ |
| 117 | static unsigned long pll_recalc(struct clk *clk) | 123 | static unsigned long pll_recalc(struct clk *clk) |
| 118 | { | 124 | { |
| @@ -181,6 +187,7 @@ static struct clk *main_clks[] = { | |||
| 181 | &extal1_div2_clk, | 187 | &extal1_div2_clk, |
| 182 | &extal2_div2_clk, | 188 | &extal2_div2_clk, |
| 183 | &main_clk, | 189 | &main_clk, |
| 190 | &main_div2_clk, | ||
| 184 | &pll0_clk, | 191 | &pll0_clk, |
| 185 | &pll1_clk, | 192 | &pll1_clk, |
| 186 | &pll2_clk, | 193 | &pll2_clk, |
| @@ -243,7 +250,7 @@ static struct clk div6_clks[DIV6_NR] = { | |||
| 243 | [DIV6_VCK1] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR1, 0), | 250 | [DIV6_VCK1] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR1, 0), |
| 244 | [DIV6_VCK2] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR2, 0), | 251 | [DIV6_VCK2] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR2, 0), |
| 245 | [DIV6_VCK3] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR3, 0), | 252 | [DIV6_VCK3] = SH_CLK_DIV6(&pll1_div2_clk, VCLKCR3, 0), |
| 246 | [DIV6_ZB1] = SH_CLK_DIV6(&pll1_div2_clk, ZBCKCR, 0), | 253 | [DIV6_ZB1] = SH_CLK_DIV6(&pll1_div2_clk, ZBCKCR, CLK_ENABLE_ON_INIT), |
| 247 | [DIV6_FLCTL] = SH_CLK_DIV6(&pll1_div2_clk, FLCKCR, 0), | 254 | [DIV6_FLCTL] = SH_CLK_DIV6(&pll1_div2_clk, FLCKCR, 0), |
| 248 | [DIV6_SDHI0] = SH_CLK_DIV6(&pll1_div2_clk, SD0CKCR, 0), | 255 | [DIV6_SDHI0] = SH_CLK_DIV6(&pll1_div2_clk, SD0CKCR, 0), |
| 249 | [DIV6_SDHI1] = SH_CLK_DIV6(&pll1_div2_clk, SD1CKCR, 0), | 256 | [DIV6_SDHI1] = SH_CLK_DIV6(&pll1_div2_clk, SD1CKCR, 0), |
| @@ -268,6 +275,7 @@ enum { MSTP001, | |||
| 268 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 275 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
| 269 | MSTP331, MSTP329, MSTP325, MSTP323, MSTP318, | 276 | MSTP331, MSTP329, MSTP325, MSTP323, MSTP318, |
| 270 | MSTP314, MSTP313, MSTP312, MSTP311, | 277 | MSTP314, MSTP313, MSTP312, MSTP311, |
| 278 | MSTP303, MSTP302, MSTP301, MSTP300, | ||
| 271 | MSTP411, MSTP410, MSTP403, | 279 | MSTP411, MSTP410, MSTP403, |
| 272 | MSTP_NR }; | 280 | MSTP_NR }; |
| 273 | 281 | ||
| @@ -301,6 +309,10 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
| 301 | [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */ | 309 | [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */ |
| 302 | [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ | 310 | [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ |
| 303 | [MSTP311] = MSTP(&div6_clks[DIV6_SDHI2], SMSTPCR3, 11, 0), /* SDHI2 */ | 311 | [MSTP311] = MSTP(&div6_clks[DIV6_SDHI2], SMSTPCR3, 11, 0), /* SDHI2 */ |
| 312 | [MSTP303] = MSTP(&main_div2_clk, SMSTPCR3, 3, 0), /* TPU1 */ | ||
| 313 | [MSTP302] = MSTP(&main_div2_clk, SMSTPCR3, 2, 0), /* TPU2 */ | ||
| 314 | [MSTP301] = MSTP(&main_div2_clk, SMSTPCR3, 1, 0), /* TPU3 */ | ||
| 315 | [MSTP300] = MSTP(&main_div2_clk, SMSTPCR3, 0, 0), /* TPU4 */ | ||
| 304 | [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */ | 316 | [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */ |
| 305 | [MSTP410] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 10, 0), /* IIC4 */ | 317 | [MSTP410] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 10, 0), /* IIC4 */ |
| 306 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ | 318 | [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ |
| @@ -350,6 +362,10 @@ static struct clk_lookup lookups[] = { | |||
| 350 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ | 362 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ |
| 351 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ | 363 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ |
| 352 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ | 364 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ |
| 365 | CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */ | ||
| 366 | CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */ | ||
| 367 | CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */ | ||
| 368 | CLKDEV_DEV_ID("leds-renesas-tpu.41", &mstp_clks[MSTP300]), /* TPU4 */ | ||
| 353 | CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ | 369 | CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ |
| 354 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ | 370 | CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ |
| 355 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ | 371 | CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ |
diff --git a/arch/arm/plat-mxc/cpufreq.c b/arch/arm/plat-mxc/cpufreq.c index 74aac96cda20..adbff706ef6f 100644 --- a/arch/arm/plat-mxc/cpufreq.c +++ b/arch/arm/plat-mxc/cpufreq.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | * the CPU clock speed on the fly. | 17 | * the CPU clock speed on the fly. |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #include <linux/module.h> | ||
| 20 | #include <linux/cpufreq.h> | 21 | #include <linux/cpufreq.h> |
| 21 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
| 22 | #include <linux/err.h> | 23 | #include <linux/err.h> |
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c index 42d74ea59084..845de59f07ed 100644 --- a/arch/arm/plat-mxc/pwm.c +++ b/arch/arm/plat-mxc/pwm.c | |||
| @@ -32,6 +32,9 @@ | |||
| 32 | #define MX3_PWMSAR 0x0C /* PWM Sample Register */ | 32 | #define MX3_PWMSAR 0x0C /* PWM Sample Register */ |
| 33 | #define MX3_PWMPR 0x10 /* PWM Period Register */ | 33 | #define MX3_PWMPR 0x10 /* PWM Period Register */ |
| 34 | #define MX3_PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4) | 34 | #define MX3_PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4) |
| 35 | #define MX3_PWMCR_DOZEEN (1 << 24) | ||
| 36 | #define MX3_PWMCR_WAITEN (1 << 23) | ||
| 37 | #define MX3_PWMCR_DBGEN (1 << 22) | ||
| 35 | #define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16) | 38 | #define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16) |
| 36 | #define MX3_PWMCR_CLKSRC_IPG (1 << 16) | 39 | #define MX3_PWMCR_CLKSRC_IPG (1 << 16) |
| 37 | #define MX3_PWMCR_EN (1 << 0) | 40 | #define MX3_PWMCR_EN (1 << 0) |
| @@ -77,7 +80,9 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) | |||
| 77 | writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR); | 80 | writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR); |
| 78 | writel(period_cycles, pwm->mmio_base + MX3_PWMPR); | 81 | writel(period_cycles, pwm->mmio_base + MX3_PWMPR); |
| 79 | 82 | ||
| 80 | cr = MX3_PWMCR_PRESCALER(prescale) | MX3_PWMCR_EN; | 83 | cr = MX3_PWMCR_PRESCALER(prescale) | |
| 84 | MX3_PWMCR_DOZEEN | MX3_PWMCR_WAITEN | | ||
| 85 | MX3_PWMCR_DBGEN | MX3_PWMCR_EN; | ||
| 81 | 86 | ||
| 82 | if (cpu_is_mx25()) | 87 | if (cpu_is_mx25()) |
| 83 | cr |= MX3_PWMCR_CLKSRC_IPG; | 88 | cr |= MX3_PWMCR_CLKSRC_IPG; |
diff --git a/arch/arm/plat-samsung/dev-backlight.c b/arch/arm/plat-samsung/dev-backlight.c index e657305644cc..a976c023b286 100644 --- a/arch/arm/plat-samsung/dev-backlight.c +++ b/arch/arm/plat-samsung/dev-backlight.c | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
| 16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
| 17 | #include <linux/pwm_backlight.h> | 17 | #include <linux/pwm_backlight.h> |
| 18 | #include <linux/slab.h> | ||
| 19 | 18 | ||
| 20 | #include <plat/devs.h> | 19 | #include <plat/devs.h> |
| 21 | #include <plat/gpio-cfg.h> | 20 | #include <plat/gpio-cfg.h> |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 43f984e93970..303192fc9260 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
| @@ -350,10 +350,12 @@ | |||
| 350 | #define __NR_clock_adjtime 342 | 350 | #define __NR_clock_adjtime 342 |
| 351 | #define __NR_syncfs 343 | 351 | #define __NR_syncfs 343 |
| 352 | #define __NR_setns 344 | 352 | #define __NR_setns 344 |
| 353 | #define __NR_process_vm_readv 345 | ||
| 354 | #define __NR_process_vm_writev 346 | ||
| 353 | 355 | ||
| 354 | #ifdef __KERNEL__ | 356 | #ifdef __KERNEL__ |
| 355 | 357 | ||
| 356 | #define NR_syscalls 345 | 358 | #define NR_syscalls 347 |
| 357 | 359 | ||
| 358 | #define __ARCH_WANT_IPC_PARSE_VERSION | 360 | #define __ARCH_WANT_IPC_PARSE_VERSION |
| 359 | #define __ARCH_WANT_OLD_READDIR | 361 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index c468f2edaa85..ce827b376110 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
| @@ -365,4 +365,6 @@ ENTRY(sys_call_table) | |||
| 365 | .long sys_clock_adjtime | 365 | .long sys_clock_adjtime |
| 366 | .long sys_syncfs | 366 | .long sys_syncfs |
| 367 | .long sys_setns | 367 | .long sys_setns |
| 368 | .long sys_process_vm_readv /* 345 */ | ||
| 369 | .long sys_process_vm_writev | ||
| 368 | 370 | ||
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c index 4f2971bcf8e5..315fc0b250f8 100644 --- a/arch/mips/kernel/perf_event_mipsxx.c +++ b/arch/mips/kernel/perf_event_mipsxx.c | |||
| @@ -623,7 +623,7 @@ static int mipspmu_event_init(struct perf_event *event) | |||
| 623 | if (!atomic_inc_not_zero(&active_events)) { | 623 | if (!atomic_inc_not_zero(&active_events)) { |
| 624 | if (atomic_read(&active_events) > MIPS_MAX_HWEVENTS) { | 624 | if (atomic_read(&active_events) > MIPS_MAX_HWEVENTS) { |
| 625 | atomic_dec(&active_events); | 625 | atomic_dec(&active_events); |
| 626 | return -ENOSPC; | 626 | return -EINVAL; |
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | mutex_lock(&pmu_reserve_mutex); | 629 | mutex_lock(&pmu_reserve_mutex); |
| @@ -732,15 +732,15 @@ static int validate_group(struct perf_event *event) | |||
| 732 | memset(&fake_cpuc, 0, sizeof(fake_cpuc)); | 732 | memset(&fake_cpuc, 0, sizeof(fake_cpuc)); |
| 733 | 733 | ||
| 734 | if (!validate_event(&fake_cpuc, leader)) | 734 | if (!validate_event(&fake_cpuc, leader)) |
| 735 | return -ENOSPC; | 735 | return -EINVAL; |
| 736 | 736 | ||
| 737 | list_for_each_entry(sibling, &leader->sibling_list, group_entry) { | 737 | list_for_each_entry(sibling, &leader->sibling_list, group_entry) { |
| 738 | if (!validate_event(&fake_cpuc, sibling)) | 738 | if (!validate_event(&fake_cpuc, sibling)) |
| 739 | return -ENOSPC; | 739 | return -EINVAL; |
| 740 | } | 740 | } |
| 741 | 741 | ||
| 742 | if (!validate_event(&fake_cpuc, event)) | 742 | if (!validate_event(&fake_cpuc, event)) |
| 743 | return -ENOSPC; | 743 | return -EINVAL; |
| 744 | 744 | ||
| 745 | return 0; | 745 | return 0; |
| 746 | } | 746 | } |
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 524d23b8610c..4f289ff0b7fe 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
| @@ -599,10 +599,10 @@ static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste) | |||
| 599 | skey = page_get_storage_key(address); | 599 | skey = page_get_storage_key(address); |
| 600 | bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); | 600 | bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); |
| 601 | /* Clear page changed & referenced bit in the storage key */ | 601 | /* Clear page changed & referenced bit in the storage key */ |
| 602 | if (bits) { | 602 | if (bits & _PAGE_CHANGED) |
| 603 | skey ^= bits; | 603 | page_set_storage_key(address, skey ^ bits, 1); |
| 604 | page_set_storage_key(address, skey, 1); | 604 | else if (bits) |
| 605 | } | 605 | page_reset_referenced(address); |
| 606 | /* Transfer page changed & referenced bit to guest bits in pgste */ | 606 | /* Transfer page changed & referenced bit to guest bits in pgste */ |
| 607 | pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ | 607 | pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ |
| 608 | /* Get host changed & referenced bits from pgste */ | 608 | /* Get host changed & referenced bits from pgste */ |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 450931a45b68..573bc29551ef 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
| @@ -296,13 +296,6 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data) | |||
| 296 | ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)))) | 296 | ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)))) |
| 297 | /* Invalid psw mask. */ | 297 | /* Invalid psw mask. */ |
| 298 | return -EINVAL; | 298 | return -EINVAL; |
| 299 | if (addr == (addr_t) &dummy->regs.psw.addr) | ||
| 300 | /* | ||
| 301 | * The debugger changed the instruction address, | ||
| 302 | * reset system call restart, see signal.c:do_signal | ||
| 303 | */ | ||
| 304 | task_thread_info(child)->system_call = 0; | ||
| 305 | |||
| 306 | *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; | 299 | *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; |
| 307 | 300 | ||
| 308 | } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { | 301 | } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { |
| @@ -614,11 +607,6 @@ static int __poke_user_compat(struct task_struct *child, | |||
| 614 | /* Transfer 31 bit amode bit to psw mask. */ | 607 | /* Transfer 31 bit amode bit to psw mask. */ |
| 615 | regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) | | 608 | regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) | |
| 616 | (__u64)(tmp & PSW32_ADDR_AMODE); | 609 | (__u64)(tmp & PSW32_ADDR_AMODE); |
| 617 | /* | ||
| 618 | * The debugger changed the instruction address, | ||
| 619 | * reset system call restart, see signal.c:do_signal | ||
| 620 | */ | ||
| 621 | task_thread_info(child)->system_call = 0; | ||
| 622 | } else { | 610 | } else { |
| 623 | /* gpr 0-15 */ | 611 | /* gpr 0-15 */ |
| 624 | *(__u32*)((addr_t) ®s->psw + addr*2 + 4) = tmp; | 612 | *(__u32*)((addr_t) ®s->psw + addr*2 + 4) = tmp; |
| @@ -905,6 +893,14 @@ static int s390_last_break_get(struct task_struct *target, | |||
| 905 | return 0; | 893 | return 0; |
| 906 | } | 894 | } |
| 907 | 895 | ||
| 896 | static int s390_last_break_set(struct task_struct *target, | ||
| 897 | const struct user_regset *regset, | ||
| 898 | unsigned int pos, unsigned int count, | ||
| 899 | const void *kbuf, const void __user *ubuf) | ||
| 900 | { | ||
| 901 | return 0; | ||
| 902 | } | ||
| 903 | |||
| 908 | #endif | 904 | #endif |
| 909 | 905 | ||
| 910 | static int s390_system_call_get(struct task_struct *target, | 906 | static int s390_system_call_get(struct task_struct *target, |
| @@ -951,6 +947,7 @@ static const struct user_regset s390_regsets[] = { | |||
| 951 | .size = sizeof(long), | 947 | .size = sizeof(long), |
| 952 | .align = sizeof(long), | 948 | .align = sizeof(long), |
| 953 | .get = s390_last_break_get, | 949 | .get = s390_last_break_get, |
| 950 | .set = s390_last_break_set, | ||
| 954 | }, | 951 | }, |
| 955 | #endif | 952 | #endif |
| 956 | [REGSET_SYSTEM_CALL] = { | 953 | [REGSET_SYSTEM_CALL] = { |
| @@ -1116,6 +1113,14 @@ static int s390_compat_last_break_get(struct task_struct *target, | |||
| 1116 | return 0; | 1113 | return 0; |
| 1117 | } | 1114 | } |
| 1118 | 1115 | ||
| 1116 | static int s390_compat_last_break_set(struct task_struct *target, | ||
| 1117 | const struct user_regset *regset, | ||
| 1118 | unsigned int pos, unsigned int count, | ||
| 1119 | const void *kbuf, const void __user *ubuf) | ||
| 1120 | { | ||
| 1121 | return 0; | ||
| 1122 | } | ||
| 1123 | |||
| 1119 | static const struct user_regset s390_compat_regsets[] = { | 1124 | static const struct user_regset s390_compat_regsets[] = { |
| 1120 | [REGSET_GENERAL] = { | 1125 | [REGSET_GENERAL] = { |
| 1121 | .core_note_type = NT_PRSTATUS, | 1126 | .core_note_type = NT_PRSTATUS, |
| @@ -1139,6 +1144,7 @@ static const struct user_regset s390_compat_regsets[] = { | |||
| 1139 | .size = sizeof(long), | 1144 | .size = sizeof(long), |
| 1140 | .align = sizeof(long), | 1145 | .align = sizeof(long), |
| 1141 | .get = s390_compat_last_break_get, | 1146 | .get = s390_compat_last_break_get, |
| 1147 | .set = s390_compat_last_break_set, | ||
| 1142 | }, | 1148 | }, |
| 1143 | [REGSET_SYSTEM_CALL] = { | 1149 | [REGSET_SYSTEM_CALL] = { |
| 1144 | .core_note_type = NT_S390_SYSTEM_CALL, | 1150 | .core_note_type = NT_S390_SYSTEM_CALL, |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index e58a462949b1..e54c4ff8abaa 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
| @@ -579,7 +579,7 @@ static unsigned long __init find_crash_base(unsigned long crash_size, | |||
| 579 | *msg = "first memory chunk must be at least crashkernel size"; | 579 | *msg = "first memory chunk must be at least crashkernel size"; |
| 580 | return 0; | 580 | return 0; |
| 581 | } | 581 | } |
| 582 | if (is_kdump_kernel() && (crash_size == OLDMEM_SIZE)) | 582 | if (OLDMEM_BASE && crash_size == OLDMEM_SIZE) |
| 583 | return OLDMEM_BASE; | 583 | return OLDMEM_BASE; |
| 584 | 584 | ||
| 585 | for (i = MEMORY_CHUNKS - 1; i >= 0; i--) { | 585 | for (i = MEMORY_CHUNKS - 1; i >= 0; i--) { |
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 05a85bc14c98..7f6f9f354545 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
| @@ -460,9 +460,9 @@ void do_signal(struct pt_regs *regs) | |||
| 460 | regs->svc_code >> 16); | 460 | regs->svc_code >> 16); |
| 461 | break; | 461 | break; |
| 462 | } | 462 | } |
| 463 | /* No longer in a system call */ | ||
| 464 | clear_thread_flag(TIF_SYSCALL); | ||
| 465 | } | 463 | } |
| 464 | /* No longer in a system call */ | ||
| 465 | clear_thread_flag(TIF_SYSCALL); | ||
| 466 | 466 | ||
| 467 | if ((is_compat_task() ? | 467 | if ((is_compat_task() ? |
| 468 | handle_signal32(signr, &ka, &info, oldset, regs) : | 468 | handle_signal32(signr, &ka, &info, oldset, regs) : |
| @@ -486,6 +486,7 @@ void do_signal(struct pt_regs *regs) | |||
| 486 | } | 486 | } |
| 487 | 487 | ||
| 488 | /* No handlers present - check for system call restart */ | 488 | /* No handlers present - check for system call restart */ |
| 489 | clear_thread_flag(TIF_SYSCALL); | ||
| 489 | if (current_thread_info()->system_call) { | 490 | if (current_thread_info()->system_call) { |
| 490 | regs->svc_code = current_thread_info()->system_call; | 491 | regs->svc_code = current_thread_info()->system_call; |
| 491 | switch (regs->gprs[2]) { | 492 | switch (regs->gprs[2]) { |
| @@ -500,9 +501,6 @@ void do_signal(struct pt_regs *regs) | |||
| 500 | regs->gprs[2] = regs->orig_gpr2; | 501 | regs->gprs[2] = regs->orig_gpr2; |
| 501 | set_thread_flag(TIF_SYSCALL); | 502 | set_thread_flag(TIF_SYSCALL); |
| 502 | break; | 503 | break; |
| 503 | default: | ||
| 504 | clear_thread_flag(TIF_SYSCALL); | ||
| 505 | break; | ||
| 506 | } | 504 | } |
| 507 | } | 505 | } |
| 508 | 506 | ||
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index 6efc18b5e60a..bd58b72454cf 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c | |||
| @@ -88,7 +88,7 @@ static ssize_t hwsampler_write(struct file *file, char const __user *buf, | |||
| 88 | return -EINVAL; | 88 | return -EINVAL; |
| 89 | 89 | ||
| 90 | retval = oprofilefs_ulong_from_user(&val, buf, count); | 90 | retval = oprofilefs_ulong_from_user(&val, buf, count); |
| 91 | if (retval) | 91 | if (retval <= 0) |
| 92 | return retval; | 92 | return retval; |
| 93 | 93 | ||
| 94 | if (oprofile_started) | 94 | if (oprofile_started) |
diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c index ec8c84c14b17..895e337c79b6 100644 --- a/arch/sh/boards/board-sh7757lcr.c +++ b/arch/sh/boards/board-sh7757lcr.c | |||
| @@ -50,9 +50,9 @@ static struct platform_device heartbeat_device = { | |||
| 50 | #define GBECONT 0xffc10100 | 50 | #define GBECONT 0xffc10100 |
| 51 | #define GBECONT_RMII1 BIT(17) | 51 | #define GBECONT_RMII1 BIT(17) |
| 52 | #define GBECONT_RMII0 BIT(16) | 52 | #define GBECONT_RMII0 BIT(16) |
| 53 | static void sh7757_eth_set_mdio_gate(unsigned long addr) | 53 | static void sh7757_eth_set_mdio_gate(void *addr) |
| 54 | { | 54 | { |
| 55 | if ((addr & 0x00000fff) < 0x0800) | 55 | if (((unsigned long)addr & 0x00000fff) < 0x0800) |
| 56 | writel(readl(GBECONT) | GBECONT_RMII0, GBECONT); | 56 | writel(readl(GBECONT) | GBECONT_RMII0, GBECONT); |
| 57 | else | 57 | else |
| 58 | writel(readl(GBECONT) | GBECONT_RMII1, GBECONT); | 58 | writel(readl(GBECONT) | GBECONT_RMII1, GBECONT); |
| @@ -116,9 +116,9 @@ static struct platform_device sh7757_eth1_device = { | |||
| 116 | }, | 116 | }, |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | static void sh7757_eth_giga_set_mdio_gate(unsigned long addr) | 119 | static void sh7757_eth_giga_set_mdio_gate(void *addr) |
| 120 | { | 120 | { |
| 121 | if ((addr & 0x00000fff) < 0x0800) { | 121 | if (((unsigned long)addr & 0x00000fff) < 0x0800) { |
| 122 | gpio_set_value(GPIO_PTT4, 1); | 122 | gpio_set_value(GPIO_PTT4, 1); |
| 123 | writel(readl(GBECONT) & ~GBECONT_RMII0, GBECONT); | 123 | writel(readl(GBECONT) & ~GBECONT_RMII0, GBECONT); |
| 124 | } else { | 124 | } else { |
| @@ -210,8 +210,12 @@ static struct resource sh_mmcif_resources[] = { | |||
| 210 | }; | 210 | }; |
| 211 | 211 | ||
| 212 | static struct sh_mmcif_dma sh7757lcr_mmcif_dma = { | 212 | static struct sh_mmcif_dma sh7757lcr_mmcif_dma = { |
| 213 | .chan_priv_tx = SHDMA_SLAVE_MMCIF_TX, | 213 | .chan_priv_tx = { |
| 214 | .chan_priv_rx = SHDMA_SLAVE_MMCIF_RX, | 214 | .slave_id = SHDMA_SLAVE_MMCIF_TX, |
| 215 | }, | ||
| 216 | .chan_priv_rx = { | ||
| 217 | .slave_id = SHDMA_SLAVE_MMCIF_RX, | ||
| 218 | } | ||
| 215 | }; | 219 | }; |
| 216 | 220 | ||
| 217 | static struct sh_mmcif_plat_data sh_mmcif_plat = { | 221 | static struct sh_mmcif_plat_data sh_mmcif_plat = { |
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c index 7429b47c3aca..381edcd5bc29 100644 --- a/arch/sparc/kernel/ds.c +++ b/arch/sparc/kernel/ds.c | |||
| @@ -1181,13 +1181,11 @@ static int __devinit ds_probe(struct vio_dev *vdev, | |||
| 1181 | 1181 | ||
| 1182 | dp->rcv_buf_len = 4096; | 1182 | dp->rcv_buf_len = 4096; |
| 1183 | 1183 | ||
| 1184 | dp->ds_states = kzalloc(sizeof(ds_states_template), | 1184 | dp->ds_states = kmemdup(ds_states_template, |
| 1185 | GFP_KERNEL); | 1185 | sizeof(ds_states_template), GFP_KERNEL); |
| 1186 | if (!dp->ds_states) | 1186 | if (!dp->ds_states) |
| 1187 | goto out_free_rcv_buf; | 1187 | goto out_free_rcv_buf; |
| 1188 | 1188 | ||
| 1189 | memcpy(dp->ds_states, ds_states_template, | ||
| 1190 | sizeof(ds_states_template)); | ||
| 1191 | dp->num_ds_states = ARRAY_SIZE(ds_states_template); | 1189 | dp->num_ds_states = ARRAY_SIZE(ds_states_template); |
| 1192 | 1190 | ||
| 1193 | for (i = 0; i < dp->num_ds_states; i++) | 1191 | for (i = 0; i < dp->num_ds_states; i++) |
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c index b272cda35a01..af5755d20fbe 100644 --- a/arch/sparc/kernel/pci_sun4v.c +++ b/arch/sparc/kernel/pci_sun4v.c | |||
| @@ -849,10 +849,10 @@ static int pci_sun4v_msiq_build_irq(struct pci_pbm_info *pbm, | |||
| 849 | if (!irq) | 849 | if (!irq) |
| 850 | return -ENOMEM; | 850 | return -ENOMEM; |
| 851 | 851 | ||
| 852 | if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE)) | ||
| 853 | return -EINVAL; | ||
| 854 | if (pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_VALID)) | 852 | if (pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_VALID)) |
| 855 | return -EINVAL; | 853 | return -EINVAL; |
| 854 | if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE)) | ||
| 855 | return -EINVAL; | ||
| 856 | 856 | ||
| 857 | return irq; | 857 | return irq; |
| 858 | } | 858 | } |
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 46614807a57f..741df916c124 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c | |||
| @@ -58,12 +58,10 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len | |||
| 58 | void *new_val; | 58 | void *new_val; |
| 59 | int err; | 59 | int err; |
| 60 | 60 | ||
| 61 | new_val = kmalloc(len, GFP_KERNEL); | 61 | new_val = kmemdup(val, len, GFP_KERNEL); |
| 62 | if (!new_val) | 62 | if (!new_val) |
| 63 | return -ENOMEM; | 63 | return -ENOMEM; |
| 64 | 64 | ||
| 65 | memcpy(new_val, val, len); | ||
| 66 | |||
| 67 | err = -ENODEV; | 65 | err = -ENODEV; |
| 68 | 66 | ||
| 69 | mutex_lock(&of_set_property_mutex); | 67 | mutex_lock(&of_set_property_mutex); |
diff --git a/arch/sparc/mm/btfixup.c b/arch/sparc/mm/btfixup.c index 5175ac2f4820..8a7f81743c12 100644 --- a/arch/sparc/mm/btfixup.c +++ b/arch/sparc/mm/btfixup.c | |||
| @@ -302,8 +302,7 @@ void __init btfixup(void) | |||
| 302 | case 'i': /* INT */ | 302 | case 'i': /* INT */ |
| 303 | if ((insn & 0xc1c00000) == 0x01000000) /* %HI */ | 303 | if ((insn & 0xc1c00000) == 0x01000000) /* %HI */ |
| 304 | set_addr(addr, q[1], fmangled, (insn & 0xffc00000) | (p[1] >> 10)); | 304 | set_addr(addr, q[1], fmangled, (insn & 0xffc00000) | (p[1] >> 10)); |
| 305 | else if ((insn & 0x80002000) == 0x80002000 && | 305 | else if ((insn & 0x80002000) == 0x80002000) /* %LO */ |
| 306 | (insn & 0x01800000) != 0x01800000) /* %LO */ | ||
| 307 | set_addr(addr, q[1], fmangled, (insn & 0xffffe000) | (p[1] & 0x3ff)); | 306 | set_addr(addr, q[1], fmangled, (insn & 0xffffe000) | (p[1] & 0x3ff)); |
| 308 | else { | 307 | else { |
| 309 | prom_printf(insn_i, p, addr, insn); | 308 | prom_printf(insn_i, p, addr, insn); |
diff --git a/arch/tile/include/asm/irq.h b/arch/tile/include/asm/irq.h index 94e9a511de84..f80f8ceabc67 100644 --- a/arch/tile/include/asm/irq.h +++ b/arch/tile/include/asm/irq.h | |||
| @@ -74,16 +74,6 @@ enum { | |||
| 74 | */ | 74 | */ |
| 75 | void tile_irq_activate(unsigned int irq, int tile_irq_type); | 75 | void tile_irq_activate(unsigned int irq, int tile_irq_type); |
| 76 | 76 | ||
| 77 | /* | ||
| 78 | * For onboard, non-PCI (e.g. TILE_IRQ_PERCPU) devices, drivers know | ||
| 79 | * how to use enable/disable_percpu_irq() to manage interrupts on each | ||
| 80 | * core. We can't use the generic enable/disable_irq() because they | ||
| 81 | * use a single reference count per irq, rather than per cpu per irq. | ||
| 82 | */ | ||
| 83 | void enable_percpu_irq(unsigned int irq); | ||
| 84 | void disable_percpu_irq(unsigned int irq); | ||
| 85 | |||
| 86 | |||
| 87 | void setup_irq_regs(void); | 77 | void setup_irq_regs(void); |
| 88 | 78 | ||
| 89 | #endif /* _ASM_TILE_IRQ_H */ | 79 | #endif /* _ASM_TILE_IRQ_H */ |
diff --git a/arch/tile/kernel/irq.c b/arch/tile/kernel/irq.c index aa0134db2dd6..02e628065012 100644 --- a/arch/tile/kernel/irq.c +++ b/arch/tile/kernel/irq.c | |||
| @@ -152,14 +152,13 @@ void tile_dev_intr(struct pt_regs *regs, int intnum) | |||
| 152 | * Remove an irq from the disabled mask. If we're in an interrupt | 152 | * Remove an irq from the disabled mask. If we're in an interrupt |
| 153 | * context, defer enabling the HW interrupt until we leave. | 153 | * context, defer enabling the HW interrupt until we leave. |
| 154 | */ | 154 | */ |
| 155 | void enable_percpu_irq(unsigned int irq) | 155 | static void tile_irq_chip_enable(struct irq_data *d) |
| 156 | { | 156 | { |
| 157 | get_cpu_var(irq_disable_mask) &= ~(1UL << irq); | 157 | get_cpu_var(irq_disable_mask) &= ~(1UL << d->irq); |
| 158 | if (__get_cpu_var(irq_depth) == 0) | 158 | if (__get_cpu_var(irq_depth) == 0) |
| 159 | unmask_irqs(1UL << irq); | 159 | unmask_irqs(1UL << d->irq); |
| 160 | put_cpu_var(irq_disable_mask); | 160 | put_cpu_var(irq_disable_mask); |
| 161 | } | 161 | } |
| 162 | EXPORT_SYMBOL(enable_percpu_irq); | ||
| 163 | 162 | ||
| 164 | /* | 163 | /* |
| 165 | * Add an irq to the disabled mask. We disable the HW interrupt | 164 | * Add an irq to the disabled mask. We disable the HW interrupt |
| @@ -167,13 +166,12 @@ EXPORT_SYMBOL(enable_percpu_irq); | |||
| 167 | * in an interrupt context, the return path is careful to avoid | 166 | * in an interrupt context, the return path is careful to avoid |
| 168 | * unmasking a newly disabled interrupt. | 167 | * unmasking a newly disabled interrupt. |
| 169 | */ | 168 | */ |
| 170 | void disable_percpu_irq(unsigned int irq) | 169 | static void tile_irq_chip_disable(struct irq_data *d) |
| 171 | { | 170 | { |
| 172 | get_cpu_var(irq_disable_mask) |= (1UL << irq); | 171 | get_cpu_var(irq_disable_mask) |= (1UL << d->irq); |
| 173 | mask_irqs(1UL << irq); | 172 | mask_irqs(1UL << d->irq); |
| 174 | put_cpu_var(irq_disable_mask); | 173 | put_cpu_var(irq_disable_mask); |
| 175 | } | 174 | } |
| 176 | EXPORT_SYMBOL(disable_percpu_irq); | ||
| 177 | 175 | ||
| 178 | /* Mask an interrupt. */ | 176 | /* Mask an interrupt. */ |
| 179 | static void tile_irq_chip_mask(struct irq_data *d) | 177 | static void tile_irq_chip_mask(struct irq_data *d) |
| @@ -209,6 +207,8 @@ static void tile_irq_chip_eoi(struct irq_data *d) | |||
| 209 | 207 | ||
| 210 | static struct irq_chip tile_irq_chip = { | 208 | static struct irq_chip tile_irq_chip = { |
| 211 | .name = "tile_irq_chip", | 209 | .name = "tile_irq_chip", |
| 210 | .irq_enable = tile_irq_chip_enable, | ||
| 211 | .irq_disable = tile_irq_chip_disable, | ||
| 212 | .irq_ack = tile_irq_chip_ack, | 212 | .irq_ack = tile_irq_chip_ack, |
| 213 | .irq_eoi = tile_irq_chip_eoi, | 213 | .irq_eoi = tile_irq_chip_eoi, |
| 214 | .irq_mask = tile_irq_chip_mask, | 214 | .irq_mask = tile_irq_chip_mask, |
diff --git a/arch/tile/kernel/pci-dma.c b/arch/tile/kernel/pci-dma.c index 658f2ce426a4..b3ed19f8779c 100644 --- a/arch/tile/kernel/pci-dma.c +++ b/arch/tile/kernel/pci-dma.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
| 16 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
| 17 | #include <linux/vmalloc.h> | 17 | #include <linux/vmalloc.h> |
| 18 | #include <linux/export.h> | ||
| 18 | #include <asm/tlbflush.h> | 19 | #include <asm/tlbflush.h> |
| 19 | #include <asm/homecache.h> | 20 | #include <asm/homecache.h> |
| 20 | 21 | ||
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c index 2a8014cb1ff5..9d610d3fb11e 100644 --- a/arch/tile/kernel/pci.c +++ b/arch/tile/kernel/pci.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
| 25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
| 26 | #include <linux/uaccess.h> | 26 | #include <linux/uaccess.h> |
| 27 | #include <linux/export.h> | ||
| 27 | 28 | ||
| 28 | #include <asm/processor.h> | 29 | #include <asm/processor.h> |
| 29 | #include <asm/sections.h> | 30 | #include <asm/sections.h> |
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c index b671a86f4515..602908268093 100644 --- a/arch/tile/kernel/sysfs.c +++ b/arch/tile/kernel/sysfs.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/cpu.h> | 18 | #include <linux/cpu.h> |
| 19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 20 | #include <linux/smp.h> | 20 | #include <linux/smp.h> |
| 21 | #include <linux/stat.h> | ||
| 21 | #include <hv/hypervisor.h> | 22 | #include <hv/hypervisor.h> |
| 22 | 23 | ||
| 23 | /* Return a string queried from the hypervisor, truncated to page size. */ | 24 | /* Return a string queried from the hypervisor, truncated to page size. */ |
diff --git a/arch/tile/lib/exports.c b/arch/tile/lib/exports.c index a87d2a859ba9..2a81d32de0da 100644 --- a/arch/tile/lib/exports.c +++ b/arch/tile/lib/exports.c | |||
| @@ -39,6 +39,9 @@ EXPORT_SYMBOL(finv_user_asm); | |||
| 39 | EXPORT_SYMBOL(current_text_addr); | 39 | EXPORT_SYMBOL(current_text_addr); |
| 40 | EXPORT_SYMBOL(dump_stack); | 40 | EXPORT_SYMBOL(dump_stack); |
| 41 | 41 | ||
| 42 | /* arch/tile/kernel/head.S */ | ||
| 43 | EXPORT_SYMBOL(empty_zero_page); | ||
| 44 | |||
| 42 | /* arch/tile/lib/, various memcpy files */ | 45 | /* arch/tile/lib/, various memcpy files */ |
| 43 | EXPORT_SYMBOL(memcpy); | 46 | EXPORT_SYMBOL(memcpy); |
| 44 | EXPORT_SYMBOL(__copy_to_user_inatomic); | 47 | EXPORT_SYMBOL(__copy_to_user_inatomic); |
diff --git a/arch/tile/mm/homecache.c b/arch/tile/mm/homecache.c index cbe6f4f9eca3..1cc6ae477c98 100644 --- a/arch/tile/mm/homecache.c +++ b/arch/tile/mm/homecache.c | |||
| @@ -449,9 +449,12 @@ void homecache_free_pages(unsigned long addr, unsigned int order) | |||
| 449 | VM_BUG_ON(!virt_addr_valid((void *)addr)); | 449 | VM_BUG_ON(!virt_addr_valid((void *)addr)); |
| 450 | page = virt_to_page((void *)addr); | 450 | page = virt_to_page((void *)addr); |
| 451 | if (put_page_testzero(page)) { | 451 | if (put_page_testzero(page)) { |
| 452 | int pages = (1 << order); | ||
| 453 | homecache_change_page_home(page, order, initial_page_home()); | 452 | homecache_change_page_home(page, order, initial_page_home()); |
| 454 | while (pages--) | 453 | if (order == 0) { |
| 455 | __free_page(page++); | 454 | free_hot_cold_page(page, 0); |
| 455 | } else { | ||
| 456 | init_page_count(page); | ||
| 457 | __free_pages(page, order); | ||
| 458 | } | ||
| 456 | } | 459 | } |
| 457 | } | 460 | } |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index cb9a1044a771..efb42949cc09 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -390,7 +390,7 @@ config X86_INTEL_CE | |||
| 390 | This option compiles in support for the CE4100 SOC for settop | 390 | This option compiles in support for the CE4100 SOC for settop |
| 391 | boxes and media devices. | 391 | boxes and media devices. |
| 392 | 392 | ||
| 393 | config X86_INTEL_MID | 393 | config X86_WANT_INTEL_MID |
| 394 | bool "Intel MID platform support" | 394 | bool "Intel MID platform support" |
| 395 | depends on X86_32 | 395 | depends on X86_32 |
| 396 | depends on X86_EXTENDED_PLATFORM | 396 | depends on X86_EXTENDED_PLATFORM |
| @@ -399,7 +399,10 @@ config X86_INTEL_MID | |||
| 399 | systems which do not have the PCI legacy interfaces (Moorestown, | 399 | systems which do not have the PCI legacy interfaces (Moorestown, |
| 400 | Medfield). If you are building for a PC class system say N here. | 400 | Medfield). If you are building for a PC class system say N here. |
| 401 | 401 | ||
| 402 | if X86_INTEL_MID | 402 | if X86_WANT_INTEL_MID |
| 403 | |||
| 404 | config X86_INTEL_MID | ||
| 405 | bool | ||
| 403 | 406 | ||
| 404 | config X86_MRST | 407 | config X86_MRST |
| 405 | bool "Moorestown MID platform" | 408 | bool "Moorestown MID platform" |
| @@ -411,6 +414,7 @@ config X86_MRST | |||
| 411 | select SPI | 414 | select SPI |
| 412 | select INTEL_SCU_IPC | 415 | select INTEL_SCU_IPC |
| 413 | select X86_PLATFORM_DEVICES | 416 | select X86_PLATFORM_DEVICES |
| 417 | select X86_INTEL_MID | ||
| 414 | ---help--- | 418 | ---help--- |
| 415 | Moorestown is Intel's Low Power Intel Architecture (LPIA) based Moblin | 419 | Moorestown is Intel's Low Power Intel Architecture (LPIA) based Moblin |
| 416 | Internet Device(MID) platform. Moorestown consists of two chips: | 420 | Internet Device(MID) platform. Moorestown consists of two chips: |
diff --git a/arch/x86/include/asm/intel_scu_ipc.h b/arch/x86/include/asm/intel_scu_ipc.h index 4420993acc47..925b605eb5c6 100644 --- a/arch/x86/include/asm/intel_scu_ipc.h +++ b/arch/x86/include/asm/intel_scu_ipc.h | |||
| @@ -3,11 +3,15 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/notifier.h> | 4 | #include <linux/notifier.h> |
| 5 | 5 | ||
| 6 | #define IPCMSG_VRTC 0xFA /* Set vRTC device */ | 6 | #define IPCMSG_WARM_RESET 0xF0 |
| 7 | 7 | #define IPCMSG_COLD_RESET 0xF1 | |
| 8 | /* Command id associated with message IPCMSG_VRTC */ | 8 | #define IPCMSG_SOFT_RESET 0xF2 |
| 9 | #define IPC_CMD_VRTC_SETTIME 1 /* Set time */ | 9 | #define IPCMSG_COLD_BOOT 0xF3 |
| 10 | #define IPC_CMD_VRTC_SETALARM 2 /* Set alarm */ | 10 | |
| 11 | #define IPCMSG_VRTC 0xFA /* Set vRTC device */ | ||
| 12 | /* Command id associated with message IPCMSG_VRTC */ | ||
| 13 | #define IPC_CMD_VRTC_SETTIME 1 /* Set time */ | ||
| 14 | #define IPC_CMD_VRTC_SETALARM 2 /* Set alarm */ | ||
| 11 | 15 | ||
| 12 | /* Read single register */ | 16 | /* Read single register */ |
| 13 | int intel_scu_ipc_ioread8(u16 addr, u8 *data); | 17 | int intel_scu_ipc_ioread8(u16 addr, u8 *data); |
diff --git a/arch/x86/include/asm/mrst.h b/arch/x86/include/asm/mrst.h index e6283129c821..93f79094c224 100644 --- a/arch/x86/include/asm/mrst.h +++ b/arch/x86/include/asm/mrst.h | |||
| @@ -31,11 +31,20 @@ enum mrst_cpu_type { | |||
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | extern enum mrst_cpu_type __mrst_cpu_chip; | 33 | extern enum mrst_cpu_type __mrst_cpu_chip; |
| 34 | |||
| 35 | #ifdef CONFIG_X86_INTEL_MID | ||
| 36 | |||
| 34 | static inline enum mrst_cpu_type mrst_identify_cpu(void) | 37 | static inline enum mrst_cpu_type mrst_identify_cpu(void) |
| 35 | { | 38 | { |
| 36 | return __mrst_cpu_chip; | 39 | return __mrst_cpu_chip; |
| 37 | } | 40 | } |
| 38 | 41 | ||
| 42 | #else /* !CONFIG_X86_INTEL_MID */ | ||
| 43 | |||
| 44 | #define mrst_identify_cpu() (0) | ||
| 45 | |||
| 46 | #endif /* !CONFIG_X86_INTEL_MID */ | ||
| 47 | |||
| 39 | enum mrst_timer_options { | 48 | enum mrst_timer_options { |
| 40 | MRST_TIMER_DEFAULT, | 49 | MRST_TIMER_DEFAULT, |
| 41 | MRST_TIMER_APBT_ONLY, | 50 | MRST_TIMER_APBT_ONLY, |
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 084ef95274cd..95203d40ffdd 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h | |||
| @@ -169,7 +169,14 @@ static inline int wrmsr_safe(unsigned msr, unsigned low, unsigned high) | |||
| 169 | return native_write_msr_safe(msr, low, high); | 169 | return native_write_msr_safe(msr, low, high); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | /* rdmsr with exception handling */ | 172 | /* |
| 173 | * rdmsr with exception handling. | ||
| 174 | * | ||
| 175 | * Please note that the exception handling works only after we've | ||
| 176 | * switched to the "smart" #GP handler in trap_init() which knows about | ||
| 177 | * exception tables - using this macro earlier than that causes machine | ||
| 178 | * hangs on boxes which do not implement the @msr in the first argument. | ||
| 179 | */ | ||
| 173 | #define rdmsr_safe(msr, p1, p2) \ | 180 | #define rdmsr_safe(msr, p1, p2) \ |
| 174 | ({ \ | 181 | ({ \ |
| 175 | int __err; \ | 182 | int __err; \ |
diff --git a/arch/x86/include/asm/timer.h b/arch/x86/include/asm/timer.h index fa7b9176b76c..431793e5d484 100644 --- a/arch/x86/include/asm/timer.h +++ b/arch/x86/include/asm/timer.h | |||
| @@ -32,6 +32,22 @@ extern int no_timer_check; | |||
| 32 | * (mathieu.desnoyers@polymtl.ca) | 32 | * (mathieu.desnoyers@polymtl.ca) |
| 33 | * | 33 | * |
| 34 | * -johnstul@us.ibm.com "math is hard, lets go shopping!" | 34 | * -johnstul@us.ibm.com "math is hard, lets go shopping!" |
| 35 | * | ||
| 36 | * In: | ||
| 37 | * | ||
| 38 | * ns = cycles * cyc2ns_scale / SC | ||
| 39 | * | ||
| 40 | * Although we may still have enough bits to store the value of ns, | ||
| 41 | * in some cases, we may not have enough bits to store cycles * cyc2ns_scale, | ||
| 42 | * leading to an incorrect result. | ||
| 43 | * | ||
| 44 | * To avoid this, we can decompose 'cycles' into quotient and remainder | ||
| 45 | * of division by SC. Then, | ||
| 46 | * | ||
| 47 | * ns = (quot * SC + rem) * cyc2ns_scale / SC | ||
| 48 | * = quot * cyc2ns_scale + (rem * cyc2ns_scale) / SC | ||
| 49 | * | ||
| 50 | * - sqazi@google.com | ||
| 35 | */ | 51 | */ |
| 36 | 52 | ||
| 37 | DECLARE_PER_CPU(unsigned long, cyc2ns); | 53 | DECLARE_PER_CPU(unsigned long, cyc2ns); |
| @@ -41,9 +57,14 @@ DECLARE_PER_CPU(unsigned long long, cyc2ns_offset); | |||
| 41 | 57 | ||
| 42 | static inline unsigned long long __cycles_2_ns(unsigned long long cyc) | 58 | static inline unsigned long long __cycles_2_ns(unsigned long long cyc) |
| 43 | { | 59 | { |
| 60 | unsigned long long quot; | ||
| 61 | unsigned long long rem; | ||
| 44 | int cpu = smp_processor_id(); | 62 | int cpu = smp_processor_id(); |
| 45 | unsigned long long ns = per_cpu(cyc2ns_offset, cpu); | 63 | unsigned long long ns = per_cpu(cyc2ns_offset, cpu); |
| 46 | ns += cyc * per_cpu(cyc2ns, cpu) >> CYC2NS_SCALE_FACTOR; | 64 | quot = (cyc >> CYC2NS_SCALE_FACTOR); |
| 65 | rem = cyc & ((1ULL << CYC2NS_SCALE_FACTOR) - 1); | ||
| 66 | ns += quot * per_cpu(cyc2ns, cpu) + | ||
| 67 | ((rem * per_cpu(cyc2ns, cpu)) >> CYC2NS_SCALE_FACTOR); | ||
| 47 | return ns; | 68 | return ns; |
| 48 | } | 69 | } |
| 49 | 70 | ||
diff --git a/arch/x86/include/asm/uv/uv_mmrs.h b/arch/x86/include/asm/uv/uv_mmrs.h index 10474fb1185d..cf1d73643f60 100644 --- a/arch/x86/include/asm/uv/uv_mmrs.h +++ b/arch/x86/include/asm/uv/uv_mmrs.h | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | 57 | ||
| 58 | #define UV1_HUB_PART_NUMBER 0x88a5 | 58 | #define UV1_HUB_PART_NUMBER 0x88a5 |
| 59 | #define UV2_HUB_PART_NUMBER 0x8eb8 | 59 | #define UV2_HUB_PART_NUMBER 0x8eb8 |
| 60 | #define UV2_HUB_PART_NUMBER_X 0x1111 | ||
| 60 | 61 | ||
| 61 | /* Compat: if this #define is present, UV headers support UV2 */ | 62 | /* Compat: if this #define is present, UV headers support UV2 */ |
| 62 | #define UV2_HUB_IS_SUPPORTED 1 | 63 | #define UV2_HUB_IS_SUPPORTED 1 |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 62ae3001ae02..9d59bbacd4e3 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
| @@ -93,6 +93,8 @@ static int __init early_get_pnodeid(void) | |||
| 93 | 93 | ||
| 94 | if (node_id.s.part_number == UV2_HUB_PART_NUMBER) | 94 | if (node_id.s.part_number == UV2_HUB_PART_NUMBER) |
| 95 | uv_min_hub_revision_id += UV2_HUB_REVISION_BASE - 1; | 95 | uv_min_hub_revision_id += UV2_HUB_REVISION_BASE - 1; |
| 96 | if (node_id.s.part_number == UV2_HUB_PART_NUMBER_X) | ||
| 97 | uv_min_hub_revision_id += UV2_HUB_REVISION_BASE - 1; | ||
| 96 | 98 | ||
| 97 | uv_hub_info->hub_revision = uv_min_hub_revision_id; | 99 | uv_hub_info->hub_revision = uv_min_hub_revision_id; |
| 98 | pnode = (node_id.s.node_id >> 1) & ((1 << m_n_config.s.n_skt) - 1); | 100 | pnode = (node_id.s.node_id >> 1) & ((1 << m_n_config.s.n_skt) - 1); |
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index a71efcdbb092..97b26356e9ee 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
| @@ -547,6 +547,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base, | |||
| 547 | 547 | ||
| 548 | if (tmp != mask_lo) { | 548 | if (tmp != mask_lo) { |
| 549 | printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n"); | 549 | printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n"); |
| 550 | add_taint(TAINT_FIRMWARE_WORKAROUND); | ||
| 550 | mask_lo = tmp; | 551 | mask_lo = tmp; |
| 551 | } | 552 | } |
| 552 | } | 553 | } |
| @@ -693,6 +694,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock) | |||
| 693 | 694 | ||
| 694 | /* Disable MTRRs, and set the default type to uncached */ | 695 | /* Disable MTRRs, and set the default type to uncached */ |
| 695 | mtrr_wrmsr(MSR_MTRRdefType, deftype_lo & ~0xcff, deftype_hi); | 696 | mtrr_wrmsr(MSR_MTRRdefType, deftype_lo & ~0xcff, deftype_hi); |
| 697 | wbinvd(); | ||
| 696 | } | 698 | } |
| 697 | 699 | ||
| 698 | static void post_set(void) __releases(set_atomicity_lock) | 700 | static void post_set(void) __releases(set_atomicity_lock) |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 640891014b2a..2bda212a0010 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
| @@ -312,12 +312,8 @@ int x86_setup_perfctr(struct perf_event *event) | |||
| 312 | return -EOPNOTSUPP; | 312 | return -EOPNOTSUPP; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | /* | ||
| 316 | * Do not allow config1 (extended registers) to propagate, | ||
| 317 | * there's no sane user-space generalization yet: | ||
| 318 | */ | ||
| 319 | if (attr->type == PERF_TYPE_RAW) | 315 | if (attr->type == PERF_TYPE_RAW) |
| 320 | return 0; | 316 | return x86_pmu_extra_regs(event->attr.config, event); |
| 321 | 317 | ||
| 322 | if (attr->type == PERF_TYPE_HW_CACHE) | 318 | if (attr->type == PERF_TYPE_HW_CACHE) |
| 323 | return set_ext_hw_attr(hwc, event); | 319 | return set_ext_hw_attr(hwc, event); |
| @@ -588,7 +584,7 @@ done: | |||
| 588 | x86_pmu.put_event_constraints(cpuc, cpuc->event_list[i]); | 584 | x86_pmu.put_event_constraints(cpuc, cpuc->event_list[i]); |
| 589 | } | 585 | } |
| 590 | } | 586 | } |
| 591 | return num ? -ENOSPC : 0; | 587 | return num ? -EINVAL : 0; |
| 592 | } | 588 | } |
| 593 | 589 | ||
| 594 | /* | 590 | /* |
| @@ -607,7 +603,7 @@ static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader, | |||
| 607 | 603 | ||
| 608 | if (is_x86_event(leader)) { | 604 | if (is_x86_event(leader)) { |
| 609 | if (n >= max_count) | 605 | if (n >= max_count) |
| 610 | return -ENOSPC; | 606 | return -EINVAL; |
| 611 | cpuc->event_list[n] = leader; | 607 | cpuc->event_list[n] = leader; |
| 612 | n++; | 608 | n++; |
| 613 | } | 609 | } |
| @@ -620,7 +616,7 @@ static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader, | |||
| 620 | continue; | 616 | continue; |
| 621 | 617 | ||
| 622 | if (n >= max_count) | 618 | if (n >= max_count) |
| 623 | return -ENOSPC; | 619 | return -EINVAL; |
| 624 | 620 | ||
| 625 | cpuc->event_list[n] = event; | 621 | cpuc->event_list[n] = event; |
| 626 | n++; | 622 | n++; |
| @@ -1316,7 +1312,7 @@ static int validate_event(struct perf_event *event) | |||
| 1316 | c = x86_pmu.get_event_constraints(fake_cpuc, event); | 1312 | c = x86_pmu.get_event_constraints(fake_cpuc, event); |
| 1317 | 1313 | ||
| 1318 | if (!c || !c->weight) | 1314 | if (!c || !c->weight) |
| 1319 | ret = -ENOSPC; | 1315 | ret = -EINVAL; |
| 1320 | 1316 | ||
| 1321 | if (x86_pmu.put_event_constraints) | 1317 | if (x86_pmu.put_event_constraints) |
| 1322 | x86_pmu.put_event_constraints(fake_cpuc, event); | 1318 | x86_pmu.put_event_constraints(fake_cpuc, event); |
| @@ -1341,7 +1337,7 @@ static int validate_group(struct perf_event *event) | |||
| 1341 | { | 1337 | { |
| 1342 | struct perf_event *leader = event->group_leader; | 1338 | struct perf_event *leader = event->group_leader; |
| 1343 | struct cpu_hw_events *fake_cpuc; | 1339 | struct cpu_hw_events *fake_cpuc; |
| 1344 | int ret = -ENOSPC, n; | 1340 | int ret = -EINVAL, n; |
| 1345 | 1341 | ||
| 1346 | fake_cpuc = allocate_fake_cpuc(); | 1342 | fake_cpuc = allocate_fake_cpuc(); |
| 1347 | if (IS_ERR(fake_cpuc)) | 1343 | if (IS_ERR(fake_cpuc)) |
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c index ab6343d21825..3b8a2d30d14e 100644 --- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c +++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c | |||
| @@ -199,8 +199,7 @@ static int force_ibs_eilvt_setup(void) | |||
| 199 | goto out; | 199 | goto out; |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | pr_err(FW_BUG "using offset %d for IBS interrupts\n", offset); | 202 | pr_info("IBS: LVT offset %d assigned\n", offset); |
| 203 | pr_err(FW_BUG "workaround enabled for IBS LVT offset\n"); | ||
| 204 | 203 | ||
| 205 | return 0; | 204 | return 0; |
| 206 | out: | 205 | out: |
| @@ -265,19 +264,23 @@ perf_ibs_cpu_notifier(struct notifier_block *self, unsigned long action, void *h | |||
| 265 | static __init int amd_ibs_init(void) | 264 | static __init int amd_ibs_init(void) |
| 266 | { | 265 | { |
| 267 | u32 caps; | 266 | u32 caps; |
| 268 | int ret; | 267 | int ret = -EINVAL; |
| 269 | 268 | ||
| 270 | caps = __get_ibs_caps(); | 269 | caps = __get_ibs_caps(); |
| 271 | if (!caps) | 270 | if (!caps) |
| 272 | return -ENODEV; /* ibs not supported by the cpu */ | 271 | return -ENODEV; /* ibs not supported by the cpu */ |
| 273 | 272 | ||
| 274 | if (!ibs_eilvt_valid()) { | 273 | /* |
| 275 | ret = force_ibs_eilvt_setup(); | 274 | * Force LVT offset assignment for family 10h: The offsets are |
| 276 | if (ret) { | 275 | * not assigned by the BIOS for this family, so the OS is |
| 277 | pr_err("Failed to setup IBS, %d\n", ret); | 276 | * responsible for doing it. If the OS assignment fails, fall |
| 278 | return ret; | 277 | * back to BIOS settings and try to setup this. |
| 279 | } | 278 | */ |
| 280 | } | 279 | if (boot_cpu_data.x86 == 0x10) |
| 280 | force_ibs_eilvt_setup(); | ||
| 281 | |||
| 282 | if (!ibs_eilvt_valid()) | ||
| 283 | goto out; | ||
| 281 | 284 | ||
| 282 | get_online_cpus(); | 285 | get_online_cpus(); |
| 283 | ibs_caps = caps; | 286 | ibs_caps = caps; |
| @@ -287,7 +290,11 @@ static __init int amd_ibs_init(void) | |||
| 287 | smp_call_function(setup_APIC_ibs, NULL, 1); | 290 | smp_call_function(setup_APIC_ibs, NULL, 1); |
| 288 | put_online_cpus(); | 291 | put_online_cpus(); |
| 289 | 292 | ||
| 290 | return perf_event_ibs_init(); | 293 | ret = perf_event_ibs_init(); |
| 294 | out: | ||
| 295 | if (ret) | ||
| 296 | pr_err("Failed to setup IBS, %d\n", ret); | ||
| 297 | return ret; | ||
| 291 | } | 298 | } |
| 292 | 299 | ||
| 293 | /* Since we need the pci subsystem to init ibs we can't do this earlier: */ | 300 | /* Since we need the pci subsystem to init ibs we can't do this earlier: */ |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 2be5ebe99872..8d601b18bf9f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
| @@ -1545,6 +1545,13 @@ static void intel_clovertown_quirks(void) | |||
| 1545 | x86_pmu.pebs_constraints = NULL; | 1545 | x86_pmu.pebs_constraints = NULL; |
| 1546 | } | 1546 | } |
| 1547 | 1547 | ||
| 1548 | static void intel_sandybridge_quirks(void) | ||
| 1549 | { | ||
| 1550 | printk(KERN_WARNING "PEBS disabled due to CPU errata.\n"); | ||
| 1551 | x86_pmu.pebs = 0; | ||
| 1552 | x86_pmu.pebs_constraints = NULL; | ||
| 1553 | } | ||
| 1554 | |||
| 1548 | __init int intel_pmu_init(void) | 1555 | __init int intel_pmu_init(void) |
| 1549 | { | 1556 | { |
| 1550 | union cpuid10_edx edx; | 1557 | union cpuid10_edx edx; |
| @@ -1694,6 +1701,7 @@ __init int intel_pmu_init(void) | |||
| 1694 | break; | 1701 | break; |
| 1695 | 1702 | ||
| 1696 | case 42: /* SandyBridge */ | 1703 | case 42: /* SandyBridge */ |
| 1704 | x86_pmu.quirks = intel_sandybridge_quirks; | ||
| 1697 | case 45: /* SandyBridge, "Romely-EP" */ | 1705 | case 45: /* SandyBridge, "Romely-EP" */ |
| 1698 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | 1706 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, |
| 1699 | sizeof(hw_cache_event_ids)); | 1707 | sizeof(hw_cache_event_ids)); |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index c0d238f49db8..73da6b64f5b7 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
| @@ -493,6 +493,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs) | |||
| 493 | unsigned long from = cpuc->lbr_entries[0].from; | 493 | unsigned long from = cpuc->lbr_entries[0].from; |
| 494 | unsigned long old_to, to = cpuc->lbr_entries[0].to; | 494 | unsigned long old_to, to = cpuc->lbr_entries[0].to; |
| 495 | unsigned long ip = regs->ip; | 495 | unsigned long ip = regs->ip; |
| 496 | int is_64bit = 0; | ||
| 496 | 497 | ||
| 497 | /* | 498 | /* |
| 498 | * We don't need to fixup if the PEBS assist is fault like | 499 | * We don't need to fixup if the PEBS assist is fault like |
| @@ -544,7 +545,10 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs) | |||
| 544 | } else | 545 | } else |
| 545 | kaddr = (void *)to; | 546 | kaddr = (void *)to; |
| 546 | 547 | ||
| 547 | kernel_insn_init(&insn, kaddr); | 548 | #ifdef CONFIG_X86_64 |
| 549 | is_64bit = kernel_ip(to) || !test_thread_flag(TIF_IA32); | ||
| 550 | #endif | ||
| 551 | insn_init(&insn, kaddr, is_64bit); | ||
| 548 | insn_get_length(&insn); | 552 | insn_get_length(&insn); |
| 549 | to += insn.length; | 553 | to += insn.length; |
| 550 | } while (to < ip); | 554 | } while (to < ip); |
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c index 492bf1358a7c..ef484d9d0a25 100644 --- a/arch/x86/kernel/cpu/perf_event_p4.c +++ b/arch/x86/kernel/cpu/perf_event_p4.c | |||
| @@ -1268,7 +1268,7 @@ reserve: | |||
| 1268 | } | 1268 | } |
| 1269 | 1269 | ||
| 1270 | done: | 1270 | done: |
| 1271 | return num ? -ENOSPC : 0; | 1271 | return num ? -EINVAL : 0; |
| 1272 | } | 1272 | } |
| 1273 | 1273 | ||
| 1274 | static __initconst const struct x86_pmu p4_pmu = { | 1274 | static __initconst const struct x86_pmu p4_pmu = { |
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c index 3b97a80ce329..c99f9ed013d5 100644 --- a/arch/x86/kernel/dumpstack_32.c +++ b/arch/x86/kernel/dumpstack_32.c | |||
| @@ -116,16 +116,16 @@ void show_registers(struct pt_regs *regs) | |||
| 116 | for (i = 0; i < code_len; i++, ip++) { | 116 | for (i = 0; i < code_len; i++, ip++) { |
| 117 | if (ip < (u8 *)PAGE_OFFSET || | 117 | if (ip < (u8 *)PAGE_OFFSET || |
| 118 | probe_kernel_address(ip, c)) { | 118 | probe_kernel_address(ip, c)) { |
| 119 | printk(" Bad EIP value."); | 119 | printk(KERN_CONT " Bad EIP value."); |
| 120 | break; | 120 | break; |
| 121 | } | 121 | } |
| 122 | if (ip == (u8 *)regs->ip) | 122 | if (ip == (u8 *)regs->ip) |
| 123 | printk("<%02x> ", c); | 123 | printk(KERN_CONT "<%02x> ", c); |
| 124 | else | 124 | else |
| 125 | printk("%02x ", c); | 125 | printk(KERN_CONT "%02x ", c); |
| 126 | } | 126 | } |
| 127 | } | 127 | } |
| 128 | printk("\n"); | 128 | printk(KERN_CONT "\n"); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | int is_valid_bugaddr(unsigned long ip) | 131 | int is_valid_bugaddr(unsigned long ip) |
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index 19853ad8afc5..6d728d9284bd 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
| @@ -284,16 +284,16 @@ void show_registers(struct pt_regs *regs) | |||
| 284 | for (i = 0; i < code_len; i++, ip++) { | 284 | for (i = 0; i < code_len; i++, ip++) { |
| 285 | if (ip < (u8 *)PAGE_OFFSET || | 285 | if (ip < (u8 *)PAGE_OFFSET || |
| 286 | probe_kernel_address(ip, c)) { | 286 | probe_kernel_address(ip, c)) { |
| 287 | printk(" Bad RIP value."); | 287 | printk(KERN_CONT " Bad RIP value."); |
| 288 | break; | 288 | break; |
| 289 | } | 289 | } |
| 290 | if (ip == (u8 *)regs->ip) | 290 | if (ip == (u8 *)regs->ip) |
| 291 | printk("<%02x> ", c); | 291 | printk(KERN_CONT "<%02x> ", c); |
| 292 | else | 292 | else |
| 293 | printk("%02x ", c); | 293 | printk(KERN_CONT "%02x ", c); |
| 294 | } | 294 | } |
| 295 | } | 295 | } |
| 296 | printk("\n"); | 296 | printk(KERN_CONT "\n"); |
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | int is_valid_bugaddr(unsigned long ip) | 299 | int is_valid_bugaddr(unsigned long ip) |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index b946a9eac7d9..1bb0bf4d92cd 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
| @@ -1049,6 +1049,14 @@ int hpet_rtc_timer_init(void) | |||
| 1049 | } | 1049 | } |
| 1050 | EXPORT_SYMBOL_GPL(hpet_rtc_timer_init); | 1050 | EXPORT_SYMBOL_GPL(hpet_rtc_timer_init); |
| 1051 | 1051 | ||
| 1052 | static void hpet_disable_rtc_channel(void) | ||
| 1053 | { | ||
| 1054 | unsigned long cfg; | ||
| 1055 | cfg = hpet_readl(HPET_T1_CFG); | ||
| 1056 | cfg &= ~HPET_TN_ENABLE; | ||
| 1057 | hpet_writel(cfg, HPET_T1_CFG); | ||
| 1058 | } | ||
| 1059 | |||
| 1052 | /* | 1060 | /* |
| 1053 | * The functions below are called from rtc driver. | 1061 | * The functions below are called from rtc driver. |
| 1054 | * Return 0 if HPET is not being used. | 1062 | * Return 0 if HPET is not being used. |
| @@ -1060,6 +1068,9 @@ int hpet_mask_rtc_irq_bit(unsigned long bit_mask) | |||
| 1060 | return 0; | 1068 | return 0; |
| 1061 | 1069 | ||
| 1062 | hpet_rtc_flags &= ~bit_mask; | 1070 | hpet_rtc_flags &= ~bit_mask; |
| 1071 | if (unlikely(!hpet_rtc_flags)) | ||
| 1072 | hpet_disable_rtc_channel(); | ||
| 1073 | |||
| 1063 | return 1; | 1074 | return 1; |
| 1064 | } | 1075 | } |
| 1065 | EXPORT_SYMBOL_GPL(hpet_mask_rtc_irq_bit); | 1076 | EXPORT_SYMBOL_GPL(hpet_mask_rtc_irq_bit); |
| @@ -1125,15 +1136,11 @@ EXPORT_SYMBOL_GPL(hpet_rtc_dropped_irq); | |||
| 1125 | 1136 | ||
| 1126 | static void hpet_rtc_timer_reinit(void) | 1137 | static void hpet_rtc_timer_reinit(void) |
| 1127 | { | 1138 | { |
| 1128 | unsigned int cfg, delta; | 1139 | unsigned int delta; |
| 1129 | int lost_ints = -1; | 1140 | int lost_ints = -1; |
| 1130 | 1141 | ||
| 1131 | if (unlikely(!hpet_rtc_flags)) { | 1142 | if (unlikely(!hpet_rtc_flags)) |
| 1132 | cfg = hpet_readl(HPET_T1_CFG); | 1143 | hpet_disable_rtc_channel(); |
| 1133 | cfg &= ~HPET_TN_ENABLE; | ||
| 1134 | hpet_writel(cfg, HPET_T1_CFG); | ||
| 1135 | return; | ||
| 1136 | } | ||
| 1137 | 1144 | ||
| 1138 | if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit) | 1145 | if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit) |
| 1139 | delta = hpet_default_delta; | 1146 | delta = hpet_default_delta; |
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c index acf8fbf8fbda..69bca468c47a 100644 --- a/arch/x86/kernel/irq_64.c +++ b/arch/x86/kernel/irq_64.c | |||
| @@ -38,6 +38,9 @@ static inline void stack_overflow_check(struct pt_regs *regs) | |||
| 38 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | 38 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
| 39 | u64 curbase = (u64)task_stack_page(current); | 39 | u64 curbase = (u64)task_stack_page(current); |
| 40 | 40 | ||
| 41 | if (user_mode_vm(regs)) | ||
| 42 | return; | ||
| 43 | |||
| 41 | WARN_ONCE(regs->sp >= curbase && | 44 | WARN_ONCE(regs->sp >= curbase && |
| 42 | regs->sp <= curbase + THREAD_SIZE && | 45 | regs->sp <= curbase + THREAD_SIZE && |
| 43 | regs->sp < curbase + sizeof(struct thread_info) + | 46 | regs->sp < curbase + sizeof(struct thread_info) + |
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index f2d2a664e797..9d46f5e43b51 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c | |||
| @@ -256,7 +256,7 @@ static int __init microcode_dev_init(void) | |||
| 256 | return 0; | 256 | return 0; |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | static void microcode_dev_exit(void) | 259 | static void __exit microcode_dev_exit(void) |
| 260 | { | 260 | { |
| 261 | misc_deregister(µcode_dev); | 261 | misc_deregister(µcode_dev); |
| 262 | } | 262 | } |
| @@ -519,10 +519,8 @@ static int __init microcode_init(void) | |||
| 519 | 519 | ||
| 520 | microcode_pdev = platform_device_register_simple("microcode", -1, | 520 | microcode_pdev = platform_device_register_simple("microcode", -1, |
| 521 | NULL, 0); | 521 | NULL, 0); |
| 522 | if (IS_ERR(microcode_pdev)) { | 522 | if (IS_ERR(microcode_pdev)) |
| 523 | microcode_dev_exit(); | ||
| 524 | return PTR_ERR(microcode_pdev); | 523 | return PTR_ERR(microcode_pdev); |
| 525 | } | ||
| 526 | 524 | ||
| 527 | get_online_cpus(); | 525 | get_online_cpus(); |
| 528 | mutex_lock(µcode_mutex); | 526 | mutex_lock(µcode_mutex); |
| @@ -532,14 +530,12 @@ static int __init microcode_init(void) | |||
| 532 | mutex_unlock(µcode_mutex); | 530 | mutex_unlock(µcode_mutex); |
| 533 | put_online_cpus(); | 531 | put_online_cpus(); |
| 534 | 532 | ||
| 535 | if (error) { | 533 | if (error) |
| 536 | platform_device_unregister(microcode_pdev); | 534 | goto out_pdev; |
| 537 | return error; | ||
| 538 | } | ||
| 539 | 535 | ||
| 540 | error = microcode_dev_init(); | 536 | error = microcode_dev_init(); |
| 541 | if (error) | 537 | if (error) |
| 542 | return error; | 538 | goto out_sysdev_driver; |
| 543 | 539 | ||
| 544 | register_syscore_ops(&mc_syscore_ops); | 540 | register_syscore_ops(&mc_syscore_ops); |
| 545 | register_hotcpu_notifier(&mc_cpu_notifier); | 541 | register_hotcpu_notifier(&mc_cpu_notifier); |
| @@ -548,6 +544,20 @@ static int __init microcode_init(void) | |||
| 548 | " <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n"); | 544 | " <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n"); |
| 549 | 545 | ||
| 550 | return 0; | 546 | return 0; |
| 547 | |||
| 548 | out_sysdev_driver: | ||
| 549 | get_online_cpus(); | ||
| 550 | mutex_lock(µcode_mutex); | ||
| 551 | |||
| 552 | sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); | ||
| 553 | |||
| 554 | mutex_unlock(µcode_mutex); | ||
| 555 | put_online_cpus(); | ||
| 556 | |||
| 557 | out_pdev: | ||
| 558 | platform_device_unregister(microcode_pdev); | ||
| 559 | return error; | ||
| 560 | |||
| 551 | } | 561 | } |
| 552 | module_init(microcode_init); | 562 | module_init(microcode_init); |
| 553 | 563 | ||
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 9103b89c145a..0741b062a304 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
| @@ -95,8 +95,8 @@ static void __init MP_bus_info(struct mpc_bus *m) | |||
| 95 | } | 95 | } |
| 96 | #endif | 96 | #endif |
| 97 | 97 | ||
| 98 | set_bit(m->busid, mp_bus_not_pci); | ||
| 98 | if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) { | 99 | if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) { |
| 99 | set_bit(m->busid, mp_bus_not_pci); | ||
| 100 | #if defined(CONFIG_EISA) || defined(CONFIG_MCA) | 100 | #if defined(CONFIG_EISA) || defined(CONFIG_MCA) |
| 101 | mp_bus_id_to_type[m->busid] = MP_BUS_ISA; | 101 | mp_bus_id_to_type[m->busid] = MP_BUS_ISA; |
| 102 | #endif | 102 | #endif |
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index b78643d0f9a5..03920a15a632 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
| @@ -553,4 +553,17 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC, | |||
| 553 | quirk_amd_nb_node); | 553 | quirk_amd_nb_node); |
| 554 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_LINK, | 554 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_LINK, |
| 555 | quirk_amd_nb_node); | 555 | quirk_amd_nb_node); |
| 556 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F0, | ||
| 557 | quirk_amd_nb_node); | ||
| 558 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F1, | ||
| 559 | quirk_amd_nb_node); | ||
| 560 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F2, | ||
| 561 | quirk_amd_nb_node); | ||
| 562 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3, | ||
| 563 | quirk_amd_nb_node); | ||
| 564 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4, | ||
| 565 | quirk_amd_nb_node); | ||
| 566 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5, | ||
| 567 | quirk_amd_nb_node); | ||
| 568 | |||
| 556 | #endif | 569 | #endif |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index e334be1182b9..37a458b521a6 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
| @@ -124,7 +124,7 @@ __setup("reboot=", reboot_setup); | |||
| 124 | */ | 124 | */ |
| 125 | 125 | ||
| 126 | /* | 126 | /* |
| 127 | * Some machines require the "reboot=b" commandline option, | 127 | * Some machines require the "reboot=b" or "reboot=k" commandline options, |
| 128 | * this quirk makes that automatic. | 128 | * this quirk makes that automatic. |
| 129 | */ | 129 | */ |
| 130 | static int __init set_bios_reboot(const struct dmi_system_id *d) | 130 | static int __init set_bios_reboot(const struct dmi_system_id *d) |
| @@ -136,6 +136,15 @@ static int __init set_bios_reboot(const struct dmi_system_id *d) | |||
| 136 | return 0; | 136 | return 0; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | static int __init set_kbd_reboot(const struct dmi_system_id *d) | ||
| 140 | { | ||
| 141 | if (reboot_type != BOOT_KBD) { | ||
| 142 | reboot_type = BOOT_KBD; | ||
| 143 | printk(KERN_INFO "%s series board detected. Selecting KBD-method for reboot.\n", d->ident); | ||
| 144 | } | ||
| 145 | return 0; | ||
| 146 | } | ||
| 147 | |||
| 139 | static struct dmi_system_id __initdata reboot_dmi_table[] = { | 148 | static struct dmi_system_id __initdata reboot_dmi_table[] = { |
| 140 | { /* Handle problems with rebooting on Dell E520's */ | 149 | { /* Handle problems with rebooting on Dell E520's */ |
| 141 | .callback = set_bios_reboot, | 150 | .callback = set_bios_reboot, |
| @@ -295,7 +304,7 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
| 295 | }, | 304 | }, |
| 296 | }, | 305 | }, |
| 297 | { /* Handle reboot issue on Acer Aspire one */ | 306 | { /* Handle reboot issue on Acer Aspire one */ |
| 298 | .callback = set_bios_reboot, | 307 | .callback = set_kbd_reboot, |
| 299 | .ident = "Acer Aspire One A110", | 308 | .ident = "Acer Aspire One A110", |
| 300 | .matches = { | 309 | .matches = { |
| 301 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 310 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
| @@ -443,6 +452,14 @@ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { | |||
| 443 | DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6420"), | 452 | DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6420"), |
| 444 | }, | 453 | }, |
| 445 | }, | 454 | }, |
| 455 | { /* Handle problems with rebooting on the OptiPlex 990. */ | ||
| 456 | .callback = set_pci_reboot, | ||
| 457 | .ident = "Dell OptiPlex 990", | ||
| 458 | .matches = { | ||
| 459 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
| 460 | DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"), | ||
| 461 | }, | ||
| 462 | }, | ||
| 446 | { } | 463 | { } |
| 447 | }; | 464 | }; |
| 448 | 465 | ||
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c index 348ce016a835..af6db6ec5b2a 100644 --- a/arch/x86/kernel/rtc.c +++ b/arch/x86/kernel/rtc.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <asm/vsyscall.h> | 12 | #include <asm/vsyscall.h> |
| 13 | #include <asm/x86_init.h> | 13 | #include <asm/x86_init.h> |
| 14 | #include <asm/time.h> | 14 | #include <asm/time.h> |
| 15 | #include <asm/mrst.h> | ||
| 15 | 16 | ||
| 16 | #ifdef CONFIG_X86_32 | 17 | #ifdef CONFIG_X86_32 |
| 17 | /* | 18 | /* |
| @@ -242,6 +243,10 @@ static __init int add_rtc_cmos(void) | |||
| 242 | if (of_have_populated_dt()) | 243 | if (of_have_populated_dt()) |
| 243 | return 0; | 244 | return 0; |
| 244 | 245 | ||
| 246 | /* Intel MID platforms don't have ioport rtc */ | ||
| 247 | if (mrst_identify_cpu()) | ||
| 248 | return -ENODEV; | ||
| 249 | |||
| 245 | platform_device_register(&rtc_device); | 250 | platform_device_register(&rtc_device); |
| 246 | dev_info(&rtc_device.dev, | 251 | dev_info(&rtc_device.dev, |
| 247 | "registered platform RTC device (no PNP device found)\n"); | 252 | "registered platform RTC device (no PNP device found)\n"); |
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c index ea305856151c..dd74e46828c0 100644 --- a/arch/x86/mm/gup.c +++ b/arch/x86/mm/gup.c | |||
| @@ -201,6 +201,8 @@ static noinline int gup_huge_pud(pud_t pud, unsigned long addr, | |||
| 201 | do { | 201 | do { |
| 202 | VM_BUG_ON(compound_head(page) != head); | 202 | VM_BUG_ON(compound_head(page) != head); |
| 203 | pages[*nr] = page; | 203 | pages[*nr] = page; |
| 204 | if (PageTail(page)) | ||
| 205 | get_huge_page_tail(page); | ||
| 204 | (*nr)++; | 206 | (*nr)++; |
| 205 | page++; | 207 | page++; |
| 206 | refs++; | 208 | refs++; |
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c index b49962662101..f4f29b19fac5 100644 --- a/arch/x86/mm/highmem_32.c +++ b/arch/x86/mm/highmem_32.c | |||
| @@ -45,6 +45,7 @@ void *kmap_atomic_prot(struct page *page, pgprot_t prot) | |||
| 45 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); | 45 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); |
| 46 | BUG_ON(!pte_none(*(kmap_pte-idx))); | 46 | BUG_ON(!pte_none(*(kmap_pte-idx))); |
| 47 | set_pte(kmap_pte-idx, mk_pte(page, prot)); | 47 | set_pte(kmap_pte-idx, mk_pte(page, prot)); |
| 48 | arch_flush_lazy_mmu_mode(); | ||
| 48 | 49 | ||
| 49 | return (void *)vaddr; | 50 | return (void *)vaddr; |
| 50 | } | 51 | } |
| @@ -88,6 +89,7 @@ void __kunmap_atomic(void *kvaddr) | |||
| 88 | */ | 89 | */ |
| 89 | kpte_clear_flush(kmap_pte-idx, vaddr); | 90 | kpte_clear_flush(kmap_pte-idx, vaddr); |
| 90 | kmap_atomic_idx_pop(); | 91 | kmap_atomic_idx_pop(); |
| 92 | arch_flush_lazy_mmu_mode(); | ||
| 91 | } | 93 | } |
| 92 | #ifdef CONFIG_DEBUG_HIGHMEM | 94 | #ifdef CONFIG_DEBUG_HIGHMEM |
| 93 | else { | 95 | else { |
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index bfab3fa10edc..7b65f752c5f8 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c | |||
| @@ -568,8 +568,8 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i]; | |||
| 568 | break; | 568 | break; |
| 569 | } | 569 | } |
| 570 | if (filter[i].jt != 0) { | 570 | if (filter[i].jt != 0) { |
| 571 | if (filter[i].jf) | 571 | if (filter[i].jf && f_offset) |
| 572 | t_offset += is_near(f_offset) ? 2 : 6; | 572 | t_offset += is_near(f_offset) ? 2 : 5; |
| 573 | EMIT_COND_JMP(t_op, t_offset); | 573 | EMIT_COND_JMP(t_op, t_offset); |
| 574 | if (filter[i].jf) | 574 | if (filter[i].jf) |
| 575 | EMIT_JMP(f_offset); | 575 | EMIT_JMP(f_offset); |
diff --git a/arch/x86/oprofile/init.c b/arch/x86/oprofile/init.c index cdfe4c54deca..f148cf652678 100644 --- a/arch/x86/oprofile/init.c +++ b/arch/x86/oprofile/init.c | |||
| @@ -21,6 +21,7 @@ extern int op_nmi_timer_init(struct oprofile_operations *ops); | |||
| 21 | extern void op_nmi_exit(void); | 21 | extern void op_nmi_exit(void); |
| 22 | extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth); | 22 | extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth); |
| 23 | 23 | ||
| 24 | static int nmi_timer; | ||
| 24 | 25 | ||
| 25 | int __init oprofile_arch_init(struct oprofile_operations *ops) | 26 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
| 26 | { | 27 | { |
| @@ -31,8 +32,9 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
| 31 | #ifdef CONFIG_X86_LOCAL_APIC | 32 | #ifdef CONFIG_X86_LOCAL_APIC |
| 32 | ret = op_nmi_init(ops); | 33 | ret = op_nmi_init(ops); |
| 33 | #endif | 34 | #endif |
| 35 | nmi_timer = (ret != 0); | ||
| 34 | #ifdef CONFIG_X86_IO_APIC | 36 | #ifdef CONFIG_X86_IO_APIC |
| 35 | if (ret < 0) | 37 | if (nmi_timer) |
| 36 | ret = op_nmi_timer_init(ops); | 38 | ret = op_nmi_timer_init(ops); |
| 37 | #endif | 39 | #endif |
| 38 | ops->backtrace = x86_backtrace; | 40 | ops->backtrace = x86_backtrace; |
| @@ -44,6 +46,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
| 44 | void oprofile_arch_exit(void) | 46 | void oprofile_arch_exit(void) |
| 45 | { | 47 | { |
| 46 | #ifdef CONFIG_X86_LOCAL_APIC | 48 | #ifdef CONFIG_X86_LOCAL_APIC |
| 47 | op_nmi_exit(); | 49 | if (!nmi_timer) |
| 50 | op_nmi_exit(); | ||
| 48 | #endif | 51 | #endif |
| 49 | } | 52 | } |
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c index e36bf714cb77..40e446941dd7 100644 --- a/arch/x86/platform/efi/efi_32.c +++ b/arch/x86/platform/efi/efi_32.c | |||
| @@ -39,43 +39,14 @@ | |||
| 39 | */ | 39 | */ |
| 40 | 40 | ||
| 41 | static unsigned long efi_rt_eflags; | 41 | static unsigned long efi_rt_eflags; |
| 42 | static pgd_t efi_bak_pg_dir_pointer[2]; | ||
| 43 | 42 | ||
| 44 | void efi_call_phys_prelog(void) | 43 | void efi_call_phys_prelog(void) |
| 45 | { | 44 | { |
| 46 | unsigned long cr4; | ||
| 47 | unsigned long temp; | ||
| 48 | struct desc_ptr gdt_descr; | 45 | struct desc_ptr gdt_descr; |
| 49 | 46 | ||
| 50 | local_irq_save(efi_rt_eflags); | 47 | local_irq_save(efi_rt_eflags); |
| 51 | 48 | ||
| 52 | /* | 49 | load_cr3(initial_page_table); |
| 53 | * If I don't have PAE, I should just duplicate two entries in page | ||
| 54 | * directory. If I have PAE, I just need to duplicate one entry in | ||
| 55 | * page directory. | ||
| 56 | */ | ||
| 57 | cr4 = read_cr4_safe(); | ||
| 58 | |||
| 59 | if (cr4 & X86_CR4_PAE) { | ||
| 60 | efi_bak_pg_dir_pointer[0].pgd = | ||
| 61 | swapper_pg_dir[pgd_index(0)].pgd; | ||
| 62 | swapper_pg_dir[0].pgd = | ||
| 63 | swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd; | ||
| 64 | } else { | ||
| 65 | efi_bak_pg_dir_pointer[0].pgd = | ||
| 66 | swapper_pg_dir[pgd_index(0)].pgd; | ||
| 67 | efi_bak_pg_dir_pointer[1].pgd = | ||
| 68 | swapper_pg_dir[pgd_index(0x400000)].pgd; | ||
| 69 | swapper_pg_dir[pgd_index(0)].pgd = | ||
| 70 | swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd; | ||
| 71 | temp = PAGE_OFFSET + 0x400000; | ||
| 72 | swapper_pg_dir[pgd_index(0x400000)].pgd = | ||
| 73 | swapper_pg_dir[pgd_index(temp)].pgd; | ||
| 74 | } | ||
| 75 | |||
| 76 | /* | ||
| 77 | * After the lock is released, the original page table is restored. | ||
| 78 | */ | ||
| 79 | __flush_tlb_all(); | 50 | __flush_tlb_all(); |
| 80 | 51 | ||
| 81 | gdt_descr.address = __pa(get_cpu_gdt_table(0)); | 52 | gdt_descr.address = __pa(get_cpu_gdt_table(0)); |
| @@ -85,28 +56,13 @@ void efi_call_phys_prelog(void) | |||
| 85 | 56 | ||
| 86 | void efi_call_phys_epilog(void) | 57 | void efi_call_phys_epilog(void) |
| 87 | { | 58 | { |
| 88 | unsigned long cr4; | ||
| 89 | struct desc_ptr gdt_descr; | 59 | struct desc_ptr gdt_descr; |
| 90 | 60 | ||
| 91 | gdt_descr.address = (unsigned long)get_cpu_gdt_table(0); | 61 | gdt_descr.address = (unsigned long)get_cpu_gdt_table(0); |
| 92 | gdt_descr.size = GDT_SIZE - 1; | 62 | gdt_descr.size = GDT_SIZE - 1; |
| 93 | load_gdt(&gdt_descr); | 63 | load_gdt(&gdt_descr); |
| 94 | 64 | ||
| 95 | cr4 = read_cr4_safe(); | 65 | load_cr3(swapper_pg_dir); |
| 96 | |||
| 97 | if (cr4 & X86_CR4_PAE) { | ||
| 98 | swapper_pg_dir[pgd_index(0)].pgd = | ||
| 99 | efi_bak_pg_dir_pointer[0].pgd; | ||
| 100 | } else { | ||
| 101 | swapper_pg_dir[pgd_index(0)].pgd = | ||
| 102 | efi_bak_pg_dir_pointer[0].pgd; | ||
| 103 | swapper_pg_dir[pgd_index(0x400000)].pgd = | ||
| 104 | efi_bak_pg_dir_pointer[1].pgd; | ||
| 105 | } | ||
| 106 | |||
| 107 | /* | ||
| 108 | * After the lock is released, the original page table is restored. | ||
| 109 | */ | ||
| 110 | __flush_tlb_all(); | 66 | __flush_tlb_all(); |
| 111 | 67 | ||
| 112 | local_irq_restore(efi_rt_eflags); | 68 | local_irq_restore(efi_rt_eflags); |
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index b1489a06a49d..ad4ec1cb097e 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c | |||
| @@ -76,6 +76,20 @@ struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX]; | |||
| 76 | EXPORT_SYMBOL_GPL(sfi_mrtc_array); | 76 | EXPORT_SYMBOL_GPL(sfi_mrtc_array); |
| 77 | int sfi_mrtc_num; | 77 | int sfi_mrtc_num; |
| 78 | 78 | ||
| 79 | static void mrst_power_off(void) | ||
| 80 | { | ||
| 81 | if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) | ||
| 82 | intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 1); | ||
| 83 | } | ||
| 84 | |||
| 85 | static void mrst_reboot(void) | ||
| 86 | { | ||
| 87 | if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) | ||
| 88 | intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 0); | ||
| 89 | else | ||
| 90 | intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); | ||
| 91 | } | ||
| 92 | |||
| 79 | /* parse all the mtimer info to a static mtimer array */ | 93 | /* parse all the mtimer info to a static mtimer array */ |
| 80 | static int __init sfi_parse_mtmr(struct sfi_table_header *table) | 94 | static int __init sfi_parse_mtmr(struct sfi_table_header *table) |
| 81 | { | 95 | { |
| @@ -265,17 +279,6 @@ static int mrst_i8042_detect(void) | |||
| 265 | return 0; | 279 | return 0; |
| 266 | } | 280 | } |
| 267 | 281 | ||
| 268 | /* Reboot and power off are handled by the SCU on a MID device */ | ||
| 269 | static void mrst_power_off(void) | ||
| 270 | { | ||
| 271 | intel_scu_ipc_simple_command(0xf1, 1); | ||
| 272 | } | ||
| 273 | |||
| 274 | static void mrst_reboot(void) | ||
| 275 | { | ||
| 276 | intel_scu_ipc_simple_command(0xf1, 0); | ||
| 277 | } | ||
| 278 | |||
| 279 | /* | 282 | /* |
| 280 | * Moorestown does not have external NMI source nor port 0x61 to report | 283 | * Moorestown does not have external NMI source nor port 0x61 to report |
| 281 | * NMI status. The possible NMI sources are from pmu as a result of NMI | 284 | * NMI status. The possible NMI sources are from pmu as a result of NMI |
| @@ -484,6 +487,46 @@ static void __init *max7315_platform_data(void *info) | |||
| 484 | return max7315; | 487 | return max7315; |
| 485 | } | 488 | } |
| 486 | 489 | ||
| 490 | static void *tca6416_platform_data(void *info) | ||
| 491 | { | ||
| 492 | static struct pca953x_platform_data tca6416; | ||
| 493 | struct i2c_board_info *i2c_info = info; | ||
| 494 | int gpio_base, intr; | ||
| 495 | char base_pin_name[SFI_NAME_LEN + 1]; | ||
| 496 | char intr_pin_name[SFI_NAME_LEN + 1]; | ||
| 497 | |||
| 498 | strcpy(i2c_info->type, "tca6416"); | ||
| 499 | strcpy(base_pin_name, "tca6416_base"); | ||
| 500 | strcpy(intr_pin_name, "tca6416_int"); | ||
| 501 | |||
| 502 | gpio_base = get_gpio_by_name(base_pin_name); | ||
| 503 | intr = get_gpio_by_name(intr_pin_name); | ||
| 504 | |||
| 505 | if (gpio_base == -1) | ||
| 506 | return NULL; | ||
| 507 | tca6416.gpio_base = gpio_base; | ||
| 508 | if (intr != -1) { | ||
| 509 | i2c_info->irq = intr + MRST_IRQ_OFFSET; | ||
| 510 | tca6416.irq_base = gpio_base + MRST_IRQ_OFFSET; | ||
| 511 | } else { | ||
| 512 | i2c_info->irq = -1; | ||
| 513 | tca6416.irq_base = -1; | ||
| 514 | } | ||
| 515 | return &tca6416; | ||
| 516 | } | ||
| 517 | |||
| 518 | static void *mpu3050_platform_data(void *info) | ||
| 519 | { | ||
| 520 | struct i2c_board_info *i2c_info = info; | ||
| 521 | int intr = get_gpio_by_name("mpu3050_int"); | ||
| 522 | |||
| 523 | if (intr == -1) | ||
| 524 | return NULL; | ||
| 525 | |||
| 526 | i2c_info->irq = intr + MRST_IRQ_OFFSET; | ||
| 527 | return NULL; | ||
| 528 | } | ||
| 529 | |||
| 487 | static void __init *emc1403_platform_data(void *info) | 530 | static void __init *emc1403_platform_data(void *info) |
| 488 | { | 531 | { |
| 489 | static short intr2nd_pdata; | 532 | static short intr2nd_pdata; |
| @@ -646,12 +689,15 @@ static void *msic_ocd_platform_data(void *info) | |||
| 646 | static const struct devs_id __initconst device_ids[] = { | 689 | static const struct devs_id __initconst device_ids[] = { |
| 647 | {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data}, | 690 | {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data}, |
| 648 | {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, | 691 | {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, |
| 692 | {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data}, | ||
| 649 | {"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data}, | 693 | {"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data}, |
| 650 | {"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, | 694 | {"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, |
| 651 | {"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, | 695 | {"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, |
| 696 | {"tca6416", SFI_DEV_TYPE_I2C, 1, &tca6416_platform_data}, | ||
| 652 | {"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data}, | 697 | {"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data}, |
| 653 | {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, | 698 | {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, |
| 654 | {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, | 699 | {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, |
| 700 | {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data}, | ||
| 655 | 701 | ||
| 656 | /* MSIC subdevices */ | 702 | /* MSIC subdevices */ |
| 657 | {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data}, | 703 | {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data}, |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 1093f80c162d..b2c7179fa263 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
| @@ -173,9 +173,21 @@ static unsigned long __init xen_get_max_pages(void) | |||
| 173 | domid_t domid = DOMID_SELF; | 173 | domid_t domid = DOMID_SELF; |
| 174 | int ret; | 174 | int ret; |
| 175 | 175 | ||
| 176 | ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid); | 176 | /* |
| 177 | if (ret > 0) | 177 | * For the initial domain we use the maximum reservation as |
| 178 | max_pages = ret; | 178 | * the maximum page. |
| 179 | * | ||
| 180 | * For guest domains the current maximum reservation reflects | ||
| 181 | * the current maximum rather than the static maximum. In this | ||
| 182 | * case the e820 map provided to us will cover the static | ||
| 183 | * maximum region. | ||
| 184 | */ | ||
| 185 | if (xen_initial_domain()) { | ||
| 186 | ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid); | ||
| 187 | if (ret > 0) | ||
| 188 | max_pages = ret; | ||
| 189 | } | ||
| 190 | |||
| 179 | return min(max_pages, MAX_DOMAIN_PAGES); | 191 | return min(max_pages, MAX_DOMAIN_PAGES); |
| 180 | } | 192 | } |
| 181 | 193 | ||
diff --git a/block/blk-core.c b/block/blk-core.c index ea70e6c80cd3..15de223c7f93 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -366,7 +366,14 @@ void blk_drain_queue(struct request_queue *q, bool drain_all) | |||
| 366 | if (drain_all) | 366 | if (drain_all) |
| 367 | blk_throtl_drain(q); | 367 | blk_throtl_drain(q); |
| 368 | 368 | ||
| 369 | __blk_run_queue(q); | 369 | /* |
| 370 | * This function might be called on a queue which failed | ||
| 371 | * driver init after queue creation. Some drivers | ||
| 372 | * (e.g. fd) get unhappy in such cases. Kick queue iff | ||
| 373 | * dispatch queue has something on it. | ||
| 374 | */ | ||
| 375 | if (!list_empty(&q->queue_head)) | ||
| 376 | __blk_run_queue(q); | ||
| 370 | 377 | ||
| 371 | if (drain_all) | 378 | if (drain_all) |
| 372 | nr_rqs = q->rq.count[0] + q->rq.count[1]; | 379 | nr_rqs = q->rq.count[0] + q->rq.count[1]; |
| @@ -467,6 +474,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) | |||
| 467 | q->backing_dev_info.state = 0; | 474 | q->backing_dev_info.state = 0; |
| 468 | q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY; | 475 | q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY; |
| 469 | q->backing_dev_info.name = "block"; | 476 | q->backing_dev_info.name = "block"; |
| 477 | q->node = node_id; | ||
| 470 | 478 | ||
| 471 | err = bdi_init(&q->backing_dev_info); | 479 | err = bdi_init(&q->backing_dev_info); |
| 472 | if (err) { | 480 | if (err) { |
| @@ -551,7 +559,7 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id) | |||
| 551 | if (!uninit_q) | 559 | if (!uninit_q) |
| 552 | return NULL; | 560 | return NULL; |
| 553 | 561 | ||
| 554 | q = blk_init_allocated_queue_node(uninit_q, rfn, lock, node_id); | 562 | q = blk_init_allocated_queue(uninit_q, rfn, lock); |
| 555 | if (!q) | 563 | if (!q) |
| 556 | blk_cleanup_queue(uninit_q); | 564 | blk_cleanup_queue(uninit_q); |
| 557 | 565 | ||
| @@ -563,18 +571,9 @@ struct request_queue * | |||
| 563 | blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, | 571 | blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, |
| 564 | spinlock_t *lock) | 572 | spinlock_t *lock) |
| 565 | { | 573 | { |
| 566 | return blk_init_allocated_queue_node(q, rfn, lock, -1); | ||
| 567 | } | ||
| 568 | EXPORT_SYMBOL(blk_init_allocated_queue); | ||
| 569 | |||
| 570 | struct request_queue * | ||
| 571 | blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn, | ||
| 572 | spinlock_t *lock, int node_id) | ||
| 573 | { | ||
| 574 | if (!q) | 574 | if (!q) |
| 575 | return NULL; | 575 | return NULL; |
| 576 | 576 | ||
| 577 | q->node = node_id; | ||
| 578 | if (blk_init_free_list(q)) | 577 | if (blk_init_free_list(q)) |
| 579 | return NULL; | 578 | return NULL; |
| 580 | 579 | ||
| @@ -604,7 +603,7 @@ blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn, | |||
| 604 | 603 | ||
| 605 | return NULL; | 604 | return NULL; |
| 606 | } | 605 | } |
| 607 | EXPORT_SYMBOL(blk_init_allocated_queue_node); | 606 | EXPORT_SYMBOL(blk_init_allocated_queue); |
| 608 | 607 | ||
| 609 | int blk_get_queue(struct request_queue *q) | 608 | int blk_get_queue(struct request_queue *q) |
| 610 | { | 609 | { |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 16ace89613bc..4c12869fcf77 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
| @@ -3184,7 +3184,7 @@ static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc, | |||
| 3184 | } | 3184 | } |
| 3185 | } | 3185 | } |
| 3186 | 3186 | ||
| 3187 | if (ret) | 3187 | if (ret && ret != -EEXIST) |
| 3188 | printk(KERN_ERR "cfq: cic link failed!\n"); | 3188 | printk(KERN_ERR "cfq: cic link failed!\n"); |
| 3189 | 3189 | ||
| 3190 | return ret; | 3190 | return ret; |
| @@ -3200,6 +3200,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) | |||
| 3200 | { | 3200 | { |
| 3201 | struct io_context *ioc = NULL; | 3201 | struct io_context *ioc = NULL; |
| 3202 | struct cfq_io_context *cic; | 3202 | struct cfq_io_context *cic; |
| 3203 | int ret; | ||
| 3203 | 3204 | ||
| 3204 | might_sleep_if(gfp_mask & __GFP_WAIT); | 3205 | might_sleep_if(gfp_mask & __GFP_WAIT); |
| 3205 | 3206 | ||
| @@ -3207,6 +3208,7 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) | |||
| 3207 | if (!ioc) | 3208 | if (!ioc) |
| 3208 | return NULL; | 3209 | return NULL; |
| 3209 | 3210 | ||
| 3211 | retry: | ||
| 3210 | cic = cfq_cic_lookup(cfqd, ioc); | 3212 | cic = cfq_cic_lookup(cfqd, ioc); |
| 3211 | if (cic) | 3213 | if (cic) |
| 3212 | goto out; | 3214 | goto out; |
| @@ -3215,7 +3217,12 @@ cfq_get_io_context(struct cfq_data *cfqd, gfp_t gfp_mask) | |||
| 3215 | if (cic == NULL) | 3217 | if (cic == NULL) |
| 3216 | goto err; | 3218 | goto err; |
| 3217 | 3219 | ||
| 3218 | if (cfq_cic_link(cfqd, ioc, cic, gfp_mask)) | 3220 | ret = cfq_cic_link(cfqd, ioc, cic, gfp_mask); |
| 3221 | if (ret == -EEXIST) { | ||
| 3222 | /* someone has linked cic to ioc already */ | ||
| 3223 | cfq_cic_free(cic); | ||
| 3224 | goto retry; | ||
| 3225 | } else if (ret) | ||
| 3219 | goto err_free; | 3226 | goto err_free; |
| 3220 | 3227 | ||
| 3221 | out: | 3228 | out: |
| @@ -4036,6 +4043,11 @@ static void *cfq_init_queue(struct request_queue *q) | |||
| 4036 | 4043 | ||
| 4037 | if (blkio_alloc_blkg_stats(&cfqg->blkg)) { | 4044 | if (blkio_alloc_blkg_stats(&cfqg->blkg)) { |
| 4038 | kfree(cfqg); | 4045 | kfree(cfqg); |
| 4046 | |||
| 4047 | spin_lock(&cic_index_lock); | ||
| 4048 | ida_remove(&cic_index_ida, cfqd->cic_index); | ||
| 4049 | spin_unlock(&cic_index_lock); | ||
| 4050 | |||
| 4039 | kfree(cfqd); | 4051 | kfree(cfqd); |
| 4040 | return NULL; | 4052 | return NULL; |
| 4041 | } | 4053 | } |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 6bdedd7cca2c..cf047c406d92 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
| @@ -820,7 +820,7 @@ config PATA_PLATFORM | |||
| 820 | 820 | ||
| 821 | config PATA_OF_PLATFORM | 821 | config PATA_OF_PLATFORM |
| 822 | tristate "OpenFirmware platform device PATA support" | 822 | tristate "OpenFirmware platform device PATA support" |
| 823 | depends on PATA_PLATFORM && OF | 823 | depends on PATA_PLATFORM && OF && OF_IRQ |
| 824 | help | 824 | help |
| 825 | This option enables support for generic directly connected ATA | 825 | This option enables support for generic directly connected ATA |
| 826 | devices commonly found on embedded systems with OpenFirmware | 826 | devices commonly found on embedded systems with OpenFirmware |
diff --git a/drivers/base/core.c b/drivers/base/core.c index d8b3d89db043..919daa7cd5b1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -1743,8 +1743,10 @@ void device_shutdown(void) | |||
| 1743 | */ | 1743 | */ |
| 1744 | list_del_init(&dev->kobj.entry); | 1744 | list_del_init(&dev->kobj.entry); |
| 1745 | spin_unlock(&devices_kset->list_lock); | 1745 | spin_unlock(&devices_kset->list_lock); |
| 1746 | /* Disable all device's runtime power management */ | 1746 | |
| 1747 | pm_runtime_disable(dev); | 1747 | /* Don't allow any more runtime suspends */ |
| 1748 | pm_runtime_get_noresume(dev); | ||
| 1749 | pm_runtime_barrier(dev); | ||
| 1748 | 1750 | ||
| 1749 | if (dev->bus && dev->bus->shutdown) { | 1751 | if (dev->bus && dev->bus->shutdown) { |
| 1750 | dev_dbg(dev, "shutdown\n"); | 1752 | dev_dbg(dev, "shutdown\n"); |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 8004ac30a7a8..587cce57adae 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
| @@ -2601,6 +2601,8 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff, | |||
| 2601 | c->Request.Timeout = 0; | 2601 | c->Request.Timeout = 0; |
| 2602 | c->Request.CDB[0] = BMIC_WRITE; | 2602 | c->Request.CDB[0] = BMIC_WRITE; |
| 2603 | c->Request.CDB[6] = BMIC_CACHE_FLUSH; | 2603 | c->Request.CDB[6] = BMIC_CACHE_FLUSH; |
| 2604 | c->Request.CDB[7] = (size >> 8) & 0xFF; | ||
| 2605 | c->Request.CDB[8] = size & 0xFF; | ||
| 2604 | break; | 2606 | break; |
| 2605 | case TEST_UNIT_READY: | 2607 | case TEST_UNIT_READY: |
| 2606 | c->Request.CDBLen = 6; | 2608 | c->Request.CDBLen = 6; |
| @@ -4880,7 +4882,7 @@ static int cciss_request_irq(ctlr_info_t *h, | |||
| 4880 | { | 4882 | { |
| 4881 | if (h->msix_vector || h->msi_vector) { | 4883 | if (h->msix_vector || h->msi_vector) { |
| 4882 | if (!request_irq(h->intr[h->intr_mode], msixhandler, | 4884 | if (!request_irq(h->intr[h->intr_mode], msixhandler, |
| 4883 | IRQF_DISABLED, h->devname, h)) | 4885 | 0, h->devname, h)) |
| 4884 | return 0; | 4886 | return 0; |
| 4885 | dev_err(&h->pdev->dev, "Unable to get msi irq %d" | 4887 | dev_err(&h->pdev->dev, "Unable to get msi irq %d" |
| 4886 | " for %s\n", h->intr[h->intr_mode], | 4888 | " for %s\n", h->intr[h->intr_mode], |
| @@ -4889,7 +4891,7 @@ static int cciss_request_irq(ctlr_info_t *h, | |||
| 4889 | } | 4891 | } |
| 4890 | 4892 | ||
| 4891 | if (!request_irq(h->intr[h->intr_mode], intxhandler, | 4893 | if (!request_irq(h->intr[h->intr_mode], intxhandler, |
| 4892 | IRQF_DISABLED, h->devname, h)) | 4894 | IRQF_SHARED, h->devname, h)) |
| 4893 | return 0; | 4895 | return 0; |
| 4894 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", | 4896 | dev_err(&h->pdev->dev, "Unable to get irq %d for %s\n", |
| 4895 | h->intr[h->intr_mode], h->devname); | 4897 | h->intr[h->intr_mode], h->devname); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 68b205a9338f..1e888c9e85b3 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
| @@ -422,7 +422,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio) | |||
| 422 | 422 | ||
| 423 | /* | 423 | /* |
| 424 | * We use punch hole to reclaim the free space used by the | 424 | * We use punch hole to reclaim the free space used by the |
| 425 | * image a.k.a. discard. However we do support discard if | 425 | * image a.k.a. discard. However we do not support discard if |
| 426 | * encryption is enabled, because it may give an attacker | 426 | * encryption is enabled, because it may give an attacker |
| 427 | * useful information. | 427 | * useful information. |
| 428 | */ | 428 | */ |
| @@ -797,7 +797,7 @@ static void loop_config_discard(struct loop_device *lo) | |||
| 797 | } | 797 | } |
| 798 | 798 | ||
| 799 | q->limits.discard_granularity = inode->i_sb->s_blocksize; | 799 | q->limits.discard_granularity = inode->i_sb->s_blocksize; |
| 800 | q->limits.discard_alignment = inode->i_sb->s_blocksize; | 800 | q->limits.discard_alignment = 0; |
| 801 | q->limits.max_discard_sectors = UINT_MAX >> 9; | 801 | q->limits.max_discard_sectors = UINT_MAX >> 9; |
| 802 | q->limits.discard_zeroes_data = 1; | 802 | q->limits.discard_zeroes_data = 1; |
| 803 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); | 803 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 65cc424359b0..148ab944378d 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
| @@ -183,10 +183,6 @@ static LIST_HEAD(rbd_client_list); /* clients */ | |||
| 183 | 183 | ||
| 184 | static int __rbd_init_snaps_header(struct rbd_device *rbd_dev); | 184 | static int __rbd_init_snaps_header(struct rbd_device *rbd_dev); |
| 185 | static void rbd_dev_release(struct device *dev); | 185 | static void rbd_dev_release(struct device *dev); |
| 186 | static ssize_t rbd_snap_rollback(struct device *dev, | ||
| 187 | struct device_attribute *attr, | ||
| 188 | const char *buf, | ||
| 189 | size_t size); | ||
| 190 | static ssize_t rbd_snap_add(struct device *dev, | 186 | static ssize_t rbd_snap_add(struct device *dev, |
| 191 | struct device_attribute *attr, | 187 | struct device_attribute *attr, |
| 192 | const char *buf, | 188 | const char *buf, |
| @@ -461,6 +457,10 @@ static int rbd_header_from_disk(struct rbd_image_header *header, | |||
| 461 | u32 snap_count = le32_to_cpu(ondisk->snap_count); | 457 | u32 snap_count = le32_to_cpu(ondisk->snap_count); |
| 462 | int ret = -ENOMEM; | 458 | int ret = -ENOMEM; |
| 463 | 459 | ||
| 460 | if (memcmp(ondisk, RBD_HEADER_TEXT, sizeof(RBD_HEADER_TEXT))) { | ||
| 461 | return -ENXIO; | ||
| 462 | } | ||
| 463 | |||
| 464 | init_rwsem(&header->snap_rwsem); | 464 | init_rwsem(&header->snap_rwsem); |
| 465 | header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); | 465 | header->snap_names_len = le64_to_cpu(ondisk->snap_names_len); |
| 466 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + | 466 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + |
| @@ -1356,32 +1356,6 @@ fail: | |||
| 1356 | } | 1356 | } |
| 1357 | 1357 | ||
| 1358 | /* | 1358 | /* |
| 1359 | * Request sync osd rollback | ||
| 1360 | */ | ||
| 1361 | static int rbd_req_sync_rollback_obj(struct rbd_device *dev, | ||
| 1362 | u64 snapid, | ||
| 1363 | const char *obj) | ||
| 1364 | { | ||
| 1365 | struct ceph_osd_req_op *ops; | ||
| 1366 | int ret = rbd_create_rw_ops(&ops, 1, CEPH_OSD_OP_ROLLBACK, 0); | ||
| 1367 | if (ret < 0) | ||
| 1368 | return ret; | ||
| 1369 | |||
| 1370 | ops[0].snap.snapid = snapid; | ||
| 1371 | |||
| 1372 | ret = rbd_req_sync_op(dev, NULL, | ||
| 1373 | CEPH_NOSNAP, | ||
| 1374 | 0, | ||
| 1375 | CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, | ||
| 1376 | ops, | ||
| 1377 | 1, obj, 0, 0, NULL, NULL, NULL); | ||
| 1378 | |||
| 1379 | rbd_destroy_ops(ops); | ||
| 1380 | |||
| 1381 | return ret; | ||
| 1382 | } | ||
| 1383 | |||
| 1384 | /* | ||
| 1385 | * Request sync osd read | 1359 | * Request sync osd read |
| 1386 | */ | 1360 | */ |
| 1387 | static int rbd_req_sync_exec(struct rbd_device *dev, | 1361 | static int rbd_req_sync_exec(struct rbd_device *dev, |
| @@ -1610,8 +1584,13 @@ static int rbd_read_header(struct rbd_device *rbd_dev, | |||
| 1610 | goto out_dh; | 1584 | goto out_dh; |
| 1611 | 1585 | ||
| 1612 | rc = rbd_header_from_disk(header, dh, snap_count, GFP_KERNEL); | 1586 | rc = rbd_header_from_disk(header, dh, snap_count, GFP_KERNEL); |
| 1613 | if (rc < 0) | 1587 | if (rc < 0) { |
| 1588 | if (rc == -ENXIO) { | ||
| 1589 | pr_warning("unrecognized header format" | ||
| 1590 | " for image %s", rbd_dev->obj); | ||
| 1591 | } | ||
| 1614 | goto out_dh; | 1592 | goto out_dh; |
| 1593 | } | ||
| 1615 | 1594 | ||
| 1616 | if (snap_count != header->total_snaps) { | 1595 | if (snap_count != header->total_snaps) { |
| 1617 | snap_count = header->total_snaps; | 1596 | snap_count = header->total_snaps; |
| @@ -1882,7 +1861,6 @@ static DEVICE_ATTR(name, S_IRUGO, rbd_name_show, NULL); | |||
| 1882 | static DEVICE_ATTR(refresh, S_IWUSR, NULL, rbd_image_refresh); | 1861 | static DEVICE_ATTR(refresh, S_IWUSR, NULL, rbd_image_refresh); |
| 1883 | static DEVICE_ATTR(current_snap, S_IRUGO, rbd_snap_show, NULL); | 1862 | static DEVICE_ATTR(current_snap, S_IRUGO, rbd_snap_show, NULL); |
| 1884 | static DEVICE_ATTR(create_snap, S_IWUSR, NULL, rbd_snap_add); | 1863 | static DEVICE_ATTR(create_snap, S_IWUSR, NULL, rbd_snap_add); |
| 1885 | static DEVICE_ATTR(rollback_snap, S_IWUSR, NULL, rbd_snap_rollback); | ||
| 1886 | 1864 | ||
| 1887 | static struct attribute *rbd_attrs[] = { | 1865 | static struct attribute *rbd_attrs[] = { |
| 1888 | &dev_attr_size.attr, | 1866 | &dev_attr_size.attr, |
| @@ -1893,7 +1871,6 @@ static struct attribute *rbd_attrs[] = { | |||
| 1893 | &dev_attr_current_snap.attr, | 1871 | &dev_attr_current_snap.attr, |
| 1894 | &dev_attr_refresh.attr, | 1872 | &dev_attr_refresh.attr, |
| 1895 | &dev_attr_create_snap.attr, | 1873 | &dev_attr_create_snap.attr, |
| 1896 | &dev_attr_rollback_snap.attr, | ||
| 1897 | NULL | 1874 | NULL |
| 1898 | }; | 1875 | }; |
| 1899 | 1876 | ||
| @@ -2424,64 +2401,6 @@ err_unlock: | |||
| 2424 | return ret; | 2401 | return ret; |
| 2425 | } | 2402 | } |
| 2426 | 2403 | ||
| 2427 | static ssize_t rbd_snap_rollback(struct device *dev, | ||
| 2428 | struct device_attribute *attr, | ||
| 2429 | const char *buf, | ||
| 2430 | size_t count) | ||
| 2431 | { | ||
| 2432 | struct rbd_device *rbd_dev = dev_to_rbd(dev); | ||
| 2433 | int ret; | ||
| 2434 | u64 snapid; | ||
| 2435 | u64 cur_ofs; | ||
| 2436 | char *seg_name = NULL; | ||
| 2437 | char *snap_name = kmalloc(count + 1, GFP_KERNEL); | ||
| 2438 | ret = -ENOMEM; | ||
| 2439 | if (!snap_name) | ||
| 2440 | return ret; | ||
| 2441 | |||
| 2442 | /* parse snaps add command */ | ||
| 2443 | snprintf(snap_name, count, "%s", buf); | ||
| 2444 | seg_name = kmalloc(RBD_MAX_SEG_NAME_LEN + 1, GFP_NOIO); | ||
| 2445 | if (!seg_name) | ||
| 2446 | goto done; | ||
| 2447 | |||
| 2448 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
| 2449 | |||
| 2450 | ret = snap_by_name(&rbd_dev->header, snap_name, &snapid, NULL); | ||
| 2451 | if (ret < 0) | ||
| 2452 | goto done_unlock; | ||
| 2453 | |||
| 2454 | dout("snapid=%lld\n", snapid); | ||
| 2455 | |||
| 2456 | cur_ofs = 0; | ||
| 2457 | while (cur_ofs < rbd_dev->header.image_size) { | ||
| 2458 | cur_ofs += rbd_get_segment(&rbd_dev->header, | ||
| 2459 | rbd_dev->obj, | ||
| 2460 | cur_ofs, (u64)-1, | ||
| 2461 | seg_name, NULL); | ||
| 2462 | dout("seg_name=%s\n", seg_name); | ||
| 2463 | |||
| 2464 | ret = rbd_req_sync_rollback_obj(rbd_dev, snapid, seg_name); | ||
| 2465 | if (ret < 0) | ||
| 2466 | pr_warning("could not roll back obj %s err=%d\n", | ||
| 2467 | seg_name, ret); | ||
| 2468 | } | ||
| 2469 | |||
| 2470 | ret = __rbd_update_snaps(rbd_dev); | ||
| 2471 | if (ret < 0) | ||
| 2472 | goto done_unlock; | ||
| 2473 | |||
| 2474 | ret = count; | ||
| 2475 | |||
| 2476 | done_unlock: | ||
| 2477 | mutex_unlock(&ctl_mutex); | ||
| 2478 | done: | ||
| 2479 | kfree(seg_name); | ||
| 2480 | kfree(snap_name); | ||
| 2481 | |||
| 2482 | return ret; | ||
| 2483 | } | ||
| 2484 | |||
| 2485 | static struct bus_attribute rbd_bus_attrs[] = { | 2404 | static struct bus_attribute rbd_bus_attrs[] = { |
| 2486 | __ATTR(add, S_IWUSR, NULL, rbd_add), | 2405 | __ATTR(add, S_IWUSR, NULL, rbd_add), |
| 2487 | __ATTR(remove, S_IWUSR, NULL, rbd_remove), | 2406 | __ATTR(remove, S_IWUSR, NULL, rbd_remove), |
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index ae3e167e17ad..89ddab127e33 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | * handle GCR disks | 16 | * handle GCR disks |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #undef DEBUG | ||
| 20 | |||
| 19 | #include <linux/stddef.h> | 21 | #include <linux/stddef.h> |
| 20 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
| 21 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
| @@ -36,13 +38,11 @@ | |||
| 36 | #include <asm/machdep.h> | 38 | #include <asm/machdep.h> |
| 37 | #include <asm/pmac_feature.h> | 39 | #include <asm/pmac_feature.h> |
| 38 | 40 | ||
| 39 | static DEFINE_MUTEX(swim3_mutex); | ||
| 40 | static struct request_queue *swim3_queue; | ||
| 41 | static struct gendisk *disks[2]; | ||
| 42 | static struct request *fd_req; | ||
| 43 | |||
| 44 | #define MAX_FLOPPIES 2 | 41 | #define MAX_FLOPPIES 2 |
| 45 | 42 | ||
| 43 | static DEFINE_MUTEX(swim3_mutex); | ||
| 44 | static struct gendisk *disks[MAX_FLOPPIES]; | ||
| 45 | |||
| 46 | enum swim_state { | 46 | enum swim_state { |
| 47 | idle, | 47 | idle, |
| 48 | locating, | 48 | locating, |
| @@ -177,7 +177,6 @@ struct swim3 { | |||
| 177 | 177 | ||
| 178 | struct floppy_state { | 178 | struct floppy_state { |
| 179 | enum swim_state state; | 179 | enum swim_state state; |
| 180 | spinlock_t lock; | ||
| 181 | struct swim3 __iomem *swim3; /* hardware registers */ | 180 | struct swim3 __iomem *swim3; /* hardware registers */ |
| 182 | struct dbdma_regs __iomem *dma; /* DMA controller registers */ | 181 | struct dbdma_regs __iomem *dma; /* DMA controller registers */ |
| 183 | int swim3_intr; /* interrupt number for SWIM3 */ | 182 | int swim3_intr; /* interrupt number for SWIM3 */ |
| @@ -204,8 +203,20 @@ struct floppy_state { | |||
| 204 | int wanted; | 203 | int wanted; |
| 205 | struct macio_dev *mdev; | 204 | struct macio_dev *mdev; |
| 206 | char dbdma_cmd_space[5 * sizeof(struct dbdma_cmd)]; | 205 | char dbdma_cmd_space[5 * sizeof(struct dbdma_cmd)]; |
| 206 | int index; | ||
| 207 | struct request *cur_req; | ||
| 207 | }; | 208 | }; |
| 208 | 209 | ||
| 210 | #define swim3_err(fmt, arg...) dev_err(&fs->mdev->ofdev.dev, "[fd%d] " fmt, fs->index, arg) | ||
| 211 | #define swim3_warn(fmt, arg...) dev_warn(&fs->mdev->ofdev.dev, "[fd%d] " fmt, fs->index, arg) | ||
| 212 | #define swim3_info(fmt, arg...) dev_info(&fs->mdev->ofdev.dev, "[fd%d] " fmt, fs->index, arg) | ||
| 213 | |||
| 214 | #ifdef DEBUG | ||
| 215 | #define swim3_dbg(fmt, arg...) dev_dbg(&fs->mdev->ofdev.dev, "[fd%d] " fmt, fs->index, arg) | ||
| 216 | #else | ||
| 217 | #define swim3_dbg(fmt, arg...) do { } while(0) | ||
| 218 | #endif | ||
| 219 | |||
| 209 | static struct floppy_state floppy_states[MAX_FLOPPIES]; | 220 | static struct floppy_state floppy_states[MAX_FLOPPIES]; |
| 210 | static int floppy_count = 0; | 221 | static int floppy_count = 0; |
| 211 | static DEFINE_SPINLOCK(swim3_lock); | 222 | static DEFINE_SPINLOCK(swim3_lock); |
| @@ -224,17 +235,8 @@ static unsigned short write_postamble[] = { | |||
| 224 | 0, 0, 0, 0, 0, 0 | 235 | 0, 0, 0, 0, 0, 0 |
| 225 | }; | 236 | }; |
| 226 | 237 | ||
| 227 | static void swim3_select(struct floppy_state *fs, int sel); | ||
| 228 | static void swim3_action(struct floppy_state *fs, int action); | ||
| 229 | static int swim3_readbit(struct floppy_state *fs, int bit); | ||
| 230 | static void do_fd_request(struct request_queue * q); | ||
| 231 | static void start_request(struct floppy_state *fs); | ||
| 232 | static void set_timeout(struct floppy_state *fs, int nticks, | ||
| 233 | void (*proc)(unsigned long)); | ||
| 234 | static void scan_track(struct floppy_state *fs); | ||
| 235 | static void seek_track(struct floppy_state *fs, int n); | 238 | static void seek_track(struct floppy_state *fs, int n); |
| 236 | static void init_dma(struct dbdma_cmd *cp, int cmd, void *buf, int count); | 239 | static void init_dma(struct dbdma_cmd *cp, int cmd, void *buf, int count); |
| 237 | static void setup_transfer(struct floppy_state *fs); | ||
| 238 | static void act(struct floppy_state *fs); | 240 | static void act(struct floppy_state *fs); |
| 239 | static void scan_timeout(unsigned long data); | 241 | static void scan_timeout(unsigned long data); |
| 240 | static void seek_timeout(unsigned long data); | 242 | static void seek_timeout(unsigned long data); |
| @@ -254,18 +256,21 @@ static unsigned int floppy_check_events(struct gendisk *disk, | |||
| 254 | unsigned int clearing); | 256 | unsigned int clearing); |
| 255 | static int floppy_revalidate(struct gendisk *disk); | 257 | static int floppy_revalidate(struct gendisk *disk); |
| 256 | 258 | ||
| 257 | static bool swim3_end_request(int err, unsigned int nr_bytes) | 259 | static bool swim3_end_request(struct floppy_state *fs, int err, unsigned int nr_bytes) |
| 258 | { | 260 | { |
| 259 | if (__blk_end_request(fd_req, err, nr_bytes)) | 261 | struct request *req = fs->cur_req; |
| 260 | return true; | 262 | int rc; |
| 261 | 263 | ||
| 262 | fd_req = NULL; | 264 | swim3_dbg(" end request, err=%d nr_bytes=%d, cur_req=%p\n", |
| 263 | return false; | 265 | err, nr_bytes, req); |
| 264 | } | ||
| 265 | 266 | ||
| 266 | static bool swim3_end_request_cur(int err) | 267 | if (err) |
| 267 | { | 268 | nr_bytes = blk_rq_cur_bytes(req); |
| 268 | return swim3_end_request(err, blk_rq_cur_bytes(fd_req)); | 269 | rc = __blk_end_request(req, err, nr_bytes); |
| 270 | if (rc) | ||
| 271 | return true; | ||
| 272 | fs->cur_req = NULL; | ||
| 273 | return false; | ||
| 269 | } | 274 | } |
| 270 | 275 | ||
| 271 | static void swim3_select(struct floppy_state *fs, int sel) | 276 | static void swim3_select(struct floppy_state *fs, int sel) |
| @@ -303,50 +308,53 @@ static int swim3_readbit(struct floppy_state *fs, int bit) | |||
| 303 | return (stat & DATA) == 0; | 308 | return (stat & DATA) == 0; |
| 304 | } | 309 | } |
| 305 | 310 | ||
| 306 | static void do_fd_request(struct request_queue * q) | ||
| 307 | { | ||
| 308 | int i; | ||
| 309 | |||
| 310 | for(i=0; i<floppy_count; i++) { | ||
| 311 | struct floppy_state *fs = &floppy_states[i]; | ||
| 312 | if (fs->mdev->media_bay && | ||
| 313 | check_media_bay(fs->mdev->media_bay) != MB_FD) | ||
| 314 | continue; | ||
| 315 | start_request(fs); | ||
| 316 | } | ||
| 317 | } | ||
| 318 | |||
| 319 | static void start_request(struct floppy_state *fs) | 311 | static void start_request(struct floppy_state *fs) |
| 320 | { | 312 | { |
| 321 | struct request *req; | 313 | struct request *req; |
| 322 | unsigned long x; | 314 | unsigned long x; |
| 323 | 315 | ||
| 316 | swim3_dbg("start request, initial state=%d\n", fs->state); | ||
| 317 | |||
| 324 | if (fs->state == idle && fs->wanted) { | 318 | if (fs->state == idle && fs->wanted) { |
| 325 | fs->state = available; | 319 | fs->state = available; |
| 326 | wake_up(&fs->wait); | 320 | wake_up(&fs->wait); |
| 327 | return; | 321 | return; |
| 328 | } | 322 | } |
| 329 | while (fs->state == idle) { | 323 | while (fs->state == idle) { |
| 330 | if (!fd_req) { | 324 | swim3_dbg("start request, idle loop, cur_req=%p\n", fs->cur_req); |
| 331 | fd_req = blk_fetch_request(swim3_queue); | 325 | if (!fs->cur_req) { |
| 332 | if (!fd_req) | 326 | fs->cur_req = blk_fetch_request(disks[fs->index]->queue); |
| 327 | swim3_dbg(" fetched request %p\n", fs->cur_req); | ||
| 328 | if (!fs->cur_req) | ||
| 333 | break; | 329 | break; |
| 334 | } | 330 | } |
| 335 | req = fd_req; | 331 | req = fs->cur_req; |
| 336 | #if 0 | 332 | |
| 337 | printk("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n", | 333 | if (fs->mdev->media_bay && |
| 338 | req->rq_disk->disk_name, req->cmd, | 334 | check_media_bay(fs->mdev->media_bay) != MB_FD) { |
| 339 | (long)blk_rq_pos(req), blk_rq_sectors(req), req->buffer); | 335 | swim3_dbg("%s", " media bay absent, dropping req\n"); |
| 340 | printk(" errors=%d current_nr_sectors=%u\n", | 336 | swim3_end_request(fs, -ENODEV, 0); |
| 341 | req->errors, blk_rq_cur_sectors(req)); | 337 | continue; |
| 338 | } | ||
| 339 | |||
| 340 | #if 0 /* This is really too verbose */ | ||
| 341 | swim3_dbg("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n", | ||
| 342 | req->rq_disk->disk_name, req->cmd, | ||
| 343 | (long)blk_rq_pos(req), blk_rq_sectors(req), | ||
| 344 | req->buffer); | ||
| 345 | swim3_dbg(" errors=%d current_nr_sectors=%u\n", | ||
| 346 | req->errors, blk_rq_cur_sectors(req)); | ||
| 342 | #endif | 347 | #endif |
| 343 | 348 | ||
| 344 | if (blk_rq_pos(req) >= fs->total_secs) { | 349 | if (blk_rq_pos(req) >= fs->total_secs) { |
| 345 | swim3_end_request_cur(-EIO); | 350 | swim3_dbg(" pos out of bounds (%ld, max is %ld)\n", |
| 351 | (long)blk_rq_pos(req), (long)fs->total_secs); | ||
| 352 | swim3_end_request(fs, -EIO, 0); | ||
| 346 | continue; | 353 | continue; |
| 347 | } | 354 | } |
| 348 | if (fs->ejected) { | 355 | if (fs->ejected) { |
| 349 | swim3_end_request_cur(-EIO); | 356 | swim3_dbg("%s", " disk ejected\n"); |
| 357 | swim3_end_request(fs, -EIO, 0); | ||
| 350 | continue; | 358 | continue; |
| 351 | } | 359 | } |
| 352 | 360 | ||
| @@ -354,7 +362,8 @@ static void start_request(struct floppy_state *fs) | |||
| 354 | if (fs->write_prot < 0) | 362 | if (fs->write_prot < 0) |
| 355 | fs->write_prot = swim3_readbit(fs, WRITE_PROT); | 363 | fs->write_prot = swim3_readbit(fs, WRITE_PROT); |
| 356 | if (fs->write_prot) { | 364 | if (fs->write_prot) { |
| 357 | swim3_end_request_cur(-EIO); | 365 | swim3_dbg("%s", " try to write, disk write protected\n"); |
| 366 | swim3_end_request(fs, -EIO, 0); | ||
| 358 | continue; | 367 | continue; |
| 359 | } | 368 | } |
| 360 | } | 369 | } |
| @@ -369,7 +378,6 @@ static void start_request(struct floppy_state *fs) | |||
| 369 | x = ((long)blk_rq_pos(req)) % fs->secpercyl; | 378 | x = ((long)blk_rq_pos(req)) % fs->secpercyl; |
| 370 | fs->head = x / fs->secpertrack; | 379 | fs->head = x / fs->secpertrack; |
| 371 | fs->req_sector = x % fs->secpertrack + 1; | 380 | fs->req_sector = x % fs->secpertrack + 1; |
| 372 | fd_req = req; | ||
| 373 | fs->state = do_transfer; | 381 | fs->state = do_transfer; |
| 374 | fs->retries = 0; | 382 | fs->retries = 0; |
| 375 | 383 | ||
| @@ -377,12 +385,14 @@ static void start_request(struct floppy_state *fs) | |||
| 377 | } | 385 | } |
| 378 | } | 386 | } |
| 379 | 387 | ||
| 388 | static void do_fd_request(struct request_queue * q) | ||
| 389 | { | ||
| 390 | start_request(q->queuedata); | ||
| 391 | } | ||
| 392 | |||
| 380 | static void set_timeout(struct floppy_state *fs, int nticks, | 393 | static void set_timeout(struct floppy_state *fs, int nticks, |
| 381 | void (*proc)(unsigned long)) | 394 | void (*proc)(unsigned long)) |
| 382 | { | 395 | { |
| 383 | unsigned long flags; | ||
| 384 | |||
| 385 | spin_lock_irqsave(&fs->lock, flags); | ||
| 386 | if (fs->timeout_pending) | 396 | if (fs->timeout_pending) |
| 387 | del_timer(&fs->timeout); | 397 | del_timer(&fs->timeout); |
| 388 | fs->timeout.expires = jiffies + nticks; | 398 | fs->timeout.expires = jiffies + nticks; |
| @@ -390,7 +400,6 @@ static void set_timeout(struct floppy_state *fs, int nticks, | |||
| 390 | fs->timeout.data = (unsigned long) fs; | 400 | fs->timeout.data = (unsigned long) fs; |
| 391 | add_timer(&fs->timeout); | 401 | add_timer(&fs->timeout); |
| 392 | fs->timeout_pending = 1; | 402 | fs->timeout_pending = 1; |
| 393 | spin_unlock_irqrestore(&fs->lock, flags); | ||
| 394 | } | 403 | } |
| 395 | 404 | ||
| 396 | static inline void scan_track(struct floppy_state *fs) | 405 | static inline void scan_track(struct floppy_state *fs) |
| @@ -442,40 +451,45 @@ static inline void setup_transfer(struct floppy_state *fs) | |||
| 442 | struct swim3 __iomem *sw = fs->swim3; | 451 | struct swim3 __iomem *sw = fs->swim3; |
| 443 | struct dbdma_cmd *cp = fs->dma_cmd; | 452 | struct dbdma_cmd *cp = fs->dma_cmd; |
| 444 | struct dbdma_regs __iomem *dr = fs->dma; | 453 | struct dbdma_regs __iomem *dr = fs->dma; |
| 454 | struct request *req = fs->cur_req; | ||
| 445 | 455 | ||
| 446 | if (blk_rq_cur_sectors(fd_req) <= 0) { | 456 | if (blk_rq_cur_sectors(req) <= 0) { |
| 447 | printk(KERN_ERR "swim3: transfer 0 sectors?\n"); | 457 | swim3_warn("%s", "Transfer 0 sectors ?\n"); |
| 448 | return; | 458 | return; |
| 449 | } | 459 | } |
| 450 | if (rq_data_dir(fd_req) == WRITE) | 460 | if (rq_data_dir(req) == WRITE) |
| 451 | n = 1; | 461 | n = 1; |
| 452 | else { | 462 | else { |
| 453 | n = fs->secpertrack - fs->req_sector + 1; | 463 | n = fs->secpertrack - fs->req_sector + 1; |
| 454 | if (n > blk_rq_cur_sectors(fd_req)) | 464 | if (n > blk_rq_cur_sectors(req)) |
| 455 | n = blk_rq_cur_sectors(fd_req); | 465 | n = blk_rq_cur_sectors(req); |
| 456 | } | 466 | } |
| 467 | |||
| 468 | swim3_dbg(" setup xfer at sect %d (of %d) head %d for %d\n", | ||
| 469 | fs->req_sector, fs->secpertrack, fs->head, n); | ||
| 470 | |||
| 457 | fs->scount = n; | 471 | fs->scount = n; |
| 458 | swim3_select(fs, fs->head? READ_DATA_1: READ_DATA_0); | 472 | swim3_select(fs, fs->head? READ_DATA_1: READ_DATA_0); |
| 459 | out_8(&sw->sector, fs->req_sector); | 473 | out_8(&sw->sector, fs->req_sector); |
| 460 | out_8(&sw->nsect, n); | 474 | out_8(&sw->nsect, n); |
| 461 | out_8(&sw->gap3, 0); | 475 | out_8(&sw->gap3, 0); |
| 462 | out_le32(&dr->cmdptr, virt_to_bus(cp)); | 476 | out_le32(&dr->cmdptr, virt_to_bus(cp)); |
| 463 | if (rq_data_dir(fd_req) == WRITE) { | 477 | if (rq_data_dir(req) == WRITE) { |
| 464 | /* Set up 3 dma commands: write preamble, data, postamble */ | 478 | /* Set up 3 dma commands: write preamble, data, postamble */ |
| 465 | init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble)); | 479 | init_dma(cp, OUTPUT_MORE, write_preamble, sizeof(write_preamble)); |
| 466 | ++cp; | 480 | ++cp; |
| 467 | init_dma(cp, OUTPUT_MORE, fd_req->buffer, 512); | 481 | init_dma(cp, OUTPUT_MORE, req->buffer, 512); |
| 468 | ++cp; | 482 | ++cp; |
| 469 | init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble)); | 483 | init_dma(cp, OUTPUT_LAST, write_postamble, sizeof(write_postamble)); |
| 470 | } else { | 484 | } else { |
| 471 | init_dma(cp, INPUT_LAST, fd_req->buffer, n * 512); | 485 | init_dma(cp, INPUT_LAST, req->buffer, n * 512); |
| 472 | } | 486 | } |
| 473 | ++cp; | 487 | ++cp; |
| 474 | out_le16(&cp->command, DBDMA_STOP); | 488 | out_le16(&cp->command, DBDMA_STOP); |
| 475 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); | 489 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); |
| 476 | in_8(&sw->error); | 490 | in_8(&sw->error); |
| 477 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); | 491 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); |
| 478 | if (rq_data_dir(fd_req) == WRITE) | 492 | if (rq_data_dir(req) == WRITE) |
| 479 | out_8(&sw->control_bis, WRITE_SECTORS); | 493 | out_8(&sw->control_bis, WRITE_SECTORS); |
| 480 | in_8(&sw->intr); | 494 | in_8(&sw->intr); |
| 481 | out_le32(&dr->control, (RUN << 16) | RUN); | 495 | out_le32(&dr->control, (RUN << 16) | RUN); |
| @@ -488,12 +502,16 @@ static inline void setup_transfer(struct floppy_state *fs) | |||
| 488 | static void act(struct floppy_state *fs) | 502 | static void act(struct floppy_state *fs) |
| 489 | { | 503 | { |
| 490 | for (;;) { | 504 | for (;;) { |
| 505 | swim3_dbg(" act loop, state=%d, req_cyl=%d, cur_cyl=%d\n", | ||
| 506 | fs->state, fs->req_cyl, fs->cur_cyl); | ||
| 507 | |||
| 491 | switch (fs->state) { | 508 | switch (fs->state) { |
| 492 | case idle: | 509 | case idle: |
| 493 | return; /* XXX shouldn't get here */ | 510 | return; /* XXX shouldn't get here */ |
| 494 | 511 | ||
| 495 | case locating: | 512 | case locating: |
| 496 | if (swim3_readbit(fs, TRACK_ZERO)) { | 513 | if (swim3_readbit(fs, TRACK_ZERO)) { |
| 514 | swim3_dbg("%s", " locate track 0\n"); | ||
| 497 | fs->cur_cyl = 0; | 515 | fs->cur_cyl = 0; |
| 498 | if (fs->req_cyl == 0) | 516 | if (fs->req_cyl == 0) |
| 499 | fs->state = do_transfer; | 517 | fs->state = do_transfer; |
| @@ -511,7 +529,7 @@ static void act(struct floppy_state *fs) | |||
| 511 | break; | 529 | break; |
| 512 | } | 530 | } |
| 513 | if (fs->req_cyl == fs->cur_cyl) { | 531 | if (fs->req_cyl == fs->cur_cyl) { |
| 514 | printk("whoops, seeking 0\n"); | 532 | swim3_warn("%s", "Whoops, seeking 0\n"); |
| 515 | fs->state = do_transfer; | 533 | fs->state = do_transfer; |
| 516 | break; | 534 | break; |
| 517 | } | 535 | } |
| @@ -527,7 +545,9 @@ static void act(struct floppy_state *fs) | |||
| 527 | case do_transfer: | 545 | case do_transfer: |
| 528 | if (fs->cur_cyl != fs->req_cyl) { | 546 | if (fs->cur_cyl != fs->req_cyl) { |
| 529 | if (fs->retries > 5) { | 547 | if (fs->retries > 5) { |
| 530 | swim3_end_request_cur(-EIO); | 548 | swim3_err("Wrong cylinder in transfer, want: %d got %d\n", |
| 549 | fs->req_cyl, fs->cur_cyl); | ||
| 550 | swim3_end_request(fs, -EIO, 0); | ||
| 531 | fs->state = idle; | 551 | fs->state = idle; |
| 532 | return; | 552 | return; |
| 533 | } | 553 | } |
| @@ -542,7 +562,7 @@ static void act(struct floppy_state *fs) | |||
| 542 | return; | 562 | return; |
| 543 | 563 | ||
| 544 | default: | 564 | default: |
| 545 | printk(KERN_ERR"swim3: unknown state %d\n", fs->state); | 565 | swim3_err("Unknown state %d\n", fs->state); |
| 546 | return; | 566 | return; |
| 547 | } | 567 | } |
| 548 | } | 568 | } |
| @@ -552,59 +572,75 @@ static void scan_timeout(unsigned long data) | |||
| 552 | { | 572 | { |
| 553 | struct floppy_state *fs = (struct floppy_state *) data; | 573 | struct floppy_state *fs = (struct floppy_state *) data; |
| 554 | struct swim3 __iomem *sw = fs->swim3; | 574 | struct swim3 __iomem *sw = fs->swim3; |
| 575 | unsigned long flags; | ||
| 576 | |||
| 577 | swim3_dbg("* scan timeout, state=%d\n", fs->state); | ||
| 555 | 578 | ||
| 579 | spin_lock_irqsave(&swim3_lock, flags); | ||
| 556 | fs->timeout_pending = 0; | 580 | fs->timeout_pending = 0; |
| 557 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); | 581 | out_8(&sw->control_bic, DO_ACTION | WRITE_SECTORS); |
| 558 | out_8(&sw->select, RELAX); | 582 | out_8(&sw->select, RELAX); |
| 559 | out_8(&sw->intr_enable, 0); | 583 | out_8(&sw->intr_enable, 0); |
| 560 | fs->cur_cyl = -1; | 584 | fs->cur_cyl = -1; |
| 561 | if (fs->retries > 5) { | 585 | if (fs->retries > 5) { |
| 562 | swim3_end_request_cur(-EIO); | 586 | swim3_end_request(fs, -EIO, 0); |
| 563 | fs->state = idle; | 587 | fs->state = idle; |
| 564 | start_request(fs); | 588 | start_request(fs); |
| 565 | } else { | 589 | } else { |
| 566 | fs->state = jogging; | 590 | fs->state = jogging; |
| 567 | act(fs); | 591 | act(fs); |
| 568 | } | 592 | } |
| 593 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
| 569 | } | 594 | } |
| 570 | 595 | ||
| 571 | static void seek_timeout(unsigned long data) | 596 | static void seek_timeout(unsigned long data) |
| 572 | { | 597 | { |
| 573 | struct floppy_state *fs = (struct floppy_state *) data; | 598 | struct floppy_state *fs = (struct floppy_state *) data; |
| 574 | struct swim3 __iomem *sw = fs->swim3; | 599 | struct swim3 __iomem *sw = fs->swim3; |
| 600 | unsigned long flags; | ||
| 601 | |||
| 602 | swim3_dbg("* seek timeout, state=%d\n", fs->state); | ||
| 575 | 603 | ||
| 604 | spin_lock_irqsave(&swim3_lock, flags); | ||
| 576 | fs->timeout_pending = 0; | 605 | fs->timeout_pending = 0; |
| 577 | out_8(&sw->control_bic, DO_SEEK); | 606 | out_8(&sw->control_bic, DO_SEEK); |
| 578 | out_8(&sw->select, RELAX); | 607 | out_8(&sw->select, RELAX); |
| 579 | out_8(&sw->intr_enable, 0); | 608 | out_8(&sw->intr_enable, 0); |
| 580 | printk(KERN_ERR "swim3: seek timeout\n"); | 609 | swim3_err("%s", "Seek timeout\n"); |
| 581 | swim3_end_request_cur(-EIO); | 610 | swim3_end_request(fs, -EIO, 0); |
| 582 | fs->state = idle; | 611 | fs->state = idle; |
| 583 | start_request(fs); | 612 | start_request(fs); |
| 613 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
| 584 | } | 614 | } |
| 585 | 615 | ||
| 586 | static void settle_timeout(unsigned long data) | 616 | static void settle_timeout(unsigned long data) |
| 587 | { | 617 | { |
| 588 | struct floppy_state *fs = (struct floppy_state *) data; | 618 | struct floppy_state *fs = (struct floppy_state *) data; |
| 589 | struct swim3 __iomem *sw = fs->swim3; | 619 | struct swim3 __iomem *sw = fs->swim3; |
| 620 | unsigned long flags; | ||
| 621 | |||
| 622 | swim3_dbg("* settle timeout, state=%d\n", fs->state); | ||
| 590 | 623 | ||
| 624 | spin_lock_irqsave(&swim3_lock, flags); | ||
| 591 | fs->timeout_pending = 0; | 625 | fs->timeout_pending = 0; |
| 592 | if (swim3_readbit(fs, SEEK_COMPLETE)) { | 626 | if (swim3_readbit(fs, SEEK_COMPLETE)) { |
| 593 | out_8(&sw->select, RELAX); | 627 | out_8(&sw->select, RELAX); |
| 594 | fs->state = locating; | 628 | fs->state = locating; |
| 595 | act(fs); | 629 | act(fs); |
| 596 | return; | 630 | goto unlock; |
| 597 | } | 631 | } |
| 598 | out_8(&sw->select, RELAX); | 632 | out_8(&sw->select, RELAX); |
| 599 | if (fs->settle_time < 2*HZ) { | 633 | if (fs->settle_time < 2*HZ) { |
| 600 | ++fs->settle_time; | 634 | ++fs->settle_time; |
| 601 | set_timeout(fs, 1, settle_timeout); | 635 | set_timeout(fs, 1, settle_timeout); |
| 602 | return; | 636 | goto unlock; |
| 603 | } | 637 | } |
| 604 | printk(KERN_ERR "swim3: seek settle timeout\n"); | 638 | swim3_err("%s", "Seek settle timeout\n"); |
| 605 | swim3_end_request_cur(-EIO); | 639 | swim3_end_request(fs, -EIO, 0); |
| 606 | fs->state = idle; | 640 | fs->state = idle; |
| 607 | start_request(fs); | 641 | start_request(fs); |
| 642 | unlock: | ||
| 643 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
| 608 | } | 644 | } |
| 609 | 645 | ||
| 610 | static void xfer_timeout(unsigned long data) | 646 | static void xfer_timeout(unsigned long data) |
| @@ -612,8 +648,12 @@ static void xfer_timeout(unsigned long data) | |||
| 612 | struct floppy_state *fs = (struct floppy_state *) data; | 648 | struct floppy_state *fs = (struct floppy_state *) data; |
| 613 | struct swim3 __iomem *sw = fs->swim3; | 649 | struct swim3 __iomem *sw = fs->swim3; |
| 614 | struct dbdma_regs __iomem *dr = fs->dma; | 650 | struct dbdma_regs __iomem *dr = fs->dma; |
| 651 | unsigned long flags; | ||
| 615 | int n; | 652 | int n; |
| 616 | 653 | ||
| 654 | swim3_dbg("* xfer timeout, state=%d\n", fs->state); | ||
| 655 | |||
| 656 | spin_lock_irqsave(&swim3_lock, flags); | ||
| 617 | fs->timeout_pending = 0; | 657 | fs->timeout_pending = 0; |
| 618 | out_le32(&dr->control, RUN << 16); | 658 | out_le32(&dr->control, RUN << 16); |
| 619 | /* We must wait a bit for dbdma to stop */ | 659 | /* We must wait a bit for dbdma to stop */ |
| @@ -622,12 +662,13 @@ static void xfer_timeout(unsigned long data) | |||
| 622 | out_8(&sw->intr_enable, 0); | 662 | out_8(&sw->intr_enable, 0); |
| 623 | out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION); | 663 | out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION); |
| 624 | out_8(&sw->select, RELAX); | 664 | out_8(&sw->select, RELAX); |
| 625 | printk(KERN_ERR "swim3: timeout %sing sector %ld\n", | 665 | swim3_err("Timeout %sing sector %ld\n", |
| 626 | (rq_data_dir(fd_req)==WRITE? "writ": "read"), | 666 | (rq_data_dir(fs->cur_req)==WRITE? "writ": "read"), |
| 627 | (long)blk_rq_pos(fd_req)); | 667 | (long)blk_rq_pos(fs->cur_req)); |
| 628 | swim3_end_request_cur(-EIO); | 668 | swim3_end_request(fs, -EIO, 0); |
| 629 | fs->state = idle; | 669 | fs->state = idle; |
| 630 | start_request(fs); | 670 | start_request(fs); |
| 671 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
| 631 | } | 672 | } |
| 632 | 673 | ||
| 633 | static irqreturn_t swim3_interrupt(int irq, void *dev_id) | 674 | static irqreturn_t swim3_interrupt(int irq, void *dev_id) |
| @@ -638,12 +679,17 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
| 638 | int stat, resid; | 679 | int stat, resid; |
| 639 | struct dbdma_regs __iomem *dr; | 680 | struct dbdma_regs __iomem *dr; |
| 640 | struct dbdma_cmd *cp; | 681 | struct dbdma_cmd *cp; |
| 682 | unsigned long flags; | ||
| 683 | struct request *req = fs->cur_req; | ||
| 684 | |||
| 685 | swim3_dbg("* interrupt, state=%d\n", fs->state); | ||
| 641 | 686 | ||
| 687 | spin_lock_irqsave(&swim3_lock, flags); | ||
| 642 | intr = in_8(&sw->intr); | 688 | intr = in_8(&sw->intr); |
| 643 | err = (intr & ERROR_INTR)? in_8(&sw->error): 0; | 689 | err = (intr & ERROR_INTR)? in_8(&sw->error): 0; |
| 644 | if ((intr & ERROR_INTR) && fs->state != do_transfer) | 690 | if ((intr & ERROR_INTR) && fs->state != do_transfer) |
| 645 | printk(KERN_ERR "swim3_interrupt, state=%d, dir=%x, intr=%x, err=%x\n", | 691 | swim3_err("Non-transfer error interrupt: state=%d, dir=%x, intr=%x, err=%x\n", |
| 646 | fs->state, rq_data_dir(fd_req), intr, err); | 692 | fs->state, rq_data_dir(req), intr, err); |
| 647 | switch (fs->state) { | 693 | switch (fs->state) { |
| 648 | case locating: | 694 | case locating: |
| 649 | if (intr & SEEN_SECTOR) { | 695 | if (intr & SEEN_SECTOR) { |
| @@ -653,10 +699,10 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
| 653 | del_timer(&fs->timeout); | 699 | del_timer(&fs->timeout); |
| 654 | fs->timeout_pending = 0; | 700 | fs->timeout_pending = 0; |
| 655 | if (sw->ctrack == 0xff) { | 701 | if (sw->ctrack == 0xff) { |
| 656 | printk(KERN_ERR "swim3: seen sector but cyl=ff?\n"); | 702 | swim3_err("%s", "Seen sector but cyl=ff?\n"); |
| 657 | fs->cur_cyl = -1; | 703 | fs->cur_cyl = -1; |
| 658 | if (fs->retries > 5) { | 704 | if (fs->retries > 5) { |
| 659 | swim3_end_request_cur(-EIO); | 705 | swim3_end_request(fs, -EIO, 0); |
| 660 | fs->state = idle; | 706 | fs->state = idle; |
| 661 | start_request(fs); | 707 | start_request(fs); |
| 662 | } else { | 708 | } else { |
| @@ -668,8 +714,8 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
| 668 | fs->cur_cyl = sw->ctrack; | 714 | fs->cur_cyl = sw->ctrack; |
| 669 | fs->cur_sector = sw->csect; | 715 | fs->cur_sector = sw->csect; |
| 670 | if (fs->expect_cyl != -1 && fs->expect_cyl != fs->cur_cyl) | 716 | if (fs->expect_cyl != -1 && fs->expect_cyl != fs->cur_cyl) |
| 671 | printk(KERN_ERR "swim3: expected cyl %d, got %d\n", | 717 | swim3_err("Expected cyl %d, got %d\n", |
| 672 | fs->expect_cyl, fs->cur_cyl); | 718 | fs->expect_cyl, fs->cur_cyl); |
| 673 | fs->state = do_transfer; | 719 | fs->state = do_transfer; |
| 674 | act(fs); | 720 | act(fs); |
| 675 | } | 721 | } |
| @@ -704,7 +750,7 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
| 704 | fs->timeout_pending = 0; | 750 | fs->timeout_pending = 0; |
| 705 | dr = fs->dma; | 751 | dr = fs->dma; |
| 706 | cp = fs->dma_cmd; | 752 | cp = fs->dma_cmd; |
| 707 | if (rq_data_dir(fd_req) == WRITE) | 753 | if (rq_data_dir(req) == WRITE) |
| 708 | ++cp; | 754 | ++cp; |
| 709 | /* | 755 | /* |
| 710 | * Check that the main data transfer has finished. | 756 | * Check that the main data transfer has finished. |
| @@ -729,31 +775,32 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
| 729 | if (intr & ERROR_INTR) { | 775 | if (intr & ERROR_INTR) { |
| 730 | n = fs->scount - 1 - resid / 512; | 776 | n = fs->scount - 1 - resid / 512; |
| 731 | if (n > 0) { | 777 | if (n > 0) { |
| 732 | blk_update_request(fd_req, 0, n << 9); | 778 | blk_update_request(req, 0, n << 9); |
| 733 | fs->req_sector += n; | 779 | fs->req_sector += n; |
| 734 | } | 780 | } |
| 735 | if (fs->retries < 5) { | 781 | if (fs->retries < 5) { |
| 736 | ++fs->retries; | 782 | ++fs->retries; |
| 737 | act(fs); | 783 | act(fs); |
| 738 | } else { | 784 | } else { |
| 739 | printk("swim3: error %sing block %ld (err=%x)\n", | 785 | swim3_err("Error %sing block %ld (err=%x)\n", |
| 740 | rq_data_dir(fd_req) == WRITE? "writ": "read", | 786 | rq_data_dir(req) == WRITE? "writ": "read", |
| 741 | (long)blk_rq_pos(fd_req), err); | 787 | (long)blk_rq_pos(req), err); |
| 742 | swim3_end_request_cur(-EIO); | 788 | swim3_end_request(fs, -EIO, 0); |
| 743 | fs->state = idle; | 789 | fs->state = idle; |
| 744 | } | 790 | } |
| 745 | } else { | 791 | } else { |
| 746 | if ((stat & ACTIVE) == 0 || resid != 0) { | 792 | if ((stat & ACTIVE) == 0 || resid != 0) { |
| 747 | /* musta been an error */ | 793 | /* musta been an error */ |
| 748 | printk(KERN_ERR "swim3: fd dma: stat=%x resid=%d\n", stat, resid); | 794 | swim3_err("fd dma error: stat=%x resid=%d\n", stat, resid); |
| 749 | printk(KERN_ERR " state=%d, dir=%x, intr=%x, err=%x\n", | 795 | swim3_err(" state=%d, dir=%x, intr=%x, err=%x\n", |
| 750 | fs->state, rq_data_dir(fd_req), intr, err); | 796 | fs->state, rq_data_dir(req), intr, err); |
| 751 | swim3_end_request_cur(-EIO); | 797 | swim3_end_request(fs, -EIO, 0); |
| 752 | fs->state = idle; | 798 | fs->state = idle; |
| 753 | start_request(fs); | 799 | start_request(fs); |
| 754 | break; | 800 | break; |
| 755 | } | 801 | } |
| 756 | if (swim3_end_request(0, fs->scount << 9)) { | 802 | fs->retries = 0; |
| 803 | if (swim3_end_request(fs, 0, fs->scount << 9)) { | ||
| 757 | fs->req_sector += fs->scount; | 804 | fs->req_sector += fs->scount; |
| 758 | if (fs->req_sector > fs->secpertrack) { | 805 | if (fs->req_sector > fs->secpertrack) { |
| 759 | fs->req_sector -= fs->secpertrack; | 806 | fs->req_sector -= fs->secpertrack; |
| @@ -770,8 +817,9 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id) | |||
| 770 | start_request(fs); | 817 | start_request(fs); |
| 771 | break; | 818 | break; |
| 772 | default: | 819 | default: |
| 773 | printk(KERN_ERR "swim3: don't know what to do in state %d\n", fs->state); | 820 | swim3_err("Don't know what to do in state %d\n", fs->state); |
| 774 | } | 821 | } |
| 822 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
| 775 | return IRQ_HANDLED; | 823 | return IRQ_HANDLED; |
| 776 | } | 824 | } |
| 777 | 825 | ||
| @@ -781,26 +829,31 @@ static void fd_dma_interrupt(int irq, void *dev_id) | |||
| 781 | } | 829 | } |
| 782 | */ | 830 | */ |
| 783 | 831 | ||
| 832 | /* Called under the mutex to grab exclusive access to a drive */ | ||
| 784 | static int grab_drive(struct floppy_state *fs, enum swim_state state, | 833 | static int grab_drive(struct floppy_state *fs, enum swim_state state, |
| 785 | int interruptible) | 834 | int interruptible) |
| 786 | { | 835 | { |
| 787 | unsigned long flags; | 836 | unsigned long flags; |
| 788 | 837 | ||
| 789 | spin_lock_irqsave(&fs->lock, flags); | 838 | swim3_dbg("%s", "-> grab drive\n"); |
| 790 | if (fs->state != idle) { | 839 | |
| 840 | spin_lock_irqsave(&swim3_lock, flags); | ||
| 841 | if (fs->state != idle && fs->state != available) { | ||
| 791 | ++fs->wanted; | 842 | ++fs->wanted; |
| 792 | while (fs->state != available) { | 843 | while (fs->state != available) { |
| 844 | spin_unlock_irqrestore(&swim3_lock, flags); | ||
| 793 | if (interruptible && signal_pending(current)) { | 845 | if (interruptible && signal_pending(current)) { |
| 794 | --fs->wanted; | 846 | --fs->wanted; |
| 795 | spin_unlock_irqrestore(&fs->lock, flags); | ||
| 796 | return -EINTR; | 847 | return -EINTR; |
| 797 | } | 848 | } |
| 798 | interruptible_sleep_on(&fs->wait); | 849 | interruptible_sleep_on(&fs->wait); |
| 850 | spin_lock_irqsave(&swim3_lock, flags); | ||
| 799 | } | 851 | } |
| 800 | --fs->wanted; | 852 | --fs->wanted; |
| 801 | } | 853 | } |
| 802 | fs->state = state; | 854 | fs->state = state; |
| 803 | spin_unlock_irqrestore(&fs->lock, flags); | 855 | spin_unlock_irqrestore(&swim3_lock, flags); |
| 856 | |||
| 804 | return 0; | 857 | return 0; |
| 805 | } | 858 | } |
| 806 | 859 | ||
| @@ -808,10 +861,12 @@ static void release_drive(struct floppy_state *fs) | |||
| 808 | { | 861 | { |
| 809 | unsigned long flags; | 862 | unsigned long flags; |
| 810 | 863 | ||
| 811 | spin_lock_irqsave(&fs->lock, flags); | 864 | swim3_dbg("%s", "-> release drive\n"); |
| 865 | |||
| 866 | spin_lock_irqsave(&swim3_lock, flags); | ||
| 812 | fs->state = idle; | 867 | fs->state = idle; |
| 813 | start_request(fs); | 868 | start_request(fs); |
| 814 | spin_unlock_irqrestore(&fs->lock, flags); | 869 | spin_unlock_irqrestore(&swim3_lock, flags); |
| 815 | } | 870 | } |
| 816 | 871 | ||
| 817 | static int fd_eject(struct floppy_state *fs) | 872 | static int fd_eject(struct floppy_state *fs) |
| @@ -966,6 +1021,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
| 966 | { | 1021 | { |
| 967 | struct floppy_state *fs = disk->private_data; | 1022 | struct floppy_state *fs = disk->private_data; |
| 968 | struct swim3 __iomem *sw = fs->swim3; | 1023 | struct swim3 __iomem *sw = fs->swim3; |
| 1024 | |||
| 969 | mutex_lock(&swim3_mutex); | 1025 | mutex_lock(&swim3_mutex); |
| 970 | if (fs->ref_count > 0 && --fs->ref_count == 0) { | 1026 | if (fs->ref_count > 0 && --fs->ref_count == 0) { |
| 971 | swim3_action(fs, MOTOR_OFF); | 1027 | swim3_action(fs, MOTOR_OFF); |
| @@ -1031,30 +1087,48 @@ static const struct block_device_operations floppy_fops = { | |||
| 1031 | .revalidate_disk= floppy_revalidate, | 1087 | .revalidate_disk= floppy_revalidate, |
| 1032 | }; | 1088 | }; |
| 1033 | 1089 | ||
| 1090 | static void swim3_mb_event(struct macio_dev* mdev, int mb_state) | ||
| 1091 | { | ||
| 1092 | struct floppy_state *fs = macio_get_drvdata(mdev); | ||
| 1093 | struct swim3 __iomem *sw = fs->swim3; | ||
| 1094 | |||
| 1095 | if (!fs) | ||
| 1096 | return; | ||
| 1097 | if (mb_state != MB_FD) | ||
| 1098 | return; | ||
| 1099 | |||
| 1100 | /* Clear state */ | ||
| 1101 | out_8(&sw->intr_enable, 0); | ||
| 1102 | in_8(&sw->intr); | ||
| 1103 | in_8(&sw->error); | ||
| 1104 | } | ||
| 1105 | |||
| 1034 | static int swim3_add_device(struct macio_dev *mdev, int index) | 1106 | static int swim3_add_device(struct macio_dev *mdev, int index) |
| 1035 | { | 1107 | { |
| 1036 | struct device_node *swim = mdev->ofdev.dev.of_node; | 1108 | struct device_node *swim = mdev->ofdev.dev.of_node; |
| 1037 | struct floppy_state *fs = &floppy_states[index]; | 1109 | struct floppy_state *fs = &floppy_states[index]; |
| 1038 | int rc = -EBUSY; | 1110 | int rc = -EBUSY; |
| 1039 | 1111 | ||
| 1112 | /* Do this first for message macros */ | ||
| 1113 | memset(fs, 0, sizeof(*fs)); | ||
| 1114 | fs->mdev = mdev; | ||
| 1115 | fs->index = index; | ||
| 1116 | |||
| 1040 | /* Check & Request resources */ | 1117 | /* Check & Request resources */ |
| 1041 | if (macio_resource_count(mdev) < 2) { | 1118 | if (macio_resource_count(mdev) < 2) { |
| 1042 | printk(KERN_WARNING "ifd%d: no address for %s\n", | 1119 | swim3_err("%s", "No address in device-tree\n"); |
| 1043 | index, swim->full_name); | ||
| 1044 | return -ENXIO; | 1120 | return -ENXIO; |
| 1045 | } | 1121 | } |
| 1046 | if (macio_irq_count(mdev) < 2) { | 1122 | if (macio_irq_count(mdev) < 1) { |
| 1047 | printk(KERN_WARNING "fd%d: no intrs for device %s\n", | 1123 | swim3_err("%s", "No interrupt in device-tree\n"); |
| 1048 | index, swim->full_name); | 1124 | return -ENXIO; |
| 1049 | } | 1125 | } |
| 1050 | if (macio_request_resource(mdev, 0, "swim3 (mmio)")) { | 1126 | if (macio_request_resource(mdev, 0, "swim3 (mmio)")) { |
| 1051 | printk(KERN_ERR "fd%d: can't request mmio resource for %s\n", | 1127 | swim3_err("%s", "Can't request mmio resource\n"); |
| 1052 | index, swim->full_name); | ||
| 1053 | return -EBUSY; | 1128 | return -EBUSY; |
| 1054 | } | 1129 | } |
| 1055 | if (macio_request_resource(mdev, 1, "swim3 (dma)")) { | 1130 | if (macio_request_resource(mdev, 1, "swim3 (dma)")) { |
| 1056 | printk(KERN_ERR "fd%d: can't request dma resource for %s\n", | 1131 | swim3_err("%s", "Can't request dma resource\n"); |
| 1057 | index, swim->full_name); | ||
| 1058 | macio_release_resource(mdev, 0); | 1132 | macio_release_resource(mdev, 0); |
| 1059 | return -EBUSY; | 1133 | return -EBUSY; |
| 1060 | } | 1134 | } |
| @@ -1063,22 +1137,18 @@ static int swim3_add_device(struct macio_dev *mdev, int index) | |||
| 1063 | if (mdev->media_bay == NULL) | 1137 | if (mdev->media_bay == NULL) |
| 1064 | pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 1); | 1138 | pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 1); |
| 1065 | 1139 | ||
| 1066 | memset(fs, 0, sizeof(*fs)); | ||
| 1067 | spin_lock_init(&fs->lock); | ||
| 1068 | fs->state = idle; | 1140 | fs->state = idle; |
| 1069 | fs->swim3 = (struct swim3 __iomem *) | 1141 | fs->swim3 = (struct swim3 __iomem *) |
| 1070 | ioremap(macio_resource_start(mdev, 0), 0x200); | 1142 | ioremap(macio_resource_start(mdev, 0), 0x200); |
| 1071 | if (fs->swim3 == NULL) { | 1143 | if (fs->swim3 == NULL) { |
| 1072 | printk("fd%d: couldn't map registers for %s\n", | 1144 | swim3_err("%s", "Couldn't map mmio registers\n"); |
| 1073 | index, swim->full_name); | ||
| 1074 | rc = -ENOMEM; | 1145 | rc = -ENOMEM; |
| 1075 | goto out_release; | 1146 | goto out_release; |
| 1076 | } | 1147 | } |
| 1077 | fs->dma = (struct dbdma_regs __iomem *) | 1148 | fs->dma = (struct dbdma_regs __iomem *) |
| 1078 | ioremap(macio_resource_start(mdev, 1), 0x200); | 1149 | ioremap(macio_resource_start(mdev, 1), 0x200); |
| 1079 | if (fs->dma == NULL) { | 1150 | if (fs->dma == NULL) { |
| 1080 | printk("fd%d: couldn't map DMA for %s\n", | 1151 | swim3_err("%s", "Couldn't map dma registers\n"); |
| 1081 | index, swim->full_name); | ||
| 1082 | iounmap(fs->swim3); | 1152 | iounmap(fs->swim3); |
| 1083 | rc = -ENOMEM; | 1153 | rc = -ENOMEM; |
| 1084 | goto out_release; | 1154 | goto out_release; |
| @@ -1090,31 +1160,25 @@ static int swim3_add_device(struct macio_dev *mdev, int index) | |||
| 1090 | fs->secpercyl = 36; | 1160 | fs->secpercyl = 36; |
| 1091 | fs->secpertrack = 18; | 1161 | fs->secpertrack = 18; |
| 1092 | fs->total_secs = 2880; | 1162 | fs->total_secs = 2880; |
| 1093 | fs->mdev = mdev; | ||
| 1094 | init_waitqueue_head(&fs->wait); | 1163 | init_waitqueue_head(&fs->wait); |
| 1095 | 1164 | ||
| 1096 | fs->dma_cmd = (struct dbdma_cmd *) DBDMA_ALIGN(fs->dbdma_cmd_space); | 1165 | fs->dma_cmd = (struct dbdma_cmd *) DBDMA_ALIGN(fs->dbdma_cmd_space); |
| 1097 | memset(fs->dma_cmd, 0, 2 * sizeof(struct dbdma_cmd)); | 1166 | memset(fs->dma_cmd, 0, 2 * sizeof(struct dbdma_cmd)); |
| 1098 | st_le16(&fs->dma_cmd[1].command, DBDMA_STOP); | 1167 | st_le16(&fs->dma_cmd[1].command, DBDMA_STOP); |
| 1099 | 1168 | ||
| 1169 | if (mdev->media_bay == NULL || check_media_bay(mdev->media_bay) == MB_FD) | ||
| 1170 | swim3_mb_event(mdev, MB_FD); | ||
| 1171 | |||
| 1100 | if (request_irq(fs->swim3_intr, swim3_interrupt, 0, "SWIM3", fs)) { | 1172 | if (request_irq(fs->swim3_intr, swim3_interrupt, 0, "SWIM3", fs)) { |
| 1101 | printk(KERN_ERR "fd%d: couldn't request irq %d for %s\n", | 1173 | swim3_err("%s", "Couldn't request interrupt\n"); |
| 1102 | index, fs->swim3_intr, swim->full_name); | ||
| 1103 | pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 0); | 1174 | pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 0); |
| 1104 | goto out_unmap; | 1175 | goto out_unmap; |
| 1105 | return -EBUSY; | 1176 | return -EBUSY; |
| 1106 | } | 1177 | } |
| 1107 | /* | ||
| 1108 | if (request_irq(fs->dma_intr, fd_dma_interrupt, 0, "SWIM3-dma", fs)) { | ||
| 1109 | printk(KERN_ERR "Couldn't get irq %d for SWIM3 DMA", | ||
| 1110 | fs->dma_intr); | ||
| 1111 | return -EBUSY; | ||
| 1112 | } | ||
| 1113 | */ | ||
| 1114 | 1178 | ||
| 1115 | init_timer(&fs->timeout); | 1179 | init_timer(&fs->timeout); |
| 1116 | 1180 | ||
| 1117 | printk(KERN_INFO "fd%d: SWIM3 floppy controller %s\n", floppy_count, | 1181 | swim3_info("SWIM3 floppy controller %s\n", |
| 1118 | mdev->media_bay ? "in media bay" : ""); | 1182 | mdev->media_bay ? "in media bay" : ""); |
| 1119 | 1183 | ||
| 1120 | return 0; | 1184 | return 0; |
| @@ -1132,41 +1196,42 @@ static int swim3_add_device(struct macio_dev *mdev, int index) | |||
| 1132 | 1196 | ||
| 1133 | static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device_id *match) | 1197 | static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device_id *match) |
| 1134 | { | 1198 | { |
| 1135 | int i, rc; | ||
| 1136 | struct gendisk *disk; | 1199 | struct gendisk *disk; |
| 1200 | int index, rc; | ||
| 1201 | |||
| 1202 | index = floppy_count++; | ||
| 1203 | if (index >= MAX_FLOPPIES) | ||
| 1204 | return -ENXIO; | ||
| 1137 | 1205 | ||
| 1138 | /* Add the drive */ | 1206 | /* Add the drive */ |
| 1139 | rc = swim3_add_device(mdev, floppy_count); | 1207 | rc = swim3_add_device(mdev, index); |
| 1140 | if (rc) | 1208 | if (rc) |
| 1141 | return rc; | 1209 | return rc; |
| 1210 | /* Now register that disk. Same comment about failure handling */ | ||
| 1211 | disk = disks[index] = alloc_disk(1); | ||
| 1212 | if (disk == NULL) | ||
| 1213 | return -ENOMEM; | ||
| 1214 | disk->queue = blk_init_queue(do_fd_request, &swim3_lock); | ||
| 1215 | if (disk->queue == NULL) { | ||
| 1216 | put_disk(disk); | ||
| 1217 | return -ENOMEM; | ||
| 1218 | } | ||
| 1219 | disk->queue->queuedata = &floppy_states[index]; | ||
| 1142 | 1220 | ||
| 1143 | /* Now create the queue if not there yet */ | 1221 | if (index == 0) { |
| 1144 | if (swim3_queue == NULL) { | ||
| 1145 | /* If we failed, there isn't much we can do as the driver is still | 1222 | /* If we failed, there isn't much we can do as the driver is still |
| 1146 | * too dumb to remove the device, just bail out | 1223 | * too dumb to remove the device, just bail out |
| 1147 | */ | 1224 | */ |
| 1148 | if (register_blkdev(FLOPPY_MAJOR, "fd")) | 1225 | if (register_blkdev(FLOPPY_MAJOR, "fd")) |
| 1149 | return 0; | 1226 | return 0; |
| 1150 | swim3_queue = blk_init_queue(do_fd_request, &swim3_lock); | ||
| 1151 | if (swim3_queue == NULL) { | ||
| 1152 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | ||
| 1153 | return 0; | ||
| 1154 | } | ||
| 1155 | } | 1227 | } |
| 1156 | 1228 | ||
| 1157 | /* Now register that disk. Same comment about failure handling */ | ||
| 1158 | i = floppy_count++; | ||
| 1159 | disk = disks[i] = alloc_disk(1); | ||
| 1160 | if (disk == NULL) | ||
| 1161 | return 0; | ||
| 1162 | |||
| 1163 | disk->major = FLOPPY_MAJOR; | 1229 | disk->major = FLOPPY_MAJOR; |
| 1164 | disk->first_minor = i; | 1230 | disk->first_minor = index; |
| 1165 | disk->fops = &floppy_fops; | 1231 | disk->fops = &floppy_fops; |
| 1166 | disk->private_data = &floppy_states[i]; | 1232 | disk->private_data = &floppy_states[index]; |
| 1167 | disk->queue = swim3_queue; | ||
| 1168 | disk->flags |= GENHD_FL_REMOVABLE; | 1233 | disk->flags |= GENHD_FL_REMOVABLE; |
| 1169 | sprintf(disk->disk_name, "fd%d", i); | 1234 | sprintf(disk->disk_name, "fd%d", index); |
| 1170 | set_capacity(disk, 2880); | 1235 | set_capacity(disk, 2880); |
| 1171 | add_disk(disk); | 1236 | add_disk(disk); |
| 1172 | 1237 | ||
| @@ -1194,6 +1259,9 @@ static struct macio_driver swim3_driver = | |||
| 1194 | .of_match_table = swim3_match, | 1259 | .of_match_table = swim3_match, |
| 1195 | }, | 1260 | }, |
| 1196 | .probe = swim3_attach, | 1261 | .probe = swim3_attach, |
| 1262 | #ifdef CONFIG_PMAC_MEDIABAY | ||
| 1263 | .mediabay_event = swim3_mb_event, | ||
| 1264 | #endif | ||
| 1197 | #if 0 | 1265 | #if 0 |
| 1198 | .suspend = swim3_suspend, | 1266 | .suspend = swim3_suspend, |
| 1199 | .resume = swim3_resume, | 1267 | .resume = swim3_resume, |
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index 11b41fd40c27..5ccf142ef0b8 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig | |||
| @@ -188,7 +188,7 @@ config BT_MRVL | |||
| 188 | The core driver to support Marvell Bluetooth devices. | 188 | The core driver to support Marvell Bluetooth devices. |
| 189 | 189 | ||
| 190 | This driver is required if you want to support | 190 | This driver is required if you want to support |
| 191 | Marvell Bluetooth devices, such as 8688/8787. | 191 | Marvell Bluetooth devices, such as 8688/8787/8797. |
| 192 | 192 | ||
| 193 | Say Y here to compile Marvell Bluetooth driver | 193 | Say Y here to compile Marvell Bluetooth driver |
| 194 | into the kernel or say M to compile it as module. | 194 | into the kernel or say M to compile it as module. |
| @@ -201,8 +201,8 @@ config BT_MRVL_SDIO | |||
| 201 | The driver for Marvell Bluetooth chipsets with SDIO interface. | 201 | The driver for Marvell Bluetooth chipsets with SDIO interface. |
| 202 | 202 | ||
| 203 | This driver is required if you want to use Marvell Bluetooth | 203 | This driver is required if you want to use Marvell Bluetooth |
| 204 | devices with SDIO interface. Currently SD8688/SD8787 chipsets are | 204 | devices with SDIO interface. Currently SD8688/SD8787/SD8797 |
| 205 | supported. | 205 | chipsets are supported. |
| 206 | 206 | ||
| 207 | Say Y here to compile support for Marvell BT-over-SDIO driver | 207 | Say Y here to compile support for Marvell BT-over-SDIO driver |
| 208 | into the kernel or say M to compile it as module. | 208 | into the kernel or say M to compile it as module. |
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index 9ef48167e2cf..27b74b0d547b 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c | |||
| @@ -65,7 +65,7 @@ static const struct btmrvl_sdio_card_reg btmrvl_reg_8688 = { | |||
| 65 | .io_port_1 = 0x01, | 65 | .io_port_1 = 0x01, |
| 66 | .io_port_2 = 0x02, | 66 | .io_port_2 = 0x02, |
| 67 | }; | 67 | }; |
| 68 | static const struct btmrvl_sdio_card_reg btmrvl_reg_8787 = { | 68 | static const struct btmrvl_sdio_card_reg btmrvl_reg_87xx = { |
| 69 | .cfg = 0x00, | 69 | .cfg = 0x00, |
| 70 | .host_int_mask = 0x02, | 70 | .host_int_mask = 0x02, |
| 71 | .host_intstatus = 0x03, | 71 | .host_intstatus = 0x03, |
| @@ -92,7 +92,14 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8688 = { | |||
| 92 | static const struct btmrvl_sdio_device btmrvl_sdio_sd8787 = { | 92 | static const struct btmrvl_sdio_device btmrvl_sdio_sd8787 = { |
| 93 | .helper = NULL, | 93 | .helper = NULL, |
| 94 | .firmware = "mrvl/sd8787_uapsta.bin", | 94 | .firmware = "mrvl/sd8787_uapsta.bin", |
| 95 | .reg = &btmrvl_reg_8787, | 95 | .reg = &btmrvl_reg_87xx, |
| 96 | .sd_blksz_fw_dl = 256, | ||
| 97 | }; | ||
| 98 | |||
| 99 | static const struct btmrvl_sdio_device btmrvl_sdio_sd8797 = { | ||
| 100 | .helper = NULL, | ||
| 101 | .firmware = "mrvl/sd8797_uapsta.bin", | ||
| 102 | .reg = &btmrvl_reg_87xx, | ||
| 96 | .sd_blksz_fw_dl = 256, | 103 | .sd_blksz_fw_dl = 256, |
| 97 | }; | 104 | }; |
| 98 | 105 | ||
| @@ -103,6 +110,9 @@ static const struct sdio_device_id btmrvl_sdio_ids[] = { | |||
| 103 | /* Marvell SD8787 Bluetooth device */ | 110 | /* Marvell SD8787 Bluetooth device */ |
| 104 | { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x911A), | 111 | { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x911A), |
| 105 | .driver_data = (unsigned long) &btmrvl_sdio_sd8787 }, | 112 | .driver_data = (unsigned long) &btmrvl_sdio_sd8787 }, |
| 113 | /* Marvell SD8797 Bluetooth device */ | ||
| 114 | { SDIO_DEVICE(SDIO_VENDOR_ID_MARVELL, 0x912A), | ||
| 115 | .driver_data = (unsigned long) &btmrvl_sdio_sd8797 }, | ||
| 106 | 116 | ||
| 107 | { } /* Terminating entry */ | 117 | { } /* Terminating entry */ |
| 108 | }; | 118 | }; |
| @@ -1076,3 +1086,4 @@ MODULE_LICENSE("GPL v2"); | |||
| 1076 | MODULE_FIRMWARE("sd8688_helper.bin"); | 1086 | MODULE_FIRMWARE("sd8688_helper.bin"); |
| 1077 | MODULE_FIRMWARE("sd8688.bin"); | 1087 | MODULE_FIRMWARE("sd8688.bin"); |
| 1078 | MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin"); | 1088 | MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin"); |
| 1089 | MODULE_FIRMWARE("mrvl/sd8797_uapsta.bin"); | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index fe4ebc375b3d..eabc437ce500 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -777,9 +777,8 @@ skip_waking: | |||
| 777 | usb_mark_last_busy(data->udev); | 777 | usb_mark_last_busy(data->udev); |
| 778 | } | 778 | } |
| 779 | 779 | ||
| 780 | usb_free_urb(urb); | ||
| 781 | |||
| 782 | done: | 780 | done: |
| 781 | usb_free_urb(urb); | ||
| 783 | return err; | 782 | return err; |
| 784 | } | 783 | } |
| 785 | 784 | ||
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index c2917ffad2c2..34767a6d7f42 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
| @@ -139,6 +139,8 @@ | |||
| 139 | #define IPMI_WDOG_SET_TIMER 0x24 | 139 | #define IPMI_WDOG_SET_TIMER 0x24 |
| 140 | #define IPMI_WDOG_GET_TIMER 0x25 | 140 | #define IPMI_WDOG_GET_TIMER 0x25 |
| 141 | 141 | ||
| 142 | #define IPMI_WDOG_TIMER_NOT_INIT_RESP 0x80 | ||
| 143 | |||
| 142 | /* These are here until the real ones get into the watchdog.h interface. */ | 144 | /* These are here until the real ones get into the watchdog.h interface. */ |
| 143 | #ifndef WDIOC_GETTIMEOUT | 145 | #ifndef WDIOC_GETTIMEOUT |
| 144 | #define WDIOC_GETTIMEOUT _IOW(WATCHDOG_IOCTL_BASE, 20, int) | 146 | #define WDIOC_GETTIMEOUT _IOW(WATCHDOG_IOCTL_BASE, 20, int) |
| @@ -596,6 +598,7 @@ static int ipmi_heartbeat(void) | |||
| 596 | struct kernel_ipmi_msg msg; | 598 | struct kernel_ipmi_msg msg; |
| 597 | int rv; | 599 | int rv; |
| 598 | struct ipmi_system_interface_addr addr; | 600 | struct ipmi_system_interface_addr addr; |
| 601 | int timeout_retries = 0; | ||
| 599 | 602 | ||
| 600 | if (ipmi_ignore_heartbeat) | 603 | if (ipmi_ignore_heartbeat) |
| 601 | return 0; | 604 | return 0; |
| @@ -616,6 +619,7 @@ static int ipmi_heartbeat(void) | |||
| 616 | 619 | ||
| 617 | mutex_lock(&heartbeat_lock); | 620 | mutex_lock(&heartbeat_lock); |
| 618 | 621 | ||
| 622 | restart: | ||
| 619 | atomic_set(&heartbeat_tofree, 2); | 623 | atomic_set(&heartbeat_tofree, 2); |
| 620 | 624 | ||
| 621 | /* | 625 | /* |
| @@ -653,7 +657,33 @@ static int ipmi_heartbeat(void) | |||
| 653 | /* Wait for the heartbeat to be sent. */ | 657 | /* Wait for the heartbeat to be sent. */ |
| 654 | wait_for_completion(&heartbeat_wait); | 658 | wait_for_completion(&heartbeat_wait); |
| 655 | 659 | ||
| 656 | if (heartbeat_recv_msg.msg.data[0] != 0) { | 660 | if (heartbeat_recv_msg.msg.data[0] == IPMI_WDOG_TIMER_NOT_INIT_RESP) { |
| 661 | timeout_retries++; | ||
| 662 | if (timeout_retries > 3) { | ||
| 663 | printk(KERN_ERR PFX ": Unable to restore the IPMI" | ||
| 664 | " watchdog's settings, giving up.\n"); | ||
| 665 | rv = -EIO; | ||
| 666 | goto out_unlock; | ||
| 667 | } | ||
| 668 | |||
| 669 | /* | ||
| 670 | * The timer was not initialized, that means the BMC was | ||
| 671 | * probably reset and lost the watchdog information. Attempt | ||
| 672 | * to restore the timer's info. Note that we still hold | ||
| 673 | * the heartbeat lock, to keep a heartbeat from happening | ||
| 674 | * in this process, so must say no heartbeat to avoid a | ||
| 675 | * deadlock on this mutex. | ||
| 676 | */ | ||
| 677 | rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB); | ||
| 678 | if (rv) { | ||
| 679 | printk(KERN_ERR PFX ": Unable to send the command to" | ||
| 680 | " set the watchdog's settings, giving up.\n"); | ||
| 681 | goto out_unlock; | ||
| 682 | } | ||
| 683 | |||
| 684 | /* We might need a new heartbeat, so do it now */ | ||
| 685 | goto restart; | ||
| 686 | } else if (heartbeat_recv_msg.msg.data[0] != 0) { | ||
| 657 | /* | 687 | /* |
| 658 | * Got an error in the heartbeat response. It was already | 688 | * Got an error in the heartbeat response. It was already |
| 659 | * reported in ipmi_wdog_msg_handler, but we should return | 689 | * reported in ipmi_wdog_msg_handler, but we should return |
| @@ -662,6 +692,7 @@ static int ipmi_heartbeat(void) | |||
| 662 | rv = -EINVAL; | 692 | rv = -EINVAL; |
| 663 | } | 693 | } |
| 664 | 694 | ||
| 695 | out_unlock: | ||
| 665 | mutex_unlock(&heartbeat_lock); | 696 | mutex_unlock(&heartbeat_lock); |
| 666 | 697 | ||
| 667 | return rv; | 698 | return rv; |
| @@ -922,11 +953,15 @@ static struct miscdevice ipmi_wdog_miscdev = { | |||
| 922 | static void ipmi_wdog_msg_handler(struct ipmi_recv_msg *msg, | 953 | static void ipmi_wdog_msg_handler(struct ipmi_recv_msg *msg, |
| 923 | void *handler_data) | 954 | void *handler_data) |
| 924 | { | 955 | { |
| 925 | if (msg->msg.data[0] != 0) { | 956 | if (msg->msg.cmd == IPMI_WDOG_RESET_TIMER && |
| 957 | msg->msg.data[0] == IPMI_WDOG_TIMER_NOT_INIT_RESP) | ||
| 958 | printk(KERN_INFO PFX "response: The IPMI controller appears" | ||
| 959 | " to have been reset, will attempt to reinitialize" | ||
| 960 | " the watchdog timer\n"); | ||
| 961 | else if (msg->msg.data[0] != 0) | ||
| 926 | printk(KERN_ERR PFX "response: Error %x on cmd %x\n", | 962 | printk(KERN_ERR PFX "response: Error %x on cmd %x\n", |
| 927 | msg->msg.data[0], | 963 | msg->msg.data[0], |
| 928 | msg->msg.cmd); | 964 | msg->msg.cmd); |
| 929 | } | ||
| 930 | 965 | ||
| 931 | ipmi_free_recv_msg(msg); | 966 | ipmi_free_recv_msg(msg); |
| 932 | } | 967 | } |
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c index c811cb107904..2cce44a1d7d0 100644 --- a/drivers/firmware/iscsi_ibft.c +++ b/drivers/firmware/iscsi_ibft.c | |||
| @@ -746,6 +746,37 @@ static void __exit ibft_exit(void) | |||
| 746 | ibft_cleanup(); | 746 | ibft_cleanup(); |
| 747 | } | 747 | } |
| 748 | 748 | ||
| 749 | #ifdef CONFIG_ACPI | ||
| 750 | static const struct { | ||
| 751 | char *sign; | ||
| 752 | } ibft_signs[] = { | ||
| 753 | /* | ||
| 754 | * One spec says "IBFT", the other says "iBFT". We have to check | ||
| 755 | * for both. | ||
| 756 | */ | ||
| 757 | { ACPI_SIG_IBFT }, | ||
| 758 | { "iBFT" }, | ||
| 759 | }; | ||
| 760 | |||
| 761 | static void __init acpi_find_ibft_region(void) | ||
| 762 | { | ||
| 763 | int i; | ||
| 764 | struct acpi_table_header *table = NULL; | ||
| 765 | |||
| 766 | if (acpi_disabled) | ||
| 767 | return; | ||
| 768 | |||
| 769 | for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++) { | ||
| 770 | acpi_get_table(ibft_signs[i].sign, 0, &table); | ||
| 771 | ibft_addr = (struct acpi_table_ibft *)table; | ||
| 772 | } | ||
| 773 | } | ||
| 774 | #else | ||
| 775 | static void __init acpi_find_ibft_region(void) | ||
| 776 | { | ||
| 777 | } | ||
| 778 | #endif | ||
| 779 | |||
| 749 | /* | 780 | /* |
| 750 | * ibft_init() - creates sysfs tree entries for the iBFT data. | 781 | * ibft_init() - creates sysfs tree entries for the iBFT data. |
| 751 | */ | 782 | */ |
| @@ -753,9 +784,16 @@ static int __init ibft_init(void) | |||
| 753 | { | 784 | { |
| 754 | int rc = 0; | 785 | int rc = 0; |
| 755 | 786 | ||
| 787 | /* | ||
| 788 | As on UEFI systems the setup_arch()/find_ibft_region() | ||
| 789 | is called before ACPI tables are parsed and it only does | ||
| 790 | legacy finding. | ||
| 791 | */ | ||
| 792 | if (!ibft_addr) | ||
| 793 | acpi_find_ibft_region(); | ||
| 794 | |||
| 756 | if (ibft_addr) { | 795 | if (ibft_addr) { |
| 757 | printk(KERN_INFO "iBFT detected at 0x%llx.\n", | 796 | pr_info("iBFT detected.\n"); |
| 758 | (u64)isa_virt_to_bus(ibft_addr)); | ||
| 759 | 797 | ||
| 760 | rc = ibft_check_device(); | 798 | rc = ibft_check_device(); |
| 761 | if (rc) | 799 | if (rc) |
diff --git a/drivers/firmware/iscsi_ibft_find.c b/drivers/firmware/iscsi_ibft_find.c index bfe723266fd8..4da4eb9ae926 100644 --- a/drivers/firmware/iscsi_ibft_find.c +++ b/drivers/firmware/iscsi_ibft_find.c | |||
| @@ -45,13 +45,6 @@ EXPORT_SYMBOL_GPL(ibft_addr); | |||
| 45 | static const struct { | 45 | static const struct { |
| 46 | char *sign; | 46 | char *sign; |
| 47 | } ibft_signs[] = { | 47 | } ibft_signs[] = { |
| 48 | #ifdef CONFIG_ACPI | ||
| 49 | /* | ||
| 50 | * One spec says "IBFT", the other says "iBFT". We have to check | ||
| 51 | * for both. | ||
| 52 | */ | ||
| 53 | { ACPI_SIG_IBFT }, | ||
| 54 | #endif | ||
| 55 | { "iBFT" }, | 48 | { "iBFT" }, |
| 56 | { "BIFT" }, /* Broadcom iSCSI Offload */ | 49 | { "BIFT" }, /* Broadcom iSCSI Offload */ |
| 57 | }; | 50 | }; |
| @@ -62,14 +55,6 @@ static const struct { | |||
| 62 | #define VGA_MEM 0xA0000 /* VGA buffer */ | 55 | #define VGA_MEM 0xA0000 /* VGA buffer */ |
| 63 | #define VGA_SIZE 0x20000 /* 128kB */ | 56 | #define VGA_SIZE 0x20000 /* 128kB */ |
| 64 | 57 | ||
| 65 | #ifdef CONFIG_ACPI | ||
| 66 | static int __init acpi_find_ibft(struct acpi_table_header *header) | ||
| 67 | { | ||
| 68 | ibft_addr = (struct acpi_table_ibft *)header; | ||
| 69 | return 0; | ||
| 70 | } | ||
| 71 | #endif /* CONFIG_ACPI */ | ||
| 72 | |||
| 73 | static int __init find_ibft_in_mem(void) | 58 | static int __init find_ibft_in_mem(void) |
| 74 | { | 59 | { |
| 75 | unsigned long pos; | 60 | unsigned long pos; |
| @@ -94,6 +79,7 @@ static int __init find_ibft_in_mem(void) | |||
| 94 | * the table cannot be valid. */ | 79 | * the table cannot be valid. */ |
| 95 | if (pos + len <= (IBFT_END-1)) { | 80 | if (pos + len <= (IBFT_END-1)) { |
| 96 | ibft_addr = (struct acpi_table_ibft *)virt; | 81 | ibft_addr = (struct acpi_table_ibft *)virt; |
| 82 | pr_info("iBFT found at 0x%lx.\n", pos); | ||
| 97 | goto done; | 83 | goto done; |
| 98 | } | 84 | } |
| 99 | } | 85 | } |
| @@ -108,20 +94,12 @@ done: | |||
| 108 | */ | 94 | */ |
| 109 | unsigned long __init find_ibft_region(unsigned long *sizep) | 95 | unsigned long __init find_ibft_region(unsigned long *sizep) |
| 110 | { | 96 | { |
| 111 | #ifdef CONFIG_ACPI | ||
| 112 | int i; | ||
| 113 | #endif | ||
| 114 | ibft_addr = NULL; | 97 | ibft_addr = NULL; |
| 115 | 98 | ||
| 116 | #ifdef CONFIG_ACPI | ||
| 117 | for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++) | ||
| 118 | acpi_table_parse(ibft_signs[i].sign, acpi_find_ibft); | ||
| 119 | #endif /* CONFIG_ACPI */ | ||
| 120 | |||
| 121 | /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will | 99 | /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will |
| 122 | * only use ACPI for this */ | 100 | * only use ACPI for this */ |
| 123 | 101 | ||
| 124 | if (!ibft_addr && !efi_enabled) | 102 | if (!efi_enabled) |
| 125 | find_ibft_in_mem(); | 103 | find_ibft_in_mem(); |
| 126 | 104 | ||
| 127 | if (ibft_addr) { | 105 | if (ibft_addr) { |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index dbcb0bcfd8da..4e018d6a7639 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
| @@ -18,7 +18,7 @@ obj-$(CONFIG_ARCH_DAVINCI) += gpio-davinci.o | |||
| 18 | obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o | 18 | obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o |
| 19 | obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o | 19 | obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o |
| 20 | obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o | 20 | obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o |
| 21 | obj-$(CONFIG_MACH_KS8695) += gpio-ks8695.o | 21 | obj-$(CONFIG_ARCH_KS8695) += gpio-ks8695.o |
| 22 | obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o | 22 | obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o |
| 23 | obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o | 23 | obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o |
| 24 | obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o | 24 | obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o |
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c index 038f5eb8b13d..f8ce29ef9f88 100644 --- a/drivers/gpio/gpio-da9052.c +++ b/drivers/gpio/gpio-da9052.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/mfd/da9052/da9052.h> | 22 | #include <linux/mfd/da9052/da9052.h> |
| 23 | #include <linux/mfd/da9052/reg.h> | 23 | #include <linux/mfd/da9052/reg.h> |
| 24 | #include <linux/mfd/da9052/pdata.h> | 24 | #include <linux/mfd/da9052/pdata.h> |
| 25 | #include <linux/mfd/da9052/gpio.h> | ||
| 26 | 25 | ||
| 27 | #define DA9052_INPUT 1 | 26 | #define DA9052_INPUT 1 |
| 28 | #define DA9052_OUTPUT_OPENDRAIN 2 | 27 | #define DA9052_OUTPUT_OPENDRAIN 2 |
| @@ -43,6 +42,9 @@ | |||
| 43 | #define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0 | 42 | #define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0 |
| 44 | #define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F | 43 | #define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F |
| 45 | #define DA9052_GPIO_NIBBLE_SHIFT 4 | 44 | #define DA9052_GPIO_NIBBLE_SHIFT 4 |
| 45 | #define DA9052_IRQ_GPI0 16 | ||
| 46 | #define DA9052_GPIO_ODD_SHIFT 7 | ||
| 47 | #define DA9052_GPIO_EVEN_SHIFT 3 | ||
| 46 | 48 | ||
| 47 | struct da9052_gpio { | 49 | struct da9052_gpio { |
| 48 | struct da9052 *da9052; | 50 | struct da9052 *da9052; |
| @@ -104,33 +106,26 @@ static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset) | |||
| 104 | static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) | 106 | static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) |
| 105 | { | 107 | { |
| 106 | struct da9052_gpio *gpio = to_da9052_gpio(gc); | 108 | struct da9052_gpio *gpio = to_da9052_gpio(gc); |
| 107 | unsigned char register_value = 0; | ||
| 108 | int ret; | 109 | int ret; |
| 109 | 110 | ||
| 110 | if (da9052_gpio_port_odd(offset)) { | 111 | if (da9052_gpio_port_odd(offset)) { |
| 111 | if (value) { | ||
| 112 | register_value = DA9052_GPIO_ODD_PORT_MODE; | ||
| 113 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + | 112 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + |
| 114 | DA9052_GPIO_0_1_REG, | 113 | DA9052_GPIO_0_1_REG, |
| 115 | DA9052_GPIO_ODD_PORT_MODE, | 114 | DA9052_GPIO_ODD_PORT_MODE, |
| 116 | register_value); | 115 | value << DA9052_GPIO_ODD_SHIFT); |
| 117 | if (ret != 0) | 116 | if (ret != 0) |
| 118 | dev_err(gpio->da9052->dev, | 117 | dev_err(gpio->da9052->dev, |
| 119 | "Failed to updated gpio odd reg,%d", | 118 | "Failed to updated gpio odd reg,%d", |
| 120 | ret); | 119 | ret); |
| 121 | } | ||
| 122 | } else { | 120 | } else { |
| 123 | if (value) { | ||
| 124 | register_value = DA9052_GPIO_EVEN_PORT_MODE; | ||
| 125 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + | 121 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + |
| 126 | DA9052_GPIO_0_1_REG, | 122 | DA9052_GPIO_0_1_REG, |
| 127 | DA9052_GPIO_EVEN_PORT_MODE, | 123 | DA9052_GPIO_EVEN_PORT_MODE, |
| 128 | register_value); | 124 | value << DA9052_GPIO_EVEN_SHIFT); |
| 129 | if (ret != 0) | 125 | if (ret != 0) |
| 130 | dev_err(gpio->da9052->dev, | 126 | dev_err(gpio->da9052->dev, |
| 131 | "Failed to updated gpio even reg,%d", | 127 | "Failed to updated gpio even reg,%d", |
| 132 | ret); | 128 | ret); |
| 133 | } | ||
| 134 | } | 129 | } |
| 135 | } | 130 | } |
| 136 | 131 | ||
| @@ -201,9 +196,9 @@ static struct gpio_chip reference_gp __devinitdata = { | |||
| 201 | .direction_input = da9052_gpio_direction_input, | 196 | .direction_input = da9052_gpio_direction_input, |
| 202 | .direction_output = da9052_gpio_direction_output, | 197 | .direction_output = da9052_gpio_direction_output, |
| 203 | .to_irq = da9052_gpio_to_irq, | 198 | .to_irq = da9052_gpio_to_irq, |
| 204 | .can_sleep = 1; | 199 | .can_sleep = 1, |
| 205 | .ngpio = 16; | 200 | .ngpio = 16, |
| 206 | .base = -1; | 201 | .base = -1, |
| 207 | }; | 202 | }; |
| 208 | 203 | ||
| 209 | static int __devinit da9052_gpio_probe(struct platform_device *pdev) | 204 | static int __devinit da9052_gpio_probe(struct platform_device *pdev) |
diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index ea8e73869250..461958fc2264 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c | |||
| @@ -332,6 +332,34 @@ static void ioh_irq_mask(struct irq_data *d) | |||
| 332 | &chip->reg->regs[chip->ch].imask); | 332 | &chip->reg->regs[chip->ch].imask); |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | static void ioh_irq_disable(struct irq_data *d) | ||
| 336 | { | ||
| 337 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
| 338 | struct ioh_gpio *chip = gc->private; | ||
| 339 | unsigned long flags; | ||
| 340 | u32 ien; | ||
| 341 | |||
| 342 | spin_lock_irqsave(&chip->spinlock, flags); | ||
| 343 | ien = ioread32(&chip->reg->regs[chip->ch].ien); | ||
| 344 | ien &= ~(1 << (d->irq - chip->irq_base)); | ||
| 345 | iowrite32(ien, &chip->reg->regs[chip->ch].ien); | ||
| 346 | spin_unlock_irqrestore(&chip->spinlock, flags); | ||
| 347 | } | ||
| 348 | |||
| 349 | static void ioh_irq_enable(struct irq_data *d) | ||
| 350 | { | ||
| 351 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
| 352 | struct ioh_gpio *chip = gc->private; | ||
| 353 | unsigned long flags; | ||
| 354 | u32 ien; | ||
| 355 | |||
| 356 | spin_lock_irqsave(&chip->spinlock, flags); | ||
| 357 | ien = ioread32(&chip->reg->regs[chip->ch].ien); | ||
| 358 | ien |= 1 << (d->irq - chip->irq_base); | ||
| 359 | iowrite32(ien, &chip->reg->regs[chip->ch].ien); | ||
| 360 | spin_unlock_irqrestore(&chip->spinlock, flags); | ||
| 361 | } | ||
| 362 | |||
| 335 | static irqreturn_t ioh_gpio_handler(int irq, void *dev_id) | 363 | static irqreturn_t ioh_gpio_handler(int irq, void *dev_id) |
| 336 | { | 364 | { |
| 337 | struct ioh_gpio *chip = dev_id; | 365 | struct ioh_gpio *chip = dev_id; |
| @@ -339,7 +367,7 @@ static irqreturn_t ioh_gpio_handler(int irq, void *dev_id) | |||
| 339 | int i, j; | 367 | int i, j; |
| 340 | int ret = IRQ_NONE; | 368 | int ret = IRQ_NONE; |
| 341 | 369 | ||
| 342 | for (i = 0; i < 8; i++) { | 370 | for (i = 0; i < 8; i++, chip++) { |
| 343 | reg_val = ioread32(&chip->reg->regs[i].istatus); | 371 | reg_val = ioread32(&chip->reg->regs[i].istatus); |
| 344 | for (j = 0; j < num_ports[i]; j++) { | 372 | for (j = 0; j < num_ports[i]; j++) { |
| 345 | if (reg_val & BIT(j)) { | 373 | if (reg_val & BIT(j)) { |
| @@ -370,6 +398,8 @@ static __devinit void ioh_gpio_alloc_generic_chip(struct ioh_gpio *chip, | |||
| 370 | ct->chip.irq_mask = ioh_irq_mask; | 398 | ct->chip.irq_mask = ioh_irq_mask; |
| 371 | ct->chip.irq_unmask = ioh_irq_unmask; | 399 | ct->chip.irq_unmask = ioh_irq_unmask; |
| 372 | ct->chip.irq_set_type = ioh_irq_type; | 400 | ct->chip.irq_set_type = ioh_irq_type; |
| 401 | ct->chip.irq_disable = ioh_irq_disable; | ||
| 402 | ct->chip.irq_enable = ioh_irq_enable; | ||
| 373 | 403 | ||
| 374 | irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, | 404 | irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, |
| 375 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); | 405 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); |
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index ec3fcf0a7e12..5cd04b65c556 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c | |||
| @@ -132,6 +132,15 @@ static int mpc8xxx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val | |||
| 132 | return 0; | 132 | return 0; |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | static int mpc5121_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) | ||
| 136 | { | ||
| 137 | /* GPIO 28..31 are input only on MPC5121 */ | ||
| 138 | if (gpio >= 28) | ||
| 139 | return -EINVAL; | ||
| 140 | |||
| 141 | return mpc8xxx_gpio_dir_out(gc, gpio, val); | ||
| 142 | } | ||
| 143 | |||
| 135 | static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset) | 144 | static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset) |
| 136 | { | 145 | { |
| 137 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); | 146 | struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); |
| @@ -340,11 +349,10 @@ static void __init mpc8xxx_add_controller(struct device_node *np) | |||
| 340 | mm_gc->save_regs = mpc8xxx_gpio_save_regs; | 349 | mm_gc->save_regs = mpc8xxx_gpio_save_regs; |
| 341 | gc->ngpio = MPC8XXX_GPIO_PINS; | 350 | gc->ngpio = MPC8XXX_GPIO_PINS; |
| 342 | gc->direction_input = mpc8xxx_gpio_dir_in; | 351 | gc->direction_input = mpc8xxx_gpio_dir_in; |
| 343 | gc->direction_output = mpc8xxx_gpio_dir_out; | 352 | gc->direction_output = of_device_is_compatible(np, "fsl,mpc5121-gpio") ? |
| 344 | if (of_device_is_compatible(np, "fsl,mpc8572-gpio")) | 353 | mpc5121_gpio_dir_out : mpc8xxx_gpio_dir_out; |
| 345 | gc->get = mpc8572_gpio_get; | 354 | gc->get = of_device_is_compatible(np, "fsl,mpc8572-gpio") ? |
| 346 | else | 355 | mpc8572_gpio_get : mpc8xxx_gpio_get; |
| 347 | gc->get = mpc8xxx_gpio_get; | ||
| 348 | gc->set = mpc8xxx_gpio_set; | 356 | gc->set = mpc8xxx_gpio_set; |
| 349 | gc->to_irq = mpc8xxx_gpio_to_irq; | 357 | gc->to_irq = mpc8xxx_gpio_to_irq; |
| 350 | 358 | ||
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 093c90bd3c1d..4102f63230fd 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c | |||
| @@ -238,10 +238,6 @@ static int pl061_probe(struct amba_device *dev, const struct amba_id *id) | |||
| 238 | int ret, irq, i; | 238 | int ret, irq, i; |
| 239 | static DECLARE_BITMAP(init_irq, NR_IRQS); | 239 | static DECLARE_BITMAP(init_irq, NR_IRQS); |
| 240 | 240 | ||
| 241 | pdata = dev->dev.platform_data; | ||
| 242 | if (pdata == NULL) | ||
| 243 | return -ENODEV; | ||
| 244 | |||
| 245 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 241 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
| 246 | if (chip == NULL) | 242 | if (chip == NULL) |
| 247 | return -ENOMEM; | 243 | return -ENOMEM; |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index d09a6e02dc95..004b048c5192 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
| @@ -62,6 +62,7 @@ static int i915_capabilities(struct seq_file *m, void *data) | |||
| 62 | const struct intel_device_info *info = INTEL_INFO(dev); | 62 | const struct intel_device_info *info = INTEL_INFO(dev); |
| 63 | 63 | ||
| 64 | seq_printf(m, "gen: %d\n", info->gen); | 64 | seq_printf(m, "gen: %d\n", info->gen); |
| 65 | seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev)); | ||
| 65 | #define B(x) seq_printf(m, #x ": %s\n", yesno(info->x)) | 66 | #define B(x) seq_printf(m, #x ": %s\n", yesno(info->x)) |
| 66 | B(is_mobile); | 67 | B(is_mobile); |
| 67 | B(is_i85x); | 68 | B(is_i85x); |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index a9533c54c93c..a9ae374861e7 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
| @@ -1454,6 +1454,14 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv) | |||
| 1454 | 1454 | ||
| 1455 | diff1 = now - dev_priv->last_time1; | 1455 | diff1 = now - dev_priv->last_time1; |
| 1456 | 1456 | ||
| 1457 | /* Prevent division-by-zero if we are asking too fast. | ||
| 1458 | * Also, we don't get interesting results if we are polling | ||
| 1459 | * faster than once in 10ms, so just return the saved value | ||
| 1460 | * in such cases. | ||
| 1461 | */ | ||
| 1462 | if (diff1 <= 10) | ||
| 1463 | return dev_priv->chipset_power; | ||
| 1464 | |||
| 1457 | count1 = I915_READ(DMIEC); | 1465 | count1 = I915_READ(DMIEC); |
| 1458 | count2 = I915_READ(DDREC); | 1466 | count2 = I915_READ(DDREC); |
| 1459 | count3 = I915_READ(CSIEC); | 1467 | count3 = I915_READ(CSIEC); |
| @@ -1484,6 +1492,8 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv) | |||
| 1484 | dev_priv->last_count1 = total_count; | 1492 | dev_priv->last_count1 = total_count; |
| 1485 | dev_priv->last_time1 = now; | 1493 | dev_priv->last_time1 = now; |
| 1486 | 1494 | ||
| 1495 | dev_priv->chipset_power = ret; | ||
| 1496 | |||
| 1487 | return ret; | 1497 | return ret; |
| 1488 | } | 1498 | } |
| 1489 | 1499 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 15bfa9145d2b..a1103fc6597d 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
| @@ -58,15 +58,15 @@ module_param_named(powersave, i915_powersave, int, 0600); | |||
| 58 | MODULE_PARM_DESC(powersave, | 58 | MODULE_PARM_DESC(powersave, |
| 59 | "Enable powersavings, fbc, downclocking, etc. (default: true)"); | 59 | "Enable powersavings, fbc, downclocking, etc. (default: true)"); |
| 60 | 60 | ||
| 61 | unsigned int i915_semaphores __read_mostly = 0; | 61 | int i915_semaphores __read_mostly = -1; |
| 62 | module_param_named(semaphores, i915_semaphores, int, 0600); | 62 | module_param_named(semaphores, i915_semaphores, int, 0600); |
| 63 | MODULE_PARM_DESC(semaphores, | 63 | MODULE_PARM_DESC(semaphores, |
| 64 | "Use semaphores for inter-ring sync (default: false)"); | 64 | "Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))"); |
| 65 | 65 | ||
| 66 | unsigned int i915_enable_rc6 __read_mostly = 0; | 66 | int i915_enable_rc6 __read_mostly = -1; |
| 67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | 67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); |
| 68 | MODULE_PARM_DESC(i915_enable_rc6, | 68 | MODULE_PARM_DESC(i915_enable_rc6, |
| 69 | "Enable power-saving render C-state 6 (default: true)"); | 69 | "Enable power-saving render C-state 6 (default: -1 (use per-chip default)"); |
| 70 | 70 | ||
| 71 | int i915_enable_fbc __read_mostly = -1; | 71 | int i915_enable_fbc __read_mostly = -1; |
| 72 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); | 72 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); |
| @@ -328,7 +328,7 @@ void intel_detect_pch(struct drm_device *dev) | |||
| 328 | } | 328 | } |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) | 331 | void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) |
| 332 | { | 332 | { |
| 333 | int count; | 333 | int count; |
| 334 | 334 | ||
| @@ -344,6 +344,22 @@ static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) | |||
| 344 | udelay(10); | 344 | udelay(10); |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv) | ||
| 348 | { | ||
| 349 | int count; | ||
| 350 | |||
| 351 | count = 0; | ||
| 352 | while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_MT_ACK) & 1)) | ||
| 353 | udelay(10); | ||
| 354 | |||
| 355 | I915_WRITE_NOTRACE(FORCEWAKE_MT, (1<<16) | 1); | ||
| 356 | POSTING_READ(FORCEWAKE_MT); | ||
| 357 | |||
| 358 | count = 0; | ||
| 359 | while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_MT_ACK) & 1) == 0) | ||
| 360 | udelay(10); | ||
| 361 | } | ||
| 362 | |||
| 347 | /* | 363 | /* |
| 348 | * Generally this is called implicitly by the register read function. However, | 364 | * Generally this is called implicitly by the register read function. However, |
| 349 | * if some sequence requires the GT to not power down then this function should | 365 | * if some sequence requires the GT to not power down then this function should |
| @@ -356,15 +372,21 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) | |||
| 356 | 372 | ||
| 357 | /* Forcewake is atomic in case we get in here without the lock */ | 373 | /* Forcewake is atomic in case we get in here without the lock */ |
| 358 | if (atomic_add_return(1, &dev_priv->forcewake_count) == 1) | 374 | if (atomic_add_return(1, &dev_priv->forcewake_count) == 1) |
| 359 | __gen6_gt_force_wake_get(dev_priv); | 375 | dev_priv->display.force_wake_get(dev_priv); |
| 360 | } | 376 | } |
| 361 | 377 | ||
| 362 | static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) | 378 | void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) |
| 363 | { | 379 | { |
| 364 | I915_WRITE_NOTRACE(FORCEWAKE, 0); | 380 | I915_WRITE_NOTRACE(FORCEWAKE, 0); |
| 365 | POSTING_READ(FORCEWAKE); | 381 | POSTING_READ(FORCEWAKE); |
| 366 | } | 382 | } |
| 367 | 383 | ||
| 384 | void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv) | ||
| 385 | { | ||
| 386 | I915_WRITE_NOTRACE(FORCEWAKE_MT, (1<<16) | 0); | ||
| 387 | POSTING_READ(FORCEWAKE_MT); | ||
| 388 | } | ||
| 389 | |||
| 368 | /* | 390 | /* |
| 369 | * see gen6_gt_force_wake_get() | 391 | * see gen6_gt_force_wake_get() |
| 370 | */ | 392 | */ |
| @@ -373,7 +395,7 @@ void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) | |||
| 373 | WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); | 395 | WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); |
| 374 | 396 | ||
| 375 | if (atomic_dec_and_test(&dev_priv->forcewake_count)) | 397 | if (atomic_dec_and_test(&dev_priv->forcewake_count)) |
| 376 | __gen6_gt_force_wake_put(dev_priv); | 398 | dev_priv->display.force_wake_put(dev_priv); |
| 377 | } | 399 | } |
| 378 | 400 | ||
| 379 | void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) | 401 | void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) |
| @@ -903,8 +925,9 @@ MODULE_LICENSE("GPL and additional rights"); | |||
| 903 | /* We give fast paths for the really cool registers */ | 925 | /* We give fast paths for the really cool registers */ |
| 904 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ | 926 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ |
| 905 | (((dev_priv)->info->gen >= 6) && \ | 927 | (((dev_priv)->info->gen >= 6) && \ |
| 906 | ((reg) < 0x40000) && \ | 928 | ((reg) < 0x40000) && \ |
| 907 | ((reg) != FORCEWAKE)) | 929 | ((reg) != FORCEWAKE) && \ |
| 930 | ((reg) != ECOBUS)) | ||
| 908 | 931 | ||
| 909 | #define __i915_read(x, y) \ | 932 | #define __i915_read(x, y) \ |
| 910 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ | 933 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 4a9c1b979804..554bef7a3b9c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
| @@ -107,6 +107,7 @@ struct opregion_header; | |||
| 107 | struct opregion_acpi; | 107 | struct opregion_acpi; |
| 108 | struct opregion_swsci; | 108 | struct opregion_swsci; |
| 109 | struct opregion_asle; | 109 | struct opregion_asle; |
| 110 | struct drm_i915_private; | ||
| 110 | 111 | ||
| 111 | struct intel_opregion { | 112 | struct intel_opregion { |
| 112 | struct opregion_header *header; | 113 | struct opregion_header *header; |
| @@ -221,6 +222,8 @@ struct drm_i915_display_funcs { | |||
| 221 | struct drm_i915_gem_object *obj); | 222 | struct drm_i915_gem_object *obj); |
| 222 | int (*update_plane)(struct drm_crtc *crtc, struct drm_framebuffer *fb, | 223 | int (*update_plane)(struct drm_crtc *crtc, struct drm_framebuffer *fb, |
| 223 | int x, int y); | 224 | int x, int y); |
| 225 | void (*force_wake_get)(struct drm_i915_private *dev_priv); | ||
| 226 | void (*force_wake_put)(struct drm_i915_private *dev_priv); | ||
| 224 | /* clock updates for mode set */ | 227 | /* clock updates for mode set */ |
| 225 | /* cursor updates */ | 228 | /* cursor updates */ |
| 226 | /* render clock increase/decrease */ | 229 | /* render clock increase/decrease */ |
| @@ -710,6 +713,7 @@ typedef struct drm_i915_private { | |||
| 710 | 713 | ||
| 711 | u64 last_count1; | 714 | u64 last_count1; |
| 712 | unsigned long last_time1; | 715 | unsigned long last_time1; |
| 716 | unsigned long chipset_power; | ||
| 713 | u64 last_count2; | 717 | u64 last_count2; |
| 714 | struct timespec last_time2; | 718 | struct timespec last_time2; |
| 715 | unsigned long gfx_power; | 719 | unsigned long gfx_power; |
| @@ -998,11 +1002,11 @@ extern int i915_max_ioctl; | |||
| 998 | extern unsigned int i915_fbpercrtc __always_unused; | 1002 | extern unsigned int i915_fbpercrtc __always_unused; |
| 999 | extern int i915_panel_ignore_lid __read_mostly; | 1003 | extern int i915_panel_ignore_lid __read_mostly; |
| 1000 | extern unsigned int i915_powersave __read_mostly; | 1004 | extern unsigned int i915_powersave __read_mostly; |
| 1001 | extern unsigned int i915_semaphores __read_mostly; | 1005 | extern int i915_semaphores __read_mostly; |
| 1002 | extern unsigned int i915_lvds_downclock __read_mostly; | 1006 | extern unsigned int i915_lvds_downclock __read_mostly; |
| 1003 | extern int i915_panel_use_ssc __read_mostly; | 1007 | extern int i915_panel_use_ssc __read_mostly; |
| 1004 | extern int i915_vbt_sdvo_panel_type __read_mostly; | 1008 | extern int i915_vbt_sdvo_panel_type __read_mostly; |
| 1005 | extern unsigned int i915_enable_rc6 __read_mostly; | 1009 | extern int i915_enable_rc6 __read_mostly; |
| 1006 | extern int i915_enable_fbc __read_mostly; | 1010 | extern int i915_enable_fbc __read_mostly; |
| 1007 | extern bool i915_enable_hangcheck __read_mostly; | 1011 | extern bool i915_enable_hangcheck __read_mostly; |
| 1008 | 1012 | ||
| @@ -1308,6 +1312,11 @@ extern void gen6_set_rps(struct drm_device *dev, u8 val); | |||
| 1308 | extern void intel_detect_pch(struct drm_device *dev); | 1312 | extern void intel_detect_pch(struct drm_device *dev); |
| 1309 | extern int intel_trans_dp_port_sel(struct drm_crtc *crtc); | 1313 | extern int intel_trans_dp_port_sel(struct drm_crtc *crtc); |
| 1310 | 1314 | ||
| 1315 | extern void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv); | ||
| 1316 | extern void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv); | ||
| 1317 | extern void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv); | ||
| 1318 | extern void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv); | ||
| 1319 | |||
| 1311 | /* overlay */ | 1320 | /* overlay */ |
| 1312 | #ifdef CONFIG_DEBUG_FS | 1321 | #ifdef CONFIG_DEBUG_FS |
| 1313 | extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev); | 1322 | extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev); |
| @@ -1352,8 +1361,9 @@ void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv); | |||
| 1352 | /* We give fast paths for the really cool registers */ | 1361 | /* We give fast paths for the really cool registers */ |
| 1353 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ | 1362 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ |
| 1354 | (((dev_priv)->info->gen >= 6) && \ | 1363 | (((dev_priv)->info->gen >= 6) && \ |
| 1355 | ((reg) < 0x40000) && \ | 1364 | ((reg) < 0x40000) && \ |
| 1356 | ((reg) != FORCEWAKE)) | 1365 | ((reg) != FORCEWAKE) && \ |
| 1366 | ((reg) != ECOBUS)) | ||
| 1357 | 1367 | ||
| 1358 | #define __i915_read(x, y) \ | 1368 | #define __i915_read(x, y) \ |
| 1359 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg); | 1369 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg); |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 3693e83a97f3..c681dc149d2a 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include "i915_drv.h" | 32 | #include "i915_drv.h" |
| 33 | #include "i915_trace.h" | 33 | #include "i915_trace.h" |
| 34 | #include "intel_drv.h" | 34 | #include "intel_drv.h" |
| 35 | #include <linux/dma_remapping.h> | ||
| 35 | 36 | ||
| 36 | struct change_domains { | 37 | struct change_domains { |
| 37 | uint32_t invalidate_domains; | 38 | uint32_t invalidate_domains; |
| @@ -746,6 +747,22 @@ i915_gem_execbuffer_flush(struct drm_device *dev, | |||
| 746 | return 0; | 747 | return 0; |
| 747 | } | 748 | } |
| 748 | 749 | ||
| 750 | static bool | ||
| 751 | intel_enable_semaphores(struct drm_device *dev) | ||
| 752 | { | ||
| 753 | if (INTEL_INFO(dev)->gen < 6) | ||
| 754 | return 0; | ||
| 755 | |||
| 756 | if (i915_semaphores >= 0) | ||
| 757 | return i915_semaphores; | ||
| 758 | |||
| 759 | /* Enable semaphores on SNB when IO remapping is off */ | ||
| 760 | if (INTEL_INFO(dev)->gen == 6) | ||
| 761 | return !intel_iommu_enabled; | ||
| 762 | |||
| 763 | return 1; | ||
| 764 | } | ||
| 765 | |||
| 749 | static int | 766 | static int |
| 750 | i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, | 767 | i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, |
| 751 | struct intel_ring_buffer *to) | 768 | struct intel_ring_buffer *to) |
| @@ -758,7 +775,7 @@ i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, | |||
| 758 | return 0; | 775 | return 0; |
| 759 | 776 | ||
| 760 | /* XXX gpu semaphores are implicated in various hard hangs on SNB */ | 777 | /* XXX gpu semaphores are implicated in various hard hangs on SNB */ |
| 761 | if (INTEL_INFO(obj->base.dev)->gen < 6 || !i915_semaphores) | 778 | if (!intel_enable_semaphores(obj->base.dev)) |
| 762 | return i915_gem_object_wait_rendering(obj); | 779 | return i915_gem_object_wait_rendering(obj); |
| 763 | 780 | ||
| 764 | idx = intel_ring_sync_index(from, to); | 781 | idx = intel_ring_sync_index(from, to); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index b080cc824001..a26d5b0a3690 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
| @@ -3303,10 +3303,10 @@ | |||
| 3303 | /* or SDVOB */ | 3303 | /* or SDVOB */ |
| 3304 | #define HDMIB 0xe1140 | 3304 | #define HDMIB 0xe1140 |
| 3305 | #define PORT_ENABLE (1 << 31) | 3305 | #define PORT_ENABLE (1 << 31) |
| 3306 | #define TRANSCODER_A (0) | 3306 | #define TRANSCODER(pipe) ((pipe) << 30) |
| 3307 | #define TRANSCODER_B (1 << 30) | 3307 | #define TRANSCODER_CPT(pipe) ((pipe) << 29) |
| 3308 | #define TRANSCODER(pipe) ((pipe) << 30) | 3308 | #define TRANSCODER_MASK (1 << 30) |
| 3309 | #define TRANSCODER_MASK (1 << 30) | 3309 | #define TRANSCODER_MASK_CPT (3 << 29) |
| 3310 | #define COLOR_FORMAT_8bpc (0) | 3310 | #define COLOR_FORMAT_8bpc (0) |
| 3311 | #define COLOR_FORMAT_12bpc (3 << 26) | 3311 | #define COLOR_FORMAT_12bpc (3 << 26) |
| 3312 | #define SDVOB_HOTPLUG_ENABLE (1 << 23) | 3312 | #define SDVOB_HOTPLUG_ENABLE (1 << 23) |
| @@ -3447,8 +3447,30 @@ | |||
| 3447 | #define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22) | 3447 | #define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22) |
| 3448 | #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22) | 3448 | #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22) |
| 3449 | 3449 | ||
| 3450 | /* IVB */ | ||
| 3451 | #define EDP_LINK_TRAIN_400MV_0DB_IVB (0x24 <<22) | ||
| 3452 | #define EDP_LINK_TRAIN_400MV_3_5DB_IVB (0x2a <<22) | ||
| 3453 | #define EDP_LINK_TRAIN_400MV_6DB_IVB (0x2f <<22) | ||
| 3454 | #define EDP_LINK_TRAIN_600MV_0DB_IVB (0x30 <<22) | ||
| 3455 | #define EDP_LINK_TRAIN_600MV_3_5DB_IVB (0x36 <<22) | ||
| 3456 | #define EDP_LINK_TRAIN_800MV_0DB_IVB (0x38 <<22) | ||
| 3457 | #define EDP_LINK_TRAIN_800MV_3_5DB_IVB (0x33 <<22) | ||
| 3458 | |||
| 3459 | /* legacy values */ | ||
| 3460 | #define EDP_LINK_TRAIN_500MV_0DB_IVB (0x00 <<22) | ||
| 3461 | #define EDP_LINK_TRAIN_1000MV_0DB_IVB (0x20 <<22) | ||
| 3462 | #define EDP_LINK_TRAIN_500MV_3_5DB_IVB (0x02 <<22) | ||
| 3463 | #define EDP_LINK_TRAIN_1000MV_3_5DB_IVB (0x22 <<22) | ||
| 3464 | #define EDP_LINK_TRAIN_1000MV_6DB_IVB (0x23 <<22) | ||
| 3465 | |||
| 3466 | #define EDP_LINK_TRAIN_VOL_EMP_MASK_IVB (0x3f<<22) | ||
| 3467 | |||
| 3450 | #define FORCEWAKE 0xA18C | 3468 | #define FORCEWAKE 0xA18C |
| 3451 | #define FORCEWAKE_ACK 0x130090 | 3469 | #define FORCEWAKE_ACK 0x130090 |
| 3470 | #define FORCEWAKE_MT 0xa188 /* multi-threaded */ | ||
| 3471 | #define FORCEWAKE_MT_ACK 0x130040 | ||
| 3472 | #define ECOBUS 0xa180 | ||
| 3473 | #define FORCEWAKE_MT_ENABLE (1<<5) | ||
| 3452 | 3474 | ||
| 3453 | #define GT_FIFO_FREE_ENTRIES 0x120008 | 3475 | #define GT_FIFO_FREE_ENTRIES 0x120008 |
| 3454 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 | 3476 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e77a863a3833..d809b038ca88 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -38,8 +38,8 @@ | |||
| 38 | #include "i915_drv.h" | 38 | #include "i915_drv.h" |
| 39 | #include "i915_trace.h" | 39 | #include "i915_trace.h" |
| 40 | #include "drm_dp_helper.h" | 40 | #include "drm_dp_helper.h" |
| 41 | |||
| 42 | #include "drm_crtc_helper.h" | 41 | #include "drm_crtc_helper.h" |
| 42 | #include <linux/dma_remapping.h> | ||
| 43 | 43 | ||
| 44 | #define HAS_eDP (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) | 44 | #define HAS_eDP (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) |
| 45 | 45 | ||
| @@ -4670,6 +4670,7 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) | |||
| 4670 | /** | 4670 | /** |
| 4671 | * intel_choose_pipe_bpp_dither - figure out what color depth the pipe should send | 4671 | * intel_choose_pipe_bpp_dither - figure out what color depth the pipe should send |
| 4672 | * @crtc: CRTC structure | 4672 | * @crtc: CRTC structure |
| 4673 | * @mode: requested mode | ||
| 4673 | * | 4674 | * |
| 4674 | * A pipe may be connected to one or more outputs. Based on the depth of the | 4675 | * A pipe may be connected to one or more outputs. Based on the depth of the |
| 4675 | * attached framebuffer, choose a good color depth to use on the pipe. | 4676 | * attached framebuffer, choose a good color depth to use on the pipe. |
| @@ -4681,13 +4682,15 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) | |||
| 4681 | * HDMI supports only 8bpc or 12bpc, so clamp to 8bpc with dither for 10bpc | 4682 | * HDMI supports only 8bpc or 12bpc, so clamp to 8bpc with dither for 10bpc |
| 4682 | * Displays may support a restricted set as well, check EDID and clamp as | 4683 | * Displays may support a restricted set as well, check EDID and clamp as |
| 4683 | * appropriate. | 4684 | * appropriate. |
| 4685 | * DP may want to dither down to 6bpc to fit larger modes | ||
| 4684 | * | 4686 | * |
| 4685 | * RETURNS: | 4687 | * RETURNS: |
| 4686 | * Dithering requirement (i.e. false if display bpc and pipe bpc match, | 4688 | * Dithering requirement (i.e. false if display bpc and pipe bpc match, |
| 4687 | * true if they don't match). | 4689 | * true if they don't match). |
| 4688 | */ | 4690 | */ |
| 4689 | static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | 4691 | static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, |
| 4690 | unsigned int *pipe_bpp) | 4692 | unsigned int *pipe_bpp, |
| 4693 | struct drm_display_mode *mode) | ||
| 4691 | { | 4694 | { |
| 4692 | struct drm_device *dev = crtc->dev; | 4695 | struct drm_device *dev = crtc->dev; |
| 4693 | struct drm_i915_private *dev_priv = dev->dev_private; | 4696 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -4758,6 +4761,11 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, | |||
| 4758 | } | 4761 | } |
| 4759 | } | 4762 | } |
| 4760 | 4763 | ||
| 4764 | if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { | ||
| 4765 | DRM_DEBUG_KMS("Dithering DP to 6bpc\n"); | ||
| 4766 | display_bpc = 6; | ||
| 4767 | } | ||
| 4768 | |||
| 4761 | /* | 4769 | /* |
| 4762 | * We could just drive the pipe at the highest bpc all the time and | 4770 | * We could just drive the pipe at the highest bpc all the time and |
| 4763 | * enable dithering as needed, but that costs bandwidth. So choose | 4771 | * enable dithering as needed, but that costs bandwidth. So choose |
| @@ -5019,6 +5027,16 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
| 5019 | pipeconf &= ~PIPECONF_DOUBLE_WIDE; | 5027 | pipeconf &= ~PIPECONF_DOUBLE_WIDE; |
| 5020 | } | 5028 | } |
| 5021 | 5029 | ||
| 5030 | /* default to 8bpc */ | ||
| 5031 | pipeconf &= ~(PIPECONF_BPP_MASK | PIPECONF_DITHER_EN); | ||
| 5032 | if (is_dp) { | ||
| 5033 | if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { | ||
| 5034 | pipeconf |= PIPECONF_BPP_6 | | ||
| 5035 | PIPECONF_DITHER_EN | | ||
| 5036 | PIPECONF_DITHER_TYPE_SP; | ||
| 5037 | } | ||
| 5038 | } | ||
| 5039 | |||
| 5022 | dpll |= DPLL_VCO_ENABLE; | 5040 | dpll |= DPLL_VCO_ENABLE; |
| 5023 | 5041 | ||
| 5024 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); | 5042 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); |
| @@ -5480,7 +5498,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
| 5480 | /* determine panel color depth */ | 5498 | /* determine panel color depth */ |
| 5481 | temp = I915_READ(PIPECONF(pipe)); | 5499 | temp = I915_READ(PIPECONF(pipe)); |
| 5482 | temp &= ~PIPE_BPC_MASK; | 5500 | temp &= ~PIPE_BPC_MASK; |
| 5483 | dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp); | 5501 | dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp, mode); |
| 5484 | switch (pipe_bpp) { | 5502 | switch (pipe_bpp) { |
| 5485 | case 18: | 5503 | case 18: |
| 5486 | temp |= PIPE_6BPC; | 5504 | temp |= PIPE_6BPC; |
| @@ -7189,11 +7207,16 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
| 7189 | work->old_fb_obj = intel_fb->obj; | 7207 | work->old_fb_obj = intel_fb->obj; |
| 7190 | INIT_WORK(&work->work, intel_unpin_work_fn); | 7208 | INIT_WORK(&work->work, intel_unpin_work_fn); |
| 7191 | 7209 | ||
| 7210 | ret = drm_vblank_get(dev, intel_crtc->pipe); | ||
| 7211 | if (ret) | ||
| 7212 | goto free_work; | ||
| 7213 | |||
| 7192 | /* We borrow the event spin lock for protecting unpin_work */ | 7214 | /* We borrow the event spin lock for protecting unpin_work */ |
| 7193 | spin_lock_irqsave(&dev->event_lock, flags); | 7215 | spin_lock_irqsave(&dev->event_lock, flags); |
| 7194 | if (intel_crtc->unpin_work) { | 7216 | if (intel_crtc->unpin_work) { |
| 7195 | spin_unlock_irqrestore(&dev->event_lock, flags); | 7217 | spin_unlock_irqrestore(&dev->event_lock, flags); |
| 7196 | kfree(work); | 7218 | kfree(work); |
| 7219 | drm_vblank_put(dev, intel_crtc->pipe); | ||
| 7197 | 7220 | ||
| 7198 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); | 7221 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); |
| 7199 | return -EBUSY; | 7222 | return -EBUSY; |
| @@ -7212,10 +7235,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
| 7212 | 7235 | ||
| 7213 | crtc->fb = fb; | 7236 | crtc->fb = fb; |
| 7214 | 7237 | ||
| 7215 | ret = drm_vblank_get(dev, intel_crtc->pipe); | ||
| 7216 | if (ret) | ||
| 7217 | goto cleanup_objs; | ||
| 7218 | |||
| 7219 | work->pending_flip_obj = obj; | 7238 | work->pending_flip_obj = obj; |
| 7220 | 7239 | ||
| 7221 | work->enable_stall_check = true; | 7240 | work->enable_stall_check = true; |
| @@ -7238,7 +7257,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
| 7238 | 7257 | ||
| 7239 | cleanup_pending: | 7258 | cleanup_pending: |
| 7240 | atomic_sub(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip); | 7259 | atomic_sub(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip); |
| 7241 | cleanup_objs: | ||
| 7242 | drm_gem_object_unreference(&work->old_fb_obj->base); | 7260 | drm_gem_object_unreference(&work->old_fb_obj->base); |
| 7243 | drm_gem_object_unreference(&obj->base); | 7261 | drm_gem_object_unreference(&obj->base); |
| 7244 | mutex_unlock(&dev->struct_mutex); | 7262 | mutex_unlock(&dev->struct_mutex); |
| @@ -7247,6 +7265,8 @@ cleanup_objs: | |||
| 7247 | intel_crtc->unpin_work = NULL; | 7265 | intel_crtc->unpin_work = NULL; |
| 7248 | spin_unlock_irqrestore(&dev->event_lock, flags); | 7266 | spin_unlock_irqrestore(&dev->event_lock, flags); |
| 7249 | 7267 | ||
| 7268 | drm_vblank_put(dev, intel_crtc->pipe); | ||
| 7269 | free_work: | ||
| 7250 | kfree(work); | 7270 | kfree(work); |
| 7251 | 7271 | ||
| 7252 | return ret; | 7272 | return ret; |
| @@ -7887,6 +7907,33 @@ void intel_init_emon(struct drm_device *dev) | |||
| 7887 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); | 7907 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); |
| 7888 | } | 7908 | } |
| 7889 | 7909 | ||
| 7910 | static bool intel_enable_rc6(struct drm_device *dev) | ||
| 7911 | { | ||
| 7912 | /* | ||
| 7913 | * Respect the kernel parameter if it is set | ||
| 7914 | */ | ||
| 7915 | if (i915_enable_rc6 >= 0) | ||
| 7916 | return i915_enable_rc6; | ||
| 7917 | |||
| 7918 | /* | ||
| 7919 | * Disable RC6 on Ironlake | ||
| 7920 | */ | ||
| 7921 | if (INTEL_INFO(dev)->gen == 5) | ||
| 7922 | return 0; | ||
| 7923 | |||
| 7924 | /* | ||
| 7925 | * Enable rc6 on Sandybridge if DMA remapping is disabled | ||
| 7926 | */ | ||
| 7927 | if (INTEL_INFO(dev)->gen == 6) { | ||
| 7928 | DRM_DEBUG_DRIVER("Sandybridge: intel_iommu_enabled %s -- RC6 %sabled\n", | ||
| 7929 | intel_iommu_enabled ? "true" : "false", | ||
| 7930 | !intel_iommu_enabled ? "en" : "dis"); | ||
| 7931 | return !intel_iommu_enabled; | ||
| 7932 | } | ||
| 7933 | DRM_DEBUG_DRIVER("RC6 enabled\n"); | ||
| 7934 | return 1; | ||
| 7935 | } | ||
| 7936 | |||
| 7890 | void gen6_enable_rps(struct drm_i915_private *dev_priv) | 7937 | void gen6_enable_rps(struct drm_i915_private *dev_priv) |
| 7891 | { | 7938 | { |
| 7892 | u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); | 7939 | u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP); |
| @@ -7923,7 +7970,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) | |||
| 7923 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); | 7970 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); |
| 7924 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ | 7971 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ |
| 7925 | 7972 | ||
| 7926 | if (i915_enable_rc6) | 7973 | if (intel_enable_rc6(dev_priv->dev)) |
| 7927 | rc6_mask = GEN6_RC_CTL_RC6p_ENABLE | | 7974 | rc6_mask = GEN6_RC_CTL_RC6p_ENABLE | |
| 7928 | GEN6_RC_CTL_RC6_ENABLE; | 7975 | GEN6_RC_CTL_RC6_ENABLE; |
| 7929 | 7976 | ||
| @@ -8372,7 +8419,7 @@ void ironlake_enable_rc6(struct drm_device *dev) | |||
| 8372 | /* rc6 disabled by default due to repeated reports of hanging during | 8419 | /* rc6 disabled by default due to repeated reports of hanging during |
| 8373 | * boot and resume. | 8420 | * boot and resume. |
| 8374 | */ | 8421 | */ |
| 8375 | if (!i915_enable_rc6) | 8422 | if (!intel_enable_rc6(dev)) |
| 8376 | return; | 8423 | return; |
| 8377 | 8424 | ||
| 8378 | mutex_lock(&dev->struct_mutex); | 8425 | mutex_lock(&dev->struct_mutex); |
| @@ -8491,6 +8538,28 @@ static void intel_init_display(struct drm_device *dev) | |||
| 8491 | 8538 | ||
| 8492 | /* For FIFO watermark updates */ | 8539 | /* For FIFO watermark updates */ |
| 8493 | if (HAS_PCH_SPLIT(dev)) { | 8540 | if (HAS_PCH_SPLIT(dev)) { |
| 8541 | dev_priv->display.force_wake_get = __gen6_gt_force_wake_get; | ||
| 8542 | dev_priv->display.force_wake_put = __gen6_gt_force_wake_put; | ||
| 8543 | |||
| 8544 | /* IVB configs may use multi-threaded forcewake */ | ||
| 8545 | if (IS_IVYBRIDGE(dev)) { | ||
| 8546 | u32 ecobus; | ||
| 8547 | |||
| 8548 | mutex_lock(&dev->struct_mutex); | ||
| 8549 | __gen6_gt_force_wake_mt_get(dev_priv); | ||
| 8550 | ecobus = I915_READ(ECOBUS); | ||
| 8551 | __gen6_gt_force_wake_mt_put(dev_priv); | ||
| 8552 | mutex_unlock(&dev->struct_mutex); | ||
| 8553 | |||
| 8554 | if (ecobus & FORCEWAKE_MT_ENABLE) { | ||
| 8555 | DRM_DEBUG_KMS("Using MT version of forcewake\n"); | ||
| 8556 | dev_priv->display.force_wake_get = | ||
| 8557 | __gen6_gt_force_wake_mt_get; | ||
| 8558 | dev_priv->display.force_wake_put = | ||
| 8559 | __gen6_gt_force_wake_mt_put; | ||
| 8560 | } | ||
| 8561 | } | ||
| 8562 | |||
| 8494 | if (HAS_PCH_IBX(dev)) | 8563 | if (HAS_PCH_IBX(dev)) |
| 8495 | dev_priv->display.init_pch_clock_gating = ibx_init_clock_gating; | 8564 | dev_priv->display.init_pch_clock_gating = ibx_init_clock_gating; |
| 8496 | else if (HAS_PCH_CPT(dev)) | 8565 | else if (HAS_PCH_CPT(dev)) |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 4d0358fad937..92b041b66e49 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -208,13 +208,15 @@ intel_dp_link_clock(uint8_t link_bw) | |||
| 208 | */ | 208 | */ |
| 209 | 209 | ||
| 210 | static int | 210 | static int |
| 211 | intel_dp_link_required(struct intel_dp *intel_dp, int pixel_clock) | 211 | intel_dp_link_required(struct intel_dp *intel_dp, int pixel_clock, int check_bpp) |
| 212 | { | 212 | { |
| 213 | struct drm_crtc *crtc = intel_dp->base.base.crtc; | 213 | struct drm_crtc *crtc = intel_dp->base.base.crtc; |
| 214 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 214 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 215 | int bpp = 24; | 215 | int bpp = 24; |
| 216 | 216 | ||
| 217 | if (intel_crtc) | 217 | if (check_bpp) |
| 218 | bpp = check_bpp; | ||
| 219 | else if (intel_crtc) | ||
| 218 | bpp = intel_crtc->bpp; | 220 | bpp = intel_crtc->bpp; |
| 219 | 221 | ||
| 220 | return (pixel_clock * bpp + 9) / 10; | 222 | return (pixel_clock * bpp + 9) / 10; |
| @@ -233,6 +235,7 @@ intel_dp_mode_valid(struct drm_connector *connector, | |||
| 233 | struct intel_dp *intel_dp = intel_attached_dp(connector); | 235 | struct intel_dp *intel_dp = intel_attached_dp(connector); |
| 234 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); | 236 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); |
| 235 | int max_lanes = intel_dp_max_lane_count(intel_dp); | 237 | int max_lanes = intel_dp_max_lane_count(intel_dp); |
| 238 | int max_rate, mode_rate; | ||
| 236 | 239 | ||
| 237 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 240 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
| 238 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) | 241 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) |
| @@ -242,9 +245,17 @@ intel_dp_mode_valid(struct drm_connector *connector, | |||
| 242 | return MODE_PANEL; | 245 | return MODE_PANEL; |
| 243 | } | 246 | } |
| 244 | 247 | ||
| 245 | if (intel_dp_link_required(intel_dp, mode->clock) | 248 | mode_rate = intel_dp_link_required(intel_dp, mode->clock, 0); |
| 246 | > intel_dp_max_data_rate(max_link_clock, max_lanes)) | 249 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); |
| 247 | return MODE_CLOCK_HIGH; | 250 | |
| 251 | if (mode_rate > max_rate) { | ||
| 252 | mode_rate = intel_dp_link_required(intel_dp, | ||
| 253 | mode->clock, 18); | ||
| 254 | if (mode_rate > max_rate) | ||
| 255 | return MODE_CLOCK_HIGH; | ||
| 256 | else | ||
| 257 | mode->private_flags |= INTEL_MODE_DP_FORCE_6BPC; | ||
| 258 | } | ||
| 248 | 259 | ||
| 249 | if (mode->clock < 10000) | 260 | if (mode->clock < 10000) |
| 250 | return MODE_CLOCK_LOW; | 261 | return MODE_CLOCK_LOW; |
| @@ -362,8 +373,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, | |||
| 362 | * clock divider. | 373 | * clock divider. |
| 363 | */ | 374 | */ |
| 364 | if (is_cpu_edp(intel_dp)) { | 375 | if (is_cpu_edp(intel_dp)) { |
| 365 | if (IS_GEN6(dev)) | 376 | if (IS_GEN6(dev) || IS_GEN7(dev)) |
| 366 | aux_clock_divider = 200; /* SNB eDP input clock at 400Mhz */ | 377 | aux_clock_divider = 200; /* SNB & IVB eDP input clock at 400Mhz */ |
| 367 | else | 378 | else |
| 368 | aux_clock_divider = 225; /* eDP input clock at 450Mhz */ | 379 | aux_clock_divider = 225; /* eDP input clock at 450Mhz */ |
| 369 | } else if (HAS_PCH_SPLIT(dev)) | 380 | } else if (HAS_PCH_SPLIT(dev)) |
| @@ -672,6 +683,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
| 672 | int lane_count, clock; | 683 | int lane_count, clock; |
| 673 | int max_lane_count = intel_dp_max_lane_count(intel_dp); | 684 | int max_lane_count = intel_dp_max_lane_count(intel_dp); |
| 674 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; | 685 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; |
| 686 | int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 0; | ||
| 675 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; | 687 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; |
| 676 | 688 | ||
| 677 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 689 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
| @@ -689,7 +701,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
| 689 | for (clock = 0; clock <= max_clock; clock++) { | 701 | for (clock = 0; clock <= max_clock; clock++) { |
| 690 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); | 702 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); |
| 691 | 703 | ||
| 692 | if (intel_dp_link_required(intel_dp, mode->clock) | 704 | if (intel_dp_link_required(intel_dp, mode->clock, bpp) |
| 693 | <= link_avail) { | 705 | <= link_avail) { |
| 694 | intel_dp->link_bw = bws[clock]; | 706 | intel_dp->link_bw = bws[clock]; |
| 695 | intel_dp->lane_count = lane_count; | 707 | intel_dp->lane_count = lane_count; |
| @@ -817,10 +829,11 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
| 817 | } | 829 | } |
| 818 | 830 | ||
| 819 | /* | 831 | /* |
| 820 | * There are three kinds of DP registers: | 832 | * There are four kinds of DP registers: |
| 821 | * | 833 | * |
| 822 | * IBX PCH | 834 | * IBX PCH |
| 823 | * CPU | 835 | * SNB CPU |
| 836 | * IVB CPU | ||
| 824 | * CPT PCH | 837 | * CPT PCH |
| 825 | * | 838 | * |
| 826 | * IBX PCH and CPU are the same for almost everything, | 839 | * IBX PCH and CPU are the same for almost everything, |
| @@ -873,7 +886,25 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
| 873 | 886 | ||
| 874 | /* Split out the IBX/CPU vs CPT settings */ | 887 | /* Split out the IBX/CPU vs CPT settings */ |
| 875 | 888 | ||
| 876 | if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) { | 889 | if (is_cpu_edp(intel_dp) && IS_GEN7(dev)) { |
| 890 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | ||
| 891 | intel_dp->DP |= DP_SYNC_HS_HIGH; | ||
| 892 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | ||
| 893 | intel_dp->DP |= DP_SYNC_VS_HIGH; | ||
| 894 | intel_dp->DP |= DP_LINK_TRAIN_OFF_CPT; | ||
| 895 | |||
| 896 | if (intel_dp->link_configuration[1] & DP_LANE_COUNT_ENHANCED_FRAME_EN) | ||
| 897 | intel_dp->DP |= DP_ENHANCED_FRAMING; | ||
| 898 | |||
| 899 | intel_dp->DP |= intel_crtc->pipe << 29; | ||
| 900 | |||
| 901 | /* don't miss out required setting for eDP */ | ||
| 902 | intel_dp->DP |= DP_PLL_ENABLE; | ||
| 903 | if (adjusted_mode->clock < 200000) | ||
| 904 | intel_dp->DP |= DP_PLL_FREQ_160MHZ; | ||
| 905 | else | ||
| 906 | intel_dp->DP |= DP_PLL_FREQ_270MHZ; | ||
| 907 | } else if (!HAS_PCH_CPT(dev) || is_cpu_edp(intel_dp)) { | ||
| 877 | intel_dp->DP |= intel_dp->color_range; | 908 | intel_dp->DP |= intel_dp->color_range; |
| 878 | 909 | ||
| 879 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 910 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
| @@ -1375,34 +1406,59 @@ static char *link_train_names[] = { | |||
| 1375 | * These are source-specific values; current Intel hardware supports | 1406 | * These are source-specific values; current Intel hardware supports |
| 1376 | * a maximum voltage of 800mV and a maximum pre-emphasis of 6dB | 1407 | * a maximum voltage of 800mV and a maximum pre-emphasis of 6dB |
| 1377 | */ | 1408 | */ |
| 1378 | #define I830_DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_800 | ||
| 1379 | #define I830_DP_VOLTAGE_MAX_CPT DP_TRAIN_VOLTAGE_SWING_1200 | ||
| 1380 | 1409 | ||
| 1381 | static uint8_t | 1410 | static uint8_t |
| 1382 | intel_dp_pre_emphasis_max(uint8_t voltage_swing) | 1411 | intel_dp_voltage_max(struct intel_dp *intel_dp) |
| 1383 | { | 1412 | { |
| 1384 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | 1413 | struct drm_device *dev = intel_dp->base.base.dev; |
| 1385 | case DP_TRAIN_VOLTAGE_SWING_400: | 1414 | |
| 1386 | return DP_TRAIN_PRE_EMPHASIS_6; | 1415 | if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) |
| 1387 | case DP_TRAIN_VOLTAGE_SWING_600: | 1416 | return DP_TRAIN_VOLTAGE_SWING_800; |
| 1388 | return DP_TRAIN_PRE_EMPHASIS_6; | 1417 | else if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) |
| 1389 | case DP_TRAIN_VOLTAGE_SWING_800: | 1418 | return DP_TRAIN_VOLTAGE_SWING_1200; |
| 1390 | return DP_TRAIN_PRE_EMPHASIS_3_5; | 1419 | else |
| 1391 | case DP_TRAIN_VOLTAGE_SWING_1200: | 1420 | return DP_TRAIN_VOLTAGE_SWING_800; |
| 1392 | default: | 1421 | } |
| 1393 | return DP_TRAIN_PRE_EMPHASIS_0; | 1422 | |
| 1423 | static uint8_t | ||
| 1424 | intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing) | ||
| 1425 | { | ||
| 1426 | struct drm_device *dev = intel_dp->base.base.dev; | ||
| 1427 | |||
| 1428 | if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) { | ||
| 1429 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | ||
| 1430 | case DP_TRAIN_VOLTAGE_SWING_400: | ||
| 1431 | return DP_TRAIN_PRE_EMPHASIS_6; | ||
| 1432 | case DP_TRAIN_VOLTAGE_SWING_600: | ||
| 1433 | case DP_TRAIN_VOLTAGE_SWING_800: | ||
| 1434 | return DP_TRAIN_PRE_EMPHASIS_3_5; | ||
| 1435 | default: | ||
| 1436 | return DP_TRAIN_PRE_EMPHASIS_0; | ||
| 1437 | } | ||
| 1438 | } else { | ||
| 1439 | switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { | ||
| 1440 | case DP_TRAIN_VOLTAGE_SWING_400: | ||
| 1441 | return DP_TRAIN_PRE_EMPHASIS_6; | ||
| 1442 | case DP_TRAIN_VOLTAGE_SWING_600: | ||
| 1443 | return DP_TRAIN_PRE_EMPHASIS_6; | ||
| 1444 | case DP_TRAIN_VOLTAGE_SWING_800: | ||
| 1445 | return DP_TRAIN_PRE_EMPHASIS_3_5; | ||
| 1446 | case DP_TRAIN_VOLTAGE_SWING_1200: | ||
| 1447 | default: | ||
| 1448 | return DP_TRAIN_PRE_EMPHASIS_0; | ||
| 1449 | } | ||
| 1394 | } | 1450 | } |
| 1395 | } | 1451 | } |
| 1396 | 1452 | ||
| 1397 | static void | 1453 | static void |
| 1398 | intel_get_adjust_train(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]) | 1454 | intel_get_adjust_train(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]) |
| 1399 | { | 1455 | { |
| 1400 | struct drm_device *dev = intel_dp->base.base.dev; | ||
| 1401 | uint8_t v = 0; | 1456 | uint8_t v = 0; |
| 1402 | uint8_t p = 0; | 1457 | uint8_t p = 0; |
| 1403 | int lane; | 1458 | int lane; |
| 1404 | uint8_t *adjust_request = link_status + (DP_ADJUST_REQUEST_LANE0_1 - DP_LANE0_1_STATUS); | 1459 | uint8_t *adjust_request = link_status + (DP_ADJUST_REQUEST_LANE0_1 - DP_LANE0_1_STATUS); |
| 1405 | int voltage_max; | 1460 | uint8_t voltage_max; |
| 1461 | uint8_t preemph_max; | ||
| 1406 | 1462 | ||
| 1407 | for (lane = 0; lane < intel_dp->lane_count; lane++) { | 1463 | for (lane = 0; lane < intel_dp->lane_count; lane++) { |
| 1408 | uint8_t this_v = intel_get_adjust_request_voltage(adjust_request, lane); | 1464 | uint8_t this_v = intel_get_adjust_request_voltage(adjust_request, lane); |
| @@ -1414,15 +1470,13 @@ intel_get_adjust_train(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_ST | |||
| 1414 | p = this_p; | 1470 | p = this_p; |
| 1415 | } | 1471 | } |
| 1416 | 1472 | ||
| 1417 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1473 | voltage_max = intel_dp_voltage_max(intel_dp); |
| 1418 | voltage_max = I830_DP_VOLTAGE_MAX_CPT; | ||
| 1419 | else | ||
| 1420 | voltage_max = I830_DP_VOLTAGE_MAX; | ||
| 1421 | if (v >= voltage_max) | 1474 | if (v >= voltage_max) |
| 1422 | v = voltage_max | DP_TRAIN_MAX_SWING_REACHED; | 1475 | v = voltage_max | DP_TRAIN_MAX_SWING_REACHED; |
| 1423 | 1476 | ||
| 1424 | if (p >= intel_dp_pre_emphasis_max(v)) | 1477 | preemph_max = intel_dp_pre_emphasis_max(intel_dp, v); |
| 1425 | p = intel_dp_pre_emphasis_max(v) | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED; | 1478 | if (p >= preemph_max) |
| 1479 | p = preemph_max | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED; | ||
| 1426 | 1480 | ||
| 1427 | for (lane = 0; lane < 4; lane++) | 1481 | for (lane = 0; lane < 4; lane++) |
| 1428 | intel_dp->train_set[lane] = v | p; | 1482 | intel_dp->train_set[lane] = v | p; |
| @@ -1494,6 +1548,37 @@ intel_gen6_edp_signal_levels(uint8_t train_set) | |||
| 1494 | } | 1548 | } |
| 1495 | } | 1549 | } |
| 1496 | 1550 | ||
| 1551 | /* Gen7's DP voltage swing and pre-emphasis control */ | ||
| 1552 | static uint32_t | ||
| 1553 | intel_gen7_edp_signal_levels(uint8_t train_set) | ||
| 1554 | { | ||
| 1555 | int signal_levels = train_set & (DP_TRAIN_VOLTAGE_SWING_MASK | | ||
| 1556 | DP_TRAIN_PRE_EMPHASIS_MASK); | ||
| 1557 | switch (signal_levels) { | ||
| 1558 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0: | ||
| 1559 | return EDP_LINK_TRAIN_400MV_0DB_IVB; | ||
| 1560 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
| 1561 | return EDP_LINK_TRAIN_400MV_3_5DB_IVB; | ||
| 1562 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6: | ||
| 1563 | return EDP_LINK_TRAIN_400MV_6DB_IVB; | ||
| 1564 | |||
| 1565 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_0: | ||
| 1566 | return EDP_LINK_TRAIN_600MV_0DB_IVB; | ||
| 1567 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
| 1568 | return EDP_LINK_TRAIN_600MV_3_5DB_IVB; | ||
| 1569 | |||
| 1570 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0: | ||
| 1571 | return EDP_LINK_TRAIN_800MV_0DB_IVB; | ||
| 1572 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
| 1573 | return EDP_LINK_TRAIN_800MV_3_5DB_IVB; | ||
| 1574 | |||
| 1575 | default: | ||
| 1576 | DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level:" | ||
| 1577 | "0x%x\n", signal_levels); | ||
| 1578 | return EDP_LINK_TRAIN_500MV_0DB_IVB; | ||
| 1579 | } | ||
| 1580 | } | ||
| 1581 | |||
| 1497 | static uint8_t | 1582 | static uint8_t |
| 1498 | intel_get_lane_status(uint8_t link_status[DP_LINK_STATUS_SIZE], | 1583 | intel_get_lane_status(uint8_t link_status[DP_LINK_STATUS_SIZE], |
| 1499 | int lane) | 1584 | int lane) |
| @@ -1599,7 +1684,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
| 1599 | DP_LINK_CONFIGURATION_SIZE); | 1684 | DP_LINK_CONFIGURATION_SIZE); |
| 1600 | 1685 | ||
| 1601 | DP |= DP_PORT_EN; | 1686 | DP |= DP_PORT_EN; |
| 1602 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1687 | |
| 1688 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) | ||
| 1603 | DP &= ~DP_LINK_TRAIN_MASK_CPT; | 1689 | DP &= ~DP_LINK_TRAIN_MASK_CPT; |
| 1604 | else | 1690 | else |
| 1605 | DP &= ~DP_LINK_TRAIN_MASK; | 1691 | DP &= ~DP_LINK_TRAIN_MASK; |
| @@ -1613,7 +1699,11 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
| 1613 | uint8_t link_status[DP_LINK_STATUS_SIZE]; | 1699 | uint8_t link_status[DP_LINK_STATUS_SIZE]; |
| 1614 | uint32_t signal_levels; | 1700 | uint32_t signal_levels; |
| 1615 | 1701 | ||
| 1616 | if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | 1702 | |
| 1703 | if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) { | ||
| 1704 | signal_levels = intel_gen7_edp_signal_levels(intel_dp->train_set[0]); | ||
| 1705 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_IVB) | signal_levels; | ||
| 1706 | } else if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | ||
| 1617 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1707 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
| 1618 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1708 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
| 1619 | } else { | 1709 | } else { |
| @@ -1622,7 +1712,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
| 1622 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; | 1712 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; |
| 1623 | } | 1713 | } |
| 1624 | 1714 | ||
| 1625 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1715 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) |
| 1626 | reg = DP | DP_LINK_TRAIN_PAT_1_CPT; | 1716 | reg = DP | DP_LINK_TRAIN_PAT_1_CPT; |
| 1627 | else | 1717 | else |
| 1628 | reg = DP | DP_LINK_TRAIN_PAT_1; | 1718 | reg = DP | DP_LINK_TRAIN_PAT_1; |
| @@ -1703,7 +1793,10 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
| 1703 | break; | 1793 | break; |
| 1704 | } | 1794 | } |
| 1705 | 1795 | ||
| 1706 | if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | 1796 | if (IS_GEN7(dev) && is_cpu_edp(intel_dp)) { |
| 1797 | signal_levels = intel_gen7_edp_signal_levels(intel_dp->train_set[0]); | ||
| 1798 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_IVB) | signal_levels; | ||
| 1799 | } else if (IS_GEN6(dev) && is_cpu_edp(intel_dp)) { | ||
| 1707 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); | 1800 | signal_levels = intel_gen6_edp_signal_levels(intel_dp->train_set[0]); |
| 1708 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; | 1801 | DP = (DP & ~EDP_LINK_TRAIN_VOL_EMP_MASK_SNB) | signal_levels; |
| 1709 | } else { | 1802 | } else { |
| @@ -1711,7 +1804,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
| 1711 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; | 1804 | DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; |
| 1712 | } | 1805 | } |
| 1713 | 1806 | ||
| 1714 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1807 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) |
| 1715 | reg = DP | DP_LINK_TRAIN_PAT_2_CPT; | 1808 | reg = DP | DP_LINK_TRAIN_PAT_2_CPT; |
| 1716 | else | 1809 | else |
| 1717 | reg = DP | DP_LINK_TRAIN_PAT_2; | 1810 | reg = DP | DP_LINK_TRAIN_PAT_2; |
| @@ -1752,7 +1845,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) | |||
| 1752 | ++tries; | 1845 | ++tries; |
| 1753 | } | 1846 | } |
| 1754 | 1847 | ||
| 1755 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1848 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) |
| 1756 | reg = DP | DP_LINK_TRAIN_OFF_CPT; | 1849 | reg = DP | DP_LINK_TRAIN_OFF_CPT; |
| 1757 | else | 1850 | else |
| 1758 | reg = DP | DP_LINK_TRAIN_OFF; | 1851 | reg = DP | DP_LINK_TRAIN_OFF; |
| @@ -1782,7 +1875,7 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
| 1782 | udelay(100); | 1875 | udelay(100); |
| 1783 | } | 1876 | } |
| 1784 | 1877 | ||
| 1785 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) { | 1878 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) { |
| 1786 | DP &= ~DP_LINK_TRAIN_MASK_CPT; | 1879 | DP &= ~DP_LINK_TRAIN_MASK_CPT; |
| 1787 | I915_WRITE(intel_dp->output_reg, DP | DP_LINK_TRAIN_PAT_IDLE_CPT); | 1880 | I915_WRITE(intel_dp->output_reg, DP | DP_LINK_TRAIN_PAT_IDLE_CPT); |
| 1788 | } else { | 1881 | } else { |
| @@ -1794,7 +1887,7 @@ intel_dp_link_down(struct intel_dp *intel_dp) | |||
| 1794 | msleep(17); | 1887 | msleep(17); |
| 1795 | 1888 | ||
| 1796 | if (is_edp(intel_dp)) { | 1889 | if (is_edp(intel_dp)) { |
| 1797 | if (HAS_PCH_CPT(dev) && !is_cpu_edp(intel_dp)) | 1890 | if (HAS_PCH_CPT(dev) && (IS_GEN7(dev) || !is_cpu_edp(intel_dp))) |
| 1798 | DP |= DP_LINK_TRAIN_OFF_CPT; | 1891 | DP |= DP_LINK_TRAIN_OFF_CPT; |
| 1799 | else | 1892 | else |
| 1800 | DP |= DP_LINK_TRAIN_OFF; | 1893 | DP |= DP_LINK_TRAIN_OFF; |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index bd9a604b73da..a1b4343814e8 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
| @@ -110,6 +110,7 @@ | |||
| 110 | /* drm_display_mode->private_flags */ | 110 | /* drm_display_mode->private_flags */ |
| 111 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) | 111 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) |
| 112 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) | 112 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) |
| 113 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) | ||
| 113 | 114 | ||
| 114 | static inline void | 115 | static inline void |
| 115 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, | 116 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 42f165a520de..e44191132ac4 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
| @@ -715,6 +715,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
| 715 | DMI_MATCH(DMI_PRODUCT_NAME, "EB1007"), | 715 | DMI_MATCH(DMI_PRODUCT_NAME, "EB1007"), |
| 716 | }, | 716 | }, |
| 717 | }, | 717 | }, |
| 718 | { | ||
| 719 | .callback = intel_no_lvds_dmi_callback, | ||
| 720 | .ident = "Asus AT5NM10T-I", | ||
| 721 | .matches = { | ||
| 722 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | ||
| 723 | DMI_MATCH(DMI_BOARD_NAME, "AT5NM10T-I"), | ||
| 724 | }, | ||
| 725 | }, | ||
| 718 | 726 | ||
| 719 | { } /* terminating entry */ | 727 | { } /* terminating entry */ |
| 720 | }; | 728 | }; |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 21f60b7d69a3..04d79fd1dc9d 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
| @@ -178,13 +178,10 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev) | |||
| 178 | if (HAS_PCH_SPLIT(dev)) { | 178 | if (HAS_PCH_SPLIT(dev)) { |
| 179 | max >>= 16; | 179 | max >>= 16; |
| 180 | } else { | 180 | } else { |
| 181 | if (IS_PINEVIEW(dev)) { | 181 | if (INTEL_INFO(dev)->gen < 4) |
| 182 | max >>= 17; | 182 | max >>= 17; |
| 183 | } else { | 183 | else |
| 184 | max >>= 16; | 184 | max >>= 16; |
| 185 | if (INTEL_INFO(dev)->gen < 4) | ||
| 186 | max &= ~1; | ||
| 187 | } | ||
| 188 | 185 | ||
| 189 | if (is_backlight_combination_mode(dev)) | 186 | if (is_backlight_combination_mode(dev)) |
| 190 | max *= 0xff; | 187 | max *= 0xff; |
| @@ -203,13 +200,12 @@ u32 intel_panel_get_backlight(struct drm_device *dev) | |||
| 203 | val = I915_READ(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; | 200 | val = I915_READ(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; |
| 204 | } else { | 201 | } else { |
| 205 | val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; | 202 | val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; |
| 206 | if (IS_PINEVIEW(dev)) | 203 | if (INTEL_INFO(dev)->gen < 4) |
| 207 | val >>= 1; | 204 | val >>= 1; |
| 208 | 205 | ||
| 209 | if (is_backlight_combination_mode(dev)) { | 206 | if (is_backlight_combination_mode(dev)) { |
| 210 | u8 lbpc; | 207 | u8 lbpc; |
| 211 | 208 | ||
| 212 | val &= ~1; | ||
| 213 | pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc); | 209 | pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc); |
| 214 | val *= lbpc; | 210 | val *= lbpc; |
| 215 | } | 211 | } |
| @@ -246,11 +242,9 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level | |||
| 246 | } | 242 | } |
| 247 | 243 | ||
| 248 | tmp = I915_READ(BLC_PWM_CTL); | 244 | tmp = I915_READ(BLC_PWM_CTL); |
| 249 | if (IS_PINEVIEW(dev)) { | 245 | if (INTEL_INFO(dev)->gen < 4) |
| 250 | tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1); | ||
| 251 | level <<= 1; | 246 | level <<= 1; |
| 252 | } else | 247 | tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK; |
| 253 | tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK; | ||
| 254 | I915_WRITE(BLC_PWM_CTL, tmp | level); | 248 | I915_WRITE(BLC_PWM_CTL, tmp | level); |
| 255 | } | 249 | } |
| 256 | 250 | ||
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 3003fb25aefd..f7b9268df266 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #define IS_TMDS(c) (c->output_flag & SDVO_TMDS_MASK) | 50 | #define IS_TMDS(c) (c->output_flag & SDVO_TMDS_MASK) |
| 51 | #define IS_LVDS(c) (c->output_flag & SDVO_LVDS_MASK) | 51 | #define IS_LVDS(c) (c->output_flag & SDVO_LVDS_MASK) |
| 52 | #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK)) | 52 | #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK)) |
| 53 | #define IS_DIGITAL(c) (c->output_flag & (SDVO_TMDS_MASK | SDVO_LVDS_MASK)) | ||
| 53 | 54 | ||
| 54 | 55 | ||
| 55 | static const char *tv_format_names[] = { | 56 | static const char *tv_format_names[] = { |
| @@ -1086,8 +1087,12 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
| 1086 | } | 1087 | } |
| 1087 | sdvox |= (9 << 19) | SDVO_BORDER_ENABLE; | 1088 | sdvox |= (9 << 19) | SDVO_BORDER_ENABLE; |
| 1088 | } | 1089 | } |
| 1089 | if (intel_crtc->pipe == 1) | 1090 | |
| 1090 | sdvox |= SDVO_PIPE_B_SELECT; | 1091 | if (INTEL_PCH_TYPE(dev) >= PCH_CPT) |
| 1092 | sdvox |= TRANSCODER_CPT(intel_crtc->pipe); | ||
| 1093 | else | ||
| 1094 | sdvox |= TRANSCODER(intel_crtc->pipe); | ||
| 1095 | |||
| 1091 | if (intel_sdvo->has_hdmi_audio) | 1096 | if (intel_sdvo->has_hdmi_audio) |
| 1092 | sdvox |= SDVO_AUDIO_ENABLE; | 1097 | sdvox |= SDVO_AUDIO_ENABLE; |
| 1093 | 1098 | ||
| @@ -1314,6 +1319,18 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector) | |||
| 1314 | return status; | 1319 | return status; |
| 1315 | } | 1320 | } |
| 1316 | 1321 | ||
| 1322 | static bool | ||
| 1323 | intel_sdvo_connector_matches_edid(struct intel_sdvo_connector *sdvo, | ||
| 1324 | struct edid *edid) | ||
| 1325 | { | ||
| 1326 | bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL); | ||
| 1327 | bool connector_is_digital = !!IS_DIGITAL(sdvo); | ||
| 1328 | |||
| 1329 | DRM_DEBUG_KMS("connector_is_digital? %d, monitor_is_digital? %d\n", | ||
| 1330 | connector_is_digital, monitor_is_digital); | ||
| 1331 | return connector_is_digital == monitor_is_digital; | ||
| 1332 | } | ||
| 1333 | |||
| 1317 | static enum drm_connector_status | 1334 | static enum drm_connector_status |
| 1318 | intel_sdvo_detect(struct drm_connector *connector, bool force) | 1335 | intel_sdvo_detect(struct drm_connector *connector, bool force) |
| 1319 | { | 1336 | { |
| @@ -1358,10 +1375,12 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) | |||
| 1358 | if (edid == NULL) | 1375 | if (edid == NULL) |
| 1359 | edid = intel_sdvo_get_analog_edid(connector); | 1376 | edid = intel_sdvo_get_analog_edid(connector); |
| 1360 | if (edid != NULL) { | 1377 | if (edid != NULL) { |
| 1361 | if (edid->input & DRM_EDID_INPUT_DIGITAL) | 1378 | if (intel_sdvo_connector_matches_edid(intel_sdvo_connector, |
| 1362 | ret = connector_status_disconnected; | 1379 | edid)) |
| 1363 | else | ||
| 1364 | ret = connector_status_connected; | 1380 | ret = connector_status_connected; |
| 1381 | else | ||
| 1382 | ret = connector_status_disconnected; | ||
| 1383 | |||
| 1365 | connector->display_info.raw_edid = NULL; | 1384 | connector->display_info.raw_edid = NULL; |
| 1366 | kfree(edid); | 1385 | kfree(edid); |
| 1367 | } else | 1386 | } else |
| @@ -1402,11 +1421,8 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) | |||
| 1402 | edid = intel_sdvo_get_analog_edid(connector); | 1421 | edid = intel_sdvo_get_analog_edid(connector); |
| 1403 | 1422 | ||
| 1404 | if (edid != NULL) { | 1423 | if (edid != NULL) { |
| 1405 | struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector); | 1424 | if (intel_sdvo_connector_matches_edid(to_intel_sdvo_connector(connector), |
| 1406 | bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL); | 1425 | edid)) { |
| 1407 | bool connector_is_digital = !!IS_TMDS(intel_sdvo_connector); | ||
| 1408 | |||
| 1409 | if (connector_is_digital == monitor_is_digital) { | ||
| 1410 | drm_mode_connector_update_edid_property(connector, edid); | 1426 | drm_mode_connector_update_edid_property(connector, edid); |
| 1411 | drm_add_edid_modes(connector, edid); | 1427 | drm_add_edid_modes(connector, edid); |
| 1412 | } | 1428 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 06e413e6a920..4b27efa4405b 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
| @@ -233,13 +233,12 @@ u16 radeon_encoder_get_dp_bridge_encoder_id(struct drm_encoder *encoder) | |||
| 233 | switch (radeon_encoder->encoder_id) { | 233 | switch (radeon_encoder->encoder_id) { |
| 234 | case ENCODER_OBJECT_ID_TRAVIS: | 234 | case ENCODER_OBJECT_ID_TRAVIS: |
| 235 | case ENCODER_OBJECT_ID_NUTMEG: | 235 | case ENCODER_OBJECT_ID_NUTMEG: |
| 236 | return true; | 236 | return radeon_encoder->encoder_id; |
| 237 | default: | 237 | default: |
| 238 | return false; | 238 | return ENCODER_OBJECT_ID_NONE; |
| 239 | } | 239 | } |
| 240 | } | 240 | } |
| 241 | 241 | return ENCODER_OBJECT_ID_NONE; | |
| 242 | return false; | ||
| 243 | } | 242 | } |
| 244 | 243 | ||
| 245 | void radeon_panel_mode_fixup(struct drm_encoder *encoder, | 244 | void radeon_panel_mode_fixup(struct drm_encoder *encoder, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 8cca91a93bde..dc279706ca70 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
| @@ -390,6 +390,11 @@ extern int vmw_context_check(struct vmw_private *dev_priv, | |||
| 390 | struct ttm_object_file *tfile, | 390 | struct ttm_object_file *tfile, |
| 391 | int id, | 391 | int id, |
| 392 | struct vmw_resource **p_res); | 392 | struct vmw_resource **p_res); |
| 393 | extern int vmw_user_lookup_handle(struct vmw_private *dev_priv, | ||
| 394 | struct ttm_object_file *tfile, | ||
| 395 | uint32_t handle, | ||
| 396 | struct vmw_surface **out_surf, | ||
| 397 | struct vmw_dma_buffer **out_buf); | ||
| 393 | extern void vmw_surface_res_free(struct vmw_resource *res); | 398 | extern void vmw_surface_res_free(struct vmw_resource *res); |
| 394 | extern int vmw_surface_init(struct vmw_private *dev_priv, | 399 | extern int vmw_surface_init(struct vmw_private *dev_priv, |
| 395 | struct vmw_surface *srf, | 400 | struct vmw_surface *srf, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index 03bbc2a6f9a7..a0c2f12b1e1b 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | |||
| @@ -33,6 +33,7 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv) | |||
| 33 | { | 33 | { |
| 34 | __le32 __iomem *fifo_mem = dev_priv->mmio_virt; | 34 | __le32 __iomem *fifo_mem = dev_priv->mmio_virt; |
| 35 | uint32_t fifo_min, hwversion; | 35 | uint32_t fifo_min, hwversion; |
| 36 | const struct vmw_fifo_state *fifo = &dev_priv->fifo; | ||
| 36 | 37 | ||
| 37 | if (!(dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO)) | 38 | if (!(dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO)) |
| 38 | return false; | 39 | return false; |
| @@ -41,7 +42,12 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv) | |||
| 41 | if (fifo_min <= SVGA_FIFO_3D_HWVERSION * sizeof(unsigned int)) | 42 | if (fifo_min <= SVGA_FIFO_3D_HWVERSION * sizeof(unsigned int)) |
| 42 | return false; | 43 | return false; |
| 43 | 44 | ||
| 44 | hwversion = ioread32(fifo_mem + SVGA_FIFO_3D_HWVERSION); | 45 | hwversion = ioread32(fifo_mem + |
| 46 | ((fifo->capabilities & | ||
| 47 | SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ? | ||
| 48 | SVGA_FIFO_3D_HWVERSION_REVISED : | ||
| 49 | SVGA_FIFO_3D_HWVERSION)); | ||
| 50 | |||
| 45 | if (hwversion == 0) | 51 | if (hwversion == 0) |
| 46 | return false; | 52 | return false; |
| 47 | 53 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c index 3f6343502d1f..66917c6c3813 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | |||
| @@ -58,8 +58,14 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, | |||
| 58 | case DRM_VMW_PARAM_FIFO_HW_VERSION: | 58 | case DRM_VMW_PARAM_FIFO_HW_VERSION: |
| 59 | { | 59 | { |
| 60 | __le32 __iomem *fifo_mem = dev_priv->mmio_virt; | 60 | __le32 __iomem *fifo_mem = dev_priv->mmio_virt; |
| 61 | 61 | const struct vmw_fifo_state *fifo = &dev_priv->fifo; | |
| 62 | param->value = ioread32(fifo_mem + SVGA_FIFO_3D_HWVERSION); | 62 | |
| 63 | param->value = | ||
| 64 | ioread32(fifo_mem + | ||
| 65 | ((fifo->capabilities & | ||
| 66 | SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ? | ||
| 67 | SVGA_FIFO_3D_HWVERSION_REVISED : | ||
| 68 | SVGA_FIFO_3D_HWVERSION)); | ||
| 63 | break; | 69 | break; |
| 64 | } | 70 | } |
| 65 | default: | 71 | default: |
| @@ -140,7 +146,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data, | |||
| 140 | goto out_clips; | 146 | goto out_clips; |
| 141 | } | 147 | } |
| 142 | 148 | ||
| 143 | clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); | 149 | clips = kcalloc(num_clips, sizeof(*clips), GFP_KERNEL); |
| 144 | if (clips == NULL) { | 150 | if (clips == NULL) { |
| 145 | DRM_ERROR("Failed to allocate clip rect list.\n"); | 151 | DRM_ERROR("Failed to allocate clip rect list.\n"); |
| 146 | ret = -ENOMEM; | 152 | ret = -ENOMEM; |
| @@ -166,13 +172,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data, | |||
| 166 | ret = -EINVAL; | 172 | ret = -EINVAL; |
| 167 | goto out_no_fb; | 173 | goto out_no_fb; |
| 168 | } | 174 | } |
| 169 | |||
| 170 | vfb = vmw_framebuffer_to_vfb(obj_to_fb(obj)); | 175 | vfb = vmw_framebuffer_to_vfb(obj_to_fb(obj)); |
| 171 | if (!vfb->dmabuf) { | ||
| 172 | DRM_ERROR("Framebuffer not dmabuf backed.\n"); | ||
| 173 | ret = -EINVAL; | ||
| 174 | goto out_no_fb; | ||
| 175 | } | ||
| 176 | 176 | ||
| 177 | ret = ttm_read_lock(&vmaster->lock, true); | 177 | ret = ttm_read_lock(&vmaster->lock, true); |
| 178 | if (unlikely(ret != 0)) | 178 | if (unlikely(ret != 0)) |
| @@ -232,7 +232,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data, | |||
| 232 | goto out_clips; | 232 | goto out_clips; |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); | 235 | clips = kcalloc(num_clips, sizeof(*clips), GFP_KERNEL); |
| 236 | if (clips == NULL) { | 236 | if (clips == NULL) { |
| 237 | DRM_ERROR("Failed to allocate clip rect list.\n"); | 237 | DRM_ERROR("Failed to allocate clip rect list.\n"); |
| 238 | ret = -ENOMEM; | 238 | ret = -ENOMEM; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 37d40545ed77..8aa1dbb45c67 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
| @@ -31,6 +31,44 @@ | |||
| 31 | /* Might need a hrtimer here? */ | 31 | /* Might need a hrtimer here? */ |
| 32 | #define VMWGFX_PRESENT_RATE ((HZ / 60 > 0) ? HZ / 60 : 1) | 32 | #define VMWGFX_PRESENT_RATE ((HZ / 60 > 0) ? HZ / 60 : 1) |
| 33 | 33 | ||
| 34 | |||
| 35 | struct vmw_clip_rect { | ||
| 36 | int x1, x2, y1, y2; | ||
| 37 | }; | ||
| 38 | |||
| 39 | /** | ||
| 40 | * Clip @num_rects number of @rects against @clip storing the | ||
| 41 | * results in @out_rects and the number of passed rects in @out_num. | ||
| 42 | */ | ||
| 43 | void vmw_clip_cliprects(struct drm_clip_rect *rects, | ||
| 44 | int num_rects, | ||
| 45 | struct vmw_clip_rect clip, | ||
| 46 | SVGASignedRect *out_rects, | ||
| 47 | int *out_num) | ||
| 48 | { | ||
| 49 | int i, k; | ||
| 50 | |||
| 51 | for (i = 0, k = 0; i < num_rects; i++) { | ||
| 52 | int x1 = max_t(int, clip.x1, rects[i].x1); | ||
| 53 | int y1 = max_t(int, clip.y1, rects[i].y1); | ||
| 54 | int x2 = min_t(int, clip.x2, rects[i].x2); | ||
| 55 | int y2 = min_t(int, clip.y2, rects[i].y2); | ||
| 56 | |||
| 57 | if (x1 >= x2) | ||
| 58 | continue; | ||
| 59 | if (y1 >= y2) | ||
| 60 | continue; | ||
| 61 | |||
| 62 | out_rects[k].left = x1; | ||
| 63 | out_rects[k].top = y1; | ||
| 64 | out_rects[k].right = x2; | ||
| 65 | out_rects[k].bottom = y2; | ||
| 66 | k++; | ||
| 67 | } | ||
| 68 | |||
| 69 | *out_num = k; | ||
| 70 | } | ||
| 71 | |||
| 34 | void vmw_display_unit_cleanup(struct vmw_display_unit *du) | 72 | void vmw_display_unit_cleanup(struct vmw_display_unit *du) |
| 35 | { | 73 | { |
| 36 | if (du->cursor_surface) | 74 | if (du->cursor_surface) |
| @@ -82,6 +120,43 @@ int vmw_cursor_update_image(struct vmw_private *dev_priv, | |||
| 82 | return 0; | 120 | return 0; |
| 83 | } | 121 | } |
| 84 | 122 | ||
| 123 | int vmw_cursor_update_dmabuf(struct vmw_private *dev_priv, | ||
| 124 | struct vmw_dma_buffer *dmabuf, | ||
| 125 | u32 width, u32 height, | ||
| 126 | u32 hotspotX, u32 hotspotY) | ||
| 127 | { | ||
| 128 | struct ttm_bo_kmap_obj map; | ||
| 129 | unsigned long kmap_offset; | ||
| 130 | unsigned long kmap_num; | ||
| 131 | void *virtual; | ||
| 132 | bool dummy; | ||
| 133 | int ret; | ||
| 134 | |||
| 135 | kmap_offset = 0; | ||
| 136 | kmap_num = (width*height*4 + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
| 137 | |||
| 138 | ret = ttm_bo_reserve(&dmabuf->base, true, false, false, 0); | ||
| 139 | if (unlikely(ret != 0)) { | ||
| 140 | DRM_ERROR("reserve failed\n"); | ||
| 141 | return -EINVAL; | ||
| 142 | } | ||
| 143 | |||
| 144 | ret = ttm_bo_kmap(&dmabuf->base, kmap_offset, kmap_num, &map); | ||
| 145 | if (unlikely(ret != 0)) | ||
| 146 | goto err_unreserve; | ||
| 147 | |||
| 148 | virtual = ttm_kmap_obj_virtual(&map, &dummy); | ||
| 149 | ret = vmw_cursor_update_image(dev_priv, virtual, width, height, | ||
| 150 | hotspotX, hotspotY); | ||
| 151 | |||
| 152 | ttm_bo_kunmap(&map); | ||
| 153 | err_unreserve: | ||
| 154 | ttm_bo_unreserve(&dmabuf->base); | ||
| 155 | |||
| 156 | return ret; | ||
| 157 | } | ||
| 158 | |||
| 159 | |||
| 85 | void vmw_cursor_update_position(struct vmw_private *dev_priv, | 160 | void vmw_cursor_update_position(struct vmw_private *dev_priv, |
| 86 | bool show, int x, int y) | 161 | bool show, int x, int y) |
| 87 | { | 162 | { |
| @@ -110,24 +185,21 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | |||
| 110 | return -EINVAL; | 185 | return -EINVAL; |
| 111 | 186 | ||
| 112 | if (handle) { | 187 | if (handle) { |
| 113 | ret = vmw_user_surface_lookup_handle(dev_priv, tfile, | 188 | ret = vmw_user_lookup_handle(dev_priv, tfile, |
| 114 | handle, &surface); | 189 | handle, &surface, &dmabuf); |
| 115 | if (!ret) { | 190 | if (ret) { |
| 116 | if (!surface->snooper.image) { | 191 | DRM_ERROR("failed to find surface or dmabuf: %i\n", ret); |
| 117 | DRM_ERROR("surface not suitable for cursor\n"); | 192 | return -EINVAL; |
| 118 | vmw_surface_unreference(&surface); | ||
| 119 | return -EINVAL; | ||
| 120 | } | ||
| 121 | } else { | ||
| 122 | ret = vmw_user_dmabuf_lookup(tfile, | ||
| 123 | handle, &dmabuf); | ||
| 124 | if (ret) { | ||
| 125 | DRM_ERROR("failed to find surface or dmabuf: %i\n", ret); | ||
| 126 | return -EINVAL; | ||
| 127 | } | ||
| 128 | } | 193 | } |
| 129 | } | 194 | } |
| 130 | 195 | ||
| 196 | /* need to do this before taking down old image */ | ||
| 197 | if (surface && !surface->snooper.image) { | ||
| 198 | DRM_ERROR("surface not suitable for cursor\n"); | ||
| 199 | vmw_surface_unreference(&surface); | ||
| 200 | return -EINVAL; | ||
| 201 | } | ||
| 202 | |||
| 131 | /* takedown old cursor */ | 203 | /* takedown old cursor */ |
| 132 | if (du->cursor_surface) { | 204 | if (du->cursor_surface) { |
| 133 | du->cursor_surface->snooper.crtc = NULL; | 205 | du->cursor_surface->snooper.crtc = NULL; |
| @@ -146,36 +218,11 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | |||
| 146 | vmw_cursor_update_image(dev_priv, surface->snooper.image, | 218 | vmw_cursor_update_image(dev_priv, surface->snooper.image, |
| 147 | 64, 64, du->hotspot_x, du->hotspot_y); | 219 | 64, 64, du->hotspot_x, du->hotspot_y); |
| 148 | } else if (dmabuf) { | 220 | } else if (dmabuf) { |
| 149 | struct ttm_bo_kmap_obj map; | ||
| 150 | unsigned long kmap_offset; | ||
| 151 | unsigned long kmap_num; | ||
| 152 | void *virtual; | ||
| 153 | bool dummy; | ||
| 154 | |||
| 155 | /* vmw_user_surface_lookup takes one reference */ | 221 | /* vmw_user_surface_lookup takes one reference */ |
| 156 | du->cursor_dmabuf = dmabuf; | 222 | du->cursor_dmabuf = dmabuf; |
| 157 | 223 | ||
| 158 | kmap_offset = 0; | 224 | ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, width, height, |
| 159 | kmap_num = (64*64*4) >> PAGE_SHIFT; | 225 | du->hotspot_x, du->hotspot_y); |
| 160 | |||
| 161 | ret = ttm_bo_reserve(&dmabuf->base, true, false, false, 0); | ||
| 162 | if (unlikely(ret != 0)) { | ||
| 163 | DRM_ERROR("reserve failed\n"); | ||
| 164 | return -EINVAL; | ||
| 165 | } | ||
| 166 | |||
| 167 | ret = ttm_bo_kmap(&dmabuf->base, kmap_offset, kmap_num, &map); | ||
| 168 | if (unlikely(ret != 0)) | ||
| 169 | goto err_unreserve; | ||
| 170 | |||
| 171 | virtual = ttm_kmap_obj_virtual(&map, &dummy); | ||
| 172 | vmw_cursor_update_image(dev_priv, virtual, 64, 64, | ||
| 173 | du->hotspot_x, du->hotspot_y); | ||
| 174 | |||
| 175 | ttm_bo_kunmap(&map); | ||
| 176 | err_unreserve: | ||
| 177 | ttm_bo_unreserve(&dmabuf->base); | ||
| 178 | |||
| 179 | } else { | 226 | } else { |
| 180 | vmw_cursor_update_position(dev_priv, false, 0, 0); | 227 | vmw_cursor_update_position(dev_priv, false, 0, 0); |
| 181 | return 0; | 228 | return 0; |
| @@ -377,8 +424,9 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, | |||
| 377 | struct drm_clip_rect *clips, | 424 | struct drm_clip_rect *clips, |
| 378 | unsigned num_clips, int inc) | 425 | unsigned num_clips, int inc) |
| 379 | { | 426 | { |
| 380 | struct drm_clip_rect *clips_ptr; | ||
| 381 | struct vmw_display_unit *units[VMWGFX_NUM_DISPLAY_UNITS]; | 427 | struct vmw_display_unit *units[VMWGFX_NUM_DISPLAY_UNITS]; |
| 428 | struct drm_clip_rect *clips_ptr; | ||
| 429 | struct drm_clip_rect *tmp; | ||
| 382 | struct drm_crtc *crtc; | 430 | struct drm_crtc *crtc; |
| 383 | size_t fifo_size; | 431 | size_t fifo_size; |
| 384 | int i, num_units; | 432 | int i, num_units; |
| @@ -391,7 +439,6 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, | |||
| 391 | } *cmd; | 439 | } *cmd; |
| 392 | SVGASignedRect *blits; | 440 | SVGASignedRect *blits; |
| 393 | 441 | ||
| 394 | |||
| 395 | num_units = 0; | 442 | num_units = 0; |
| 396 | list_for_each_entry(crtc, &dev_priv->dev->mode_config.crtc_list, | 443 | list_for_each_entry(crtc, &dev_priv->dev->mode_config.crtc_list, |
| 397 | head) { | 444 | head) { |
| @@ -402,13 +449,24 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, | |||
| 402 | 449 | ||
| 403 | BUG_ON(!clips || !num_clips); | 450 | BUG_ON(!clips || !num_clips); |
| 404 | 451 | ||
| 452 | tmp = kzalloc(sizeof(*tmp) * num_clips, GFP_KERNEL); | ||
| 453 | if (unlikely(tmp == NULL)) { | ||
| 454 | DRM_ERROR("Temporary cliprect memory alloc failed.\n"); | ||
| 455 | return -ENOMEM; | ||
| 456 | } | ||
| 457 | |||
| 405 | fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num_clips; | 458 | fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num_clips; |
| 406 | cmd = kzalloc(fifo_size, GFP_KERNEL); | 459 | cmd = kzalloc(fifo_size, GFP_KERNEL); |
| 407 | if (unlikely(cmd == NULL)) { | 460 | if (unlikely(cmd == NULL)) { |
| 408 | DRM_ERROR("Temporary fifo memory alloc failed.\n"); | 461 | DRM_ERROR("Temporary fifo memory alloc failed.\n"); |
| 409 | return -ENOMEM; | 462 | ret = -ENOMEM; |
| 463 | goto out_free_tmp; | ||
| 410 | } | 464 | } |
| 411 | 465 | ||
| 466 | /* setup blits pointer */ | ||
| 467 | blits = (SVGASignedRect *)&cmd[1]; | ||
| 468 | |||
| 469 | /* initial clip region */ | ||
| 412 | left = clips->x1; | 470 | left = clips->x1; |
| 413 | right = clips->x2; | 471 | right = clips->x2; |
| 414 | top = clips->y1; | 472 | top = clips->y1; |
| @@ -434,45 +492,60 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, | |||
| 434 | cmd->body.srcRect.bottom = bottom; | 492 | cmd->body.srcRect.bottom = bottom; |
| 435 | 493 | ||
| 436 | clips_ptr = clips; | 494 | clips_ptr = clips; |
| 437 | blits = (SVGASignedRect *)&cmd[1]; | ||
| 438 | for (i = 0; i < num_clips; i++, clips_ptr += inc) { | 495 | for (i = 0; i < num_clips; i++, clips_ptr += inc) { |
| 439 | blits[i].left = clips_ptr->x1 - left; | 496 | tmp[i].x1 = clips_ptr->x1 - left; |
| 440 | blits[i].right = clips_ptr->x2 - left; | 497 | tmp[i].x2 = clips_ptr->x2 - left; |
| 441 | blits[i].top = clips_ptr->y1 - top; | 498 | tmp[i].y1 = clips_ptr->y1 - top; |
| 442 | blits[i].bottom = clips_ptr->y2 - top; | 499 | tmp[i].y2 = clips_ptr->y2 - top; |
| 443 | } | 500 | } |
| 444 | 501 | ||
| 445 | /* do per unit writing, reuse fifo for each */ | 502 | /* do per unit writing, reuse fifo for each */ |
| 446 | for (i = 0; i < num_units; i++) { | 503 | for (i = 0; i < num_units; i++) { |
| 447 | struct vmw_display_unit *unit = units[i]; | 504 | struct vmw_display_unit *unit = units[i]; |
| 448 | int clip_x1 = left - unit->crtc.x; | 505 | struct vmw_clip_rect clip; |
| 449 | int clip_y1 = top - unit->crtc.y; | 506 | int num; |
| 450 | int clip_x2 = right - unit->crtc.x; | 507 | |
| 451 | int clip_y2 = bottom - unit->crtc.y; | 508 | clip.x1 = left - unit->crtc.x; |
| 509 | clip.y1 = top - unit->crtc.y; | ||
| 510 | clip.x2 = right - unit->crtc.x; | ||
| 511 | clip.y2 = bottom - unit->crtc.y; | ||
| 452 | 512 | ||
| 453 | /* skip any crtcs that misses the clip region */ | 513 | /* skip any crtcs that misses the clip region */ |
| 454 | if (clip_x1 >= unit->crtc.mode.hdisplay || | 514 | if (clip.x1 >= unit->crtc.mode.hdisplay || |
| 455 | clip_y1 >= unit->crtc.mode.vdisplay || | 515 | clip.y1 >= unit->crtc.mode.vdisplay || |
| 456 | clip_x2 <= 0 || clip_y2 <= 0) | 516 | clip.x2 <= 0 || clip.y2 <= 0) |
| 457 | continue; | 517 | continue; |
| 458 | 518 | ||
| 519 | /* | ||
| 520 | * In order for the clip rects to be correctly scaled | ||
| 521 | * the src and dest rects needs to be the same size. | ||
| 522 | */ | ||
| 523 | cmd->body.destRect.left = clip.x1; | ||
| 524 | cmd->body.destRect.right = clip.x2; | ||
| 525 | cmd->body.destRect.top = clip.y1; | ||
| 526 | cmd->body.destRect.bottom = clip.y2; | ||
| 527 | |||
| 528 | /* create a clip rect of the crtc in dest coords */ | ||
| 529 | clip.x2 = unit->crtc.mode.hdisplay - clip.x1; | ||
| 530 | clip.y2 = unit->crtc.mode.vdisplay - clip.y1; | ||
| 531 | clip.x1 = 0 - clip.x1; | ||
| 532 | clip.y1 = 0 - clip.y1; | ||
| 533 | |||
| 459 | /* need to reset sid as it is changed by execbuf */ | 534 | /* need to reset sid as it is changed by execbuf */ |
| 460 | cmd->body.srcImage.sid = cpu_to_le32(framebuffer->user_handle); | 535 | cmd->body.srcImage.sid = cpu_to_le32(framebuffer->user_handle); |
| 461 | |||
| 462 | cmd->body.destScreenId = unit->unit; | 536 | cmd->body.destScreenId = unit->unit; |
| 463 | 537 | ||
| 464 | /* | 538 | /* clip and write blits to cmd stream */ |
| 465 | * The blit command is a lot more resilient then the | 539 | vmw_clip_cliprects(tmp, num_clips, clip, blits, &num); |
| 466 | * readback command when it comes to clip rects. So its | ||
| 467 | * okay to go out of bounds. | ||
| 468 | */ | ||
| 469 | 540 | ||
| 470 | cmd->body.destRect.left = clip_x1; | 541 | /* if no cliprects hit skip this */ |
| 471 | cmd->body.destRect.right = clip_x2; | 542 | if (num == 0) |
| 472 | cmd->body.destRect.top = clip_y1; | 543 | continue; |
| 473 | cmd->body.destRect.bottom = clip_y2; | ||
| 474 | 544 | ||
| 475 | 545 | ||
| 546 | /* recalculate package length */ | ||
| 547 | fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num; | ||
| 548 | cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); | ||
| 476 | ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, | 549 | ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, |
| 477 | fifo_size, 0, NULL); | 550 | fifo_size, 0, NULL); |
| 478 | 551 | ||
| @@ -480,7 +553,10 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv, | |||
| 480 | break; | 553 | break; |
| 481 | } | 554 | } |
| 482 | 555 | ||
| 556 | |||
| 483 | kfree(cmd); | 557 | kfree(cmd); |
| 558 | out_free_tmp: | ||
| 559 | kfree(tmp); | ||
| 484 | 560 | ||
| 485 | return ret; | 561 | return ret; |
| 486 | } | 562 | } |
| @@ -556,6 +632,10 @@ static int vmw_kms_new_framebuffer_surface(struct vmw_private *dev_priv, | |||
| 556 | * Sanity checks. | 632 | * Sanity checks. |
| 557 | */ | 633 | */ |
| 558 | 634 | ||
| 635 | /* Surface must be marked as a scanout. */ | ||
| 636 | if (unlikely(!surface->scanout)) | ||
| 637 | return -EINVAL; | ||
| 638 | |||
| 559 | if (unlikely(surface->mip_levels[0] != 1 || | 639 | if (unlikely(surface->mip_levels[0] != 1 || |
| 560 | surface->num_sizes != 1 || | 640 | surface->num_sizes != 1 || |
| 561 | surface->sizes[0].width < mode_cmd->width || | 641 | surface->sizes[0].width < mode_cmd->width || |
| @@ -782,6 +862,7 @@ static int do_dmabuf_dirty_sou(struct drm_file *file_priv, | |||
| 782 | int clip_y1 = clips_ptr->y1 - unit->crtc.y; | 862 | int clip_y1 = clips_ptr->y1 - unit->crtc.y; |
| 783 | int clip_x2 = clips_ptr->x2 - unit->crtc.x; | 863 | int clip_x2 = clips_ptr->x2 - unit->crtc.x; |
| 784 | int clip_y2 = clips_ptr->y2 - unit->crtc.y; | 864 | int clip_y2 = clips_ptr->y2 - unit->crtc.y; |
| 865 | int move_x, move_y; | ||
| 785 | 866 | ||
| 786 | /* skip any crtcs that misses the clip region */ | 867 | /* skip any crtcs that misses the clip region */ |
| 787 | if (clip_x1 >= unit->crtc.mode.hdisplay || | 868 | if (clip_x1 >= unit->crtc.mode.hdisplay || |
| @@ -789,12 +870,21 @@ static int do_dmabuf_dirty_sou(struct drm_file *file_priv, | |||
| 789 | clip_x2 <= 0 || clip_y2 <= 0) | 870 | clip_x2 <= 0 || clip_y2 <= 0) |
| 790 | continue; | 871 | continue; |
| 791 | 872 | ||
| 873 | /* clip size to crtc size */ | ||
| 874 | clip_x2 = min_t(int, clip_x2, unit->crtc.mode.hdisplay); | ||
| 875 | clip_y2 = min_t(int, clip_y2, unit->crtc.mode.vdisplay); | ||
| 876 | |||
| 877 | /* translate both src and dest to bring clip into screen */ | ||
| 878 | move_x = min_t(int, clip_x1, 0); | ||
| 879 | move_y = min_t(int, clip_y1, 0); | ||
| 880 | |||
| 881 | /* actual translate done here */ | ||
| 792 | blits[hit_num].header = SVGA_CMD_BLIT_GMRFB_TO_SCREEN; | 882 | blits[hit_num].header = SVGA_CMD_BLIT_GMRFB_TO_SCREEN; |
| 793 | blits[hit_num].body.destScreenId = unit->unit; | 883 | blits[hit_num].body.destScreenId = unit->unit; |
| 794 | blits[hit_num].body.srcOrigin.x = clips_ptr->x1; | 884 | blits[hit_num].body.srcOrigin.x = clips_ptr->x1 - move_x; |
| 795 | blits[hit_num].body.srcOrigin.y = clips_ptr->y1; | 885 | blits[hit_num].body.srcOrigin.y = clips_ptr->y1 - move_y; |
| 796 | blits[hit_num].body.destRect.left = clip_x1; | 886 | blits[hit_num].body.destRect.left = clip_x1 - move_x; |
| 797 | blits[hit_num].body.destRect.top = clip_y1; | 887 | blits[hit_num].body.destRect.top = clip_y1 - move_y; |
| 798 | blits[hit_num].body.destRect.right = clip_x2; | 888 | blits[hit_num].body.destRect.right = clip_x2; |
| 799 | blits[hit_num].body.destRect.bottom = clip_y2; | 889 | blits[hit_num].body.destRect.bottom = clip_y2; |
| 800 | hit_num++; | 890 | hit_num++; |
| @@ -1033,46 +1123,29 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, | |||
| 1033 | return ERR_PTR(-ENOENT); | 1123 | return ERR_PTR(-ENOENT); |
| 1034 | } | 1124 | } |
| 1035 | 1125 | ||
| 1036 | /** | 1126 | /* returns either a dmabuf or surface */ |
| 1037 | * End conditioned code. | 1127 | ret = vmw_user_lookup_handle(dev_priv, tfile, |
| 1038 | */ | 1128 | mode_cmd->handle, |
| 1039 | 1129 | &surface, &bo); | |
| 1040 | ret = vmw_user_surface_lookup_handle(dev_priv, tfile, | ||
| 1041 | mode_cmd->handle, &surface); | ||
| 1042 | if (ret) | 1130 | if (ret) |
| 1043 | goto try_dmabuf; | 1131 | goto err_out; |
| 1044 | 1132 | ||
| 1045 | if (!surface->scanout) | 1133 | /* Create the new framebuffer depending one what we got back */ |
| 1046 | goto err_not_scanout; | 1134 | if (bo) |
| 1047 | 1135 | ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb, | |
| 1048 | ret = vmw_kms_new_framebuffer_surface(dev_priv, file_priv, surface, | 1136 | mode_cmd); |
| 1049 | &vfb, mode_cmd); | 1137 | else if (surface) |
| 1050 | 1138 | ret = vmw_kms_new_framebuffer_surface(dev_priv, file_priv, | |
| 1051 | /* vmw_user_surface_lookup takes one ref so does new_fb */ | 1139 | surface, &vfb, mode_cmd); |
| 1052 | vmw_surface_unreference(&surface); | 1140 | else |
| 1053 | 1141 | BUG(); | |
| 1054 | if (ret) { | ||
| 1055 | DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); | ||
| 1056 | ttm_base_object_unref(&user_obj); | ||
| 1057 | return ERR_PTR(ret); | ||
| 1058 | } else | ||
| 1059 | vfb->user_obj = user_obj; | ||
| 1060 | return &vfb->base; | ||
| 1061 | |||
| 1062 | try_dmabuf: | ||
| 1063 | DRM_INFO("%s: trying buffer\n", __func__); | ||
| 1064 | |||
| 1065 | ret = vmw_user_dmabuf_lookup(tfile, mode_cmd->handle, &bo); | ||
| 1066 | if (ret) { | ||
| 1067 | DRM_ERROR("failed to find buffer: %i\n", ret); | ||
| 1068 | return ERR_PTR(-ENOENT); | ||
| 1069 | } | ||
| 1070 | |||
| 1071 | ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb, | ||
| 1072 | mode_cmd); | ||
| 1073 | 1142 | ||
| 1074 | /* vmw_user_dmabuf_lookup takes one ref so does new_fb */ | 1143 | err_out: |
| 1075 | vmw_dmabuf_unreference(&bo); | 1144 | /* vmw_user_lookup_handle takes one ref so does new_fb */ |
| 1145 | if (bo) | ||
| 1146 | vmw_dmabuf_unreference(&bo); | ||
| 1147 | if (surface) | ||
| 1148 | vmw_surface_unreference(&surface); | ||
| 1076 | 1149 | ||
| 1077 | if (ret) { | 1150 | if (ret) { |
| 1078 | DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); | 1151 | DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); |
| @@ -1082,14 +1155,6 @@ try_dmabuf: | |||
| 1082 | vfb->user_obj = user_obj; | 1155 | vfb->user_obj = user_obj; |
| 1083 | 1156 | ||
| 1084 | return &vfb->base; | 1157 | return &vfb->base; |
| 1085 | |||
| 1086 | err_not_scanout: | ||
| 1087 | DRM_ERROR("surface not marked as scanout\n"); | ||
| 1088 | /* vmw_user_surface_lookup takes one ref */ | ||
| 1089 | vmw_surface_unreference(&surface); | ||
| 1090 | ttm_base_object_unref(&user_obj); | ||
| 1091 | |||
| 1092 | return ERR_PTR(-EINVAL); | ||
| 1093 | } | 1158 | } |
| 1094 | 1159 | ||
| 1095 | static struct drm_mode_config_funcs vmw_kms_funcs = { | 1160 | static struct drm_mode_config_funcs vmw_kms_funcs = { |
| @@ -1106,10 +1171,12 @@ int vmw_kms_present(struct vmw_private *dev_priv, | |||
| 1106 | uint32_t num_clips) | 1171 | uint32_t num_clips) |
| 1107 | { | 1172 | { |
| 1108 | struct vmw_display_unit *units[VMWGFX_NUM_DISPLAY_UNITS]; | 1173 | struct vmw_display_unit *units[VMWGFX_NUM_DISPLAY_UNITS]; |
| 1174 | struct drm_clip_rect *tmp; | ||
| 1109 | struct drm_crtc *crtc; | 1175 | struct drm_crtc *crtc; |
| 1110 | size_t fifo_size; | 1176 | size_t fifo_size; |
| 1111 | int i, k, num_units; | 1177 | int i, k, num_units; |
| 1112 | int ret = 0; /* silence warning */ | 1178 | int ret = 0; /* silence warning */ |
| 1179 | int left, right, top, bottom; | ||
| 1113 | 1180 | ||
| 1114 | struct { | 1181 | struct { |
| 1115 | SVGA3dCmdHeader header; | 1182 | SVGA3dCmdHeader header; |
| @@ -1127,60 +1194,95 @@ int vmw_kms_present(struct vmw_private *dev_priv, | |||
| 1127 | BUG_ON(surface == NULL); | 1194 | BUG_ON(surface == NULL); |
| 1128 | BUG_ON(!clips || !num_clips); | 1195 | BUG_ON(!clips || !num_clips); |
| 1129 | 1196 | ||
| 1197 | tmp = kzalloc(sizeof(*tmp) * num_clips, GFP_KERNEL); | ||
| 1198 | if (unlikely(tmp == NULL)) { | ||
| 1199 | DRM_ERROR("Temporary cliprect memory alloc failed.\n"); | ||
| 1200 | return -ENOMEM; | ||
| 1201 | } | ||
| 1202 | |||
| 1130 | fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num_clips; | 1203 | fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num_clips; |
| 1131 | cmd = kmalloc(fifo_size, GFP_KERNEL); | 1204 | cmd = kmalloc(fifo_size, GFP_KERNEL); |
| 1132 | if (unlikely(cmd == NULL)) { | 1205 | if (unlikely(cmd == NULL)) { |
| 1133 | DRM_ERROR("Failed to allocate temporary fifo memory.\n"); | 1206 | DRM_ERROR("Failed to allocate temporary fifo memory.\n"); |
| 1134 | return -ENOMEM; | 1207 | ret = -ENOMEM; |
| 1208 | goto out_free_tmp; | ||
| 1209 | } | ||
| 1210 | |||
| 1211 | left = clips->x; | ||
| 1212 | right = clips->x + clips->w; | ||
| 1213 | top = clips->y; | ||
| 1214 | bottom = clips->y + clips->h; | ||
| 1215 | |||
| 1216 | for (i = 1; i < num_clips; i++) { | ||
| 1217 | left = min_t(int, left, (int)clips[i].x); | ||
| 1218 | right = max_t(int, right, (int)clips[i].x + clips[i].w); | ||
| 1219 | top = min_t(int, top, (int)clips[i].y); | ||
| 1220 | bottom = max_t(int, bottom, (int)clips[i].y + clips[i].h); | ||
| 1135 | } | 1221 | } |
| 1136 | 1222 | ||
| 1137 | /* only need to do this once */ | 1223 | /* only need to do this once */ |
| 1138 | memset(cmd, 0, fifo_size); | 1224 | memset(cmd, 0, fifo_size); |
| 1139 | cmd->header.id = cpu_to_le32(SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN); | 1225 | cmd->header.id = cpu_to_le32(SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN); |
| 1140 | cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); | ||
| 1141 | |||
| 1142 | cmd->body.srcRect.left = 0; | ||
| 1143 | cmd->body.srcRect.right = surface->sizes[0].width; | ||
| 1144 | cmd->body.srcRect.top = 0; | ||
| 1145 | cmd->body.srcRect.bottom = surface->sizes[0].height; | ||
| 1146 | 1226 | ||
| 1147 | blits = (SVGASignedRect *)&cmd[1]; | 1227 | blits = (SVGASignedRect *)&cmd[1]; |
| 1228 | |||
| 1229 | cmd->body.srcRect.left = left; | ||
| 1230 | cmd->body.srcRect.right = right; | ||
| 1231 | cmd->body.srcRect.top = top; | ||
| 1232 | cmd->body.srcRect.bottom = bottom; | ||
| 1233 | |||
| 1148 | for (i = 0; i < num_clips; i++) { | 1234 | for (i = 0; i < num_clips; i++) { |
| 1149 | blits[i].left = clips[i].x; | 1235 | tmp[i].x1 = clips[i].x - left; |
| 1150 | blits[i].right = clips[i].x + clips[i].w; | 1236 | tmp[i].x2 = clips[i].x + clips[i].w - left; |
| 1151 | blits[i].top = clips[i].y; | 1237 | tmp[i].y1 = clips[i].y - top; |
| 1152 | blits[i].bottom = clips[i].y + clips[i].h; | 1238 | tmp[i].y2 = clips[i].y + clips[i].h - top; |
| 1153 | } | 1239 | } |
| 1154 | 1240 | ||
| 1155 | for (k = 0; k < num_units; k++) { | 1241 | for (k = 0; k < num_units; k++) { |
| 1156 | struct vmw_display_unit *unit = units[k]; | 1242 | struct vmw_display_unit *unit = units[k]; |
| 1157 | int clip_x1 = destX - unit->crtc.x; | 1243 | struct vmw_clip_rect clip; |
| 1158 | int clip_y1 = destY - unit->crtc.y; | 1244 | int num; |
| 1159 | int clip_x2 = clip_x1 + surface->sizes[0].width; | 1245 | |
| 1160 | int clip_y2 = clip_y1 + surface->sizes[0].height; | 1246 | clip.x1 = left + destX - unit->crtc.x; |
| 1247 | clip.y1 = top + destY - unit->crtc.y; | ||
| 1248 | clip.x2 = right + destX - unit->crtc.x; | ||
| 1249 | clip.y2 = bottom + destY - unit->crtc.y; | ||
| 1161 | 1250 | ||
| 1162 | /* skip any crtcs that misses the clip region */ | 1251 | /* skip any crtcs that misses the clip region */ |
| 1163 | if (clip_x1 >= unit->crtc.mode.hdisplay || | 1252 | if (clip.x1 >= unit->crtc.mode.hdisplay || |
| 1164 | clip_y1 >= unit->crtc.mode.vdisplay || | 1253 | clip.y1 >= unit->crtc.mode.vdisplay || |
| 1165 | clip_x2 <= 0 || clip_y2 <= 0) | 1254 | clip.x2 <= 0 || clip.y2 <= 0) |
| 1166 | continue; | 1255 | continue; |
| 1167 | 1256 | ||
| 1257 | /* | ||
| 1258 | * In order for the clip rects to be correctly scaled | ||
| 1259 | * the src and dest rects needs to be the same size. | ||
| 1260 | */ | ||
| 1261 | cmd->body.destRect.left = clip.x1; | ||
| 1262 | cmd->body.destRect.right = clip.x2; | ||
| 1263 | cmd->body.destRect.top = clip.y1; | ||
| 1264 | cmd->body.destRect.bottom = clip.y2; | ||
| 1265 | |||
| 1266 | /* create a clip rect of the crtc in dest coords */ | ||
| 1267 | clip.x2 = unit->crtc.mode.hdisplay - clip.x1; | ||
| 1268 | clip.y2 = unit->crtc.mode.vdisplay - clip.y1; | ||
| 1269 | clip.x1 = 0 - clip.x1; | ||
| 1270 | clip.y1 = 0 - clip.y1; | ||
| 1271 | |||
| 1168 | /* need to reset sid as it is changed by execbuf */ | 1272 | /* need to reset sid as it is changed by execbuf */ |
| 1169 | cmd->body.srcImage.sid = sid; | 1273 | cmd->body.srcImage.sid = sid; |
| 1170 | |||
| 1171 | cmd->body.destScreenId = unit->unit; | 1274 | cmd->body.destScreenId = unit->unit; |
| 1172 | 1275 | ||
| 1173 | /* | 1276 | /* clip and write blits to cmd stream */ |
| 1174 | * The blit command is a lot more resilient then the | 1277 | vmw_clip_cliprects(tmp, num_clips, clip, blits, &num); |
| 1175 | * readback command when it comes to clip rects. So its | ||
| 1176 | * okay to go out of bounds. | ||
| 1177 | */ | ||
| 1178 | 1278 | ||
| 1179 | cmd->body.destRect.left = clip_x1; | 1279 | /* if no cliprects hit skip this */ |
| 1180 | cmd->body.destRect.right = clip_x2; | 1280 | if (num == 0) |
| 1181 | cmd->body.destRect.top = clip_y1; | 1281 | continue; |
| 1182 | cmd->body.destRect.bottom = clip_y2; | ||
| 1183 | 1282 | ||
| 1283 | /* recalculate package length */ | ||
| 1284 | fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num; | ||
| 1285 | cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); | ||
| 1184 | ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, | 1286 | ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, |
| 1185 | fifo_size, 0, NULL); | 1287 | fifo_size, 0, NULL); |
| 1186 | 1288 | ||
| @@ -1189,6 +1291,8 @@ int vmw_kms_present(struct vmw_private *dev_priv, | |||
| 1189 | } | 1291 | } |
| 1190 | 1292 | ||
| 1191 | kfree(cmd); | 1293 | kfree(cmd); |
| 1294 | out_free_tmp: | ||
| 1295 | kfree(tmp); | ||
| 1192 | 1296 | ||
| 1193 | return ret; | 1297 | return ret; |
| 1194 | } | 1298 | } |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index af8e6e5bd964..e1cb8556355f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | |||
| @@ -62,9 +62,14 @@ struct vmw_framebuffer { | |||
| 62 | int vmw_cursor_update_image(struct vmw_private *dev_priv, | 62 | int vmw_cursor_update_image(struct vmw_private *dev_priv, |
| 63 | u32 *image, u32 width, u32 height, | 63 | u32 *image, u32 width, u32 height, |
| 64 | u32 hotspotX, u32 hotspotY); | 64 | u32 hotspotX, u32 hotspotY); |
| 65 | int vmw_cursor_update_dmabuf(struct vmw_private *dev_priv, | ||
| 66 | struct vmw_dma_buffer *dmabuf, | ||
| 67 | u32 width, u32 height, | ||
| 68 | u32 hotspotX, u32 hotspotY); | ||
| 65 | void vmw_cursor_update_position(struct vmw_private *dev_priv, | 69 | void vmw_cursor_update_position(struct vmw_private *dev_priv, |
| 66 | bool show, int x, int y); | 70 | bool show, int x, int y); |
| 67 | 71 | ||
| 72 | |||
| 68 | /** | 73 | /** |
| 69 | * Base class display unit. | 74 | * Base class display unit. |
| 70 | * | 75 | * |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index 90c5e3928491..8f8dbd43c33d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | |||
| @@ -74,9 +74,10 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) | |||
| 74 | { | 74 | { |
| 75 | struct vmw_legacy_display *lds = dev_priv->ldu_priv; | 75 | struct vmw_legacy_display *lds = dev_priv->ldu_priv; |
| 76 | struct vmw_legacy_display_unit *entry; | 76 | struct vmw_legacy_display_unit *entry; |
| 77 | struct vmw_display_unit *du = NULL; | ||
| 77 | struct drm_framebuffer *fb = NULL; | 78 | struct drm_framebuffer *fb = NULL; |
| 78 | struct drm_crtc *crtc = NULL; | 79 | struct drm_crtc *crtc = NULL; |
| 79 | int i = 0; | 80 | int i = 0, ret; |
| 80 | 81 | ||
| 81 | /* If there is no display topology the host just assumes | 82 | /* If there is no display topology the host just assumes |
| 82 | * that the guest will set the same layout as the host. | 83 | * that the guest will set the same layout as the host. |
| @@ -129,6 +130,25 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) | |||
| 129 | 130 | ||
| 130 | lds->last_num_active = lds->num_active; | 131 | lds->last_num_active = lds->num_active; |
| 131 | 132 | ||
| 133 | |||
| 134 | /* Find the first du with a cursor. */ | ||
| 135 | list_for_each_entry(entry, &lds->active, active) { | ||
| 136 | du = &entry->base; | ||
| 137 | |||
| 138 | if (!du->cursor_dmabuf) | ||
| 139 | continue; | ||
| 140 | |||
| 141 | ret = vmw_cursor_update_dmabuf(dev_priv, | ||
| 142 | du->cursor_dmabuf, | ||
| 143 | 64, 64, | ||
| 144 | du->hotspot_x, | ||
| 145 | du->hotspot_y); | ||
| 146 | if (ret == 0) | ||
| 147 | break; | ||
| 148 | |||
| 149 | DRM_ERROR("Could not update cursor image\n"); | ||
| 150 | } | ||
| 151 | |||
| 132 | return 0; | 152 | return 0; |
| 133 | } | 153 | } |
| 134 | 154 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 86c5e4cceb31..1c7f09e26819 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
| @@ -1190,6 +1190,29 @@ void vmw_resource_unreserve(struct list_head *list) | |||
| 1190 | write_unlock(lock); | 1190 | write_unlock(lock); |
| 1191 | } | 1191 | } |
| 1192 | 1192 | ||
| 1193 | /** | ||
| 1194 | * Helper function that looks either a surface or dmabuf. | ||
| 1195 | * | ||
| 1196 | * The pointer this pointed at by out_surf and out_buf needs to be null. | ||
| 1197 | */ | ||
| 1198 | int vmw_user_lookup_handle(struct vmw_private *dev_priv, | ||
| 1199 | struct ttm_object_file *tfile, | ||
| 1200 | uint32_t handle, | ||
| 1201 | struct vmw_surface **out_surf, | ||
| 1202 | struct vmw_dma_buffer **out_buf) | ||
| 1203 | { | ||
| 1204 | int ret; | ||
| 1205 | |||
| 1206 | BUG_ON(*out_surf || *out_buf); | ||
| 1207 | |||
| 1208 | ret = vmw_user_surface_lookup_handle(dev_priv, tfile, handle, out_surf); | ||
| 1209 | if (!ret) | ||
| 1210 | return 0; | ||
| 1211 | |||
| 1212 | ret = vmw_user_dmabuf_lookup(tfile, handle, out_buf); | ||
| 1213 | return ret; | ||
| 1214 | } | ||
| 1215 | |||
| 1193 | 1216 | ||
| 1194 | int vmw_user_surface_lookup_handle(struct vmw_private *dev_priv, | 1217 | int vmw_user_surface_lookup_handle(struct vmw_private *dev_priv, |
| 1195 | struct ttm_object_file *tfile, | 1218 | struct ttm_object_file *tfile, |
diff --git a/drivers/hwmon/jz4740-hwmon.c b/drivers/hwmon/jz4740-hwmon.c index 7a48b1eb4233..5253d23361d9 100644 --- a/drivers/hwmon/jz4740-hwmon.c +++ b/drivers/hwmon/jz4740-hwmon.c | |||
| @@ -59,7 +59,7 @@ static ssize_t jz4740_hwmon_read_adcin(struct device *dev, | |||
| 59 | { | 59 | { |
| 60 | struct jz4740_hwmon *hwmon = dev_get_drvdata(dev); | 60 | struct jz4740_hwmon *hwmon = dev_get_drvdata(dev); |
| 61 | struct completion *completion = &hwmon->read_completion; | 61 | struct completion *completion = &hwmon->read_completion; |
| 62 | unsigned long t; | 62 | long t; |
| 63 | unsigned long val; | 63 | unsigned long val; |
| 64 | int ret; | 64 | int ret; |
| 65 | 65 | ||
| @@ -203,7 +203,7 @@ static int __devexit jz4740_hwmon_remove(struct platform_device *pdev) | |||
| 203 | return 0; | 203 | return 0; |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | struct platform_driver jz4740_hwmon_driver = { | 206 | static struct platform_driver jz4740_hwmon_driver = { |
| 207 | .probe = jz4740_hwmon_probe, | 207 | .probe = jz4740_hwmon_probe, |
| 208 | .remove = __devexit_p(jz4740_hwmon_remove), | 208 | .remove = __devexit_p(jz4740_hwmon_remove), |
| 209 | .driver = { | 209 | .driver = { |
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index 8cebef49aeac..18936ac9d51c 100644 --- a/drivers/i2c/busses/i2c-eg20t.c +++ b/drivers/i2c/busses/i2c-eg20t.c | |||
| @@ -893,6 +893,13 @@ static int __devinit pch_i2c_probe(struct pci_dev *pdev, | |||
| 893 | /* Set the number of I2C channel instance */ | 893 | /* Set the number of I2C channel instance */ |
| 894 | adap_info->ch_num = id->driver_data; | 894 | adap_info->ch_num = id->driver_data; |
| 895 | 895 | ||
| 896 | ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED, | ||
| 897 | KBUILD_MODNAME, adap_info); | ||
| 898 | if (ret) { | ||
| 899 | pch_pci_err(pdev, "request_irq FAILED\n"); | ||
| 900 | goto err_request_irq; | ||
| 901 | } | ||
| 902 | |||
| 896 | for (i = 0; i < adap_info->ch_num; i++) { | 903 | for (i = 0; i < adap_info->ch_num; i++) { |
| 897 | pch_adap = &adap_info->pch_data[i].pch_adapter; | 904 | pch_adap = &adap_info->pch_data[i].pch_adapter; |
| 898 | adap_info->pch_i2c_suspended = false; | 905 | adap_info->pch_i2c_suspended = false; |
| @@ -910,28 +917,23 @@ static int __devinit pch_i2c_probe(struct pci_dev *pdev, | |||
| 910 | 917 | ||
| 911 | pch_adap->dev.parent = &pdev->dev; | 918 | pch_adap->dev.parent = &pdev->dev; |
| 912 | 919 | ||
| 920 | pch_i2c_init(&adap_info->pch_data[i]); | ||
| 913 | ret = i2c_add_adapter(pch_adap); | 921 | ret = i2c_add_adapter(pch_adap); |
| 914 | if (ret) { | 922 | if (ret) { |
| 915 | pch_pci_err(pdev, "i2c_add_adapter[ch:%d] FAILED\n", i); | 923 | pch_pci_err(pdev, "i2c_add_adapter[ch:%d] FAILED\n", i); |
| 916 | goto err_i2c_add_adapter; | 924 | goto err_add_adapter; |
| 917 | } | 925 | } |
| 918 | |||
| 919 | pch_i2c_init(&adap_info->pch_data[i]); | ||
| 920 | } | ||
| 921 | ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED, | ||
| 922 | KBUILD_MODNAME, adap_info); | ||
| 923 | if (ret) { | ||
| 924 | pch_pci_err(pdev, "request_irq FAILED\n"); | ||
| 925 | goto err_i2c_add_adapter; | ||
| 926 | } | 926 | } |
| 927 | 927 | ||
| 928 | pci_set_drvdata(pdev, adap_info); | 928 | pci_set_drvdata(pdev, adap_info); |
| 929 | pch_pci_dbg(pdev, "returns %d.\n", ret); | 929 | pch_pci_dbg(pdev, "returns %d.\n", ret); |
| 930 | return 0; | 930 | return 0; |
| 931 | 931 | ||
| 932 | err_i2c_add_adapter: | 932 | err_add_adapter: |
| 933 | for (j = 0; j < i; j++) | 933 | for (j = 0; j < i; j++) |
| 934 | i2c_del_adapter(&adap_info->pch_data[j].pch_adapter); | 934 | i2c_del_adapter(&adap_info->pch_data[j].pch_adapter); |
| 935 | free_irq(pdev->irq, adap_info); | ||
| 936 | err_request_irq: | ||
| 935 | pci_iounmap(pdev, base_addr); | 937 | pci_iounmap(pdev, base_addr); |
| 936 | err_pci_iomap: | 938 | err_pci_iomap: |
| 937 | pci_release_regions(pdev); | 939 | pci_release_regions(pdev); |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index a43d0023446a..fa23faa20f0e 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
| @@ -1047,13 +1047,14 @@ omap_i2c_probe(struct platform_device *pdev) | |||
| 1047 | * size. This is to ensure that we can handle the status on int | 1047 | * size. This is to ensure that we can handle the status on int |
| 1048 | * call back latencies. | 1048 | * call back latencies. |
| 1049 | */ | 1049 | */ |
| 1050 | if (dev->rev >= OMAP_I2C_REV_ON_3530_4430) { | 1050 | |
| 1051 | dev->fifo_size = 0; | 1051 | dev->fifo_size = (dev->fifo_size / 2); |
| 1052 | |||
| 1053 | if (dev->rev >= OMAP_I2C_REV_ON_3530_4430) | ||
| 1052 | dev->b_hw = 0; /* Disable hardware fixes */ | 1054 | dev->b_hw = 0; /* Disable hardware fixes */ |
| 1053 | } else { | 1055 | else |
| 1054 | dev->fifo_size = (dev->fifo_size / 2); | ||
| 1055 | dev->b_hw = 1; /* Enable hardware fixes */ | 1056 | dev->b_hw = 1; /* Enable hardware fixes */ |
| 1056 | } | 1057 | |
| 1057 | /* calculate wakeup latency constraint for MPU */ | 1058 | /* calculate wakeup latency constraint for MPU */ |
| 1058 | if (dev->set_mpu_wkup_lat != NULL) | 1059 | if (dev->set_mpu_wkup_lat != NULL) |
| 1059 | dev->latency = (1000000 * dev->fifo_size) / | 1060 | dev->latency = (1000000 * dev->fifo_size) / |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 2754cef86a06..4c1718081685 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
| @@ -534,6 +534,7 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, | |||
| 534 | 534 | ||
| 535 | /* first, try busy waiting briefly */ | 535 | /* first, try busy waiting briefly */ |
| 536 | do { | 536 | do { |
| 537 | cpu_relax(); | ||
| 537 | iicstat = readl(i2c->regs + S3C2410_IICSTAT); | 538 | iicstat = readl(i2c->regs + S3C2410_IICSTAT); |
| 538 | } while ((iicstat & S3C2410_IICSTAT_START) && --spins); | 539 | } while ((iicstat & S3C2410_IICSTAT_START) && --spins); |
| 539 | 540 | ||
| @@ -786,7 +787,7 @@ static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c) | |||
| 786 | #else | 787 | #else |
| 787 | static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c) | 788 | static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c) |
| 788 | { | 789 | { |
| 789 | return -EINVAL; | 790 | return 0; |
| 790 | } | 791 | } |
| 791 | 792 | ||
| 792 | static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c) | 793 | static void s3c24xx_i2c_dt_gpio_free(struct s3c24xx_i2c *i2c) |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 75ff821c0af0..d0d4aa9f4802 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
| @@ -2513,6 +2513,9 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, | |||
| 2513 | 2513 | ||
| 2514 | req.private_data_len = sizeof(struct cma_hdr) + | 2514 | req.private_data_len = sizeof(struct cma_hdr) + |
| 2515 | conn_param->private_data_len; | 2515 | conn_param->private_data_len; |
| 2516 | if (req.private_data_len < conn_param->private_data_len) | ||
| 2517 | return -EINVAL; | ||
| 2518 | |||
| 2516 | req.private_data = kzalloc(req.private_data_len, GFP_ATOMIC); | 2519 | req.private_data = kzalloc(req.private_data_len, GFP_ATOMIC); |
| 2517 | if (!req.private_data) | 2520 | if (!req.private_data) |
| 2518 | return -ENOMEM; | 2521 | return -ENOMEM; |
| @@ -2562,6 +2565,9 @@ static int cma_connect_ib(struct rdma_id_private *id_priv, | |||
| 2562 | memset(&req, 0, sizeof req); | 2565 | memset(&req, 0, sizeof req); |
| 2563 | offset = cma_user_data_offset(id_priv->id.ps); | 2566 | offset = cma_user_data_offset(id_priv->id.ps); |
| 2564 | req.private_data_len = offset + conn_param->private_data_len; | 2567 | req.private_data_len = offset + conn_param->private_data_len; |
| 2568 | if (req.private_data_len < conn_param->private_data_len) | ||
| 2569 | return -EINVAL; | ||
| 2570 | |||
| 2565 | private_data = kzalloc(req.private_data_len, GFP_ATOMIC); | 2571 | private_data = kzalloc(req.private_data_len, GFP_ATOMIC); |
| 2566 | if (!private_data) | 2572 | if (!private_data) |
| 2567 | return -ENOMEM; | 2573 | return -ENOMEM; |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 77f3dbc0aaa1..18836cdf1e10 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
| @@ -1244,7 +1244,8 @@ err_reg: | |||
| 1244 | 1244 | ||
| 1245 | err_counter: | 1245 | err_counter: |
| 1246 | for (; i; --i) | 1246 | for (; i; --i) |
| 1247 | mlx4_counter_free(ibdev->dev, ibdev->counters[i - 1]); | 1247 | if (ibdev->counters[i - 1] != -1) |
| 1248 | mlx4_counter_free(ibdev->dev, ibdev->counters[i - 1]); | ||
| 1248 | 1249 | ||
| 1249 | err_map: | 1250 | err_map: |
| 1250 | iounmap(ibdev->uar_map); | 1251 | iounmap(ibdev->uar_map); |
| @@ -1275,7 +1276,8 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) | |||
| 1275 | } | 1276 | } |
| 1276 | iounmap(ibdev->uar_map); | 1277 | iounmap(ibdev->uar_map); |
| 1277 | for (p = 0; p < ibdev->num_ports; ++p) | 1278 | for (p = 0; p < ibdev->num_ports; ++p) |
| 1278 | mlx4_counter_free(ibdev->dev, ibdev->counters[p]); | 1279 | if (ibdev->counters[p] != -1) |
| 1280 | mlx4_counter_free(ibdev->dev, ibdev->counters[p]); | ||
| 1279 | mlx4_foreach_port(p, dev, MLX4_PORT_TYPE_IB) | 1281 | mlx4_foreach_port(p, dev, MLX4_PORT_TYPE_IB) |
| 1280 | mlx4_CLOSE_PORT(dev, p); | 1282 | mlx4_CLOSE_PORT(dev, p); |
| 1281 | 1283 | ||
diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c index 574600ef5b42..a7403248d83d 100644 --- a/drivers/infiniband/hw/qib/qib_file_ops.c +++ b/drivers/infiniband/hw/qib/qib_file_ops.c | |||
| @@ -1285,7 +1285,7 @@ static int setup_ctxt(struct qib_pportdata *ppd, int ctxt, | |||
| 1285 | strlcpy(rcd->comm, current->comm, sizeof(rcd->comm)); | 1285 | strlcpy(rcd->comm, current->comm, sizeof(rcd->comm)); |
| 1286 | ctxt_fp(fp) = rcd; | 1286 | ctxt_fp(fp) = rcd; |
| 1287 | qib_stats.sps_ctxts++; | 1287 | qib_stats.sps_ctxts++; |
| 1288 | dd->freectxts++; | 1288 | dd->freectxts--; |
| 1289 | ret = 0; | 1289 | ret = 0; |
| 1290 | goto bail; | 1290 | goto bail; |
| 1291 | 1291 | ||
| @@ -1794,7 +1794,7 @@ static int qib_close(struct inode *in, struct file *fp) | |||
| 1794 | if (dd->pageshadow) | 1794 | if (dd->pageshadow) |
| 1795 | unlock_expected_tids(rcd); | 1795 | unlock_expected_tids(rcd); |
| 1796 | qib_stats.sps_ctxts--; | 1796 | qib_stats.sps_ctxts--; |
| 1797 | dd->freectxts--; | 1797 | dd->freectxts++; |
| 1798 | } | 1798 | } |
| 1799 | 1799 | ||
| 1800 | mutex_unlock(&qib_mutex); | 1800 | mutex_unlock(&qib_mutex); |
diff --git a/drivers/input/misc/cma3000_d0x.c b/drivers/input/misc/cma3000_d0x.c index 80793f1608eb..06517e60e50c 100644 --- a/drivers/input/misc/cma3000_d0x.c +++ b/drivers/input/misc/cma3000_d0x.c | |||
| @@ -115,8 +115,8 @@ static void decode_mg(struct cma3000_accl_data *data, int *datax, | |||
| 115 | static irqreturn_t cma3000_thread_irq(int irq, void *dev_id) | 115 | static irqreturn_t cma3000_thread_irq(int irq, void *dev_id) |
| 116 | { | 116 | { |
| 117 | struct cma3000_accl_data *data = dev_id; | 117 | struct cma3000_accl_data *data = dev_id; |
| 118 | int datax, datay, dataz; | 118 | int datax, datay, dataz, intr_status; |
| 119 | u8 ctrl, mode, range, intr_status; | 119 | u8 ctrl, mode, range; |
| 120 | 120 | ||
| 121 | intr_status = CMA3000_READ(data, CMA3000_INTSTATUS, "interrupt status"); | 121 | intr_status = CMA3000_READ(data, CMA3000_INTSTATUS, "interrupt status"); |
| 122 | if (intr_status < 0) | 122 | if (intr_status < 0) |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index c080b828e5dc..a6dcd18e9adf 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| 27 | #include <linux/delay.h> | ||
| 27 | #include <linux/dmi.h> | 28 | #include <linux/dmi.h> |
| 28 | #include <linux/input/mt.h> | 29 | #include <linux/input/mt.h> |
| 29 | #include <linux/serio.h> | 30 | #include <linux/serio.h> |
| @@ -1220,6 +1221,16 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
| 1220 | 1221 | ||
| 1221 | do { | 1222 | do { |
| 1222 | psmouse_reset(psmouse); | 1223 | psmouse_reset(psmouse); |
| 1224 | if (retry) { | ||
| 1225 | /* | ||
| 1226 | * On some boxes, right after resuming, the touchpad | ||
| 1227 | * needs some time to finish initializing (I assume | ||
| 1228 | * it needs time to calibrate) and start responding | ||
| 1229 | * to Synaptics-specific queries, so let's wait a | ||
| 1230 | * bit. | ||
| 1231 | */ | ||
| 1232 | ssleep(1); | ||
| 1233 | } | ||
| 1223 | error = synaptics_detect(psmouse, 0); | 1234 | error = synaptics_detect(psmouse, 0); |
| 1224 | } while (error && ++retry < 3); | 1235 | } while (error && ++retry < 3); |
| 1225 | 1236 | ||
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index da0d8761e778..2ee47d01a3b4 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
| @@ -1470,6 +1470,9 @@ static const struct wacom_features wacom_features_0xE3 = | |||
| 1470 | static const struct wacom_features wacom_features_0xE6 = | 1470 | static const struct wacom_features wacom_features_0xE6 = |
| 1471 | { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, | 1471 | { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, |
| 1472 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 1472 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 1473 | static const struct wacom_features wacom_features_0xEC = | ||
| 1474 | { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, | ||
| 1475 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
| 1473 | static const struct wacom_features wacom_features_0x47 = | 1476 | static const struct wacom_features wacom_features_0x47 = |
| 1474 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, | 1477 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, |
| 1475 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 1478 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| @@ -1611,6 +1614,7 @@ const struct usb_device_id wacom_ids[] = { | |||
| 1611 | { USB_DEVICE_WACOM(0xE2) }, | 1614 | { USB_DEVICE_WACOM(0xE2) }, |
| 1612 | { USB_DEVICE_WACOM(0xE3) }, | 1615 | { USB_DEVICE_WACOM(0xE3) }, |
| 1613 | { USB_DEVICE_WACOM(0xE6) }, | 1616 | { USB_DEVICE_WACOM(0xE6) }, |
| 1617 | { USB_DEVICE_WACOM(0xEC) }, | ||
| 1614 | { USB_DEVICE_WACOM(0x47) }, | 1618 | { USB_DEVICE_WACOM(0x47) }, |
| 1615 | { USB_DEVICE_LENOVO(0x6004) }, | 1619 | { USB_DEVICE_LENOVO(0x6004) }, |
| 1616 | { } | 1620 | { } |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c0c7820d4c46..bdc447fd4766 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -405,6 +405,9 @@ int dmar_disabled = 0; | |||
| 405 | int dmar_disabled = 1; | 405 | int dmar_disabled = 1; |
| 406 | #endif /*CONFIG_INTEL_IOMMU_DEFAULT_ON*/ | 406 | #endif /*CONFIG_INTEL_IOMMU_DEFAULT_ON*/ |
| 407 | 407 | ||
| 408 | int intel_iommu_enabled = 0; | ||
| 409 | EXPORT_SYMBOL_GPL(intel_iommu_enabled); | ||
| 410 | |||
| 408 | static int dmar_map_gfx = 1; | 411 | static int dmar_map_gfx = 1; |
| 409 | static int dmar_forcedac; | 412 | static int dmar_forcedac; |
| 410 | static int intel_iommu_strict; | 413 | static int intel_iommu_strict; |
| @@ -3524,7 +3527,7 @@ found: | |||
| 3524 | return 0; | 3527 | return 0; |
| 3525 | } | 3528 | } |
| 3526 | 3529 | ||
| 3527 | int dmar_parse_rmrr_atsr_dev(void) | 3530 | int __init dmar_parse_rmrr_atsr_dev(void) |
| 3528 | { | 3531 | { |
| 3529 | struct dmar_rmrr_unit *rmrr, *rmrr_n; | 3532 | struct dmar_rmrr_unit *rmrr, *rmrr_n; |
| 3530 | struct dmar_atsr_unit *atsr, *atsr_n; | 3533 | struct dmar_atsr_unit *atsr, *atsr_n; |
| @@ -3647,6 +3650,8 @@ int __init intel_iommu_init(void) | |||
| 3647 | 3650 | ||
| 3648 | bus_register_notifier(&pci_bus_type, &device_nb); | 3651 | bus_register_notifier(&pci_bus_type, &device_nb); |
| 3649 | 3652 | ||
| 3653 | intel_iommu_enabled = 1; | ||
| 3654 | |||
| 3650 | return 0; | 3655 | return 0; |
| 3651 | } | 3656 | } |
| 3652 | 3657 | ||
diff --git a/drivers/iommu/intr_remapping.c b/drivers/iommu/intr_remapping.c index 07c9f189f314..6777ca049471 100644 --- a/drivers/iommu/intr_remapping.c +++ b/drivers/iommu/intr_remapping.c | |||
| @@ -773,7 +773,7 @@ int __init parse_ioapics_under_ir(void) | |||
| 773 | return ir_supported; | 773 | return ir_supported; |
| 774 | } | 774 | } |
| 775 | 775 | ||
| 776 | int ir_dev_scope_init(void) | 776 | int __init ir_dev_scope_init(void) |
| 777 | { | 777 | { |
| 778 | if (!intr_remapping_enabled) | 778 | if (!intr_remapping_enabled) |
| 779 | return 0; | 779 | return 0; |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 7878712721bf..6d03774b176e 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
| @@ -1106,10 +1106,12 @@ void bitmap_write_all(struct bitmap *bitmap) | |||
| 1106 | */ | 1106 | */ |
| 1107 | int i; | 1107 | int i; |
| 1108 | 1108 | ||
| 1109 | spin_lock_irq(&bitmap->lock); | ||
| 1109 | for (i = 0; i < bitmap->file_pages; i++) | 1110 | for (i = 0; i < bitmap->file_pages; i++) |
| 1110 | set_page_attr(bitmap, bitmap->filemap[i], | 1111 | set_page_attr(bitmap, bitmap->filemap[i], |
| 1111 | BITMAP_PAGE_NEEDWRITE); | 1112 | BITMAP_PAGE_NEEDWRITE); |
| 1112 | bitmap->allclean = 0; | 1113 | bitmap->allclean = 0; |
| 1114 | spin_unlock_irq(&bitmap->lock); | ||
| 1113 | } | 1115 | } |
| 1114 | 1116 | ||
| 1115 | static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc) | 1117 | static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc) |
| @@ -1391,9 +1393,6 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto | |||
| 1391 | atomic_read(&bitmap->behind_writes), | 1393 | atomic_read(&bitmap->behind_writes), |
| 1392 | bitmap->mddev->bitmap_info.max_write_behind); | 1394 | bitmap->mddev->bitmap_info.max_write_behind); |
| 1393 | } | 1395 | } |
| 1394 | if (bitmap->mddev->degraded) | ||
| 1395 | /* Never clear bits or update events_cleared when degraded */ | ||
| 1396 | success = 0; | ||
| 1397 | 1396 | ||
| 1398 | while (sectors) { | 1397 | while (sectors) { |
| 1399 | sector_t blocks; | 1398 | sector_t blocks; |
| @@ -1407,7 +1406,7 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto | |||
| 1407 | return; | 1406 | return; |
| 1408 | } | 1407 | } |
| 1409 | 1408 | ||
| 1410 | if (success && | 1409 | if (success && !bitmap->mddev->degraded && |
| 1411 | bitmap->events_cleared < bitmap->mddev->events) { | 1410 | bitmap->events_cleared < bitmap->mddev->events) { |
| 1412 | bitmap->events_cleared = bitmap->mddev->events; | 1411 | bitmap->events_cleared = bitmap->mddev->events; |
| 1413 | bitmap->need_sync = 1; | 1412 | bitmap->need_sync = 1; |
| @@ -1605,7 +1604,9 @@ void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e) | |||
| 1605 | for (chunk = s; chunk <= e; chunk++) { | 1604 | for (chunk = s; chunk <= e; chunk++) { |
| 1606 | sector_t sec = (sector_t)chunk << CHUNK_BLOCK_SHIFT(bitmap); | 1605 | sector_t sec = (sector_t)chunk << CHUNK_BLOCK_SHIFT(bitmap); |
| 1607 | bitmap_set_memory_bits(bitmap, sec, 1); | 1606 | bitmap_set_memory_bits(bitmap, sec, 1); |
| 1607 | spin_lock_irq(&bitmap->lock); | ||
| 1608 | bitmap_file_set_bit(bitmap, sec); | 1608 | bitmap_file_set_bit(bitmap, sec); |
| 1609 | spin_unlock_irq(&bitmap->lock); | ||
| 1609 | if (sec < bitmap->mddev->recovery_cp) | 1610 | if (sec < bitmap->mddev->recovery_cp) |
| 1610 | /* We are asserting that the array is dirty, | 1611 | /* We are asserting that the array is dirty, |
| 1611 | * so move the recovery_cp address back so | 1612 | * so move the recovery_cp address back so |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index c3273efd08cb..627456542fb3 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
| @@ -230,6 +230,7 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev) | |||
| 230 | return -EINVAL; | 230 | return -EINVAL; |
| 231 | 231 | ||
| 232 | rdev->raid_disk = rdev->saved_raid_disk; | 232 | rdev->raid_disk = rdev->saved_raid_disk; |
| 233 | rdev->saved_raid_disk = -1; | ||
| 233 | 234 | ||
| 234 | newconf = linear_conf(mddev,mddev->raid_disks+1); | 235 | newconf = linear_conf(mddev,mddev->raid_disks+1); |
| 235 | 236 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 84acfe7d10e4..f47f1f8ac44b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -570,7 +570,7 @@ static void mddev_put(struct mddev *mddev) | |||
| 570 | mddev->ctime == 0 && !mddev->hold_active) { | 570 | mddev->ctime == 0 && !mddev->hold_active) { |
| 571 | /* Array is not configured at all, and not held active, | 571 | /* Array is not configured at all, and not held active, |
| 572 | * so destroy it */ | 572 | * so destroy it */ |
| 573 | list_del(&mddev->all_mddevs); | 573 | list_del_init(&mddev->all_mddevs); |
| 574 | bs = mddev->bio_set; | 574 | bs = mddev->bio_set; |
| 575 | mddev->bio_set = NULL; | 575 | mddev->bio_set = NULL; |
| 576 | if (mddev->gendisk) { | 576 | if (mddev->gendisk) { |
| @@ -2546,7 +2546,8 @@ state_show(struct md_rdev *rdev, char *page) | |||
| 2546 | sep = ","; | 2546 | sep = ","; |
| 2547 | } | 2547 | } |
| 2548 | if (test_bit(Blocked, &rdev->flags) || | 2548 | if (test_bit(Blocked, &rdev->flags) || |
| 2549 | rdev->badblocks.unacked_exist) { | 2549 | (rdev->badblocks.unacked_exist |
| 2550 | && !test_bit(Faulty, &rdev->flags))) { | ||
| 2550 | len += sprintf(page+len, "%sblocked", sep); | 2551 | len += sprintf(page+len, "%sblocked", sep); |
| 2551 | sep = ","; | 2552 | sep = ","; |
| 2552 | } | 2553 | } |
| @@ -3788,6 +3789,8 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len) | |||
| 3788 | if (err) | 3789 | if (err) |
| 3789 | return err; | 3790 | return err; |
| 3790 | else { | 3791 | else { |
| 3792 | if (mddev->hold_active == UNTIL_IOCTL) | ||
| 3793 | mddev->hold_active = 0; | ||
| 3791 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 3794 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
| 3792 | return len; | 3795 | return len; |
| 3793 | } | 3796 | } |
| @@ -4487,11 +4490,20 @@ md_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | |||
| 4487 | 4490 | ||
| 4488 | if (!entry->show) | 4491 | if (!entry->show) |
| 4489 | return -EIO; | 4492 | return -EIO; |
| 4493 | spin_lock(&all_mddevs_lock); | ||
| 4494 | if (list_empty(&mddev->all_mddevs)) { | ||
| 4495 | spin_unlock(&all_mddevs_lock); | ||
| 4496 | return -EBUSY; | ||
| 4497 | } | ||
| 4498 | mddev_get(mddev); | ||
| 4499 | spin_unlock(&all_mddevs_lock); | ||
| 4500 | |||
| 4490 | rv = mddev_lock(mddev); | 4501 | rv = mddev_lock(mddev); |
| 4491 | if (!rv) { | 4502 | if (!rv) { |
| 4492 | rv = entry->show(mddev, page); | 4503 | rv = entry->show(mddev, page); |
| 4493 | mddev_unlock(mddev); | 4504 | mddev_unlock(mddev); |
| 4494 | } | 4505 | } |
| 4506 | mddev_put(mddev); | ||
| 4495 | return rv; | 4507 | return rv; |
| 4496 | } | 4508 | } |
| 4497 | 4509 | ||
| @@ -4507,13 +4519,19 @@ md_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 4507 | return -EIO; | 4519 | return -EIO; |
| 4508 | if (!capable(CAP_SYS_ADMIN)) | 4520 | if (!capable(CAP_SYS_ADMIN)) |
| 4509 | return -EACCES; | 4521 | return -EACCES; |
| 4522 | spin_lock(&all_mddevs_lock); | ||
| 4523 | if (list_empty(&mddev->all_mddevs)) { | ||
| 4524 | spin_unlock(&all_mddevs_lock); | ||
| 4525 | return -EBUSY; | ||
| 4526 | } | ||
| 4527 | mddev_get(mddev); | ||
| 4528 | spin_unlock(&all_mddevs_lock); | ||
| 4510 | rv = mddev_lock(mddev); | 4529 | rv = mddev_lock(mddev); |
| 4511 | if (mddev->hold_active == UNTIL_IOCTL) | ||
| 4512 | mddev->hold_active = 0; | ||
| 4513 | if (!rv) { | 4530 | if (!rv) { |
| 4514 | rv = entry->store(mddev, page, length); | 4531 | rv = entry->store(mddev, page, length); |
| 4515 | mddev_unlock(mddev); | 4532 | mddev_unlock(mddev); |
| 4516 | } | 4533 | } |
| 4534 | mddev_put(mddev); | ||
| 4517 | return rv; | 4535 | return rv; |
| 4518 | } | 4536 | } |
| 4519 | 4537 | ||
| @@ -7342,8 +7360,7 @@ static int remove_and_add_spares(struct mddev *mddev) | |||
| 7342 | spares++; | 7360 | spares++; |
| 7343 | md_new_event(mddev); | 7361 | md_new_event(mddev); |
| 7344 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 7362 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
| 7345 | } else | 7363 | } |
| 7346 | break; | ||
| 7347 | } | 7364 | } |
| 7348 | } | 7365 | } |
| 7349 | } | 7366 | } |
| @@ -7840,6 +7857,7 @@ int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors, | |||
| 7840 | s + rdev->data_offset, sectors, acknowledged); | 7857 | s + rdev->data_offset, sectors, acknowledged); |
| 7841 | if (rv) { | 7858 | if (rv) { |
| 7842 | /* Make sure they get written out promptly */ | 7859 | /* Make sure they get written out promptly */ |
| 7860 | sysfs_notify_dirent_safe(rdev->sysfs_state); | ||
| 7843 | set_bit(MD_CHANGE_CLEAN, &rdev->mddev->flags); | 7861 | set_bit(MD_CHANGE_CLEAN, &rdev->mddev->flags); |
| 7844 | md_wakeup_thread(rdev->mddev->thread); | 7862 | md_wakeup_thread(rdev->mddev->thread); |
| 7845 | } | 7863 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 297e26092178..858fdbb7eb07 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -3036,6 +3036,8 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
| 3036 | if (dev->written) | 3036 | if (dev->written) |
| 3037 | s->written++; | 3037 | s->written++; |
| 3038 | rdev = rcu_dereference(conf->disks[i].rdev); | 3038 | rdev = rcu_dereference(conf->disks[i].rdev); |
| 3039 | if (rdev && test_bit(Faulty, &rdev->flags)) | ||
| 3040 | rdev = NULL; | ||
| 3039 | if (rdev) { | 3041 | if (rdev) { |
| 3040 | is_bad = is_badblock(rdev, sh->sector, STRIPE_SECTORS, | 3042 | is_bad = is_badblock(rdev, sh->sector, STRIPE_SECTORS, |
| 3041 | &first_bad, &bad_sectors); | 3043 | &first_bad, &bad_sectors); |
| @@ -3063,12 +3065,18 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
| 3063 | } | 3065 | } |
| 3064 | } else if (test_bit(In_sync, &rdev->flags)) | 3066 | } else if (test_bit(In_sync, &rdev->flags)) |
| 3065 | set_bit(R5_Insync, &dev->flags); | 3067 | set_bit(R5_Insync, &dev->flags); |
| 3066 | else if (!test_bit(Faulty, &rdev->flags)) { | 3068 | else if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) |
| 3067 | /* in sync if before recovery_offset */ | 3069 | /* in sync if before recovery_offset */ |
| 3068 | if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) | 3070 | set_bit(R5_Insync, &dev->flags); |
| 3069 | set_bit(R5_Insync, &dev->flags); | 3071 | else if (test_bit(R5_UPTODATE, &dev->flags) && |
| 3070 | } | 3072 | test_bit(R5_Expanded, &dev->flags)) |
| 3071 | if (test_bit(R5_WriteError, &dev->flags)) { | 3073 | /* If we've reshaped into here, we assume it is Insync. |
| 3074 | * We will shortly update recovery_offset to make | ||
| 3075 | * it official. | ||
| 3076 | */ | ||
| 3077 | set_bit(R5_Insync, &dev->flags); | ||
| 3078 | |||
| 3079 | if (rdev && test_bit(R5_WriteError, &dev->flags)) { | ||
| 3072 | clear_bit(R5_Insync, &dev->flags); | 3080 | clear_bit(R5_Insync, &dev->flags); |
| 3073 | if (!test_bit(Faulty, &rdev->flags)) { | 3081 | if (!test_bit(Faulty, &rdev->flags)) { |
| 3074 | s->handle_bad_blocks = 1; | 3082 | s->handle_bad_blocks = 1; |
| @@ -3076,7 +3084,7 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
| 3076 | } else | 3084 | } else |
| 3077 | clear_bit(R5_WriteError, &dev->flags); | 3085 | clear_bit(R5_WriteError, &dev->flags); |
| 3078 | } | 3086 | } |
| 3079 | if (test_bit(R5_MadeGood, &dev->flags)) { | 3087 | if (rdev && test_bit(R5_MadeGood, &dev->flags)) { |
| 3080 | if (!test_bit(Faulty, &rdev->flags)) { | 3088 | if (!test_bit(Faulty, &rdev->flags)) { |
| 3081 | s->handle_bad_blocks = 1; | 3089 | s->handle_bad_blocks = 1; |
| 3082 | atomic_inc(&rdev->nr_pending); | 3090 | atomic_inc(&rdev->nr_pending); |
diff --git a/drivers/media/common/tuners/mxl5007t.c b/drivers/media/common/tuners/mxl5007t.c index 7eb1bf75cd07..5d02221e99dd 100644 --- a/drivers/media/common/tuners/mxl5007t.c +++ b/drivers/media/common/tuners/mxl5007t.c | |||
| @@ -488,9 +488,10 @@ static int mxl5007t_write_regs(struct mxl5007t_state *state, | |||
| 488 | 488 | ||
| 489 | static int mxl5007t_read_reg(struct mxl5007t_state *state, u8 reg, u8 *val) | 489 | static int mxl5007t_read_reg(struct mxl5007t_state *state, u8 reg, u8 *val) |
| 490 | { | 490 | { |
| 491 | u8 buf[2] = { 0xfb, reg }; | ||
| 491 | struct i2c_msg msg[] = { | 492 | struct i2c_msg msg[] = { |
| 492 | { .addr = state->i2c_props.addr, .flags = 0, | 493 | { .addr = state->i2c_props.addr, .flags = 0, |
| 493 | .buf = ®, .len = 1 }, | 494 | .buf = buf, .len = 2 }, |
| 494 | { .addr = state->i2c_props.addr, .flags = I2C_M_RD, | 495 | { .addr = state->i2c_props.addr, .flags = I2C_M_RD, |
| 495 | .buf = val, .len = 1 }, | 496 | .buf = val, .len = 1 }, |
| 496 | }; | 497 | }; |
diff --git a/drivers/media/common/tuners/tda18218.c b/drivers/media/common/tuners/tda18218.c index aacfe2387e28..4fc29730a12c 100644 --- a/drivers/media/common/tuners/tda18218.c +++ b/drivers/media/common/tuners/tda18218.c | |||
| @@ -141,7 +141,7 @@ static int tda18218_set_params(struct dvb_frontend *fe, | |||
| 141 | switch (params->u.ofdm.bandwidth) { | 141 | switch (params->u.ofdm.bandwidth) { |
| 142 | case BANDWIDTH_6_MHZ: | 142 | case BANDWIDTH_6_MHZ: |
| 143 | LP_Fc = 0; | 143 | LP_Fc = 0; |
| 144 | LO_Frac = params->frequency + 4000000; | 144 | LO_Frac = params->frequency + 3000000; |
| 145 | break; | 145 | break; |
| 146 | case BANDWIDTH_7_MHZ: | 146 | case BANDWIDTH_7_MHZ: |
| 147 | LP_Fc = 1; | 147 | LP_Fc = 1; |
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 303f22ea04c0..01bb8daf4b09 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c | |||
| @@ -189,7 +189,7 @@ struct ati_remote { | |||
| 189 | dma_addr_t inbuf_dma; | 189 | dma_addr_t inbuf_dma; |
| 190 | dma_addr_t outbuf_dma; | 190 | dma_addr_t outbuf_dma; |
| 191 | 191 | ||
| 192 | unsigned char old_data[2]; /* Detect duplicate events */ | 192 | unsigned char old_data; /* Detect duplicate events */ |
| 193 | unsigned long old_jiffies; | 193 | unsigned long old_jiffies; |
| 194 | unsigned long acc_jiffies; /* handle acceleration */ | 194 | unsigned long acc_jiffies; /* handle acceleration */ |
| 195 | unsigned long first_jiffies; | 195 | unsigned long first_jiffies; |
| @@ -221,35 +221,35 @@ struct ati_remote { | |||
| 221 | /* Translation table from hardware messages to input events. */ | 221 | /* Translation table from hardware messages to input events. */ |
| 222 | static const struct { | 222 | static const struct { |
| 223 | short kind; | 223 | short kind; |
| 224 | unsigned char data1, data2; | 224 | unsigned char data; |
| 225 | int type; | 225 | int type; |
| 226 | unsigned int code; | 226 | unsigned int code; |
| 227 | int value; | 227 | int value; |
| 228 | } ati_remote_tbl[] = { | 228 | } ati_remote_tbl[] = { |
| 229 | /* Directional control pad axes */ | 229 | /* Directional control pad axes */ |
| 230 | {KIND_ACCEL, 0x35, 0x70, EV_REL, REL_X, -1}, /* left */ | 230 | {KIND_ACCEL, 0x70, EV_REL, REL_X, -1}, /* left */ |
| 231 | {KIND_ACCEL, 0x36, 0x71, EV_REL, REL_X, 1}, /* right */ | 231 | {KIND_ACCEL, 0x71, EV_REL, REL_X, 1}, /* right */ |
| 232 | {KIND_ACCEL, 0x37, 0x72, EV_REL, REL_Y, -1}, /* up */ | 232 | {KIND_ACCEL, 0x72, EV_REL, REL_Y, -1}, /* up */ |
| 233 | {KIND_ACCEL, 0x38, 0x73, EV_REL, REL_Y, 1}, /* down */ | 233 | {KIND_ACCEL, 0x73, EV_REL, REL_Y, 1}, /* down */ |
| 234 | /* Directional control pad diagonals */ | 234 | /* Directional control pad diagonals */ |
| 235 | {KIND_LU, 0x39, 0x74, EV_REL, 0, 0}, /* left up */ | 235 | {KIND_LU, 0x74, EV_REL, 0, 0}, /* left up */ |
| 236 | {KIND_RU, 0x3a, 0x75, EV_REL, 0, 0}, /* right up */ | 236 | {KIND_RU, 0x75, EV_REL, 0, 0}, /* right up */ |
| 237 | {KIND_LD, 0x3c, 0x77, EV_REL, 0, 0}, /* left down */ | 237 | {KIND_LD, 0x77, EV_REL, 0, 0}, /* left down */ |
| 238 | {KIND_RD, 0x3b, 0x76, EV_REL, 0, 0}, /* right down */ | 238 | {KIND_RD, 0x76, EV_REL, 0, 0}, /* right down */ |
| 239 | 239 | ||
| 240 | /* "Mouse button" buttons */ | 240 | /* "Mouse button" buttons */ |
| 241 | {KIND_LITERAL, 0x3d, 0x78, EV_KEY, BTN_LEFT, 1}, /* left btn down */ | 241 | {KIND_LITERAL, 0x78, EV_KEY, BTN_LEFT, 1}, /* left btn down */ |
| 242 | {KIND_LITERAL, 0x3e, 0x79, EV_KEY, BTN_LEFT, 0}, /* left btn up */ | 242 | {KIND_LITERAL, 0x79, EV_KEY, BTN_LEFT, 0}, /* left btn up */ |
| 243 | {KIND_LITERAL, 0x41, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */ | 243 | {KIND_LITERAL, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */ |
| 244 | {KIND_LITERAL, 0x42, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */ | 244 | {KIND_LITERAL, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */ |
| 245 | 245 | ||
| 246 | /* Artificial "doubleclick" events are generated by the hardware. | 246 | /* Artificial "doubleclick" events are generated by the hardware. |
| 247 | * They are mapped to the "side" and "extra" mouse buttons here. */ | 247 | * They are mapped to the "side" and "extra" mouse buttons here. */ |
| 248 | {KIND_FILTERED, 0x3f, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */ | 248 | {KIND_FILTERED, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */ |
| 249 | {KIND_FILTERED, 0x43, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */ | 249 | {KIND_FILTERED, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */ |
| 250 | 250 | ||
| 251 | /* Non-mouse events are handled by rc-core */ | 251 | /* Non-mouse events are handled by rc-core */ |
| 252 | {KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0} | 252 | {KIND_END, 0x00, EV_MAX + 1, 0, 0} |
| 253 | }; | 253 | }; |
| 254 | 254 | ||
| 255 | /* Local function prototypes */ | 255 | /* Local function prototypes */ |
| @@ -397,25 +397,6 @@ static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigne | |||
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | /* | 399 | /* |
| 400 | * ati_remote_event_lookup | ||
| 401 | */ | ||
| 402 | static int ati_remote_event_lookup(int rem, unsigned char d1, unsigned char d2) | ||
| 403 | { | ||
| 404 | int i; | ||
| 405 | |||
| 406 | for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) { | ||
| 407 | /* | ||
| 408 | * Decide if the table entry matches the remote input. | ||
| 409 | */ | ||
| 410 | if (ati_remote_tbl[i].data1 == d1 && | ||
| 411 | ati_remote_tbl[i].data2 == d2) | ||
| 412 | return i; | ||
| 413 | |||
| 414 | } | ||
| 415 | return -1; | ||
| 416 | } | ||
| 417 | |||
| 418 | /* | ||
| 419 | * ati_remote_compute_accel | 400 | * ati_remote_compute_accel |
| 420 | * | 401 | * |
| 421 | * Implements acceleration curve for directional control pad | 402 | * Implements acceleration curve for directional control pad |
| @@ -463,7 +444,15 @@ static void ati_remote_input_report(struct urb *urb) | |||
| 463 | int index = -1; | 444 | int index = -1; |
| 464 | int acc; | 445 | int acc; |
| 465 | int remote_num; | 446 | int remote_num; |
| 466 | unsigned char scancode[2]; | 447 | unsigned char scancode; |
| 448 | int i; | ||
| 449 | |||
| 450 | /* | ||
| 451 | * data[0] = 0x14 | ||
| 452 | * data[1] = data[2] + data[3] + 0xd5 (a checksum byte) | ||
| 453 | * data[2] = the key code (with toggle bit in MSB with some models) | ||
| 454 | * data[3] = channel << 4 (the low 4 bits must be zero) | ||
| 455 | */ | ||
| 467 | 456 | ||
| 468 | /* Deal with strange looking inputs */ | 457 | /* Deal with strange looking inputs */ |
| 469 | if ( (urb->actual_length != 4) || (data[0] != 0x14) || | 458 | if ( (urb->actual_length != 4) || (data[0] != 0x14) || |
| @@ -472,6 +461,13 @@ static void ati_remote_input_report(struct urb *urb) | |||
| 472 | return; | 461 | return; |
| 473 | } | 462 | } |
| 474 | 463 | ||
| 464 | if (data[1] != ((data[2] + data[3] + 0xd5) & 0xff)) { | ||
| 465 | dbginfo(&ati_remote->interface->dev, | ||
| 466 | "wrong checksum in input: %02x %02x %02x %02x\n", | ||
| 467 | data[0], data[1], data[2], data[3]); | ||
| 468 | return; | ||
| 469 | } | ||
| 470 | |||
| 475 | /* Mask unwanted remote channels. */ | 471 | /* Mask unwanted remote channels. */ |
| 476 | /* note: remote_num is 0-based, channel 1 on remote == 0 here */ | 472 | /* note: remote_num is 0-based, channel 1 on remote == 0 here */ |
| 477 | remote_num = (data[3] >> 4) & 0x0f; | 473 | remote_num = (data[3] >> 4) & 0x0f; |
| @@ -482,31 +478,30 @@ static void ati_remote_input_report(struct urb *urb) | |||
| 482 | return; | 478 | return; |
| 483 | } | 479 | } |
| 484 | 480 | ||
| 485 | scancode[0] = (((data[1] - ((remote_num + 1) << 4)) & 0xf0) | (data[1] & 0x0f)); | ||
| 486 | |||
| 487 | /* | 481 | /* |
| 488 | * Some devices (e.g. SnapStream Firefly) use 8080 as toggle code, | 482 | * MSB is a toggle code, though only used by some devices |
| 489 | * so we have to clear them. The first bit is a bit tricky as the | 483 | * (e.g. SnapStream Firefly) |
| 490 | * "non-toggled" state depends on remote_num, so we xor it with the | ||
| 491 | * second bit which is only used for toggle. | ||
| 492 | */ | 484 | */ |
| 493 | scancode[0] ^= (data[2] & 0x80); | 485 | scancode = data[2] & 0x7f; |
| 494 | |||
| 495 | scancode[1] = data[2] & ~0x80; | ||
| 496 | 486 | ||
| 497 | /* Look up event code index in mouse translation table. */ | 487 | /* Look up event code index in the mouse translation table. */ |
| 498 | index = ati_remote_event_lookup(remote_num, scancode[0], scancode[1]); | 488 | for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) { |
| 489 | if (scancode == ati_remote_tbl[i].data) { | ||
| 490 | index = i; | ||
| 491 | break; | ||
| 492 | } | ||
| 493 | } | ||
| 499 | 494 | ||
| 500 | if (index >= 0) { | 495 | if (index >= 0) { |
| 501 | dbginfo(&ati_remote->interface->dev, | 496 | dbginfo(&ati_remote->interface->dev, |
| 502 | "channel 0x%02x; mouse data %02x,%02x; index %d; keycode %d\n", | 497 | "channel 0x%02x; mouse data %02x; index %d; keycode %d\n", |
| 503 | remote_num, data[1], data[2], index, ati_remote_tbl[index].code); | 498 | remote_num, data[2], index, ati_remote_tbl[index].code); |
| 504 | if (!dev) | 499 | if (!dev) |
| 505 | return; /* no mouse device */ | 500 | return; /* no mouse device */ |
| 506 | } else | 501 | } else |
| 507 | dbginfo(&ati_remote->interface->dev, | 502 | dbginfo(&ati_remote->interface->dev, |
| 508 | "channel 0x%02x; key data %02x,%02x, scancode %02x,%02x\n", | 503 | "channel 0x%02x; key data %02x, scancode %02x\n", |
| 509 | remote_num, data[1], data[2], scancode[0], scancode[1]); | 504 | remote_num, data[2], scancode); |
| 510 | 505 | ||
| 511 | 506 | ||
| 512 | if (index >= 0 && ati_remote_tbl[index].kind == KIND_LITERAL) { | 507 | if (index >= 0 && ati_remote_tbl[index].kind == KIND_LITERAL) { |
| @@ -523,8 +518,7 @@ static void ati_remote_input_report(struct urb *urb) | |||
| 523 | unsigned long now = jiffies; | 518 | unsigned long now = jiffies; |
| 524 | 519 | ||
| 525 | /* Filter duplicate events which happen "too close" together. */ | 520 | /* Filter duplicate events which happen "too close" together. */ |
| 526 | if (ati_remote->old_data[0] == data[1] && | 521 | if (ati_remote->old_data == data[2] && |
| 527 | ati_remote->old_data[1] == data[2] && | ||
| 528 | time_before(now, ati_remote->old_jiffies + | 522 | time_before(now, ati_remote->old_jiffies + |
| 529 | msecs_to_jiffies(repeat_filter))) { | 523 | msecs_to_jiffies(repeat_filter))) { |
| 530 | ati_remote->repeat_count++; | 524 | ati_remote->repeat_count++; |
| @@ -533,8 +527,7 @@ static void ati_remote_input_report(struct urb *urb) | |||
| 533 | ati_remote->first_jiffies = now; | 527 | ati_remote->first_jiffies = now; |
| 534 | } | 528 | } |
| 535 | 529 | ||
| 536 | ati_remote->old_data[0] = data[1]; | 530 | ati_remote->old_data = data[2]; |
| 537 | ati_remote->old_data[1] = data[2]; | ||
| 538 | ati_remote->old_jiffies = now; | 531 | ati_remote->old_jiffies = now; |
| 539 | 532 | ||
| 540 | /* Ensure we skip at least the 4 first duplicate events (generated | 533 | /* Ensure we skip at least the 4 first duplicate events (generated |
| @@ -549,14 +542,13 @@ static void ati_remote_input_report(struct urb *urb) | |||
| 549 | 542 | ||
| 550 | if (index < 0) { | 543 | if (index < 0) { |
| 551 | /* Not a mouse event, hand it to rc-core. */ | 544 | /* Not a mouse event, hand it to rc-core. */ |
| 552 | u32 rc_code = (scancode[0] << 8) | scancode[1]; | ||
| 553 | 545 | ||
| 554 | /* | 546 | /* |
| 555 | * We don't use the rc-core repeat handling yet as | 547 | * We don't use the rc-core repeat handling yet as |
| 556 | * it would cause ghost repeats which would be a | 548 | * it would cause ghost repeats which would be a |
| 557 | * regression for this driver. | 549 | * regression for this driver. |
| 558 | */ | 550 | */ |
| 559 | rc_keydown_notimeout(ati_remote->rdev, rc_code, | 551 | rc_keydown_notimeout(ati_remote->rdev, scancode, |
| 560 | data[2]); | 552 | data[2]); |
| 561 | rc_keyup(ati_remote->rdev); | 553 | rc_keyup(ati_remote->rdev); |
| 562 | return; | 554 | return; |
| @@ -607,8 +599,7 @@ static void ati_remote_input_report(struct urb *urb) | |||
| 607 | input_sync(dev); | 599 | input_sync(dev); |
| 608 | 600 | ||
| 609 | ati_remote->old_jiffies = jiffies; | 601 | ati_remote->old_jiffies = jiffies; |
| 610 | ati_remote->old_data[0] = data[1]; | 602 | ati_remote->old_data = data[2]; |
| 611 | ati_remote->old_data[1] = data[2]; | ||
| 612 | } | 603 | } |
| 613 | } | 604 | } |
| 614 | 605 | ||
diff --git a/drivers/media/rc/keymaps/rc-ati-x10.c b/drivers/media/rc/keymaps/rc-ati-x10.c index e1b8b2605c48..81506440eded 100644 --- a/drivers/media/rc/keymaps/rc-ati-x10.c +++ b/drivers/media/rc/keymaps/rc-ati-x10.c | |||
| @@ -27,55 +27,55 @@ | |||
| 27 | #include <media/rc-map.h> | 27 | #include <media/rc-map.h> |
| 28 | 28 | ||
| 29 | static struct rc_map_table ati_x10[] = { | 29 | static struct rc_map_table ati_x10[] = { |
| 30 | { 0xd20d, KEY_1 }, | 30 | { 0x0d, KEY_1 }, |
| 31 | { 0xd30e, KEY_2 }, | 31 | { 0x0e, KEY_2 }, |
| 32 | { 0xd40f, KEY_3 }, | 32 | { 0x0f, KEY_3 }, |
| 33 | { 0xd510, KEY_4 }, | 33 | { 0x10, KEY_4 }, |
| 34 | { 0xd611, KEY_5 }, | 34 | { 0x11, KEY_5 }, |
| 35 | { 0xd712, KEY_6 }, | 35 | { 0x12, KEY_6 }, |
| 36 | { 0xd813, KEY_7 }, | 36 | { 0x13, KEY_7 }, |
| 37 | { 0xd914, KEY_8 }, | 37 | { 0x14, KEY_8 }, |
| 38 | { 0xda15, KEY_9 }, | 38 | { 0x15, KEY_9 }, |
| 39 | { 0xdc17, KEY_0 }, | 39 | { 0x17, KEY_0 }, |
| 40 | { 0xc500, KEY_A }, | 40 | { 0x00, KEY_A }, |
| 41 | { 0xc601, KEY_B }, | 41 | { 0x01, KEY_B }, |
| 42 | { 0xde19, KEY_C }, | 42 | { 0x19, KEY_C }, |
| 43 | { 0xe01b, KEY_D }, | 43 | { 0x1b, KEY_D }, |
| 44 | { 0xe621, KEY_E }, | 44 | { 0x21, KEY_E }, |
| 45 | { 0xe823, KEY_F }, | 45 | { 0x23, KEY_F }, |
| 46 | 46 | ||
| 47 | { 0xdd18, KEY_KPENTER }, /* "check" */ | 47 | { 0x18, KEY_KPENTER }, /* "check" */ |
| 48 | { 0xdb16, KEY_MENU }, /* "menu" */ | 48 | { 0x16, KEY_MENU }, /* "menu" */ |
| 49 | { 0xc702, KEY_POWER }, /* Power */ | 49 | { 0x02, KEY_POWER }, /* Power */ |
| 50 | { 0xc803, KEY_TV }, /* TV */ | 50 | { 0x03, KEY_TV }, /* TV */ |
| 51 | { 0xc904, KEY_DVD }, /* DVD */ | 51 | { 0x04, KEY_DVD }, /* DVD */ |
| 52 | { 0xca05, KEY_WWW }, /* WEB */ | 52 | { 0x05, KEY_WWW }, /* WEB */ |
| 53 | { 0xcb06, KEY_BOOKMARKS }, /* "book" */ | 53 | { 0x06, KEY_BOOKMARKS }, /* "book" */ |
| 54 | { 0xcc07, KEY_EDIT }, /* "hand" */ | 54 | { 0x07, KEY_EDIT }, /* "hand" */ |
| 55 | { 0xe11c, KEY_COFFEE }, /* "timer" */ | 55 | { 0x1c, KEY_COFFEE }, /* "timer" */ |
| 56 | { 0xe520, KEY_FRONT }, /* "max" */ | 56 | { 0x20, KEY_FRONT }, /* "max" */ |
| 57 | { 0xe21d, KEY_LEFT }, /* left */ | 57 | { 0x1d, KEY_LEFT }, /* left */ |
| 58 | { 0xe41f, KEY_RIGHT }, /* right */ | 58 | { 0x1f, KEY_RIGHT }, /* right */ |
| 59 | { 0xe722, KEY_DOWN }, /* down */ | 59 | { 0x22, KEY_DOWN }, /* down */ |
| 60 | { 0xdf1a, KEY_UP }, /* up */ | 60 | { 0x1a, KEY_UP }, /* up */ |
| 61 | { 0xe31e, KEY_OK }, /* "OK" */ | 61 | { 0x1e, KEY_OK }, /* "OK" */ |
| 62 | { 0xce09, KEY_VOLUMEDOWN }, /* VOL + */ | 62 | { 0x09, KEY_VOLUMEDOWN }, /* VOL + */ |
| 63 | { 0xcd08, KEY_VOLUMEUP }, /* VOL - */ | 63 | { 0x08, KEY_VOLUMEUP }, /* VOL - */ |
| 64 | { 0xcf0a, KEY_MUTE }, /* MUTE */ | 64 | { 0x0a, KEY_MUTE }, /* MUTE */ |
| 65 | { 0xd00b, KEY_CHANNELUP }, /* CH + */ | 65 | { 0x0b, KEY_CHANNELUP }, /* CH + */ |
| 66 | { 0xd10c, KEY_CHANNELDOWN },/* CH - */ | 66 | { 0x0c, KEY_CHANNELDOWN },/* CH - */ |
| 67 | { 0xec27, KEY_RECORD }, /* ( o) red */ | 67 | { 0x27, KEY_RECORD }, /* ( o) red */ |
| 68 | { 0xea25, KEY_PLAY }, /* ( >) */ | 68 | { 0x25, KEY_PLAY }, /* ( >) */ |
| 69 | { 0xe924, KEY_REWIND }, /* (<<) */ | 69 | { 0x24, KEY_REWIND }, /* (<<) */ |
| 70 | { 0xeb26, KEY_FORWARD }, /* (>>) */ | 70 | { 0x26, KEY_FORWARD }, /* (>>) */ |
| 71 | { 0xed28, KEY_STOP }, /* ([]) */ | 71 | { 0x28, KEY_STOP }, /* ([]) */ |
| 72 | { 0xee29, KEY_PAUSE }, /* ('') */ | 72 | { 0x29, KEY_PAUSE }, /* ('') */ |
| 73 | { 0xf02b, KEY_PREVIOUS }, /* (<-) */ | 73 | { 0x2b, KEY_PREVIOUS }, /* (<-) */ |
| 74 | { 0xef2a, KEY_NEXT }, /* (>+) */ | 74 | { 0x2a, KEY_NEXT }, /* (>+) */ |
| 75 | { 0xf22d, KEY_INFO }, /* PLAYING */ | 75 | { 0x2d, KEY_INFO }, /* PLAYING */ |
| 76 | { 0xf32e, KEY_HOME }, /* TOP */ | 76 | { 0x2e, KEY_HOME }, /* TOP */ |
| 77 | { 0xf42f, KEY_END }, /* END */ | 77 | { 0x2f, KEY_END }, /* END */ |
| 78 | { 0xf530, KEY_SELECT }, /* SELECT */ | 78 | { 0x30, KEY_SELECT }, /* SELECT */ |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | static struct rc_map_list ati_x10_map = { | 81 | static struct rc_map_list ati_x10_map = { |
diff --git a/drivers/media/rc/keymaps/rc-medion-x10.c b/drivers/media/rc/keymaps/rc-medion-x10.c index 09e2cc01d110..479cdb897810 100644 --- a/drivers/media/rc/keymaps/rc-medion-x10.c +++ b/drivers/media/rc/keymaps/rc-medion-x10.c | |||
| @@ -25,70 +25,70 @@ | |||
| 25 | #include <media/rc-map.h> | 25 | #include <media/rc-map.h> |
| 26 | 26 | ||
| 27 | static struct rc_map_table medion_x10[] = { | 27 | static struct rc_map_table medion_x10[] = { |
| 28 | { 0xf12c, KEY_TV }, /* TV */ | 28 | { 0x2c, KEY_TV }, /* TV */ |
| 29 | { 0xf22d, KEY_VCR }, /* VCR */ | 29 | { 0x2d, KEY_VCR }, /* VCR */ |
| 30 | { 0xc904, KEY_DVD }, /* DVD */ | 30 | { 0x04, KEY_DVD }, /* DVD */ |
| 31 | { 0xcb06, KEY_AUDIO }, /* MUSIC */ | 31 | { 0x06, KEY_AUDIO }, /* MUSIC */ |
| 32 | 32 | ||
| 33 | { 0xf32e, KEY_RADIO }, /* RADIO */ | 33 | { 0x2e, KEY_RADIO }, /* RADIO */ |
| 34 | { 0xca05, KEY_DIRECTORY }, /* PHOTO */ | 34 | { 0x05, KEY_DIRECTORY }, /* PHOTO */ |
| 35 | { 0xf42f, KEY_INFO }, /* TV-PREVIEW */ | 35 | { 0x2f, KEY_INFO }, /* TV-PREVIEW */ |
| 36 | { 0xf530, KEY_LIST }, /* CHANNEL-LST */ | 36 | { 0x30, KEY_LIST }, /* CHANNEL-LST */ |
| 37 | 37 | ||
| 38 | { 0xe01b, KEY_SETUP }, /* SETUP */ | 38 | { 0x1b, KEY_SETUP }, /* SETUP */ |
| 39 | { 0xf631, KEY_VIDEO }, /* VIDEO DESKTOP */ | 39 | { 0x31, KEY_VIDEO }, /* VIDEO DESKTOP */ |
| 40 | 40 | ||
| 41 | { 0xcd08, KEY_VOLUMEDOWN }, /* VOL - */ | 41 | { 0x08, KEY_VOLUMEDOWN }, /* VOL - */ |
| 42 | { 0xce09, KEY_VOLUMEUP }, /* VOL + */ | 42 | { 0x09, KEY_VOLUMEUP }, /* VOL + */ |
| 43 | { 0xd00b, KEY_CHANNELUP }, /* CHAN + */ | 43 | { 0x0b, KEY_CHANNELUP }, /* CHAN + */ |
| 44 | { 0xd10c, KEY_CHANNELDOWN }, /* CHAN - */ | 44 | { 0x0c, KEY_CHANNELDOWN }, /* CHAN - */ |
| 45 | { 0xc500, KEY_MUTE }, /* MUTE */ | 45 | { 0x00, KEY_MUTE }, /* MUTE */ |
| 46 | 46 | ||
| 47 | { 0xf732, KEY_RED }, /* red */ | 47 | { 0x32, KEY_RED }, /* red */ |
| 48 | { 0xf833, KEY_GREEN }, /* green */ | 48 | { 0x33, KEY_GREEN }, /* green */ |
| 49 | { 0xf934, KEY_YELLOW }, /* yellow */ | 49 | { 0x34, KEY_YELLOW }, /* yellow */ |
| 50 | { 0xfa35, KEY_BLUE }, /* blue */ | 50 | { 0x35, KEY_BLUE }, /* blue */ |
| 51 | { 0xdb16, KEY_TEXT }, /* TXT */ | 51 | { 0x16, KEY_TEXT }, /* TXT */ |
| 52 | 52 | ||
| 53 | { 0xd20d, KEY_1 }, | 53 | { 0x0d, KEY_1 }, |
| 54 | { 0xd30e, KEY_2 }, | 54 | { 0x0e, KEY_2 }, |
| 55 | { 0xd40f, KEY_3 }, | 55 | { 0x0f, KEY_3 }, |
| 56 | { 0xd510, KEY_4 }, | 56 | { 0x10, KEY_4 }, |
| 57 | { 0xd611, KEY_5 }, | 57 | { 0x11, KEY_5 }, |
| 58 | { 0xd712, KEY_6 }, | 58 | { 0x12, KEY_6 }, |
| 59 | { 0xd813, KEY_7 }, | 59 | { 0x13, KEY_7 }, |
| 60 | { 0xd914, KEY_8 }, | 60 | { 0x14, KEY_8 }, |
| 61 | { 0xda15, KEY_9 }, | 61 | { 0x15, KEY_9 }, |
| 62 | { 0xdc17, KEY_0 }, | 62 | { 0x17, KEY_0 }, |
| 63 | { 0xe11c, KEY_SEARCH }, /* TV/RAD, CH SRC */ | 63 | { 0x1c, KEY_SEARCH }, /* TV/RAD, CH SRC */ |
| 64 | { 0xe520, KEY_DELETE }, /* DELETE */ | 64 | { 0x20, KEY_DELETE }, /* DELETE */ |
| 65 | 65 | ||
| 66 | { 0xfb36, KEY_KEYBOARD }, /* RENAME */ | 66 | { 0x36, KEY_KEYBOARD }, /* RENAME */ |
| 67 | { 0xdd18, KEY_SCREEN }, /* SNAPSHOT */ | 67 | { 0x18, KEY_SCREEN }, /* SNAPSHOT */ |
| 68 | 68 | ||
| 69 | { 0xdf1a, KEY_UP }, /* up */ | 69 | { 0x1a, KEY_UP }, /* up */ |
| 70 | { 0xe722, KEY_DOWN }, /* down */ | 70 | { 0x22, KEY_DOWN }, /* down */ |
| 71 | { 0xe21d, KEY_LEFT }, /* left */ | 71 | { 0x1d, KEY_LEFT }, /* left */ |
| 72 | { 0xe41f, KEY_RIGHT }, /* right */ | 72 | { 0x1f, KEY_RIGHT }, /* right */ |
| 73 | { 0xe31e, KEY_OK }, /* OK */ | 73 | { 0x1e, KEY_OK }, /* OK */ |
| 74 | 74 | ||
| 75 | { 0xfc37, KEY_SELECT }, /* ACQUIRE IMAGE */ | 75 | { 0x37, KEY_SELECT }, /* ACQUIRE IMAGE */ |
| 76 | { 0xfd38, KEY_EDIT }, /* EDIT IMAGE */ | 76 | { 0x38, KEY_EDIT }, /* EDIT IMAGE */ |
| 77 | 77 | ||
| 78 | { 0xe924, KEY_REWIND }, /* rewind (<<) */ | 78 | { 0x24, KEY_REWIND }, /* rewind (<<) */ |
| 79 | { 0xea25, KEY_PLAY }, /* play ( >) */ | 79 | { 0x25, KEY_PLAY }, /* play ( >) */ |
| 80 | { 0xeb26, KEY_FORWARD }, /* forward (>>) */ | 80 | { 0x26, KEY_FORWARD }, /* forward (>>) */ |
| 81 | { 0xec27, KEY_RECORD }, /* record ( o) */ | 81 | { 0x27, KEY_RECORD }, /* record ( o) */ |
| 82 | { 0xed28, KEY_STOP }, /* stop ([]) */ | 82 | { 0x28, KEY_STOP }, /* stop ([]) */ |
| 83 | { 0xee29, KEY_PAUSE }, /* pause ('') */ | 83 | { 0x29, KEY_PAUSE }, /* pause ('') */ |
| 84 | 84 | ||
| 85 | { 0xe621, KEY_PREVIOUS }, /* prev */ | 85 | { 0x21, KEY_PREVIOUS }, /* prev */ |
| 86 | { 0xfe39, KEY_SWITCHVIDEOMODE }, /* F SCR */ | 86 | { 0x39, KEY_SWITCHVIDEOMODE }, /* F SCR */ |
| 87 | { 0xe823, KEY_NEXT }, /* next */ | 87 | { 0x23, KEY_NEXT }, /* next */ |
| 88 | { 0xde19, KEY_MENU }, /* MENU */ | 88 | { 0x19, KEY_MENU }, /* MENU */ |
| 89 | { 0xff3a, KEY_LANGUAGE }, /* AUDIO */ | 89 | { 0x3a, KEY_LANGUAGE }, /* AUDIO */ |
| 90 | 90 | ||
| 91 | { 0xc702, KEY_POWER }, /* POWER */ | 91 | { 0x02, KEY_POWER }, /* POWER */ |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| 94 | static struct rc_map_list medion_x10_map = { | 94 | static struct rc_map_list medion_x10_map = { |
diff --git a/drivers/media/rc/keymaps/rc-snapstream-firefly.c b/drivers/media/rc/keymaps/rc-snapstream-firefly.c index ef146520931c..c7f33ec719b4 100644 --- a/drivers/media/rc/keymaps/rc-snapstream-firefly.c +++ b/drivers/media/rc/keymaps/rc-snapstream-firefly.c | |||
| @@ -22,63 +22,63 @@ | |||
| 22 | #include <media/rc-map.h> | 22 | #include <media/rc-map.h> |
| 23 | 23 | ||
| 24 | static struct rc_map_table snapstream_firefly[] = { | 24 | static struct rc_map_table snapstream_firefly[] = { |
| 25 | { 0xf12c, KEY_ZOOM }, /* Maximize */ | 25 | { 0x2c, KEY_ZOOM }, /* Maximize */ |
| 26 | { 0xc702, KEY_CLOSE }, | 26 | { 0x02, KEY_CLOSE }, |
| 27 | 27 | ||
| 28 | { 0xd20d, KEY_1 }, | 28 | { 0x0d, KEY_1 }, |
| 29 | { 0xd30e, KEY_2 }, | 29 | { 0x0e, KEY_2 }, |
| 30 | { 0xd40f, KEY_3 }, | 30 | { 0x0f, KEY_3 }, |
| 31 | { 0xd510, KEY_4 }, | 31 | { 0x10, KEY_4 }, |
| 32 | { 0xd611, KEY_5 }, | 32 | { 0x11, KEY_5 }, |
| 33 | { 0xd712, KEY_6 }, | 33 | { 0x12, KEY_6 }, |
| 34 | { 0xd813, KEY_7 }, | 34 | { 0x13, KEY_7 }, |
| 35 | { 0xd914, KEY_8 }, | 35 | { 0x14, KEY_8 }, |
| 36 | { 0xda15, KEY_9 }, | 36 | { 0x15, KEY_9 }, |
| 37 | { 0xdc17, KEY_0 }, | 37 | { 0x17, KEY_0 }, |
| 38 | { 0xdb16, KEY_BACK }, | 38 | { 0x16, KEY_BACK }, |
| 39 | { 0xdd18, KEY_KPENTER }, /* ent */ | 39 | { 0x18, KEY_KPENTER }, /* ent */ |
| 40 | 40 | ||
| 41 | { 0xce09, KEY_VOLUMEUP }, | 41 | { 0x09, KEY_VOLUMEUP }, |
| 42 | { 0xcd08, KEY_VOLUMEDOWN }, | 42 | { 0x08, KEY_VOLUMEDOWN }, |
| 43 | { 0xcf0a, KEY_MUTE }, | 43 | { 0x0a, KEY_MUTE }, |
| 44 | { 0xd00b, KEY_CHANNELUP }, | 44 | { 0x0b, KEY_CHANNELUP }, |
| 45 | { 0xd10c, KEY_CHANNELDOWN }, | 45 | { 0x0c, KEY_CHANNELDOWN }, |
| 46 | { 0xc500, KEY_VENDOR }, /* firefly */ | 46 | { 0x00, KEY_VENDOR }, /* firefly */ |
| 47 | 47 | ||
| 48 | { 0xf32e, KEY_INFO }, | 48 | { 0x2e, KEY_INFO }, |
| 49 | { 0xf42f, KEY_OPTION }, | 49 | { 0x2f, KEY_OPTION }, |
| 50 | 50 | ||
| 51 | { 0xe21d, KEY_LEFT }, | 51 | { 0x1d, KEY_LEFT }, |
| 52 | { 0xe41f, KEY_RIGHT }, | 52 | { 0x1f, KEY_RIGHT }, |
| 53 | { 0xe722, KEY_DOWN }, | 53 | { 0x22, KEY_DOWN }, |
| 54 | { 0xdf1a, KEY_UP }, | 54 | { 0x1a, KEY_UP }, |
| 55 | { 0xe31e, KEY_OK }, | 55 | { 0x1e, KEY_OK }, |
| 56 | 56 | ||
| 57 | { 0xe11c, KEY_MENU }, | 57 | { 0x1c, KEY_MENU }, |
| 58 | { 0xe520, KEY_EXIT }, | 58 | { 0x20, KEY_EXIT }, |
| 59 | 59 | ||
| 60 | { 0xec27, KEY_RECORD }, | 60 | { 0x27, KEY_RECORD }, |
| 61 | { 0xea25, KEY_PLAY }, | 61 | { 0x25, KEY_PLAY }, |
| 62 | { 0xed28, KEY_STOP }, | 62 | { 0x28, KEY_STOP }, |
| 63 | { 0xe924, KEY_REWIND }, | 63 | { 0x24, KEY_REWIND }, |
| 64 | { 0xeb26, KEY_FORWARD }, | 64 | { 0x26, KEY_FORWARD }, |
| 65 | { 0xee29, KEY_PAUSE }, | 65 | { 0x29, KEY_PAUSE }, |
| 66 | { 0xf02b, KEY_PREVIOUS }, | 66 | { 0x2b, KEY_PREVIOUS }, |
| 67 | { 0xef2a, KEY_NEXT }, | 67 | { 0x2a, KEY_NEXT }, |
| 68 | 68 | ||
| 69 | { 0xcb06, KEY_AUDIO }, /* Music */ | 69 | { 0x06, KEY_AUDIO }, /* Music */ |
| 70 | { 0xca05, KEY_IMAGES }, /* Photos */ | 70 | { 0x05, KEY_IMAGES }, /* Photos */ |
| 71 | { 0xc904, KEY_DVD }, | 71 | { 0x04, KEY_DVD }, |
| 72 | { 0xc803, KEY_TV }, | 72 | { 0x03, KEY_TV }, |
| 73 | { 0xcc07, KEY_VIDEO }, | 73 | { 0x07, KEY_VIDEO }, |
| 74 | 74 | ||
| 75 | { 0xc601, KEY_HELP }, | 75 | { 0x01, KEY_HELP }, |
| 76 | { 0xf22d, KEY_MODE }, /* Mouse */ | 76 | { 0x2d, KEY_MODE }, /* Mouse */ |
| 77 | 77 | ||
| 78 | { 0xde19, KEY_A }, | 78 | { 0x19, KEY_A }, |
| 79 | { 0xe01b, KEY_B }, | 79 | { 0x1b, KEY_B }, |
| 80 | { 0xe621, KEY_C }, | 80 | { 0x21, KEY_C }, |
| 81 | { 0xe823, KEY_D }, | 81 | { 0x23, KEY_D }, |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | static struct rc_map_list snapstream_firefly_map = { | 84 | static struct rc_map_list snapstream_firefly_map = { |
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index 39fc923fc46b..1c6015a04f96 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c | |||
| @@ -162,11 +162,14 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) | |||
| 162 | switch (tv.model) { | 162 | switch (tv.model) { |
| 163 | case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */ | 163 | case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */ |
| 164 | case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ | 164 | case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ |
| 165 | case 72101: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ | ||
| 166 | case 72201: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ | ||
| 165 | case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ | 167 | case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ |
| 166 | case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ | 168 | case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ |
| 167 | case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ | 169 | case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ |
| 168 | case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and analog video */ | 170 | case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and analog video */ |
| 169 | case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ | 171 | case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ |
| 172 | case 72261: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ | ||
| 170 | case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and analog video */ | 173 | case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and analog video */ |
| 171 | case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */ | 174 | case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */ |
| 172 | break; | 175 | break; |
| @@ -324,6 +327,10 @@ struct usb_device_id au0828_usb_id_table[] = { | |||
| 324 | .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL }, | 327 | .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL }, |
| 325 | { USB_DEVICE(0x2040, 0x8200), | 328 | { USB_DEVICE(0x2040, 0x8200), |
| 326 | .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY }, | 329 | .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY }, |
| 330 | { USB_DEVICE(0x2040, 0x7260), | ||
| 331 | .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, | ||
| 332 | { USB_DEVICE(0x2040, 0x7213), | ||
| 333 | .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, | ||
| 327 | { }, | 334 | { }, |
| 328 | }; | 335 | }; |
| 329 | 336 | ||
diff --git a/drivers/media/video/m5mols/m5mols.h b/drivers/media/video/m5mols/m5mols.h index 89d09a8914f8..82c8817bd32d 100644 --- a/drivers/media/video/m5mols/m5mols.h +++ b/drivers/media/video/m5mols/m5mols.h | |||
| @@ -162,7 +162,6 @@ struct m5mols_version { | |||
| 162 | * @pad: media pad | 162 | * @pad: media pad |
| 163 | * @ffmt: current fmt according to resolution type | 163 | * @ffmt: current fmt according to resolution type |
| 164 | * @res_type: current resolution type | 164 | * @res_type: current resolution type |
| 165 | * @code: current code | ||
| 166 | * @irq_waitq: waitqueue for the capture | 165 | * @irq_waitq: waitqueue for the capture |
| 167 | * @work_irq: workqueue for the IRQ | 166 | * @work_irq: workqueue for the IRQ |
| 168 | * @flags: state variable for the interrupt handler | 167 | * @flags: state variable for the interrupt handler |
| @@ -192,7 +191,6 @@ struct m5mols_info { | |||
| 192 | struct media_pad pad; | 191 | struct media_pad pad; |
| 193 | struct v4l2_mbus_framefmt ffmt[M5MOLS_RESTYPE_MAX]; | 192 | struct v4l2_mbus_framefmt ffmt[M5MOLS_RESTYPE_MAX]; |
| 194 | int res_type; | 193 | int res_type; |
| 195 | enum v4l2_mbus_pixelcode code; | ||
| 196 | wait_queue_head_t irq_waitq; | 194 | wait_queue_head_t irq_waitq; |
| 197 | struct work_struct work_irq; | 195 | struct work_struct work_irq; |
| 198 | unsigned long flags; | 196 | unsigned long flags; |
diff --git a/drivers/media/video/m5mols/m5mols_core.c b/drivers/media/video/m5mols/m5mols_core.c index 05ab3700647e..e0f09e531800 100644 --- a/drivers/media/video/m5mols/m5mols_core.c +++ b/drivers/media/video/m5mols/m5mols_core.c | |||
| @@ -334,7 +334,7 @@ int m5mols_mode(struct m5mols_info *info, u8 mode) | |||
| 334 | int ret = -EINVAL; | 334 | int ret = -EINVAL; |
| 335 | u8 reg; | 335 | u8 reg; |
| 336 | 336 | ||
| 337 | if (mode < REG_PARAMETER && mode > REG_CAPTURE) | 337 | if (mode < REG_PARAMETER || mode > REG_CAPTURE) |
| 338 | return ret; | 338 | return ret; |
| 339 | 339 | ||
| 340 | ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, ®); | 340 | ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, ®); |
| @@ -511,9 +511,6 @@ static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | |||
| 511 | struct m5mols_info *info = to_m5mols(sd); | 511 | struct m5mols_info *info = to_m5mols(sd); |
| 512 | struct v4l2_mbus_framefmt *format; | 512 | struct v4l2_mbus_framefmt *format; |
| 513 | 513 | ||
| 514 | if (fmt->pad != 0) | ||
| 515 | return -EINVAL; | ||
| 516 | |||
| 517 | format = __find_format(info, fh, fmt->which, info->res_type); | 514 | format = __find_format(info, fh, fmt->which, info->res_type); |
| 518 | if (!format) | 515 | if (!format) |
| 519 | return -EINVAL; | 516 | return -EINVAL; |
| @@ -532,9 +529,6 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | |||
| 532 | u32 resolution = 0; | 529 | u32 resolution = 0; |
| 533 | int ret; | 530 | int ret; |
| 534 | 531 | ||
| 535 | if (fmt->pad != 0) | ||
| 536 | return -EINVAL; | ||
| 537 | |||
| 538 | ret = __find_resolution(sd, format, &type, &resolution); | 532 | ret = __find_resolution(sd, format, &type, &resolution); |
| 539 | if (ret < 0) | 533 | if (ret < 0) |
| 540 | return ret; | 534 | return ret; |
| @@ -543,13 +537,14 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | |||
| 543 | if (!sfmt) | 537 | if (!sfmt) |
| 544 | return 0; | 538 | return 0; |
| 545 | 539 | ||
| 546 | *sfmt = m5mols_default_ffmt[type]; | 540 | |
| 547 | sfmt->width = format->width; | 541 | format->code = m5mols_default_ffmt[type].code; |
| 548 | sfmt->height = format->height; | 542 | format->colorspace = V4L2_COLORSPACE_JPEG; |
| 543 | format->field = V4L2_FIELD_NONE; | ||
| 549 | 544 | ||
| 550 | if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { | 545 | if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { |
| 546 | *sfmt = *format; | ||
| 551 | info->resolution = resolution; | 547 | info->resolution = resolution; |
| 552 | info->code = format->code; | ||
| 553 | info->res_type = type; | 548 | info->res_type = type; |
| 554 | } | 549 | } |
| 555 | 550 | ||
| @@ -626,13 +621,14 @@ static int m5mols_start_monitor(struct m5mols_info *info) | |||
| 626 | static int m5mols_s_stream(struct v4l2_subdev *sd, int enable) | 621 | static int m5mols_s_stream(struct v4l2_subdev *sd, int enable) |
| 627 | { | 622 | { |
| 628 | struct m5mols_info *info = to_m5mols(sd); | 623 | struct m5mols_info *info = to_m5mols(sd); |
| 624 | u32 code = info->ffmt[info->res_type].code; | ||
| 629 | 625 | ||
| 630 | if (enable) { | 626 | if (enable) { |
| 631 | int ret = -EINVAL; | 627 | int ret = -EINVAL; |
| 632 | 628 | ||
| 633 | if (is_code(info->code, M5MOLS_RESTYPE_MONITOR)) | 629 | if (is_code(code, M5MOLS_RESTYPE_MONITOR)) |
| 634 | ret = m5mols_start_monitor(info); | 630 | ret = m5mols_start_monitor(info); |
| 635 | if (is_code(info->code, M5MOLS_RESTYPE_CAPTURE)) | 631 | if (is_code(code, M5MOLS_RESTYPE_CAPTURE)) |
| 636 | ret = m5mols_start_capture(info); | 632 | ret = m5mols_start_capture(info); |
| 637 | 633 | ||
| 638 | return ret; | 634 | return ret; |
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index cf2c0fb95f2f..398f96ffd35e 100644 --- a/drivers/media/video/mt9m111.c +++ b/drivers/media/video/mt9m111.c | |||
| @@ -955,6 +955,7 @@ static int mt9m111_probe(struct i2c_client *client, | |||
| 955 | mt9m111->rect.height = MT9M111_MAX_HEIGHT; | 955 | mt9m111->rect.height = MT9M111_MAX_HEIGHT; |
| 956 | mt9m111->fmt = &mt9m111_colour_fmts[0]; | 956 | mt9m111->fmt = &mt9m111_colour_fmts[0]; |
| 957 | mt9m111->lastpage = -1; | 957 | mt9m111->lastpage = -1; |
| 958 | mutex_init(&mt9m111->power_lock); | ||
| 958 | 959 | ||
| 959 | ret = mt9m111_video_probe(client); | 960 | ret = mt9m111_video_probe(client); |
| 960 | if (ret) { | 961 | if (ret) { |
diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c index 32114a3c0ca7..7b34b11daf24 100644 --- a/drivers/media/video/mt9t112.c +++ b/drivers/media/video/mt9t112.c | |||
| @@ -1083,8 +1083,10 @@ static int mt9t112_probe(struct i2c_client *client, | |||
| 1083 | v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops); | 1083 | v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops); |
| 1084 | 1084 | ||
| 1085 | ret = mt9t112_camera_probe(client); | 1085 | ret = mt9t112_camera_probe(client); |
| 1086 | if (ret) | 1086 | if (ret) { |
| 1087 | kfree(priv); | 1087 | kfree(priv); |
| 1088 | return ret; | ||
| 1089 | } | ||
| 1088 | 1090 | ||
| 1089 | /* Cannot fail: using the default supported pixel code */ | 1091 | /* Cannot fail: using the default supported pixel code */ |
| 1090 | mt9t112_set_params(priv, &rect, V4L2_MBUS_FMT_UYVY8_2X8); | 1092 | mt9t112_set_params(priv, &rect, V4L2_MBUS_FMT_UYVY8_2X8); |
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c index 9c5c19f142de..ee0d0b39cd17 100644 --- a/drivers/media/video/omap/omap_vout.c +++ b/drivers/media/video/omap/omap_vout.c | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include <linux/irq.h> | 38 | #include <linux/irq.h> |
| 39 | #include <linux/videodev2.h> | 39 | #include <linux/videodev2.h> |
| 40 | #include <linux/dma-mapping.h> | 40 | #include <linux/dma-mapping.h> |
| 41 | #include <linux/slab.h> | ||
| 41 | 42 | ||
| 42 | #include <media/videobuf-dma-contig.h> | 43 | #include <media/videobuf-dma-contig.h> |
| 43 | #include <media/v4l2-device.h> | 44 | #include <media/v4l2-device.h> |
| @@ -2169,6 +2170,14 @@ static int __init omap_vout_probe(struct platform_device *pdev) | |||
| 2169 | vid_dev->num_displays = 0; | 2170 | vid_dev->num_displays = 0; |
| 2170 | for_each_dss_dev(dssdev) { | 2171 | for_each_dss_dev(dssdev) { |
| 2171 | omap_dss_get_device(dssdev); | 2172 | omap_dss_get_device(dssdev); |
| 2173 | |||
| 2174 | if (!dssdev->driver) { | ||
| 2175 | dev_warn(&pdev->dev, "no driver for display: %s\n", | ||
| 2176 | dssdev->name); | ||
| 2177 | omap_dss_put_device(dssdev); | ||
| 2178 | continue; | ||
| 2179 | } | ||
| 2180 | |||
| 2172 | vid_dev->displays[vid_dev->num_displays++] = dssdev; | 2181 | vid_dev->displays[vid_dev->num_displays++] = dssdev; |
| 2173 | } | 2182 | } |
| 2174 | 2183 | ||
diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c index e87ae2f634b2..6a6cf388bae4 100644 --- a/drivers/media/video/omap1_camera.c +++ b/drivers/media/video/omap1_camera.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
| 25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
| 26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/module.h> | ||
| 27 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
| 28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 29 | 30 | ||
diff --git a/drivers/media/video/omap24xxcam-dma.c b/drivers/media/video/omap24xxcam-dma.c index 1d54b86c936b..3ea38a8def8e 100644 --- a/drivers/media/video/omap24xxcam-dma.c +++ b/drivers/media/video/omap24xxcam-dma.c | |||
| @@ -506,7 +506,7 @@ int omap24xxcam_sgdma_queue(struct omap24xxcam_sgdma *sgdma, | |||
| 506 | unsigned long flags; | 506 | unsigned long flags; |
| 507 | struct sgdma_state *sg_state; | 507 | struct sgdma_state *sg_state; |
| 508 | 508 | ||
| 509 | if ((sglen < 0) || ((sglen > 0) & !sglist)) | 509 | if ((sglen < 0) || ((sglen > 0) && !sglist)) |
| 510 | return -EINVAL; | 510 | return -EINVAL; |
| 511 | 511 | ||
| 512 | spin_lock_irqsave(&sgdma->lock, flags); | 512 | spin_lock_irqsave(&sgdma->lock, flags); |
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index b0b0fa5a3572..54a4a3f22e2e 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c | |||
| @@ -1408,7 +1408,7 @@ static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc) | |||
| 1408 | { | 1408 | { |
| 1409 | struct isp_pipeline *pipe = | 1409 | struct isp_pipeline *pipe = |
| 1410 | to_isp_pipeline(&ccdc->video_out.video.entity); | 1410 | to_isp_pipeline(&ccdc->video_out.video.entity); |
| 1411 | struct video_device *vdev = &ccdc->subdev.devnode; | 1411 | struct video_device *vdev = ccdc->subdev.devnode; |
| 1412 | struct v4l2_event event; | 1412 | struct v4l2_event event; |
| 1413 | 1413 | ||
| 1414 | memset(&event, 0, sizeof(event)); | 1414 | memset(&event, 0, sizeof(event)); |
diff --git a/drivers/media/video/omap3isp/ispstat.c b/drivers/media/video/omap3isp/ispstat.c index 68d539456c55..bc0b2c7349b9 100644 --- a/drivers/media/video/omap3isp/ispstat.c +++ b/drivers/media/video/omap3isp/ispstat.c | |||
| @@ -496,7 +496,7 @@ static int isp_stat_bufs_alloc(struct ispstat *stat, u32 size) | |||
| 496 | 496 | ||
| 497 | static void isp_stat_queue_event(struct ispstat *stat, int err) | 497 | static void isp_stat_queue_event(struct ispstat *stat, int err) |
| 498 | { | 498 | { |
| 499 | struct video_device *vdev = &stat->subdev.devnode; | 499 | struct video_device *vdev = stat->subdev.devnode; |
| 500 | struct v4l2_event event; | 500 | struct v4l2_event event; |
| 501 | struct omap3isp_stat_event_status *status = (void *)event.u.data; | 501 | struct omap3isp_stat_event_status *status = (void *)event.u.data; |
| 502 | 502 | ||
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index d1000723c5ae..f2290578448c 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <asm/cacheflush.h> | 26 | #include <asm/cacheflush.h> |
| 27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
| 28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
| 29 | #include <linux/module.h> | ||
| 29 | #include <linux/pagemap.h> | 30 | #include <linux/pagemap.h> |
| 30 | #include <linux/scatterlist.h> | 31 | #include <linux/scatterlist.h> |
| 31 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
diff --git a/drivers/media/video/ov6650.c b/drivers/media/video/ov6650.c index 9f2d26b1d4cb..6806345ec2f0 100644 --- a/drivers/media/video/ov6650.c +++ b/drivers/media/video/ov6650.c | |||
| @@ -540,7 +540,7 @@ static u8 to_clkrc(struct v4l2_fract *timeperframe, | |||
| 540 | static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) | 540 | static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
| 541 | { | 541 | { |
| 542 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 542 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 543 | struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; | 543 | struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); |
| 544 | struct soc_camera_sense *sense = icd->sense; | 544 | struct soc_camera_sense *sense = icd->sense; |
| 545 | struct ov6650 *priv = to_ov6650(client); | 545 | struct ov6650 *priv = to_ov6650(client); |
| 546 | bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect); | 546 | bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect); |
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index c8d91b0cd9bd..2cc3b9166724 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
| @@ -98,6 +98,10 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend) | |||
| 98 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); | 98 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); |
| 99 | } | 99 | } |
| 100 | set_bit(ST_CAPT_SUSPENDED, &fimc->state); | 100 | set_bit(ST_CAPT_SUSPENDED, &fimc->state); |
| 101 | |||
| 102 | fimc_hw_reset(fimc); | ||
| 103 | cap->buf_index = 0; | ||
| 104 | |||
| 101 | spin_unlock_irqrestore(&fimc->slock, flags); | 105 | spin_unlock_irqrestore(&fimc->slock, flags); |
| 102 | 106 | ||
| 103 | if (streaming) | 107 | if (streaming) |
| @@ -137,7 +141,7 @@ int fimc_capture_config_update(struct fimc_ctx *ctx) | |||
| 137 | struct fimc_dev *fimc = ctx->fimc_dev; | 141 | struct fimc_dev *fimc = ctx->fimc_dev; |
| 138 | int ret; | 142 | int ret; |
| 139 | 143 | ||
| 140 | if (test_bit(ST_CAPT_APPLY_CFG, &fimc->state)) | 144 | if (!test_bit(ST_CAPT_APPLY_CFG, &fimc->state)) |
| 141 | return 0; | 145 | return 0; |
| 142 | 146 | ||
| 143 | spin_lock(&ctx->slock); | 147 | spin_lock(&ctx->slock); |
| @@ -150,7 +154,7 @@ int fimc_capture_config_update(struct fimc_ctx *ctx) | |||
| 150 | fimc_hw_set_rotation(ctx); | 154 | fimc_hw_set_rotation(ctx); |
| 151 | fimc_prepare_dma_offset(ctx, &ctx->d_frame); | 155 | fimc_prepare_dma_offset(ctx, &ctx->d_frame); |
| 152 | fimc_hw_set_out_dma(ctx); | 156 | fimc_hw_set_out_dma(ctx); |
| 153 | set_bit(ST_CAPT_APPLY_CFG, &fimc->state); | 157 | clear_bit(ST_CAPT_APPLY_CFG, &fimc->state); |
| 154 | } | 158 | } |
| 155 | spin_unlock(&ctx->slock); | 159 | spin_unlock(&ctx->slock); |
| 156 | return ret; | 160 | return ret; |
| @@ -164,7 +168,6 @@ static int start_streaming(struct vb2_queue *q, unsigned int count) | |||
| 164 | int min_bufs; | 168 | int min_bufs; |
| 165 | int ret; | 169 | int ret; |
| 166 | 170 | ||
| 167 | fimc_hw_reset(fimc); | ||
| 168 | vid_cap->frame_count = 0; | 171 | vid_cap->frame_count = 0; |
| 169 | 172 | ||
| 170 | ret = fimc_init_capture(fimc); | 173 | ret = fimc_init_capture(fimc); |
| @@ -523,7 +526,7 @@ static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx, | |||
| 523 | max_w = rotation ? pl->out_rot_en_w : pl->out_rot_dis_w; | 526 | max_w = rotation ? pl->out_rot_en_w : pl->out_rot_dis_w; |
| 524 | min_w = ctx->state & FIMC_DST_CROP ? dst->width : var->min_out_pixsize; | 527 | min_w = ctx->state & FIMC_DST_CROP ? dst->width : var->min_out_pixsize; |
| 525 | min_h = ctx->state & FIMC_DST_CROP ? dst->height : var->min_out_pixsize; | 528 | min_h = ctx->state & FIMC_DST_CROP ? dst->height : var->min_out_pixsize; |
| 526 | if (fimc->id == 1 && var->pix_hoff) | 529 | if (var->min_vsize_align == 1 && !rotation) |
| 527 | align_h = fimc_fmt_is_rgb(ffmt->color) ? 0 : 1; | 530 | align_h = fimc_fmt_is_rgb(ffmt->color) ? 0 : 1; |
| 528 | 531 | ||
| 529 | depth = fimc_get_format_depth(ffmt); | 532 | depth = fimc_get_format_depth(ffmt); |
| @@ -1239,6 +1242,7 @@ static int fimc_subdev_set_fmt(struct v4l2_subdev *sd, | |||
| 1239 | 1242 | ||
| 1240 | mutex_lock(&fimc->lock); | 1243 | mutex_lock(&fimc->lock); |
| 1241 | set_frame_bounds(ff, mf->width, mf->height); | 1244 | set_frame_bounds(ff, mf->width, mf->height); |
| 1245 | fimc->vid_cap.mf = *mf; | ||
| 1242 | ff->fmt = ffmt; | 1246 | ff->fmt = ffmt; |
| 1243 | 1247 | ||
| 1244 | /* Reset the crop rectangle if required. */ | 1248 | /* Reset the crop rectangle if required. */ |
| @@ -1375,7 +1379,7 @@ static void fimc_destroy_capture_subdev(struct fimc_dev *fimc) | |||
| 1375 | media_entity_cleanup(&sd->entity); | 1379 | media_entity_cleanup(&sd->entity); |
| 1376 | v4l2_device_unregister_subdev(sd); | 1380 | v4l2_device_unregister_subdev(sd); |
| 1377 | kfree(sd); | 1381 | kfree(sd); |
| 1378 | sd = NULL; | 1382 | fimc->vid_cap.subdev = NULL; |
| 1379 | } | 1383 | } |
| 1380 | 1384 | ||
| 1381 | /* Set default format at the sensor and host interface */ | 1385 | /* Set default format at the sensor and host interface */ |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 19ca6db38b2f..07c6254faee3 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
| @@ -37,7 +37,7 @@ static char *fimc_clocks[MAX_FIMC_CLOCKS] = { | |||
| 37 | static struct fimc_fmt fimc_formats[] = { | 37 | static struct fimc_fmt fimc_formats[] = { |
| 38 | { | 38 | { |
| 39 | .name = "RGB565", | 39 | .name = "RGB565", |
| 40 | .fourcc = V4L2_PIX_FMT_RGB565X, | 40 | .fourcc = V4L2_PIX_FMT_RGB565, |
| 41 | .depth = { 16 }, | 41 | .depth = { 16 }, |
| 42 | .color = S5P_FIMC_RGB565, | 42 | .color = S5P_FIMC_RGB565, |
| 43 | .memplanes = 1, | 43 | .memplanes = 1, |
| @@ -1038,12 +1038,11 @@ static int fimc_try_fmt_mplane(struct fimc_ctx *ctx, struct v4l2_format *f) | |||
| 1038 | mod_x = 6; /* 64 x 32 pixels tile */ | 1038 | mod_x = 6; /* 64 x 32 pixels tile */ |
| 1039 | mod_y = 5; | 1039 | mod_y = 5; |
| 1040 | } else { | 1040 | } else { |
| 1041 | if (fimc->id == 1 && variant->pix_hoff) | 1041 | if (variant->min_vsize_align == 1) |
| 1042 | mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1; | 1042 | mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1; |
| 1043 | else | 1043 | else |
| 1044 | mod_y = mod_x; | 1044 | mod_y = ffs(variant->min_vsize_align) - 1; |
| 1045 | } | 1045 | } |
| 1046 | dbg("mod_x: %d, mod_y: %d, max_w: %d", mod_x, mod_y, max_w); | ||
| 1047 | 1046 | ||
| 1048 | v4l_bound_align_image(&pix->width, 16, max_w, mod_x, | 1047 | v4l_bound_align_image(&pix->width, 16, max_w, mod_x, |
| 1049 | &pix->height, 8, variant->pix_limit->scaler_dis_w, mod_y, 0); | 1048 | &pix->height, 8, variant->pix_limit->scaler_dis_w, mod_y, 0); |
| @@ -1226,10 +1225,10 @@ static int fimc_m2m_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr) | |||
| 1226 | fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize; | 1225 | fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize; |
| 1227 | 1226 | ||
| 1228 | /* Get pixel alignment constraints. */ | 1227 | /* Get pixel alignment constraints. */ |
| 1229 | if (fimc->id == 1 && fimc->variant->pix_hoff) | 1228 | if (fimc->variant->min_vsize_align == 1) |
| 1230 | halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1; | 1229 | halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1; |
| 1231 | else | 1230 | else |
| 1232 | halign = ffs(min_size) - 1; | 1231 | halign = ffs(fimc->variant->min_vsize_align) - 1; |
| 1233 | 1232 | ||
| 1234 | for (i = 0; i < f->fmt->colplanes; i++) | 1233 | for (i = 0; i < f->fmt->colplanes; i++) |
| 1235 | depth += f->fmt->depth[i]; | 1234 | depth += f->fmt->depth[i]; |
| @@ -1615,7 +1614,6 @@ static int fimc_probe(struct platform_device *pdev) | |||
| 1615 | pdata = pdev->dev.platform_data; | 1614 | pdata = pdev->dev.platform_data; |
| 1616 | fimc->pdata = pdata; | 1615 | fimc->pdata = pdata; |
| 1617 | 1616 | ||
| 1618 | set_bit(ST_LPM, &fimc->state); | ||
| 1619 | 1617 | ||
| 1620 | init_waitqueue_head(&fimc->irq_queue); | 1618 | init_waitqueue_head(&fimc->irq_queue); |
| 1621 | spin_lock_init(&fimc->slock); | 1619 | spin_lock_init(&fimc->slock); |
| @@ -1707,8 +1705,6 @@ static int fimc_runtime_resume(struct device *dev) | |||
| 1707 | /* Enable clocks and perform basic initalization */ | 1705 | /* Enable clocks and perform basic initalization */ |
| 1708 | clk_enable(fimc->clock[CLK_GATE]); | 1706 | clk_enable(fimc->clock[CLK_GATE]); |
| 1709 | fimc_hw_reset(fimc); | 1707 | fimc_hw_reset(fimc); |
| 1710 | if (fimc->variant->out_buf_count > 4) | ||
| 1711 | fimc_hw_set_dma_seq(fimc, 0xF); | ||
| 1712 | 1708 | ||
| 1713 | /* Resume the capture or mem-to-mem device */ | 1709 | /* Resume the capture or mem-to-mem device */ |
| 1714 | if (fimc_capture_busy(fimc)) | 1710 | if (fimc_capture_busy(fimc)) |
| @@ -1750,8 +1746,6 @@ static int fimc_resume(struct device *dev) | |||
| 1750 | return 0; | 1746 | return 0; |
| 1751 | } | 1747 | } |
| 1752 | fimc_hw_reset(fimc); | 1748 | fimc_hw_reset(fimc); |
| 1753 | if (fimc->variant->out_buf_count > 4) | ||
| 1754 | fimc_hw_set_dma_seq(fimc, 0xF); | ||
| 1755 | spin_unlock_irqrestore(&fimc->slock, flags); | 1749 | spin_unlock_irqrestore(&fimc->slock, flags); |
| 1756 | 1750 | ||
| 1757 | if (fimc_capture_busy(fimc)) | 1751 | if (fimc_capture_busy(fimc)) |
| @@ -1780,7 +1774,6 @@ static int __devexit fimc_remove(struct platform_device *pdev) | |||
| 1780 | struct fimc_dev *fimc = platform_get_drvdata(pdev); | 1774 | struct fimc_dev *fimc = platform_get_drvdata(pdev); |
| 1781 | 1775 | ||
| 1782 | pm_runtime_disable(&pdev->dev); | 1776 | pm_runtime_disable(&pdev->dev); |
| 1783 | fimc_runtime_suspend(&pdev->dev); | ||
| 1784 | pm_runtime_set_suspended(&pdev->dev); | 1777 | pm_runtime_set_suspended(&pdev->dev); |
| 1785 | 1778 | ||
| 1786 | vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx); | 1779 | vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx); |
| @@ -1840,6 +1833,7 @@ static struct samsung_fimc_variant fimc0_variant_s5p = { | |||
| 1840 | .min_inp_pixsize = 16, | 1833 | .min_inp_pixsize = 16, |
| 1841 | .min_out_pixsize = 16, | 1834 | .min_out_pixsize = 16, |
| 1842 | .hor_offs_align = 8, | 1835 | .hor_offs_align = 8, |
| 1836 | .min_vsize_align = 16, | ||
| 1843 | .out_buf_count = 4, | 1837 | .out_buf_count = 4, |
| 1844 | .pix_limit = &s5p_pix_limit[0], | 1838 | .pix_limit = &s5p_pix_limit[0], |
| 1845 | }; | 1839 | }; |
| @@ -1849,6 +1843,7 @@ static struct samsung_fimc_variant fimc2_variant_s5p = { | |||
| 1849 | .min_inp_pixsize = 16, | 1843 | .min_inp_pixsize = 16, |
| 1850 | .min_out_pixsize = 16, | 1844 | .min_out_pixsize = 16, |
| 1851 | .hor_offs_align = 8, | 1845 | .hor_offs_align = 8, |
| 1846 | .min_vsize_align = 16, | ||
| 1852 | .out_buf_count = 4, | 1847 | .out_buf_count = 4, |
| 1853 | .pix_limit = &s5p_pix_limit[1], | 1848 | .pix_limit = &s5p_pix_limit[1], |
| 1854 | }; | 1849 | }; |
| @@ -1861,6 +1856,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv210 = { | |||
| 1861 | .min_inp_pixsize = 16, | 1856 | .min_inp_pixsize = 16, |
| 1862 | .min_out_pixsize = 16, | 1857 | .min_out_pixsize = 16, |
| 1863 | .hor_offs_align = 8, | 1858 | .hor_offs_align = 8, |
| 1859 | .min_vsize_align = 16, | ||
| 1864 | .out_buf_count = 4, | 1860 | .out_buf_count = 4, |
| 1865 | .pix_limit = &s5p_pix_limit[1], | 1861 | .pix_limit = &s5p_pix_limit[1], |
| 1866 | }; | 1862 | }; |
| @@ -1874,6 +1870,7 @@ static struct samsung_fimc_variant fimc1_variant_s5pv210 = { | |||
| 1874 | .min_inp_pixsize = 16, | 1870 | .min_inp_pixsize = 16, |
| 1875 | .min_out_pixsize = 16, | 1871 | .min_out_pixsize = 16, |
| 1876 | .hor_offs_align = 1, | 1872 | .hor_offs_align = 1, |
| 1873 | .min_vsize_align = 1, | ||
| 1877 | .out_buf_count = 4, | 1874 | .out_buf_count = 4, |
| 1878 | .pix_limit = &s5p_pix_limit[2], | 1875 | .pix_limit = &s5p_pix_limit[2], |
| 1879 | }; | 1876 | }; |
| @@ -1884,6 +1881,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv210 = { | |||
| 1884 | .min_inp_pixsize = 16, | 1881 | .min_inp_pixsize = 16, |
| 1885 | .min_out_pixsize = 16, | 1882 | .min_out_pixsize = 16, |
| 1886 | .hor_offs_align = 8, | 1883 | .hor_offs_align = 8, |
| 1884 | .min_vsize_align = 16, | ||
| 1887 | .out_buf_count = 4, | 1885 | .out_buf_count = 4, |
| 1888 | .pix_limit = &s5p_pix_limit[2], | 1886 | .pix_limit = &s5p_pix_limit[2], |
| 1889 | }; | 1887 | }; |
| @@ -1898,6 +1896,7 @@ static struct samsung_fimc_variant fimc0_variant_exynos4 = { | |||
| 1898 | .min_inp_pixsize = 16, | 1896 | .min_inp_pixsize = 16, |
| 1899 | .min_out_pixsize = 16, | 1897 | .min_out_pixsize = 16, |
| 1900 | .hor_offs_align = 2, | 1898 | .hor_offs_align = 2, |
| 1899 | .min_vsize_align = 1, | ||
| 1901 | .out_buf_count = 32, | 1900 | .out_buf_count = 32, |
| 1902 | .pix_limit = &s5p_pix_limit[1], | 1901 | .pix_limit = &s5p_pix_limit[1], |
| 1903 | }; | 1902 | }; |
| @@ -1910,6 +1909,7 @@ static struct samsung_fimc_variant fimc3_variant_exynos4 = { | |||
| 1910 | .min_inp_pixsize = 16, | 1909 | .min_inp_pixsize = 16, |
| 1911 | .min_out_pixsize = 16, | 1910 | .min_out_pixsize = 16, |
| 1912 | .hor_offs_align = 2, | 1911 | .hor_offs_align = 2, |
| 1912 | .min_vsize_align = 1, | ||
| 1913 | .out_buf_count = 32, | 1913 | .out_buf_count = 32, |
| 1914 | .pix_limit = &s5p_pix_limit[3], | 1914 | .pix_limit = &s5p_pix_limit[3], |
| 1915 | }; | 1915 | }; |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h index a6936dad5b10..c7f01c47b20f 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.h +++ b/drivers/media/video/s5p-fimc/fimc-core.h | |||
| @@ -377,6 +377,7 @@ struct fimc_pix_limit { | |||
| 377 | * @min_inp_pixsize: minimum input pixel size | 377 | * @min_inp_pixsize: minimum input pixel size |
| 378 | * @min_out_pixsize: minimum output pixel size | 378 | * @min_out_pixsize: minimum output pixel size |
| 379 | * @hor_offs_align: horizontal pixel offset aligment | 379 | * @hor_offs_align: horizontal pixel offset aligment |
| 380 | * @min_vsize_align: minimum vertical pixel size alignment | ||
| 380 | * @out_buf_count: the number of buffers in output DMA sequence | 381 | * @out_buf_count: the number of buffers in output DMA sequence |
| 381 | */ | 382 | */ |
| 382 | struct samsung_fimc_variant { | 383 | struct samsung_fimc_variant { |
| @@ -390,6 +391,7 @@ struct samsung_fimc_variant { | |||
| 390 | u16 min_inp_pixsize; | 391 | u16 min_inp_pixsize; |
| 391 | u16 min_out_pixsize; | 392 | u16 min_out_pixsize; |
| 392 | u16 hor_offs_align; | 393 | u16 hor_offs_align; |
| 394 | u16 min_vsize_align; | ||
| 393 | u16 out_buf_count; | 395 | u16 out_buf_count; |
| 394 | }; | 396 | }; |
| 395 | 397 | ||
diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.c b/drivers/media/video/s5p-fimc/fimc-mdevice.c index cc337b1de913..615c862f0360 100644 --- a/drivers/media/video/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/video/s5p-fimc/fimc-mdevice.c | |||
| @@ -220,6 +220,7 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd, | |||
| 220 | sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter, | 220 | sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter, |
| 221 | s_info->pdata->board_info, NULL); | 221 | s_info->pdata->board_info, NULL); |
| 222 | if (IS_ERR_OR_NULL(sd)) { | 222 | if (IS_ERR_OR_NULL(sd)) { |
| 223 | i2c_put_adapter(adapter); | ||
| 223 | v4l2_err(&fmd->v4l2_dev, "Failed to acquire subdev\n"); | 224 | v4l2_err(&fmd->v4l2_dev, "Failed to acquire subdev\n"); |
| 224 | return NULL; | 225 | return NULL; |
| 225 | } | 226 | } |
| @@ -234,12 +235,15 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd, | |||
| 234 | static void fimc_md_unregister_sensor(struct v4l2_subdev *sd) | 235 | static void fimc_md_unregister_sensor(struct v4l2_subdev *sd) |
| 235 | { | 236 | { |
| 236 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 237 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 238 | struct i2c_adapter *adapter; | ||
| 237 | 239 | ||
| 238 | if (!client) | 240 | if (!client) |
| 239 | return; | 241 | return; |
| 240 | v4l2_device_unregister_subdev(sd); | 242 | v4l2_device_unregister_subdev(sd); |
| 243 | adapter = client->adapter; | ||
| 241 | i2c_unregister_device(client); | 244 | i2c_unregister_device(client); |
| 242 | i2c_put_adapter(client->adapter); | 245 | if (adapter) |
| 246 | i2c_put_adapter(adapter); | ||
| 243 | } | 247 | } |
| 244 | 248 | ||
| 245 | static int fimc_md_register_sensor_entities(struct fimc_md *fmd) | 249 | static int fimc_md_register_sensor_entities(struct fimc_md *fmd) |
| @@ -381,20 +385,28 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd) | |||
| 381 | 385 | ||
| 382 | static int fimc_md_register_video_nodes(struct fimc_md *fmd) | 386 | static int fimc_md_register_video_nodes(struct fimc_md *fmd) |
| 383 | { | 387 | { |
| 388 | struct video_device *vdev; | ||
| 384 | int i, ret = 0; | 389 | int i, ret = 0; |
| 385 | 390 | ||
| 386 | for (i = 0; i < FIMC_MAX_DEVS && !ret; i++) { | 391 | for (i = 0; i < FIMC_MAX_DEVS && !ret; i++) { |
| 387 | if (!fmd->fimc[i]) | 392 | if (!fmd->fimc[i]) |
| 388 | continue; | 393 | continue; |
| 389 | 394 | ||
| 390 | if (fmd->fimc[i]->m2m.vfd) | 395 | vdev = fmd->fimc[i]->m2m.vfd; |
| 391 | ret = video_register_device(fmd->fimc[i]->m2m.vfd, | 396 | if (vdev) { |
| 392 | VFL_TYPE_GRABBER, -1); | 397 | ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); |
| 393 | if (ret) | 398 | if (ret) |
| 394 | break; | 399 | break; |
| 395 | if (fmd->fimc[i]->vid_cap.vfd) | 400 | v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s\n", |
| 396 | ret = video_register_device(fmd->fimc[i]->vid_cap.vfd, | 401 | vdev->name, video_device_node_name(vdev)); |
| 397 | VFL_TYPE_GRABBER, -1); | 402 | } |
| 403 | |||
| 404 | vdev = fmd->fimc[i]->vid_cap.vfd; | ||
| 405 | if (vdev == NULL) | ||
| 406 | continue; | ||
| 407 | ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); | ||
| 408 | v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s\n", | ||
| 409 | vdev->name, video_device_node_name(vdev)); | ||
| 398 | } | 410 | } |
| 399 | 411 | ||
| 400 | return ret; | 412 | return ret; |
| @@ -502,7 +514,7 @@ static int fimc_md_create_links(struct fimc_md *fmd) | |||
| 502 | if (WARN(csis == NULL, | 514 | if (WARN(csis == NULL, |
| 503 | "MIPI-CSI interface specified " | 515 | "MIPI-CSI interface specified " |
| 504 | "but s5p-csis module is not loaded!\n")) | 516 | "but s5p-csis module is not loaded!\n")) |
| 505 | continue; | 517 | return -EINVAL; |
| 506 | 518 | ||
| 507 | ret = media_entity_create_link(&sensor->entity, 0, | 519 | ret = media_entity_create_link(&sensor->entity, 0, |
| 508 | &csis->entity, CSIS_PAD_SINK, | 520 | &csis->entity, CSIS_PAD_SINK, |
| @@ -742,9 +754,6 @@ static int __devinit fimc_md_probe(struct platform_device *pdev) | |||
| 742 | struct fimc_md *fmd; | 754 | struct fimc_md *fmd; |
| 743 | int ret; | 755 | int ret; |
| 744 | 756 | ||
| 745 | if (WARN(!pdev->dev.platform_data, "Platform data not specified!\n")) | ||
| 746 | return -EINVAL; | ||
| 747 | |||
| 748 | fmd = kzalloc(sizeof(struct fimc_md), GFP_KERNEL); | 757 | fmd = kzalloc(sizeof(struct fimc_md), GFP_KERNEL); |
| 749 | if (!fmd) | 758 | if (!fmd) |
| 750 | return -ENOMEM; | 759 | return -ENOMEM; |
| @@ -782,9 +791,11 @@ static int __devinit fimc_md_probe(struct platform_device *pdev) | |||
| 782 | if (ret) | 791 | if (ret) |
| 783 | goto err3; | 792 | goto err3; |
| 784 | 793 | ||
| 785 | ret = fimc_md_register_sensor_entities(fmd); | 794 | if (pdev->dev.platform_data) { |
| 786 | if (ret) | 795 | ret = fimc_md_register_sensor_entities(fmd); |
| 787 | goto err3; | 796 | if (ret) |
| 797 | goto err3; | ||
| 798 | } | ||
| 788 | ret = fimc_md_create_links(fmd); | 799 | ret = fimc_md_create_links(fmd); |
| 789 | if (ret) | 800 | if (ret) |
| 790 | goto err3; | 801 | goto err3; |
diff --git a/drivers/media/video/s5p-fimc/fimc-reg.c b/drivers/media/video/s5p-fimc/fimc-reg.c index 20e664e34163..44f5c2d1920b 100644 --- a/drivers/media/video/s5p-fimc/fimc-reg.c +++ b/drivers/media/video/s5p-fimc/fimc-reg.c | |||
| @@ -35,6 +35,9 @@ void fimc_hw_reset(struct fimc_dev *dev) | |||
| 35 | cfg = readl(dev->regs + S5P_CIGCTRL); | 35 | cfg = readl(dev->regs + S5P_CIGCTRL); |
| 36 | cfg &= ~S5P_CIGCTRL_SWRST; | 36 | cfg &= ~S5P_CIGCTRL_SWRST; |
| 37 | writel(cfg, dev->regs + S5P_CIGCTRL); | 37 | writel(cfg, dev->regs + S5P_CIGCTRL); |
| 38 | |||
| 39 | if (dev->variant->out_buf_count > 4) | ||
| 40 | fimc_hw_set_dma_seq(dev, 0xF); | ||
| 38 | } | 41 | } |
| 39 | 42 | ||
| 40 | static u32 fimc_hw_get_in_flip(struct fimc_ctx *ctx) | 43 | static u32 fimc_hw_get_in_flip(struct fimc_ctx *ctx) |
| @@ -251,7 +254,14 @@ static void fimc_hw_set_scaler(struct fimc_ctx *ctx) | |||
| 251 | struct fimc_scaler *sc = &ctx->scaler; | 254 | struct fimc_scaler *sc = &ctx->scaler; |
| 252 | struct fimc_frame *src_frame = &ctx->s_frame; | 255 | struct fimc_frame *src_frame = &ctx->s_frame; |
| 253 | struct fimc_frame *dst_frame = &ctx->d_frame; | 256 | struct fimc_frame *dst_frame = &ctx->d_frame; |
| 254 | u32 cfg = 0; | 257 | |
| 258 | u32 cfg = readl(dev->regs + S5P_CISCCTRL); | ||
| 259 | |||
| 260 | cfg &= ~(S5P_CISCCTRL_CSCR2Y_WIDE | S5P_CISCCTRL_CSCY2R_WIDE | | ||
| 261 | S5P_CISCCTRL_SCALEUP_H | S5P_CISCCTRL_SCALEUP_V | | ||
| 262 | S5P_CISCCTRL_SCALERBYPASS | S5P_CISCCTRL_ONE2ONE | | ||
| 263 | S5P_CISCCTRL_INRGB_FMT_MASK | S5P_CISCCTRL_OUTRGB_FMT_MASK | | ||
| 264 | S5P_CISCCTRL_INTERLACE | S5P_CISCCTRL_RGB_EXT); | ||
| 255 | 265 | ||
| 256 | if (!(ctx->flags & FIMC_COLOR_RANGE_NARROW)) | 266 | if (!(ctx->flags & FIMC_COLOR_RANGE_NARROW)) |
| 257 | cfg |= (S5P_CISCCTRL_CSCR2Y_WIDE | S5P_CISCCTRL_CSCY2R_WIDE); | 267 | cfg |= (S5P_CISCCTRL_CSCR2Y_WIDE | S5P_CISCCTRL_CSCY2R_WIDE); |
| @@ -308,9 +318,9 @@ void fimc_hw_set_mainscaler(struct fimc_ctx *ctx) | |||
| 308 | fimc_hw_set_scaler(ctx); | 318 | fimc_hw_set_scaler(ctx); |
| 309 | 319 | ||
| 310 | cfg = readl(dev->regs + S5P_CISCCTRL); | 320 | cfg = readl(dev->regs + S5P_CISCCTRL); |
| 321 | cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK); | ||
| 311 | 322 | ||
| 312 | if (variant->has_mainscaler_ext) { | 323 | if (variant->has_mainscaler_ext) { |
| 313 | cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK); | ||
| 314 | cfg |= S5P_CISCCTRL_MHRATIO_EXT(sc->main_hratio); | 324 | cfg |= S5P_CISCCTRL_MHRATIO_EXT(sc->main_hratio); |
| 315 | cfg |= S5P_CISCCTRL_MVRATIO_EXT(sc->main_vratio); | 325 | cfg |= S5P_CISCCTRL_MVRATIO_EXT(sc->main_vratio); |
| 316 | writel(cfg, dev->regs + S5P_CISCCTRL); | 326 | writel(cfg, dev->regs + S5P_CISCCTRL); |
| @@ -323,7 +333,6 @@ void fimc_hw_set_mainscaler(struct fimc_ctx *ctx) | |||
| 323 | cfg |= S5P_CIEXTEN_MVRATIO_EXT(sc->main_vratio); | 333 | cfg |= S5P_CIEXTEN_MVRATIO_EXT(sc->main_vratio); |
| 324 | writel(cfg, dev->regs + S5P_CIEXTEN); | 334 | writel(cfg, dev->regs + S5P_CIEXTEN); |
| 325 | } else { | 335 | } else { |
| 326 | cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK); | ||
| 327 | cfg |= S5P_CISCCTRL_MHRATIO(sc->main_hratio); | 336 | cfg |= S5P_CISCCTRL_MHRATIO(sc->main_hratio); |
| 328 | cfg |= S5P_CISCCTRL_MVRATIO(sc->main_vratio); | 337 | cfg |= S5P_CISCCTRL_MVRATIO(sc->main_vratio); |
| 329 | writel(cfg, dev->regs + S5P_CISCCTRL); | 338 | writel(cfg, dev->regs + S5P_CISCCTRL); |
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index 1e8cdb77d4b8..dff9dc798795 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c | |||
| @@ -61,7 +61,7 @@ static struct s5p_mfc_fmt formats[] = { | |||
| 61 | .num_planes = 1, | 61 | .num_planes = 1, |
| 62 | }, | 62 | }, |
| 63 | { | 63 | { |
| 64 | .name = "H264 Encoded Stream", | 64 | .name = "H263 Encoded Stream", |
| 65 | .fourcc = V4L2_PIX_FMT_H263, | 65 | .fourcc = V4L2_PIX_FMT_H263, |
| 66 | .codec_mode = S5P_FIMV_CODEC_H263_ENC, | 66 | .codec_mode = S5P_FIMV_CODEC_H263_ENC, |
| 67 | .type = MFC_FMT_ENC, | 67 | .type = MFC_FMT_ENC, |
diff --git a/drivers/media/video/s5p-tv/mixer_video.c b/drivers/media/video/s5p-tv/mixer_video.c index e16d3a4bc1dc..b47d0c06ecf5 100644 --- a/drivers/media/video/s5p-tv/mixer_video.c +++ b/drivers/media/video/s5p-tv/mixer_video.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <media/v4l2-ioctl.h> | 16 | #include <media/v4l2-ioctl.h> |
| 17 | #include <linux/videodev2.h> | 17 | #include <linux/videodev2.h> |
| 18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
| 19 | #include <linux/module.h> | ||
| 19 | #include <linux/version.h> | 20 | #include <linux/version.h> |
| 20 | #include <linux/timer.h> | 21 | #include <linux/timer.h> |
| 21 | #include <media/videobuf2-dma-contig.h> | 22 | #include <media/videobuf2-dma-contig.h> |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index f390682629cf..c51decfcae19 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
| @@ -566,8 +566,10 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) | |||
| 566 | ret = sh_mobile_ceu_soft_reset(pcdev); | 566 | ret = sh_mobile_ceu_soft_reset(pcdev); |
| 567 | 567 | ||
| 568 | csi2_sd = find_csi2(pcdev); | 568 | csi2_sd = find_csi2(pcdev); |
| 569 | if (csi2_sd) | 569 | if (csi2_sd) { |
| 570 | csi2_sd->grp_id = (long)icd; | 570 | csi2_sd->grp_id = soc_camera_grp_id(icd); |
| 571 | v4l2_set_subdev_hostdata(csi2_sd, icd); | ||
| 572 | } | ||
| 571 | 573 | ||
| 572 | ret = v4l2_subdev_call(csi2_sd, core, s_power, 1); | 574 | ret = v4l2_subdev_call(csi2_sd, core, s_power, 1); |
| 573 | if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) { | 575 | if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) { |
| @@ -768,7 +770,7 @@ static struct v4l2_subdev *find_bus_subdev(struct sh_mobile_ceu_dev *pcdev, | |||
| 768 | { | 770 | { |
| 769 | if (pcdev->csi2_pdev) { | 771 | if (pcdev->csi2_pdev) { |
| 770 | struct v4l2_subdev *csi2_sd = find_csi2(pcdev); | 772 | struct v4l2_subdev *csi2_sd = find_csi2(pcdev); |
| 771 | if (csi2_sd && csi2_sd->grp_id == (u32)icd) | 773 | if (csi2_sd && csi2_sd->grp_id == soc_camera_grp_id(icd)) |
| 772 | return csi2_sd; | 774 | return csi2_sd; |
| 773 | } | 775 | } |
| 774 | 776 | ||
| @@ -1089,8 +1091,9 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int | |||
| 1089 | /* Try 2560x1920, 1280x960, 640x480, 320x240 */ | 1091 | /* Try 2560x1920, 1280x960, 640x480, 320x240 */ |
| 1090 | mf.width = 2560 >> shift; | 1092 | mf.width = 2560 >> shift; |
| 1091 | mf.height = 1920 >> shift; | 1093 | mf.height = 1920 >> shift; |
| 1092 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, | 1094 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
| 1093 | s_mbus_fmt, &mf); | 1095 | soc_camera_grp_id(icd), video, |
| 1096 | s_mbus_fmt, &mf); | ||
| 1094 | if (ret < 0) | 1097 | if (ret < 0) |
| 1095 | return ret; | 1098 | return ret; |
| 1096 | shift++; | 1099 | shift++; |
| @@ -1389,7 +1392,8 @@ static int client_s_fmt(struct soc_camera_device *icd, | |||
| 1389 | bool ceu_1to1; | 1392 | bool ceu_1to1; |
| 1390 | int ret; | 1393 | int ret; |
| 1391 | 1394 | ||
| 1392 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, | 1395 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
| 1396 | soc_camera_grp_id(icd), video, | ||
| 1393 | s_mbus_fmt, mf); | 1397 | s_mbus_fmt, mf); |
| 1394 | if (ret < 0) | 1398 | if (ret < 0) |
| 1395 | return ret; | 1399 | return ret; |
| @@ -1426,8 +1430,9 @@ static int client_s_fmt(struct soc_camera_device *icd, | |||
| 1426 | tmp_h = min(2 * tmp_h, max_height); | 1430 | tmp_h = min(2 * tmp_h, max_height); |
| 1427 | mf->width = tmp_w; | 1431 | mf->width = tmp_w; |
| 1428 | mf->height = tmp_h; | 1432 | mf->height = tmp_h; |
| 1429 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, | 1433 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
| 1430 | s_mbus_fmt, mf); | 1434 | soc_camera_grp_id(icd), video, |
| 1435 | s_mbus_fmt, mf); | ||
| 1431 | dev_geo(dev, "Camera scaled to %ux%u\n", | 1436 | dev_geo(dev, "Camera scaled to %ux%u\n", |
| 1432 | mf->width, mf->height); | 1437 | mf->width, mf->height); |
| 1433 | if (ret < 0) { | 1438 | if (ret < 0) { |
| @@ -1580,8 +1585,9 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, | |||
| 1580 | } | 1585 | } |
| 1581 | 1586 | ||
| 1582 | if (interm_width < icd->user_width || interm_height < icd->user_height) { | 1587 | if (interm_width < icd->user_width || interm_height < icd->user_height) { |
| 1583 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (int)icd, video, | 1588 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
| 1584 | s_mbus_fmt, &mf); | 1589 | soc_camera_grp_id(icd), video, |
| 1590 | s_mbus_fmt, &mf); | ||
| 1585 | if (ret < 0) | 1591 | if (ret < 0) |
| 1586 | return ret; | 1592 | return ret; |
| 1587 | 1593 | ||
| @@ -1867,7 +1873,8 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
| 1867 | mf.code = xlate->code; | 1873 | mf.code = xlate->code; |
| 1868 | mf.colorspace = pix->colorspace; | 1874 | mf.colorspace = pix->colorspace; |
| 1869 | 1875 | ||
| 1870 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, try_mbus_fmt, &mf); | 1876 | ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd), |
| 1877 | video, try_mbus_fmt, &mf); | ||
| 1871 | if (ret < 0) | 1878 | if (ret < 0) |
| 1872 | return ret; | 1879 | return ret; |
| 1873 | 1880 | ||
| @@ -1891,8 +1898,9 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
| 1891 | */ | 1898 | */ |
| 1892 | mf.width = 2560; | 1899 | mf.width = 2560; |
| 1893 | mf.height = 1920; | 1900 | mf.height = 1920; |
| 1894 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, | 1901 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
| 1895 | try_mbus_fmt, &mf); | 1902 | soc_camera_grp_id(icd), video, |
| 1903 | try_mbus_fmt, &mf); | ||
| 1896 | if (ret < 0) { | 1904 | if (ret < 0) { |
| 1897 | /* Shouldn't actually happen... */ | 1905 | /* Shouldn't actually happen... */ |
| 1898 | dev_err(icd->parent, | 1906 | dev_err(icd->parent, |
diff --git a/drivers/media/video/sh_mobile_csi2.c b/drivers/media/video/sh_mobile_csi2.c index ea4f0473ed3b..8a652b53ff7e 100644 --- a/drivers/media/video/sh_mobile_csi2.c +++ b/drivers/media/video/sh_mobile_csi2.c | |||
| @@ -143,7 +143,7 @@ static int sh_csi2_s_mbus_config(struct v4l2_subdev *sd, | |||
| 143 | const struct v4l2_mbus_config *cfg) | 143 | const struct v4l2_mbus_config *cfg) |
| 144 | { | 144 | { |
| 145 | struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); | 145 | struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); |
| 146 | struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; | 146 | struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); |
| 147 | struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); | 147 | struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); |
| 148 | struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2, | 148 | struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2, |
| 149 | .flags = priv->mipi_flags}; | 149 | .flags = priv->mipi_flags}; |
| @@ -202,7 +202,7 @@ static void sh_csi2_hwinit(struct sh_csi2 *priv) | |||
| 202 | static int sh_csi2_client_connect(struct sh_csi2 *priv) | 202 | static int sh_csi2_client_connect(struct sh_csi2 *priv) |
| 203 | { | 203 | { |
| 204 | struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; | 204 | struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; |
| 205 | struct soc_camera_device *icd = (struct soc_camera_device *)priv->subdev.grp_id; | 205 | struct soc_camera_device *icd = v4l2_get_subdev_hostdata(&priv->subdev); |
| 206 | struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); | 206 | struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); |
| 207 | struct device *dev = v4l2_get_subdevdata(&priv->subdev); | 207 | struct device *dev = v4l2_get_subdevdata(&priv->subdev); |
| 208 | struct v4l2_mbus_config cfg; | 208 | struct v4l2_mbus_config cfg; |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index b72580c38957..62e4312515cb 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
| @@ -1103,7 +1103,8 @@ static int soc_camera_probe(struct soc_camera_device *icd) | |||
| 1103 | } | 1103 | } |
| 1104 | 1104 | ||
| 1105 | sd = soc_camera_to_subdev(icd); | 1105 | sd = soc_camera_to_subdev(icd); |
| 1106 | sd->grp_id = (long)icd; | 1106 | sd->grp_id = soc_camera_grp_id(icd); |
| 1107 | v4l2_set_subdev_hostdata(sd, icd); | ||
| 1107 | 1108 | ||
| 1108 | if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler)) | 1109 | if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler)) |
| 1109 | goto ectrl; | 1110 | goto ectrl; |
diff --git a/drivers/mfd/ab5500-debugfs.c b/drivers/mfd/ab5500-debugfs.c index 43c0ebb81956..b7b2d3483fd4 100644 --- a/drivers/mfd/ab5500-debugfs.c +++ b/drivers/mfd/ab5500-debugfs.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Debugfs support for the AB5500 MFD driver | 4 | * Debugfs support for the AB5500 MFD driver |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <linux/export.h> | 7 | #include <linux/module.h> |
| 8 | #include <linux/debugfs.h> | 8 | #include <linux/debugfs.h> |
| 9 | #include <linux/seq_file.h> | 9 | #include <linux/seq_file.h> |
| 10 | #include <linux/mfd/ab5500/ab5500.h> | 10 | #include <linux/mfd/ab5500/ab5500.h> |
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 1e9173804ede..d3d572b2317b 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
| @@ -620,6 +620,7 @@ static struct resource __devinitdata ab8500_fg_resources[] = { | |||
| 620 | 620 | ||
| 621 | static struct resource __devinitdata ab8500_chargalg_resources[] = {}; | 621 | static struct resource __devinitdata ab8500_chargalg_resources[] = {}; |
| 622 | 622 | ||
| 623 | #ifdef CONFIG_DEBUG_FS | ||
| 623 | static struct resource __devinitdata ab8500_debug_resources[] = { | 624 | static struct resource __devinitdata ab8500_debug_resources[] = { |
| 624 | { | 625 | { |
| 625 | .name = "IRQ_FIRST", | 626 | .name = "IRQ_FIRST", |
| @@ -634,6 +635,7 @@ static struct resource __devinitdata ab8500_debug_resources[] = { | |||
| 634 | .flags = IORESOURCE_IRQ, | 635 | .flags = IORESOURCE_IRQ, |
| 635 | }, | 636 | }, |
| 636 | }; | 637 | }; |
| 638 | #endif | ||
| 637 | 639 | ||
| 638 | static struct resource __devinitdata ab8500_usb_resources[] = { | 640 | static struct resource __devinitdata ab8500_usb_resources[] = { |
| 639 | { | 641 | { |
diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c index f1d88483112c..8d816cce8322 100644 --- a/drivers/mfd/adp5520.c +++ b/drivers/mfd/adp5520.c | |||
| @@ -109,7 +109,7 @@ int adp5520_set_bits(struct device *dev, int reg, uint8_t bit_mask) | |||
| 109 | 109 | ||
| 110 | ret = __adp5520_read(chip->client, reg, ®_val); | 110 | ret = __adp5520_read(chip->client, reg, ®_val); |
| 111 | 111 | ||
| 112 | if (!ret && ((reg_val & bit_mask) == 0)) { | 112 | if (!ret && ((reg_val & bit_mask) != bit_mask)) { |
| 113 | reg_val |= bit_mask; | 113 | reg_val |= bit_mask; |
| 114 | ret = __adp5520_write(chip->client, reg, reg_val); | 114 | ret = __adp5520_write(chip->client, reg, reg_val); |
| 115 | } | 115 | } |
diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c index 1b79c37fd599..1924b857a0fb 100644 --- a/drivers/mfd/da903x.c +++ b/drivers/mfd/da903x.c | |||
| @@ -182,7 +182,7 @@ int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask) | |||
| 182 | if (ret) | 182 | if (ret) |
| 183 | goto out; | 183 | goto out; |
| 184 | 184 | ||
| 185 | if ((reg_val & bit_mask) == 0) { | 185 | if ((reg_val & bit_mask) != bit_mask) { |
| 186 | reg_val |= bit_mask; | 186 | reg_val |= bit_mask; |
| 187 | ret = __da903x_write(chip->client, reg, reg_val); | 187 | ret = __da903x_write(chip->client, reg, reg_val); |
| 188 | } | 188 | } |
| @@ -549,6 +549,7 @@ static int __devexit da903x_remove(struct i2c_client *client) | |||
| 549 | struct da903x_chip *chip = i2c_get_clientdata(client); | 549 | struct da903x_chip *chip = i2c_get_clientdata(client); |
| 550 | 550 | ||
| 551 | da903x_remove_subdevs(chip); | 551 | da903x_remove_subdevs(chip); |
| 552 | free_irq(client->irq, chip); | ||
| 552 | kfree(chip); | 553 | kfree(chip); |
| 553 | return 0; | 554 | return 0; |
| 554 | } | 555 | } |
diff --git a/drivers/mfd/jz4740-adc.c b/drivers/mfd/jz4740-adc.c index 1e9ee533eacb..ef39528088f2 100644 --- a/drivers/mfd/jz4740-adc.c +++ b/drivers/mfd/jz4740-adc.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
| 19 | #include <linux/io.h> | ||
| 19 | #include <linux/irq.h> | 20 | #include <linux/irq.h> |
| 20 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
| 21 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index bba26d96c240..a5ddf31b60ca 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c | |||
| @@ -197,7 +197,7 @@ int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask) | |||
| 197 | if (ret) | 197 | if (ret) |
| 198 | goto out; | 198 | goto out; |
| 199 | 199 | ||
| 200 | if ((reg_val & bit_mask) == 0) { | 200 | if ((reg_val & bit_mask) != bit_mask) { |
| 201 | reg_val |= bit_mask; | 201 | reg_val |= bit_mask; |
| 202 | ret = __tps6586x_write(to_i2c_client(dev), reg, reg_val); | 202 | ret = __tps6586x_write(to_i2c_client(dev), reg, reg_val); |
| 203 | } | 203 | } |
diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index 6f5b8cf2f652..c1da84bc1573 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c | |||
| @@ -120,7 +120,7 @@ int tps65910_clear_bits(struct tps65910 *tps65910, u8 reg, u8 mask) | |||
| 120 | goto out; | 120 | goto out; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | data &= mask; | 123 | data &= ~mask; |
| 124 | err = tps65910_i2c_write(tps65910, reg, 1, &data); | 124 | err = tps65910_i2c_write(tps65910, reg, 1, &data); |
| 125 | if (err) | 125 | if (err) |
| 126 | dev_err(tps65910->dev, "write to reg %x failed\n", reg); | 126 | dev_err(tps65910->dev, "write to reg %x failed\n", reg); |
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index bfbd66021afd..61e70cfaa774 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
| @@ -363,13 +363,13 @@ int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) | |||
| 363 | pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); | 363 | pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); |
| 364 | return -EPERM; | 364 | return -EPERM; |
| 365 | } | 365 | } |
| 366 | sid = twl_map[mod_no].sid; | ||
| 367 | twl = &twl_modules[sid]; | ||
| 368 | |||
| 369 | if (unlikely(!inuse)) { | 366 | if (unlikely(!inuse)) { |
| 370 | pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid); | 367 | pr_err("%s: not initialized\n", DRIVER_NAME); |
| 371 | return -EPERM; | 368 | return -EPERM; |
| 372 | } | 369 | } |
| 370 | sid = twl_map[mod_no].sid; | ||
| 371 | twl = &twl_modules[sid]; | ||
| 372 | |||
| 373 | mutex_lock(&twl->xfer_lock); | 373 | mutex_lock(&twl->xfer_lock); |
| 374 | /* | 374 | /* |
| 375 | * [MSG1]: fill the register address data | 375 | * [MSG1]: fill the register address data |
| @@ -420,13 +420,13 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) | |||
| 420 | pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); | 420 | pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); |
| 421 | return -EPERM; | 421 | return -EPERM; |
| 422 | } | 422 | } |
| 423 | sid = twl_map[mod_no].sid; | ||
| 424 | twl = &twl_modules[sid]; | ||
| 425 | |||
| 426 | if (unlikely(!inuse)) { | 423 | if (unlikely(!inuse)) { |
| 427 | pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid); | 424 | pr_err("%s: not initialized\n", DRIVER_NAME); |
| 428 | return -EPERM; | 425 | return -EPERM; |
| 429 | } | 426 | } |
| 427 | sid = twl_map[mod_no].sid; | ||
| 428 | twl = &twl_modules[sid]; | ||
| 429 | |||
| 430 | mutex_lock(&twl->xfer_lock); | 430 | mutex_lock(&twl->xfer_lock); |
| 431 | /* [MSG1] fill the register address data */ | 431 | /* [MSG1] fill the register address data */ |
| 432 | msg = &twl->xfer_msg[0]; | 432 | msg = &twl->xfer_msg[0]; |
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c index f062c8cc6c38..29f11e0765fe 100644 --- a/drivers/mfd/twl4030-irq.c +++ b/drivers/mfd/twl4030-irq.c | |||
| @@ -432,6 +432,7 @@ struct sih_agent { | |||
| 432 | u32 edge_change; | 432 | u32 edge_change; |
| 433 | 433 | ||
| 434 | struct mutex irq_lock; | 434 | struct mutex irq_lock; |
| 435 | char *irq_name; | ||
| 435 | }; | 436 | }; |
| 436 | 437 | ||
| 437 | /*----------------------------------------------------------------------*/ | 438 | /*----------------------------------------------------------------------*/ |
| @@ -589,7 +590,7 @@ static inline int sih_read_isr(const struct sih *sih) | |||
| 589 | * Generic handler for SIH interrupts ... we "know" this is called | 590 | * Generic handler for SIH interrupts ... we "know" this is called |
| 590 | * in task context, with IRQs enabled. | 591 | * in task context, with IRQs enabled. |
| 591 | */ | 592 | */ |
| 592 | static void handle_twl4030_sih(unsigned irq, struct irq_desc *desc) | 593 | static irqreturn_t handle_twl4030_sih(int irq, void *data) |
| 593 | { | 594 | { |
| 594 | struct sih_agent *agent = irq_get_handler_data(irq); | 595 | struct sih_agent *agent = irq_get_handler_data(irq); |
| 595 | const struct sih *sih = agent->sih; | 596 | const struct sih *sih = agent->sih; |
| @@ -602,7 +603,7 @@ static void handle_twl4030_sih(unsigned irq, struct irq_desc *desc) | |||
| 602 | pr_err("twl4030: %s SIH, read ISR error %d\n", | 603 | pr_err("twl4030: %s SIH, read ISR error %d\n", |
| 603 | sih->name, isr); | 604 | sih->name, isr); |
| 604 | /* REVISIT: recover; eventually mask it all, etc */ | 605 | /* REVISIT: recover; eventually mask it all, etc */ |
| 605 | return; | 606 | return IRQ_HANDLED; |
| 606 | } | 607 | } |
| 607 | 608 | ||
| 608 | while (isr) { | 609 | while (isr) { |
| @@ -616,6 +617,7 @@ static void handle_twl4030_sih(unsigned irq, struct irq_desc *desc) | |||
| 616 | pr_err("twl4030: %s SIH, invalid ISR bit %d\n", | 617 | pr_err("twl4030: %s SIH, invalid ISR bit %d\n", |
| 617 | sih->name, irq); | 618 | sih->name, irq); |
| 618 | } | 619 | } |
| 620 | return IRQ_HANDLED; | ||
| 619 | } | 621 | } |
| 620 | 622 | ||
| 621 | static unsigned twl4030_irq_next; | 623 | static unsigned twl4030_irq_next; |
| @@ -668,18 +670,19 @@ int twl4030_sih_setup(int module) | |||
| 668 | activate_irq(irq); | 670 | activate_irq(irq); |
| 669 | } | 671 | } |
| 670 | 672 | ||
| 671 | status = irq_base; | ||
| 672 | twl4030_irq_next += i; | 673 | twl4030_irq_next += i; |
| 673 | 674 | ||
| 674 | /* replace generic PIH handler (handle_simple_irq) */ | 675 | /* replace generic PIH handler (handle_simple_irq) */ |
| 675 | irq = sih_mod + twl4030_irq_base; | 676 | irq = sih_mod + twl4030_irq_base; |
| 676 | irq_set_handler_data(irq, agent); | 677 | irq_set_handler_data(irq, agent); |
| 677 | irq_set_chained_handler(irq, handle_twl4030_sih); | 678 | agent->irq_name = kasprintf(GFP_KERNEL, "twl4030_%s", sih->name); |
| 679 | status = request_threaded_irq(irq, NULL, handle_twl4030_sih, 0, | ||
| 680 | agent->irq_name ?: sih->name, NULL); | ||
| 678 | 681 | ||
| 679 | pr_info("twl4030: %s (irq %d) chaining IRQs %d..%d\n", sih->name, | 682 | pr_info("twl4030: %s (irq %d) chaining IRQs %d..%d\n", sih->name, |
| 680 | irq, irq_base, twl4030_irq_next - 1); | 683 | irq, irq_base, twl4030_irq_next - 1); |
| 681 | 684 | ||
| 682 | return status; | 685 | return status < 0 ? status : irq_base; |
| 683 | } | 686 | } |
| 684 | 687 | ||
| 685 | /* FIXME need a call to reverse twl4030_sih_setup() ... */ | 688 | /* FIXME need a call to reverse twl4030_sih_setup() ... */ |
| @@ -733,8 +736,9 @@ int twl4030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end) | |||
| 733 | } | 736 | } |
| 734 | 737 | ||
| 735 | /* install an irq handler to demultiplex the TWL4030 interrupt */ | 738 | /* install an irq handler to demultiplex the TWL4030 interrupt */ |
| 736 | status = request_threaded_irq(irq_num, NULL, handle_twl4030_pih, 0, | 739 | status = request_threaded_irq(irq_num, NULL, handle_twl4030_pih, |
| 737 | "TWL4030-PIH", NULL); | 740 | IRQF_ONESHOT, |
| 741 | "TWL4030-PIH", NULL); | ||
| 738 | if (status < 0) { | 742 | if (status < 0) { |
| 739 | pr_err("twl4030: could not claim irq%d: %d\n", irq_num, status); | 743 | pr_err("twl4030: could not claim irq%d: %d\n", irq_num, status); |
| 740 | goto fail_rqirq; | 744 | goto fail_rqirq; |
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 5d6ba132837e..61894fced8ea 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
| @@ -239,6 +239,7 @@ static int wm8994_suspend(struct device *dev) | |||
| 239 | 239 | ||
| 240 | switch (wm8994->type) { | 240 | switch (wm8994->type) { |
| 241 | case WM8958: | 241 | case WM8958: |
| 242 | case WM1811: | ||
| 242 | ret = wm8994_reg_read(wm8994, WM8958_MIC_DETECT_1); | 243 | ret = wm8994_reg_read(wm8994, WM8958_MIC_DETECT_1); |
| 243 | if (ret < 0) { | 244 | if (ret < 0) { |
| 244 | dev_err(dev, "Failed to read power status: %d\n", ret); | 245 | dev_err(dev, "Failed to read power status: %d\n", ret); |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index a1cb21f95302..1e0e27cbe987 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
| @@ -1606,6 +1606,14 @@ static const struct mmc_fixup blk_fixups[] = | |||
| 1606 | MMC_QUIRK_BLK_NO_CMD23), | 1606 | MMC_QUIRK_BLK_NO_CMD23), |
| 1607 | MMC_FIXUP("MMC32G", 0x11, CID_OEMID_ANY, add_quirk_mmc, | 1607 | MMC_FIXUP("MMC32G", 0x11, CID_OEMID_ANY, add_quirk_mmc, |
| 1608 | MMC_QUIRK_BLK_NO_CMD23), | 1608 | MMC_QUIRK_BLK_NO_CMD23), |
| 1609 | |||
| 1610 | /* | ||
| 1611 | * Some Micron MMC cards needs longer data read timeout than | ||
| 1612 | * indicated in CSD. | ||
| 1613 | */ | ||
| 1614 | MMC_FIXUP(CID_NAME_ANY, 0x13, 0x200, add_quirk_mmc, | ||
| 1615 | MMC_QUIRK_LONG_READ_TIME), | ||
| 1616 | |||
| 1609 | END_FIXUP | 1617 | END_FIXUP |
| 1610 | }; | 1618 | }; |
| 1611 | 1619 | ||
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 5278ffb20e74..950b97d7412a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
| @@ -529,6 +529,18 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) | |||
| 529 | data->timeout_clks = 0; | 529 | data->timeout_clks = 0; |
| 530 | } | 530 | } |
| 531 | } | 531 | } |
| 532 | |||
| 533 | /* | ||
| 534 | * Some cards require longer data read timeout than indicated in CSD. | ||
| 535 | * Address this by setting the read timeout to a "reasonably high" | ||
| 536 | * value. For the cards tested, 300ms has proven enough. If necessary, | ||
| 537 | * this value can be increased if other problematic cards require this. | ||
| 538 | */ | ||
| 539 | if (mmc_card_long_read_time(card) && data->flags & MMC_DATA_READ) { | ||
| 540 | data->timeout_ns = 300000000; | ||
| 541 | data->timeout_clks = 0; | ||
| 542 | } | ||
| 543 | |||
| 532 | /* | 544 | /* |
| 533 | * Some cards need very high timeouts if driven in SPI mode. | 545 | * Some cards need very high timeouts if driven in SPI mode. |
| 534 | * The worst observed timeout was 900ms after writing a | 546 | * The worst observed timeout was 900ms after writing a |
| @@ -1213,6 +1225,46 @@ void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type) | |||
| 1213 | mmc_host_clk_release(host); | 1225 | mmc_host_clk_release(host); |
| 1214 | } | 1226 | } |
| 1215 | 1227 | ||
| 1228 | static void mmc_poweroff_notify(struct mmc_host *host) | ||
| 1229 | { | ||
| 1230 | struct mmc_card *card; | ||
| 1231 | unsigned int timeout; | ||
| 1232 | unsigned int notify_type = EXT_CSD_NO_POWER_NOTIFICATION; | ||
| 1233 | int err = 0; | ||
| 1234 | |||
| 1235 | card = host->card; | ||
| 1236 | |||
| 1237 | /* | ||
| 1238 | * Send power notify command only if card | ||
| 1239 | * is mmc and notify state is powered ON | ||
| 1240 | */ | ||
| 1241 | if (card && mmc_card_mmc(card) && | ||
| 1242 | (card->poweroff_notify_state == MMC_POWERED_ON)) { | ||
| 1243 | |||
| 1244 | if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { | ||
| 1245 | notify_type = EXT_CSD_POWER_OFF_SHORT; | ||
| 1246 | timeout = card->ext_csd.generic_cmd6_time; | ||
| 1247 | card->poweroff_notify_state = MMC_POWEROFF_SHORT; | ||
| 1248 | } else { | ||
| 1249 | notify_type = EXT_CSD_POWER_OFF_LONG; | ||
| 1250 | timeout = card->ext_csd.power_off_longtime; | ||
| 1251 | card->poweroff_notify_state = MMC_POWEROFF_LONG; | ||
| 1252 | } | ||
| 1253 | |||
| 1254 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
| 1255 | EXT_CSD_POWER_OFF_NOTIFICATION, | ||
| 1256 | notify_type, timeout); | ||
| 1257 | |||
| 1258 | if (err && err != -EBADMSG) | ||
| 1259 | pr_err("Device failed to respond within %d poweroff " | ||
| 1260 | "time. Forcefully powering down the device\n", | ||
| 1261 | timeout); | ||
| 1262 | |||
| 1263 | /* Set the card state to no notification after the poweroff */ | ||
| 1264 | card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; | ||
| 1265 | } | ||
| 1266 | } | ||
| 1267 | |||
| 1216 | /* | 1268 | /* |
| 1217 | * Apply power to the MMC stack. This is a two-stage process. | 1269 | * Apply power to the MMC stack. This is a two-stage process. |
| 1218 | * First, we enable power to the card without the clock running. | 1270 | * First, we enable power to the card without the clock running. |
| @@ -1269,42 +1321,12 @@ static void mmc_power_up(struct mmc_host *host) | |||
| 1269 | 1321 | ||
| 1270 | void mmc_power_off(struct mmc_host *host) | 1322 | void mmc_power_off(struct mmc_host *host) |
| 1271 | { | 1323 | { |
| 1272 | struct mmc_card *card; | ||
| 1273 | unsigned int notify_type; | ||
| 1274 | unsigned int timeout; | ||
| 1275 | int err; | ||
| 1276 | |||
| 1277 | mmc_host_clk_hold(host); | 1324 | mmc_host_clk_hold(host); |
| 1278 | 1325 | ||
| 1279 | card = host->card; | ||
| 1280 | host->ios.clock = 0; | 1326 | host->ios.clock = 0; |
| 1281 | host->ios.vdd = 0; | 1327 | host->ios.vdd = 0; |
| 1282 | 1328 | ||
| 1283 | if (card && mmc_card_mmc(card) && | 1329 | mmc_poweroff_notify(host); |
| 1284 | (card->poweroff_notify_state == MMC_POWERED_ON)) { | ||
| 1285 | |||
| 1286 | if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { | ||
| 1287 | notify_type = EXT_CSD_POWER_OFF_SHORT; | ||
| 1288 | timeout = card->ext_csd.generic_cmd6_time; | ||
| 1289 | card->poweroff_notify_state = MMC_POWEROFF_SHORT; | ||
| 1290 | } else { | ||
| 1291 | notify_type = EXT_CSD_POWER_OFF_LONG; | ||
| 1292 | timeout = card->ext_csd.power_off_longtime; | ||
| 1293 | card->poweroff_notify_state = MMC_POWEROFF_LONG; | ||
| 1294 | } | ||
| 1295 | |||
| 1296 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
| 1297 | EXT_CSD_POWER_OFF_NOTIFICATION, | ||
| 1298 | notify_type, timeout); | ||
| 1299 | |||
| 1300 | if (err && err != -EBADMSG) | ||
| 1301 | pr_err("Device failed to respond within %d poweroff " | ||
| 1302 | "time. Forcefully powering down the device\n", | ||
| 1303 | timeout); | ||
| 1304 | |||
| 1305 | /* Set the card state to no notification after the poweroff */ | ||
| 1306 | card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; | ||
| 1307 | } | ||
| 1308 | 1330 | ||
| 1309 | /* | 1331 | /* |
| 1310 | * Reset ocr mask to be the highest possible voltage supported for | 1332 | * Reset ocr mask to be the highest possible voltage supported for |
| @@ -2196,7 +2218,7 @@ int mmc_card_sleep(struct mmc_host *host) | |||
| 2196 | 2218 | ||
| 2197 | mmc_bus_get(host); | 2219 | mmc_bus_get(host); |
| 2198 | 2220 | ||
| 2199 | if (host->bus_ops && !host->bus_dead && host->bus_ops->awake) | 2221 | if (host->bus_ops && !host->bus_dead && host->bus_ops->sleep) |
| 2200 | err = host->bus_ops->sleep(host); | 2222 | err = host->bus_ops->sleep(host); |
| 2201 | 2223 | ||
| 2202 | mmc_bus_put(host); | 2224 | mmc_bus_put(host); |
| @@ -2302,8 +2324,17 @@ int mmc_suspend_host(struct mmc_host *host) | |||
| 2302 | * pre-claim the host. | 2324 | * pre-claim the host. |
| 2303 | */ | 2325 | */ |
| 2304 | if (mmc_try_claim_host(host)) { | 2326 | if (mmc_try_claim_host(host)) { |
| 2305 | if (host->bus_ops->suspend) | 2327 | if (host->bus_ops->suspend) { |
| 2328 | /* | ||
| 2329 | * For eMMC 4.5 device send notify command | ||
| 2330 | * before sleep, because in sleep state eMMC 4.5 | ||
| 2331 | * devices respond to only RESET and AWAKE cmd | ||
| 2332 | */ | ||
| 2333 | mmc_poweroff_notify(host); | ||
| 2306 | err = host->bus_ops->suspend(host); | 2334 | err = host->bus_ops->suspend(host); |
| 2335 | } | ||
| 2336 | mmc_do_release_host(host); | ||
| 2337 | |||
| 2307 | if (err == -ENOSYS || !host->bus_ops->resume) { | 2338 | if (err == -ENOSYS || !host->bus_ops->resume) { |
| 2308 | /* | 2339 | /* |
| 2309 | * We simply "remove" the card in this case. | 2340 | * We simply "remove" the card in this case. |
| @@ -2318,7 +2349,6 @@ int mmc_suspend_host(struct mmc_host *host) | |||
| 2318 | host->pm_flags = 0; | 2349 | host->pm_flags = 0; |
| 2319 | err = 0; | 2350 | err = 0; |
| 2320 | } | 2351 | } |
| 2321 | mmc_do_release_host(host); | ||
| 2322 | } else { | 2352 | } else { |
| 2323 | err = -EBUSY; | 2353 | err = -EBUSY; |
| 2324 | } | 2354 | } |
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index e8a5eb38748b..d31c78b72b0f 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
| @@ -302,17 +302,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) | |||
| 302 | host->max_blk_size = 512; | 302 | host->max_blk_size = 512; |
| 303 | host->max_blk_count = PAGE_CACHE_SIZE / 512; | 303 | host->max_blk_count = PAGE_CACHE_SIZE / 512; |
| 304 | 304 | ||
| 305 | /* | ||
| 306 | * Enable runtime power management by default. This flag was added due | ||
| 307 | * to runtime power management causing disruption for some users, but | ||
| 308 | * the power on/off code has been improved since then. | ||
| 309 | * | ||
| 310 | * We'll enable this flag by default as an experiment, and if no | ||
| 311 | * problems are reported, we will follow up later and remove the flag | ||
| 312 | * altogether. | ||
| 313 | */ | ||
| 314 | host->caps = MMC_CAP_POWER_OFF_CARD; | ||
| 315 | |||
| 316 | return host; | 305 | return host; |
| 317 | 306 | ||
| 318 | free: | 307 | free: |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index dbf421a6279c..d240427c1246 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
| @@ -876,17 +876,21 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
| 876 | * set the notification byte in the ext_csd register of device | 876 | * set the notification byte in the ext_csd register of device |
| 877 | */ | 877 | */ |
| 878 | if ((host->caps2 & MMC_CAP2_POWEROFF_NOTIFY) && | 878 | if ((host->caps2 & MMC_CAP2_POWEROFF_NOTIFY) && |
| 879 | (card->poweroff_notify_state == MMC_NO_POWER_NOTIFICATION)) { | 879 | (card->ext_csd.rev >= 6)) { |
| 880 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 880 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
| 881 | EXT_CSD_POWER_OFF_NOTIFICATION, | 881 | EXT_CSD_POWER_OFF_NOTIFICATION, |
| 882 | EXT_CSD_POWER_ON, | 882 | EXT_CSD_POWER_ON, |
| 883 | card->ext_csd.generic_cmd6_time); | 883 | card->ext_csd.generic_cmd6_time); |
| 884 | if (err && err != -EBADMSG) | 884 | if (err && err != -EBADMSG) |
| 885 | goto free_card; | 885 | goto free_card; |
| 886 | } | ||
| 887 | 886 | ||
| 888 | if (!err) | 887 | /* |
| 889 | card->poweroff_notify_state = MMC_POWERED_ON; | 888 | * The err can be -EBADMSG or 0, |
| 889 | * so check for success and update the flag | ||
| 890 | */ | ||
| 891 | if (!err) | ||
| 892 | card->poweroff_notify_state = MMC_POWERED_ON; | ||
| 893 | } | ||
| 890 | 894 | ||
| 891 | /* | 895 | /* |
| 892 | * Activate high speed (if supported) | 896 | * Activate high speed (if supported) |
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 325ea61e12d3..8e0fbe994047 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c | |||
| @@ -732,6 +732,7 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
| 732 | "failed to config DMA channel. Falling back to PIO\n"); | 732 | "failed to config DMA channel. Falling back to PIO\n"); |
| 733 | dma_release_channel(host->dma); | 733 | dma_release_channel(host->dma); |
| 734 | host->do_dma = 0; | 734 | host->do_dma = 0; |
| 735 | host->dma = NULL; | ||
| 735 | } | 736 | } |
| 736 | } | 737 | } |
| 737 | 738 | ||
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 101cd31c8220..d5fe43d53c51 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
| @@ -1010,6 +1010,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno) | |||
| 1010 | host->data->sg_len, | 1010 | host->data->sg_len, |
| 1011 | omap_hsmmc_get_dma_dir(host, host->data)); | 1011 | omap_hsmmc_get_dma_dir(host, host->data)); |
| 1012 | omap_free_dma(dma_ch); | 1012 | omap_free_dma(dma_ch); |
| 1013 | host->data->host_cookie = 0; | ||
| 1013 | } | 1014 | } |
| 1014 | host->data = NULL; | 1015 | host->data = NULL; |
| 1015 | } | 1016 | } |
| @@ -1575,8 +1576,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq, | |||
| 1575 | struct mmc_data *data = mrq->data; | 1576 | struct mmc_data *data = mrq->data; |
| 1576 | 1577 | ||
| 1577 | if (host->use_dma) { | 1578 | if (host->use_dma) { |
| 1578 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, | 1579 | if (data->host_cookie) |
| 1579 | omap_hsmmc_get_dma_dir(host, data)); | 1580 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, |
| 1581 | data->sg_len, | ||
| 1582 | omap_hsmmc_get_dma_dir(host, data)); | ||
| 1580 | data->host_cookie = 0; | 1583 | data->host_cookie = 0; |
| 1581 | } | 1584 | } |
| 1582 | } | 1585 | } |
diff --git a/drivers/mmc/host/sdhci-cns3xxx.c b/drivers/mmc/host/sdhci-cns3xxx.c index 4b920b7621cf..b4257e700617 100644 --- a/drivers/mmc/host/sdhci-cns3xxx.c +++ b/drivers/mmc/host/sdhci-cns3xxx.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
| 16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
| 17 | #include <linux/mmc/host.h> | 17 | #include <linux/mmc/host.h> |
| 18 | #include <linux/module.h> | ||
| 18 | #include <mach/cns3xxx.h> | 19 | #include <mach/cns3xxx.h> |
| 19 | #include "sdhci-pltfm.h" | 20 | #include "sdhci-pltfm.h" |
| 20 | 21 | ||
| @@ -108,13 +109,10 @@ static struct platform_driver sdhci_cns3xxx_driver = { | |||
| 108 | .driver = { | 109 | .driver = { |
| 109 | .name = "sdhci-cns3xxx", | 110 | .name = "sdhci-cns3xxx", |
| 110 | .owner = THIS_MODULE, | 111 | .owner = THIS_MODULE, |
| 112 | .pm = SDHCI_PLTFM_PMOPS, | ||
| 111 | }, | 113 | }, |
| 112 | .probe = sdhci_cns3xxx_probe, | 114 | .probe = sdhci_cns3xxx_probe, |
| 113 | .remove = __devexit_p(sdhci_cns3xxx_remove), | 115 | .remove = __devexit_p(sdhci_cns3xxx_remove), |
| 114 | #ifdef CONFIG_PM | ||
| 115 | .suspend = sdhci_pltfm_suspend, | ||
| 116 | .resume = sdhci_pltfm_resume, | ||
| 117 | #endif | ||
| 118 | }; | 116 | }; |
| 119 | 117 | ||
| 120 | static int __init sdhci_cns3xxx_init(void) | 118 | static int __init sdhci_cns3xxx_init(void) |
diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c index f2d29dca4420..a81312c91f70 100644 --- a/drivers/mmc/host/sdhci-dove.c +++ b/drivers/mmc/host/sdhci-dove.c | |||
| @@ -82,13 +82,10 @@ static struct platform_driver sdhci_dove_driver = { | |||
| 82 | .driver = { | 82 | .driver = { |
| 83 | .name = "sdhci-dove", | 83 | .name = "sdhci-dove", |
| 84 | .owner = THIS_MODULE, | 84 | .owner = THIS_MODULE, |
| 85 | .pm = SDHCI_PLTFM_PMOPS, | ||
| 85 | }, | 86 | }, |
| 86 | .probe = sdhci_dove_probe, | 87 | .probe = sdhci_dove_probe, |
| 87 | .remove = __devexit_p(sdhci_dove_remove), | 88 | .remove = __devexit_p(sdhci_dove_remove), |
| 88 | #ifdef CONFIG_PM | ||
| 89 | .suspend = sdhci_pltfm_suspend, | ||
| 90 | .resume = sdhci_pltfm_resume, | ||
| 91 | #endif | ||
| 92 | }; | 89 | }; |
| 93 | 90 | ||
| 94 | static int __init sdhci_dove_init(void) | 91 | static int __init sdhci_dove_init(void) |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 4b976f00ea85..38ebc4ea259f 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
| @@ -599,14 +599,11 @@ static struct platform_driver sdhci_esdhc_imx_driver = { | |||
| 599 | .name = "sdhci-esdhc-imx", | 599 | .name = "sdhci-esdhc-imx", |
| 600 | .owner = THIS_MODULE, | 600 | .owner = THIS_MODULE, |
| 601 | .of_match_table = imx_esdhc_dt_ids, | 601 | .of_match_table = imx_esdhc_dt_ids, |
| 602 | .pm = SDHCI_PLTFM_PMOPS, | ||
| 602 | }, | 603 | }, |
| 603 | .id_table = imx_esdhc_devtype, | 604 | .id_table = imx_esdhc_devtype, |
| 604 | .probe = sdhci_esdhc_imx_probe, | 605 | .probe = sdhci_esdhc_imx_probe, |
| 605 | .remove = __devexit_p(sdhci_esdhc_imx_remove), | 606 | .remove = __devexit_p(sdhci_esdhc_imx_remove), |
| 606 | #ifdef CONFIG_PM | ||
| 607 | .suspend = sdhci_pltfm_suspend, | ||
| 608 | .resume = sdhci_pltfm_resume, | ||
| 609 | #endif | ||
| 610 | }; | 607 | }; |
| 611 | 608 | ||
| 612 | static int __init sdhci_esdhc_imx_init(void) | 609 | static int __init sdhci_esdhc_imx_init(void) |
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 59e9d003e589..01e5f627e0f0 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c | |||
| @@ -125,13 +125,10 @@ static struct platform_driver sdhci_esdhc_driver = { | |||
| 125 | .name = "sdhci-esdhc", | 125 | .name = "sdhci-esdhc", |
| 126 | .owner = THIS_MODULE, | 126 | .owner = THIS_MODULE, |
| 127 | .of_match_table = sdhci_esdhc_of_match, | 127 | .of_match_table = sdhci_esdhc_of_match, |
| 128 | .pm = SDHCI_PLTFM_PMOPS, | ||
| 128 | }, | 129 | }, |
| 129 | .probe = sdhci_esdhc_probe, | 130 | .probe = sdhci_esdhc_probe, |
| 130 | .remove = __devexit_p(sdhci_esdhc_remove), | 131 | .remove = __devexit_p(sdhci_esdhc_remove), |
| 131 | #ifdef CONFIG_PM | ||
| 132 | .suspend = sdhci_pltfm_suspend, | ||
| 133 | .resume = sdhci_pltfm_resume, | ||
| 134 | #endif | ||
| 135 | }; | 132 | }; |
| 136 | 133 | ||
| 137 | static int __init sdhci_esdhc_init(void) | 134 | static int __init sdhci_esdhc_init(void) |
diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c index 9b0d794a4f69..3619adc7d9fc 100644 --- a/drivers/mmc/host/sdhci-of-hlwd.c +++ b/drivers/mmc/host/sdhci-of-hlwd.c | |||
| @@ -87,13 +87,10 @@ static struct platform_driver sdhci_hlwd_driver = { | |||
| 87 | .name = "sdhci-hlwd", | 87 | .name = "sdhci-hlwd", |
| 88 | .owner = THIS_MODULE, | 88 | .owner = THIS_MODULE, |
| 89 | .of_match_table = sdhci_hlwd_of_match, | 89 | .of_match_table = sdhci_hlwd_of_match, |
| 90 | .pm = SDHCI_PLTFM_PMOPS, | ||
| 90 | }, | 91 | }, |
| 91 | .probe = sdhci_hlwd_probe, | 92 | .probe = sdhci_hlwd_probe, |
| 92 | .remove = __devexit_p(sdhci_hlwd_remove), | 93 | .remove = __devexit_p(sdhci_hlwd_remove), |
| 93 | #ifdef CONFIG_PM | ||
| 94 | .suspend = sdhci_pltfm_suspend, | ||
| 95 | .resume = sdhci_pltfm_resume, | ||
| 96 | #endif | ||
| 97 | }; | 94 | }; |
| 98 | 95 | ||
| 99 | static int __init sdhci_hlwd_init(void) | 96 | static int __init sdhci_hlwd_init(void) |
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index d833d9c2f7e3..6878a94626bc 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
| @@ -54,8 +54,7 @@ struct sdhci_pci_fixes { | |||
| 54 | int (*probe_slot) (struct sdhci_pci_slot *); | 54 | int (*probe_slot) (struct sdhci_pci_slot *); |
| 55 | void (*remove_slot) (struct sdhci_pci_slot *, int); | 55 | void (*remove_slot) (struct sdhci_pci_slot *, int); |
| 56 | 56 | ||
| 57 | int (*suspend) (struct sdhci_pci_chip *, | 57 | int (*suspend) (struct sdhci_pci_chip *); |
| 58 | pm_message_t); | ||
| 59 | int (*resume) (struct sdhci_pci_chip *); | 58 | int (*resume) (struct sdhci_pci_chip *); |
| 60 | }; | 59 | }; |
| 61 | 60 | ||
| @@ -549,7 +548,7 @@ static void jmicron_remove_slot(struct sdhci_pci_slot *slot, int dead) | |||
| 549 | jmicron_enable_mmc(slot->host, 0); | 548 | jmicron_enable_mmc(slot->host, 0); |
| 550 | } | 549 | } |
| 551 | 550 | ||
| 552 | static int jmicron_suspend(struct sdhci_pci_chip *chip, pm_message_t state) | 551 | static int jmicron_suspend(struct sdhci_pci_chip *chip) |
| 553 | { | 552 | { |
| 554 | int i; | 553 | int i; |
| 555 | 554 | ||
| @@ -993,8 +992,9 @@ static struct sdhci_ops sdhci_pci_ops = { | |||
| 993 | 992 | ||
| 994 | #ifdef CONFIG_PM | 993 | #ifdef CONFIG_PM |
| 995 | 994 | ||
| 996 | static int sdhci_pci_suspend(struct pci_dev *pdev, pm_message_t state) | 995 | static int sdhci_pci_suspend(struct device *dev) |
| 997 | { | 996 | { |
| 997 | struct pci_dev *pdev = to_pci_dev(dev); | ||
| 998 | struct sdhci_pci_chip *chip; | 998 | struct sdhci_pci_chip *chip; |
| 999 | struct sdhci_pci_slot *slot; | 999 | struct sdhci_pci_slot *slot; |
| 1000 | mmc_pm_flag_t slot_pm_flags; | 1000 | mmc_pm_flag_t slot_pm_flags; |
| @@ -1010,7 +1010,7 @@ static int sdhci_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 1010 | if (!slot) | 1010 | if (!slot) |
| 1011 | continue; | 1011 | continue; |
| 1012 | 1012 | ||
| 1013 | ret = sdhci_suspend_host(slot->host, state); | 1013 | ret = sdhci_suspend_host(slot->host); |
| 1014 | 1014 | ||
| 1015 | if (ret) { | 1015 | if (ret) { |
| 1016 | for (i--; i >= 0; i--) | 1016 | for (i--; i >= 0; i--) |
| @@ -1026,7 +1026,7 @@ static int sdhci_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 1026 | } | 1026 | } |
| 1027 | 1027 | ||
| 1028 | if (chip->fixes && chip->fixes->suspend) { | 1028 | if (chip->fixes && chip->fixes->suspend) { |
| 1029 | ret = chip->fixes->suspend(chip, state); | 1029 | ret = chip->fixes->suspend(chip); |
| 1030 | if (ret) { | 1030 | if (ret) { |
| 1031 | for (i = chip->num_slots - 1; i >= 0; i--) | 1031 | for (i = chip->num_slots - 1; i >= 0; i--) |
| 1032 | sdhci_resume_host(chip->slots[i]->host); | 1032 | sdhci_resume_host(chip->slots[i]->host); |
| @@ -1042,16 +1042,17 @@ static int sdhci_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 1042 | } | 1042 | } |
| 1043 | pci_set_power_state(pdev, PCI_D3hot); | 1043 | pci_set_power_state(pdev, PCI_D3hot); |
| 1044 | } else { | 1044 | } else { |
| 1045 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); | 1045 | pci_enable_wake(pdev, PCI_D3hot, 0); |
| 1046 | pci_disable_device(pdev); | 1046 | pci_disable_device(pdev); |
| 1047 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 1047 | pci_set_power_state(pdev, PCI_D3hot); |
| 1048 | } | 1048 | } |
| 1049 | 1049 | ||
| 1050 | return 0; | 1050 | return 0; |
| 1051 | } | 1051 | } |
| 1052 | 1052 | ||
| 1053 | static int sdhci_pci_resume(struct pci_dev *pdev) | 1053 | static int sdhci_pci_resume(struct device *dev) |
| 1054 | { | 1054 | { |
| 1055 | struct pci_dev *pdev = to_pci_dev(dev); | ||
| 1055 | struct sdhci_pci_chip *chip; | 1056 | struct sdhci_pci_chip *chip; |
| 1056 | struct sdhci_pci_slot *slot; | 1057 | struct sdhci_pci_slot *slot; |
| 1057 | int i, ret; | 1058 | int i, ret; |
| @@ -1099,7 +1100,6 @@ static int sdhci_pci_runtime_suspend(struct device *dev) | |||
| 1099 | struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); | 1100 | struct pci_dev *pdev = container_of(dev, struct pci_dev, dev); |
| 1100 | struct sdhci_pci_chip *chip; | 1101 | struct sdhci_pci_chip *chip; |
| 1101 | struct sdhci_pci_slot *slot; | 1102 | struct sdhci_pci_slot *slot; |
| 1102 | pm_message_t state = { .event = PM_EVENT_SUSPEND }; | ||
| 1103 | int i, ret; | 1103 | int i, ret; |
| 1104 | 1104 | ||
| 1105 | chip = pci_get_drvdata(pdev); | 1105 | chip = pci_get_drvdata(pdev); |
| @@ -1121,7 +1121,7 @@ static int sdhci_pci_runtime_suspend(struct device *dev) | |||
| 1121 | } | 1121 | } |
| 1122 | 1122 | ||
| 1123 | if (chip->fixes && chip->fixes->suspend) { | 1123 | if (chip->fixes && chip->fixes->suspend) { |
| 1124 | ret = chip->fixes->suspend(chip, state); | 1124 | ret = chip->fixes->suspend(chip); |
| 1125 | if (ret) { | 1125 | if (ret) { |
| 1126 | for (i = chip->num_slots - 1; i >= 0; i--) | 1126 | for (i = chip->num_slots - 1; i >= 0; i--) |
| 1127 | sdhci_runtime_resume_host(chip->slots[i]->host); | 1127 | sdhci_runtime_resume_host(chip->slots[i]->host); |
| @@ -1176,6 +1176,8 @@ static int sdhci_pci_runtime_idle(struct device *dev) | |||
| 1176 | #endif | 1176 | #endif |
| 1177 | 1177 | ||
| 1178 | static const struct dev_pm_ops sdhci_pci_pm_ops = { | 1178 | static const struct dev_pm_ops sdhci_pci_pm_ops = { |
| 1179 | .suspend = sdhci_pci_suspend, | ||
| 1180 | .resume = sdhci_pci_resume, | ||
| 1179 | .runtime_suspend = sdhci_pci_runtime_suspend, | 1181 | .runtime_suspend = sdhci_pci_runtime_suspend, |
| 1180 | .runtime_resume = sdhci_pci_runtime_resume, | 1182 | .runtime_resume = sdhci_pci_runtime_resume, |
| 1181 | .runtime_idle = sdhci_pci_runtime_idle, | 1183 | .runtime_idle = sdhci_pci_runtime_idle, |
| @@ -1428,8 +1430,6 @@ static struct pci_driver sdhci_driver = { | |||
| 1428 | .id_table = pci_ids, | 1430 | .id_table = pci_ids, |
| 1429 | .probe = sdhci_pci_probe, | 1431 | .probe = sdhci_pci_probe, |
| 1430 | .remove = __devexit_p(sdhci_pci_remove), | 1432 | .remove = __devexit_p(sdhci_pci_remove), |
| 1431 | .suspend = sdhci_pci_suspend, | ||
| 1432 | .resume = sdhci_pci_resume, | ||
| 1433 | .driver = { | 1433 | .driver = { |
| 1434 | .pm = &sdhci_pci_pm_ops | 1434 | .pm = &sdhci_pci_pm_ops |
| 1435 | }, | 1435 | }, |
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index a9e12ea05583..03970bcb3495 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c | |||
| @@ -194,21 +194,25 @@ int sdhci_pltfm_unregister(struct platform_device *pdev) | |||
| 194 | EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister); | 194 | EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister); |
| 195 | 195 | ||
| 196 | #ifdef CONFIG_PM | 196 | #ifdef CONFIG_PM |
| 197 | int sdhci_pltfm_suspend(struct platform_device *dev, pm_message_t state) | 197 | static int sdhci_pltfm_suspend(struct device *dev) |
| 198 | { | 198 | { |
| 199 | struct sdhci_host *host = platform_get_drvdata(dev); | 199 | struct sdhci_host *host = dev_get_drvdata(dev); |
| 200 | 200 | ||
| 201 | return sdhci_suspend_host(host, state); | 201 | return sdhci_suspend_host(host); |
| 202 | } | 202 | } |
| 203 | EXPORT_SYMBOL_GPL(sdhci_pltfm_suspend); | ||
| 204 | 203 | ||
| 205 | int sdhci_pltfm_resume(struct platform_device *dev) | 204 | static int sdhci_pltfm_resume(struct device *dev) |
| 206 | { | 205 | { |
| 207 | struct sdhci_host *host = platform_get_drvdata(dev); | 206 | struct sdhci_host *host = dev_get_drvdata(dev); |
| 208 | 207 | ||
| 209 | return sdhci_resume_host(host); | 208 | return sdhci_resume_host(host); |
| 210 | } | 209 | } |
| 211 | EXPORT_SYMBOL_GPL(sdhci_pltfm_resume); | 210 | |
| 211 | const struct dev_pm_ops sdhci_pltfm_pmops = { | ||
| 212 | .suspend = sdhci_pltfm_suspend, | ||
| 213 | .resume = sdhci_pltfm_resume, | ||
| 214 | }; | ||
| 215 | EXPORT_SYMBOL_GPL(sdhci_pltfm_pmops); | ||
| 212 | #endif /* CONFIG_PM */ | 216 | #endif /* CONFIG_PM */ |
| 213 | 217 | ||
| 214 | static int __init sdhci_pltfm_drv_init(void) | 218 | static int __init sdhci_pltfm_drv_init(void) |
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h index 3a9fc3f40840..37e0e184a0bb 100644 --- a/drivers/mmc/host/sdhci-pltfm.h +++ b/drivers/mmc/host/sdhci-pltfm.h | |||
| @@ -99,8 +99,10 @@ extern int sdhci_pltfm_register(struct platform_device *pdev, | |||
| 99 | extern int sdhci_pltfm_unregister(struct platform_device *pdev); | 99 | extern int sdhci_pltfm_unregister(struct platform_device *pdev); |
| 100 | 100 | ||
| 101 | #ifdef CONFIG_PM | 101 | #ifdef CONFIG_PM |
| 102 | extern int sdhci_pltfm_suspend(struct platform_device *dev, pm_message_t state); | 102 | extern const struct dev_pm_ops sdhci_pltfm_pmops; |
| 103 | extern int sdhci_pltfm_resume(struct platform_device *dev); | 103 | #define SDHCI_PLTFM_PMOPS (&sdhci_pltfm_pmops) |
| 104 | #else | ||
| 105 | #define SDHCI_PLTFM_PMOPS NULL | ||
| 104 | #endif | 106 | #endif |
| 105 | 107 | ||
| 106 | #endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */ | 108 | #endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */ |
diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c index d4bf6d30c7ba..7a039c3cb1f1 100644 --- a/drivers/mmc/host/sdhci-pxav2.c +++ b/drivers/mmc/host/sdhci-pxav2.c | |||
| @@ -218,13 +218,10 @@ static struct platform_driver sdhci_pxav2_driver = { | |||
| 218 | .driver = { | 218 | .driver = { |
| 219 | .name = "sdhci-pxav2", | 219 | .name = "sdhci-pxav2", |
| 220 | .owner = THIS_MODULE, | 220 | .owner = THIS_MODULE, |
| 221 | .pm = SDHCI_PLTFM_PMOPS, | ||
| 221 | }, | 222 | }, |
| 222 | .probe = sdhci_pxav2_probe, | 223 | .probe = sdhci_pxav2_probe, |
| 223 | .remove = __devexit_p(sdhci_pxav2_remove), | 224 | .remove = __devexit_p(sdhci_pxav2_remove), |
| 224 | #ifdef CONFIG_PM | ||
| 225 | .suspend = sdhci_pltfm_suspend, | ||
| 226 | .resume = sdhci_pltfm_resume, | ||
| 227 | #endif | ||
| 228 | }; | 225 | }; |
| 229 | static int __init sdhci_pxav2_init(void) | 226 | static int __init sdhci_pxav2_init(void) |
| 230 | { | 227 | { |
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index cff4ad3e7a59..15673a7ee6a5 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c | |||
| @@ -264,13 +264,10 @@ static struct platform_driver sdhci_pxav3_driver = { | |||
| 264 | .driver = { | 264 | .driver = { |
| 265 | .name = "sdhci-pxav3", | 265 | .name = "sdhci-pxav3", |
| 266 | .owner = THIS_MODULE, | 266 | .owner = THIS_MODULE, |
| 267 | .pm = SDHCI_PLTFM_PMOPS, | ||
| 267 | }, | 268 | }, |
| 268 | .probe = sdhci_pxav3_probe, | 269 | .probe = sdhci_pxav3_probe, |
| 269 | .remove = __devexit_p(sdhci_pxav3_remove), | 270 | .remove = __devexit_p(sdhci_pxav3_remove), |
| 270 | #ifdef CONFIG_PM | ||
| 271 | .suspend = sdhci_pltfm_suspend, | ||
| 272 | .resume = sdhci_pltfm_resume, | ||
| 273 | #endif | ||
| 274 | }; | 271 | }; |
| 275 | static int __init sdhci_pxav3_init(void) | 272 | static int __init sdhci_pxav3_init(void) |
| 276 | { | 273 | { |
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 3d00e722efc9..0d33ff0d67fb 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
| @@ -622,33 +622,38 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) | |||
| 622 | 622 | ||
| 623 | #ifdef CONFIG_PM | 623 | #ifdef CONFIG_PM |
| 624 | 624 | ||
| 625 | static int sdhci_s3c_suspend(struct platform_device *dev, pm_message_t pm) | 625 | static int sdhci_s3c_suspend(struct device *dev) |
| 626 | { | 626 | { |
| 627 | struct sdhci_host *host = platform_get_drvdata(dev); | 627 | struct sdhci_host *host = dev_get_drvdata(dev); |
| 628 | 628 | ||
| 629 | return sdhci_suspend_host(host, pm); | 629 | return sdhci_suspend_host(host); |
| 630 | } | 630 | } |
| 631 | 631 | ||
| 632 | static int sdhci_s3c_resume(struct platform_device *dev) | 632 | static int sdhci_s3c_resume(struct device *dev) |
| 633 | { | 633 | { |
| 634 | struct sdhci_host *host = platform_get_drvdata(dev); | 634 | struct sdhci_host *host = dev_get_drvdata(dev); |
| 635 | 635 | ||
| 636 | return sdhci_resume_host(host); | 636 | return sdhci_resume_host(host); |
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | static const struct dev_pm_ops sdhci_s3c_pmops = { | ||
| 640 | .suspend = sdhci_s3c_suspend, | ||
| 641 | .resume = sdhci_s3c_resume, | ||
| 642 | }; | ||
| 643 | |||
| 644 | #define SDHCI_S3C_PMOPS (&sdhci_s3c_pmops) | ||
| 645 | |||
| 639 | #else | 646 | #else |
| 640 | #define sdhci_s3c_suspend NULL | 647 | #define SDHCI_S3C_PMOPS NULL |
| 641 | #define sdhci_s3c_resume NULL | ||
| 642 | #endif | 648 | #endif |
| 643 | 649 | ||
| 644 | static struct platform_driver sdhci_s3c_driver = { | 650 | static struct platform_driver sdhci_s3c_driver = { |
| 645 | .probe = sdhci_s3c_probe, | 651 | .probe = sdhci_s3c_probe, |
| 646 | .remove = __devexit_p(sdhci_s3c_remove), | 652 | .remove = __devexit_p(sdhci_s3c_remove), |
| 647 | .suspend = sdhci_s3c_suspend, | ||
| 648 | .resume = sdhci_s3c_resume, | ||
| 649 | .driver = { | 653 | .driver = { |
| 650 | .owner = THIS_MODULE, | 654 | .owner = THIS_MODULE, |
| 651 | .name = "s3c-sdhci", | 655 | .name = "s3c-sdhci", |
| 656 | .pm = SDHCI_S3C_PMOPS, | ||
| 652 | }, | 657 | }, |
| 653 | }; | 658 | }; |
| 654 | 659 | ||
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 89699e861fc1..e2e18d3f949c 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c | |||
| @@ -318,13 +318,10 @@ static struct platform_driver sdhci_tegra_driver = { | |||
| 318 | .name = "sdhci-tegra", | 318 | .name = "sdhci-tegra", |
| 319 | .owner = THIS_MODULE, | 319 | .owner = THIS_MODULE, |
| 320 | .of_match_table = sdhci_tegra_dt_match, | 320 | .of_match_table = sdhci_tegra_dt_match, |
| 321 | .pm = SDHCI_PLTFM_PMOPS, | ||
| 321 | }, | 322 | }, |
| 322 | .probe = sdhci_tegra_probe, | 323 | .probe = sdhci_tegra_probe, |
| 323 | .remove = __devexit_p(sdhci_tegra_remove), | 324 | .remove = __devexit_p(sdhci_tegra_remove), |
| 324 | #ifdef CONFIG_PM | ||
| 325 | .suspend = sdhci_pltfm_suspend, | ||
| 326 | .resume = sdhci_pltfm_resume, | ||
| 327 | #endif | ||
| 328 | }; | 325 | }; |
| 329 | 326 | ||
| 330 | static int __init sdhci_tegra_init(void) | 327 | static int __init sdhci_tegra_init(void) |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6d8eea323541..19ed580f2cab 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
| @@ -2327,7 +2327,7 @@ out: | |||
| 2327 | 2327 | ||
| 2328 | #ifdef CONFIG_PM | 2328 | #ifdef CONFIG_PM |
| 2329 | 2329 | ||
| 2330 | int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state) | 2330 | int sdhci_suspend_host(struct sdhci_host *host) |
| 2331 | { | 2331 | { |
| 2332 | int ret; | 2332 | int ret; |
| 2333 | 2333 | ||
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 0a5b65460d8a..a04d4d0c6fd2 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
| @@ -374,7 +374,7 @@ extern int sdhci_add_host(struct sdhci_host *host); | |||
| 374 | extern void sdhci_remove_host(struct sdhci_host *host, int dead); | 374 | extern void sdhci_remove_host(struct sdhci_host *host, int dead); |
| 375 | 375 | ||
| 376 | #ifdef CONFIG_PM | 376 | #ifdef CONFIG_PM |
| 377 | extern int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state); | 377 | extern int sdhci_suspend_host(struct sdhci_host *host); |
| 378 | extern int sdhci_resume_host(struct sdhci_host *host); | 378 | extern int sdhci_resume_host(struct sdhci_host *host); |
| 379 | extern void sdhci_enable_irq_wakeups(struct sdhci_host *host); | 379 | extern void sdhci_enable_irq_wakeups(struct sdhci_host *host); |
| 380 | #endif | 380 | #endif |
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 369366c8e205..d5505f3fe2a1 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c | |||
| @@ -908,7 +908,7 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
| 908 | if (host->power) { | 908 | if (host->power) { |
| 909 | pm_runtime_put(&host->pd->dev); | 909 | pm_runtime_put(&host->pd->dev); |
| 910 | host->power = false; | 910 | host->power = false; |
| 911 | if (p->down_pwr) | 911 | if (p->down_pwr && ios->power_mode == MMC_POWER_OFF) |
| 912 | p->down_pwr(host->pd); | 912 | p->down_pwr(host->pd); |
| 913 | } | 913 | } |
| 914 | host->state = STATE_IDLE; | 914 | host->state = STATE_IDLE; |
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index d85a60cda167..4208b3958069 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c | |||
| @@ -798,7 +798,7 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
| 798 | /* start bus clock */ | 798 | /* start bus clock */ |
| 799 | tmio_mmc_clk_start(host); | 799 | tmio_mmc_clk_start(host); |
| 800 | } else if (ios->power_mode != MMC_POWER_UP) { | 800 | } else if (ios->power_mode != MMC_POWER_UP) { |
| 801 | if (host->set_pwr) | 801 | if (host->set_pwr && ios->power_mode == MMC_POWER_OFF) |
| 802 | host->set_pwr(host->pdev, 0); | 802 | host->set_pwr(host->pdev, 0); |
| 803 | if ((pdata->flags & TMIO_MMC_HAS_COLD_CD) && | 803 | if ((pdata->flags & TMIO_MMC_HAS_COLD_CD) && |
| 804 | pdata->power) { | 804 | pdata->power) { |
diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c index e8f6e65183d7..2ec978bc32ba 100644 --- a/drivers/mmc/host/vub300.c +++ b/drivers/mmc/host/vub300.c | |||
| @@ -259,7 +259,7 @@ static int firmware_rom_wait_states = 0x04; | |||
| 259 | static int firmware_rom_wait_states = 0x1C; | 259 | static int firmware_rom_wait_states = 0x1C; |
| 260 | #endif | 260 | #endif |
| 261 | 261 | ||
| 262 | module_param(firmware_rom_wait_states, bool, 0644); | 262 | module_param(firmware_rom_wait_states, int, 0644); |
| 263 | MODULE_PARM_DESC(firmware_rom_wait_states, | 263 | MODULE_PARM_DESC(firmware_rom_wait_states, |
| 264 | "ROM wait states byte=RRRIIEEE (Reserved Internal External)"); | 264 | "ROM wait states byte=RRRIIEEE (Reserved Internal External)"); |
| 265 | 265 | ||
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index 94f553489725..45876d0e5b8e 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c | |||
| @@ -227,10 +227,14 @@ static int platram_probe(struct platform_device *pdev) | |||
| 227 | if (!err) | 227 | if (!err) |
| 228 | dev_info(&pdev->dev, "registered mtd device\n"); | 228 | dev_info(&pdev->dev, "registered mtd device\n"); |
| 229 | 229 | ||
| 230 | /* add the whole device. */ | 230 | if (pdata->nr_partitions) { |
| 231 | err = mtd_device_register(info->mtd, NULL, 0); | 231 | /* add the whole device. */ |
| 232 | if (err) | 232 | err = mtd_device_register(info->mtd, NULL, 0); |
| 233 | dev_err(&pdev->dev, "failed to register the entire device\n"); | 233 | if (err) { |
| 234 | dev_err(&pdev->dev, | ||
| 235 | "failed to register the entire device\n"); | ||
| 236 | } | ||
| 237 | } | ||
| 234 | 238 | ||
| 235 | return err; | 239 | return err; |
| 236 | 240 | ||
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index 411a17df9fc1..2a25b6789af4 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
| @@ -98,7 +98,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) | |||
| 98 | } | 98 | } |
| 99 | info->mtd->owner = THIS_MODULE; | 99 | info->mtd->owner = THIS_MODULE; |
| 100 | 100 | ||
| 101 | mtd_device_parse_register(info->mtd, probes, 0, NULL, 0); | 101 | mtd_device_parse_register(info->mtd, probes, 0, flash->parts, flash->nr_parts); |
| 102 | 102 | ||
| 103 | platform_set_drvdata(pdev, info); | 103 | platform_set_drvdata(pdev, info); |
| 104 | return 0; | 104 | return 0; |
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 071b63420f0e..493ec2fcf97f 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
| @@ -21,9 +21,9 @@ | |||
| 21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/module.h> | ||
| 24 | #include <linux/mtd/gpmi-nand.h> | 25 | #include <linux/mtd/gpmi-nand.h> |
| 25 | #include <linux/mtd/partitions.h> | 26 | #include <linux/mtd/partitions.h> |
| 26 | |||
| 27 | #include "gpmi-nand.h" | 27 | #include "gpmi-nand.h" |
| 28 | 28 | ||
| 29 | /* add our owner bbt descriptor */ | 29 | /* add our owner bbt descriptor */ |
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index ee1713907b92..f8aacf48ecdd 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c | |||
| @@ -188,7 +188,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc, | |||
| 188 | if (!flash_np) | 188 | if (!flash_np) |
| 189 | return -ENODEV; | 189 | return -ENODEV; |
| 190 | 190 | ||
| 191 | ppdata->of_node = flash_np; | 191 | ppdata.of_node = flash_np; |
| 192 | ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s", | 192 | ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s", |
| 193 | dev_name(&ndfc->ofdev->dev), flash_np->name); | 193 | dev_name(&ndfc->ofdev->dev), flash_np->name); |
| 194 | if (!ndfc->mtd.name) { | 194 | if (!ndfc->mtd.name) { |
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 1124ce0a1594..c136230d50bb 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c | |||
| @@ -232,6 +232,7 @@ struct fec_enet_private { | |||
| 232 | struct platform_device *pdev; | 232 | struct platform_device *pdev; |
| 233 | 233 | ||
| 234 | int opened; | 234 | int opened; |
| 235 | int dev_id; | ||
| 235 | 236 | ||
| 236 | /* Phylib and MDIO interface */ | 237 | /* Phylib and MDIO interface */ |
| 237 | struct mii_bus *mii_bus; | 238 | struct mii_bus *mii_bus; |
| @@ -837,7 +838,7 @@ static void __inline__ fec_get_mac(struct net_device *ndev) | |||
| 837 | 838 | ||
| 838 | /* Adjust MAC if using macaddr */ | 839 | /* Adjust MAC if using macaddr */ |
| 839 | if (iap == macaddr) | 840 | if (iap == macaddr) |
| 840 | ndev->dev_addr[ETH_ALEN-1] = macaddr[ETH_ALEN-1] + fep->pdev->id; | 841 | ndev->dev_addr[ETH_ALEN-1] = macaddr[ETH_ALEN-1] + fep->dev_id; |
| 841 | } | 842 | } |
| 842 | 843 | ||
| 843 | /* ------------------------------------------------------------------------- */ | 844 | /* ------------------------------------------------------------------------- */ |
| @@ -953,7 +954,7 @@ static int fec_enet_mii_probe(struct net_device *ndev) | |||
| 953 | char mdio_bus_id[MII_BUS_ID_SIZE]; | 954 | char mdio_bus_id[MII_BUS_ID_SIZE]; |
| 954 | char phy_name[MII_BUS_ID_SIZE + 3]; | 955 | char phy_name[MII_BUS_ID_SIZE + 3]; |
| 955 | int phy_id; | 956 | int phy_id; |
| 956 | int dev_id = fep->pdev->id; | 957 | int dev_id = fep->dev_id; |
| 957 | 958 | ||
| 958 | fep->phy_dev = NULL; | 959 | fep->phy_dev = NULL; |
| 959 | 960 | ||
| @@ -1031,7 +1032,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
| 1031 | * mdio interface in board design, and need to be configured by | 1032 | * mdio interface in board design, and need to be configured by |
| 1032 | * fec0 mii_bus. | 1033 | * fec0 mii_bus. |
| 1033 | */ | 1034 | */ |
| 1034 | if ((id_entry->driver_data & FEC_QUIRK_ENET_MAC) && pdev->id > 0) { | 1035 | if ((id_entry->driver_data & FEC_QUIRK_ENET_MAC) && fep->dev_id > 0) { |
| 1035 | /* fec1 uses fec0 mii_bus */ | 1036 | /* fec1 uses fec0 mii_bus */ |
| 1036 | fep->mii_bus = fec0_mii_bus; | 1037 | fep->mii_bus = fec0_mii_bus; |
| 1037 | return 0; | 1038 | return 0; |
| @@ -1063,7 +1064,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
| 1063 | fep->mii_bus->read = fec_enet_mdio_read; | 1064 | fep->mii_bus->read = fec_enet_mdio_read; |
| 1064 | fep->mii_bus->write = fec_enet_mdio_write; | 1065 | fep->mii_bus->write = fec_enet_mdio_write; |
| 1065 | fep->mii_bus->reset = fec_enet_mdio_reset; | 1066 | fep->mii_bus->reset = fec_enet_mdio_reset; |
| 1066 | snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id + 1); | 1067 | snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", fep->dev_id + 1); |
| 1067 | fep->mii_bus->priv = fep; | 1068 | fep->mii_bus->priv = fep; |
| 1068 | fep->mii_bus->parent = &pdev->dev; | 1069 | fep->mii_bus->parent = &pdev->dev; |
| 1069 | 1070 | ||
| @@ -1521,6 +1522,7 @@ fec_probe(struct platform_device *pdev) | |||
| 1521 | int i, irq, ret = 0; | 1522 | int i, irq, ret = 0; |
| 1522 | struct resource *r; | 1523 | struct resource *r; |
| 1523 | const struct of_device_id *of_id; | 1524 | const struct of_device_id *of_id; |
| 1525 | static int dev_id; | ||
| 1524 | 1526 | ||
| 1525 | of_id = of_match_device(fec_dt_ids, &pdev->dev); | 1527 | of_id = of_match_device(fec_dt_ids, &pdev->dev); |
| 1526 | if (of_id) | 1528 | if (of_id) |
| @@ -1548,6 +1550,7 @@ fec_probe(struct platform_device *pdev) | |||
| 1548 | 1550 | ||
| 1549 | fep->hwp = ioremap(r->start, resource_size(r)); | 1551 | fep->hwp = ioremap(r->start, resource_size(r)); |
| 1550 | fep->pdev = pdev; | 1552 | fep->pdev = pdev; |
| 1553 | fep->dev_id = dev_id++; | ||
| 1551 | 1554 | ||
| 1552 | if (!fep->hwp) { | 1555 | if (!fep->hwp) { |
| 1553 | ret = -ENOMEM; | 1556 | ret = -ENOMEM; |
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index 52f4e8ad48e7..4d9f84b8ab97 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c | |||
| @@ -183,28 +183,10 @@ void fsl_pq_mdio_bus_name(char *name, struct device_node *np) | |||
| 183 | } | 183 | } |
| 184 | EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name); | 184 | EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name); |
| 185 | 185 | ||
| 186 | /* Scan the bus in reverse, looking for an empty spot */ | ||
| 187 | static int fsl_pq_mdio_find_free(struct mii_bus *new_bus) | ||
| 188 | { | ||
| 189 | int i; | ||
| 190 | |||
| 191 | for (i = PHY_MAX_ADDR; i > 0; i--) { | ||
| 192 | u32 phy_id; | ||
| 193 | |||
| 194 | if (get_phy_id(new_bus, i, &phy_id)) | ||
| 195 | return -1; | ||
| 196 | |||
| 197 | if (phy_id == 0xffffffff) | ||
| 198 | break; | ||
| 199 | } | ||
| 200 | |||
| 201 | return i; | ||
| 202 | } | ||
| 203 | |||
| 204 | 186 | ||
| 205 | #if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE) | ||
| 206 | static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct device_node *np) | 187 | static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct device_node *np) |
| 207 | { | 188 | { |
| 189 | #if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE) | ||
| 208 | struct gfar __iomem *enet_regs; | 190 | struct gfar __iomem *enet_regs; |
| 209 | 191 | ||
| 210 | /* | 192 | /* |
| @@ -220,15 +202,15 @@ static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct devi | |||
| 220 | } else if (of_device_is_compatible(np, "fsl,etsec2-mdio") || | 202 | } else if (of_device_is_compatible(np, "fsl,etsec2-mdio") || |
| 221 | of_device_is_compatible(np, "fsl,etsec2-tbi")) { | 203 | of_device_is_compatible(np, "fsl,etsec2-tbi")) { |
| 222 | return of_iomap(np, 1); | 204 | return of_iomap(np, 1); |
| 223 | } else | 205 | } |
| 224 | return NULL; | ||
| 225 | } | ||
| 226 | #endif | 206 | #endif |
| 207 | return NULL; | ||
| 208 | } | ||
| 227 | 209 | ||
| 228 | 210 | ||
| 229 | #if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE) | ||
| 230 | static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id) | 211 | static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id) |
| 231 | { | 212 | { |
| 213 | #if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE) | ||
| 232 | struct device_node *np = NULL; | 214 | struct device_node *np = NULL; |
| 233 | int err = 0; | 215 | int err = 0; |
| 234 | 216 | ||
| @@ -261,9 +243,10 @@ static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id) | |||
| 261 | return err; | 243 | return err; |
| 262 | else | 244 | else |
| 263 | return -EINVAL; | 245 | return -EINVAL; |
| 264 | } | 246 | #else |
| 247 | return -ENODEV; | ||
| 265 | #endif | 248 | #endif |
| 266 | 249 | } | |
| 267 | 250 | ||
| 268 | static int fsl_pq_mdio_probe(struct platform_device *ofdev) | 251 | static int fsl_pq_mdio_probe(struct platform_device *ofdev) |
| 269 | { | 252 | { |
| @@ -339,19 +322,13 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev) | |||
| 339 | of_device_is_compatible(np, "fsl,etsec2-mdio") || | 322 | of_device_is_compatible(np, "fsl,etsec2-mdio") || |
| 340 | of_device_is_compatible(np, "fsl,etsec2-tbi") || | 323 | of_device_is_compatible(np, "fsl,etsec2-tbi") || |
| 341 | of_device_is_compatible(np, "gianfar")) { | 324 | of_device_is_compatible(np, "gianfar")) { |
| 342 | #if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE) | ||
| 343 | tbipa = get_gfar_tbipa(regs, np); | 325 | tbipa = get_gfar_tbipa(regs, np); |
| 344 | if (!tbipa) { | 326 | if (!tbipa) { |
| 345 | err = -EINVAL; | 327 | err = -EINVAL; |
| 346 | goto err_free_irqs; | 328 | goto err_free_irqs; |
| 347 | } | 329 | } |
| 348 | #else | ||
| 349 | err = -ENODEV; | ||
| 350 | goto err_free_irqs; | ||
| 351 | #endif | ||
| 352 | } else if (of_device_is_compatible(np, "fsl,ucc-mdio") || | 330 | } else if (of_device_is_compatible(np, "fsl,ucc-mdio") || |
| 353 | of_device_is_compatible(np, "ucc_geth_phy")) { | 331 | of_device_is_compatible(np, "ucc_geth_phy")) { |
| 354 | #if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE) | ||
| 355 | u32 id; | 332 | u32 id; |
| 356 | static u32 mii_mng_master; | 333 | static u32 mii_mng_master; |
| 357 | 334 | ||
| @@ -364,10 +341,6 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev) | |||
| 364 | mii_mng_master = id; | 341 | mii_mng_master = id; |
| 365 | ucc_set_qe_mux_mii_mng(id - 1); | 342 | ucc_set_qe_mux_mii_mng(id - 1); |
| 366 | } | 343 | } |
| 367 | #else | ||
| 368 | err = -ENODEV; | ||
| 369 | goto err_free_irqs; | ||
| 370 | #endif | ||
| 371 | } else { | 344 | } else { |
| 372 | err = -ENODEV; | 345 | err = -ENODEV; |
| 373 | goto err_free_irqs; | 346 | goto err_free_irqs; |
| @@ -386,16 +359,6 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev) | |||
| 386 | } | 359 | } |
| 387 | 360 | ||
| 388 | if (tbiaddr == -1) { | 361 | if (tbiaddr == -1) { |
| 389 | out_be32(tbipa, 0); | ||
| 390 | |||
| 391 | tbiaddr = fsl_pq_mdio_find_free(new_bus); | ||
| 392 | } | ||
| 393 | |||
| 394 | /* | ||
| 395 | * We define TBIPA at 0 to be illegal, opting to fail for boards that | ||
| 396 | * have PHYs at 1-31, rather than change tbipa and rescan. | ||
| 397 | */ | ||
| 398 | if (tbiaddr == 0) { | ||
| 399 | err = -EBUSY; | 362 | err = -EBUSY; |
| 400 | 363 | ||
| 401 | goto err_free_irqs; | 364 | goto err_free_irqs; |
diff --git a/drivers/net/ethernet/pasemi/Makefile b/drivers/net/ethernet/pasemi/Makefile index 05db5434bafc..90497ffb1ac3 100644 --- a/drivers/net/ethernet/pasemi/Makefile +++ b/drivers/net/ethernet/pasemi/Makefile | |||
| @@ -2,4 +2,5 @@ | |||
| 2 | # Makefile for the A Semi network device drivers. | 2 | # Makefile for the A Semi network device drivers. |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac.o pasemi_mac_ethtool.o | 5 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o |
| 6 | pasemi_mac_driver-objs := pasemi_mac.o pasemi_mac_ethtool.o | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 6f06aa10f0d7..c8f47f17186f 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -477,7 +477,6 @@ enum rtl_register_content { | |||
| 477 | /* Config1 register p.24 */ | 477 | /* Config1 register p.24 */ |
| 478 | LEDS1 = (1 << 7), | 478 | LEDS1 = (1 << 7), |
| 479 | LEDS0 = (1 << 6), | 479 | LEDS0 = (1 << 6), |
| 480 | MSIEnable = (1 << 5), /* Enable Message Signaled Interrupt */ | ||
| 481 | Speed_down = (1 << 4), | 480 | Speed_down = (1 << 4), |
| 482 | MEMMAP = (1 << 3), | 481 | MEMMAP = (1 << 3), |
| 483 | IOMAP = (1 << 2), | 482 | IOMAP = (1 << 2), |
| @@ -485,6 +484,7 @@ enum rtl_register_content { | |||
| 485 | PMEnable = (1 << 0), /* Power Management Enable */ | 484 | PMEnable = (1 << 0), /* Power Management Enable */ |
| 486 | 485 | ||
| 487 | /* Config2 register p. 25 */ | 486 | /* Config2 register p. 25 */ |
| 487 | MSIEnable = (1 << 5), /* 8169 only. Reserved in the 8168. */ | ||
| 488 | PCI_Clock_66MHz = 0x01, | 488 | PCI_Clock_66MHz = 0x01, |
| 489 | PCI_Clock_33MHz = 0x00, | 489 | PCI_Clock_33MHz = 0x00, |
| 490 | 490 | ||
| @@ -1183,11 +1183,13 @@ static u8 rtl8168d_efuse_read(void __iomem *ioaddr, int reg_addr) | |||
| 1183 | return value; | 1183 | return value; |
| 1184 | } | 1184 | } |
| 1185 | 1185 | ||
| 1186 | static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr) | 1186 | static void rtl8169_irq_mask_and_ack(struct rtl8169_private *tp) |
| 1187 | { | 1187 | { |
| 1188 | RTL_W16(IntrMask, 0x0000); | 1188 | void __iomem *ioaddr = tp->mmio_addr; |
| 1189 | 1189 | ||
| 1190 | RTL_W16(IntrStatus, 0xffff); | 1190 | RTL_W16(IntrMask, 0x0000); |
| 1191 | RTL_W16(IntrStatus, tp->intr_event); | ||
| 1192 | RTL_R8(ChipCmd); | ||
| 1191 | } | 1193 | } |
| 1192 | 1194 | ||
| 1193 | static unsigned int rtl8169_tbi_reset_pending(struct rtl8169_private *tp) | 1195 | static unsigned int rtl8169_tbi_reset_pending(struct rtl8169_private *tp) |
| @@ -3424,22 +3426,24 @@ static const struct rtl_cfg_info { | |||
| 3424 | }; | 3426 | }; |
| 3425 | 3427 | ||
| 3426 | /* Cfg9346_Unlock assumed. */ | 3428 | /* Cfg9346_Unlock assumed. */ |
| 3427 | static unsigned rtl_try_msi(struct pci_dev *pdev, void __iomem *ioaddr, | 3429 | static unsigned rtl_try_msi(struct rtl8169_private *tp, |
| 3428 | const struct rtl_cfg_info *cfg) | 3430 | const struct rtl_cfg_info *cfg) |
| 3429 | { | 3431 | { |
| 3432 | void __iomem *ioaddr = tp->mmio_addr; | ||
| 3430 | unsigned msi = 0; | 3433 | unsigned msi = 0; |
| 3431 | u8 cfg2; | 3434 | u8 cfg2; |
| 3432 | 3435 | ||
| 3433 | cfg2 = RTL_R8(Config2) & ~MSIEnable; | 3436 | cfg2 = RTL_R8(Config2) & ~MSIEnable; |
| 3434 | if (cfg->features & RTL_FEATURE_MSI) { | 3437 | if (cfg->features & RTL_FEATURE_MSI) { |
| 3435 | if (pci_enable_msi(pdev)) { | 3438 | if (pci_enable_msi(tp->pci_dev)) { |
| 3436 | dev_info(&pdev->dev, "no MSI. Back to INTx.\n"); | 3439 | netif_info(tp, hw, tp->dev, "no MSI. Back to INTx.\n"); |
| 3437 | } else { | 3440 | } else { |
| 3438 | cfg2 |= MSIEnable; | 3441 | cfg2 |= MSIEnable; |
| 3439 | msi = RTL_FEATURE_MSI; | 3442 | msi = RTL_FEATURE_MSI; |
| 3440 | } | 3443 | } |
| 3441 | } | 3444 | } |
| 3442 | RTL_W8(Config2, cfg2); | 3445 | if (tp->mac_version <= RTL_GIGA_MAC_VER_06) |
| 3446 | RTL_W8(Config2, cfg2); | ||
| 3443 | return msi; | 3447 | return msi; |
| 3444 | } | 3448 | } |
| 3445 | 3449 | ||
| @@ -3933,8 +3937,6 @@ static void rtl_hw_reset(struct rtl8169_private *tp) | |||
| 3933 | break; | 3937 | break; |
| 3934 | udelay(100); | 3938 | udelay(100); |
| 3935 | } | 3939 | } |
| 3936 | |||
| 3937 | rtl8169_init_ring_indexes(tp); | ||
| 3938 | } | 3940 | } |
| 3939 | 3941 | ||
| 3940 | static int __devinit | 3942 | static int __devinit |
| @@ -4077,7 +4079,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 4077 | tp->features |= RTL_FEATURE_WOL; | 4079 | tp->features |= RTL_FEATURE_WOL; |
| 4078 | if ((RTL_R8(Config5) & (UWF | BWF | MWF)) != 0) | 4080 | if ((RTL_R8(Config5) & (UWF | BWF | MWF)) != 0) |
| 4079 | tp->features |= RTL_FEATURE_WOL; | 4081 | tp->features |= RTL_FEATURE_WOL; |
| 4080 | tp->features |= rtl_try_msi(pdev, ioaddr, cfg); | 4082 | tp->features |= rtl_try_msi(tp, cfg); |
| 4081 | RTL_W8(Cfg9346, Cfg9346_Lock); | 4083 | RTL_W8(Cfg9346, Cfg9346_Lock); |
| 4082 | 4084 | ||
| 4083 | if (rtl_tbi_enabled(tp)) { | 4085 | if (rtl_tbi_enabled(tp)) { |
| @@ -4339,7 +4341,7 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp) | |||
| 4339 | void __iomem *ioaddr = tp->mmio_addr; | 4341 | void __iomem *ioaddr = tp->mmio_addr; |
| 4340 | 4342 | ||
| 4341 | /* Disable interrupts */ | 4343 | /* Disable interrupts */ |
| 4342 | rtl8169_irq_mask_and_ack(ioaddr); | 4344 | rtl8169_irq_mask_and_ack(tp); |
| 4343 | 4345 | ||
| 4344 | rtl_rx_close(tp); | 4346 | rtl_rx_close(tp); |
| 4345 | 4347 | ||
| @@ -4885,8 +4887,7 @@ static void rtl_hw_start_8168(struct net_device *dev) | |||
| 4885 | RTL_W16(IntrMitigate, 0x5151); | 4887 | RTL_W16(IntrMitigate, 0x5151); |
| 4886 | 4888 | ||
| 4887 | /* Work around for RxFIFO overflow. */ | 4889 | /* Work around for RxFIFO overflow. */ |
| 4888 | if (tp->mac_version == RTL_GIGA_MAC_VER_11 || | 4890 | if (tp->mac_version == RTL_GIGA_MAC_VER_11) { |
| 4889 | tp->mac_version == RTL_GIGA_MAC_VER_22) { | ||
| 4890 | tp->intr_event |= RxFIFOOver | PCSTimeout; | 4891 | tp->intr_event |= RxFIFOOver | PCSTimeout; |
| 4891 | tp->intr_event &= ~RxOverflow; | 4892 | tp->intr_event &= ~RxOverflow; |
| 4892 | } | 4893 | } |
| @@ -5076,6 +5077,11 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
| 5076 | void __iomem *ioaddr = tp->mmio_addr; | 5077 | void __iomem *ioaddr = tp->mmio_addr; |
| 5077 | struct pci_dev *pdev = tp->pci_dev; | 5078 | struct pci_dev *pdev = tp->pci_dev; |
| 5078 | 5079 | ||
| 5080 | if (tp->mac_version >= RTL_GIGA_MAC_VER_30) { | ||
| 5081 | tp->intr_event &= ~RxFIFOOver; | ||
| 5082 | tp->napi_event &= ~RxFIFOOver; | ||
| 5083 | } | ||
| 5084 | |||
| 5079 | if (tp->mac_version == RTL_GIGA_MAC_VER_13 || | 5085 | if (tp->mac_version == RTL_GIGA_MAC_VER_13 || |
| 5080 | tp->mac_version == RTL_GIGA_MAC_VER_16) { | 5086 | tp->mac_version == RTL_GIGA_MAC_VER_16) { |
| 5081 | int cap = pci_pcie_cap(pdev); | 5087 | int cap = pci_pcie_cap(pdev); |
| @@ -5342,7 +5348,7 @@ static void rtl8169_wait_for_quiescence(struct net_device *dev) | |||
| 5342 | /* Wait for any pending NAPI task to complete */ | 5348 | /* Wait for any pending NAPI task to complete */ |
| 5343 | napi_disable(&tp->napi); | 5349 | napi_disable(&tp->napi); |
| 5344 | 5350 | ||
| 5345 | rtl8169_irq_mask_and_ack(ioaddr); | 5351 | rtl8169_irq_mask_and_ack(tp); |
| 5346 | 5352 | ||
| 5347 | tp->intr_mask = 0xffff; | 5353 | tp->intr_mask = 0xffff; |
| 5348 | RTL_W16(IntrMask, tp->intr_event); | 5354 | RTL_W16(IntrMask, tp->intr_event); |
| @@ -5389,14 +5395,16 @@ static void rtl8169_reset_task(struct work_struct *work) | |||
| 5389 | if (!netif_running(dev)) | 5395 | if (!netif_running(dev)) |
| 5390 | goto out_unlock; | 5396 | goto out_unlock; |
| 5391 | 5397 | ||
| 5398 | rtl8169_hw_reset(tp); | ||
| 5399 | |||
| 5392 | rtl8169_wait_for_quiescence(dev); | 5400 | rtl8169_wait_for_quiescence(dev); |
| 5393 | 5401 | ||
| 5394 | for (i = 0; i < NUM_RX_DESC; i++) | 5402 | for (i = 0; i < NUM_RX_DESC; i++) |
| 5395 | rtl8169_mark_to_asic(tp->RxDescArray + i, rx_buf_sz); | 5403 | rtl8169_mark_to_asic(tp->RxDescArray + i, rx_buf_sz); |
| 5396 | 5404 | ||
| 5397 | rtl8169_tx_clear(tp); | 5405 | rtl8169_tx_clear(tp); |
| 5406 | rtl8169_init_ring_indexes(tp); | ||
| 5398 | 5407 | ||
| 5399 | rtl8169_hw_reset(tp); | ||
| 5400 | rtl_hw_start(dev); | 5408 | rtl_hw_start(dev); |
| 5401 | netif_wake_queue(dev); | 5409 | netif_wake_queue(dev); |
| 5402 | rtl8169_check_link_status(dev, tp, tp->mmio_addr); | 5410 | rtl8169_check_link_status(dev, tp, tp->mmio_addr); |
| @@ -5407,11 +5415,6 @@ out_unlock: | |||
| 5407 | 5415 | ||
| 5408 | static void rtl8169_tx_timeout(struct net_device *dev) | 5416 | static void rtl8169_tx_timeout(struct net_device *dev) |
| 5409 | { | 5417 | { |
| 5410 | struct rtl8169_private *tp = netdev_priv(dev); | ||
| 5411 | |||
| 5412 | rtl8169_hw_reset(tp); | ||
| 5413 | |||
| 5414 | /* Let's wait a bit while any (async) irq lands on */ | ||
| 5415 | rtl8169_schedule_work(dev, rtl8169_reset_task); | 5418 | rtl8169_schedule_work(dev, rtl8169_reset_task); |
| 5416 | } | 5419 | } |
| 5417 | 5420 | ||
| @@ -5804,6 +5807,10 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
| 5804 | */ | 5807 | */ |
| 5805 | status = RTL_R16(IntrStatus); | 5808 | status = RTL_R16(IntrStatus); |
| 5806 | while (status && status != 0xffff) { | 5809 | while (status && status != 0xffff) { |
| 5810 | status &= tp->intr_event; | ||
| 5811 | if (!status) | ||
| 5812 | break; | ||
| 5813 | |||
| 5807 | handled = 1; | 5814 | handled = 1; |
| 5808 | 5815 | ||
| 5809 | /* Handle all of the error cases first. These will reset | 5816 | /* Handle all of the error cases first. These will reset |
| @@ -5818,27 +5825,9 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
| 5818 | switch (tp->mac_version) { | 5825 | switch (tp->mac_version) { |
| 5819 | /* Work around for rx fifo overflow */ | 5826 | /* Work around for rx fifo overflow */ |
| 5820 | case RTL_GIGA_MAC_VER_11: | 5827 | case RTL_GIGA_MAC_VER_11: |
| 5821 | case RTL_GIGA_MAC_VER_22: | ||
| 5822 | case RTL_GIGA_MAC_VER_26: | ||
| 5823 | netif_stop_queue(dev); | 5828 | netif_stop_queue(dev); |
| 5824 | rtl8169_tx_timeout(dev); | 5829 | rtl8169_tx_timeout(dev); |
| 5825 | goto done; | 5830 | goto done; |
| 5826 | /* Testers needed. */ | ||
| 5827 | case RTL_GIGA_MAC_VER_17: | ||
| 5828 | case RTL_GIGA_MAC_VER_19: | ||
| 5829 | case RTL_GIGA_MAC_VER_20: | ||
| 5830 | case RTL_GIGA_MAC_VER_21: | ||
| 5831 | case RTL_GIGA_MAC_VER_23: | ||
| 5832 | case RTL_GIGA_MAC_VER_24: | ||
| 5833 | case RTL_GIGA_MAC_VER_27: | ||
| 5834 | case RTL_GIGA_MAC_VER_28: | ||
| 5835 | case RTL_GIGA_MAC_VER_31: | ||
| 5836 | /* Experimental science. Pktgen proof. */ | ||
| 5837 | case RTL_GIGA_MAC_VER_12: | ||
| 5838 | case RTL_GIGA_MAC_VER_25: | ||
| 5839 | if (status == RxFIFOOver) | ||
| 5840 | goto done; | ||
| 5841 | break; | ||
| 5842 | default: | 5831 | default: |
| 5843 | break; | 5832 | break; |
| 5844 | } | 5833 | } |
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index dca9d3369cdd..c97d2f590855 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c | |||
| @@ -836,11 +836,13 @@ int cpdma_chan_stop(struct cpdma_chan *chan) | |||
| 836 | chan_write(chan, cp, CPDMA_TEARDOWN_VALUE); | 836 | chan_write(chan, cp, CPDMA_TEARDOWN_VALUE); |
| 837 | 837 | ||
| 838 | /* handle completed packets */ | 838 | /* handle completed packets */ |
| 839 | spin_unlock_irqrestore(&chan->lock, flags); | ||
| 839 | do { | 840 | do { |
| 840 | ret = __cpdma_chan_process(chan); | 841 | ret = __cpdma_chan_process(chan); |
| 841 | if (ret < 0) | 842 | if (ret < 0) |
| 842 | break; | 843 | break; |
| 843 | } while ((ret & CPDMA_DESC_TD_COMPLETE) == 0); | 844 | } while ((ret & CPDMA_DESC_TD_COMPLETE) == 0); |
| 845 | spin_lock_irqsave(&chan->lock, flags); | ||
| 844 | 846 | ||
| 845 | /* remaining packets haven't been tx/rx'ed, clean them up */ | 847 | /* remaining packets haven't been tx/rx'ed, clean them up */ |
| 846 | while (chan->head) { | 848 | while (chan->head) { |
diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c index 10826d8a2a2d..1187a1169eb2 100644 --- a/drivers/net/ethernet/tile/tilepro.c +++ b/drivers/net/ethernet/tile/tilepro.c | |||
| @@ -926,7 +926,7 @@ static int tile_net_poll(struct napi_struct *napi, int budget) | |||
| 926 | goto done; | 926 | goto done; |
| 927 | 927 | ||
| 928 | /* Re-enable the ingress interrupt. */ | 928 | /* Re-enable the ingress interrupt. */ |
| 929 | enable_percpu_irq(priv->intr_id); | 929 | enable_percpu_irq(priv->intr_id, 0); |
| 930 | 930 | ||
| 931 | /* HACK: Avoid the "rotting packet" problem (see above). */ | 931 | /* HACK: Avoid the "rotting packet" problem (see above). */ |
| 932 | if (qup->__packet_receive_read != | 932 | if (qup->__packet_receive_read != |
| @@ -1296,7 +1296,7 @@ static void tile_net_open_enable(void *dev_ptr) | |||
| 1296 | info->napi_enabled = true; | 1296 | info->napi_enabled = true; |
| 1297 | 1297 | ||
| 1298 | /* Enable the ingress interrupt. */ | 1298 | /* Enable the ingress interrupt. */ |
| 1299 | enable_percpu_irq(priv->intr_id); | 1299 | enable_percpu_irq(priv->intr_id, 0); |
| 1300 | } | 1300 | } |
| 1301 | 1301 | ||
| 1302 | 1302 | ||
| @@ -1697,7 +1697,7 @@ static unsigned int tile_net_tx_frags(lepp_frag_t *frags, | |||
| 1697 | for (i = 0; i < sh->nr_frags; i++) { | 1697 | for (i = 0; i < sh->nr_frags; i++) { |
| 1698 | 1698 | ||
| 1699 | skb_frag_t *f = &sh->frags[i]; | 1699 | skb_frag_t *f = &sh->frags[i]; |
| 1700 | unsigned long pfn = page_to_pfn(f->page); | 1700 | unsigned long pfn = page_to_pfn(skb_frag_page(f)); |
| 1701 | 1701 | ||
| 1702 | /* FIXME: Compute "hash_for_home" properly. */ | 1702 | /* FIXME: Compute "hash_for_home" properly. */ |
| 1703 | /* ISSUE: The hypervisor checks CHIP_HAS_REV1_DMA_PACKETS(). */ | 1703 | /* ISSUE: The hypervisor checks CHIP_HAS_REV1_DMA_PACKETS(). */ |
| @@ -1706,7 +1706,7 @@ static unsigned int tile_net_tx_frags(lepp_frag_t *frags, | |||
| 1706 | /* FIXME: Hmmm. */ | 1706 | /* FIXME: Hmmm. */ |
| 1707 | if (!hash_default) { | 1707 | if (!hash_default) { |
| 1708 | void *va = pfn_to_kaddr(pfn) + f->page_offset; | 1708 | void *va = pfn_to_kaddr(pfn) + f->page_offset; |
| 1709 | BUG_ON(PageHighMem(f->page)); | 1709 | BUG_ON(PageHighMem(skb_frag_page(f))); |
| 1710 | finv_buffer_remote(va, f->size, 0); | 1710 | finv_buffer_remote(va, f->size, 0); |
| 1711 | } | 1711 | } |
| 1712 | 1712 | ||
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index 89f829f5f725..f8a6853b692e 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c | |||
| @@ -423,10 +423,8 @@ static int pptp_bind(struct socket *sock, struct sockaddr *uservaddr, | |||
| 423 | lock_sock(sk); | 423 | lock_sock(sk); |
| 424 | 424 | ||
| 425 | opt->src_addr = sp->sa_addr.pptp; | 425 | opt->src_addr = sp->sa_addr.pptp; |
| 426 | if (add_chan(po)) { | 426 | if (add_chan(po)) |
| 427 | release_sock(sk); | ||
| 428 | error = -EBUSY; | 427 | error = -EBUSY; |
| 429 | } | ||
| 430 | 428 | ||
| 431 | release_sock(sk); | 429 | release_sock(sk); |
| 432 | return error; | 430 | return error; |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index e6fed4d4cb77..e95f0e60a9bc 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
| @@ -1655,6 +1655,10 @@ static const struct usb_device_id products [] = { | |||
| 1655 | // ASIX 88772a | 1655 | // ASIX 88772a |
| 1656 | USB_DEVICE(0x0db0, 0xa877), | 1656 | USB_DEVICE(0x0db0, 0xa877), |
| 1657 | .driver_info = (unsigned long) &ax88772_info, | 1657 | .driver_info = (unsigned long) &ax88772_info, |
| 1658 | }, { | ||
| 1659 | // Asus USB Ethernet Adapter | ||
| 1660 | USB_DEVICE (0x0b95, 0x7e2b), | ||
| 1661 | .driver_info = (unsigned long) &ax88772_info, | ||
| 1658 | }, | 1662 | }, |
| 1659 | { }, // END | 1663 | { }, // END |
| 1660 | }; | 1664 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 93fbe6f40898..d2348a5a7809 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -286,7 +286,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start) | |||
| 286 | ath_start_ani(common); | 286 | ath_start_ani(common); |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | if (ath9k_hw_ops(ah)->antdiv_comb_conf_get && sc->ant_rx != 3) { | 289 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) && sc->ant_rx != 3) { |
| 290 | struct ath_hw_antcomb_conf div_ant_conf; | 290 | struct ath_hw_antcomb_conf div_ant_conf; |
| 291 | u8 lna_conf; | 291 | u8 lna_conf; |
| 292 | 292 | ||
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 888abc2be3a5..528d5f3e868c 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
| @@ -1271,7 +1271,9 @@ static void ath_rc_init(struct ath_softc *sc, | |||
| 1271 | 1271 | ||
| 1272 | ath_rc_priv->max_valid_rate = k; | 1272 | ath_rc_priv->max_valid_rate = k; |
| 1273 | ath_rc_sort_validrates(rate_table, ath_rc_priv); | 1273 | ath_rc_sort_validrates(rate_table, ath_rc_priv); |
| 1274 | ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4]; | 1274 | ath_rc_priv->rate_max_phy = (k > 4) ? |
| 1275 | ath_rc_priv->valid_rate_index[k-4] : | ||
| 1276 | ath_rc_priv->valid_rate_index[k-1]; | ||
| 1275 | ath_rc_priv->rate_table = rate_table; | 1277 | ath_rc_priv->rate_table = rate_table; |
| 1276 | 1278 | ||
| 1277 | ath_dbg(common, ATH_DBG_CONFIG, | 1279 | ath_dbg(common, ATH_DBG_CONFIG, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index e12b48c2cff6..dd008b0e6417 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
| @@ -191,6 +191,7 @@ static struct iwl_base_params iwl1000_base_params = { | |||
| 191 | .chain_noise_scale = 1000, | 191 | .chain_noise_scale = 1000, |
| 192 | .wd_timeout = IWL_DEF_WD_TIMEOUT, | 192 | .wd_timeout = IWL_DEF_WD_TIMEOUT, |
| 193 | .max_event_log_size = 128, | 193 | .max_event_log_size = 128, |
| 194 | .wd_disable = true, | ||
| 194 | }; | 195 | }; |
| 195 | static struct iwl_ht_params iwl1000_ht_params = { | 196 | static struct iwl_ht_params iwl1000_ht_params = { |
| 196 | .ht_greenfield_support = true, | 197 | .ht_greenfield_support = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index c511c98a89a8..f55fb2d1af52 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
| @@ -364,6 +364,7 @@ static struct iwl_base_params iwl5000_base_params = { | |||
| 364 | .wd_timeout = IWL_LONG_WD_TIMEOUT, | 364 | .wd_timeout = IWL_LONG_WD_TIMEOUT, |
| 365 | .max_event_log_size = 512, | 365 | .max_event_log_size = 512, |
| 366 | .no_idle_support = true, | 366 | .no_idle_support = true, |
| 367 | .wd_disable = true, | ||
| 367 | }; | 368 | }; |
| 368 | static struct iwl_ht_params iwl5000_ht_params = { | 369 | static struct iwl_ht_params iwl5000_ht_params = { |
| 369 | .ht_greenfield_support = true, | 370 | .ht_greenfield_support = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c index 58a381c01c89..5c7c17c7166a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | |||
| @@ -528,6 +528,24 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
| 528 | return 0; | 528 | return 0; |
| 529 | } | 529 | } |
| 530 | 530 | ||
| 531 | void iwlagn_config_ht40(struct ieee80211_conf *conf, | ||
| 532 | struct iwl_rxon_context *ctx) | ||
| 533 | { | ||
| 534 | if (conf_is_ht40_minus(conf)) { | ||
| 535 | ctx->ht.extension_chan_offset = | ||
| 536 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; | ||
| 537 | ctx->ht.is_40mhz = true; | ||
| 538 | } else if (conf_is_ht40_plus(conf)) { | ||
| 539 | ctx->ht.extension_chan_offset = | ||
| 540 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
| 541 | ctx->ht.is_40mhz = true; | ||
| 542 | } else { | ||
| 543 | ctx->ht.extension_chan_offset = | ||
| 544 | IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
| 545 | ctx->ht.is_40mhz = false; | ||
| 546 | } | ||
| 547 | } | ||
| 548 | |||
| 531 | int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) | 549 | int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) |
| 532 | { | 550 | { |
| 533 | struct iwl_priv *priv = hw->priv; | 551 | struct iwl_priv *priv = hw->priv; |
| @@ -586,19 +604,11 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
| 586 | ctx->ht.enabled = conf_is_ht(conf); | 604 | ctx->ht.enabled = conf_is_ht(conf); |
| 587 | 605 | ||
| 588 | if (ctx->ht.enabled) { | 606 | if (ctx->ht.enabled) { |
| 589 | if (conf_is_ht40_minus(conf)) { | 607 | /* if HT40 is used, it should not change |
| 590 | ctx->ht.extension_chan_offset = | 608 | * after associated except channel switch */ |
| 591 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; | 609 | if (!ctx->ht.is_40mhz || |
| 592 | ctx->ht.is_40mhz = true; | 610 | !iwl_is_associated_ctx(ctx)) |
| 593 | } else if (conf_is_ht40_plus(conf)) { | 611 | iwlagn_config_ht40(conf, ctx); |
| 594 | ctx->ht.extension_chan_offset = | ||
| 595 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
| 596 | ctx->ht.is_40mhz = true; | ||
| 597 | } else { | ||
| 598 | ctx->ht.extension_chan_offset = | ||
| 599 | IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
| 600 | ctx->ht.is_40mhz = false; | ||
| 601 | } | ||
| 602 | } else | 612 | } else |
| 603 | ctx->ht.is_40mhz = false; | 613 | ctx->ht.is_40mhz = false; |
| 604 | 614 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c index ed6283623932..4b2aa1da0953 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c | |||
| @@ -1268,9 +1268,6 @@ int iwl_set_dynamic_key(struct iwl_priv *priv, | |||
| 1268 | 1268 | ||
| 1269 | switch (keyconf->cipher) { | 1269 | switch (keyconf->cipher) { |
| 1270 | case WLAN_CIPHER_SUITE_TKIP: | 1270 | case WLAN_CIPHER_SUITE_TKIP: |
| 1271 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | ||
| 1272 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | ||
| 1273 | |||
| 1274 | if (sta) | 1271 | if (sta) |
| 1275 | addr = sta->addr; | 1272 | addr = sta->addr; |
| 1276 | else /* station mode case only */ | 1273 | else /* station mode case only */ |
| @@ -1283,8 +1280,6 @@ int iwl_set_dynamic_key(struct iwl_priv *priv, | |||
| 1283 | seq.tkip.iv32, p1k, CMD_SYNC); | 1280 | seq.tkip.iv32, p1k, CMD_SYNC); |
| 1284 | break; | 1281 | break; |
| 1285 | case WLAN_CIPHER_SUITE_CCMP: | 1282 | case WLAN_CIPHER_SUITE_CCMP: |
| 1286 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | ||
| 1287 | /* fall through */ | ||
| 1288 | case WLAN_CIPHER_SUITE_WEP40: | 1283 | case WLAN_CIPHER_SUITE_WEP40: |
| 1289 | case WLAN_CIPHER_SUITE_WEP104: | 1284 | case WLAN_CIPHER_SUITE_WEP104: |
| 1290 | ret = iwlagn_send_sta_key(priv, keyconf, sta_id, | 1285 | ret = iwlagn_send_sta_key(priv, keyconf, sta_id, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index 35a6b71f358c..df1540ca6102 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
| @@ -91,7 +91,10 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv, | |||
| 91 | tx_cmd->tid_tspec = qc[0] & 0xf; | 91 | tx_cmd->tid_tspec = qc[0] & 0xf; |
| 92 | tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; | 92 | tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; |
| 93 | } else { | 93 | } else { |
| 94 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; | 94 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) |
| 95 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; | ||
| 96 | else | ||
| 97 | tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; | ||
| 95 | } | 98 | } |
| 96 | 99 | ||
| 97 | iwlagn_tx_cmd_protection(priv, info, fc, &tx_flags); | 100 | iwlagn_tx_cmd_protection(priv, info, fc, &tx_flags); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index ccba69b7f8a7..e0e9a3dfbc00 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
| @@ -2316,6 +2316,17 @@ static int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
| 2316 | return -EOPNOTSUPP; | 2316 | return -EOPNOTSUPP; |
| 2317 | } | 2317 | } |
| 2318 | 2318 | ||
| 2319 | switch (key->cipher) { | ||
| 2320 | case WLAN_CIPHER_SUITE_TKIP: | ||
| 2321 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | ||
| 2322 | /* fall through */ | ||
| 2323 | case WLAN_CIPHER_SUITE_CCMP: | ||
| 2324 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | ||
| 2325 | break; | ||
| 2326 | default: | ||
| 2327 | break; | ||
| 2328 | } | ||
| 2329 | |||
| 2319 | /* | 2330 | /* |
| 2320 | * We could program these keys into the hardware as well, but we | 2331 | * We could program these keys into the hardware as well, but we |
| 2321 | * don't expect much multicast traffic in IBSS and having keys | 2332 | * don't expect much multicast traffic in IBSS and having keys |
| @@ -2599,21 +2610,9 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, | |||
| 2599 | 2610 | ||
| 2600 | /* Configure HT40 channels */ | 2611 | /* Configure HT40 channels */ |
| 2601 | ctx->ht.enabled = conf_is_ht(conf); | 2612 | ctx->ht.enabled = conf_is_ht(conf); |
| 2602 | if (ctx->ht.enabled) { | 2613 | if (ctx->ht.enabled) |
| 2603 | if (conf_is_ht40_minus(conf)) { | 2614 | iwlagn_config_ht40(conf, ctx); |
| 2604 | ctx->ht.extension_chan_offset = | 2615 | else |
| 2605 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; | ||
| 2606 | ctx->ht.is_40mhz = true; | ||
| 2607 | } else if (conf_is_ht40_plus(conf)) { | ||
| 2608 | ctx->ht.extension_chan_offset = | ||
| 2609 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
| 2610 | ctx->ht.is_40mhz = true; | ||
| 2611 | } else { | ||
| 2612 | ctx->ht.extension_chan_offset = | ||
| 2613 | IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
| 2614 | ctx->ht.is_40mhz = false; | ||
| 2615 | } | ||
| 2616 | } else | ||
| 2617 | ctx->ht.is_40mhz = false; | 2616 | ctx->ht.is_40mhz = false; |
| 2618 | 2617 | ||
| 2619 | if ((le16_to_cpu(ctx->staging.channel) != ch)) | 2618 | if ((le16_to_cpu(ctx->staging.channel) != ch)) |
| @@ -2851,6 +2850,9 @@ static int iwlagn_mac_tx_sync(struct ieee80211_hw *hw, | |||
| 2851 | int ret; | 2850 | int ret; |
| 2852 | u8 sta_id; | 2851 | u8 sta_id; |
| 2853 | 2852 | ||
| 2853 | if (ctx->ctxid != IWL_RXON_CTX_PAN) | ||
| 2854 | return 0; | ||
| 2855 | |||
| 2854 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 2856 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
| 2855 | mutex_lock(&priv->shrd->mutex); | 2857 | mutex_lock(&priv->shrd->mutex); |
| 2856 | 2858 | ||
| @@ -2899,6 +2901,9 @@ static void iwlagn_mac_finish_tx_sync(struct ieee80211_hw *hw, | |||
| 2899 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; | 2901 | struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; |
| 2900 | struct iwl_rxon_context *ctx = vif_priv->ctx; | 2902 | struct iwl_rxon_context *ctx = vif_priv->ctx; |
| 2901 | 2903 | ||
| 2904 | if (ctx->ctxid != IWL_RXON_CTX_PAN) | ||
| 2905 | return; | ||
| 2906 | |||
| 2902 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 2907 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
| 2903 | mutex_lock(&priv->shrd->mutex); | 2908 | mutex_lock(&priv->shrd->mutex); |
| 2904 | 2909 | ||
| @@ -3499,9 +3504,10 @@ MODULE_PARM_DESC(plcp_check, "Check plcp health (default: 1 [enabled])"); | |||
| 3499 | module_param_named(ack_check, iwlagn_mod_params.ack_check, bool, S_IRUGO); | 3504 | module_param_named(ack_check, iwlagn_mod_params.ack_check, bool, S_IRUGO); |
| 3500 | MODULE_PARM_DESC(ack_check, "Check ack health (default: 0 [disabled])"); | 3505 | MODULE_PARM_DESC(ack_check, "Check ack health (default: 0 [disabled])"); |
| 3501 | 3506 | ||
| 3502 | module_param_named(wd_disable, iwlagn_mod_params.wd_disable, bool, S_IRUGO); | 3507 | module_param_named(wd_disable, iwlagn_mod_params.wd_disable, int, S_IRUGO); |
| 3503 | MODULE_PARM_DESC(wd_disable, | 3508 | MODULE_PARM_DESC(wd_disable, |
| 3504 | "Disable stuck queue watchdog timer (default: 0 [enabled])"); | 3509 | "Disable stuck queue watchdog timer 0=system default, " |
| 3510 | "1=disable, 2=enable (default: 0)"); | ||
| 3505 | 3511 | ||
| 3506 | /* | 3512 | /* |
| 3507 | * set bt_coex_active to true, uCode will do kill/defer | 3513 | * set bt_coex_active to true, uCode will do kill/defer |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index 5b936ec1a541..3856abaea507 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
| @@ -86,6 +86,8 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
| 86 | struct ieee80211_vif *vif, | 86 | struct ieee80211_vif *vif, |
| 87 | struct ieee80211_bss_conf *bss_conf, | 87 | struct ieee80211_bss_conf *bss_conf, |
| 88 | u32 changes); | 88 | u32 changes); |
| 89 | void iwlagn_config_ht40(struct ieee80211_conf *conf, | ||
| 90 | struct iwl_rxon_context *ctx); | ||
| 89 | 91 | ||
| 90 | /* uCode */ | 92 | /* uCode */ |
| 91 | int iwlagn_rx_calib_result(struct iwl_priv *priv, | 93 | int iwlagn_rx_calib_result(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 001fdf140abb..fcf54160e4ed 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
| @@ -1810,11 +1810,23 @@ void iwl_setup_watchdog(struct iwl_priv *priv) | |||
| 1810 | { | 1810 | { |
| 1811 | unsigned int timeout = priv->cfg->base_params->wd_timeout; | 1811 | unsigned int timeout = priv->cfg->base_params->wd_timeout; |
| 1812 | 1812 | ||
| 1813 | if (timeout && !iwlagn_mod_params.wd_disable) | 1813 | if (!iwlagn_mod_params.wd_disable) { |
| 1814 | mod_timer(&priv->watchdog, | 1814 | /* use system default */ |
| 1815 | jiffies + msecs_to_jiffies(IWL_WD_TICK(timeout))); | 1815 | if (timeout && !priv->cfg->base_params->wd_disable) |
| 1816 | else | 1816 | mod_timer(&priv->watchdog, |
| 1817 | del_timer(&priv->watchdog); | 1817 | jiffies + |
| 1818 | msecs_to_jiffies(IWL_WD_TICK(timeout))); | ||
| 1819 | else | ||
| 1820 | del_timer(&priv->watchdog); | ||
| 1821 | } else { | ||
| 1822 | /* module parameter overwrite default configuration */ | ||
| 1823 | if (timeout && iwlagn_mod_params.wd_disable == 2) | ||
| 1824 | mod_timer(&priv->watchdog, | ||
| 1825 | jiffies + | ||
| 1826 | msecs_to_jiffies(IWL_WD_TICK(timeout))); | ||
| 1827 | else | ||
| 1828 | del_timer(&priv->watchdog); | ||
| 1829 | } | ||
| 1818 | } | 1830 | } |
| 1819 | 1831 | ||
| 1820 | /** | 1832 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 137da3380704..f2fc288f3dd3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
| @@ -113,6 +113,7 @@ struct iwl_lib_ops { | |||
| 113 | * @shadow_reg_enable: HW shadhow register bit | 113 | * @shadow_reg_enable: HW shadhow register bit |
| 114 | * @no_idle_support: do not support idle mode | 114 | * @no_idle_support: do not support idle mode |
| 115 | * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up | 115 | * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up |
| 116 | * wd_disable: disable watchdog timer | ||
| 116 | */ | 117 | */ |
| 117 | struct iwl_base_params { | 118 | struct iwl_base_params { |
| 118 | int eeprom_size; | 119 | int eeprom_size; |
| @@ -134,6 +135,7 @@ struct iwl_base_params { | |||
| 134 | const bool shadow_reg_enable; | 135 | const bool shadow_reg_enable; |
| 135 | const bool no_idle_support; | 136 | const bool no_idle_support; |
| 136 | const bool hd_v2; | 137 | const bool hd_v2; |
| 138 | const bool wd_disable; | ||
| 137 | }; | 139 | }; |
| 138 | /* | 140 | /* |
| 139 | * @advanced_bt_coexist: support advanced bt coexist | 141 | * @advanced_bt_coexist: support advanced bt coexist |
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h index 1f7a93c67c45..14eaf37ce3b1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-shared.h +++ b/drivers/net/wireless/iwlwifi/iwl-shared.h | |||
| @@ -120,7 +120,7 @@ extern struct iwl_mod_params iwlagn_mod_params; | |||
| 120 | * @restart_fw: restart firmware, default = 1 | 120 | * @restart_fw: restart firmware, default = 1 |
| 121 | * @plcp_check: enable plcp health check, default = true | 121 | * @plcp_check: enable plcp health check, default = true |
| 122 | * @ack_check: disable ack health check, default = false | 122 | * @ack_check: disable ack health check, default = false |
| 123 | * @wd_disable: enable stuck queue check, default = false | 123 | * @wd_disable: enable stuck queue check, default = 0 |
| 124 | * @bt_coex_active: enable bt coex, default = true | 124 | * @bt_coex_active: enable bt coex, default = true |
| 125 | * @led_mode: system default, default = 0 | 125 | * @led_mode: system default, default = 0 |
| 126 | * @no_sleep_autoadjust: disable autoadjust, default = true | 126 | * @no_sleep_autoadjust: disable autoadjust, default = true |
| @@ -141,7 +141,7 @@ struct iwl_mod_params { | |||
| 141 | int restart_fw; | 141 | int restart_fw; |
| 142 | bool plcp_check; | 142 | bool plcp_check; |
| 143 | bool ack_check; | 143 | bool ack_check; |
| 144 | bool wd_disable; | 144 | int wd_disable; |
| 145 | bool bt_coex_active; | 145 | bool bt_coex_active; |
| 146 | int led_mode; | 146 | int led_mode; |
| 147 | bool no_sleep_autoadjust; | 147 | bool no_sleep_autoadjust; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index ce918980e977..5f17ab8e76ba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | |||
| @@ -1197,9 +1197,7 @@ static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
| 1197 | iwl_print_hex_dump(trans, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); | 1197 | iwl_print_hex_dump(trans, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); |
| 1198 | 1198 | ||
| 1199 | /* Set up entry for this TFD in Tx byte-count array */ | 1199 | /* Set up entry for this TFD in Tx byte-count array */ |
| 1200 | if (is_agg) | 1200 | iwl_trans_txq_update_byte_cnt_tbl(trans, txq, le16_to_cpu(tx_cmd->len)); |
| 1201 | iwl_trans_txq_update_byte_cnt_tbl(trans, txq, | ||
| 1202 | le16_to_cpu(tx_cmd->len)); | ||
| 1203 | 1201 | ||
| 1204 | dma_sync_single_for_device(bus(trans)->dev, txcmd_phys, firstlen, | 1202 | dma_sync_single_for_device(bus(trans)->dev, txcmd_phys, firstlen, |
| 1205 | DMA_BIDIRECTIONAL); | 1203 | DMA_BIDIRECTIONAL); |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index ac278156d390..6e0a3eaecf70 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
| @@ -939,7 +939,6 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) | |||
| 939 | { | 939 | { |
| 940 | struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; | 940 | struct cmd_ctrl_node *cmd_node = NULL, *tmp_node = NULL; |
| 941 | unsigned long cmd_flags; | 941 | unsigned long cmd_flags; |
| 942 | unsigned long cmd_pending_q_flags; | ||
| 943 | unsigned long scan_pending_q_flags; | 942 | unsigned long scan_pending_q_flags; |
| 944 | uint16_t cancel_scan_cmd = false; | 943 | uint16_t cancel_scan_cmd = false; |
| 945 | 944 | ||
| @@ -949,12 +948,9 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) | |||
| 949 | cmd_node = adapter->curr_cmd; | 948 | cmd_node = adapter->curr_cmd; |
| 950 | cmd_node->wait_q_enabled = false; | 949 | cmd_node->wait_q_enabled = false; |
| 951 | cmd_node->cmd_flag |= CMD_F_CANCELED; | 950 | cmd_node->cmd_flag |= CMD_F_CANCELED; |
| 952 | spin_lock_irqsave(&adapter->cmd_pending_q_lock, | ||
| 953 | cmd_pending_q_flags); | ||
| 954 | list_del(&cmd_node->list); | ||
| 955 | spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, | ||
| 956 | cmd_pending_q_flags); | ||
| 957 | mwifiex_insert_cmd_to_free_q(adapter, cmd_node); | 951 | mwifiex_insert_cmd_to_free_q(adapter, cmd_node); |
| 952 | mwifiex_complete_cmd(adapter, adapter->curr_cmd); | ||
| 953 | adapter->curr_cmd = NULL; | ||
| 958 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); | 954 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); |
| 959 | } | 955 | } |
| 960 | 956 | ||
| @@ -981,7 +977,6 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter) | |||
| 981 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); | 977 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags); |
| 982 | } | 978 | } |
| 983 | adapter->cmd_wait_q.status = -1; | 979 | adapter->cmd_wait_q.status = -1; |
| 984 | mwifiex_complete_cmd(adapter, adapter->curr_cmd); | ||
| 985 | } | 980 | } |
| 986 | 981 | ||
| 987 | /* | 982 | /* |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c index 592a10ac5929..3b585aadabfc 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.c | |||
| @@ -569,7 +569,7 @@ static bool _rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
| 569 | } | 569 | } |
| 570 | case ERFSLEEP:{ | 570 | case ERFSLEEP:{ |
| 571 | if (ppsc->rfpwr_state == ERFOFF) | 571 | if (ppsc->rfpwr_state == ERFOFF) |
| 572 | break; | 572 | return false; |
| 573 | for (queue_id = 0, i = 0; | 573 | for (queue_id = 0, i = 0; |
| 574 | queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { | 574 | queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { |
| 575 | ring = &pcipriv->dev.tx_ring[queue_id]; | 575 | ring = &pcipriv->dev.tx_ring[queue_id]; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c index 72852900df84..e49cf2244c75 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/phy.c | |||
| @@ -548,7 +548,7 @@ static bool _rtl92cu_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
| 548 | break; | 548 | break; |
| 549 | case ERFSLEEP: | 549 | case ERFSLEEP: |
| 550 | if (ppsc->rfpwr_state == ERFOFF) | 550 | if (ppsc->rfpwr_state == ERFOFF) |
| 551 | break; | 551 | return false; |
| 552 | for (queue_id = 0, i = 0; | 552 | for (queue_id = 0, i = 0; |
| 553 | queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { | 553 | queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { |
| 554 | ring = &pcipriv->dev.tx_ring[queue_id]; | 554 | ring = &pcipriv->dev.tx_ring[queue_id]; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c index 3ac7af1c5509..0883349e1c83 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c | |||
| @@ -3374,7 +3374,7 @@ bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
| 3374 | break; | 3374 | break; |
| 3375 | case ERFSLEEP: | 3375 | case ERFSLEEP: |
| 3376 | if (ppsc->rfpwr_state == ERFOFF) | 3376 | if (ppsc->rfpwr_state == ERFOFF) |
| 3377 | break; | 3377 | return false; |
| 3378 | 3378 | ||
| 3379 | for (queue_id = 0, i = 0; | 3379 | for (queue_id = 0, i = 0; |
| 3380 | queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { | 3380 | queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c index f27171af979c..f10ac1ad9087 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c | |||
| @@ -602,7 +602,7 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw, | |||
| 602 | } | 602 | } |
| 603 | case ERFSLEEP: | 603 | case ERFSLEEP: |
| 604 | if (ppsc->rfpwr_state == ERFOFF) | 604 | if (ppsc->rfpwr_state == ERFOFF) |
| 605 | break; | 605 | return false; |
| 606 | 606 | ||
| 607 | for (queue_id = 0, i = 0; | 607 | for (queue_id = 0, i = 0; |
| 608 | queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { | 608 | queue_id < RTL_PCI_MAX_TX_QUEUE_COUNT;) { |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 1ae270eed51a..15e332d08c8d 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -1668,7 +1668,7 @@ static int __init netback_init(void) | |||
| 1668 | "netback/%u", group); | 1668 | "netback/%u", group); |
| 1669 | 1669 | ||
| 1670 | if (IS_ERR(netbk->task)) { | 1670 | if (IS_ERR(netbk->task)) { |
| 1671 | printk(KERN_ALERT "kthread_run() fails at netback\n"); | 1671 | printk(KERN_ALERT "kthread_create() fails at netback\n"); |
| 1672 | del_timer(&netbk->net_timer); | 1672 | del_timer(&netbk->net_timer); |
| 1673 | rc = PTR_ERR(netbk->task); | 1673 | rc = PTR_ERR(netbk->task); |
| 1674 | goto failed_init; | 1674 | goto failed_init; |
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 19c0115092dd..0f0cfa3bca30 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
| @@ -26,11 +26,6 @@ | |||
| 26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
| 27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 28 | 28 | ||
| 29 | /* For archs that don't support NO_IRQ (such as x86), provide a dummy value */ | ||
| 30 | #ifndef NO_IRQ | ||
| 31 | #define NO_IRQ 0 | ||
| 32 | #endif | ||
| 33 | |||
| 34 | /** | 29 | /** |
| 35 | * irq_of_parse_and_map - Parse and map an interrupt into linux virq space | 30 | * irq_of_parse_and_map - Parse and map an interrupt into linux virq space |
| 36 | * @device: Device node of the device whose interrupt is to be mapped | 31 | * @device: Device node of the device whose interrupt is to be mapped |
| @@ -44,7 +39,7 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index) | |||
| 44 | struct of_irq oirq; | 39 | struct of_irq oirq; |
| 45 | 40 | ||
| 46 | if (of_irq_map_one(dev, index, &oirq)) | 41 | if (of_irq_map_one(dev, index, &oirq)) |
| 47 | return NO_IRQ; | 42 | return 0; |
| 48 | 43 | ||
| 49 | return irq_create_of_mapping(oirq.controller, oirq.specifier, | 44 | return irq_create_of_mapping(oirq.controller, oirq.specifier, |
| 50 | oirq.size); | 45 | oirq.size); |
| @@ -345,7 +340,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) | |||
| 345 | 340 | ||
| 346 | /* Only dereference the resource if both the | 341 | /* Only dereference the resource if both the |
| 347 | * resource and the irq are valid. */ | 342 | * resource and the irq are valid. */ |
| 348 | if (r && irq != NO_IRQ) { | 343 | if (r && irq) { |
| 349 | r->start = r->end = irq; | 344 | r->start = r->end = irq; |
| 350 | r->flags = IORESOURCE_IRQ; | 345 | r->flags = IORESOURCE_IRQ; |
| 351 | r->name = dev->full_name; | 346 | r->name = dev->full_name; |
| @@ -363,7 +358,7 @@ int of_irq_count(struct device_node *dev) | |||
| 363 | { | 358 | { |
| 364 | int nr = 0; | 359 | int nr = 0; |
| 365 | 360 | ||
| 366 | while (of_irq_to_resource(dev, nr, NULL) != NO_IRQ) | 361 | while (of_irq_to_resource(dev, nr, NULL)) |
| 367 | nr++; | 362 | nr++; |
| 368 | 363 | ||
| 369 | return nr; | 364 | return nr; |
| @@ -383,7 +378,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res, | |||
| 383 | int i; | 378 | int i; |
| 384 | 379 | ||
| 385 | for (i = 0; i < nr_irqs; i++, res++) | 380 | for (i = 0; i < nr_irqs; i++, res++) |
| 386 | if (of_irq_to_resource(dev, i, res) == NO_IRQ) | 381 | if (!of_irq_to_resource(dev, i, res)) |
| 387 | break; | 382 | break; |
| 388 | 383 | ||
| 389 | return i; | 384 | return i; |
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index dccd8636095c..f8c752e408a6 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c | |||
| @@ -239,26 +239,45 @@ int oprofile_set_ulong(unsigned long *addr, unsigned long val) | |||
| 239 | return err; | 239 | return err; |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | static int timer_mode; | ||
| 243 | |||
| 242 | static int __init oprofile_init(void) | 244 | static int __init oprofile_init(void) |
| 243 | { | 245 | { |
| 244 | int err; | 246 | int err; |
| 245 | 247 | ||
| 248 | /* always init architecture to setup backtrace support */ | ||
| 246 | err = oprofile_arch_init(&oprofile_ops); | 249 | err = oprofile_arch_init(&oprofile_ops); |
| 247 | if (err < 0 || timer) { | 250 | |
| 248 | printk(KERN_INFO "oprofile: using timer interrupt.\n"); | 251 | timer_mode = err || timer; /* fall back to timer mode on errors */ |
| 252 | if (timer_mode) { | ||
| 253 | if (!err) | ||
| 254 | oprofile_arch_exit(); | ||
| 249 | err = oprofile_timer_init(&oprofile_ops); | 255 | err = oprofile_timer_init(&oprofile_ops); |
| 250 | if (err) | 256 | if (err) |
| 251 | return err; | 257 | return err; |
| 252 | } | 258 | } |
| 253 | return oprofilefs_register(); | 259 | |
| 260 | err = oprofilefs_register(); | ||
| 261 | if (!err) | ||
| 262 | return 0; | ||
| 263 | |||
| 264 | /* failed */ | ||
| 265 | if (timer_mode) | ||
| 266 | oprofile_timer_exit(); | ||
| 267 | else | ||
| 268 | oprofile_arch_exit(); | ||
| 269 | |||
| 270 | return err; | ||
| 254 | } | 271 | } |
| 255 | 272 | ||
| 256 | 273 | ||
| 257 | static void __exit oprofile_exit(void) | 274 | static void __exit oprofile_exit(void) |
| 258 | { | 275 | { |
| 259 | oprofile_timer_exit(); | ||
| 260 | oprofilefs_unregister(); | 276 | oprofilefs_unregister(); |
| 261 | oprofile_arch_exit(); | 277 | if (timer_mode) |
| 278 | oprofile_timer_exit(); | ||
| 279 | else | ||
| 280 | oprofile_arch_exit(); | ||
| 262 | } | 281 | } |
| 263 | 282 | ||
| 264 | 283 | ||
diff --git a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c index 89f63456646f..84a208dbed93 100644 --- a/drivers/oprofile/oprofile_files.c +++ b/drivers/oprofile/oprofile_files.c | |||
| @@ -45,7 +45,7 @@ static ssize_t timeout_write(struct file *file, char const __user *buf, | |||
| 45 | return -EINVAL; | 45 | return -EINVAL; |
| 46 | 46 | ||
| 47 | retval = oprofilefs_ulong_from_user(&val, buf, count); | 47 | retval = oprofilefs_ulong_from_user(&val, buf, count); |
| 48 | if (retval) | 48 | if (retval <= 0) |
| 49 | return retval; | 49 | return retval; |
| 50 | 50 | ||
| 51 | retval = oprofile_set_timeout(val); | 51 | retval = oprofile_set_timeout(val); |
| @@ -84,7 +84,7 @@ static ssize_t depth_write(struct file *file, char const __user *buf, size_t cou | |||
| 84 | return -EINVAL; | 84 | return -EINVAL; |
| 85 | 85 | ||
| 86 | retval = oprofilefs_ulong_from_user(&val, buf, count); | 86 | retval = oprofilefs_ulong_from_user(&val, buf, count); |
| 87 | if (retval) | 87 | if (retval <= 0) |
| 88 | return retval; | 88 | return retval; |
| 89 | 89 | ||
| 90 | retval = oprofile_set_ulong(&oprofile_backtrace_depth, val); | 90 | retval = oprofile_set_ulong(&oprofile_backtrace_depth, val); |
| @@ -141,9 +141,10 @@ static ssize_t enable_write(struct file *file, char const __user *buf, size_t co | |||
| 141 | return -EINVAL; | 141 | return -EINVAL; |
| 142 | 142 | ||
| 143 | retval = oprofilefs_ulong_from_user(&val, buf, count); | 143 | retval = oprofilefs_ulong_from_user(&val, buf, count); |
| 144 | if (retval) | 144 | if (retval <= 0) |
| 145 | return retval; | 145 | return retval; |
| 146 | 146 | ||
| 147 | retval = 0; | ||
| 147 | if (val) | 148 | if (val) |
| 148 | retval = oprofile_start(); | 149 | retval = oprofile_start(); |
| 149 | else | 150 | else |
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index d0de6cc2d7a5..2f0aa0f700e6 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c | |||
| @@ -60,6 +60,13 @@ ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user *buf, size_t cou | |||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | /* | ||
| 64 | * Note: If oprofilefs_ulong_from_user() returns 0, then *val remains | ||
| 65 | * unchanged and might be uninitialized. This follows write syscall | ||
| 66 | * implementation when count is zero: "If count is zero ... [and if] | ||
| 67 | * no errors are detected, 0 will be returned without causing any | ||
| 68 | * other effect." (man 2 write) | ||
| 69 | */ | ||
| 63 | int oprofilefs_ulong_from_user(unsigned long *val, char const __user *buf, size_t count) | 70 | int oprofilefs_ulong_from_user(unsigned long *val, char const __user *buf, size_t count) |
| 64 | { | 71 | { |
| 65 | char tmpbuf[TMPBUFSIZE]; | 72 | char tmpbuf[TMPBUFSIZE]; |
| @@ -79,7 +86,7 @@ int oprofilefs_ulong_from_user(unsigned long *val, char const __user *buf, size_ | |||
| 79 | raw_spin_lock_irqsave(&oprofilefs_lock, flags); | 86 | raw_spin_lock_irqsave(&oprofilefs_lock, flags); |
| 80 | *val = simple_strtoul(tmpbuf, NULL, 0); | 87 | *val = simple_strtoul(tmpbuf, NULL, 0); |
| 81 | raw_spin_unlock_irqrestore(&oprofilefs_lock, flags); | 88 | raw_spin_unlock_irqrestore(&oprofilefs_lock, flags); |
| 82 | return 0; | 89 | return count; |
| 83 | } | 90 | } |
| 84 | 91 | ||
| 85 | 92 | ||
| @@ -99,7 +106,7 @@ static ssize_t ulong_write_file(struct file *file, char const __user *buf, size_ | |||
| 99 | return -EINVAL; | 106 | return -EINVAL; |
| 100 | 107 | ||
| 101 | retval = oprofilefs_ulong_from_user(&value, buf, count); | 108 | retval = oprofilefs_ulong_from_user(&value, buf, count); |
| 102 | if (retval) | 109 | if (retval <= 0) |
| 103 | return retval; | 110 | return retval; |
| 104 | 111 | ||
| 105 | retval = oprofile_set_ulong(file->private_data, value); | 112 | retval = oprofile_set_ulong(file->private_data, value); |
diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c index 3ef44624f510..878fba126582 100644 --- a/drivers/oprofile/timer_int.c +++ b/drivers/oprofile/timer_int.c | |||
| @@ -110,6 +110,7 @@ int oprofile_timer_init(struct oprofile_operations *ops) | |||
| 110 | ops->start = oprofile_hrtimer_start; | 110 | ops->start = oprofile_hrtimer_start; |
| 111 | ops->stop = oprofile_hrtimer_stop; | 111 | ops->stop = oprofile_hrtimer_stop; |
| 112 | ops->cpu_type = "timer"; | 112 | ops->cpu_type = "timer"; |
| 113 | printk(KERN_INFO "oprofile: using timer interrupt.\n"); | ||
| 113 | return 0; | 114 | return 0; |
| 114 | } | 115 | } |
| 115 | 116 | ||
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c index 7ec56fb0bd78..b0dd08e6a9da 100644 --- a/drivers/pci/ats.c +++ b/drivers/pci/ats.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/export.h> | 13 | #include <linux/export.h> |
| 14 | #include <linux/pci-ats.h> | 14 | #include <linux/pci-ats.h> |
| 15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
| 16 | #include <linux/slab.h> | ||
| 16 | 17 | ||
| 17 | #include "pci.h" | 18 | #include "pci.h" |
| 18 | 19 | ||
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index fce1c54a0c8d..9ddf69e3bbef 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
| @@ -132,6 +132,18 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
| 132 | if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle)) | 132 | if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle)) |
| 133 | return AE_OK; | 133 | return AE_OK; |
| 134 | 134 | ||
| 135 | pdev = pbus->self; | ||
| 136 | if (pdev && pci_is_pcie(pdev)) { | ||
| 137 | tmp = acpi_find_root_bridge_handle(pdev); | ||
| 138 | if (tmp) { | ||
| 139 | struct acpi_pci_root *root = acpi_pci_find_root(tmp); | ||
| 140 | |||
| 141 | if (root && (root->osc_control_set & | ||
| 142 | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)) | ||
| 143 | return AE_OK; | ||
| 144 | } | ||
| 145 | } | ||
| 146 | |||
| 135 | acpi_evaluate_integer(handle, "_ADR", NULL, &adr); | 147 | acpi_evaluate_integer(handle, "_ADR", NULL, &adr); |
| 136 | device = (adr >> 16) & 0xffff; | 148 | device = (adr >> 16) & 0xffff; |
| 137 | function = adr & 0xffff; | 149 | function = adr & 0xffff; |
| @@ -213,7 +225,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
| 213 | 225 | ||
| 214 | pdev = pci_get_slot(pbus, PCI_DEVFN(device, function)); | 226 | pdev = pci_get_slot(pbus, PCI_DEVFN(device, function)); |
| 215 | if (pdev) { | 227 | if (pdev) { |
| 216 | pdev->current_state = PCI_D0; | ||
| 217 | slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); | 228 | slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); |
| 218 | pci_dev_put(pdev); | 229 | pci_dev_put(pdev); |
| 219 | } | 230 | } |
| @@ -459,17 +470,8 @@ static int add_bridge(acpi_handle handle) | |||
| 459 | { | 470 | { |
| 460 | acpi_status status; | 471 | acpi_status status; |
| 461 | unsigned long long tmp; | 472 | unsigned long long tmp; |
| 462 | struct acpi_pci_root *root; | ||
| 463 | acpi_handle dummy_handle; | 473 | acpi_handle dummy_handle; |
| 464 | 474 | ||
| 465 | /* | ||
| 466 | * We shouldn't use this bridge if PCIe native hotplug control has been | ||
| 467 | * granted by the BIOS for it. | ||
| 468 | */ | ||
| 469 | root = acpi_pci_find_root(handle); | ||
| 470 | if (root && (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)) | ||
| 471 | return -ENODEV; | ||
| 472 | |||
| 473 | /* if the bridge doesn't have _STA, we assume it is always there */ | 475 | /* if the bridge doesn't have _STA, we assume it is always there */ |
| 474 | status = acpi_get_handle(handle, "_STA", &dummy_handle); | 476 | status = acpi_get_handle(handle, "_STA", &dummy_handle); |
| 475 | if (ACPI_SUCCESS(status)) { | 477 | if (ACPI_SUCCESS(status)) { |
| @@ -1385,19 +1387,11 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, | |||
| 1385 | static acpi_status | 1387 | static acpi_status |
| 1386 | find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | 1388 | find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) |
| 1387 | { | 1389 | { |
| 1388 | struct acpi_pci_root *root; | ||
| 1389 | int *count = (int *)context; | 1390 | int *count = (int *)context; |
| 1390 | 1391 | ||
| 1391 | if (!acpi_is_root_bridge(handle)) | 1392 | if (!acpi_is_root_bridge(handle)) |
| 1392 | return AE_OK; | 1393 | return AE_OK; |
| 1393 | 1394 | ||
| 1394 | root = acpi_pci_find_root(handle); | ||
| 1395 | if (!root) | ||
| 1396 | return AE_OK; | ||
| 1397 | |||
| 1398 | if (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL) | ||
| 1399 | return AE_OK; | ||
| 1400 | |||
| 1401 | (*count)++; | 1395 | (*count)++; |
| 1402 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | 1396 | acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, |
| 1403 | handle_hotplug_event_bridge, NULL); | 1397 | handle_hotplug_event_bridge, NULL); |
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index b82c155d7b37..1969a3ee3058 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c | |||
| @@ -283,6 +283,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) | |||
| 283 | struct resource *res; | 283 | struct resource *res; |
| 284 | struct pci_dev *pdev; | 284 | struct pci_dev *pdev; |
| 285 | struct pci_sriov *iov = dev->sriov; | 285 | struct pci_sriov *iov = dev->sriov; |
| 286 | int bars = 0; | ||
| 286 | 287 | ||
| 287 | if (!nr_virtfn) | 288 | if (!nr_virtfn) |
| 288 | return 0; | 289 | return 0; |
| @@ -307,6 +308,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) | |||
| 307 | 308 | ||
| 308 | nres = 0; | 309 | nres = 0; |
| 309 | for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { | 310 | for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { |
| 311 | bars |= (1 << (i + PCI_IOV_RESOURCES)); | ||
| 310 | res = dev->resource + PCI_IOV_RESOURCES + i; | 312 | res = dev->resource + PCI_IOV_RESOURCES + i; |
| 311 | if (res->parent) | 313 | if (res->parent) |
| 312 | nres++; | 314 | nres++; |
| @@ -324,6 +326,11 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) | |||
| 324 | return -ENOMEM; | 326 | return -ENOMEM; |
| 325 | } | 327 | } |
| 326 | 328 | ||
| 329 | if (pci_enable_resources(dev, bars)) { | ||
| 330 | dev_err(&dev->dev, "SR-IOV: IOV BARS not allocated\n"); | ||
| 331 | return -ENOMEM; | ||
| 332 | } | ||
| 333 | |||
| 327 | if (iov->link != dev->devfn) { | 334 | if (iov->link != dev->devfn) { |
| 328 | pdev = pci_get_slot(dev->bus, iov->link); | 335 | pdev = pci_get_slot(dev->bus, iov->link); |
| 329 | if (!pdev) | 336 | if (!pdev) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6f45a73c6e9f..6d4a5319148d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -664,6 +664,9 @@ static int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state) | |||
| 664 | error = platform_pci_set_power_state(dev, state); | 664 | error = platform_pci_set_power_state(dev, state); |
| 665 | if (!error) | 665 | if (!error) |
| 666 | pci_update_current_state(dev, state); | 666 | pci_update_current_state(dev, state); |
| 667 | /* Fall back to PCI_D0 if native PM is not supported */ | ||
| 668 | if (!dev->pm_cap) | ||
| 669 | dev->current_state = PCI_D0; | ||
| 667 | } else { | 670 | } else { |
| 668 | error = -ENODEV; | 671 | error = -ENODEV; |
| 669 | /* Fall back to PCI_D0 if native PM is not supported */ | 672 | /* Fall back to PCI_D0 if native PM is not supported */ |
| @@ -1126,7 +1129,11 @@ static int __pci_enable_device_flags(struct pci_dev *dev, | |||
| 1126 | if (atomic_add_return(1, &dev->enable_cnt) > 1) | 1129 | if (atomic_add_return(1, &dev->enable_cnt) > 1) |
| 1127 | return 0; /* already enabled */ | 1130 | return 0; /* already enabled */ |
| 1128 | 1131 | ||
| 1129 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) | 1132 | /* only skip sriov related */ |
| 1133 | for (i = 0; i <= PCI_ROM_RESOURCE; i++) | ||
| 1134 | if (dev->resource[i].flags & flags) | ||
| 1135 | bars |= (1 << i); | ||
| 1136 | for (i = PCI_BRIDGE_RESOURCES; i < DEVICE_COUNT_RESOURCE; i++) | ||
| 1130 | if (dev->resource[i].flags & flags) | 1137 | if (dev->resource[i].flags & flags) |
| 1131 | bars |= (1 << i); | 1138 | bars |= (1 << i); |
| 1132 | 1139 | ||
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 13ef8c37471d..dcdc1f4a4624 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
| @@ -121,6 +121,7 @@ struct toshiba_acpi_dev { | |||
| 121 | int illumination_supported:1; | 121 | int illumination_supported:1; |
| 122 | int video_supported:1; | 122 | int video_supported:1; |
| 123 | int fan_supported:1; | 123 | int fan_supported:1; |
| 124 | int system_event_supported:1; | ||
| 124 | 125 | ||
| 125 | struct mutex mutex; | 126 | struct mutex mutex; |
| 126 | }; | 127 | }; |
| @@ -724,7 +725,7 @@ static int keys_proc_show(struct seq_file *m, void *v) | |||
| 724 | u32 hci_result; | 725 | u32 hci_result; |
| 725 | u32 value; | 726 | u32 value; |
| 726 | 727 | ||
| 727 | if (!dev->key_event_valid) { | 728 | if (!dev->key_event_valid && dev->system_event_supported) { |
| 728 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); | 729 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); |
| 729 | if (hci_result == HCI_SUCCESS) { | 730 | if (hci_result == HCI_SUCCESS) { |
| 730 | dev->key_event_valid = 1; | 731 | dev->key_event_valid = 1; |
| @@ -964,6 +965,8 @@ static int __devinit toshiba_acpi_add(struct acpi_device *acpi_dev) | |||
| 964 | 965 | ||
| 965 | /* enable event fifo */ | 966 | /* enable event fifo */ |
| 966 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); | 967 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); |
| 968 | if (hci_result == HCI_SUCCESS) | ||
| 969 | dev->system_event_supported = 1; | ||
| 967 | 970 | ||
| 968 | props.type = BACKLIGHT_PLATFORM; | 971 | props.type = BACKLIGHT_PLATFORM; |
| 969 | props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | 972 | props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; |
| @@ -1032,12 +1035,15 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event) | |||
| 1032 | { | 1035 | { |
| 1033 | struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev); | 1036 | struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev); |
| 1034 | u32 hci_result, value; | 1037 | u32 hci_result, value; |
| 1038 | int retries = 3; | ||
| 1035 | 1039 | ||
| 1036 | if (event != 0x80) | 1040 | if (!dev->system_event_supported || event != 0x80) |
| 1037 | return; | 1041 | return; |
| 1042 | |||
| 1038 | do { | 1043 | do { |
| 1039 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); | 1044 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); |
| 1040 | if (hci_result == HCI_SUCCESS) { | 1045 | switch (hci_result) { |
| 1046 | case HCI_SUCCESS: | ||
| 1041 | if (value == 0x100) | 1047 | if (value == 0x100) |
| 1042 | continue; | 1048 | continue; |
| 1043 | /* act on key press; ignore key release */ | 1049 | /* act on key press; ignore key release */ |
| @@ -1049,14 +1055,19 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event) | |||
| 1049 | pr_info("Unknown key %x\n", | 1055 | pr_info("Unknown key %x\n", |
| 1050 | value); | 1056 | value); |
| 1051 | } | 1057 | } |
| 1052 | } else if (hci_result == HCI_NOT_SUPPORTED) { | 1058 | break; |
| 1059 | case HCI_NOT_SUPPORTED: | ||
| 1053 | /* This is a workaround for an unresolved issue on | 1060 | /* This is a workaround for an unresolved issue on |
| 1054 | * some machines where system events sporadically | 1061 | * some machines where system events sporadically |
| 1055 | * become disabled. */ | 1062 | * become disabled. */ |
| 1056 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); | 1063 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); |
| 1057 | pr_notice("Re-enabled hotkeys\n"); | 1064 | pr_notice("Re-enabled hotkeys\n"); |
| 1065 | /* fall through */ | ||
| 1066 | default: | ||
| 1067 | retries--; | ||
| 1068 | break; | ||
| 1058 | } | 1069 | } |
| 1059 | } while (hci_result != HCI_EMPTY); | 1070 | } while (retries && hci_result != HCI_EMPTY); |
| 1060 | } | 1071 | } |
| 1061 | 1072 | ||
| 1062 | 1073 | ||
diff --git a/drivers/power/intel_mid_battery.c b/drivers/power/intel_mid_battery.c index cffcb7c00b00..01fa671ec97f 100644 --- a/drivers/power/intel_mid_battery.c +++ b/drivers/power/intel_mid_battery.c | |||
| @@ -61,7 +61,8 @@ MODULE_PARM_DESC(debug, "Flag to enable PMIC Battery debug messages."); | |||
| 61 | #define PMIC_BATT_CHR_SBATDET_MASK (1 << 5) | 61 | #define PMIC_BATT_CHR_SBATDET_MASK (1 << 5) |
| 62 | #define PMIC_BATT_CHR_SDCLMT_MASK (1 << 6) | 62 | #define PMIC_BATT_CHR_SDCLMT_MASK (1 << 6) |
| 63 | #define PMIC_BATT_CHR_SUSBOVP_MASK (1 << 7) | 63 | #define PMIC_BATT_CHR_SUSBOVP_MASK (1 << 7) |
| 64 | #define PMIC_BATT_CHR_EXCPT_MASK 0xC6 | 64 | #define PMIC_BATT_CHR_EXCPT_MASK 0x86 |
| 65 | |||
| 65 | #define PMIC_BATT_ADC_ACCCHRG_MASK (1 << 31) | 66 | #define PMIC_BATT_ADC_ACCCHRG_MASK (1 << 31) |
| 66 | #define PMIC_BATT_ADC_ACCCHRGVAL_MASK 0x7FFFFFFF | 67 | #define PMIC_BATT_ADC_ACCCHRGVAL_MASK 0x7FFFFFFF |
| 67 | 68 | ||
| @@ -304,11 +305,6 @@ static void pmic_battery_read_status(struct pmic_power_module_info *pbi) | |||
| 304 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; | 305 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; |
| 305 | pmic_battery_log_event(BATT_EVENT_BATOVP_EXCPT); | 306 | pmic_battery_log_event(BATT_EVENT_BATOVP_EXCPT); |
| 306 | batt_exception = 1; | 307 | batt_exception = 1; |
| 307 | } else if (r8 & PMIC_BATT_CHR_SDCLMT_MASK) { | ||
| 308 | pbi->batt_health = POWER_SUPPLY_HEALTH_OVERVOLTAGE; | ||
| 309 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; | ||
| 310 | pmic_battery_log_event(BATT_EVENT_DCLMT_EXCPT); | ||
| 311 | batt_exception = 1; | ||
| 312 | } else if (r8 & PMIC_BATT_CHR_STEMP_MASK) { | 308 | } else if (r8 & PMIC_BATT_CHR_STEMP_MASK) { |
| 313 | pbi->batt_health = POWER_SUPPLY_HEALTH_OVERHEAT; | 309 | pbi->batt_health = POWER_SUPPLY_HEALTH_OVERHEAT; |
| 314 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; | 310 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; |
| @@ -316,6 +312,10 @@ static void pmic_battery_read_status(struct pmic_power_module_info *pbi) | |||
| 316 | batt_exception = 1; | 312 | batt_exception = 1; |
| 317 | } else { | 313 | } else { |
| 318 | pbi->batt_health = POWER_SUPPLY_HEALTH_GOOD; | 314 | pbi->batt_health = POWER_SUPPLY_HEALTH_GOOD; |
| 315 | if (r8 & PMIC_BATT_CHR_SDCLMT_MASK) { | ||
| 316 | /* PMIC will change charging current automatically */ | ||
| 317 | pmic_battery_log_event(BATT_EVENT_DCLMT_EXCPT); | ||
| 318 | } | ||
| 319 | } | 319 | } |
| 320 | } | 320 | } |
| 321 | 321 | ||
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index cf3f9997546d..10451a15e828 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c | |||
| @@ -101,7 +101,9 @@ static s32 scaled_ppm_to_ppb(long ppm) | |||
| 101 | 101 | ||
| 102 | static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp) | 102 | static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp) |
| 103 | { | 103 | { |
| 104 | return 1; /* always round timer functions to one nanosecond */ | 104 | tp->tv_sec = 0; |
| 105 | tp->tv_nsec = 1; | ||
| 106 | return 0; | ||
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp) | 109 | static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp) |
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c index 5225930a10cd..691b1ab1a3d0 100644 --- a/drivers/rapidio/devices/tsi721.c +++ b/drivers/rapidio/devices/tsi721.c | |||
| @@ -851,14 +851,12 @@ static int tsi721_doorbell_init(struct tsi721_device *priv) | |||
| 851 | INIT_WORK(&priv->idb_work, tsi721_db_dpc); | 851 | INIT_WORK(&priv->idb_work, tsi721_db_dpc); |
| 852 | 852 | ||
| 853 | /* Allocate buffer for inbound doorbells queue */ | 853 | /* Allocate buffer for inbound doorbells queue */ |
| 854 | priv->idb_base = dma_alloc_coherent(&priv->pdev->dev, | 854 | priv->idb_base = dma_zalloc_coherent(&priv->pdev->dev, |
| 855 | IDB_QSIZE * TSI721_IDB_ENTRY_SIZE, | 855 | IDB_QSIZE * TSI721_IDB_ENTRY_SIZE, |
| 856 | &priv->idb_dma, GFP_KERNEL); | 856 | &priv->idb_dma, GFP_KERNEL); |
| 857 | if (!priv->idb_base) | 857 | if (!priv->idb_base) |
| 858 | return -ENOMEM; | 858 | return -ENOMEM; |
| 859 | 859 | ||
| 860 | memset(priv->idb_base, 0, IDB_QSIZE * TSI721_IDB_ENTRY_SIZE); | ||
| 861 | |||
| 862 | dev_dbg(&priv->pdev->dev, "Allocated IDB buffer @ %p (phys = %llx)\n", | 860 | dev_dbg(&priv->pdev->dev, "Allocated IDB buffer @ %p (phys = %llx)\n", |
| 863 | priv->idb_base, (unsigned long long)priv->idb_dma); | 861 | priv->idb_base, (unsigned long long)priv->idb_dma); |
| 864 | 862 | ||
| @@ -904,7 +902,7 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) | |||
| 904 | */ | 902 | */ |
| 905 | 903 | ||
| 906 | /* Allocate space for DMA descriptors */ | 904 | /* Allocate space for DMA descriptors */ |
| 907 | bd_ptr = dma_alloc_coherent(&priv->pdev->dev, | 905 | bd_ptr = dma_zalloc_coherent(&priv->pdev->dev, |
| 908 | bd_num * sizeof(struct tsi721_dma_desc), | 906 | bd_num * sizeof(struct tsi721_dma_desc), |
| 909 | &bd_phys, GFP_KERNEL); | 907 | &bd_phys, GFP_KERNEL); |
| 910 | if (!bd_ptr) | 908 | if (!bd_ptr) |
| @@ -913,8 +911,6 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) | |||
| 913 | priv->bdma[chnum].bd_phys = bd_phys; | 911 | priv->bdma[chnum].bd_phys = bd_phys; |
| 914 | priv->bdma[chnum].bd_base = bd_ptr; | 912 | priv->bdma[chnum].bd_base = bd_ptr; |
| 915 | 913 | ||
| 916 | memset(bd_ptr, 0, bd_num * sizeof(struct tsi721_dma_desc)); | ||
| 917 | |||
| 918 | dev_dbg(&priv->pdev->dev, "DMA descriptors @ %p (phys = %llx)\n", | 914 | dev_dbg(&priv->pdev->dev, "DMA descriptors @ %p (phys = %llx)\n", |
| 919 | bd_ptr, (unsigned long long)bd_phys); | 915 | bd_ptr, (unsigned long long)bd_phys); |
| 920 | 916 | ||
| @@ -922,7 +918,7 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) | |||
| 922 | sts_size = (bd_num >= TSI721_DMA_MINSTSSZ) ? | 918 | sts_size = (bd_num >= TSI721_DMA_MINSTSSZ) ? |
| 923 | bd_num : TSI721_DMA_MINSTSSZ; | 919 | bd_num : TSI721_DMA_MINSTSSZ; |
| 924 | sts_size = roundup_pow_of_two(sts_size); | 920 | sts_size = roundup_pow_of_two(sts_size); |
| 925 | sts_ptr = dma_alloc_coherent(&priv->pdev->dev, | 921 | sts_ptr = dma_zalloc_coherent(&priv->pdev->dev, |
| 926 | sts_size * sizeof(struct tsi721_dma_sts), | 922 | sts_size * sizeof(struct tsi721_dma_sts), |
| 927 | &sts_phys, GFP_KERNEL); | 923 | &sts_phys, GFP_KERNEL); |
| 928 | if (!sts_ptr) { | 924 | if (!sts_ptr) { |
| @@ -938,8 +934,6 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) | |||
| 938 | priv->bdma[chnum].sts_base = sts_ptr; | 934 | priv->bdma[chnum].sts_base = sts_ptr; |
| 939 | priv->bdma[chnum].sts_size = sts_size; | 935 | priv->bdma[chnum].sts_size = sts_size; |
| 940 | 936 | ||
| 941 | memset(sts_ptr, 0, sts_size); | ||
| 942 | |||
| 943 | dev_dbg(&priv->pdev->dev, | 937 | dev_dbg(&priv->pdev->dev, |
| 944 | "desc status FIFO @ %p (phys = %llx) size=0x%x\n", | 938 | "desc status FIFO @ %p (phys = %llx) size=0x%x\n", |
| 945 | sts_ptr, (unsigned long long)sts_phys, sts_size); | 939 | sts_ptr, (unsigned long long)sts_phys, sts_size); |
| @@ -1400,7 +1394,7 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id, | |||
| 1400 | 1394 | ||
| 1401 | /* Outbound message descriptor status FIFO allocation */ | 1395 | /* Outbound message descriptor status FIFO allocation */ |
| 1402 | priv->omsg_ring[mbox].sts_size = roundup_pow_of_two(entries + 1); | 1396 | priv->omsg_ring[mbox].sts_size = roundup_pow_of_two(entries + 1); |
| 1403 | priv->omsg_ring[mbox].sts_base = dma_alloc_coherent(&priv->pdev->dev, | 1397 | priv->omsg_ring[mbox].sts_base = dma_zalloc_coherent(&priv->pdev->dev, |
| 1404 | priv->omsg_ring[mbox].sts_size * | 1398 | priv->omsg_ring[mbox].sts_size * |
| 1405 | sizeof(struct tsi721_dma_sts), | 1399 | sizeof(struct tsi721_dma_sts), |
| 1406 | &priv->omsg_ring[mbox].sts_phys, GFP_KERNEL); | 1400 | &priv->omsg_ring[mbox].sts_phys, GFP_KERNEL); |
| @@ -1412,9 +1406,6 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id, | |||
| 1412 | goto out_desc; | 1406 | goto out_desc; |
| 1413 | } | 1407 | } |
| 1414 | 1408 | ||
| 1415 | memset(priv->omsg_ring[mbox].sts_base, 0, | ||
| 1416 | entries * sizeof(struct tsi721_dma_sts)); | ||
| 1417 | |||
| 1418 | /* | 1409 | /* |
| 1419 | * Configure Outbound Messaging Engine | 1410 | * Configure Outbound Messaging Engine |
| 1420 | */ | 1411 | */ |
| @@ -2116,8 +2107,8 @@ static int __devinit tsi721_setup_mport(struct tsi721_device *priv) | |||
| 2116 | INIT_LIST_HEAD(&mport->dbells); | 2107 | INIT_LIST_HEAD(&mport->dbells); |
| 2117 | 2108 | ||
| 2118 | rio_init_dbell_res(&mport->riores[RIO_DOORBELL_RESOURCE], 0, 0xffff); | 2109 | rio_init_dbell_res(&mport->riores[RIO_DOORBELL_RESOURCE], 0, 0xffff); |
| 2119 | rio_init_mbox_res(&mport->riores[RIO_INB_MBOX_RESOURCE], 0, 0); | 2110 | rio_init_mbox_res(&mport->riores[RIO_INB_MBOX_RESOURCE], 0, 3); |
| 2120 | rio_init_mbox_res(&mport->riores[RIO_OUTB_MBOX_RESOURCE], 0, 0); | 2111 | rio_init_mbox_res(&mport->riores[RIO_OUTB_MBOX_RESOURCE], 0, 3); |
| 2121 | strcpy(mport->name, "Tsi721 mport"); | 2112 | strcpy(mport->name, "Tsi721 mport"); |
| 2122 | 2113 | ||
| 2123 | /* Hook up interrupt handler */ | 2114 | /* Hook up interrupt handler */ |
| @@ -2163,7 +2154,7 @@ static int __devinit tsi721_probe(struct pci_dev *pdev, | |||
| 2163 | const struct pci_device_id *id) | 2154 | const struct pci_device_id *id) |
| 2164 | { | 2155 | { |
| 2165 | struct tsi721_device *priv; | 2156 | struct tsi721_device *priv; |
| 2166 | int i; | 2157 | int i, cap; |
| 2167 | int err; | 2158 | int err; |
| 2168 | u32 regval; | 2159 | u32 regval; |
| 2169 | 2160 | ||
| @@ -2271,10 +2262,20 @@ static int __devinit tsi721_probe(struct pci_dev *pdev, | |||
| 2271 | dev_info(&pdev->dev, "Unable to set consistent DMA mask\n"); | 2262 | dev_info(&pdev->dev, "Unable to set consistent DMA mask\n"); |
| 2272 | } | 2263 | } |
| 2273 | 2264 | ||
| 2274 | /* Clear "no snoop" and "relaxed ordering" bits. */ | 2265 | cap = pci_pcie_cap(pdev); |
| 2275 | pci_read_config_dword(pdev, 0x40 + PCI_EXP_DEVCTL, ®val); | 2266 | BUG_ON(cap == 0); |
| 2276 | regval &= ~(PCI_EXP_DEVCTL_RELAX_EN | PCI_EXP_DEVCTL_NOSNOOP_EN); | 2267 | |
| 2277 | pci_write_config_dword(pdev, 0x40 + PCI_EXP_DEVCTL, regval); | 2268 | /* Clear "no snoop" and "relaxed ordering" bits, use default MRRS. */ |
| 2269 | pci_read_config_dword(pdev, cap + PCI_EXP_DEVCTL, ®val); | ||
| 2270 | regval &= ~(PCI_EXP_DEVCTL_READRQ | PCI_EXP_DEVCTL_RELAX_EN | | ||
| 2271 | PCI_EXP_DEVCTL_NOSNOOP_EN); | ||
| 2272 | regval |= 0x2 << MAX_READ_REQUEST_SZ_SHIFT; | ||
| 2273 | pci_write_config_dword(pdev, cap + PCI_EXP_DEVCTL, regval); | ||
| 2274 | |||
| 2275 | /* Adjust PCIe completion timeout. */ | ||
| 2276 | pci_read_config_dword(pdev, cap + PCI_EXP_DEVCTL2, ®val); | ||
| 2277 | regval &= ~(0x0f); | ||
| 2278 | pci_write_config_dword(pdev, cap + PCI_EXP_DEVCTL2, regval | 0x2); | ||
| 2278 | 2279 | ||
| 2279 | /* | 2280 | /* |
| 2280 | * FIXUP: correct offsets of MSI-X tables in the MSI-X Capability Block | 2281 | * FIXUP: correct offsets of MSI-X tables in the MSI-X Capability Block |
diff --git a/drivers/rapidio/devices/tsi721.h b/drivers/rapidio/devices/tsi721.h index 58be4deb1402..822e54c394d5 100644 --- a/drivers/rapidio/devices/tsi721.h +++ b/drivers/rapidio/devices/tsi721.h | |||
| @@ -72,6 +72,8 @@ | |||
| 72 | #define TSI721_MSIXPBA_OFFSET 0x2a000 | 72 | #define TSI721_MSIXPBA_OFFSET 0x2a000 |
| 73 | #define TSI721_PCIECFG_EPCTL 0x400 | 73 | #define TSI721_PCIECFG_EPCTL 0x400 |
| 74 | 74 | ||
| 75 | #define MAX_READ_REQUEST_SZ_SHIFT 12 | ||
| 76 | |||
| 75 | /* | 77 | /* |
| 76 | * Event Management Registers | 78 | * Event Management Registers |
| 77 | */ | 79 | */ |
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index e8326f26fa2f..dc4c2748bbc3 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
| @@ -63,7 +63,7 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg) | |||
| 63 | */ | 63 | */ |
| 64 | delta = timespec_sub(old_system, old_rtc); | 64 | delta = timespec_sub(old_system, old_rtc); |
| 65 | delta_delta = timespec_sub(delta, old_delta); | 65 | delta_delta = timespec_sub(delta, old_delta); |
| 66 | if (abs(delta_delta.tv_sec) >= 2) { | 66 | if (delta_delta.tv_sec < -2 || delta_delta.tv_sec >= 2) { |
| 67 | /* | 67 | /* |
| 68 | * if delta_delta is too large, assume time correction | 68 | * if delta_delta is too large, assume time correction |
| 69 | * has occured and set old_delta to the current delta. | 69 | * has occured and set old_delta to the current delta. |
| @@ -97,9 +97,8 @@ static int rtc_resume(struct device *dev) | |||
| 97 | rtc_tm_to_time(&tm, &new_rtc.tv_sec); | 97 | rtc_tm_to_time(&tm, &new_rtc.tv_sec); |
| 98 | new_rtc.tv_nsec = 0; | 98 | new_rtc.tv_nsec = 0; |
| 99 | 99 | ||
| 100 | if (new_rtc.tv_sec <= old_rtc.tv_sec) { | 100 | if (new_rtc.tv_sec < old_rtc.tv_sec) { |
| 101 | if (new_rtc.tv_sec < old_rtc.tv_sec) | 101 | pr_debug("%s: time travel!\n", dev_name(&rtc->dev)); |
| 102 | pr_debug("%s: time travel!\n", dev_name(&rtc->dev)); | ||
| 103 | return 0; | 102 | return 0; |
| 104 | } | 103 | } |
| 105 | 104 | ||
| @@ -116,7 +115,8 @@ static int rtc_resume(struct device *dev) | |||
| 116 | sleep_time = timespec_sub(sleep_time, | 115 | sleep_time = timespec_sub(sleep_time, |
| 117 | timespec_sub(new_system, old_system)); | 116 | timespec_sub(new_system, old_system)); |
| 118 | 117 | ||
| 119 | timekeeping_inject_sleeptime(&sleep_time); | 118 | if (sleep_time.tv_sec >= 0) |
| 119 | timekeeping_inject_sleeptime(&sleep_time); | ||
| 120 | return 0; | 120 | return 0; |
| 121 | } | 121 | } |
| 122 | 122 | ||
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 8e286259a007..3bcc7cfcaba7 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
| @@ -73,6 +73,8 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm) | |||
| 73 | err = -EINVAL; | 73 | err = -EINVAL; |
| 74 | 74 | ||
| 75 | mutex_unlock(&rtc->ops_lock); | 75 | mutex_unlock(&rtc->ops_lock); |
| 76 | /* A timer might have just expired */ | ||
| 77 | schedule_work(&rtc->irqwork); | ||
| 76 | return err; | 78 | return err; |
| 77 | } | 79 | } |
| 78 | EXPORT_SYMBOL_GPL(rtc_set_time); | 80 | EXPORT_SYMBOL_GPL(rtc_set_time); |
| @@ -112,6 +114,8 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs) | |||
| 112 | err = -EINVAL; | 114 | err = -EINVAL; |
| 113 | 115 | ||
| 114 | mutex_unlock(&rtc->ops_lock); | 116 | mutex_unlock(&rtc->ops_lock); |
| 117 | /* A timer might have just expired */ | ||
| 118 | schedule_work(&rtc->irqwork); | ||
| 115 | 119 | ||
| 116 | return err; | 120 | return err; |
| 117 | } | 121 | } |
| @@ -319,6 +323,20 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
| 319 | } | 323 | } |
| 320 | EXPORT_SYMBOL_GPL(rtc_read_alarm); | 324 | EXPORT_SYMBOL_GPL(rtc_read_alarm); |
| 321 | 325 | ||
| 326 | static int ___rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | ||
| 327 | { | ||
| 328 | int err; | ||
| 329 | |||
| 330 | if (!rtc->ops) | ||
| 331 | err = -ENODEV; | ||
| 332 | else if (!rtc->ops->set_alarm) | ||
| 333 | err = -EINVAL; | ||
| 334 | else | ||
| 335 | err = rtc->ops->set_alarm(rtc->dev.parent, alarm); | ||
| 336 | |||
| 337 | return err; | ||
| 338 | } | ||
| 339 | |||
| 322 | static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | 340 | static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) |
| 323 | { | 341 | { |
| 324 | struct rtc_time tm; | 342 | struct rtc_time tm; |
| @@ -342,14 +360,7 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
| 342 | * over right here, before we set the alarm. | 360 | * over right here, before we set the alarm. |
| 343 | */ | 361 | */ |
| 344 | 362 | ||
| 345 | if (!rtc->ops) | 363 | return ___rtc_set_alarm(rtc, alarm); |
| 346 | err = -ENODEV; | ||
| 347 | else if (!rtc->ops->set_alarm) | ||
| 348 | err = -EINVAL; | ||
| 349 | else | ||
| 350 | err = rtc->ops->set_alarm(rtc->dev.parent, alarm); | ||
| 351 | |||
| 352 | return err; | ||
| 353 | } | 364 | } |
| 354 | 365 | ||
| 355 | int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | 366 | int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) |
| @@ -396,6 +407,8 @@ int rtc_initialize_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
| 396 | timerqueue_add(&rtc->timerqueue, &rtc->aie_timer.node); | 407 | timerqueue_add(&rtc->timerqueue, &rtc->aie_timer.node); |
| 397 | } | 408 | } |
| 398 | mutex_unlock(&rtc->ops_lock); | 409 | mutex_unlock(&rtc->ops_lock); |
| 410 | /* maybe that was in the past.*/ | ||
| 411 | schedule_work(&rtc->irqwork); | ||
| 399 | return err; | 412 | return err; |
| 400 | } | 413 | } |
| 401 | EXPORT_SYMBOL_GPL(rtc_initialize_alarm); | 414 | EXPORT_SYMBOL_GPL(rtc_initialize_alarm); |
| @@ -763,6 +776,20 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) | |||
| 763 | return 0; | 776 | return 0; |
| 764 | } | 777 | } |
| 765 | 778 | ||
| 779 | static void rtc_alarm_disable(struct rtc_device *rtc) | ||
| 780 | { | ||
| 781 | struct rtc_wkalrm alarm; | ||
| 782 | struct rtc_time tm; | ||
| 783 | |||
| 784 | __rtc_read_time(rtc, &tm); | ||
| 785 | |||
| 786 | alarm.time = rtc_ktime_to_tm(ktime_add(rtc_tm_to_ktime(tm), | ||
| 787 | ktime_set(300, 0))); | ||
| 788 | alarm.enabled = 0; | ||
| 789 | |||
| 790 | ___rtc_set_alarm(rtc, &alarm); | ||
| 791 | } | ||
| 792 | |||
| 766 | /** | 793 | /** |
| 767 | * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue | 794 | * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue |
| 768 | * @rtc rtc device | 795 | * @rtc rtc device |
| @@ -784,8 +811,10 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer) | |||
| 784 | struct rtc_wkalrm alarm; | 811 | struct rtc_wkalrm alarm; |
| 785 | int err; | 812 | int err; |
| 786 | next = timerqueue_getnext(&rtc->timerqueue); | 813 | next = timerqueue_getnext(&rtc->timerqueue); |
| 787 | if (!next) | 814 | if (!next) { |
| 815 | rtc_alarm_disable(rtc); | ||
| 788 | return; | 816 | return; |
| 817 | } | ||
| 789 | alarm.time = rtc_ktime_to_tm(next->expires); | 818 | alarm.time = rtc_ktime_to_tm(next->expires); |
| 790 | alarm.enabled = 1; | 819 | alarm.enabled = 1; |
| 791 | err = __rtc_set_alarm(rtc, &alarm); | 820 | err = __rtc_set_alarm(rtc, &alarm); |
| @@ -847,7 +876,8 @@ again: | |||
| 847 | err = __rtc_set_alarm(rtc, &alarm); | 876 | err = __rtc_set_alarm(rtc, &alarm); |
| 848 | if (err == -ETIME) | 877 | if (err == -ETIME) |
| 849 | goto again; | 878 | goto again; |
| 850 | } | 879 | } else |
| 880 | rtc_alarm_disable(rtc); | ||
| 851 | 881 | ||
| 852 | mutex_unlock(&rtc->ops_lock); | 882 | mutex_unlock(&rtc->ops_lock); |
| 853 | } | 883 | } |
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index eda128fc1d38..64aedd8cc095 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
| @@ -357,10 +357,19 @@ static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
| 357 | static struct rtc_class_ops m41t80_rtc_ops = { | 357 | static struct rtc_class_ops m41t80_rtc_ops = { |
| 358 | .read_time = m41t80_rtc_read_time, | 358 | .read_time = m41t80_rtc_read_time, |
| 359 | .set_time = m41t80_rtc_set_time, | 359 | .set_time = m41t80_rtc_set_time, |
| 360 | /* | ||
| 361 | * XXX - m41t80 alarm functionality is reported broken. | ||
| 362 | * until it is fixed, don't register alarm functions. | ||
| 363 | * | ||
| 360 | .read_alarm = m41t80_rtc_read_alarm, | 364 | .read_alarm = m41t80_rtc_read_alarm, |
| 361 | .set_alarm = m41t80_rtc_set_alarm, | 365 | .set_alarm = m41t80_rtc_set_alarm, |
| 366 | */ | ||
| 362 | .proc = m41t80_rtc_proc, | 367 | .proc = m41t80_rtc_proc, |
| 368 | /* | ||
| 369 | * See above comment on broken alarm | ||
| 370 | * | ||
| 363 | .alarm_irq_enable = m41t80_rtc_alarm_irq_enable, | 371 | .alarm_irq_enable = m41t80_rtc_alarm_irq_enable, |
| 372 | */ | ||
| 364 | }; | 373 | }; |
| 365 | 374 | ||
| 366 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) | 375 | #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE) |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 7639ab906f02..5b979d9cc332 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -202,7 +202,6 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
| 202 | void __iomem *base = s3c_rtc_base; | 202 | void __iomem *base = s3c_rtc_base; |
| 203 | int year = tm->tm_year - 100; | 203 | int year = tm->tm_year - 100; |
| 204 | 204 | ||
| 205 | clk_enable(rtc_clk); | ||
| 206 | pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n", | 205 | pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n", |
| 207 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, | 206 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, |
| 208 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 207 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| @@ -214,6 +213,7 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
| 214 | return -EINVAL; | 213 | return -EINVAL; |
| 215 | } | 214 | } |
| 216 | 215 | ||
| 216 | clk_enable(rtc_clk); | ||
| 217 | writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC); | 217 | writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC); |
| 218 | writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN); | 218 | writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN); |
| 219 | writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR); | 219 | writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR); |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 75c3f1f8fd43..a84631a7391d 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
| @@ -529,10 +529,7 @@ __s390_vary_chpid_on(struct subchannel_id schid, void *data) | |||
| 529 | int chsc_chp_vary(struct chp_id chpid, int on) | 529 | int chsc_chp_vary(struct chp_id chpid, int on) |
| 530 | { | 530 | { |
| 531 | struct channel_path *chp = chpid_to_chp(chpid); | 531 | struct channel_path *chp = chpid_to_chp(chpid); |
| 532 | struct chp_link link; | ||
| 533 | 532 | ||
| 534 | memset(&link, 0, sizeof(struct chp_link)); | ||
| 535 | link.chpid = chpid; | ||
| 536 | /* Wait until previous actions have settled. */ | 533 | /* Wait until previous actions have settled. */ |
| 537 | css_wait_for_slow_path(); | 534 | css_wait_for_slow_path(); |
| 538 | /* | 535 | /* |
| @@ -542,10 +539,10 @@ int chsc_chp_vary(struct chp_id chpid, int on) | |||
| 542 | /* Try to update the channel path descritor. */ | 539 | /* Try to update the channel path descritor. */ |
| 543 | chsc_determine_base_channel_path_desc(chpid, &chp->desc); | 540 | chsc_determine_base_channel_path_desc(chpid, &chp->desc); |
| 544 | for_each_subchannel_staged(s390_subchannel_vary_chpid_on, | 541 | for_each_subchannel_staged(s390_subchannel_vary_chpid_on, |
| 545 | __s390_vary_chpid_on, &link); | 542 | __s390_vary_chpid_on, &chpid); |
| 546 | } else | 543 | } else |
| 547 | for_each_subchannel_staged(s390_subchannel_vary_chpid_off, | 544 | for_each_subchannel_staged(s390_subchannel_vary_chpid_off, |
| 548 | NULL, &link); | 545 | NULL, &chpid); |
| 549 | 546 | ||
| 550 | return 0; | 547 | return 0; |
| 551 | } | 548 | } |
diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h index 155a82bcb9e5..4a1ff5c2eb88 100644 --- a/drivers/s390/cio/cio.h +++ b/drivers/s390/cio/cio.h | |||
| @@ -68,8 +68,13 @@ struct schib { | |||
| 68 | __u8 mda[4]; /* model dependent area */ | 68 | __u8 mda[4]; /* model dependent area */ |
| 69 | } __attribute__ ((packed,aligned(4))); | 69 | } __attribute__ ((packed,aligned(4))); |
| 70 | 70 | ||
| 71 | /* | ||
| 72 | * When rescheduled, todo's with higher values will overwrite those | ||
| 73 | * with lower values. | ||
| 74 | */ | ||
| 71 | enum sch_todo { | 75 | enum sch_todo { |
| 72 | SCH_TODO_NOTHING, | 76 | SCH_TODO_NOTHING, |
| 77 | SCH_TODO_EVAL, | ||
| 73 | SCH_TODO_UNREG, | 78 | SCH_TODO_UNREG, |
| 74 | }; | 79 | }; |
| 75 | 80 | ||
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 92d7324acb1c..21908e67bf67 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
| @@ -195,51 +195,6 @@ void css_sch_device_unregister(struct subchannel *sch) | |||
| 195 | } | 195 | } |
| 196 | EXPORT_SYMBOL_GPL(css_sch_device_unregister); | 196 | EXPORT_SYMBOL_GPL(css_sch_device_unregister); |
| 197 | 197 | ||
| 198 | static void css_sch_todo(struct work_struct *work) | ||
| 199 | { | ||
| 200 | struct subchannel *sch; | ||
| 201 | enum sch_todo todo; | ||
| 202 | |||
| 203 | sch = container_of(work, struct subchannel, todo_work); | ||
| 204 | /* Find out todo. */ | ||
| 205 | spin_lock_irq(sch->lock); | ||
| 206 | todo = sch->todo; | ||
| 207 | CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, | ||
| 208 | sch->schid.sch_no, todo); | ||
| 209 | sch->todo = SCH_TODO_NOTHING; | ||
| 210 | spin_unlock_irq(sch->lock); | ||
| 211 | /* Perform todo. */ | ||
| 212 | if (todo == SCH_TODO_UNREG) | ||
| 213 | css_sch_device_unregister(sch); | ||
| 214 | /* Release workqueue ref. */ | ||
| 215 | put_device(&sch->dev); | ||
| 216 | } | ||
| 217 | |||
| 218 | /** | ||
| 219 | * css_sched_sch_todo - schedule a subchannel operation | ||
| 220 | * @sch: subchannel | ||
| 221 | * @todo: todo | ||
| 222 | * | ||
| 223 | * Schedule the operation identified by @todo to be performed on the slow path | ||
| 224 | * workqueue. Do nothing if another operation with higher priority is already | ||
| 225 | * scheduled. Needs to be called with subchannel lock held. | ||
| 226 | */ | ||
| 227 | void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) | ||
| 228 | { | ||
| 229 | CIO_MSG_EVENT(4, "sch_todo: sched sch=0.%x.%04x todo=%d\n", | ||
| 230 | sch->schid.ssid, sch->schid.sch_no, todo); | ||
| 231 | if (sch->todo >= todo) | ||
| 232 | return; | ||
| 233 | /* Get workqueue ref. */ | ||
| 234 | if (!get_device(&sch->dev)) | ||
| 235 | return; | ||
| 236 | sch->todo = todo; | ||
| 237 | if (!queue_work(cio_work_q, &sch->todo_work)) { | ||
| 238 | /* Already queued, release workqueue ref. */ | ||
| 239 | put_device(&sch->dev); | ||
| 240 | } | ||
| 241 | } | ||
| 242 | |||
| 243 | static void ssd_from_pmcw(struct chsc_ssd_info *ssd, struct pmcw *pmcw) | 198 | static void ssd_from_pmcw(struct chsc_ssd_info *ssd, struct pmcw *pmcw) |
| 244 | { | 199 | { |
| 245 | int i; | 200 | int i; |
| @@ -466,6 +421,65 @@ static void css_evaluate_subchannel(struct subchannel_id schid, int slow) | |||
| 466 | css_schedule_eval(schid); | 421 | css_schedule_eval(schid); |
| 467 | } | 422 | } |
| 468 | 423 | ||
| 424 | /** | ||
| 425 | * css_sched_sch_todo - schedule a subchannel operation | ||
| 426 | * @sch: subchannel | ||
| 427 | * @todo: todo | ||
| 428 | * | ||
| 429 | * Schedule the operation identified by @todo to be performed on the slow path | ||
| 430 | * workqueue. Do nothing if another operation with higher priority is already | ||
| 431 | * scheduled. Needs to be called with subchannel lock held. | ||
| 432 | */ | ||
| 433 | void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) | ||
| 434 | { | ||
| 435 | CIO_MSG_EVENT(4, "sch_todo: sched sch=0.%x.%04x todo=%d\n", | ||
| 436 | sch->schid.ssid, sch->schid.sch_no, todo); | ||
| 437 | if (sch->todo >= todo) | ||
| 438 | return; | ||
| 439 | /* Get workqueue ref. */ | ||
| 440 | if (!get_device(&sch->dev)) | ||
| 441 | return; | ||
| 442 | sch->todo = todo; | ||
| 443 | if (!queue_work(cio_work_q, &sch->todo_work)) { | ||
| 444 | /* Already queued, release workqueue ref. */ | ||
| 445 | put_device(&sch->dev); | ||
| 446 | } | ||
| 447 | } | ||
| 448 | |||
| 449 | static void css_sch_todo(struct work_struct *work) | ||
| 450 | { | ||
| 451 | struct subchannel *sch; | ||
| 452 | enum sch_todo todo; | ||
| 453 | int ret; | ||
| 454 | |||
| 455 | sch = container_of(work, struct subchannel, todo_work); | ||
| 456 | /* Find out todo. */ | ||
| 457 | spin_lock_irq(sch->lock); | ||
| 458 | todo = sch->todo; | ||
| 459 | CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, | ||
| 460 | sch->schid.sch_no, todo); | ||
| 461 | sch->todo = SCH_TODO_NOTHING; | ||
| 462 | spin_unlock_irq(sch->lock); | ||
| 463 | /* Perform todo. */ | ||
| 464 | switch (todo) { | ||
| 465 | case SCH_TODO_NOTHING: | ||
| 466 | break; | ||
| 467 | case SCH_TODO_EVAL: | ||
| 468 | ret = css_evaluate_known_subchannel(sch, 1); | ||
| 469 | if (ret == -EAGAIN) { | ||
| 470 | spin_lock_irq(sch->lock); | ||
| 471 | css_sched_sch_todo(sch, todo); | ||
| 472 | spin_unlock_irq(sch->lock); | ||
| 473 | } | ||
| 474 | break; | ||
| 475 | case SCH_TODO_UNREG: | ||
| 476 | css_sch_device_unregister(sch); | ||
| 477 | break; | ||
| 478 | } | ||
| 479 | /* Release workqueue ref. */ | ||
| 480 | put_device(&sch->dev); | ||
| 481 | } | ||
| 482 | |||
| 469 | static struct idset *slow_subchannel_set; | 483 | static struct idset *slow_subchannel_set; |
| 470 | static spinlock_t slow_subchannel_lock; | 484 | static spinlock_t slow_subchannel_lock; |
| 471 | static wait_queue_head_t css_eval_wq; | 485 | static wait_queue_head_t css_eval_wq; |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index d734f4a0ecac..47269858ecb6 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
| @@ -1868,9 +1868,9 @@ static void __ccw_device_pm_restore(struct ccw_device *cdev) | |||
| 1868 | */ | 1868 | */ |
| 1869 | cdev->private->flags.resuming = 1; | 1869 | cdev->private->flags.resuming = 1; |
| 1870 | cdev->private->path_new_mask = LPM_ANYPATH; | 1870 | cdev->private->path_new_mask = LPM_ANYPATH; |
| 1871 | css_schedule_eval(sch->schid); | 1871 | css_sched_sch_todo(sch, SCH_TODO_EVAL); |
| 1872 | spin_unlock_irq(sch->lock); | 1872 | spin_unlock_irq(sch->lock); |
| 1873 | css_complete_work(); | 1873 | css_wait_for_slow_path(); |
| 1874 | 1874 | ||
| 1875 | /* cdev may have been moved to a different subchannel. */ | 1875 | /* cdev may have been moved to a different subchannel. */ |
| 1876 | sch = to_subchannel(cdev->dev.parent); | 1876 | sch = to_subchannel(cdev->dev.parent); |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 52c233fa2b12..1b853513c891 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
| @@ -496,8 +496,26 @@ static void ccw_device_reset_path_events(struct ccw_device *cdev) | |||
| 496 | cdev->private->pgid_reset_mask = 0; | 496 | cdev->private->pgid_reset_mask = 0; |
| 497 | } | 497 | } |
| 498 | 498 | ||
| 499 | void | 499 | static void create_fake_irb(struct irb *irb, int type) |
| 500 | ccw_device_verify_done(struct ccw_device *cdev, int err) | 500 | { |
| 501 | memset(irb, 0, sizeof(*irb)); | ||
| 502 | if (type == FAKE_CMD_IRB) { | ||
| 503 | struct cmd_scsw *scsw = &irb->scsw.cmd; | ||
| 504 | scsw->cc = 1; | ||
| 505 | scsw->fctl = SCSW_FCTL_START_FUNC; | ||
| 506 | scsw->actl = SCSW_ACTL_START_PEND; | ||
| 507 | scsw->stctl = SCSW_STCTL_STATUS_PEND; | ||
| 508 | } else if (type == FAKE_TM_IRB) { | ||
| 509 | struct tm_scsw *scsw = &irb->scsw.tm; | ||
| 510 | scsw->x = 1; | ||
| 511 | scsw->cc = 1; | ||
| 512 | scsw->fctl = SCSW_FCTL_START_FUNC; | ||
| 513 | scsw->actl = SCSW_ACTL_START_PEND; | ||
| 514 | scsw->stctl = SCSW_STCTL_STATUS_PEND; | ||
| 515 | } | ||
| 516 | } | ||
| 517 | |||
| 518 | void ccw_device_verify_done(struct ccw_device *cdev, int err) | ||
| 501 | { | 519 | { |
| 502 | struct subchannel *sch; | 520 | struct subchannel *sch; |
| 503 | 521 | ||
| @@ -520,12 +538,8 @@ callback: | |||
| 520 | ccw_device_done(cdev, DEV_STATE_ONLINE); | 538 | ccw_device_done(cdev, DEV_STATE_ONLINE); |
| 521 | /* Deliver fake irb to device driver, if needed. */ | 539 | /* Deliver fake irb to device driver, if needed. */ |
| 522 | if (cdev->private->flags.fake_irb) { | 540 | if (cdev->private->flags.fake_irb) { |
| 523 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | 541 | create_fake_irb(&cdev->private->irb, |
| 524 | cdev->private->irb.scsw.cmd.cc = 1; | 542 | cdev->private->flags.fake_irb); |
| 525 | cdev->private->irb.scsw.cmd.fctl = SCSW_FCTL_START_FUNC; | ||
| 526 | cdev->private->irb.scsw.cmd.actl = SCSW_ACTL_START_PEND; | ||
| 527 | cdev->private->irb.scsw.cmd.stctl = | ||
| 528 | SCSW_STCTL_STATUS_PEND; | ||
| 529 | cdev->private->flags.fake_irb = 0; | 543 | cdev->private->flags.fake_irb = 0; |
| 530 | if (cdev->handler) | 544 | if (cdev->handler) |
| 531 | cdev->handler(cdev, cdev->private->intparm, | 545 | cdev->handler(cdev, cdev->private->intparm, |
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c index f98698d5735e..ec7fb6d3b479 100644 --- a/drivers/s390/cio/device_ops.c +++ b/drivers/s390/cio/device_ops.c | |||
| @@ -198,7 +198,7 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa, | |||
| 198 | if (cdev->private->state == DEV_STATE_VERIFY) { | 198 | if (cdev->private->state == DEV_STATE_VERIFY) { |
| 199 | /* Remember to fake irb when finished. */ | 199 | /* Remember to fake irb when finished. */ |
| 200 | if (!cdev->private->flags.fake_irb) { | 200 | if (!cdev->private->flags.fake_irb) { |
| 201 | cdev->private->flags.fake_irb = 1; | 201 | cdev->private->flags.fake_irb = FAKE_CMD_IRB; |
| 202 | cdev->private->intparm = intparm; | 202 | cdev->private->intparm = intparm; |
| 203 | return 0; | 203 | return 0; |
| 204 | } else | 204 | } else |
| @@ -213,9 +213,9 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa, | |||
| 213 | ret = cio_set_options (sch, flags); | 213 | ret = cio_set_options (sch, flags); |
| 214 | if (ret) | 214 | if (ret) |
| 215 | return ret; | 215 | return ret; |
| 216 | /* Adjust requested path mask to excluded varied off paths. */ | 216 | /* Adjust requested path mask to exclude unusable paths. */ |
| 217 | if (lpm) { | 217 | if (lpm) { |
| 218 | lpm &= sch->opm; | 218 | lpm &= sch->lpm; |
| 219 | if (lpm == 0) | 219 | if (lpm == 0) |
| 220 | return -EACCES; | 220 | return -EACCES; |
| 221 | } | 221 | } |
| @@ -605,11 +605,21 @@ int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw, | |||
| 605 | sch = to_subchannel(cdev->dev.parent); | 605 | sch = to_subchannel(cdev->dev.parent); |
| 606 | if (!sch->schib.pmcw.ena) | 606 | if (!sch->schib.pmcw.ena) |
| 607 | return -EINVAL; | 607 | return -EINVAL; |
| 608 | if (cdev->private->state == DEV_STATE_VERIFY) { | ||
| 609 | /* Remember to fake irb when finished. */ | ||
| 610 | if (!cdev->private->flags.fake_irb) { | ||
| 611 | cdev->private->flags.fake_irb = FAKE_TM_IRB; | ||
| 612 | cdev->private->intparm = intparm; | ||
| 613 | return 0; | ||
| 614 | } else | ||
| 615 | /* There's already a fake I/O around. */ | ||
| 616 | return -EBUSY; | ||
| 617 | } | ||
| 608 | if (cdev->private->state != DEV_STATE_ONLINE) | 618 | if (cdev->private->state != DEV_STATE_ONLINE) |
| 609 | return -EIO; | 619 | return -EIO; |
| 610 | /* Adjust requested path mask to excluded varied off paths. */ | 620 | /* Adjust requested path mask to exclude unusable paths. */ |
| 611 | if (lpm) { | 621 | if (lpm) { |
| 612 | lpm &= sch->opm; | 622 | lpm &= sch->lpm; |
| 613 | if (lpm == 0) | 623 | if (lpm == 0) |
| 614 | return -EACCES; | 624 | return -EACCES; |
| 615 | } | 625 | } |
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h index 2ebb492a5c17..76253dfcc1be 100644 --- a/drivers/s390/cio/io_sch.h +++ b/drivers/s390/cio/io_sch.h | |||
| @@ -111,6 +111,9 @@ enum cdev_todo { | |||
| 111 | CDEV_TODO_UNREG_EVAL, | 111 | CDEV_TODO_UNREG_EVAL, |
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| 114 | #define FAKE_CMD_IRB 1 | ||
| 115 | #define FAKE_TM_IRB 2 | ||
| 116 | |||
| 114 | struct ccw_device_private { | 117 | struct ccw_device_private { |
| 115 | struct ccw_device *cdev; | 118 | struct ccw_device *cdev; |
| 116 | struct subchannel *sch; | 119 | struct subchannel *sch; |
| @@ -138,7 +141,7 @@ struct ccw_device_private { | |||
| 138 | unsigned int doverify:1; /* delayed path verification */ | 141 | unsigned int doverify:1; /* delayed path verification */ |
| 139 | unsigned int donotify:1; /* call notify function */ | 142 | unsigned int donotify:1; /* call notify function */ |
| 140 | unsigned int recog_done:1; /* dev. recog. complete */ | 143 | unsigned int recog_done:1; /* dev. recog. complete */ |
| 141 | unsigned int fake_irb:1; /* deliver faked irb */ | 144 | unsigned int fake_irb:2; /* deliver faked irb */ |
| 142 | unsigned int resuming:1; /* recognition while resume */ | 145 | unsigned int resuming:1; /* recognition while resume */ |
| 143 | unsigned int pgroup:1; /* pathgroup is set up */ | 146 | unsigned int pgroup:1; /* pathgroup is set up */ |
| 144 | unsigned int mpath:1; /* multipathing is set up */ | 147 | unsigned int mpath:1; /* multipathing is set up */ |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index ec94f049e995..96bbe9d12a79 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
| @@ -1552,6 +1552,8 @@ static void ap_reset(struct ap_device *ap_dev) | |||
| 1552 | rc = ap_init_queue(ap_dev->qid); | 1552 | rc = ap_init_queue(ap_dev->qid); |
| 1553 | if (rc == -ENODEV) | 1553 | if (rc == -ENODEV) |
| 1554 | ap_dev->unregistered = 1; | 1554 | ap_dev->unregistered = 1; |
| 1555 | else | ||
| 1556 | __ap_schedule_poll_timer(); | ||
| 1555 | } | 1557 | } |
| 1556 | 1558 | ||
| 1557 | static int __ap_poll_device(struct ap_device *ap_dev, unsigned long *flags) | 1559 | static int __ap_poll_device(struct ap_device *ap_dev, unsigned long *flags) |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 11f07f888223..b79576b64f45 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
| @@ -55,6 +55,10 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdev) | |||
| 55 | { | 55 | { |
| 56 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | 56 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); |
| 57 | 57 | ||
| 58 | /* if previous slave_alloc returned early, there is nothing to do */ | ||
| 59 | if (!zfcp_sdev->port) | ||
| 60 | return; | ||
| 61 | |||
| 58 | zfcp_erp_lun_shutdown_wait(sdev, "scssd_1"); | 62 | zfcp_erp_lun_shutdown_wait(sdev, "scssd_1"); |
| 59 | put_device(&zfcp_sdev->port->dev); | 63 | put_device(&zfcp_sdev->port->dev); |
| 60 | } | 64 | } |
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c index 5f94d22c491e..542668292900 100644 --- a/drivers/sbus/char/bbc_i2c.c +++ b/drivers/sbus/char/bbc_i2c.c | |||
| @@ -233,13 +233,9 @@ int bbc_i2c_write_buf(struct bbc_i2c_client *client, | |||
| 233 | int ret = 0; | 233 | int ret = 0; |
| 234 | 234 | ||
| 235 | while (len > 0) { | 235 | while (len > 0) { |
| 236 | int err = bbc_i2c_writeb(client, *buf, off); | 236 | ret = bbc_i2c_writeb(client, *buf, off); |
| 237 | 237 | if (ret < 0) | |
| 238 | if (err < 0) { | ||
| 239 | ret = err; | ||
| 240 | break; | 238 | break; |
| 241 | } | ||
| 242 | |||
| 243 | len--; | 239 | len--; |
| 244 | buf++; | 240 | buf++; |
| 245 | off++; | 241 | off++; |
| @@ -253,11 +249,9 @@ int bbc_i2c_read_buf(struct bbc_i2c_client *client, | |||
| 253 | int ret = 0; | 249 | int ret = 0; |
| 254 | 250 | ||
| 255 | while (len > 0) { | 251 | while (len > 0) { |
| 256 | int err = bbc_i2c_readb(client, buf, off); | 252 | ret = bbc_i2c_readb(client, buf, off); |
| 257 | if (err < 0) { | 253 | if (ret < 0) |
| 258 | ret = err; | ||
| 259 | break; | 254 | break; |
| 260 | } | ||
| 261 | len--; | 255 | len--; |
| 262 | buf++; | 256 | buf++; |
| 263 | off++; | 257 | off++; |
| @@ -422,17 +416,6 @@ static struct platform_driver bbc_i2c_driver = { | |||
| 422 | .remove = __devexit_p(bbc_i2c_remove), | 416 | .remove = __devexit_p(bbc_i2c_remove), |
| 423 | }; | 417 | }; |
| 424 | 418 | ||
| 425 | static int __init bbc_i2c_init(void) | 419 | module_platform_driver(bbc_i2c_driver); |
| 426 | { | ||
| 427 | return platform_driver_register(&bbc_i2c_driver); | ||
| 428 | } | ||
| 429 | |||
| 430 | static void __exit bbc_i2c_exit(void) | ||
| 431 | { | ||
| 432 | platform_driver_unregister(&bbc_i2c_driver); | ||
| 433 | } | ||
| 434 | |||
| 435 | module_init(bbc_i2c_init); | ||
| 436 | module_exit(bbc_i2c_exit); | ||
| 437 | 420 | ||
| 438 | MODULE_LICENSE("GPL"); | 421 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index 965a1fccd66a..4b9939726c34 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c | |||
| @@ -275,15 +275,4 @@ static struct platform_driver d7s_driver = { | |||
| 275 | .remove = __devexit_p(d7s_remove), | 275 | .remove = __devexit_p(d7s_remove), |
| 276 | }; | 276 | }; |
| 277 | 277 | ||
| 278 | static int __init d7s_init(void) | 278 | module_platform_driver(d7s_driver); |
| 279 | { | ||
| 280 | return platform_driver_register(&d7s_driver); | ||
| 281 | } | ||
| 282 | |||
| 283 | static void __exit d7s_exit(void) | ||
| 284 | { | ||
| 285 | platform_driver_unregister(&d7s_driver); | ||
| 286 | } | ||
| 287 | |||
| 288 | module_init(d7s_init); | ||
| 289 | module_exit(d7s_exit); | ||
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c index be7b4e56154f..339fd6f65eda 100644 --- a/drivers/sbus/char/envctrl.c +++ b/drivers/sbus/char/envctrl.c | |||
| @@ -1138,16 +1138,6 @@ static struct platform_driver envctrl_driver = { | |||
| 1138 | .remove = __devexit_p(envctrl_remove), | 1138 | .remove = __devexit_p(envctrl_remove), |
| 1139 | }; | 1139 | }; |
| 1140 | 1140 | ||
| 1141 | static int __init envctrl_init(void) | 1141 | module_platform_driver(envctrl_driver); |
| 1142 | { | ||
| 1143 | return platform_driver_register(&envctrl_driver); | ||
| 1144 | } | ||
| 1145 | |||
| 1146 | static void __exit envctrl_exit(void) | ||
| 1147 | { | ||
| 1148 | platform_driver_unregister(&envctrl_driver); | ||
| 1149 | } | ||
| 1150 | 1142 | ||
| 1151 | module_init(envctrl_init); | ||
| 1152 | module_exit(envctrl_exit); | ||
| 1153 | MODULE_LICENSE("GPL"); | 1143 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c index 73dd4e7afaaa..826157f38694 100644 --- a/drivers/sbus/char/flash.c +++ b/drivers/sbus/char/flash.c | |||
| @@ -216,16 +216,6 @@ static struct platform_driver flash_driver = { | |||
| 216 | .remove = __devexit_p(flash_remove), | 216 | .remove = __devexit_p(flash_remove), |
| 217 | }; | 217 | }; |
| 218 | 218 | ||
| 219 | static int __init flash_init(void) | 219 | module_platform_driver(flash_driver); |
| 220 | { | ||
| 221 | return platform_driver_register(&flash_driver); | ||
| 222 | } | ||
| 223 | |||
| 224 | static void __exit flash_cleanup(void) | ||
| 225 | { | ||
| 226 | platform_driver_unregister(&flash_driver); | ||
| 227 | } | ||
| 228 | 220 | ||
| 229 | module_init(flash_init); | ||
| 230 | module_exit(flash_cleanup); | ||
| 231 | MODULE_LICENSE("GPL"); | 221 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c index ebce9639a26a..0b31658ccde5 100644 --- a/drivers/sbus/char/uctrl.c +++ b/drivers/sbus/char/uctrl.c | |||
| @@ -435,16 +435,6 @@ static struct platform_driver uctrl_driver = { | |||
| 435 | }; | 435 | }; |
| 436 | 436 | ||
| 437 | 437 | ||
| 438 | static int __init uctrl_init(void) | 438 | module_platform_driver(uctrl_driver); |
| 439 | { | ||
| 440 | return platform_driver_register(&uctrl_driver); | ||
| 441 | } | ||
| 442 | |||
| 443 | static void __exit uctrl_exit(void) | ||
| 444 | { | ||
| 445 | platform_driver_unregister(&uctrl_driver); | ||
| 446 | } | ||
| 447 | 439 | ||
| 448 | module_init(uctrl_init); | ||
| 449 | module_exit(uctrl_exit); | ||
| 450 | MODULE_LICENSE("GPL"); | 440 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index dba72a4e6a1c..1ad0b8225560 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
| @@ -1906,18 +1906,19 @@ static int bnx2i_queue_scsi_cmd_resp(struct iscsi_session *session, | |||
| 1906 | spin_lock(&session->lock); | 1906 | spin_lock(&session->lock); |
| 1907 | task = iscsi_itt_to_task(bnx2i_conn->cls_conn->dd_data, | 1907 | task = iscsi_itt_to_task(bnx2i_conn->cls_conn->dd_data, |
| 1908 | cqe->itt & ISCSI_CMD_RESPONSE_INDEX); | 1908 | cqe->itt & ISCSI_CMD_RESPONSE_INDEX); |
| 1909 | if (!task) { | 1909 | if (!task || !task->sc) { |
| 1910 | spin_unlock(&session->lock); | 1910 | spin_unlock(&session->lock); |
| 1911 | return -EINVAL; | 1911 | return -EINVAL; |
| 1912 | } | 1912 | } |
| 1913 | sc = task->sc; | 1913 | sc = task->sc; |
| 1914 | spin_unlock(&session->lock); | ||
| 1915 | 1914 | ||
| 1916 | if (!blk_rq_cpu_valid(sc->request)) | 1915 | if (!blk_rq_cpu_valid(sc->request)) |
| 1917 | cpu = smp_processor_id(); | 1916 | cpu = smp_processor_id(); |
| 1918 | else | 1917 | else |
| 1919 | cpu = sc->request->cpu; | 1918 | cpu = sc->request->cpu; |
| 1920 | 1919 | ||
| 1920 | spin_unlock(&session->lock); | ||
| 1921 | |||
| 1921 | p = &per_cpu(bnx2i_percpu, cpu); | 1922 | p = &per_cpu(bnx2i_percpu, cpu); |
| 1922 | spin_lock(&p->p_work_lock); | 1923 | spin_lock(&p->p_work_lock); |
| 1923 | if (unlikely(!p->iothread)) { | 1924 | if (unlikely(!p->iothread)) { |
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index cefbe44bb84a..8d67467dd9ce 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
| @@ -31,6 +31,8 @@ | |||
| 31 | #include <linux/sysfs.h> | 31 | #include <linux/sysfs.h> |
| 32 | #include <linux/ctype.h> | 32 | #include <linux/ctype.h> |
| 33 | #include <linux/workqueue.h> | 33 | #include <linux/workqueue.h> |
| 34 | #include <net/dcbnl.h> | ||
| 35 | #include <net/dcbevent.h> | ||
| 34 | #include <scsi/scsi_tcq.h> | 36 | #include <scsi/scsi_tcq.h> |
| 35 | #include <scsi/scsicam.h> | 37 | #include <scsi/scsicam.h> |
| 36 | #include <scsi/scsi_transport.h> | 38 | #include <scsi/scsi_transport.h> |
| @@ -101,6 +103,8 @@ static int fcoe_ddp_done(struct fc_lport *, u16); | |||
| 101 | static int fcoe_ddp_target(struct fc_lport *, u16, struct scatterlist *, | 103 | static int fcoe_ddp_target(struct fc_lport *, u16, struct scatterlist *, |
| 102 | unsigned int); | 104 | unsigned int); |
| 103 | static int fcoe_cpu_callback(struct notifier_block *, unsigned long, void *); | 105 | static int fcoe_cpu_callback(struct notifier_block *, unsigned long, void *); |
| 106 | static int fcoe_dcb_app_notification(struct notifier_block *notifier, | ||
| 107 | ulong event, void *ptr); | ||
| 104 | 108 | ||
| 105 | static bool fcoe_match(struct net_device *netdev); | 109 | static bool fcoe_match(struct net_device *netdev); |
| 106 | static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode); | 110 | static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode); |
| @@ -129,6 +133,11 @@ static struct notifier_block fcoe_cpu_notifier = { | |||
| 129 | .notifier_call = fcoe_cpu_callback, | 133 | .notifier_call = fcoe_cpu_callback, |
| 130 | }; | 134 | }; |
| 131 | 135 | ||
| 136 | /* notification function for DCB events */ | ||
| 137 | static struct notifier_block dcb_notifier = { | ||
| 138 | .notifier_call = fcoe_dcb_app_notification, | ||
| 139 | }; | ||
| 140 | |||
| 132 | static struct scsi_transport_template *fcoe_nport_scsi_transport; | 141 | static struct scsi_transport_template *fcoe_nport_scsi_transport; |
| 133 | static struct scsi_transport_template *fcoe_vport_scsi_transport; | 142 | static struct scsi_transport_template *fcoe_vport_scsi_transport; |
| 134 | 143 | ||
| @@ -1522,6 +1531,8 @@ int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp) | |||
| 1522 | skb_reset_network_header(skb); | 1531 | skb_reset_network_header(skb); |
| 1523 | skb->mac_len = elen; | 1532 | skb->mac_len = elen; |
| 1524 | skb->protocol = htons(ETH_P_FCOE); | 1533 | skb->protocol = htons(ETH_P_FCOE); |
| 1534 | skb->priority = port->priority; | ||
| 1535 | |||
| 1525 | if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN && | 1536 | if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN && |
| 1526 | fcoe->realdev->features & NETIF_F_HW_VLAN_TX) { | 1537 | fcoe->realdev->features & NETIF_F_HW_VLAN_TX) { |
| 1527 | skb->vlan_tci = VLAN_TAG_PRESENT | | 1538 | skb->vlan_tci = VLAN_TAG_PRESENT | |
| @@ -1624,6 +1635,7 @@ static inline int fcoe_filter_frames(struct fc_lport *lport, | |||
| 1624 | stats->InvalidCRCCount++; | 1635 | stats->InvalidCRCCount++; |
| 1625 | if (stats->InvalidCRCCount < 5) | 1636 | if (stats->InvalidCRCCount < 5) |
| 1626 | printk(KERN_WARNING "fcoe: dropping frame with CRC error\n"); | 1637 | printk(KERN_WARNING "fcoe: dropping frame with CRC error\n"); |
| 1638 | put_cpu(); | ||
| 1627 | return -EINVAL; | 1639 | return -EINVAL; |
| 1628 | } | 1640 | } |
| 1629 | 1641 | ||
| @@ -1746,6 +1758,7 @@ int fcoe_percpu_receive_thread(void *arg) | |||
| 1746 | */ | 1758 | */ |
| 1747 | static void fcoe_dev_setup(void) | 1759 | static void fcoe_dev_setup(void) |
| 1748 | { | 1760 | { |
| 1761 | register_dcbevent_notifier(&dcb_notifier); | ||
| 1749 | register_netdevice_notifier(&fcoe_notifier); | 1762 | register_netdevice_notifier(&fcoe_notifier); |
| 1750 | } | 1763 | } |
| 1751 | 1764 | ||
| @@ -1754,9 +1767,69 @@ static void fcoe_dev_setup(void) | |||
| 1754 | */ | 1767 | */ |
| 1755 | static void fcoe_dev_cleanup(void) | 1768 | static void fcoe_dev_cleanup(void) |
| 1756 | { | 1769 | { |
| 1770 | unregister_dcbevent_notifier(&dcb_notifier); | ||
| 1757 | unregister_netdevice_notifier(&fcoe_notifier); | 1771 | unregister_netdevice_notifier(&fcoe_notifier); |
| 1758 | } | 1772 | } |
| 1759 | 1773 | ||
| 1774 | static struct fcoe_interface * | ||
| 1775 | fcoe_hostlist_lookup_realdev_port(struct net_device *netdev) | ||
| 1776 | { | ||
| 1777 | struct fcoe_interface *fcoe; | ||
| 1778 | struct net_device *real_dev; | ||
| 1779 | |||
| 1780 | list_for_each_entry(fcoe, &fcoe_hostlist, list) { | ||
| 1781 | if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN) | ||
| 1782 | real_dev = vlan_dev_real_dev(fcoe->netdev); | ||
| 1783 | else | ||
| 1784 | real_dev = fcoe->netdev; | ||
| 1785 | |||
| 1786 | if (netdev == real_dev) | ||
| 1787 | return fcoe; | ||
| 1788 | } | ||
| 1789 | return NULL; | ||
| 1790 | } | ||
| 1791 | |||
| 1792 | static int fcoe_dcb_app_notification(struct notifier_block *notifier, | ||
| 1793 | ulong event, void *ptr) | ||
| 1794 | { | ||
| 1795 | struct dcb_app_type *entry = ptr; | ||
| 1796 | struct fcoe_interface *fcoe; | ||
| 1797 | struct net_device *netdev; | ||
| 1798 | struct fcoe_port *port; | ||
| 1799 | int prio; | ||
| 1800 | |||
| 1801 | if (entry->app.selector != DCB_APP_IDTYPE_ETHTYPE) | ||
| 1802 | return NOTIFY_OK; | ||
| 1803 | |||
| 1804 | netdev = dev_get_by_index(&init_net, entry->ifindex); | ||
| 1805 | if (!netdev) | ||
| 1806 | return NOTIFY_OK; | ||
| 1807 | |||
| 1808 | fcoe = fcoe_hostlist_lookup_realdev_port(netdev); | ||
| 1809 | dev_put(netdev); | ||
| 1810 | if (!fcoe) | ||
| 1811 | return NOTIFY_OK; | ||
| 1812 | |||
| 1813 | if (entry->dcbx & DCB_CAP_DCBX_VER_CEE) | ||
| 1814 | prio = ffs(entry->app.priority) - 1; | ||
| 1815 | else | ||
| 1816 | prio = entry->app.priority; | ||
| 1817 | |||
| 1818 | if (prio < 0) | ||
| 1819 | return NOTIFY_OK; | ||
| 1820 | |||
| 1821 | if (entry->app.protocol == ETH_P_FIP || | ||
| 1822 | entry->app.protocol == ETH_P_FCOE) | ||
| 1823 | fcoe->ctlr.priority = prio; | ||
| 1824 | |||
| 1825 | if (entry->app.protocol == ETH_P_FCOE) { | ||
| 1826 | port = lport_priv(fcoe->ctlr.lp); | ||
| 1827 | port->priority = prio; | ||
| 1828 | } | ||
| 1829 | |||
| 1830 | return NOTIFY_OK; | ||
| 1831 | } | ||
| 1832 | |||
| 1760 | /** | 1833 | /** |
| 1761 | * fcoe_device_notification() - Handler for net device events | 1834 | * fcoe_device_notification() - Handler for net device events |
| 1762 | * @notifier: The context of the notification | 1835 | * @notifier: The context of the notification |
| @@ -1965,6 +2038,46 @@ static bool fcoe_match(struct net_device *netdev) | |||
| 1965 | } | 2038 | } |
| 1966 | 2039 | ||
| 1967 | /** | 2040 | /** |
| 2041 | * fcoe_dcb_create() - Initialize DCB attributes and hooks | ||
| 2042 | * @netdev: The net_device object of the L2 link that should be queried | ||
| 2043 | * @port: The fcoe_port to bind FCoE APP priority with | ||
| 2044 | * @ | ||
| 2045 | */ | ||
| 2046 | static void fcoe_dcb_create(struct fcoe_interface *fcoe) | ||
| 2047 | { | ||
| 2048 | #ifdef CONFIG_DCB | ||
| 2049 | int dcbx; | ||
| 2050 | u8 fup, up; | ||
| 2051 | struct net_device *netdev = fcoe->realdev; | ||
| 2052 | struct fcoe_port *port = lport_priv(fcoe->ctlr.lp); | ||
| 2053 | struct dcb_app app = { | ||
| 2054 | .priority = 0, | ||
| 2055 | .protocol = ETH_P_FCOE | ||
| 2056 | }; | ||
| 2057 | |||
| 2058 | /* setup DCB priority attributes. */ | ||
| 2059 | if (netdev && netdev->dcbnl_ops && netdev->dcbnl_ops->getdcbx) { | ||
| 2060 | dcbx = netdev->dcbnl_ops->getdcbx(netdev); | ||
| 2061 | |||
| 2062 | if (dcbx & DCB_CAP_DCBX_VER_IEEE) { | ||
| 2063 | app.selector = IEEE_8021QAZ_APP_SEL_ETHERTYPE; | ||
| 2064 | up = dcb_ieee_getapp_mask(netdev, &app); | ||
| 2065 | app.protocol = ETH_P_FIP; | ||
| 2066 | fup = dcb_ieee_getapp_mask(netdev, &app); | ||
| 2067 | } else { | ||
| 2068 | app.selector = DCB_APP_IDTYPE_ETHTYPE; | ||
| 2069 | up = dcb_getapp(netdev, &app); | ||
| 2070 | app.protocol = ETH_P_FIP; | ||
| 2071 | fup = dcb_getapp(netdev, &app); | ||
| 2072 | } | ||
| 2073 | |||
| 2074 | port->priority = ffs(up) ? ffs(up) - 1 : 0; | ||
| 2075 | fcoe->ctlr.priority = ffs(fup) ? ffs(fup) - 1 : port->priority; | ||
| 2076 | } | ||
| 2077 | #endif | ||
| 2078 | } | ||
| 2079 | |||
| 2080 | /** | ||
| 1968 | * fcoe_create() - Create a fcoe interface | 2081 | * fcoe_create() - Create a fcoe interface |
| 1969 | * @netdev : The net_device object the Ethernet interface to create on | 2082 | * @netdev : The net_device object the Ethernet interface to create on |
| 1970 | * @fip_mode: The FIP mode for this creation | 2083 | * @fip_mode: The FIP mode for this creation |
| @@ -2007,6 +2120,9 @@ static int fcoe_create(struct net_device *netdev, enum fip_state fip_mode) | |||
| 2007 | /* Make this the "master" N_Port */ | 2120 | /* Make this the "master" N_Port */ |
| 2008 | fcoe->ctlr.lp = lport; | 2121 | fcoe->ctlr.lp = lport; |
| 2009 | 2122 | ||
| 2123 | /* setup DCB priority attributes. */ | ||
| 2124 | fcoe_dcb_create(fcoe); | ||
| 2125 | |||
| 2010 | /* add to lports list */ | 2126 | /* add to lports list */ |
| 2011 | fcoe_hostlist_add(lport); | 2127 | fcoe_hostlist_add(lport); |
| 2012 | 2128 | ||
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index c74c4b8e71ef..e7522dcc296e 100644 --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c | |||
| @@ -320,6 +320,7 @@ static void fcoe_ctlr_solicit(struct fcoe_ctlr *fip, struct fcoe_fcf *fcf) | |||
| 320 | 320 | ||
| 321 | skb_put(skb, sizeof(*sol)); | 321 | skb_put(skb, sizeof(*sol)); |
| 322 | skb->protocol = htons(ETH_P_FIP); | 322 | skb->protocol = htons(ETH_P_FIP); |
| 323 | skb->priority = fip->priority; | ||
| 323 | skb_reset_mac_header(skb); | 324 | skb_reset_mac_header(skb); |
| 324 | skb_reset_network_header(skb); | 325 | skb_reset_network_header(skb); |
| 325 | fip->send(fip, skb); | 326 | fip->send(fip, skb); |
| @@ -474,6 +475,7 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip, | |||
| 474 | } | 475 | } |
| 475 | skb_put(skb, len); | 476 | skb_put(skb, len); |
| 476 | skb->protocol = htons(ETH_P_FIP); | 477 | skb->protocol = htons(ETH_P_FIP); |
| 478 | skb->priority = fip->priority; | ||
| 477 | skb_reset_mac_header(skb); | 479 | skb_reset_mac_header(skb); |
| 478 | skb_reset_network_header(skb); | 480 | skb_reset_network_header(skb); |
| 479 | fip->send(fip, skb); | 481 | fip->send(fip, skb); |
| @@ -566,6 +568,7 @@ static int fcoe_ctlr_encaps(struct fcoe_ctlr *fip, struct fc_lport *lport, | |||
| 566 | cap->fip.fip_dl_len = htons(dlen / FIP_BPW); | 568 | cap->fip.fip_dl_len = htons(dlen / FIP_BPW); |
| 567 | 569 | ||
| 568 | skb->protocol = htons(ETH_P_FIP); | 570 | skb->protocol = htons(ETH_P_FIP); |
| 571 | skb->priority = fip->priority; | ||
| 569 | skb_reset_mac_header(skb); | 572 | skb_reset_mac_header(skb); |
| 570 | skb_reset_network_header(skb); | 573 | skb_reset_network_header(skb); |
| 571 | return 0; | 574 | return 0; |
| @@ -1911,6 +1914,7 @@ static void fcoe_ctlr_vn_send(struct fcoe_ctlr *fip, | |||
| 1911 | 1914 | ||
| 1912 | skb_put(skb, len); | 1915 | skb_put(skb, len); |
| 1913 | skb->protocol = htons(ETH_P_FIP); | 1916 | skb->protocol = htons(ETH_P_FIP); |
| 1917 | skb->priority = fip->priority; | ||
| 1914 | skb_reset_mac_header(skb); | 1918 | skb_reset_mac_header(skb); |
| 1915 | skb_reset_network_header(skb); | 1919 | skb_reset_network_header(skb); |
| 1916 | 1920 | ||
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 4e041f6d808c..d570573b7963 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
| @@ -4335,7 +4335,7 @@ _scsih_smart_predicted_fault(struct MPT2SAS_ADAPTER *ioc, u16 handle) | |||
| 4335 | /* insert into event log */ | 4335 | /* insert into event log */ |
| 4336 | sz = offsetof(Mpi2EventNotificationReply_t, EventData) + | 4336 | sz = offsetof(Mpi2EventNotificationReply_t, EventData) + |
| 4337 | sizeof(Mpi2EventDataSasDeviceStatusChange_t); | 4337 | sizeof(Mpi2EventDataSasDeviceStatusChange_t); |
| 4338 | event_reply = kzalloc(sz, GFP_KERNEL); | 4338 | event_reply = kzalloc(sz, GFP_ATOMIC); |
| 4339 | if (!event_reply) { | 4339 | if (!event_reply) { |
| 4340 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | 4340 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", |
| 4341 | ioc->name, __FILE__, __LINE__, __func__); | 4341 | ioc->name, __FILE__, __LINE__, __func__); |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index ac326c41e931..6465dae5883a 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
| @@ -1762,12 +1762,31 @@ qla2x00_get_host_port_state(struct Scsi_Host *shost) | |||
| 1762 | scsi_qla_host_t *vha = shost_priv(shost); | 1762 | scsi_qla_host_t *vha = shost_priv(shost); |
| 1763 | struct scsi_qla_host *base_vha = pci_get_drvdata(vha->hw->pdev); | 1763 | struct scsi_qla_host *base_vha = pci_get_drvdata(vha->hw->pdev); |
| 1764 | 1764 | ||
| 1765 | if (!base_vha->flags.online) | 1765 | if (!base_vha->flags.online) { |
| 1766 | fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; | 1766 | fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; |
| 1767 | else if (atomic_read(&base_vha->loop_state) == LOOP_TIMEOUT) | 1767 | return; |
| 1768 | fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN; | 1768 | } |
| 1769 | else | 1769 | |
| 1770 | switch (atomic_read(&base_vha->loop_state)) { | ||
| 1771 | case LOOP_UPDATE: | ||
| 1772 | fc_host_port_state(shost) = FC_PORTSTATE_DIAGNOSTICS; | ||
| 1773 | break; | ||
| 1774 | case LOOP_DOWN: | ||
| 1775 | if (test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags)) | ||
| 1776 | fc_host_port_state(shost) = FC_PORTSTATE_DIAGNOSTICS; | ||
| 1777 | else | ||
| 1778 | fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN; | ||
| 1779 | break; | ||
| 1780 | case LOOP_DEAD: | ||
| 1781 | fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN; | ||
| 1782 | break; | ||
| 1783 | case LOOP_READY: | ||
| 1770 | fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; | 1784 | fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; |
| 1785 | break; | ||
| 1786 | default: | ||
| 1787 | fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN; | ||
| 1788 | break; | ||
| 1789 | } | ||
| 1771 | } | 1790 | } |
| 1772 | 1791 | ||
| 1773 | static int | 1792 | static int |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 9df4787715c0..f3cddd5800c3 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
| @@ -12,17 +12,17 @@ | |||
| 12 | * | Level | Last Value Used | Holes | | 12 | * | Level | Last Value Used | Holes | |
| 13 | * ---------------------------------------------------------------------- | 13 | * ---------------------------------------------------------------------- |
| 14 | * | Module Init and Probe | 0x0116 | | | 14 | * | Module Init and Probe | 0x0116 | | |
| 15 | * | Mailbox commands | 0x1129 | | | 15 | * | Mailbox commands | 0x112b | | |
| 16 | * | Device Discovery | 0x2083 | | | 16 | * | Device Discovery | 0x2083 | | |
| 17 | * | Queue Command and IO tracing | 0x302e | 0x3008 | | 17 | * | Queue Command and IO tracing | 0x302e | 0x3008 | |
| 18 | * | DPC Thread | 0x401c | | | 18 | * | DPC Thread | 0x401c | | |
| 19 | * | Async Events | 0x5059 | | | 19 | * | Async Events | 0x5059 | | |
| 20 | * | Timer Routines | 0x600d | | | 20 | * | Timer Routines | 0x6010 | 0x600e,0x600f | |
| 21 | * | User Space Interactions | 0x709d | | | 21 | * | User Space Interactions | 0x709d | | |
| 22 | * | Task Management | 0x8041 | | | 22 | * | Task Management | 0x8041 | 0x800b | |
| 23 | * | AER/EEH | 0x900f | | | 23 | * | AER/EEH | 0x900f | | |
| 24 | * | Virtual Port | 0xa007 | | | 24 | * | Virtual Port | 0xa007 | | |
| 25 | * | ISP82XX Specific | 0xb051 | | | 25 | * | ISP82XX Specific | 0xb052 | | |
| 26 | * | MultiQ | 0xc00b | | | 26 | * | MultiQ | 0xc00b | | |
| 27 | * | Misc | 0xd00b | | | 27 | * | Misc | 0xd00b | | |
| 28 | * ---------------------------------------------------------------------- | 28 | * ---------------------------------------------------------------------- |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index ce32d8135c9e..c0c11afb685c 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
| @@ -578,6 +578,7 @@ extern int qla82xx_check_md_needed(scsi_qla_host_t *); | |||
| 578 | extern void qla82xx_chip_reset_cleanup(scsi_qla_host_t *); | 578 | extern void qla82xx_chip_reset_cleanup(scsi_qla_host_t *); |
| 579 | extern int qla82xx_mbx_beacon_ctl(scsi_qla_host_t *, int); | 579 | extern int qla82xx_mbx_beacon_ctl(scsi_qla_host_t *, int); |
| 580 | extern char *qdev_state(uint32_t); | 580 | extern char *qdev_state(uint32_t); |
| 581 | extern void qla82xx_clear_pending_mbx(scsi_qla_host_t *); | ||
| 581 | 582 | ||
| 582 | /* BSG related functions */ | 583 | /* BSG related functions */ |
| 583 | extern int qla24xx_bsg_request(struct fc_bsg_job *); | 584 | extern int qla24xx_bsg_request(struct fc_bsg_job *); |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index f03e915f1877..54ea68cec4c5 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
| @@ -1509,7 +1509,8 @@ enable_82xx_npiv: | |||
| 1509 | &ha->fw_xcb_count, NULL, NULL, | 1509 | &ha->fw_xcb_count, NULL, NULL, |
| 1510 | &ha->max_npiv_vports, NULL); | 1510 | &ha->max_npiv_vports, NULL); |
| 1511 | 1511 | ||
| 1512 | if (!fw_major_version && ql2xallocfwdump) | 1512 | if (!fw_major_version && ql2xallocfwdump |
| 1513 | && !IS_QLA82XX(ha)) | ||
| 1513 | qla2x00_alloc_fw_dump(vha); | 1514 | qla2x00_alloc_fw_dump(vha); |
| 1514 | } | 1515 | } |
| 1515 | } else { | 1516 | } else { |
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index dbec89622a0f..a4b267e60a35 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
| @@ -120,11 +120,10 @@ qla2x00_prep_cont_type0_iocb(struct scsi_qla_host *vha) | |||
| 120 | * Returns a pointer to the continuation type 1 IOCB packet. | 120 | * Returns a pointer to the continuation type 1 IOCB packet. |
| 121 | */ | 121 | */ |
| 122 | static inline cont_a64_entry_t * | 122 | static inline cont_a64_entry_t * |
| 123 | qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha) | 123 | qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha, struct req_que *req) |
| 124 | { | 124 | { |
| 125 | cont_a64_entry_t *cont_pkt; | 125 | cont_a64_entry_t *cont_pkt; |
| 126 | 126 | ||
| 127 | struct req_que *req = vha->req; | ||
| 128 | /* Adjust ring index. */ | 127 | /* Adjust ring index. */ |
| 129 | req->ring_index++; | 128 | req->ring_index++; |
| 130 | if (req->ring_index == req->length) { | 129 | if (req->ring_index == req->length) { |
| @@ -292,7 +291,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, | |||
| 292 | * Five DSDs are available in the Continuation | 291 | * Five DSDs are available in the Continuation |
| 293 | * Type 1 IOCB. | 292 | * Type 1 IOCB. |
| 294 | */ | 293 | */ |
| 295 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha); | 294 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha, vha->req); |
| 296 | cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; | 295 | cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; |
| 297 | avail_dsds = 5; | 296 | avail_dsds = 5; |
| 298 | } | 297 | } |
| @@ -684,7 +683,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, | |||
| 684 | * Five DSDs are available in the Continuation | 683 | * Five DSDs are available in the Continuation |
| 685 | * Type 1 IOCB. | 684 | * Type 1 IOCB. |
| 686 | */ | 685 | */ |
| 687 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha); | 686 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha, vha->req); |
| 688 | cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; | 687 | cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; |
| 689 | avail_dsds = 5; | 688 | avail_dsds = 5; |
| 690 | } | 689 | } |
| @@ -2070,7 +2069,8 @@ qla2x00_ct_iocb(srb_t *sp, ms_iocb_entry_t *ct_iocb) | |||
| 2070 | * Five DSDs are available in the Cont. | 2069 | * Five DSDs are available in the Cont. |
| 2071 | * Type 1 IOCB. | 2070 | * Type 1 IOCB. |
| 2072 | */ | 2071 | */ |
| 2073 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha); | 2072 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha, |
| 2073 | vha->hw->req_q_map[0]); | ||
| 2074 | cur_dsd = (uint32_t *) cont_pkt->dseg_0_address; | 2074 | cur_dsd = (uint32_t *) cont_pkt->dseg_0_address; |
| 2075 | avail_dsds = 5; | 2075 | avail_dsds = 5; |
| 2076 | cont_iocb_prsnt = 1; | 2076 | cont_iocb_prsnt = 1; |
| @@ -2096,6 +2096,7 @@ qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) | |||
| 2096 | int index; | 2096 | int index; |
| 2097 | uint16_t tot_dsds; | 2097 | uint16_t tot_dsds; |
| 2098 | scsi_qla_host_t *vha = sp->fcport->vha; | 2098 | scsi_qla_host_t *vha = sp->fcport->vha; |
| 2099 | struct qla_hw_data *ha = vha->hw; | ||
| 2099 | struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job; | 2100 | struct fc_bsg_job *bsg_job = ((struct srb_ctx *)sp->ctx)->u.bsg_job; |
| 2100 | int loop_iterartion = 0; | 2101 | int loop_iterartion = 0; |
| 2101 | int cont_iocb_prsnt = 0; | 2102 | int cont_iocb_prsnt = 0; |
| @@ -2141,7 +2142,8 @@ qla24xx_ct_iocb(srb_t *sp, struct ct_entry_24xx *ct_iocb) | |||
| 2141 | * Five DSDs are available in the Cont. | 2142 | * Five DSDs are available in the Cont. |
| 2142 | * Type 1 IOCB. | 2143 | * Type 1 IOCB. |
| 2143 | */ | 2144 | */ |
| 2144 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha); | 2145 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha, |
| 2146 | ha->req_q_map[0]); | ||
| 2145 | cur_dsd = (uint32_t *) cont_pkt->dseg_0_address; | 2147 | cur_dsd = (uint32_t *) cont_pkt->dseg_0_address; |
| 2146 | avail_dsds = 5; | 2148 | avail_dsds = 5; |
| 2147 | cont_iocb_prsnt = 1; | 2149 | cont_iocb_prsnt = 1; |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 2516adf1aeea..7b91b290ffd6 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
| @@ -1741,7 +1741,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) | |||
| 1741 | resid, scsi_bufflen(cp)); | 1741 | resid, scsi_bufflen(cp)); |
| 1742 | 1742 | ||
| 1743 | cp->result = DID_ERROR << 16 | lscsi_status; | 1743 | cp->result = DID_ERROR << 16 | lscsi_status; |
| 1744 | break; | 1744 | goto check_scsi_status; |
| 1745 | } | 1745 | } |
| 1746 | 1746 | ||
| 1747 | if (!lscsi_status && | 1747 | if (!lscsi_status && |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 3b3cec9f6ac2..82a33533ed26 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
| @@ -79,8 +79,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
| 79 | mcp->mb[0] = MBS_LINK_DOWN_ERROR; | 79 | mcp->mb[0] = MBS_LINK_DOWN_ERROR; |
| 80 | ql_log(ql_log_warn, base_vha, 0x1004, | 80 | ql_log(ql_log_warn, base_vha, 0x1004, |
| 81 | "FW hung = %d.\n", ha->flags.isp82xx_fw_hung); | 81 | "FW hung = %d.\n", ha->flags.isp82xx_fw_hung); |
| 82 | rval = QLA_FUNCTION_FAILED; | 82 | return QLA_FUNCTION_TIMEOUT; |
| 83 | goto premature_exit; | ||
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | /* | 85 | /* |
| @@ -163,6 +162,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
| 163 | HINT_MBX_INT_PENDING) { | 162 | HINT_MBX_INT_PENDING) { |
| 164 | spin_unlock_irqrestore(&ha->hardware_lock, | 163 | spin_unlock_irqrestore(&ha->hardware_lock, |
| 165 | flags); | 164 | flags); |
| 165 | ha->flags.mbox_busy = 0; | ||
| 166 | ql_dbg(ql_dbg_mbx, base_vha, 0x1010, | 166 | ql_dbg(ql_dbg_mbx, base_vha, 0x1010, |
| 167 | "Pending mailbox timeout, exiting.\n"); | 167 | "Pending mailbox timeout, exiting.\n"); |
| 168 | rval = QLA_FUNCTION_TIMEOUT; | 168 | rval = QLA_FUNCTION_TIMEOUT; |
| @@ -188,6 +188,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
| 188 | HINT_MBX_INT_PENDING) { | 188 | HINT_MBX_INT_PENDING) { |
| 189 | spin_unlock_irqrestore(&ha->hardware_lock, | 189 | spin_unlock_irqrestore(&ha->hardware_lock, |
| 190 | flags); | 190 | flags); |
| 191 | ha->flags.mbox_busy = 0; | ||
| 191 | ql_dbg(ql_dbg_mbx, base_vha, 0x1012, | 192 | ql_dbg(ql_dbg_mbx, base_vha, 0x1012, |
| 192 | "Pending mailbox timeout, exiting.\n"); | 193 | "Pending mailbox timeout, exiting.\n"); |
| 193 | rval = QLA_FUNCTION_TIMEOUT; | 194 | rval = QLA_FUNCTION_TIMEOUT; |
| @@ -302,7 +303,15 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
| 302 | if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && | 303 | if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && |
| 303 | !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && | 304 | !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && |
| 304 | !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | 305 | !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { |
| 305 | 306 | if (IS_QLA82XX(ha)) { | |
| 307 | ql_dbg(ql_dbg_mbx, vha, 0x112a, | ||
| 308 | "disabling pause transmit on port " | ||
| 309 | "0 & 1.\n"); | ||
| 310 | qla82xx_wr_32(ha, | ||
| 311 | QLA82XX_CRB_NIU + 0x98, | ||
| 312 | CRB_NIU_XG_PAUSE_CTL_P0| | ||
| 313 | CRB_NIU_XG_PAUSE_CTL_P1); | ||
| 314 | } | ||
| 306 | ql_log(ql_log_info, base_vha, 0x101c, | 315 | ql_log(ql_log_info, base_vha, 0x101c, |
| 307 | "Mailbox cmd timeout occured. " | 316 | "Mailbox cmd timeout occured. " |
| 308 | "Scheduling ISP abort eeh_busy=0x%x.\n", | 317 | "Scheduling ISP abort eeh_busy=0x%x.\n", |
| @@ -318,7 +327,15 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) | |||
| 318 | if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && | 327 | if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) && |
| 319 | !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && | 328 | !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && |
| 320 | !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | 329 | !test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { |
| 321 | 330 | if (IS_QLA82XX(ha)) { | |
| 331 | ql_dbg(ql_dbg_mbx, vha, 0x112b, | ||
| 332 | "disabling pause transmit on port " | ||
| 333 | "0 & 1.\n"); | ||
| 334 | qla82xx_wr_32(ha, | ||
| 335 | QLA82XX_CRB_NIU + 0x98, | ||
| 336 | CRB_NIU_XG_PAUSE_CTL_P0| | ||
| 337 | CRB_NIU_XG_PAUSE_CTL_P1); | ||
| 338 | } | ||
| 322 | ql_log(ql_log_info, base_vha, 0x101e, | 339 | ql_log(ql_log_info, base_vha, 0x101e, |
| 323 | "Mailbox cmd timeout occured. " | 340 | "Mailbox cmd timeout occured. " |
| 324 | "Scheduling ISP abort.\n"); | 341 | "Scheduling ISP abort.\n"); |
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index 94bded5ddce4..03554934b0a5 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c | |||
| @@ -3817,6 +3817,20 @@ exit: | |||
| 3817 | return rval; | 3817 | return rval; |
| 3818 | } | 3818 | } |
| 3819 | 3819 | ||
| 3820 | void qla82xx_clear_pending_mbx(scsi_qla_host_t *vha) | ||
| 3821 | { | ||
| 3822 | struct qla_hw_data *ha = vha->hw; | ||
| 3823 | |||
| 3824 | if (ha->flags.mbox_busy) { | ||
| 3825 | ha->flags.mbox_int = 1; | ||
| 3826 | ha->flags.mbox_busy = 0; | ||
| 3827 | ql_log(ql_log_warn, vha, 0x6010, | ||
| 3828 | "Doing premature completion of mbx command.\n"); | ||
| 3829 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags)) | ||
| 3830 | complete(&ha->mbx_intr_comp); | ||
| 3831 | } | ||
| 3832 | } | ||
| 3833 | |||
| 3820 | void qla82xx_watchdog(scsi_qla_host_t *vha) | 3834 | void qla82xx_watchdog(scsi_qla_host_t *vha) |
| 3821 | { | 3835 | { |
| 3822 | uint32_t dev_state, halt_status; | 3836 | uint32_t dev_state, halt_status; |
| @@ -3839,9 +3853,13 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) | |||
| 3839 | qla2xxx_wake_dpc(vha); | 3853 | qla2xxx_wake_dpc(vha); |
| 3840 | } else { | 3854 | } else { |
| 3841 | if (qla82xx_check_fw_alive(vha)) { | 3855 | if (qla82xx_check_fw_alive(vha)) { |
| 3856 | ql_dbg(ql_dbg_timer, vha, 0x6011, | ||
| 3857 | "disabling pause transmit on port 0 & 1.\n"); | ||
| 3858 | qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x98, | ||
| 3859 | CRB_NIU_XG_PAUSE_CTL_P0|CRB_NIU_XG_PAUSE_CTL_P1); | ||
| 3842 | halt_status = qla82xx_rd_32(ha, | 3860 | halt_status = qla82xx_rd_32(ha, |
| 3843 | QLA82XX_PEG_HALT_STATUS1); | 3861 | QLA82XX_PEG_HALT_STATUS1); |
| 3844 | ql_dbg(ql_dbg_timer, vha, 0x6005, | 3862 | ql_log(ql_log_info, vha, 0x6005, |
| 3845 | "dumping hw/fw registers:.\n " | 3863 | "dumping hw/fw registers:.\n " |
| 3846 | " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,.\n " | 3864 | " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,.\n " |
| 3847 | " PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,.\n " | 3865 | " PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,.\n " |
| @@ -3858,6 +3876,11 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) | |||
| 3858 | QLA82XX_CRB_PEG_NET_3 + 0x3c), | 3876 | QLA82XX_CRB_PEG_NET_3 + 0x3c), |
| 3859 | qla82xx_rd_32(ha, | 3877 | qla82xx_rd_32(ha, |
| 3860 | QLA82XX_CRB_PEG_NET_4 + 0x3c)); | 3878 | QLA82XX_CRB_PEG_NET_4 + 0x3c)); |
| 3879 | if (LSW(MSB(halt_status)) == 0x67) | ||
| 3880 | ql_log(ql_log_warn, vha, 0xb052, | ||
| 3881 | "Firmware aborted with " | ||
| 3882 | "error code 0x00006700. Device is " | ||
| 3883 | "being reset.\n"); | ||
| 3861 | if (halt_status & HALT_STATUS_UNRECOVERABLE) { | 3884 | if (halt_status & HALT_STATUS_UNRECOVERABLE) { |
| 3862 | set_bit(ISP_UNRECOVERABLE, | 3885 | set_bit(ISP_UNRECOVERABLE, |
| 3863 | &vha->dpc_flags); | 3886 | &vha->dpc_flags); |
| @@ -3869,16 +3892,8 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) | |||
| 3869 | } | 3892 | } |
| 3870 | qla2xxx_wake_dpc(vha); | 3893 | qla2xxx_wake_dpc(vha); |
| 3871 | ha->flags.isp82xx_fw_hung = 1; | 3894 | ha->flags.isp82xx_fw_hung = 1; |
| 3872 | if (ha->flags.mbox_busy) { | 3895 | ql_log(ql_log_warn, vha, 0x6007, "Firmware hung.\n"); |
| 3873 | ha->flags.mbox_int = 1; | 3896 | qla82xx_clear_pending_mbx(vha); |
| 3874 | ql_log(ql_log_warn, vha, 0x6007, | ||
| 3875 | "Due to FW hung, doing " | ||
| 3876 | "premature completion of mbx " | ||
| 3877 | "command.\n"); | ||
| 3878 | if (test_bit(MBX_INTR_WAIT, | ||
| 3879 | &ha->mbx_cmd_flags)) | ||
| 3880 | complete(&ha->mbx_intr_comp); | ||
| 3881 | } | ||
| 3882 | } | 3897 | } |
| 3883 | } | 3898 | } |
| 3884 | } | 3899 | } |
| @@ -4073,10 +4088,7 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha) | |||
| 4073 | msleep(1000); | 4088 | msleep(1000); |
| 4074 | if (qla82xx_check_fw_alive(vha)) { | 4089 | if (qla82xx_check_fw_alive(vha)) { |
| 4075 | ha->flags.isp82xx_fw_hung = 1; | 4090 | ha->flags.isp82xx_fw_hung = 1; |
| 4076 | if (ha->flags.mbox_busy) { | 4091 | qla82xx_clear_pending_mbx(vha); |
| 4077 | ha->flags.mbox_int = 1; | ||
| 4078 | complete(&ha->mbx_intr_comp); | ||
| 4079 | } | ||
| 4080 | break; | 4092 | break; |
| 4081 | } | 4093 | } |
| 4082 | } | 4094 | } |
diff --git a/drivers/scsi/qla2xxx/qla_nx.h b/drivers/scsi/qla2xxx/qla_nx.h index 57820c199bc2..57a226be339a 100644 --- a/drivers/scsi/qla2xxx/qla_nx.h +++ b/drivers/scsi/qla2xxx/qla_nx.h | |||
| @@ -1173,4 +1173,8 @@ struct qla82xx_md_entry_queue { | |||
| 1173 | 1173 | ||
| 1174 | static const int MD_MIU_TEST_AGT_RDDATA[] = { 0x410000A8, 0x410000AC, | 1174 | static const int MD_MIU_TEST_AGT_RDDATA[] = { 0x410000A8, 0x410000AC, |
| 1175 | 0x410000B8, 0x410000BC }; | 1175 | 0x410000B8, 0x410000BC }; |
| 1176 | |||
| 1177 | #define CRB_NIU_XG_PAUSE_CTL_P0 0x1 | ||
| 1178 | #define CRB_NIU_XG_PAUSE_CTL_P1 0x8 | ||
| 1179 | |||
| 1176 | #endif | 1180 | #endif |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index fd14c7bfc626..f9e5b85e84d8 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
| @@ -201,12 +201,12 @@ MODULE_PARM_DESC(ql2xmdcapmask, | |||
| 201 | "Set the Minidump driver capture mask level. " | 201 | "Set the Minidump driver capture mask level. " |
| 202 | "Default is 0x7F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F."); | 202 | "Default is 0x7F - Can be set to 0x3, 0x7, 0xF, 0x1F, 0x7F."); |
| 203 | 203 | ||
| 204 | int ql2xmdenable; | 204 | int ql2xmdenable = 1; |
| 205 | module_param(ql2xmdenable, int, S_IRUGO); | 205 | module_param(ql2xmdenable, int, S_IRUGO); |
| 206 | MODULE_PARM_DESC(ql2xmdenable, | 206 | MODULE_PARM_DESC(ql2xmdenable, |
| 207 | "Enable/disable MiniDump. " | 207 | "Enable/disable MiniDump. " |
| 208 | "0 (Default) - MiniDump disabled. " | 208 | "0 - MiniDump disabled. " |
| 209 | "1 - MiniDump enabled."); | 209 | "1 (Default) - MiniDump enabled."); |
| 210 | 210 | ||
| 211 | /* | 211 | /* |
| 212 | * SCSI host template entry points | 212 | * SCSI host template entry points |
| @@ -423,6 +423,7 @@ fail2: | |||
| 423 | qla25xx_delete_queues(vha); | 423 | qla25xx_delete_queues(vha); |
| 424 | destroy_workqueue(ha->wq); | 424 | destroy_workqueue(ha->wq); |
| 425 | ha->wq = NULL; | 425 | ha->wq = NULL; |
| 426 | vha->req = ha->req_q_map[0]; | ||
| 426 | fail: | 427 | fail: |
| 427 | ha->mqenable = 0; | 428 | ha->mqenable = 0; |
| 428 | kfree(ha->req_q_map); | 429 | kfree(ha->req_q_map); |
| @@ -814,49 +815,6 @@ qla2x00_wait_for_chip_reset(scsi_qla_host_t *vha) | |||
| 814 | return return_status; | 815 | return return_status; |
| 815 | } | 816 | } |
| 816 | 817 | ||
| 817 | /* | ||
| 818 | * qla2x00_wait_for_loop_ready | ||
| 819 | * Wait for MAX_LOOP_TIMEOUT(5 min) value for loop | ||
| 820 | * to be in LOOP_READY state. | ||
| 821 | * Input: | ||
| 822 | * ha - pointer to host adapter structure | ||
| 823 | * | ||
| 824 | * Note: | ||
| 825 | * Does context switching-Release SPIN_LOCK | ||
| 826 | * (if any) before calling this routine. | ||
| 827 | * | ||
| 828 | * | ||
| 829 | * Return: | ||
| 830 | * Success (LOOP_READY) : 0 | ||
| 831 | * Failed (LOOP_NOT_READY) : 1 | ||
| 832 | */ | ||
| 833 | static inline int | ||
| 834 | qla2x00_wait_for_loop_ready(scsi_qla_host_t *vha) | ||
| 835 | { | ||
| 836 | int return_status = QLA_SUCCESS; | ||
| 837 | unsigned long loop_timeout ; | ||
| 838 | struct qla_hw_data *ha = vha->hw; | ||
| 839 | scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); | ||
| 840 | |||
| 841 | /* wait for 5 min at the max for loop to be ready */ | ||
| 842 | loop_timeout = jiffies + (MAX_LOOP_TIMEOUT * HZ); | ||
| 843 | |||
| 844 | while ((!atomic_read(&base_vha->loop_down_timer) && | ||
| 845 | atomic_read(&base_vha->loop_state) == LOOP_DOWN) || | ||
| 846 | atomic_read(&base_vha->loop_state) != LOOP_READY) { | ||
| 847 | if (atomic_read(&base_vha->loop_state) == LOOP_DEAD) { | ||
| 848 | return_status = QLA_FUNCTION_FAILED; | ||
| 849 | break; | ||
| 850 | } | ||
| 851 | msleep(1000); | ||
| 852 | if (time_after_eq(jiffies, loop_timeout)) { | ||
| 853 | return_status = QLA_FUNCTION_FAILED; | ||
| 854 | break; | ||
| 855 | } | ||
| 856 | } | ||
| 857 | return (return_status); | ||
| 858 | } | ||
| 859 | |||
| 860 | static void | 818 | static void |
| 861 | sp_get(struct srb *sp) | 819 | sp_get(struct srb *sp) |
| 862 | { | 820 | { |
| @@ -1035,12 +993,6 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, | |||
| 1035 | "Wait for hba online failed for cmd=%p.\n", cmd); | 993 | "Wait for hba online failed for cmd=%p.\n", cmd); |
| 1036 | goto eh_reset_failed; | 994 | goto eh_reset_failed; |
| 1037 | } | 995 | } |
| 1038 | err = 1; | ||
| 1039 | if (qla2x00_wait_for_loop_ready(vha) != QLA_SUCCESS) { | ||
| 1040 | ql_log(ql_log_warn, vha, 0x800b, | ||
| 1041 | "Wait for loop ready failed for cmd=%p.\n", cmd); | ||
| 1042 | goto eh_reset_failed; | ||
| 1043 | } | ||
| 1044 | err = 2; | 996 | err = 2; |
| 1045 | if (do_reset(fcport, cmd->device->lun, cmd->request->cpu + 1) | 997 | if (do_reset(fcport, cmd->device->lun, cmd->request->cpu + 1) |
| 1046 | != QLA_SUCCESS) { | 998 | != QLA_SUCCESS) { |
| @@ -1137,10 +1089,9 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) | |||
| 1137 | goto eh_bus_reset_done; | 1089 | goto eh_bus_reset_done; |
| 1138 | } | 1090 | } |
| 1139 | 1091 | ||
| 1140 | if (qla2x00_wait_for_loop_ready(vha) == QLA_SUCCESS) { | 1092 | if (qla2x00_loop_reset(vha) == QLA_SUCCESS) |
| 1141 | if (qla2x00_loop_reset(vha) == QLA_SUCCESS) | 1093 | ret = SUCCESS; |
| 1142 | ret = SUCCESS; | 1094 | |
| 1143 | } | ||
| 1144 | if (ret == FAILED) | 1095 | if (ret == FAILED) |
| 1145 | goto eh_bus_reset_done; | 1096 | goto eh_bus_reset_done; |
| 1146 | 1097 | ||
| @@ -1206,15 +1157,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) | |||
| 1206 | if (qla2x00_wait_for_reset_ready(vha) != QLA_SUCCESS) | 1157 | if (qla2x00_wait_for_reset_ready(vha) != QLA_SUCCESS) |
| 1207 | goto eh_host_reset_lock; | 1158 | goto eh_host_reset_lock; |
| 1208 | 1159 | ||
| 1209 | /* | ||
| 1210 | * Fixme-may be dpc thread is active and processing | ||
| 1211 | * loop_resync,so wait a while for it to | ||
| 1212 | * be completed and then issue big hammer.Otherwise | ||
| 1213 | * it may cause I/O failure as big hammer marks the | ||
| 1214 | * devices as lost kicking of the port_down_timer | ||
| 1215 | * while dpc is stuck for the mailbox to complete. | ||
| 1216 | */ | ||
| 1217 | qla2x00_wait_for_loop_ready(vha); | ||
| 1218 | if (vha != base_vha) { | 1160 | if (vha != base_vha) { |
| 1219 | if (qla2x00_vp_abort_isp(vha)) | 1161 | if (qla2x00_vp_abort_isp(vha)) |
| 1220 | goto eh_host_reset_lock; | 1162 | goto eh_host_reset_lock; |
| @@ -1297,16 +1239,13 @@ qla2x00_loop_reset(scsi_qla_host_t *vha) | |||
| 1297 | atomic_set(&vha->loop_state, LOOP_DOWN); | 1239 | atomic_set(&vha->loop_state, LOOP_DOWN); |
| 1298 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); | 1240 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); |
| 1299 | qla2x00_mark_all_devices_lost(vha, 0); | 1241 | qla2x00_mark_all_devices_lost(vha, 0); |
| 1300 | qla2x00_wait_for_loop_ready(vha); | ||
| 1301 | } | 1242 | } |
| 1302 | 1243 | ||
| 1303 | if (ha->flags.enable_lip_reset) { | 1244 | if (ha->flags.enable_lip_reset) { |
| 1304 | ret = qla2x00_lip_reset(vha); | 1245 | ret = qla2x00_lip_reset(vha); |
| 1305 | if (ret != QLA_SUCCESS) { | 1246 | if (ret != QLA_SUCCESS) |
| 1306 | ql_dbg(ql_dbg_taskm, vha, 0x802e, | 1247 | ql_dbg(ql_dbg_taskm, vha, 0x802e, |
| 1307 | "lip_reset failed (%d).\n", ret); | 1248 | "lip_reset failed (%d).\n", ret); |
| 1308 | } else | ||
| 1309 | qla2x00_wait_for_loop_ready(vha); | ||
| 1310 | } | 1249 | } |
| 1311 | 1250 | ||
| 1312 | /* Issue marker command only when we are going to start the I/O */ | 1251 | /* Issue marker command only when we are going to start the I/O */ |
| @@ -4070,13 +4009,8 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state) | |||
| 4070 | /* For ISP82XX complete any pending mailbox cmd */ | 4009 | /* For ISP82XX complete any pending mailbox cmd */ |
| 4071 | if (IS_QLA82XX(ha)) { | 4010 | if (IS_QLA82XX(ha)) { |
| 4072 | ha->flags.isp82xx_fw_hung = 1; | 4011 | ha->flags.isp82xx_fw_hung = 1; |
| 4073 | if (ha->flags.mbox_busy) { | 4012 | ql_dbg(ql_dbg_aer, vha, 0x9001, "Pci channel io frozen\n"); |
| 4074 | ha->flags.mbox_int = 1; | 4013 | qla82xx_clear_pending_mbx(vha); |
| 4075 | ql_dbg(ql_dbg_aer, vha, 0x9001, | ||
| 4076 | "Due to pci channel io frozen, doing premature " | ||
| 4077 | "completion of mbx command.\n"); | ||
| 4078 | complete(&ha->mbx_intr_comp); | ||
| 4079 | } | ||
| 4080 | } | 4014 | } |
| 4081 | qla2x00_free_irqs(vha); | 4015 | qla2x00_free_irqs(vha); |
| 4082 | pci_disable_device(pdev); | 4016 | pci_disable_device(pdev); |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 13b6357c1fa2..23f33a6d52d7 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | /* | 7 | /* |
| 8 | * Driver version | 8 | * Driver version |
| 9 | */ | 9 | */ |
| 10 | #define QLA2XXX_VERSION "8.03.07.07-k" | 10 | #define QLA2XXX_VERSION "8.03.07.12-k" |
| 11 | 11 | ||
| 12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
| 13 | #define QLA_DRIVER_MINOR_VER 3 | 13 | #define QLA_DRIVER_MINOR_VER 3 |
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h index ace637bf254e..fd5edc6e166d 100644 --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h | |||
| @@ -147,7 +147,7 @@ | |||
| 147 | #define ISCSI_ALIAS_SIZE 32 /* ISCSI Alias name size */ | 147 | #define ISCSI_ALIAS_SIZE 32 /* ISCSI Alias name size */ |
| 148 | #define ISCSI_NAME_SIZE 0xE0 /* ISCSI Name size */ | 148 | #define ISCSI_NAME_SIZE 0xE0 /* ISCSI Name size */ |
| 149 | 149 | ||
| 150 | #define QL4_SESS_RECOVERY_TMO 30 /* iSCSI session */ | 150 | #define QL4_SESS_RECOVERY_TMO 120 /* iSCSI session */ |
| 151 | /* recovery timeout */ | 151 | /* recovery timeout */ |
| 152 | 152 | ||
| 153 | #define LSDW(x) ((u32)((u64)(x))) | 153 | #define LSDW(x) ((u32)((u64)(x))) |
| @@ -173,6 +173,8 @@ | |||
| 173 | #define ISNS_DEREG_TOV 5 | 173 | #define ISNS_DEREG_TOV 5 |
| 174 | #define HBA_ONLINE_TOV 30 | 174 | #define HBA_ONLINE_TOV 30 |
| 175 | #define DISABLE_ACB_TOV 30 | 175 | #define DISABLE_ACB_TOV 30 |
| 176 | #define IP_CONFIG_TOV 30 | ||
| 177 | #define LOGIN_TOV 12 | ||
| 176 | 178 | ||
| 177 | #define MAX_RESET_HA_RETRIES 2 | 179 | #define MAX_RESET_HA_RETRIES 2 |
| 178 | 180 | ||
| @@ -240,6 +242,45 @@ struct ddb_entry { | |||
| 240 | 242 | ||
| 241 | uint16_t fw_ddb_index; /* DDB firmware index */ | 243 | uint16_t fw_ddb_index; /* DDB firmware index */ |
| 242 | uint32_t fw_ddb_device_state; /* F/W Device State -- see ql4_fw.h */ | 244 | uint32_t fw_ddb_device_state; /* F/W Device State -- see ql4_fw.h */ |
| 245 | uint16_t ddb_type; | ||
| 246 | #define FLASH_DDB 0x01 | ||
| 247 | |||
| 248 | struct dev_db_entry fw_ddb_entry; | ||
| 249 | int (*unblock_sess)(struct iscsi_cls_session *cls_session); | ||
| 250 | int (*ddb_change)(struct scsi_qla_host *ha, uint32_t fw_ddb_index, | ||
| 251 | struct ddb_entry *ddb_entry, uint32_t state); | ||
| 252 | |||
| 253 | /* Driver Re-login */ | ||
| 254 | unsigned long flags; /* DDB Flags */ | ||
| 255 | uint16_t default_relogin_timeout; /* Max time to wait for | ||
| 256 | * relogin to complete */ | ||
| 257 | atomic_t retry_relogin_timer; /* Min Time between relogins | ||
| 258 | * (4000 only) */ | ||
| 259 | atomic_t relogin_timer; /* Max Time to wait for | ||
| 260 | * relogin to complete */ | ||
| 261 | atomic_t relogin_retry_count; /* Num of times relogin has been | ||
| 262 | * retried */ | ||
| 263 | uint32_t default_time2wait; /* Default Min time between | ||
| 264 | * relogins (+aens) */ | ||
| 265 | |||
| 266 | }; | ||
| 267 | |||
| 268 | struct qla_ddb_index { | ||
| 269 | struct list_head list; | ||
| 270 | uint16_t fw_ddb_idx; | ||
| 271 | struct dev_db_entry fw_ddb; | ||
| 272 | }; | ||
| 273 | |||
| 274 | #define DDB_IPADDR_LEN 64 | ||
| 275 | |||
| 276 | struct ql4_tuple_ddb { | ||
| 277 | int port; | ||
| 278 | int tpgt; | ||
| 279 | char ip_addr[DDB_IPADDR_LEN]; | ||
| 280 | char iscsi_name[ISCSI_NAME_SIZE]; | ||
| 281 | uint16_t options; | ||
| 282 | #define DDB_OPT_IPV6 0x0e0e | ||
| 283 | #define DDB_OPT_IPV4 0x0f0f | ||
| 243 | }; | 284 | }; |
| 244 | 285 | ||
| 245 | /* | 286 | /* |
| @@ -411,7 +452,7 @@ struct scsi_qla_host { | |||
| 411 | #define AF_FW_RECOVERY 19 /* 0x00080000 */ | 452 | #define AF_FW_RECOVERY 19 /* 0x00080000 */ |
| 412 | #define AF_EEH_BUSY 20 /* 0x00100000 */ | 453 | #define AF_EEH_BUSY 20 /* 0x00100000 */ |
| 413 | #define AF_PCI_CHANNEL_IO_PERM_FAILURE 21 /* 0x00200000 */ | 454 | #define AF_PCI_CHANNEL_IO_PERM_FAILURE 21 /* 0x00200000 */ |
| 414 | 455 | #define AF_BUILD_DDB_LIST 22 /* 0x00400000 */ | |
| 415 | unsigned long dpc_flags; | 456 | unsigned long dpc_flags; |
| 416 | 457 | ||
| 417 | #define DPC_RESET_HA 1 /* 0x00000002 */ | 458 | #define DPC_RESET_HA 1 /* 0x00000002 */ |
| @@ -604,6 +645,7 @@ struct scsi_qla_host { | |||
| 604 | uint16_t bootload_minor; | 645 | uint16_t bootload_minor; |
| 605 | uint16_t bootload_patch; | 646 | uint16_t bootload_patch; |
| 606 | uint16_t bootload_build; | 647 | uint16_t bootload_build; |
| 648 | uint16_t def_timeout; /* Default login timeout */ | ||
| 607 | 649 | ||
| 608 | uint32_t flash_state; | 650 | uint32_t flash_state; |
| 609 | #define QLFLASH_WAITING 0 | 651 | #define QLFLASH_WAITING 0 |
| @@ -623,6 +665,11 @@ struct scsi_qla_host { | |||
| 623 | uint16_t iscsi_pci_func_cnt; | 665 | uint16_t iscsi_pci_func_cnt; |
| 624 | uint8_t model_name[16]; | 666 | uint8_t model_name[16]; |
| 625 | struct completion disable_acb_comp; | 667 | struct completion disable_acb_comp; |
| 668 | struct dma_pool *fw_ddb_dma_pool; | ||
| 669 | #define DDB_DMA_BLOCK_SIZE 512 | ||
| 670 | uint16_t pri_ddb_idx; | ||
| 671 | uint16_t sec_ddb_idx; | ||
| 672 | int is_reset; | ||
| 626 | }; | 673 | }; |
| 627 | 674 | ||
| 628 | struct ql4_task_data { | 675 | struct ql4_task_data { |
| @@ -835,6 +882,10 @@ static inline int ql4xxx_reset_active(struct scsi_qla_host *ha) | |||
| 835 | /*---------------------------------------------------------------------------*/ | 882 | /*---------------------------------------------------------------------------*/ |
| 836 | 883 | ||
| 837 | /* Defines for qla4xxx_initialize_adapter() and qla4xxx_recover_adapter() */ | 884 | /* Defines for qla4xxx_initialize_adapter() and qla4xxx_recover_adapter() */ |
| 885 | |||
| 886 | #define INIT_ADAPTER 0 | ||
| 887 | #define RESET_ADAPTER 1 | ||
| 888 | |||
| 838 | #define PRESERVE_DDB_LIST 0 | 889 | #define PRESERVE_DDB_LIST 0 |
| 839 | #define REBUILD_DDB_LIST 1 | 890 | #define REBUILD_DDB_LIST 1 |
| 840 | 891 | ||
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h index cbd5a20dbbd1..4ac07f882521 100644 --- a/drivers/scsi/qla4xxx/ql4_fw.h +++ b/drivers/scsi/qla4xxx/ql4_fw.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #define MAX_PRST_DEV_DB_ENTRIES 64 | 12 | #define MAX_PRST_DEV_DB_ENTRIES 64 |
| 13 | #define MIN_DISC_DEV_DB_ENTRY MAX_PRST_DEV_DB_ENTRIES | 13 | #define MIN_DISC_DEV_DB_ENTRY MAX_PRST_DEV_DB_ENTRIES |
| 14 | #define MAX_DEV_DB_ENTRIES 512 | 14 | #define MAX_DEV_DB_ENTRIES 512 |
| 15 | #define MAX_DEV_DB_ENTRIES_40XX 256 | ||
| 15 | 16 | ||
| 16 | /************************************************************************* | 17 | /************************************************************************* |
| 17 | * | 18 | * |
| @@ -604,6 +605,13 @@ struct addr_ctrl_blk { | |||
| 604 | uint8_t res14[140]; /* 274-2FF */ | 605 | uint8_t res14[140]; /* 274-2FF */ |
| 605 | }; | 606 | }; |
| 606 | 607 | ||
| 608 | #define IP_ADDR_COUNT 4 /* Total 4 IP address supported in one interface | ||
| 609 | * One IPv4, one IPv6 link local and 2 IPv6 | ||
| 610 | */ | ||
| 611 | |||
| 612 | #define IP_STATE_MASK 0x0F000000 | ||
| 613 | #define IP_STATE_SHIFT 24 | ||
| 614 | |||
| 607 | struct init_fw_ctrl_blk { | 615 | struct init_fw_ctrl_blk { |
| 608 | struct addr_ctrl_blk pri; | 616 | struct addr_ctrl_blk pri; |
| 609 | /* struct addr_ctrl_blk sec;*/ | 617 | /* struct addr_ctrl_blk sec;*/ |
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h index 160db9d5ea21..d0dd4b330206 100644 --- a/drivers/scsi/qla4xxx/ql4_glbl.h +++ b/drivers/scsi/qla4xxx/ql4_glbl.h | |||
| @@ -13,7 +13,7 @@ struct iscsi_cls_conn; | |||
| 13 | int qla4xxx_hw_reset(struct scsi_qla_host *ha); | 13 | int qla4xxx_hw_reset(struct scsi_qla_host *ha); |
| 14 | int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a); | 14 | int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a); |
| 15 | int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb *srb); | 15 | int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb *srb); |
| 16 | int qla4xxx_initialize_adapter(struct scsi_qla_host *ha); | 16 | int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset); |
| 17 | int qla4xxx_soft_reset(struct scsi_qla_host *ha); | 17 | int qla4xxx_soft_reset(struct scsi_qla_host *ha); |
| 18 | irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id); | 18 | irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id); |
| 19 | 19 | ||
| @@ -153,10 +153,13 @@ int qla4xxx_req_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index, | |||
| 153 | uint32_t *mbx_sts); | 153 | uint32_t *mbx_sts); |
| 154 | int qla4xxx_clear_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index); | 154 | int qla4xxx_clear_ddb_entry(struct scsi_qla_host *ha, uint32_t fw_ddb_index); |
| 155 | int qla4xxx_send_passthru0(struct iscsi_task *task); | 155 | int qla4xxx_send_passthru0(struct iscsi_task *task); |
| 156 | void qla4xxx_free_ddb_index(struct scsi_qla_host *ha); | ||
| 156 | int qla4xxx_get_mgmt_data(struct scsi_qla_host *ha, uint16_t fw_ddb_index, | 157 | int qla4xxx_get_mgmt_data(struct scsi_qla_host *ha, uint16_t fw_ddb_index, |
| 157 | uint16_t stats_size, dma_addr_t stats_dma); | 158 | uint16_t stats_size, dma_addr_t stats_dma); |
| 158 | void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, | 159 | void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, |
| 159 | struct ddb_entry *ddb_entry); | 160 | struct ddb_entry *ddb_entry); |
| 161 | void qla4xxx_update_session_conn_fwddb_param(struct scsi_qla_host *ha, | ||
| 162 | struct ddb_entry *ddb_entry); | ||
| 160 | int qla4xxx_bootdb_by_index(struct scsi_qla_host *ha, | 163 | int qla4xxx_bootdb_by_index(struct scsi_qla_host *ha, |
| 161 | struct dev_db_entry *fw_ddb_entry, | 164 | struct dev_db_entry *fw_ddb_entry, |
| 162 | dma_addr_t fw_ddb_entry_dma, uint16_t ddb_index); | 165 | dma_addr_t fw_ddb_entry_dma, uint16_t ddb_index); |
| @@ -169,11 +172,22 @@ int qla4xxx_set_nvram(struct scsi_qla_host *ha, dma_addr_t nvram_dma, | |||
| 169 | int qla4xxx_restore_factory_defaults(struct scsi_qla_host *ha, | 172 | int qla4xxx_restore_factory_defaults(struct scsi_qla_host *ha, |
| 170 | uint32_t region, uint32_t field0, | 173 | uint32_t region, uint32_t field0, |
| 171 | uint32_t field1); | 174 | uint32_t field1); |
| 175 | int qla4xxx_get_ddb_index(struct scsi_qla_host *ha, uint16_t *ddb_index); | ||
| 176 | void qla4xxx_login_flash_ddb(struct iscsi_cls_session *cls_session); | ||
| 177 | int qla4xxx_unblock_ddb(struct iscsi_cls_session *cls_session); | ||
| 178 | int qla4xxx_unblock_flash_ddb(struct iscsi_cls_session *cls_session); | ||
| 179 | int qla4xxx_flash_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, | ||
| 180 | struct ddb_entry *ddb_entry, uint32_t state); | ||
| 181 | int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, | ||
| 182 | struct ddb_entry *ddb_entry, uint32_t state); | ||
| 183 | void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset); | ||
| 172 | 184 | ||
| 173 | /* BSG Functions */ | 185 | /* BSG Functions */ |
| 174 | int qla4xxx_bsg_request(struct bsg_job *bsg_job); | 186 | int qla4xxx_bsg_request(struct bsg_job *bsg_job); |
| 175 | int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job); | 187 | int qla4xxx_process_vendor_specific(struct bsg_job *bsg_job); |
| 176 | 188 | ||
| 189 | void qla4xxx_arm_relogin_timer(struct ddb_entry *ddb_entry); | ||
| 190 | |||
| 177 | extern int ql4xextended_error_logging; | 191 | extern int ql4xextended_error_logging; |
| 178 | extern int ql4xdontresethba; | 192 | extern int ql4xdontresethba; |
| 179 | extern int ql4xenablemsix; | 193 | extern int ql4xenablemsix; |
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index 3075fbaef553..1bdfa8120ac8 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c | |||
| @@ -773,22 +773,24 @@ int qla4xxx_start_firmware(struct scsi_qla_host *ha) | |||
| 773 | * be freed so that when login happens from user space there are free DDB | 773 | * be freed so that when login happens from user space there are free DDB |
| 774 | * indices available. | 774 | * indices available. |
| 775 | **/ | 775 | **/ |
| 776 | static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) | 776 | void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) |
| 777 | { | 777 | { |
| 778 | int max_ddbs; | 778 | int max_ddbs; |
| 779 | int ret; | 779 | int ret; |
| 780 | uint32_t idx = 0, next_idx = 0; | 780 | uint32_t idx = 0, next_idx = 0; |
| 781 | uint32_t state = 0, conn_err = 0; | 781 | uint32_t state = 0, conn_err = 0; |
| 782 | 782 | ||
| 783 | max_ddbs = is_qla40XX(ha) ? MAX_PRST_DEV_DB_ENTRIES : | 783 | max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : |
| 784 | MAX_DEV_DB_ENTRIES; | 784 | MAX_DEV_DB_ENTRIES; |
| 785 | 785 | ||
| 786 | for (idx = 0; idx < max_ddbs; idx = next_idx) { | 786 | for (idx = 0; idx < max_ddbs; idx = next_idx) { |
| 787 | ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL, | 787 | ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL, |
| 788 | &next_idx, &state, &conn_err, | 788 | &next_idx, &state, &conn_err, |
| 789 | NULL, NULL); | 789 | NULL, NULL); |
| 790 | if (ret == QLA_ERROR) | 790 | if (ret == QLA_ERROR) { |
| 791 | next_idx++; | ||
| 791 | continue; | 792 | continue; |
| 793 | } | ||
| 792 | if (state == DDB_DS_NO_CONNECTION_ACTIVE || | 794 | if (state == DDB_DS_NO_CONNECTION_ACTIVE || |
| 793 | state == DDB_DS_SESSION_FAILED) { | 795 | state == DDB_DS_SESSION_FAILED) { |
| 794 | DEBUG2(ql4_printk(KERN_INFO, ha, | 796 | DEBUG2(ql4_printk(KERN_INFO, ha, |
| @@ -804,7 +806,6 @@ static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) | |||
| 804 | } | 806 | } |
| 805 | } | 807 | } |
| 806 | 808 | ||
| 807 | |||
| 808 | /** | 809 | /** |
| 809 | * qla4xxx_initialize_adapter - initiailizes hba | 810 | * qla4xxx_initialize_adapter - initiailizes hba |
| 810 | * @ha: Pointer to host adapter structure. | 811 | * @ha: Pointer to host adapter structure. |
| @@ -812,7 +813,7 @@ static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) | |||
| 812 | * This routine parforms all of the steps necessary to initialize the adapter. | 813 | * This routine parforms all of the steps necessary to initialize the adapter. |
| 813 | * | 814 | * |
| 814 | **/ | 815 | **/ |
| 815 | int qla4xxx_initialize_adapter(struct scsi_qla_host *ha) | 816 | int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset) |
| 816 | { | 817 | { |
| 817 | int status = QLA_ERROR; | 818 | int status = QLA_ERROR; |
| 818 | 819 | ||
| @@ -840,7 +841,8 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha) | |||
| 840 | if (status == QLA_ERROR) | 841 | if (status == QLA_ERROR) |
| 841 | goto exit_init_hba; | 842 | goto exit_init_hba; |
| 842 | 843 | ||
| 843 | qla4xxx_free_ddb_index(ha); | 844 | if (is_reset == RESET_ADAPTER) |
| 845 | qla4xxx_build_ddb_list(ha, is_reset); | ||
| 844 | 846 | ||
| 845 | set_bit(AF_ONLINE, &ha->flags); | 847 | set_bit(AF_ONLINE, &ha->flags); |
| 846 | exit_init_hba: | 848 | exit_init_hba: |
| @@ -855,38 +857,12 @@ exit_init_hba: | |||
| 855 | return status; | 857 | return status; |
| 856 | } | 858 | } |
| 857 | 859 | ||
| 858 | /** | 860 | int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, |
| 859 | * qla4xxx_process_ddb_changed - process ddb state change | 861 | struct ddb_entry *ddb_entry, uint32_t state) |
| 860 | * @ha - Pointer to host adapter structure. | ||
| 861 | * @fw_ddb_index - Firmware's device database index | ||
| 862 | * @state - Device state | ||
| 863 | * | ||
| 864 | * This routine processes a Decive Database Changed AEN Event. | ||
| 865 | **/ | ||
| 866 | int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index, | ||
| 867 | uint32_t state, uint32_t conn_err) | ||
| 868 | { | 862 | { |
| 869 | struct ddb_entry * ddb_entry; | ||
| 870 | uint32_t old_fw_ddb_device_state; | 863 | uint32_t old_fw_ddb_device_state; |
| 871 | int status = QLA_ERROR; | 864 | int status = QLA_ERROR; |
| 872 | 865 | ||
| 873 | /* check for out of range index */ | ||
| 874 | if (fw_ddb_index >= MAX_DDB_ENTRIES) | ||
| 875 | goto exit_ddb_event; | ||
| 876 | |||
| 877 | /* Get the corresponging ddb entry */ | ||
| 878 | ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index); | ||
| 879 | /* Device does not currently exist in our database. */ | ||
| 880 | if (ddb_entry == NULL) { | ||
| 881 | ql4_printk(KERN_ERR, ha, "%s: No ddb_entry at FW index [%d]\n", | ||
| 882 | __func__, fw_ddb_index); | ||
| 883 | |||
| 884 | if (state == DDB_DS_NO_CONNECTION_ACTIVE) | ||
| 885 | clear_bit(fw_ddb_index, ha->ddb_idx_map); | ||
| 886 | |||
| 887 | goto exit_ddb_event; | ||
| 888 | } | ||
| 889 | |||
| 890 | old_fw_ddb_device_state = ddb_entry->fw_ddb_device_state; | 866 | old_fw_ddb_device_state = ddb_entry->fw_ddb_device_state; |
| 891 | DEBUG2(ql4_printk(KERN_INFO, ha, | 867 | DEBUG2(ql4_printk(KERN_INFO, ha, |
| 892 | "%s: DDB - old state = 0x%x, new state = 0x%x for " | 868 | "%s: DDB - old state = 0x%x, new state = 0x%x for " |
| @@ -900,9 +876,7 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index, | |||
| 900 | switch (state) { | 876 | switch (state) { |
| 901 | case DDB_DS_SESSION_ACTIVE: | 877 | case DDB_DS_SESSION_ACTIVE: |
| 902 | case DDB_DS_DISCOVERY: | 878 | case DDB_DS_DISCOVERY: |
| 903 | iscsi_conn_start(ddb_entry->conn); | 879 | ddb_entry->unblock_sess(ddb_entry->sess); |
| 904 | iscsi_conn_login_event(ddb_entry->conn, | ||
| 905 | ISCSI_CONN_STATE_LOGGED_IN); | ||
| 906 | qla4xxx_update_session_conn_param(ha, ddb_entry); | 880 | qla4xxx_update_session_conn_param(ha, ddb_entry); |
| 907 | status = QLA_SUCCESS; | 881 | status = QLA_SUCCESS; |
| 908 | break; | 882 | break; |
| @@ -936,9 +910,7 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index, | |||
| 936 | switch (state) { | 910 | switch (state) { |
| 937 | case DDB_DS_SESSION_ACTIVE: | 911 | case DDB_DS_SESSION_ACTIVE: |
| 938 | case DDB_DS_DISCOVERY: | 912 | case DDB_DS_DISCOVERY: |
| 939 | iscsi_conn_start(ddb_entry->conn); | 913 | ddb_entry->unblock_sess(ddb_entry->sess); |
| 940 | iscsi_conn_login_event(ddb_entry->conn, | ||
| 941 | ISCSI_CONN_STATE_LOGGED_IN); | ||
| 942 | qla4xxx_update_session_conn_param(ha, ddb_entry); | 914 | qla4xxx_update_session_conn_param(ha, ddb_entry); |
| 943 | status = QLA_SUCCESS; | 915 | status = QLA_SUCCESS; |
| 944 | break; | 916 | break; |
| @@ -954,7 +926,198 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index, | |||
| 954 | __func__)); | 926 | __func__)); |
| 955 | break; | 927 | break; |
| 956 | } | 928 | } |
| 929 | return status; | ||
| 930 | } | ||
| 931 | |||
| 932 | void qla4xxx_arm_relogin_timer(struct ddb_entry *ddb_entry) | ||
| 933 | { | ||
| 934 | /* | ||
| 935 | * This triggers a relogin. After the relogin_timer | ||
| 936 | * expires, the relogin gets scheduled. We must wait a | ||
| 937 | * minimum amount of time since receiving an 0x8014 AEN | ||
| 938 | * with failed device_state or a logout response before | ||
| 939 | * we can issue another relogin. | ||
| 940 | * | ||
| 941 | * Firmware pads this timeout: (time2wait +1). | ||
| 942 | * Driver retry to login should be longer than F/W. | ||
| 943 | * Otherwise F/W will fail | ||
| 944 | * set_ddb() mbx cmd with 0x4005 since it still | ||
| 945 | * counting down its time2wait. | ||
| 946 | */ | ||
| 947 | atomic_set(&ddb_entry->relogin_timer, 0); | ||
| 948 | atomic_set(&ddb_entry->retry_relogin_timer, | ||
| 949 | ddb_entry->default_time2wait + 4); | ||
| 950 | |||
| 951 | } | ||
| 952 | |||
| 953 | int qla4xxx_flash_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, | ||
| 954 | struct ddb_entry *ddb_entry, uint32_t state) | ||
| 955 | { | ||
| 956 | uint32_t old_fw_ddb_device_state; | ||
| 957 | int status = QLA_ERROR; | ||
| 958 | |||
| 959 | old_fw_ddb_device_state = ddb_entry->fw_ddb_device_state; | ||
| 960 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 961 | "%s: DDB - old state = 0x%x, new state = 0x%x for " | ||
| 962 | "index [%d]\n", __func__, | ||
| 963 | ddb_entry->fw_ddb_device_state, state, fw_ddb_index)); | ||
| 964 | |||
| 965 | ddb_entry->fw_ddb_device_state = state; | ||
| 966 | |||
| 967 | switch (old_fw_ddb_device_state) { | ||
| 968 | case DDB_DS_LOGIN_IN_PROCESS: | ||
| 969 | case DDB_DS_NO_CONNECTION_ACTIVE: | ||
| 970 | switch (state) { | ||
| 971 | case DDB_DS_SESSION_ACTIVE: | ||
| 972 | ddb_entry->unblock_sess(ddb_entry->sess); | ||
| 973 | qla4xxx_update_session_conn_fwddb_param(ha, ddb_entry); | ||
| 974 | status = QLA_SUCCESS; | ||
| 975 | break; | ||
| 976 | case DDB_DS_SESSION_FAILED: | ||
| 977 | iscsi_block_session(ddb_entry->sess); | ||
| 978 | if (!test_bit(DF_RELOGIN, &ddb_entry->flags)) | ||
| 979 | qla4xxx_arm_relogin_timer(ddb_entry); | ||
| 980 | status = QLA_SUCCESS; | ||
| 981 | break; | ||
| 982 | } | ||
| 983 | break; | ||
| 984 | case DDB_DS_SESSION_ACTIVE: | ||
| 985 | switch (state) { | ||
| 986 | case DDB_DS_SESSION_FAILED: | ||
| 987 | iscsi_block_session(ddb_entry->sess); | ||
| 988 | if (!test_bit(DF_RELOGIN, &ddb_entry->flags)) | ||
| 989 | qla4xxx_arm_relogin_timer(ddb_entry); | ||
| 990 | status = QLA_SUCCESS; | ||
| 991 | break; | ||
| 992 | } | ||
| 993 | break; | ||
| 994 | case DDB_DS_SESSION_FAILED: | ||
| 995 | switch (state) { | ||
| 996 | case DDB_DS_SESSION_ACTIVE: | ||
| 997 | ddb_entry->unblock_sess(ddb_entry->sess); | ||
| 998 | qla4xxx_update_session_conn_fwddb_param(ha, ddb_entry); | ||
| 999 | status = QLA_SUCCESS; | ||
| 1000 | break; | ||
| 1001 | case DDB_DS_SESSION_FAILED: | ||
| 1002 | if (!test_bit(DF_RELOGIN, &ddb_entry->flags)) | ||
| 1003 | qla4xxx_arm_relogin_timer(ddb_entry); | ||
| 1004 | status = QLA_SUCCESS; | ||
| 1005 | break; | ||
| 1006 | } | ||
| 1007 | break; | ||
| 1008 | default: | ||
| 1009 | DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Unknown Event\n", | ||
| 1010 | __func__)); | ||
| 1011 | break; | ||
| 1012 | } | ||
| 1013 | return status; | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | /** | ||
| 1017 | * qla4xxx_process_ddb_changed - process ddb state change | ||
| 1018 | * @ha - Pointer to host adapter structure. | ||
| 1019 | * @fw_ddb_index - Firmware's device database index | ||
| 1020 | * @state - Device state | ||
| 1021 | * | ||
| 1022 | * This routine processes a Decive Database Changed AEN Event. | ||
| 1023 | **/ | ||
| 1024 | int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, | ||
| 1025 | uint32_t fw_ddb_index, | ||
| 1026 | uint32_t state, uint32_t conn_err) | ||
| 1027 | { | ||
| 1028 | struct ddb_entry *ddb_entry; | ||
| 1029 | int status = QLA_ERROR; | ||
| 1030 | |||
| 1031 | /* check for out of range index */ | ||
| 1032 | if (fw_ddb_index >= MAX_DDB_ENTRIES) | ||
| 1033 | goto exit_ddb_event; | ||
| 1034 | |||
| 1035 | /* Get the corresponging ddb entry */ | ||
| 1036 | ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index); | ||
| 1037 | /* Device does not currently exist in our database. */ | ||
| 1038 | if (ddb_entry == NULL) { | ||
| 1039 | ql4_printk(KERN_ERR, ha, "%s: No ddb_entry at FW index [%d]\n", | ||
| 1040 | __func__, fw_ddb_index); | ||
| 1041 | |||
| 1042 | if (state == DDB_DS_NO_CONNECTION_ACTIVE) | ||
| 1043 | clear_bit(fw_ddb_index, ha->ddb_idx_map); | ||
| 1044 | |||
| 1045 | goto exit_ddb_event; | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | ddb_entry->ddb_change(ha, fw_ddb_index, ddb_entry, state); | ||
| 957 | 1049 | ||
| 958 | exit_ddb_event: | 1050 | exit_ddb_event: |
| 959 | return status; | 1051 | return status; |
| 960 | } | 1052 | } |
| 1053 | |||
| 1054 | /** | ||
| 1055 | * qla4xxx_login_flash_ddb - Login to target (DDB) | ||
| 1056 | * @cls_session: Pointer to the session to login | ||
| 1057 | * | ||
| 1058 | * This routine logins to the target. | ||
| 1059 | * Issues setddb and conn open mbx | ||
| 1060 | **/ | ||
| 1061 | void qla4xxx_login_flash_ddb(struct iscsi_cls_session *cls_session) | ||
| 1062 | { | ||
| 1063 | struct iscsi_session *sess; | ||
| 1064 | struct ddb_entry *ddb_entry; | ||
| 1065 | struct scsi_qla_host *ha; | ||
| 1066 | struct dev_db_entry *fw_ddb_entry = NULL; | ||
| 1067 | dma_addr_t fw_ddb_dma; | ||
| 1068 | uint32_t mbx_sts = 0; | ||
| 1069 | int ret; | ||
| 1070 | |||
| 1071 | sess = cls_session->dd_data; | ||
| 1072 | ddb_entry = sess->dd_data; | ||
| 1073 | ha = ddb_entry->ha; | ||
| 1074 | |||
| 1075 | if (!test_bit(AF_LINK_UP, &ha->flags)) | ||
| 1076 | return; | ||
| 1077 | |||
| 1078 | if (ddb_entry->ddb_type != FLASH_DDB) { | ||
| 1079 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1080 | "Skipping login to non FLASH DB")); | ||
| 1081 | goto exit_login; | ||
| 1082 | } | ||
| 1083 | |||
| 1084 | fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, | ||
| 1085 | &fw_ddb_dma); | ||
| 1086 | if (fw_ddb_entry == NULL) { | ||
| 1087 | DEBUG2(ql4_printk(KERN_ERR, ha, "Out of memory\n")); | ||
| 1088 | goto exit_login; | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | if (ddb_entry->fw_ddb_index == INVALID_ENTRY) { | ||
| 1092 | ret = qla4xxx_get_ddb_index(ha, &ddb_entry->fw_ddb_index); | ||
| 1093 | if (ret == QLA_ERROR) | ||
| 1094 | goto exit_login; | ||
| 1095 | |||
| 1096 | ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry; | ||
| 1097 | ha->tot_ddbs++; | ||
| 1098 | } | ||
| 1099 | |||
| 1100 | memcpy(fw_ddb_entry, &ddb_entry->fw_ddb_entry, | ||
| 1101 | sizeof(struct dev_db_entry)); | ||
| 1102 | ddb_entry->sess->target_id = ddb_entry->fw_ddb_index; | ||
| 1103 | |||
| 1104 | ret = qla4xxx_set_ddb_entry(ha, ddb_entry->fw_ddb_index, | ||
| 1105 | fw_ddb_dma, &mbx_sts); | ||
| 1106 | if (ret == QLA_ERROR) { | ||
| 1107 | DEBUG2(ql4_printk(KERN_ERR, ha, "Set DDB failed\n")); | ||
| 1108 | goto exit_login; | ||
| 1109 | } | ||
| 1110 | |||
| 1111 | ddb_entry->fw_ddb_device_state = DDB_DS_LOGIN_IN_PROCESS; | ||
| 1112 | ret = qla4xxx_conn_open(ha, ddb_entry->fw_ddb_index); | ||
| 1113 | if (ret == QLA_ERROR) { | ||
| 1114 | ql4_printk(KERN_ERR, ha, "%s: Login failed: %s\n", __func__, | ||
| 1115 | sess->targetname); | ||
| 1116 | goto exit_login; | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | exit_login: | ||
| 1120 | if (fw_ddb_entry) | ||
| 1121 | dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); | ||
| 1122 | } | ||
| 1123 | |||
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index 4c2b84870392..c2593782fbbe 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
| @@ -41,6 +41,16 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, | |||
| 41 | return status; | 41 | return status; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | if (is_qla40XX(ha)) { | ||
| 45 | if (test_bit(AF_HA_REMOVAL, &ha->flags)) { | ||
| 46 | DEBUG2(ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: " | ||
| 47 | "prematurely completing mbx cmd as " | ||
| 48 | "adapter removal detected\n", | ||
| 49 | ha->host_no, __func__)); | ||
| 50 | return status; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 44 | if (is_qla8022(ha)) { | 54 | if (is_qla8022(ha)) { |
| 45 | if (test_bit(AF_FW_RECOVERY, &ha->flags)) { | 55 | if (test_bit(AF_FW_RECOVERY, &ha->flags)) { |
| 46 | DEBUG2(ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: " | 56 | DEBUG2(ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: " |
| @@ -413,6 +423,7 @@ qla4xxx_update_local_ifcb(struct scsi_qla_host *ha, | |||
| 413 | memcpy(ha->name_string, init_fw_cb->iscsi_name, | 423 | memcpy(ha->name_string, init_fw_cb->iscsi_name, |
| 414 | min(sizeof(ha->name_string), | 424 | min(sizeof(ha->name_string), |
| 415 | sizeof(init_fw_cb->iscsi_name))); | 425 | sizeof(init_fw_cb->iscsi_name))); |
| 426 | ha->def_timeout = le16_to_cpu(init_fw_cb->def_timeout); | ||
| 416 | /*memcpy(ha->alias, init_fw_cb->Alias, | 427 | /*memcpy(ha->alias, init_fw_cb->Alias, |
| 417 | min(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));*/ | 428 | min(sizeof(ha->alias), sizeof(init_fw_cb->Alias)));*/ |
| 418 | 429 | ||
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 30f31b127f33..4169c8baa112 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
| 9 | #include <linux/blkdev.h> | 9 | #include <linux/blkdev.h> |
| 10 | #include <linux/iscsi_boot_sysfs.h> | 10 | #include <linux/iscsi_boot_sysfs.h> |
| 11 | #include <linux/inet.h> | ||
| 11 | 12 | ||
| 12 | #include <scsi/scsi_tcq.h> | 13 | #include <scsi/scsi_tcq.h> |
| 13 | #include <scsi/scsicam.h> | 14 | #include <scsi/scsicam.h> |
| @@ -31,6 +32,13 @@ static struct kmem_cache *srb_cachep; | |||
| 31 | /* | 32 | /* |
| 32 | * Module parameter information and variables | 33 | * Module parameter information and variables |
| 33 | */ | 34 | */ |
| 35 | int ql4xdisablesysfsboot = 1; | ||
| 36 | module_param(ql4xdisablesysfsboot, int, S_IRUGO | S_IWUSR); | ||
| 37 | MODULE_PARM_DESC(ql4xdisablesysfsboot, | ||
| 38 | "Set to disable exporting boot targets to sysfs\n" | ||
| 39 | " 0 - Export boot targets\n" | ||
| 40 | " 1 - Do not export boot targets (Default)"); | ||
| 41 | |||
| 34 | int ql4xdontresethba = 0; | 42 | int ql4xdontresethba = 0; |
| 35 | module_param(ql4xdontresethba, int, S_IRUGO | S_IWUSR); | 43 | module_param(ql4xdontresethba, int, S_IRUGO | S_IWUSR); |
| 36 | MODULE_PARM_DESC(ql4xdontresethba, | 44 | MODULE_PARM_DESC(ql4xdontresethba, |
| @@ -63,7 +71,7 @@ static int ql4xsess_recovery_tmo = QL4_SESS_RECOVERY_TMO; | |||
| 63 | module_param(ql4xsess_recovery_tmo, int, S_IRUGO); | 71 | module_param(ql4xsess_recovery_tmo, int, S_IRUGO); |
| 64 | MODULE_PARM_DESC(ql4xsess_recovery_tmo, | 72 | MODULE_PARM_DESC(ql4xsess_recovery_tmo, |
| 65 | "Target Session Recovery Timeout.\n" | 73 | "Target Session Recovery Timeout.\n" |
| 66 | " Default: 30 sec."); | 74 | " Default: 120 sec."); |
| 67 | 75 | ||
| 68 | static int qla4xxx_wait_for_hba_online(struct scsi_qla_host *ha); | 76 | static int qla4xxx_wait_for_hba_online(struct scsi_qla_host *ha); |
| 69 | /* | 77 | /* |
| @@ -415,7 +423,7 @@ static int qla4xxx_ep_poll(struct iscsi_endpoint *ep, int timeout_ms) | |||
| 415 | qla_ep = ep->dd_data; | 423 | qla_ep = ep->dd_data; |
| 416 | ha = to_qla_host(qla_ep->host); | 424 | ha = to_qla_host(qla_ep->host); |
| 417 | 425 | ||
| 418 | if (adapter_up(ha)) | 426 | if (adapter_up(ha) && !test_bit(AF_BUILD_DDB_LIST, &ha->flags)) |
| 419 | ret = 1; | 427 | ret = 1; |
| 420 | 428 | ||
| 421 | return ret; | 429 | return ret; |
| @@ -975,6 +983,150 @@ static int qla4xxx_conn_get_param(struct iscsi_cls_conn *cls_conn, | |||
| 975 | 983 | ||
| 976 | } | 984 | } |
| 977 | 985 | ||
| 986 | int qla4xxx_get_ddb_index(struct scsi_qla_host *ha, uint16_t *ddb_index) | ||
| 987 | { | ||
| 988 | uint32_t mbx_sts = 0; | ||
| 989 | uint16_t tmp_ddb_index; | ||
| 990 | int ret; | ||
| 991 | |||
| 992 | get_ddb_index: | ||
| 993 | tmp_ddb_index = find_first_zero_bit(ha->ddb_idx_map, MAX_DDB_ENTRIES); | ||
| 994 | |||
| 995 | if (tmp_ddb_index >= MAX_DDB_ENTRIES) { | ||
| 996 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 997 | "Free DDB index not available\n")); | ||
| 998 | ret = QLA_ERROR; | ||
| 999 | goto exit_get_ddb_index; | ||
| 1000 | } | ||
| 1001 | |||
| 1002 | if (test_and_set_bit(tmp_ddb_index, ha->ddb_idx_map)) | ||
| 1003 | goto get_ddb_index; | ||
| 1004 | |||
| 1005 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1006 | "Found a free DDB index at %d\n", tmp_ddb_index)); | ||
| 1007 | ret = qla4xxx_req_ddb_entry(ha, tmp_ddb_index, &mbx_sts); | ||
| 1008 | if (ret == QLA_ERROR) { | ||
| 1009 | if (mbx_sts == MBOX_STS_COMMAND_ERROR) { | ||
| 1010 | ql4_printk(KERN_INFO, ha, | ||
| 1011 | "DDB index = %d not available trying next\n", | ||
| 1012 | tmp_ddb_index); | ||
| 1013 | goto get_ddb_index; | ||
| 1014 | } | ||
| 1015 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1016 | "Free FW DDB not available\n")); | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | *ddb_index = tmp_ddb_index; | ||
| 1020 | |||
| 1021 | exit_get_ddb_index: | ||
| 1022 | return ret; | ||
| 1023 | } | ||
| 1024 | |||
| 1025 | static int qla4xxx_match_ipaddress(struct scsi_qla_host *ha, | ||
| 1026 | struct ddb_entry *ddb_entry, | ||
| 1027 | char *existing_ipaddr, | ||
| 1028 | char *user_ipaddr) | ||
| 1029 | { | ||
| 1030 | uint8_t dst_ipaddr[IPv6_ADDR_LEN]; | ||
| 1031 | char formatted_ipaddr[DDB_IPADDR_LEN]; | ||
| 1032 | int status = QLA_SUCCESS, ret = 0; | ||
| 1033 | |||
| 1034 | if (ddb_entry->fw_ddb_entry.options & DDB_OPT_IPV6_DEVICE) { | ||
| 1035 | ret = in6_pton(user_ipaddr, strlen(user_ipaddr), dst_ipaddr, | ||
| 1036 | '\0', NULL); | ||
| 1037 | if (ret == 0) { | ||
| 1038 | status = QLA_ERROR; | ||
| 1039 | goto out_match; | ||
| 1040 | } | ||
| 1041 | ret = sprintf(formatted_ipaddr, "%pI6", dst_ipaddr); | ||
| 1042 | } else { | ||
| 1043 | ret = in4_pton(user_ipaddr, strlen(user_ipaddr), dst_ipaddr, | ||
| 1044 | '\0', NULL); | ||
| 1045 | if (ret == 0) { | ||
| 1046 | status = QLA_ERROR; | ||
| 1047 | goto out_match; | ||
| 1048 | } | ||
| 1049 | ret = sprintf(formatted_ipaddr, "%pI4", dst_ipaddr); | ||
| 1050 | } | ||
| 1051 | |||
| 1052 | if (strcmp(existing_ipaddr, formatted_ipaddr)) | ||
| 1053 | status = QLA_ERROR; | ||
| 1054 | |||
| 1055 | out_match: | ||
| 1056 | return status; | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | static int qla4xxx_match_fwdb_session(struct scsi_qla_host *ha, | ||
| 1060 | struct iscsi_cls_conn *cls_conn) | ||
| 1061 | { | ||
| 1062 | int idx = 0, max_ddbs, rval; | ||
| 1063 | struct iscsi_cls_session *cls_sess = iscsi_conn_to_session(cls_conn); | ||
| 1064 | struct iscsi_session *sess, *existing_sess; | ||
| 1065 | struct iscsi_conn *conn, *existing_conn; | ||
| 1066 | struct ddb_entry *ddb_entry; | ||
| 1067 | |||
| 1068 | sess = cls_sess->dd_data; | ||
| 1069 | conn = cls_conn->dd_data; | ||
| 1070 | |||
| 1071 | if (sess->targetname == NULL || | ||
| 1072 | conn->persistent_address == NULL || | ||
| 1073 | conn->persistent_port == 0) | ||
| 1074 | return QLA_ERROR; | ||
| 1075 | |||
| 1076 | max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : | ||
| 1077 | MAX_DEV_DB_ENTRIES; | ||
| 1078 | |||
| 1079 | for (idx = 0; idx < max_ddbs; idx++) { | ||
| 1080 | ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx); | ||
| 1081 | if (ddb_entry == NULL) | ||
| 1082 | continue; | ||
| 1083 | |||
| 1084 | if (ddb_entry->ddb_type != FLASH_DDB) | ||
| 1085 | continue; | ||
| 1086 | |||
| 1087 | existing_sess = ddb_entry->sess->dd_data; | ||
| 1088 | existing_conn = ddb_entry->conn->dd_data; | ||
| 1089 | |||
| 1090 | if (existing_sess->targetname == NULL || | ||
| 1091 | existing_conn->persistent_address == NULL || | ||
| 1092 | existing_conn->persistent_port == 0) | ||
| 1093 | continue; | ||
| 1094 | |||
| 1095 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1096 | "IQN = %s User IQN = %s\n", | ||
| 1097 | existing_sess->targetname, | ||
| 1098 | sess->targetname)); | ||
| 1099 | |||
| 1100 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1101 | "IP = %s User IP = %s\n", | ||
| 1102 | existing_conn->persistent_address, | ||
| 1103 | conn->persistent_address)); | ||
| 1104 | |||
| 1105 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1106 | "Port = %d User Port = %d\n", | ||
| 1107 | existing_conn->persistent_port, | ||
| 1108 | conn->persistent_port)); | ||
| 1109 | |||
| 1110 | if (strcmp(existing_sess->targetname, sess->targetname)) | ||
| 1111 | continue; | ||
| 1112 | rval = qla4xxx_match_ipaddress(ha, ddb_entry, | ||
| 1113 | existing_conn->persistent_address, | ||
| 1114 | conn->persistent_address); | ||
| 1115 | if (rval == QLA_ERROR) | ||
| 1116 | continue; | ||
| 1117 | if (existing_conn->persistent_port != conn->persistent_port) | ||
| 1118 | continue; | ||
| 1119 | break; | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | if (idx == max_ddbs) | ||
| 1123 | return QLA_ERROR; | ||
| 1124 | |||
| 1125 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1126 | "Match found in fwdb sessions\n")); | ||
| 1127 | return QLA_SUCCESS; | ||
| 1128 | } | ||
| 1129 | |||
| 978 | static struct iscsi_cls_session * | 1130 | static struct iscsi_cls_session * |
| 979 | qla4xxx_session_create(struct iscsi_endpoint *ep, | 1131 | qla4xxx_session_create(struct iscsi_endpoint *ep, |
| 980 | uint16_t cmds_max, uint16_t qdepth, | 1132 | uint16_t cmds_max, uint16_t qdepth, |
| @@ -984,8 +1136,7 @@ qla4xxx_session_create(struct iscsi_endpoint *ep, | |||
| 984 | struct scsi_qla_host *ha; | 1136 | struct scsi_qla_host *ha; |
| 985 | struct qla_endpoint *qla_ep; | 1137 | struct qla_endpoint *qla_ep; |
| 986 | struct ddb_entry *ddb_entry; | 1138 | struct ddb_entry *ddb_entry; |
| 987 | uint32_t ddb_index; | 1139 | uint16_t ddb_index; |
| 988 | uint32_t mbx_sts = 0; | ||
| 989 | struct iscsi_session *sess; | 1140 | struct iscsi_session *sess; |
| 990 | struct sockaddr *dst_addr; | 1141 | struct sockaddr *dst_addr; |
| 991 | int ret; | 1142 | int ret; |
| @@ -1000,32 +1151,9 @@ qla4xxx_session_create(struct iscsi_endpoint *ep, | |||
| 1000 | dst_addr = (struct sockaddr *)&qla_ep->dst_addr; | 1151 | dst_addr = (struct sockaddr *)&qla_ep->dst_addr; |
| 1001 | ha = to_qla_host(qla_ep->host); | 1152 | ha = to_qla_host(qla_ep->host); |
| 1002 | 1153 | ||
| 1003 | get_ddb_index: | 1154 | ret = qla4xxx_get_ddb_index(ha, &ddb_index); |
| 1004 | ddb_index = find_first_zero_bit(ha->ddb_idx_map, MAX_DDB_ENTRIES); | 1155 | if (ret == QLA_ERROR) |
| 1005 | |||
| 1006 | if (ddb_index >= MAX_DDB_ENTRIES) { | ||
| 1007 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1008 | "Free DDB index not available\n")); | ||
| 1009 | return NULL; | ||
| 1010 | } | ||
| 1011 | |||
| 1012 | if (test_and_set_bit(ddb_index, ha->ddb_idx_map)) | ||
| 1013 | goto get_ddb_index; | ||
| 1014 | |||
| 1015 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1016 | "Found a free DDB index at %d\n", ddb_index)); | ||
| 1017 | ret = qla4xxx_req_ddb_entry(ha, ddb_index, &mbx_sts); | ||
| 1018 | if (ret == QLA_ERROR) { | ||
| 1019 | if (mbx_sts == MBOX_STS_COMMAND_ERROR) { | ||
| 1020 | ql4_printk(KERN_INFO, ha, | ||
| 1021 | "DDB index = %d not available trying next\n", | ||
| 1022 | ddb_index); | ||
| 1023 | goto get_ddb_index; | ||
| 1024 | } | ||
| 1025 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 1026 | "Free FW DDB not available\n")); | ||
| 1027 | return NULL; | 1156 | return NULL; |
| 1028 | } | ||
| 1029 | 1157 | ||
| 1030 | cls_sess = iscsi_session_setup(&qla4xxx_iscsi_transport, qla_ep->host, | 1158 | cls_sess = iscsi_session_setup(&qla4xxx_iscsi_transport, qla_ep->host, |
| 1031 | cmds_max, sizeof(struct ddb_entry), | 1159 | cmds_max, sizeof(struct ddb_entry), |
| @@ -1040,6 +1168,8 @@ get_ddb_index: | |||
| 1040 | ddb_entry->fw_ddb_device_state = DDB_DS_NO_CONNECTION_ACTIVE; | 1168 | ddb_entry->fw_ddb_device_state = DDB_DS_NO_CONNECTION_ACTIVE; |
| 1041 | ddb_entry->ha = ha; | 1169 | ddb_entry->ha = ha; |
| 1042 | ddb_entry->sess = cls_sess; | 1170 | ddb_entry->sess = cls_sess; |
| 1171 | ddb_entry->unblock_sess = qla4xxx_unblock_ddb; | ||
| 1172 | ddb_entry->ddb_change = qla4xxx_ddb_change; | ||
| 1043 | cls_sess->recovery_tmo = ql4xsess_recovery_tmo; | 1173 | cls_sess->recovery_tmo = ql4xsess_recovery_tmo; |
| 1044 | ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry; | 1174 | ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry; |
| 1045 | ha->tot_ddbs++; | 1175 | ha->tot_ddbs++; |
| @@ -1077,6 +1207,9 @@ qla4xxx_conn_create(struct iscsi_cls_session *cls_sess, uint32_t conn_idx) | |||
| 1077 | DEBUG2(printk(KERN_INFO "Func: %s\n", __func__)); | 1207 | DEBUG2(printk(KERN_INFO "Func: %s\n", __func__)); |
| 1078 | cls_conn = iscsi_conn_setup(cls_sess, sizeof(struct qla_conn), | 1208 | cls_conn = iscsi_conn_setup(cls_sess, sizeof(struct qla_conn), |
| 1079 | conn_idx); | 1209 | conn_idx); |
| 1210 | if (!cls_conn) | ||
| 1211 | return NULL; | ||
| 1212 | |||
| 1080 | sess = cls_sess->dd_data; | 1213 | sess = cls_sess->dd_data; |
| 1081 | ddb_entry = sess->dd_data; | 1214 | ddb_entry = sess->dd_data; |
| 1082 | ddb_entry->conn = cls_conn; | 1215 | ddb_entry->conn = cls_conn; |
| @@ -1109,7 +1242,7 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn) | |||
| 1109 | struct iscsi_session *sess; | 1242 | struct iscsi_session *sess; |
| 1110 | struct ddb_entry *ddb_entry; | 1243 | struct ddb_entry *ddb_entry; |
| 1111 | struct scsi_qla_host *ha; | 1244 | struct scsi_qla_host *ha; |
| 1112 | struct dev_db_entry *fw_ddb_entry; | 1245 | struct dev_db_entry *fw_ddb_entry = NULL; |
| 1113 | dma_addr_t fw_ddb_entry_dma; | 1246 | dma_addr_t fw_ddb_entry_dma; |
| 1114 | uint32_t mbx_sts = 0; | 1247 | uint32_t mbx_sts = 0; |
| 1115 | int ret = 0; | 1248 | int ret = 0; |
| @@ -1120,12 +1253,25 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn) | |||
| 1120 | ddb_entry = sess->dd_data; | 1253 | ddb_entry = sess->dd_data; |
| 1121 | ha = ddb_entry->ha; | 1254 | ha = ddb_entry->ha; |
| 1122 | 1255 | ||
| 1256 | /* Check if we have matching FW DDB, if yes then do not | ||
| 1257 | * login to this target. This could cause target to logout previous | ||
| 1258 | * connection | ||
| 1259 | */ | ||
| 1260 | ret = qla4xxx_match_fwdb_session(ha, cls_conn); | ||
| 1261 | if (ret == QLA_SUCCESS) { | ||
| 1262 | ql4_printk(KERN_INFO, ha, | ||
| 1263 | "Session already exist in FW.\n"); | ||
| 1264 | ret = -EEXIST; | ||
| 1265 | goto exit_conn_start; | ||
| 1266 | } | ||
| 1267 | |||
| 1123 | fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), | 1268 | fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), |
| 1124 | &fw_ddb_entry_dma, GFP_KERNEL); | 1269 | &fw_ddb_entry_dma, GFP_KERNEL); |
| 1125 | if (!fw_ddb_entry) { | 1270 | if (!fw_ddb_entry) { |
| 1126 | ql4_printk(KERN_ERR, ha, | 1271 | ql4_printk(KERN_ERR, ha, |
| 1127 | "%s: Unable to allocate dma buffer\n", __func__); | 1272 | "%s: Unable to allocate dma buffer\n", __func__); |
| 1128 | return -ENOMEM; | 1273 | ret = -ENOMEM; |
| 1274 | goto exit_conn_start; | ||
| 1129 | } | 1275 | } |
| 1130 | 1276 | ||
| 1131 | ret = qla4xxx_set_param_ddbentry(ha, ddb_entry, cls_conn, &mbx_sts); | 1277 | ret = qla4xxx_set_param_ddbentry(ha, ddb_entry, cls_conn, &mbx_sts); |
| @@ -1138,9 +1284,7 @@ static int qla4xxx_conn_start(struct iscsi_cls_conn *cls_conn) | |||
| 1138 | if (mbx_sts) | 1284 | if (mbx_sts) |
| 1139 | if (ddb_entry->fw_ddb_device_state == | 1285 | if (ddb_entry->fw_ddb_device_state == |
| 1140 | DDB_DS_SESSION_ACTIVE) { | 1286 | DDB_DS_SESSION_ACTIVE) { |
| 1141 | iscsi_conn_start(ddb_entry->conn); | 1287 | ddb_entry->unblock_sess(ddb_entry->sess); |
| 1142 | iscsi_conn_login_event(ddb_entry->conn, | ||
| 1143 | ISCSI_CONN_STATE_LOGGED_IN); | ||
| 1144 | goto exit_set_param; | 1288 | goto exit_set_param; |
| 1145 | } | 1289 | } |
| 1146 | 1290 | ||
| @@ -1167,8 +1311,9 @@ exit_set_param: | |||
| 1167 | ret = 0; | 1311 | ret = 0; |
| 1168 | 1312 | ||
| 1169 | exit_conn_start: | 1313 | exit_conn_start: |
| 1170 | dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), | 1314 | if (fw_ddb_entry) |
| 1171 | fw_ddb_entry, fw_ddb_entry_dma); | 1315 | dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), |
| 1316 | fw_ddb_entry, fw_ddb_entry_dma); | ||
| 1172 | return ret; | 1317 | return ret; |
| 1173 | } | 1318 | } |
| 1174 | 1319 | ||
| @@ -1344,6 +1489,101 @@ static int qla4xxx_task_xmit(struct iscsi_task *task) | |||
| 1344 | return -ENOSYS; | 1489 | return -ENOSYS; |
| 1345 | } | 1490 | } |
| 1346 | 1491 | ||
| 1492 | static void qla4xxx_copy_fwddb_param(struct scsi_qla_host *ha, | ||
| 1493 | struct dev_db_entry *fw_ddb_entry, | ||
| 1494 | struct iscsi_cls_session *cls_sess, | ||
| 1495 | struct iscsi_cls_conn *cls_conn) | ||
| 1496 | { | ||
| 1497 | int buflen = 0; | ||
| 1498 | struct iscsi_session *sess; | ||
| 1499 | struct iscsi_conn *conn; | ||
| 1500 | char ip_addr[DDB_IPADDR_LEN]; | ||
| 1501 | uint16_t options = 0; | ||
| 1502 | |||
| 1503 | sess = cls_sess->dd_data; | ||
| 1504 | conn = cls_conn->dd_data; | ||
| 1505 | |||
| 1506 | conn->max_recv_dlength = BYTE_UNITS * | ||
| 1507 | le16_to_cpu(fw_ddb_entry->iscsi_max_rcv_data_seg_len); | ||
| 1508 | |||
| 1509 | conn->max_xmit_dlength = BYTE_UNITS * | ||
| 1510 | le16_to_cpu(fw_ddb_entry->iscsi_max_snd_data_seg_len); | ||
| 1511 | |||
| 1512 | sess->initial_r2t_en = | ||
| 1513 | (BIT_10 & le16_to_cpu(fw_ddb_entry->iscsi_options)); | ||
| 1514 | |||
| 1515 | sess->max_r2t = le16_to_cpu(fw_ddb_entry->iscsi_max_outsnd_r2t); | ||
| 1516 | |||
| 1517 | sess->imm_data_en = (BIT_11 & le16_to_cpu(fw_ddb_entry->iscsi_options)); | ||
| 1518 | |||
| 1519 | sess->first_burst = BYTE_UNITS * | ||
| 1520 | le16_to_cpu(fw_ddb_entry->iscsi_first_burst_len); | ||
| 1521 | |||
| 1522 | sess->max_burst = BYTE_UNITS * | ||
| 1523 | le16_to_cpu(fw_ddb_entry->iscsi_max_burst_len); | ||
| 1524 | |||
| 1525 | sess->time2wait = le16_to_cpu(fw_ddb_entry->iscsi_def_time2wait); | ||
| 1526 | |||
| 1527 | sess->time2retain = le16_to_cpu(fw_ddb_entry->iscsi_def_time2retain); | ||
| 1528 | |||
| 1529 | conn->persistent_port = le16_to_cpu(fw_ddb_entry->port); | ||
| 1530 | |||
| 1531 | sess->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp); | ||
| 1532 | |||
| 1533 | options = le16_to_cpu(fw_ddb_entry->options); | ||
| 1534 | if (options & DDB_OPT_IPV6_DEVICE) | ||
| 1535 | sprintf(ip_addr, "%pI6", fw_ddb_entry->ip_addr); | ||
| 1536 | else | ||
| 1537 | sprintf(ip_addr, "%pI4", fw_ddb_entry->ip_addr); | ||
| 1538 | |||
| 1539 | iscsi_set_param(cls_conn, ISCSI_PARAM_TARGET_NAME, | ||
| 1540 | (char *)fw_ddb_entry->iscsi_name, buflen); | ||
| 1541 | iscsi_set_param(cls_conn, ISCSI_PARAM_INITIATOR_NAME, | ||
| 1542 | (char *)ha->name_string, buflen); | ||
| 1543 | iscsi_set_param(cls_conn, ISCSI_PARAM_PERSISTENT_ADDRESS, | ||
| 1544 | (char *)ip_addr, buflen); | ||
| 1545 | } | ||
| 1546 | |||
| 1547 | void qla4xxx_update_session_conn_fwddb_param(struct scsi_qla_host *ha, | ||
| 1548 | struct ddb_entry *ddb_entry) | ||
| 1549 | { | ||
| 1550 | struct iscsi_cls_session *cls_sess; | ||
| 1551 | struct iscsi_cls_conn *cls_conn; | ||
| 1552 | uint32_t ddb_state; | ||
| 1553 | dma_addr_t fw_ddb_entry_dma; | ||
| 1554 | struct dev_db_entry *fw_ddb_entry; | ||
| 1555 | |||
| 1556 | fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), | ||
| 1557 | &fw_ddb_entry_dma, GFP_KERNEL); | ||
| 1558 | if (!fw_ddb_entry) { | ||
| 1559 | ql4_printk(KERN_ERR, ha, | ||
| 1560 | "%s: Unable to allocate dma buffer\n", __func__); | ||
| 1561 | goto exit_session_conn_fwddb_param; | ||
| 1562 | } | ||
| 1563 | |||
| 1564 | if (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, fw_ddb_entry, | ||
| 1565 | fw_ddb_entry_dma, NULL, NULL, &ddb_state, | ||
| 1566 | NULL, NULL, NULL) == QLA_ERROR) { | ||
| 1567 | DEBUG2(ql4_printk(KERN_ERR, ha, "scsi%ld: %s: failed " | ||
| 1568 | "get_ddb_entry for fw_ddb_index %d\n", | ||
| 1569 | ha->host_no, __func__, | ||
| 1570 | ddb_entry->fw_ddb_index)); | ||
| 1571 | goto exit_session_conn_fwddb_param; | ||
| 1572 | } | ||
| 1573 | |||
| 1574 | cls_sess = ddb_entry->sess; | ||
| 1575 | |||
| 1576 | cls_conn = ddb_entry->conn; | ||
| 1577 | |||
| 1578 | /* Update params */ | ||
| 1579 | qla4xxx_copy_fwddb_param(ha, fw_ddb_entry, cls_sess, cls_conn); | ||
| 1580 | |||
| 1581 | exit_session_conn_fwddb_param: | ||
| 1582 | if (fw_ddb_entry) | ||
| 1583 | dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), | ||
| 1584 | fw_ddb_entry, fw_ddb_entry_dma); | ||
| 1585 | } | ||
| 1586 | |||
| 1347 | void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, | 1587 | void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, |
| 1348 | struct ddb_entry *ddb_entry) | 1588 | struct ddb_entry *ddb_entry) |
| 1349 | { | 1589 | { |
| @@ -1360,7 +1600,7 @@ void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, | |||
| 1360 | if (!fw_ddb_entry) { | 1600 | if (!fw_ddb_entry) { |
| 1361 | ql4_printk(KERN_ERR, ha, | 1601 | ql4_printk(KERN_ERR, ha, |
| 1362 | "%s: Unable to allocate dma buffer\n", __func__); | 1602 | "%s: Unable to allocate dma buffer\n", __func__); |
| 1363 | return; | 1603 | goto exit_session_conn_param; |
| 1364 | } | 1604 | } |
| 1365 | 1605 | ||
| 1366 | if (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, fw_ddb_entry, | 1606 | if (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index, fw_ddb_entry, |
| @@ -1370,7 +1610,7 @@ void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, | |||
| 1370 | "get_ddb_entry for fw_ddb_index %d\n", | 1610 | "get_ddb_entry for fw_ddb_index %d\n", |
| 1371 | ha->host_no, __func__, | 1611 | ha->host_no, __func__, |
| 1372 | ddb_entry->fw_ddb_index)); | 1612 | ddb_entry->fw_ddb_index)); |
| 1373 | return; | 1613 | goto exit_session_conn_param; |
| 1374 | } | 1614 | } |
| 1375 | 1615 | ||
| 1376 | cls_sess = ddb_entry->sess; | 1616 | cls_sess = ddb_entry->sess; |
| @@ -1379,6 +1619,12 @@ void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, | |||
| 1379 | cls_conn = ddb_entry->conn; | 1619 | cls_conn = ddb_entry->conn; |
| 1380 | conn = cls_conn->dd_data; | 1620 | conn = cls_conn->dd_data; |
| 1381 | 1621 | ||
| 1622 | /* Update timers after login */ | ||
| 1623 | ddb_entry->default_relogin_timeout = | ||
| 1624 | le16_to_cpu(fw_ddb_entry->def_timeout); | ||
| 1625 | ddb_entry->default_time2wait = | ||
| 1626 | le16_to_cpu(fw_ddb_entry->iscsi_def_time2wait); | ||
| 1627 | |||
| 1382 | /* Update params */ | 1628 | /* Update params */ |
| 1383 | conn->max_recv_dlength = BYTE_UNITS * | 1629 | conn->max_recv_dlength = BYTE_UNITS * |
| 1384 | le16_to_cpu(fw_ddb_entry->iscsi_max_rcv_data_seg_len); | 1630 | le16_to_cpu(fw_ddb_entry->iscsi_max_rcv_data_seg_len); |
| @@ -1407,6 +1653,11 @@ void qla4xxx_update_session_conn_param(struct scsi_qla_host *ha, | |||
| 1407 | 1653 | ||
| 1408 | memcpy(sess->initiatorname, ha->name_string, | 1654 | memcpy(sess->initiatorname, ha->name_string, |
| 1409 | min(sizeof(ha->name_string), sizeof(sess->initiatorname))); | 1655 | min(sizeof(ha->name_string), sizeof(sess->initiatorname))); |
| 1656 | |||
| 1657 | exit_session_conn_param: | ||
| 1658 | if (fw_ddb_entry) | ||
| 1659 | dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), | ||
| 1660 | fw_ddb_entry, fw_ddb_entry_dma); | ||
| 1410 | } | 1661 | } |
| 1411 | 1662 | ||
| 1412 | /* | 1663 | /* |
| @@ -1607,6 +1858,9 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha) | |||
| 1607 | vfree(ha->chap_list); | 1858 | vfree(ha->chap_list); |
| 1608 | ha->chap_list = NULL; | 1859 | ha->chap_list = NULL; |
| 1609 | 1860 | ||
| 1861 | if (ha->fw_ddb_dma_pool) | ||
| 1862 | dma_pool_destroy(ha->fw_ddb_dma_pool); | ||
| 1863 | |||
| 1610 | /* release io space registers */ | 1864 | /* release io space registers */ |
| 1611 | if (is_qla8022(ha)) { | 1865 | if (is_qla8022(ha)) { |
| 1612 | if (ha->nx_pcibase) | 1866 | if (ha->nx_pcibase) |
| @@ -1689,6 +1943,16 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha) | |||
| 1689 | goto mem_alloc_error_exit; | 1943 | goto mem_alloc_error_exit; |
| 1690 | } | 1944 | } |
| 1691 | 1945 | ||
| 1946 | ha->fw_ddb_dma_pool = dma_pool_create("ql4_fw_ddb", &ha->pdev->dev, | ||
| 1947 | DDB_DMA_BLOCK_SIZE, 8, 0); | ||
| 1948 | |||
| 1949 | if (ha->fw_ddb_dma_pool == NULL) { | ||
| 1950 | ql4_printk(KERN_WARNING, ha, | ||
| 1951 | "%s: fw_ddb_dma_pool allocation failed..\n", | ||
| 1952 | __func__); | ||
| 1953 | goto mem_alloc_error_exit; | ||
| 1954 | } | ||
| 1955 | |||
| 1692 | return QLA_SUCCESS; | 1956 | return QLA_SUCCESS; |
| 1693 | 1957 | ||
| 1694 | mem_alloc_error_exit: | 1958 | mem_alloc_error_exit: |
| @@ -1800,6 +2064,60 @@ void qla4_8xxx_watchdog(struct scsi_qla_host *ha) | |||
| 1800 | } | 2064 | } |
| 1801 | } | 2065 | } |
| 1802 | 2066 | ||
| 2067 | void qla4xxx_check_relogin_flash_ddb(struct iscsi_cls_session *cls_sess) | ||
| 2068 | { | ||
| 2069 | struct iscsi_session *sess; | ||
| 2070 | struct ddb_entry *ddb_entry; | ||
| 2071 | struct scsi_qla_host *ha; | ||
| 2072 | |||
| 2073 | sess = cls_sess->dd_data; | ||
| 2074 | ddb_entry = sess->dd_data; | ||
| 2075 | ha = ddb_entry->ha; | ||
| 2076 | |||
| 2077 | if (!(ddb_entry->ddb_type == FLASH_DDB)) | ||
| 2078 | return; | ||
| 2079 | |||
| 2080 | if (adapter_up(ha) && !test_bit(DF_RELOGIN, &ddb_entry->flags) && | ||
| 2081 | !iscsi_is_session_online(cls_sess)) { | ||
| 2082 | if (atomic_read(&ddb_entry->retry_relogin_timer) != | ||
| 2083 | INVALID_ENTRY) { | ||
| 2084 | if (atomic_read(&ddb_entry->retry_relogin_timer) == | ||
| 2085 | 0) { | ||
| 2086 | atomic_set(&ddb_entry->retry_relogin_timer, | ||
| 2087 | INVALID_ENTRY); | ||
| 2088 | set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); | ||
| 2089 | set_bit(DF_RELOGIN, &ddb_entry->flags); | ||
| 2090 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 2091 | "%s: index [%d] login device\n", | ||
| 2092 | __func__, ddb_entry->fw_ddb_index)); | ||
| 2093 | } else | ||
| 2094 | atomic_dec(&ddb_entry->retry_relogin_timer); | ||
| 2095 | } | ||
| 2096 | } | ||
| 2097 | |||
| 2098 | /* Wait for relogin to timeout */ | ||
| 2099 | if (atomic_read(&ddb_entry->relogin_timer) && | ||
| 2100 | (atomic_dec_and_test(&ddb_entry->relogin_timer) != 0)) { | ||
| 2101 | /* | ||
| 2102 | * If the relogin times out and the device is | ||
| 2103 | * still NOT ONLINE then try and relogin again. | ||
| 2104 | */ | ||
| 2105 | if (!iscsi_is_session_online(cls_sess)) { | ||
| 2106 | /* Reset retry relogin timer */ | ||
| 2107 | atomic_inc(&ddb_entry->relogin_retry_count); | ||
| 2108 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 2109 | "%s: index[%d] relogin timed out-retrying" | ||
| 2110 | " relogin (%d), retry (%d)\n", __func__, | ||
| 2111 | ddb_entry->fw_ddb_index, | ||
| 2112 | atomic_read(&ddb_entry->relogin_retry_count), | ||
| 2113 | ddb_entry->default_time2wait + 4)); | ||
| 2114 | set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); | ||
| 2115 | atomic_set(&ddb_entry->retry_relogin_timer, | ||
| 2116 | ddb_entry->default_time2wait + 4); | ||
| 2117 | } | ||
| 2118 | } | ||
| 2119 | } | ||
| 2120 | |||
| 1803 | /** | 2121 | /** |
| 1804 | * qla4xxx_timer - checks every second for work to do. | 2122 | * qla4xxx_timer - checks every second for work to do. |
| 1805 | * @ha: Pointer to host adapter structure. | 2123 | * @ha: Pointer to host adapter structure. |
| @@ -1809,6 +2127,8 @@ static void qla4xxx_timer(struct scsi_qla_host *ha) | |||
| 1809 | int start_dpc = 0; | 2127 | int start_dpc = 0; |
| 1810 | uint16_t w; | 2128 | uint16_t w; |
| 1811 | 2129 | ||
| 2130 | iscsi_host_for_each_session(ha->host, qla4xxx_check_relogin_flash_ddb); | ||
| 2131 | |||
| 1812 | /* If we are in the middle of AER/EEH processing | 2132 | /* If we are in the middle of AER/EEH processing |
| 1813 | * skip any processing and reschedule the timer | 2133 | * skip any processing and reschedule the timer |
| 1814 | */ | 2134 | */ |
| @@ -2078,7 +2398,12 @@ static void qla4xxx_fail_session(struct iscsi_cls_session *cls_session) | |||
| 2078 | sess = cls_session->dd_data; | 2398 | sess = cls_session->dd_data; |
| 2079 | ddb_entry = sess->dd_data; | 2399 | ddb_entry = sess->dd_data; |
| 2080 | ddb_entry->fw_ddb_device_state = DDB_DS_SESSION_FAILED; | 2400 | ddb_entry->fw_ddb_device_state = DDB_DS_SESSION_FAILED; |
| 2081 | iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED); | 2401 | |
| 2402 | if (ddb_entry->ddb_type == FLASH_DDB) | ||
| 2403 | iscsi_block_session(ddb_entry->sess); | ||
| 2404 | else | ||
| 2405 | iscsi_session_failure(cls_session->dd_data, | ||
| 2406 | ISCSI_ERR_CONN_FAILED); | ||
| 2082 | } | 2407 | } |
| 2083 | 2408 | ||
| 2084 | /** | 2409 | /** |
| @@ -2163,7 +2488,7 @@ recover_ha_init_adapter: | |||
| 2163 | 2488 | ||
| 2164 | /* NOTE: AF_ONLINE flag set upon successful completion of | 2489 | /* NOTE: AF_ONLINE flag set upon successful completion of |
| 2165 | * qla4xxx_initialize_adapter */ | 2490 | * qla4xxx_initialize_adapter */ |
| 2166 | status = qla4xxx_initialize_adapter(ha); | 2491 | status = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); |
| 2167 | } | 2492 | } |
| 2168 | 2493 | ||
| 2169 | /* Retry failed adapter initialization, if necessary | 2494 | /* Retry failed adapter initialization, if necessary |
| @@ -2245,17 +2570,108 @@ static void qla4xxx_relogin_devices(struct iscsi_cls_session *cls_session) | |||
| 2245 | iscsi_unblock_session(ddb_entry->sess); | 2570 | iscsi_unblock_session(ddb_entry->sess); |
| 2246 | } else { | 2571 | } else { |
| 2247 | /* Trigger relogin */ | 2572 | /* Trigger relogin */ |
| 2248 | iscsi_session_failure(cls_session->dd_data, | 2573 | if (ddb_entry->ddb_type == FLASH_DDB) { |
| 2249 | ISCSI_ERR_CONN_FAILED); | 2574 | if (!test_bit(DF_RELOGIN, &ddb_entry->flags)) |
| 2575 | qla4xxx_arm_relogin_timer(ddb_entry); | ||
| 2576 | } else | ||
| 2577 | iscsi_session_failure(cls_session->dd_data, | ||
| 2578 | ISCSI_ERR_CONN_FAILED); | ||
| 2250 | } | 2579 | } |
| 2251 | } | 2580 | } |
| 2252 | } | 2581 | } |
| 2253 | 2582 | ||
| 2583 | int qla4xxx_unblock_flash_ddb(struct iscsi_cls_session *cls_session) | ||
| 2584 | { | ||
| 2585 | struct iscsi_session *sess; | ||
| 2586 | struct ddb_entry *ddb_entry; | ||
| 2587 | struct scsi_qla_host *ha; | ||
| 2588 | |||
| 2589 | sess = cls_session->dd_data; | ||
| 2590 | ddb_entry = sess->dd_data; | ||
| 2591 | ha = ddb_entry->ha; | ||
| 2592 | ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ddb[%d]" | ||
| 2593 | " unblock session\n", ha->host_no, __func__, | ||
| 2594 | ddb_entry->fw_ddb_index); | ||
| 2595 | |||
| 2596 | iscsi_unblock_session(ddb_entry->sess); | ||
| 2597 | |||
| 2598 | /* Start scan target */ | ||
| 2599 | if (test_bit(AF_ONLINE, &ha->flags)) { | ||
| 2600 | ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ddb[%d]" | ||
| 2601 | " start scan\n", ha->host_no, __func__, | ||
| 2602 | ddb_entry->fw_ddb_index); | ||
| 2603 | scsi_queue_work(ha->host, &ddb_entry->sess->scan_work); | ||
| 2604 | } | ||
| 2605 | return QLA_SUCCESS; | ||
| 2606 | } | ||
| 2607 | |||
| 2608 | int qla4xxx_unblock_ddb(struct iscsi_cls_session *cls_session) | ||
| 2609 | { | ||
| 2610 | struct iscsi_session *sess; | ||
| 2611 | struct ddb_entry *ddb_entry; | ||
| 2612 | struct scsi_qla_host *ha; | ||
| 2613 | |||
| 2614 | sess = cls_session->dd_data; | ||
| 2615 | ddb_entry = sess->dd_data; | ||
| 2616 | ha = ddb_entry->ha; | ||
| 2617 | ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ddb[%d]" | ||
| 2618 | " unblock user space session\n", ha->host_no, __func__, | ||
| 2619 | ddb_entry->fw_ddb_index); | ||
| 2620 | iscsi_conn_start(ddb_entry->conn); | ||
| 2621 | iscsi_conn_login_event(ddb_entry->conn, | ||
| 2622 | ISCSI_CONN_STATE_LOGGED_IN); | ||
| 2623 | |||
| 2624 | return QLA_SUCCESS; | ||
| 2625 | } | ||
| 2626 | |||
| 2254 | static void qla4xxx_relogin_all_devices(struct scsi_qla_host *ha) | 2627 | static void qla4xxx_relogin_all_devices(struct scsi_qla_host *ha) |
| 2255 | { | 2628 | { |
| 2256 | iscsi_host_for_each_session(ha->host, qla4xxx_relogin_devices); | 2629 | iscsi_host_for_each_session(ha->host, qla4xxx_relogin_devices); |
| 2257 | } | 2630 | } |
| 2258 | 2631 | ||
| 2632 | static void qla4xxx_relogin_flash_ddb(struct iscsi_cls_session *cls_sess) | ||
| 2633 | { | ||
| 2634 | uint16_t relogin_timer; | ||
| 2635 | struct iscsi_session *sess; | ||
| 2636 | struct ddb_entry *ddb_entry; | ||
| 2637 | struct scsi_qla_host *ha; | ||
| 2638 | |||
| 2639 | sess = cls_sess->dd_data; | ||
| 2640 | ddb_entry = sess->dd_data; | ||
| 2641 | ha = ddb_entry->ha; | ||
| 2642 | |||
| 2643 | relogin_timer = max(ddb_entry->default_relogin_timeout, | ||
| 2644 | (uint16_t)RELOGIN_TOV); | ||
| 2645 | atomic_set(&ddb_entry->relogin_timer, relogin_timer); | ||
| 2646 | |||
| 2647 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 2648 | "scsi%ld: Relogin index [%d]. TOV=%d\n", ha->host_no, | ||
| 2649 | ddb_entry->fw_ddb_index, relogin_timer)); | ||
| 2650 | |||
| 2651 | qla4xxx_login_flash_ddb(cls_sess); | ||
| 2652 | } | ||
| 2653 | |||
| 2654 | static void qla4xxx_dpc_relogin(struct iscsi_cls_session *cls_sess) | ||
| 2655 | { | ||
| 2656 | struct iscsi_session *sess; | ||
| 2657 | struct ddb_entry *ddb_entry; | ||
| 2658 | struct scsi_qla_host *ha; | ||
| 2659 | |||
| 2660 | sess = cls_sess->dd_data; | ||
| 2661 | ddb_entry = sess->dd_data; | ||
| 2662 | ha = ddb_entry->ha; | ||
| 2663 | |||
| 2664 | if (!(ddb_entry->ddb_type == FLASH_DDB)) | ||
| 2665 | return; | ||
| 2666 | |||
| 2667 | if (test_and_clear_bit(DF_RELOGIN, &ddb_entry->flags) && | ||
| 2668 | !iscsi_is_session_online(cls_sess)) { | ||
| 2669 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 2670 | "relogin issued\n")); | ||
| 2671 | qla4xxx_relogin_flash_ddb(cls_sess); | ||
| 2672 | } | ||
| 2673 | } | ||
| 2674 | |||
| 2259 | void qla4xxx_wake_dpc(struct scsi_qla_host *ha) | 2675 | void qla4xxx_wake_dpc(struct scsi_qla_host *ha) |
| 2260 | { | 2676 | { |
| 2261 | if (ha->dpc_thread) | 2677 | if (ha->dpc_thread) |
| @@ -2356,6 +2772,12 @@ dpc_post_reset_ha: | |||
| 2356 | if (test_and_clear_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags)) | 2772 | if (test_and_clear_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags)) |
| 2357 | qla4xxx_get_dhcp_ip_address(ha); | 2773 | qla4xxx_get_dhcp_ip_address(ha); |
| 2358 | 2774 | ||
| 2775 | /* ---- relogin device? --- */ | ||
| 2776 | if (adapter_up(ha) && | ||
| 2777 | test_and_clear_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags)) { | ||
| 2778 | iscsi_host_for_each_session(ha->host, qla4xxx_dpc_relogin); | ||
| 2779 | } | ||
| 2780 | |||
| 2359 | /* ---- link change? --- */ | 2781 | /* ---- link change? --- */ |
| 2360 | if (test_and_clear_bit(DPC_LINK_CHANGED, &ha->dpc_flags)) { | 2782 | if (test_and_clear_bit(DPC_LINK_CHANGED, &ha->dpc_flags)) { |
| 2361 | if (!test_bit(AF_LINK_UP, &ha->flags)) { | 2783 | if (!test_bit(AF_LINK_UP, &ha->flags)) { |
| @@ -2368,8 +2790,12 @@ dpc_post_reset_ha: | |||
| 2368 | * fatal error recovery. Therefore, the driver must | 2790 | * fatal error recovery. Therefore, the driver must |
| 2369 | * manually relogin to devices when recovering from | 2791 | * manually relogin to devices when recovering from |
| 2370 | * connection failures, logouts, expired KATO, etc. */ | 2792 | * connection failures, logouts, expired KATO, etc. */ |
| 2371 | 2793 | if (test_and_clear_bit(AF_BUILD_DDB_LIST, &ha->flags)) { | |
| 2372 | qla4xxx_relogin_all_devices(ha); | 2794 | qla4xxx_build_ddb_list(ha, ha->is_reset); |
| 2795 | iscsi_host_for_each_session(ha->host, | ||
| 2796 | qla4xxx_login_flash_ddb); | ||
| 2797 | } else | ||
| 2798 | qla4xxx_relogin_all_devices(ha); | ||
| 2373 | } | 2799 | } |
| 2374 | } | 2800 | } |
| 2375 | } | 2801 | } |
| @@ -2867,6 +3293,9 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[]) | |||
| 2867 | " target ID %d\n", __func__, ddb_index[0], | 3293 | " target ID %d\n", __func__, ddb_index[0], |
| 2868 | ddb_index[1])); | 3294 | ddb_index[1])); |
| 2869 | 3295 | ||
| 3296 | ha->pri_ddb_idx = ddb_index[0]; | ||
| 3297 | ha->sec_ddb_idx = ddb_index[1]; | ||
| 3298 | |||
| 2870 | exit_boot_info_free: | 3299 | exit_boot_info_free: |
| 2871 | dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma); | 3300 | dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma); |
| 2872 | exit_boot_info: | 3301 | exit_boot_info: |
| @@ -3034,6 +3463,9 @@ static int qla4xxx_get_boot_info(struct scsi_qla_host *ha) | |||
| 3034 | return ret; | 3463 | return ret; |
| 3035 | } | 3464 | } |
| 3036 | 3465 | ||
| 3466 | if (ql4xdisablesysfsboot) | ||
| 3467 | return QLA_SUCCESS; | ||
| 3468 | |||
| 3037 | if (ddb_index[0] == 0xffff) | 3469 | if (ddb_index[0] == 0xffff) |
| 3038 | goto sec_target; | 3470 | goto sec_target; |
| 3039 | 3471 | ||
| @@ -3066,7 +3498,15 @@ static int qla4xxx_setup_boot_info(struct scsi_qla_host *ha) | |||
| 3066 | struct iscsi_boot_kobj *boot_kobj; | 3498 | struct iscsi_boot_kobj *boot_kobj; |
| 3067 | 3499 | ||
| 3068 | if (qla4xxx_get_boot_info(ha) != QLA_SUCCESS) | 3500 | if (qla4xxx_get_boot_info(ha) != QLA_SUCCESS) |
| 3069 | return 0; | 3501 | return QLA_ERROR; |
| 3502 | |||
| 3503 | if (ql4xdisablesysfsboot) { | ||
| 3504 | ql4_printk(KERN_INFO, ha, | ||
| 3505 | "%s: syfsboot disabled - driver will trigger login" | ||
| 3506 | "and publish session for discovery .\n", __func__); | ||
| 3507 | return QLA_SUCCESS; | ||
| 3508 | } | ||
| 3509 | |||
| 3070 | 3510 | ||
| 3071 | ha->boot_kset = iscsi_boot_create_host_kset(ha->host->host_no); | 3511 | ha->boot_kset = iscsi_boot_create_host_kset(ha->host->host_no); |
| 3072 | if (!ha->boot_kset) | 3512 | if (!ha->boot_kset) |
| @@ -3108,7 +3548,7 @@ static int qla4xxx_setup_boot_info(struct scsi_qla_host *ha) | |||
| 3108 | if (!boot_kobj) | 3548 | if (!boot_kobj) |
| 3109 | goto put_host; | 3549 | goto put_host; |
| 3110 | 3550 | ||
| 3111 | return 0; | 3551 | return QLA_SUCCESS; |
| 3112 | 3552 | ||
| 3113 | put_host: | 3553 | put_host: |
| 3114 | scsi_host_put(ha->host); | 3554 | scsi_host_put(ha->host); |
| @@ -3174,9 +3614,507 @@ static void qla4xxx_create_chap_list(struct scsi_qla_host *ha) | |||
| 3174 | exit_chap_list: | 3614 | exit_chap_list: |
| 3175 | dma_free_coherent(&ha->pdev->dev, chap_size, | 3615 | dma_free_coherent(&ha->pdev->dev, chap_size, |
| 3176 | chap_flash_data, chap_dma); | 3616 | chap_flash_data, chap_dma); |
| 3177 | return; | ||
| 3178 | } | 3617 | } |
| 3179 | 3618 | ||
| 3619 | static void qla4xxx_get_param_ddb(struct ddb_entry *ddb_entry, | ||
| 3620 | struct ql4_tuple_ddb *tddb) | ||
| 3621 | { | ||
| 3622 | struct scsi_qla_host *ha; | ||
| 3623 | struct iscsi_cls_session *cls_sess; | ||
| 3624 | struct iscsi_cls_conn *cls_conn; | ||
| 3625 | struct iscsi_session *sess; | ||
| 3626 | struct iscsi_conn *conn; | ||
| 3627 | |||
| 3628 | DEBUG2(printk(KERN_INFO "Func: %s\n", __func__)); | ||
| 3629 | ha = ddb_entry->ha; | ||
| 3630 | cls_sess = ddb_entry->sess; | ||
| 3631 | sess = cls_sess->dd_data; | ||
| 3632 | cls_conn = ddb_entry->conn; | ||
| 3633 | conn = cls_conn->dd_data; | ||
| 3634 | |||
| 3635 | tddb->tpgt = sess->tpgt; | ||
| 3636 | tddb->port = conn->persistent_port; | ||
| 3637 | strncpy(tddb->iscsi_name, sess->targetname, ISCSI_NAME_SIZE); | ||
| 3638 | strncpy(tddb->ip_addr, conn->persistent_address, DDB_IPADDR_LEN); | ||
| 3639 | } | ||
| 3640 | |||
| 3641 | static void qla4xxx_convert_param_ddb(struct dev_db_entry *fw_ddb_entry, | ||
| 3642 | struct ql4_tuple_ddb *tddb) | ||
| 3643 | { | ||
| 3644 | uint16_t options = 0; | ||
| 3645 | |||
| 3646 | tddb->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp); | ||
| 3647 | memcpy(&tddb->iscsi_name[0], &fw_ddb_entry->iscsi_name[0], | ||
| 3648 | min(sizeof(tddb->iscsi_name), sizeof(fw_ddb_entry->iscsi_name))); | ||
| 3649 | |||
| 3650 | options = le16_to_cpu(fw_ddb_entry->options); | ||
| 3651 | if (options & DDB_OPT_IPV6_DEVICE) | ||
| 3652 | sprintf(tddb->ip_addr, "%pI6", fw_ddb_entry->ip_addr); | ||
| 3653 | else | ||
| 3654 | sprintf(tddb->ip_addr, "%pI4", fw_ddb_entry->ip_addr); | ||
| 3655 | |||
| 3656 | tddb->port = le16_to_cpu(fw_ddb_entry->port); | ||
| 3657 | } | ||
| 3658 | |||
| 3659 | static int qla4xxx_compare_tuple_ddb(struct scsi_qla_host *ha, | ||
| 3660 | struct ql4_tuple_ddb *old_tddb, | ||
| 3661 | struct ql4_tuple_ddb *new_tddb) | ||
| 3662 | { | ||
| 3663 | if (strcmp(old_tddb->iscsi_name, new_tddb->iscsi_name)) | ||
| 3664 | return QLA_ERROR; | ||
| 3665 | |||
| 3666 | if (strcmp(old_tddb->ip_addr, new_tddb->ip_addr)) | ||
| 3667 | return QLA_ERROR; | ||
| 3668 | |||
| 3669 | if (old_tddb->port != new_tddb->port) | ||
| 3670 | return QLA_ERROR; | ||
| 3671 | |||
| 3672 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 3673 | "Match Found, fw[%d,%d,%s,%s], [%d,%d,%s,%s]", | ||
| 3674 | old_tddb->port, old_tddb->tpgt, old_tddb->ip_addr, | ||
| 3675 | old_tddb->iscsi_name, new_tddb->port, new_tddb->tpgt, | ||
| 3676 | new_tddb->ip_addr, new_tddb->iscsi_name)); | ||
| 3677 | |||
| 3678 | return QLA_SUCCESS; | ||
| 3679 | } | ||
| 3680 | |||
| 3681 | static int qla4xxx_is_session_exists(struct scsi_qla_host *ha, | ||
| 3682 | struct dev_db_entry *fw_ddb_entry) | ||
| 3683 | { | ||
| 3684 | struct ddb_entry *ddb_entry; | ||
| 3685 | struct ql4_tuple_ddb *fw_tddb = NULL; | ||
| 3686 | struct ql4_tuple_ddb *tmp_tddb = NULL; | ||
| 3687 | int idx; | ||
| 3688 | int ret = QLA_ERROR; | ||
| 3689 | |||
| 3690 | fw_tddb = vzalloc(sizeof(*fw_tddb)); | ||
| 3691 | if (!fw_tddb) { | ||
| 3692 | DEBUG2(ql4_printk(KERN_WARNING, ha, | ||
| 3693 | "Memory Allocation failed.\n")); | ||
| 3694 | ret = QLA_SUCCESS; | ||
| 3695 | goto exit_check; | ||
| 3696 | } | ||
| 3697 | |||
| 3698 | tmp_tddb = vzalloc(sizeof(*tmp_tddb)); | ||
| 3699 | if (!tmp_tddb) { | ||
| 3700 | DEBUG2(ql4_printk(KERN_WARNING, ha, | ||
| 3701 | "Memory Allocation failed.\n")); | ||
| 3702 | ret = QLA_SUCCESS; | ||
| 3703 | goto exit_check; | ||
| 3704 | } | ||
| 3705 | |||
| 3706 | qla4xxx_convert_param_ddb(fw_ddb_entry, fw_tddb); | ||
| 3707 | |||
| 3708 | for (idx = 0; idx < MAX_DDB_ENTRIES; idx++) { | ||
| 3709 | ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx); | ||
| 3710 | if (ddb_entry == NULL) | ||
| 3711 | continue; | ||
| 3712 | |||
| 3713 | qla4xxx_get_param_ddb(ddb_entry, tmp_tddb); | ||
| 3714 | if (!qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb)) { | ||
| 3715 | ret = QLA_SUCCESS; /* found */ | ||
| 3716 | goto exit_check; | ||
| 3717 | } | ||
| 3718 | } | ||
| 3719 | |||
| 3720 | exit_check: | ||
| 3721 | if (fw_tddb) | ||
| 3722 | vfree(fw_tddb); | ||
| 3723 | if (tmp_tddb) | ||
| 3724 | vfree(tmp_tddb); | ||
| 3725 | return ret; | ||
| 3726 | } | ||
| 3727 | |||
| 3728 | static int qla4xxx_is_flash_ddb_exists(struct scsi_qla_host *ha, | ||
| 3729 | struct list_head *list_nt, | ||
| 3730 | struct dev_db_entry *fw_ddb_entry) | ||
| 3731 | { | ||
| 3732 | struct qla_ddb_index *nt_ddb_idx, *nt_ddb_idx_tmp; | ||
| 3733 | struct ql4_tuple_ddb *fw_tddb = NULL; | ||
| 3734 | struct ql4_tuple_ddb *tmp_tddb = NULL; | ||
| 3735 | int ret = QLA_ERROR; | ||
| 3736 | |||
| 3737 | fw_tddb = vzalloc(sizeof(*fw_tddb)); | ||
| 3738 | if (!fw_tddb) { | ||
| 3739 | DEBUG2(ql4_printk(KERN_WARNING, ha, | ||
| 3740 | "Memory Allocation failed.\n")); | ||
| 3741 | ret = QLA_SUCCESS; | ||
| 3742 | goto exit_check; | ||
| 3743 | } | ||
| 3744 | |||
| 3745 | tmp_tddb = vzalloc(sizeof(*tmp_tddb)); | ||
| 3746 | if (!tmp_tddb) { | ||
| 3747 | DEBUG2(ql4_printk(KERN_WARNING, ha, | ||
| 3748 | "Memory Allocation failed.\n")); | ||
| 3749 | ret = QLA_SUCCESS; | ||
| 3750 | goto exit_check; | ||
| 3751 | } | ||
| 3752 | |||
| 3753 | qla4xxx_convert_param_ddb(fw_ddb_entry, fw_tddb); | ||
| 3754 | |||
| 3755 | list_for_each_entry_safe(nt_ddb_idx, nt_ddb_idx_tmp, list_nt, list) { | ||
| 3756 | qla4xxx_convert_param_ddb(&nt_ddb_idx->fw_ddb, tmp_tddb); | ||
| 3757 | if (!qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb)) { | ||
| 3758 | ret = QLA_SUCCESS; /* found */ | ||
| 3759 | goto exit_check; | ||
| 3760 | } | ||
| 3761 | } | ||
| 3762 | |||
| 3763 | exit_check: | ||
| 3764 | if (fw_tddb) | ||
| 3765 | vfree(fw_tddb); | ||
| 3766 | if (tmp_tddb) | ||
| 3767 | vfree(tmp_tddb); | ||
| 3768 | return ret; | ||
| 3769 | } | ||
| 3770 | |||
| 3771 | static void qla4xxx_free_nt_list(struct list_head *list_nt) | ||
| 3772 | { | ||
| 3773 | struct qla_ddb_index *nt_ddb_idx, *nt_ddb_idx_tmp; | ||
| 3774 | |||
| 3775 | /* Free up the normaltargets list */ | ||
| 3776 | list_for_each_entry_safe(nt_ddb_idx, nt_ddb_idx_tmp, list_nt, list) { | ||
| 3777 | list_del_init(&nt_ddb_idx->list); | ||
| 3778 | vfree(nt_ddb_idx); | ||
| 3779 | } | ||
| 3780 | |||
| 3781 | } | ||
| 3782 | |||
| 3783 | static struct iscsi_endpoint *qla4xxx_get_ep_fwdb(struct scsi_qla_host *ha, | ||
| 3784 | struct dev_db_entry *fw_ddb_entry) | ||
| 3785 | { | ||
| 3786 | struct iscsi_endpoint *ep; | ||
| 3787 | struct sockaddr_in *addr; | ||
| 3788 | struct sockaddr_in6 *addr6; | ||
| 3789 | struct sockaddr *dst_addr; | ||
| 3790 | char *ip; | ||
| 3791 | |||
| 3792 | /* TODO: need to destroy on unload iscsi_endpoint*/ | ||
| 3793 | dst_addr = vmalloc(sizeof(*dst_addr)); | ||
| 3794 | if (!dst_addr) | ||
| 3795 | return NULL; | ||
| 3796 | |||
| 3797 | if (fw_ddb_entry->options & DDB_OPT_IPV6_DEVICE) { | ||
| 3798 | dst_addr->sa_family = AF_INET6; | ||
| 3799 | addr6 = (struct sockaddr_in6 *)dst_addr; | ||
| 3800 | ip = (char *)&addr6->sin6_addr; | ||
| 3801 | memcpy(ip, fw_ddb_entry->ip_addr, IPv6_ADDR_LEN); | ||
| 3802 | addr6->sin6_port = htons(le16_to_cpu(fw_ddb_entry->port)); | ||
| 3803 | |||
| 3804 | } else { | ||
| 3805 | dst_addr->sa_family = AF_INET; | ||
| 3806 | addr = (struct sockaddr_in *)dst_addr; | ||
| 3807 | ip = (char *)&addr->sin_addr; | ||
| 3808 | memcpy(ip, fw_ddb_entry->ip_addr, IP_ADDR_LEN); | ||
| 3809 | addr->sin_port = htons(le16_to_cpu(fw_ddb_entry->port)); | ||
| 3810 | } | ||
| 3811 | |||
| 3812 | ep = qla4xxx_ep_connect(ha->host, dst_addr, 0); | ||
| 3813 | vfree(dst_addr); | ||
| 3814 | return ep; | ||
| 3815 | } | ||
| 3816 | |||
| 3817 | static int qla4xxx_verify_boot_idx(struct scsi_qla_host *ha, uint16_t idx) | ||
| 3818 | { | ||
| 3819 | if (ql4xdisablesysfsboot) | ||
| 3820 | return QLA_SUCCESS; | ||
| 3821 | if (idx == ha->pri_ddb_idx || idx == ha->sec_ddb_idx) | ||
| 3822 | return QLA_ERROR; | ||
| 3823 | return QLA_SUCCESS; | ||
| 3824 | } | ||
| 3825 | |||
| 3826 | static void qla4xxx_setup_flash_ddb_entry(struct scsi_qla_host *ha, | ||
| 3827 | struct ddb_entry *ddb_entry) | ||
| 3828 | { | ||
| 3829 | ddb_entry->ddb_type = FLASH_DDB; | ||
| 3830 | ddb_entry->fw_ddb_index = INVALID_ENTRY; | ||
| 3831 | ddb_entry->fw_ddb_device_state = DDB_DS_NO_CONNECTION_ACTIVE; | ||
| 3832 | ddb_entry->ha = ha; | ||
| 3833 | ddb_entry->unblock_sess = qla4xxx_unblock_flash_ddb; | ||
| 3834 | ddb_entry->ddb_change = qla4xxx_flash_ddb_change; | ||
| 3835 | |||
| 3836 | atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY); | ||
| 3837 | atomic_set(&ddb_entry->relogin_timer, 0); | ||
| 3838 | atomic_set(&ddb_entry->relogin_retry_count, 0); | ||
| 3839 | |||
| 3840 | ddb_entry->default_relogin_timeout = | ||
| 3841 | le16_to_cpu(ddb_entry->fw_ddb_entry.def_timeout); | ||
| 3842 | ddb_entry->default_time2wait = | ||
| 3843 | le16_to_cpu(ddb_entry->fw_ddb_entry.iscsi_def_time2wait); | ||
| 3844 | } | ||
| 3845 | |||
| 3846 | static void qla4xxx_wait_for_ip_configuration(struct scsi_qla_host *ha) | ||
| 3847 | { | ||
| 3848 | uint32_t idx = 0; | ||
| 3849 | uint32_t ip_idx[IP_ADDR_COUNT] = {0, 1, 2, 3}; /* 4 IP interfaces */ | ||
| 3850 | uint32_t sts[MBOX_REG_COUNT]; | ||
| 3851 | uint32_t ip_state; | ||
| 3852 | unsigned long wtime; | ||
| 3853 | int ret; | ||
| 3854 | |||
| 3855 | wtime = jiffies + (HZ * IP_CONFIG_TOV); | ||
| 3856 | do { | ||
| 3857 | for (idx = 0; idx < IP_ADDR_COUNT; idx++) { | ||
| 3858 | if (ip_idx[idx] == -1) | ||
| 3859 | continue; | ||
| 3860 | |||
| 3861 | ret = qla4xxx_get_ip_state(ha, 0, ip_idx[idx], sts); | ||
| 3862 | |||
| 3863 | if (ret == QLA_ERROR) { | ||
| 3864 | ip_idx[idx] = -1; | ||
| 3865 | continue; | ||
| 3866 | } | ||
| 3867 | |||
| 3868 | ip_state = (sts[1] & IP_STATE_MASK) >> IP_STATE_SHIFT; | ||
| 3869 | |||
| 3870 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 3871 | "Waiting for IP state for idx = %d, state = 0x%x\n", | ||
| 3872 | ip_idx[idx], ip_state)); | ||
| 3873 | if (ip_state == IP_ADDRSTATE_UNCONFIGURED || | ||
| 3874 | ip_state == IP_ADDRSTATE_INVALID || | ||
| 3875 | ip_state == IP_ADDRSTATE_PREFERRED || | ||
| 3876 | ip_state == IP_ADDRSTATE_DEPRICATED || | ||
| 3877 | ip_state == IP_ADDRSTATE_DISABLING) | ||
| 3878 | ip_idx[idx] = -1; | ||
| 3879 | |||
| 3880 | } | ||
| 3881 | |||
| 3882 | /* Break if all IP states checked */ | ||
| 3883 | if ((ip_idx[0] == -1) && | ||
| 3884 | (ip_idx[1] == -1) && | ||
| 3885 | (ip_idx[2] == -1) && | ||
| 3886 | (ip_idx[3] == -1)) | ||
| 3887 | break; | ||
| 3888 | schedule_timeout_uninterruptible(HZ); | ||
| 3889 | } while (time_after(wtime, jiffies)); | ||
| 3890 | } | ||
| 3891 | |||
| 3892 | void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset) | ||
| 3893 | { | ||
| 3894 | int max_ddbs; | ||
| 3895 | int ret; | ||
| 3896 | uint32_t idx = 0, next_idx = 0; | ||
| 3897 | uint32_t state = 0, conn_err = 0; | ||
| 3898 | uint16_t conn_id; | ||
| 3899 | struct dev_db_entry *fw_ddb_entry; | ||
| 3900 | struct ddb_entry *ddb_entry = NULL; | ||
| 3901 | dma_addr_t fw_ddb_dma; | ||
| 3902 | struct iscsi_cls_session *cls_sess; | ||
| 3903 | struct iscsi_session *sess; | ||
| 3904 | struct iscsi_cls_conn *cls_conn; | ||
| 3905 | struct iscsi_endpoint *ep; | ||
| 3906 | uint16_t cmds_max = 32, tmo = 0; | ||
| 3907 | uint32_t initial_cmdsn = 0; | ||
| 3908 | struct list_head list_st, list_nt; /* List of sendtargets */ | ||
| 3909 | struct qla_ddb_index *st_ddb_idx, *st_ddb_idx_tmp; | ||
| 3910 | int fw_idx_size; | ||
| 3911 | unsigned long wtime; | ||
| 3912 | struct qla_ddb_index *nt_ddb_idx; | ||
| 3913 | |||
| 3914 | if (!test_bit(AF_LINK_UP, &ha->flags)) { | ||
| 3915 | set_bit(AF_BUILD_DDB_LIST, &ha->flags); | ||
| 3916 | ha->is_reset = is_reset; | ||
| 3917 | return; | ||
| 3918 | } | ||
| 3919 | max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : | ||
| 3920 | MAX_DEV_DB_ENTRIES; | ||
| 3921 | |||
| 3922 | fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, | ||
| 3923 | &fw_ddb_dma); | ||
| 3924 | if (fw_ddb_entry == NULL) { | ||
| 3925 | DEBUG2(ql4_printk(KERN_ERR, ha, "Out of memory\n")); | ||
| 3926 | goto exit_ddb_list; | ||
| 3927 | } | ||
| 3928 | |||
| 3929 | INIT_LIST_HEAD(&list_st); | ||
| 3930 | INIT_LIST_HEAD(&list_nt); | ||
| 3931 | fw_idx_size = sizeof(struct qla_ddb_index); | ||
| 3932 | |||
| 3933 | for (idx = 0; idx < max_ddbs; idx = next_idx) { | ||
| 3934 | ret = qla4xxx_get_fwddb_entry(ha, idx, fw_ddb_entry, | ||
| 3935 | fw_ddb_dma, NULL, | ||
| 3936 | &next_idx, &state, &conn_err, | ||
| 3937 | NULL, &conn_id); | ||
| 3938 | if (ret == QLA_ERROR) | ||
| 3939 | break; | ||
| 3940 | |||
| 3941 | if (qla4xxx_verify_boot_idx(ha, idx) != QLA_SUCCESS) | ||
| 3942 | goto continue_next_st; | ||
| 3943 | |||
| 3944 | /* Check if ST, add to the list_st */ | ||
| 3945 | if (strlen((char *) fw_ddb_entry->iscsi_name) != 0) | ||
| 3946 | goto continue_next_st; | ||
| 3947 | |||
| 3948 | st_ddb_idx = vzalloc(fw_idx_size); | ||
| 3949 | if (!st_ddb_idx) | ||
| 3950 | break; | ||
| 3951 | |||
| 3952 | st_ddb_idx->fw_ddb_idx = idx; | ||
| 3953 | |||
| 3954 | list_add_tail(&st_ddb_idx->list, &list_st); | ||
| 3955 | continue_next_st: | ||
| 3956 | if (next_idx == 0) | ||
| 3957 | break; | ||
| 3958 | } | ||
| 3959 | |||
| 3960 | /* Before issuing conn open mbox, ensure all IPs states are configured | ||
| 3961 | * Note, conn open fails if IPs are not configured | ||
| 3962 | */ | ||
| 3963 | qla4xxx_wait_for_ip_configuration(ha); | ||
| 3964 | |||
| 3965 | /* Go thru the STs and fire the sendtargets by issuing conn open mbx */ | ||
| 3966 | list_for_each_entry_safe(st_ddb_idx, st_ddb_idx_tmp, &list_st, list) { | ||
| 3967 | qla4xxx_conn_open(ha, st_ddb_idx->fw_ddb_idx); | ||
| 3968 | } | ||
| 3969 | |||
| 3970 | /* Wait to ensure all sendtargets are done for min 12 sec wait */ | ||
| 3971 | tmo = ((ha->def_timeout < LOGIN_TOV) ? LOGIN_TOV : ha->def_timeout); | ||
| 3972 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 3973 | "Default time to wait for build ddb %d\n", tmo)); | ||
| 3974 | |||
| 3975 | wtime = jiffies + (HZ * tmo); | ||
| 3976 | do { | ||
| 3977 | list_for_each_entry_safe(st_ddb_idx, st_ddb_idx_tmp, &list_st, | ||
| 3978 | list) { | ||
| 3979 | ret = qla4xxx_get_fwddb_entry(ha, | ||
| 3980 | st_ddb_idx->fw_ddb_idx, | ||
| 3981 | NULL, 0, NULL, &next_idx, | ||
| 3982 | &state, &conn_err, NULL, | ||
| 3983 | NULL); | ||
| 3984 | if (ret == QLA_ERROR) | ||
| 3985 | continue; | ||
| 3986 | |||
| 3987 | if (state == DDB_DS_NO_CONNECTION_ACTIVE || | ||
| 3988 | state == DDB_DS_SESSION_FAILED) { | ||
| 3989 | list_del_init(&st_ddb_idx->list); | ||
| 3990 | vfree(st_ddb_idx); | ||
| 3991 | } | ||
| 3992 | } | ||
| 3993 | schedule_timeout_uninterruptible(HZ / 10); | ||
| 3994 | } while (time_after(wtime, jiffies)); | ||
| 3995 | |||
| 3996 | /* Free up the sendtargets list */ | ||
| 3997 | list_for_each_entry_safe(st_ddb_idx, st_ddb_idx_tmp, &list_st, list) { | ||
| 3998 | list_del_init(&st_ddb_idx->list); | ||
| 3999 | vfree(st_ddb_idx); | ||
| 4000 | } | ||
| 4001 | |||
| 4002 | for (idx = 0; idx < max_ddbs; idx = next_idx) { | ||
| 4003 | ret = qla4xxx_get_fwddb_entry(ha, idx, fw_ddb_entry, | ||
| 4004 | fw_ddb_dma, NULL, | ||
| 4005 | &next_idx, &state, &conn_err, | ||
| 4006 | NULL, &conn_id); | ||
| 4007 | if (ret == QLA_ERROR) | ||
| 4008 | break; | ||
| 4009 | |||
| 4010 | if (qla4xxx_verify_boot_idx(ha, idx) != QLA_SUCCESS) | ||
| 4011 | goto continue_next_nt; | ||
| 4012 | |||
| 4013 | /* Check if NT, then add to list it */ | ||
| 4014 | if (strlen((char *) fw_ddb_entry->iscsi_name) == 0) | ||
| 4015 | goto continue_next_nt; | ||
| 4016 | |||
| 4017 | if (state == DDB_DS_NO_CONNECTION_ACTIVE || | ||
| 4018 | state == DDB_DS_SESSION_FAILED) { | ||
| 4019 | DEBUG2(ql4_printk(KERN_INFO, ha, | ||
| 4020 | "Adding DDB to session = 0x%x\n", | ||
| 4021 | idx)); | ||
| 4022 | if (is_reset == INIT_ADAPTER) { | ||
| 4023 | nt_ddb_idx = vmalloc(fw_idx_size); | ||
| 4024 | if (!nt_ddb_idx) | ||
| 4025 | break; | ||
| 4026 | |||
| 4027 | nt_ddb_idx->fw_ddb_idx = idx; | ||
| 4028 | |||
| 4029 | memcpy(&nt_ddb_idx->fw_ddb, fw_ddb_entry, | ||
| 4030 | sizeof(struct dev_db_entry)); | ||
| 4031 | |||
| 4032 | if (qla4xxx_is_flash_ddb_exists(ha, &list_nt, | ||
| 4033 | fw_ddb_entry) == QLA_SUCCESS) { | ||
| 4034 | vfree(nt_ddb_idx); | ||
| 4035 | goto continue_next_nt; | ||
| 4036 | } | ||
| 4037 | list_add_tail(&nt_ddb_idx->list, &list_nt); | ||
| 4038 | } else if (is_reset == RESET_ADAPTER) { | ||
| 4039 | if (qla4xxx_is_session_exists(ha, | ||
| 4040 | fw_ddb_entry) == QLA_SUCCESS) | ||
| 4041 | goto continue_next_nt; | ||
| 4042 | } | ||
| 4043 | |||
| 4044 | /* Create session object, with INVALID_ENTRY, | ||
| 4045 | * the targer_id would get set when we issue the login | ||
| 4046 | */ | ||
| 4047 | cls_sess = iscsi_session_setup(&qla4xxx_iscsi_transport, | ||
| 4048 | ha->host, cmds_max, | ||
| 4049 | sizeof(struct ddb_entry), | ||
| 4050 | sizeof(struct ql4_task_data), | ||
| 4051 | initial_cmdsn, INVALID_ENTRY); | ||
| 4052 | if (!cls_sess) | ||
| 4053 | goto exit_ddb_list; | ||
| 4054 | |||
| 4055 | /* | ||
| 4056 | * iscsi_session_setup increments the driver reference | ||
| 4057 | * count which wouldn't let the driver to be unloaded. | ||
| 4058 | * so calling module_put function to decrement the | ||
| 4059 | * reference count. | ||
| 4060 | **/ | ||
| 4061 | module_put(qla4xxx_iscsi_transport.owner); | ||
| 4062 | sess = cls_sess->dd_data; | ||
| 4063 | ddb_entry = sess->dd_data; | ||
| 4064 | ddb_entry->sess = cls_sess; | ||
| 4065 | |||
| 4066 | cls_sess->recovery_tmo = ql4xsess_recovery_tmo; | ||
| 4067 | memcpy(&ddb_entry->fw_ddb_entry, fw_ddb_entry, | ||
| 4068 | sizeof(struct dev_db_entry)); | ||
| 4069 | |||
| 4070 | qla4xxx_setup_flash_ddb_entry(ha, ddb_entry); | ||
| 4071 | |||
| 4072 | cls_conn = iscsi_conn_setup(cls_sess, | ||
| 4073 | sizeof(struct qla_conn), | ||
| 4074 | conn_id); | ||
| 4075 | if (!cls_conn) | ||
| 4076 | goto exit_ddb_list; | ||
| 4077 | |||
| 4078 | ddb_entry->conn = cls_conn; | ||
| 4079 | |||
| 4080 | /* Setup ep, for displaying attributes in sysfs */ | ||
| 4081 | ep = qla4xxx_get_ep_fwdb(ha, fw_ddb_entry); | ||
| 4082 | if (ep) { | ||
| 4083 | ep->conn = cls_conn; | ||
| 4084 | cls_conn->ep = ep; | ||
| 4085 | } else { | ||
| 4086 | DEBUG2(ql4_printk(KERN_ERR, ha, | ||
| 4087 | "Unable to get ep\n")); | ||
| 4088 | } | ||
| 4089 | |||
| 4090 | /* Update sess/conn params */ | ||
| 4091 | qla4xxx_copy_fwddb_param(ha, fw_ddb_entry, cls_sess, | ||
| 4092 | cls_conn); | ||
| 4093 | |||
| 4094 | if (is_reset == RESET_ADAPTER) { | ||
| 4095 | iscsi_block_session(cls_sess); | ||
| 4096 | /* Use the relogin path to discover new devices | ||
| 4097 | * by short-circuting the logic of setting | ||
| 4098 | * timer to relogin - instead set the flags | ||
| 4099 | * to initiate login right away. | ||
| 4100 | */ | ||
| 4101 | set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); | ||
| 4102 | set_bit(DF_RELOGIN, &ddb_entry->flags); | ||
| 4103 | } | ||
| 4104 | } | ||
| 4105 | continue_next_nt: | ||
| 4106 | if (next_idx == 0) | ||
| 4107 | break; | ||
| 4108 | } | ||
| 4109 | exit_ddb_list: | ||
| 4110 | qla4xxx_free_nt_list(&list_nt); | ||
| 4111 | if (fw_ddb_entry) | ||
| 4112 | dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); | ||
| 4113 | |||
| 4114 | qla4xxx_free_ddb_index(ha); | ||
| 4115 | } | ||
| 4116 | |||
| 4117 | |||
| 3180 | /** | 4118 | /** |
| 3181 | * qla4xxx_probe_adapter - callback function to probe HBA | 4119 | * qla4xxx_probe_adapter - callback function to probe HBA |
| 3182 | * @pdev: pointer to pci_dev structure | 4120 | * @pdev: pointer to pci_dev structure |
| @@ -3298,7 +4236,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, | |||
| 3298 | * firmware | 4236 | * firmware |
| 3299 | * NOTE: interrupts enabled upon successful completion | 4237 | * NOTE: interrupts enabled upon successful completion |
| 3300 | */ | 4238 | */ |
| 3301 | status = qla4xxx_initialize_adapter(ha); | 4239 | status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); |
| 3302 | while ((!test_bit(AF_ONLINE, &ha->flags)) && | 4240 | while ((!test_bit(AF_ONLINE, &ha->flags)) && |
| 3303 | init_retry_count++ < MAX_INIT_RETRIES) { | 4241 | init_retry_count++ < MAX_INIT_RETRIES) { |
| 3304 | 4242 | ||
| @@ -3319,7 +4257,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, | |||
| 3319 | if (ha->isp_ops->reset_chip(ha) == QLA_ERROR) | 4257 | if (ha->isp_ops->reset_chip(ha) == QLA_ERROR) |
| 3320 | continue; | 4258 | continue; |
| 3321 | 4259 | ||
| 3322 | status = qla4xxx_initialize_adapter(ha); | 4260 | status = qla4xxx_initialize_adapter(ha, INIT_ADAPTER); |
| 3323 | } | 4261 | } |
| 3324 | 4262 | ||
| 3325 | if (!test_bit(AF_ONLINE, &ha->flags)) { | 4263 | if (!test_bit(AF_ONLINE, &ha->flags)) { |
| @@ -3386,12 +4324,16 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, | |||
| 3386 | ha->host_no, ha->firmware_version[0], ha->firmware_version[1], | 4324 | ha->host_no, ha->firmware_version[0], ha->firmware_version[1], |
| 3387 | ha->patch_number, ha->build_number); | 4325 | ha->patch_number, ha->build_number); |
| 3388 | 4326 | ||
| 3389 | qla4xxx_create_chap_list(ha); | ||
| 3390 | |||
| 3391 | if (qla4xxx_setup_boot_info(ha)) | 4327 | if (qla4xxx_setup_boot_info(ha)) |
| 3392 | ql4_printk(KERN_ERR, ha, "%s:ISCSI boot info setup failed\n", | 4328 | ql4_printk(KERN_ERR, ha, "%s:ISCSI boot info setup failed\n", |
| 3393 | __func__); | 4329 | __func__); |
| 3394 | 4330 | ||
| 4331 | /* Perform the build ddb list and login to each */ | ||
| 4332 | qla4xxx_build_ddb_list(ha, INIT_ADAPTER); | ||
| 4333 | iscsi_host_for_each_session(ha->host, qla4xxx_login_flash_ddb); | ||
| 4334 | |||
| 4335 | qla4xxx_create_chap_list(ha); | ||
| 4336 | |||
| 3395 | qla4xxx_create_ifaces(ha); | 4337 | qla4xxx_create_ifaces(ha); |
| 3396 | return 0; | 4338 | return 0; |
| 3397 | 4339 | ||
| @@ -3449,6 +4391,38 @@ static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha) | |||
| 3449 | } | 4391 | } |
| 3450 | } | 4392 | } |
| 3451 | 4393 | ||
| 4394 | static void qla4xxx_destroy_fw_ddb_session(struct scsi_qla_host *ha) | ||
| 4395 | { | ||
| 4396 | struct ddb_entry *ddb_entry; | ||
| 4397 | int options; | ||
| 4398 | int idx; | ||
| 4399 | |||
| 4400 | for (idx = 0; idx < MAX_DDB_ENTRIES; idx++) { | ||
| 4401 | |||
| 4402 | ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx); | ||
| 4403 | if ((ddb_entry != NULL) && | ||
| 4404 | (ddb_entry->ddb_type == FLASH_DDB)) { | ||
| 4405 | |||
| 4406 | options = LOGOUT_OPTION_CLOSE_SESSION; | ||
| 4407 | if (qla4xxx_session_logout_ddb(ha, ddb_entry, options) | ||
| 4408 | == QLA_ERROR) | ||
| 4409 | ql4_printk(KERN_ERR, ha, "%s: Logout failed\n", | ||
| 4410 | __func__); | ||
| 4411 | |||
| 4412 | qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index); | ||
| 4413 | /* | ||
| 4414 | * we have decremented the reference count of the driver | ||
| 4415 | * when we setup the session to have the driver unload | ||
| 4416 | * to be seamless without actually destroying the | ||
| 4417 | * session | ||
| 4418 | **/ | ||
| 4419 | try_module_get(qla4xxx_iscsi_transport.owner); | ||
| 4420 | iscsi_destroy_endpoint(ddb_entry->conn->ep); | ||
| 4421 | qla4xxx_free_ddb(ha, ddb_entry); | ||
| 4422 | iscsi_session_teardown(ddb_entry->sess); | ||
| 4423 | } | ||
| 4424 | } | ||
| 4425 | } | ||
| 3452 | /** | 4426 | /** |
| 3453 | * qla4xxx_remove_adapter - calback function to remove adapter. | 4427 | * qla4xxx_remove_adapter - calback function to remove adapter. |
| 3454 | * @pci_dev: PCI device pointer | 4428 | * @pci_dev: PCI device pointer |
| @@ -3465,9 +4439,11 @@ static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev) | |||
| 3465 | /* destroy iface from sysfs */ | 4439 | /* destroy iface from sysfs */ |
| 3466 | qla4xxx_destroy_ifaces(ha); | 4440 | qla4xxx_destroy_ifaces(ha); |
| 3467 | 4441 | ||
| 3468 | if (ha->boot_kset) | 4442 | if ((!ql4xdisablesysfsboot) && ha->boot_kset) |
| 3469 | iscsi_boot_destroy_kset(ha->boot_kset); | 4443 | iscsi_boot_destroy_kset(ha->boot_kset); |
| 3470 | 4444 | ||
| 4445 | qla4xxx_destroy_fw_ddb_session(ha); | ||
| 4446 | |||
| 3471 | scsi_remove_host(ha->host); | 4447 | scsi_remove_host(ha->host); |
| 3472 | 4448 | ||
| 3473 | qla4xxx_free_adapter(ha); | 4449 | qla4xxx_free_adapter(ha); |
| @@ -4115,7 +5091,7 @@ static uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha) | |||
| 4115 | 5091 | ||
| 4116 | qla4_8xxx_idc_unlock(ha); | 5092 | qla4_8xxx_idc_unlock(ha); |
| 4117 | clear_bit(AF_FW_RECOVERY, &ha->flags); | 5093 | clear_bit(AF_FW_RECOVERY, &ha->flags); |
| 4118 | rval = qla4xxx_initialize_adapter(ha); | 5094 | rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); |
| 4119 | qla4_8xxx_idc_lock(ha); | 5095 | qla4_8xxx_idc_lock(ha); |
| 4120 | 5096 | ||
| 4121 | if (rval != QLA_SUCCESS) { | 5097 | if (rval != QLA_SUCCESS) { |
| @@ -4151,7 +5127,7 @@ static uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha) | |||
| 4151 | if ((qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == | 5127 | if ((qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE) == |
| 4152 | QLA82XX_DEV_READY)) { | 5128 | QLA82XX_DEV_READY)) { |
| 4153 | clear_bit(AF_FW_RECOVERY, &ha->flags); | 5129 | clear_bit(AF_FW_RECOVERY, &ha->flags); |
| 4154 | rval = qla4xxx_initialize_adapter(ha); | 5130 | rval = qla4xxx_initialize_adapter(ha, RESET_ADAPTER); |
| 4155 | if (rval == QLA_SUCCESS) { | 5131 | if (rval == QLA_SUCCESS) { |
| 4156 | ret = qla4xxx_request_irqs(ha); | 5132 | ret = qla4xxx_request_irqs(ha); |
| 4157 | if (ret) { | 5133 | if (ret) { |
diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h index c15347d3f532..5254e57968f5 100644 --- a/drivers/scsi/qla4xxx/ql4_version.h +++ b/drivers/scsi/qla4xxx/ql4_version.h | |||
| @@ -5,4 +5,4 @@ | |||
| 5 | * See LICENSE.qla4xxx for copyright and licensing details. | 5 | * See LICENSE.qla4xxx for copyright and licensing details. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #define QLA4XXX_DRIVER_VERSION "5.02.00-k8" | 8 | #define QLA4XXX_DRIVER_VERSION "5.02.00-k9" |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index a1fd73df5416..8ba4510a9519 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
| @@ -199,7 +199,7 @@ config SPI_FSL_LIB | |||
| 199 | depends on FSL_SOC | 199 | depends on FSL_SOC |
| 200 | 200 | ||
| 201 | config SPI_FSL_SPI | 201 | config SPI_FSL_SPI |
| 202 | tristate "Freescale SPI controller" | 202 | bool "Freescale SPI controller" |
| 203 | depends on FSL_SOC | 203 | depends on FSL_SOC |
| 204 | select SPI_FSL_LIB | 204 | select SPI_FSL_LIB |
| 205 | help | 205 | help |
| @@ -208,7 +208,7 @@ config SPI_FSL_SPI | |||
| 208 | MPC8569 uses the controller in QE mode, MPC8610 in cpu mode. | 208 | MPC8569 uses the controller in QE mode, MPC8610 in cpu mode. |
| 209 | 209 | ||
| 210 | config SPI_FSL_ESPI | 210 | config SPI_FSL_ESPI |
| 211 | tristate "Freescale eSPI controller" | 211 | bool "Freescale eSPI controller" |
| 212 | depends on FSL_SOC | 212 | depends on FSL_SOC |
| 213 | select SPI_FSL_LIB | 213 | select SPI_FSL_LIB |
| 214 | help | 214 | help |
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index 024b48aed5ca..acc88b4d2869 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 16 | #include <linux/module.h> | ||
| 16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 17 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
| 18 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index e093d3ec41ba..0094c645ff0d 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c | |||
| @@ -256,7 +256,7 @@ static void spi_gpio_cleanup(struct spi_device *spi) | |||
| 256 | spi_bitbang_cleanup(spi); | 256 | spi_bitbang_cleanup(spi); |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | static int __init spi_gpio_alloc(unsigned pin, const char *label, bool is_in) | 259 | static int __devinit spi_gpio_alloc(unsigned pin, const char *label, bool is_in) |
| 260 | { | 260 | { |
| 261 | int value; | 261 | int value; |
| 262 | 262 | ||
| @@ -270,7 +270,7 @@ static int __init spi_gpio_alloc(unsigned pin, const char *label, bool is_in) | |||
| 270 | return value; | 270 | return value; |
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | static int __init | 273 | static int __devinit |
| 274 | spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label, | 274 | spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label, |
| 275 | u16 *res_flags) | 275 | u16 *res_flags) |
| 276 | { | 276 | { |
diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c index 21c70b2b8311..182e9c873822 100644 --- a/drivers/spi/spi-nuc900.c +++ b/drivers/spi/spi-nuc900.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | * | 8 | * |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/module.h> | ||
| 11 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 12 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
| 13 | #include <linux/workqueue.h> | 14 | #include <linux/workqueue.h> |
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c index 84c934c0a545..520e8286db28 100644 --- a/drivers/ssb/driver_pcicore.c +++ b/drivers/ssb/driver_pcicore.c | |||
| @@ -517,10 +517,14 @@ static void ssb_pcicore_pcie_setup_workarounds(struct ssb_pcicore *pc) | |||
| 517 | 517 | ||
| 518 | static void __devinit ssb_pcicore_init_clientmode(struct ssb_pcicore *pc) | 518 | static void __devinit ssb_pcicore_init_clientmode(struct ssb_pcicore *pc) |
| 519 | { | 519 | { |
| 520 | ssb_pcicore_fix_sprom_core_index(pc); | 520 | struct ssb_device *pdev = pc->dev; |
| 521 | struct ssb_bus *bus = pdev->bus; | ||
| 522 | |||
| 523 | if (bus->bustype == SSB_BUSTYPE_PCI) | ||
| 524 | ssb_pcicore_fix_sprom_core_index(pc); | ||
| 521 | 525 | ||
| 522 | /* Disable PCI interrupts. */ | 526 | /* Disable PCI interrupts. */ |
| 523 | ssb_write32(pc->dev, SSB_INTVEC, 0); | 527 | ssb_write32(pdev, SSB_INTVEC, 0); |
| 524 | 528 | ||
| 525 | /* Additional PCIe always once-executed workarounds */ | 529 | /* Additional PCIe always once-executed workarounds */ |
| 526 | if (pc->dev->id.coreid == SSB_DEV_PCIE) { | 530 | if (pc->dev->id.coreid == SSB_DEV_PCIE) { |
diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index fb2e89c3056c..5385da2e9cdb 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c | |||
| @@ -89,6 +89,7 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { | |||
| 89 | {USB_DEVICE(0x0DF6, 0x0045)}, | 89 | {USB_DEVICE(0x0DF6, 0x0045)}, |
| 90 | {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */ | 90 | {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */ |
| 91 | {USB_DEVICE(0x0DF6, 0x004B)}, | 91 | {USB_DEVICE(0x0DF6, 0x004B)}, |
| 92 | {USB_DEVICE(0x0DF6, 0x005D)}, | ||
| 92 | {USB_DEVICE(0x0DF6, 0x0063)}, | 93 | {USB_DEVICE(0x0DF6, 0x0063)}, |
| 93 | /* Sweex */ | 94 | /* Sweex */ |
| 94 | {USB_DEVICE(0x177F, 0x0154)}, | 95 | {USB_DEVICE(0x177F, 0x0154)}, |
diff --git a/drivers/staging/tidspbridge/core/dsp-clock.c b/drivers/staging/tidspbridge/core/dsp-clock.c index 3d1279c424a8..7eb56178fb64 100644 --- a/drivers/staging/tidspbridge/core/dsp-clock.c +++ b/drivers/staging/tidspbridge/core/dsp-clock.c | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | 54 | ||
| 55 | /* Bridge GPT id (1 - 4), DM Timer id (5 - 8) */ | 55 | /* Bridge GPT id (1 - 4), DM Timer id (5 - 8) */ |
| 56 | #define DMT_ID(id) ((id) + 4) | 56 | #define DMT_ID(id) ((id) + 4) |
| 57 | #define DM_TIMER_CLOCKS 4 | ||
| 57 | 58 | ||
| 58 | /* Bridge MCBSP id (6 - 10), OMAP Mcbsp id (0 - 4) */ | 59 | /* Bridge MCBSP id (6 - 10), OMAP Mcbsp id (0 - 4) */ |
| 59 | #define MCBSP_ID(id) ((id) - 6) | 60 | #define MCBSP_ID(id) ((id) - 6) |
| @@ -114,8 +115,13 @@ static s8 get_clk_type(u8 id) | |||
| 114 | */ | 115 | */ |
| 115 | void dsp_clk_exit(void) | 116 | void dsp_clk_exit(void) |
| 116 | { | 117 | { |
| 118 | int i; | ||
| 119 | |||
| 117 | dsp_clock_disable_all(dsp_clocks); | 120 | dsp_clock_disable_all(dsp_clocks); |
| 118 | 121 | ||
| 122 | for (i = 0; i < DM_TIMER_CLOCKS; i++) | ||
| 123 | omap_dm_timer_free(timer[i]); | ||
| 124 | |||
| 119 | clk_put(iva2_clk); | 125 | clk_put(iva2_clk); |
| 120 | clk_put(ssi.sst_fck); | 126 | clk_put(ssi.sst_fck); |
| 121 | clk_put(ssi.ssr_fck); | 127 | clk_put(ssi.ssr_fck); |
| @@ -130,9 +136,13 @@ void dsp_clk_exit(void) | |||
| 130 | void dsp_clk_init(void) | 136 | void dsp_clk_init(void) |
| 131 | { | 137 | { |
| 132 | static struct platform_device dspbridge_device; | 138 | static struct platform_device dspbridge_device; |
| 139 | int i, id; | ||
| 133 | 140 | ||
| 134 | dspbridge_device.dev.bus = &platform_bus_type; | 141 | dspbridge_device.dev.bus = &platform_bus_type; |
| 135 | 142 | ||
| 143 | for (i = 0, id = 5; i < DM_TIMER_CLOCKS; i++, id++) | ||
| 144 | timer[i] = omap_dm_timer_request_specific(id); | ||
| 145 | |||
| 136 | iva2_clk = clk_get(&dspbridge_device.dev, "iva2_ck"); | 146 | iva2_clk = clk_get(&dspbridge_device.dev, "iva2_ck"); |
| 137 | if (IS_ERR(iva2_clk)) | 147 | if (IS_ERR(iva2_clk)) |
| 138 | dev_err(bridge, "failed to get iva2 clock %p\n", iva2_clk); | 148 | dev_err(bridge, "failed to get iva2 clock %p\n", iva2_clk); |
| @@ -204,8 +214,7 @@ int dsp_clk_enable(enum dsp_clk_id clk_id) | |||
| 204 | clk_enable(iva2_clk); | 214 | clk_enable(iva2_clk); |
| 205 | break; | 215 | break; |
| 206 | case GPT_CLK: | 216 | case GPT_CLK: |
| 207 | timer[clk_id - 1] = | 217 | status = omap_dm_timer_start(timer[clk_id - 1]); |
| 208 | omap_dm_timer_request_specific(DMT_ID(clk_id)); | ||
| 209 | break; | 218 | break; |
| 210 | #ifdef CONFIG_OMAP_MCBSP | 219 | #ifdef CONFIG_OMAP_MCBSP |
| 211 | case MCBSP_CLK: | 220 | case MCBSP_CLK: |
| @@ -281,7 +290,7 @@ int dsp_clk_disable(enum dsp_clk_id clk_id) | |||
| 281 | clk_disable(iva2_clk); | 290 | clk_disable(iva2_clk); |
| 282 | break; | 291 | break; |
| 283 | case GPT_CLK: | 292 | case GPT_CLK: |
| 284 | omap_dm_timer_free(timer[clk_id - 1]); | 293 | status = omap_dm_timer_stop(timer[clk_id - 1]); |
| 285 | break; | 294 | break; |
| 286 | #ifdef CONFIG_OMAP_MCBSP | 295 | #ifdef CONFIG_OMAP_MCBSP |
| 287 | case MCBSP_CLK: | 296 | case MCBSP_CLK: |
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c index c43c7e3421c8..76cfc6edecd9 100644 --- a/drivers/staging/tidspbridge/rmgr/drv_interface.c +++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c | |||
| @@ -24,11 +24,7 @@ | |||
| 24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
| 25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
| 26 | #include <linux/pm.h> | 26 | #include <linux/pm.h> |
| 27 | |||
| 28 | #ifdef MODULE | ||
| 29 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 30 | #endif | ||
| 31 | |||
| 32 | #include <linux/device.h> | 28 | #include <linux/device.h> |
| 33 | #include <linux/init.h> | 29 | #include <linux/init.h> |
| 34 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 0fd96c10271d..8599545cdf9e 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
| @@ -614,13 +614,12 @@ int iscsit_add_reject( | |||
| 614 | hdr = (struct iscsi_reject *) cmd->pdu; | 614 | hdr = (struct iscsi_reject *) cmd->pdu; |
| 615 | hdr->reason = reason; | 615 | hdr->reason = reason; |
| 616 | 616 | ||
| 617 | cmd->buf_ptr = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL); | 617 | cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); |
| 618 | if (!cmd->buf_ptr) { | 618 | if (!cmd->buf_ptr) { |
| 619 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); | 619 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); |
| 620 | iscsit_release_cmd(cmd); | 620 | iscsit_release_cmd(cmd); |
| 621 | return -1; | 621 | return -1; |
| 622 | } | 622 | } |
| 623 | memcpy(cmd->buf_ptr, buf, ISCSI_HDR_LEN); | ||
| 624 | 623 | ||
| 625 | spin_lock_bh(&conn->cmd_lock); | 624 | spin_lock_bh(&conn->cmd_lock); |
| 626 | list_add_tail(&cmd->i_list, &conn->conn_cmd_list); | 625 | list_add_tail(&cmd->i_list, &conn->conn_cmd_list); |
| @@ -661,13 +660,12 @@ int iscsit_add_reject_from_cmd( | |||
| 661 | hdr = (struct iscsi_reject *) cmd->pdu; | 660 | hdr = (struct iscsi_reject *) cmd->pdu; |
| 662 | hdr->reason = reason; | 661 | hdr->reason = reason; |
| 663 | 662 | ||
| 664 | cmd->buf_ptr = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL); | 663 | cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); |
| 665 | if (!cmd->buf_ptr) { | 664 | if (!cmd->buf_ptr) { |
| 666 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); | 665 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); |
| 667 | iscsit_release_cmd(cmd); | 666 | iscsit_release_cmd(cmd); |
| 668 | return -1; | 667 | return -1; |
| 669 | } | 668 | } |
| 670 | memcpy(cmd->buf_ptr, buf, ISCSI_HDR_LEN); | ||
| 671 | 669 | ||
| 672 | if (add_to_conn) { | 670 | if (add_to_conn) { |
| 673 | spin_lock_bh(&conn->cmd_lock); | 671 | spin_lock_bh(&conn->cmd_lock); |
| @@ -1017,11 +1015,6 @@ done: | |||
| 1017 | " non-existent or non-exported iSCSI LUN:" | 1015 | " non-existent or non-exported iSCSI LUN:" |
| 1018 | " 0x%016Lx\n", get_unaligned_le64(&hdr->lun)); | 1016 | " 0x%016Lx\n", get_unaligned_le64(&hdr->lun)); |
| 1019 | } | 1017 | } |
| 1020 | if (ret == PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES) | ||
| 1021 | return iscsit_add_reject_from_cmd( | ||
| 1022 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, | ||
| 1023 | 1, 1, buf, cmd); | ||
| 1024 | |||
| 1025 | send_check_condition = 1; | 1018 | send_check_condition = 1; |
| 1026 | goto attach_cmd; | 1019 | goto attach_cmd; |
| 1027 | } | 1020 | } |
| @@ -1044,6 +1037,8 @@ done: | |||
| 1044 | */ | 1037 | */ |
| 1045 | send_check_condition = 1; | 1038 | send_check_condition = 1; |
| 1046 | } else { | 1039 | } else { |
| 1040 | cmd->data_length = cmd->se_cmd.data_length; | ||
| 1041 | |||
| 1047 | if (iscsit_decide_list_to_build(cmd, payload_length) < 0) | 1042 | if (iscsit_decide_list_to_build(cmd, payload_length) < 0) |
| 1048 | return iscsit_add_reject_from_cmd( | 1043 | return iscsit_add_reject_from_cmd( |
| 1049 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, | 1044 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, |
| @@ -1123,7 +1118,7 @@ attach_cmd: | |||
| 1123 | * the backend memory allocation. | 1118 | * the backend memory allocation. |
| 1124 | */ | 1119 | */ |
| 1125 | ret = transport_generic_new_cmd(&cmd->se_cmd); | 1120 | ret = transport_generic_new_cmd(&cmd->se_cmd); |
| 1126 | if ((ret < 0) || (cmd->se_cmd.se_cmd_flags & SCF_SE_CMD_FAILED)) { | 1121 | if (ret < 0) { |
| 1127 | immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION; | 1122 | immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION; |
| 1128 | dump_immediate_data = 1; | 1123 | dump_immediate_data = 1; |
| 1129 | goto after_immediate_data; | 1124 | goto after_immediate_data; |
| @@ -1341,7 +1336,7 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf) | |||
| 1341 | 1336 | ||
| 1342 | spin_lock_irqsave(&se_cmd->t_state_lock, flags); | 1337 | spin_lock_irqsave(&se_cmd->t_state_lock, flags); |
| 1343 | if (!(se_cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) || | 1338 | if (!(se_cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) || |
| 1344 | (se_cmd->se_cmd_flags & SCF_SE_CMD_FAILED)) | 1339 | (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION)) |
| 1345 | dump_unsolicited_data = 1; | 1340 | dump_unsolicited_data = 1; |
| 1346 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); | 1341 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); |
| 1347 | 1342 | ||
| @@ -2513,10 +2508,10 @@ static int iscsit_send_data_in( | |||
| 2513 | if (hdr->flags & ISCSI_FLAG_DATA_STATUS) { | 2508 | if (hdr->flags & ISCSI_FLAG_DATA_STATUS) { |
| 2514 | if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { | 2509 | if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { |
| 2515 | hdr->flags |= ISCSI_FLAG_DATA_OVERFLOW; | 2510 | hdr->flags |= ISCSI_FLAG_DATA_OVERFLOW; |
| 2516 | hdr->residual_count = cpu_to_be32(cmd->residual_count); | 2511 | hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); |
| 2517 | } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { | 2512 | } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { |
| 2518 | hdr->flags |= ISCSI_FLAG_DATA_UNDERFLOW; | 2513 | hdr->flags |= ISCSI_FLAG_DATA_UNDERFLOW; |
| 2519 | hdr->residual_count = cpu_to_be32(cmd->residual_count); | 2514 | hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); |
| 2520 | } | 2515 | } |
| 2521 | } | 2516 | } |
| 2522 | hton24(hdr->dlength, datain.length); | 2517 | hton24(hdr->dlength, datain.length); |
| @@ -3018,10 +3013,10 @@ static int iscsit_send_status( | |||
| 3018 | hdr->flags |= ISCSI_FLAG_CMD_FINAL; | 3013 | hdr->flags |= ISCSI_FLAG_CMD_FINAL; |
| 3019 | if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { | 3014 | if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { |
| 3020 | hdr->flags |= ISCSI_FLAG_CMD_OVERFLOW; | 3015 | hdr->flags |= ISCSI_FLAG_CMD_OVERFLOW; |
| 3021 | hdr->residual_count = cpu_to_be32(cmd->residual_count); | 3016 | hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); |
| 3022 | } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { | 3017 | } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { |
| 3023 | hdr->flags |= ISCSI_FLAG_CMD_UNDERFLOW; | 3018 | hdr->flags |= ISCSI_FLAG_CMD_UNDERFLOW; |
| 3024 | hdr->residual_count = cpu_to_be32(cmd->residual_count); | 3019 | hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); |
| 3025 | } | 3020 | } |
| 3026 | hdr->response = cmd->iscsi_response; | 3021 | hdr->response = cmd->iscsi_response; |
| 3027 | hdr->cmd_status = cmd->se_cmd.scsi_status; | 3022 | hdr->cmd_status = cmd->se_cmd.scsi_status; |
| @@ -3133,6 +3128,7 @@ static int iscsit_send_task_mgt_rsp( | |||
| 3133 | hdr = (struct iscsi_tm_rsp *) cmd->pdu; | 3128 | hdr = (struct iscsi_tm_rsp *) cmd->pdu; |
| 3134 | memset(hdr, 0, ISCSI_HDR_LEN); | 3129 | memset(hdr, 0, ISCSI_HDR_LEN); |
| 3135 | hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP; | 3130 | hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP; |
| 3131 | hdr->flags = ISCSI_FLAG_CMD_FINAL; | ||
| 3136 | hdr->response = iscsit_convert_tcm_tmr_rsp(se_tmr); | 3132 | hdr->response = iscsit_convert_tcm_tmr_rsp(se_tmr); |
| 3137 | hdr->itt = cpu_to_be32(cmd->init_task_tag); | 3133 | hdr->itt = cpu_to_be32(cmd->init_task_tag); |
| 3138 | cmd->stat_sn = conn->stat_sn++; | 3134 | cmd->stat_sn = conn->stat_sn++; |
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index beb39469e7f1..1cd6ce373b83 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
| @@ -30,9 +30,11 @@ | |||
| 30 | 30 | ||
| 31 | static int chap_string_to_hex(unsigned char *dst, unsigned char *src, int len) | 31 | static int chap_string_to_hex(unsigned char *dst, unsigned char *src, int len) |
| 32 | { | 32 | { |
| 33 | int j = DIV_ROUND_UP(len, 2); | 33 | int j = DIV_ROUND_UP(len, 2), rc; |
| 34 | 34 | ||
| 35 | hex2bin(dst, src, j); | 35 | rc = hex2bin(dst, src, j); |
| 36 | if (rc < 0) | ||
| 37 | pr_debug("CHAP string contains non hex digit symbols\n"); | ||
| 36 | 38 | ||
| 37 | dst[j] = '\0'; | 39 | dst[j] = '\0'; |
| 38 | return j; | 40 | return j; |
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index 3723d90d5ae5..f1a02dad05a0 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h | |||
| @@ -398,7 +398,6 @@ struct iscsi_cmd { | |||
| 398 | u32 pdu_send_order; | 398 | u32 pdu_send_order; |
| 399 | /* Current struct iscsi_pdu in struct iscsi_cmd->pdu_list */ | 399 | /* Current struct iscsi_pdu in struct iscsi_cmd->pdu_list */ |
| 400 | u32 pdu_start; | 400 | u32 pdu_start; |
| 401 | u32 residual_count; | ||
| 402 | /* Next struct iscsi_seq to send in struct iscsi_cmd->seq_list */ | 401 | /* Next struct iscsi_seq to send in struct iscsi_cmd->seq_list */ |
| 403 | u32 seq_send_order; | 402 | u32 seq_send_order; |
| 404 | /* Number of struct iscsi_seq in struct iscsi_cmd->seq_list */ | 403 | /* Number of struct iscsi_seq in struct iscsi_cmd->seq_list */ |
| @@ -535,7 +534,6 @@ struct iscsi_conn { | |||
| 535 | atomic_t connection_exit; | 534 | atomic_t connection_exit; |
| 536 | atomic_t connection_recovery; | 535 | atomic_t connection_recovery; |
| 537 | atomic_t connection_reinstatement; | 536 | atomic_t connection_reinstatement; |
| 538 | atomic_t connection_wait; | ||
| 539 | atomic_t connection_wait_rcfr; | 537 | atomic_t connection_wait_rcfr; |
| 540 | atomic_t sleep_on_conn_wait_comp; | 538 | atomic_t sleep_on_conn_wait_comp; |
| 541 | atomic_t transport_failed; | 539 | atomic_t transport_failed; |
| @@ -643,7 +641,6 @@ struct iscsi_session { | |||
| 643 | atomic_t session_reinstatement; | 641 | atomic_t session_reinstatement; |
| 644 | atomic_t session_stop_active; | 642 | atomic_t session_stop_active; |
| 645 | atomic_t sleep_on_sess_wait_comp; | 643 | atomic_t sleep_on_sess_wait_comp; |
| 646 | atomic_t transport_wait_cmds; | ||
| 647 | /* connection list */ | 644 | /* connection list */ |
| 648 | struct list_head sess_conn_list; | 645 | struct list_head sess_conn_list; |
| 649 | struct list_head cr_active_list; | 646 | struct list_head cr_active_list; |
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index c4c68da3e500..101b1beb3bca 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c | |||
| @@ -938,8 +938,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo) | |||
| 938 | * handle the SCF_SCSI_RESERVATION_CONFLICT case here as well. | 938 | * handle the SCF_SCSI_RESERVATION_CONFLICT case here as well. |
| 939 | */ | 939 | */ |
| 940 | if (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION) { | 940 | if (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION) { |
| 941 | if (se_cmd->se_cmd_flags & | 941 | if (se_cmd->scsi_sense_reason == TCM_RESERVATION_CONFLICT) { |
| 942 | SCF_SCSI_RESERVATION_CONFLICT) { | ||
| 943 | cmd->i_state = ISTATE_SEND_STATUS; | 942 | cmd->i_state = ISTATE_SEND_STATUS; |
| 944 | spin_unlock_bh(&cmd->istate_lock); | 943 | spin_unlock_bh(&cmd->istate_lock); |
| 945 | iscsit_add_cmd_to_response_queue(cmd, cmd->conn, | 944 | iscsit_add_cmd_to_response_queue(cmd, cmd->conn, |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index daad362a93ce..d734bdec24f9 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
| @@ -224,7 +224,7 @@ static int iscsi_login_zero_tsih_s1( | |||
| 224 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 224 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
| 225 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 225 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
| 226 | pr_err("Could not allocate memory for session\n"); | 226 | pr_err("Could not allocate memory for session\n"); |
| 227 | return -1; | 227 | return -ENOMEM; |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | iscsi_login_set_conn_values(sess, conn, pdu->cid); | 230 | iscsi_login_set_conn_values(sess, conn, pdu->cid); |
| @@ -250,7 +250,8 @@ static int iscsi_login_zero_tsih_s1( | |||
| 250 | pr_err("idr_pre_get() for sess_idr failed\n"); | 250 | pr_err("idr_pre_get() for sess_idr failed\n"); |
| 251 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 251 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
| 252 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 252 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
| 253 | return -1; | 253 | kfree(sess); |
| 254 | return -ENOMEM; | ||
| 254 | } | 255 | } |
| 255 | spin_lock(&sess_idr_lock); | 256 | spin_lock(&sess_idr_lock); |
| 256 | idr_get_new(&sess_idr, NULL, &sess->session_index); | 257 | idr_get_new(&sess_idr, NULL, &sess->session_index); |
| @@ -270,14 +271,16 @@ static int iscsi_login_zero_tsih_s1( | |||
| 270 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 271 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
| 271 | pr_err("Unable to allocate memory for" | 272 | pr_err("Unable to allocate memory for" |
| 272 | " struct iscsi_sess_ops.\n"); | 273 | " struct iscsi_sess_ops.\n"); |
| 273 | return -1; | 274 | kfree(sess); |
| 275 | return -ENOMEM; | ||
| 274 | } | 276 | } |
| 275 | 277 | ||
| 276 | sess->se_sess = transport_init_session(); | 278 | sess->se_sess = transport_init_session(); |
| 277 | if (!sess->se_sess) { | 279 | if (IS_ERR(sess->se_sess)) { |
| 278 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 280 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
| 279 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 281 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
| 280 | return -1; | 282 | kfree(sess); |
| 283 | return -ENOMEM; | ||
| 281 | } | 284 | } |
| 282 | 285 | ||
| 283 | return 0; | 286 | return 0; |
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 426cd4bf6a9a..98936cb7c294 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c | |||
| @@ -981,14 +981,13 @@ struct iscsi_login *iscsi_target_init_negotiation( | |||
| 981 | return NULL; | 981 | return NULL; |
| 982 | } | 982 | } |
| 983 | 983 | ||
| 984 | login->req = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL); | 984 | login->req = kmemdup(login_pdu, ISCSI_HDR_LEN, GFP_KERNEL); |
| 985 | if (!login->req) { | 985 | if (!login->req) { |
| 986 | pr_err("Unable to allocate memory for Login Request.\n"); | 986 | pr_err("Unable to allocate memory for Login Request.\n"); |
| 987 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 987 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
| 988 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 988 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
| 989 | goto out; | 989 | goto out; |
| 990 | } | 990 | } |
| 991 | memcpy(login->req, login_pdu, ISCSI_HDR_LEN); | ||
| 992 | 991 | ||
| 993 | login->req_buf = kzalloc(MAX_KEY_VALUE_PAIRS, GFP_KERNEL); | 992 | login->req_buf = kzalloc(MAX_KEY_VALUE_PAIRS, GFP_KERNEL); |
| 994 | if (!login->req_buf) { | 993 | if (!login->req_buf) { |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 3df1c9b8ae6b..81d5832fbbd5 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
| @@ -113,11 +113,9 @@ static struct se_cmd *tcm_loop_allocate_core_cmd( | |||
| 113 | scsi_bufflen(sc), sc->sc_data_direction, sam_task_attr, | 113 | scsi_bufflen(sc), sc->sc_data_direction, sam_task_attr, |
| 114 | &tl_cmd->tl_sense_buf[0]); | 114 | &tl_cmd->tl_sense_buf[0]); |
| 115 | 115 | ||
| 116 | /* | ||
| 117 | * Signal BIDI usage with T_TASK(cmd)->t_tasks_bidi | ||
| 118 | */ | ||
| 119 | if (scsi_bidi_cmnd(sc)) | 116 | if (scsi_bidi_cmnd(sc)) |
| 120 | se_cmd->t_tasks_bidi = 1; | 117 | se_cmd->se_cmd_flags |= SCF_BIDI; |
| 118 | |||
| 121 | /* | 119 | /* |
| 122 | * Locate the struct se_lun pointer and attach it to struct se_cmd | 120 | * Locate the struct se_lun pointer and attach it to struct se_cmd |
| 123 | */ | 121 | */ |
| @@ -148,27 +146,13 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd) | |||
| 148 | * Allocate the necessary tasks to complete the received CDB+data | 146 | * Allocate the necessary tasks to complete the received CDB+data |
| 149 | */ | 147 | */ |
| 150 | ret = transport_generic_allocate_tasks(se_cmd, sc->cmnd); | 148 | ret = transport_generic_allocate_tasks(se_cmd, sc->cmnd); |
| 151 | if (ret == -ENOMEM) { | 149 | if (ret != 0) |
| 152 | /* Out of Resources */ | 150 | return ret; |
| 153 | return PYX_TRANSPORT_LU_COMM_FAILURE; | ||
| 154 | } else if (ret == -EINVAL) { | ||
| 155 | /* | ||
| 156 | * Handle case for SAM_STAT_RESERVATION_CONFLICT | ||
| 157 | */ | ||
| 158 | if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT) | ||
| 159 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | ||
| 160 | /* | ||
| 161 | * Otherwise, return SAM_STAT_CHECK_CONDITION and return | ||
| 162 | * sense data. | ||
| 163 | */ | ||
| 164 | return PYX_TRANSPORT_USE_SENSE_REASON; | ||
| 165 | } | ||
| 166 | |||
| 167 | /* | 151 | /* |
| 168 | * For BIDI commands, pass in the extra READ buffer | 152 | * For BIDI commands, pass in the extra READ buffer |
| 169 | * to transport_generic_map_mem_to_cmd() below.. | 153 | * to transport_generic_map_mem_to_cmd() below.. |
| 170 | */ | 154 | */ |
| 171 | if (se_cmd->t_tasks_bidi) { | 155 | if (se_cmd->se_cmd_flags & SCF_BIDI) { |
| 172 | struct scsi_data_buffer *sdb = scsi_in(sc); | 156 | struct scsi_data_buffer *sdb = scsi_in(sc); |
| 173 | 157 | ||
| 174 | sgl_bidi = sdb->table.sgl; | 158 | sgl_bidi = sdb->table.sgl; |
| @@ -194,12 +178,8 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd) | |||
| 194 | } | 178 | } |
| 195 | 179 | ||
| 196 | /* Tell the core about our preallocated memory */ | 180 | /* Tell the core about our preallocated memory */ |
| 197 | ret = transport_generic_map_mem_to_cmd(se_cmd, scsi_sglist(sc), | 181 | return transport_generic_map_mem_to_cmd(se_cmd, scsi_sglist(sc), |
| 198 | scsi_sg_count(sc), sgl_bidi, sgl_bidi_count); | 182 | scsi_sg_count(sc), sgl_bidi, sgl_bidi_count); |
| 199 | if (ret < 0) | ||
| 200 | return PYX_TRANSPORT_LU_COMM_FAILURE; | ||
| 201 | |||
| 202 | return 0; | ||
| 203 | } | 183 | } |
| 204 | 184 | ||
| 205 | /* | 185 | /* |
| @@ -1360,17 +1340,16 @@ void tcm_loop_drop_scsi_hba( | |||
| 1360 | { | 1340 | { |
| 1361 | struct tcm_loop_hba *tl_hba = container_of(wwn, | 1341 | struct tcm_loop_hba *tl_hba = container_of(wwn, |
| 1362 | struct tcm_loop_hba, tl_hba_wwn); | 1342 | struct tcm_loop_hba, tl_hba_wwn); |
| 1363 | int host_no = tl_hba->sh->host_no; | 1343 | |
| 1344 | pr_debug("TCM_Loop_ConfigFS: Deallocating emulated Target" | ||
| 1345 | " SAS Address: %s at Linux/SCSI Host ID: %d\n", | ||
| 1346 | tl_hba->tl_wwn_address, tl_hba->sh->host_no); | ||
| 1364 | /* | 1347 | /* |
| 1365 | * Call device_unregister() on the original tl_hba->dev. | 1348 | * Call device_unregister() on the original tl_hba->dev. |
| 1366 | * tcm_loop_fabric_scsi.c:tcm_loop_release_adapter() will | 1349 | * tcm_loop_fabric_scsi.c:tcm_loop_release_adapter() will |
| 1367 | * release *tl_hba; | 1350 | * release *tl_hba; |
| 1368 | */ | 1351 | */ |
| 1369 | device_unregister(&tl_hba->dev); | 1352 | device_unregister(&tl_hba->dev); |
| 1370 | |||
| 1371 | pr_debug("TCM_Loop_ConfigFS: Deallocated emulated Target" | ||
| 1372 | " SAS Address: %s at Linux/SCSI Host ID: %d\n", | ||
| 1373 | config_item_name(&wwn->wwn_group.cg_item), host_no); | ||
| 1374 | } | 1353 | } |
| 1375 | 1354 | ||
| 1376 | /* Start items for tcm_loop_cit */ | 1355 | /* Start items for tcm_loop_cit */ |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 88f2ad43ec8b..1dcbef499d6a 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
| @@ -191,9 +191,10 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
| 191 | int alua_access_state, primary = 0, rc; | 191 | int alua_access_state, primary = 0, rc; |
| 192 | u16 tg_pt_id, rtpi; | 192 | u16 tg_pt_id, rtpi; |
| 193 | 193 | ||
| 194 | if (!l_port) | 194 | if (!l_port) { |
| 195 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 195 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 196 | 196 | return -EINVAL; | |
| 197 | } | ||
| 197 | buf = transport_kmap_first_data_page(cmd); | 198 | buf = transport_kmap_first_data_page(cmd); |
| 198 | 199 | ||
| 199 | /* | 200 | /* |
| @@ -203,7 +204,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
| 203 | l_tg_pt_gp_mem = l_port->sep_alua_tg_pt_gp_mem; | 204 | l_tg_pt_gp_mem = l_port->sep_alua_tg_pt_gp_mem; |
| 204 | if (!l_tg_pt_gp_mem) { | 205 | if (!l_tg_pt_gp_mem) { |
| 205 | pr_err("Unable to access l_port->sep_alua_tg_pt_gp_mem\n"); | 206 | pr_err("Unable to access l_port->sep_alua_tg_pt_gp_mem\n"); |
| 206 | rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 207 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
| 208 | rc = -EINVAL; | ||
| 207 | goto out; | 209 | goto out; |
| 208 | } | 210 | } |
| 209 | spin_lock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); | 211 | spin_lock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); |
| @@ -211,7 +213,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
| 211 | if (!l_tg_pt_gp) { | 213 | if (!l_tg_pt_gp) { |
| 212 | spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); | 214 | spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); |
| 213 | pr_err("Unable to access *l_tg_pt_gp_mem->tg_pt_gp\n"); | 215 | pr_err("Unable to access *l_tg_pt_gp_mem->tg_pt_gp\n"); |
| 214 | rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 216 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
| 217 | rc = -EINVAL; | ||
| 215 | goto out; | 218 | goto out; |
| 216 | } | 219 | } |
| 217 | rc = (l_tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICT_ALUA); | 220 | rc = (l_tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICT_ALUA); |
| @@ -220,7 +223,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
| 220 | if (!rc) { | 223 | if (!rc) { |
| 221 | pr_debug("Unable to process SET_TARGET_PORT_GROUPS" | 224 | pr_debug("Unable to process SET_TARGET_PORT_GROUPS" |
| 222 | " while TPGS_EXPLICT_ALUA is disabled\n"); | 225 | " while TPGS_EXPLICT_ALUA is disabled\n"); |
| 223 | rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 226 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
| 227 | rc = -EINVAL; | ||
| 224 | goto out; | 228 | goto out; |
| 225 | } | 229 | } |
| 226 | 230 | ||
| @@ -245,7 +249,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
| 245 | * REQUEST, and the additional sense code set to INVALID | 249 | * REQUEST, and the additional sense code set to INVALID |
| 246 | * FIELD IN PARAMETER LIST. | 250 | * FIELD IN PARAMETER LIST. |
| 247 | */ | 251 | */ |
| 248 | rc = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 252 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 253 | rc = -EINVAL; | ||
| 249 | goto out; | 254 | goto out; |
| 250 | } | 255 | } |
| 251 | rc = -1; | 256 | rc = -1; |
| @@ -298,7 +303,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
| 298 | * throw an exception with ASCQ: INVALID_PARAMETER_LIST | 303 | * throw an exception with ASCQ: INVALID_PARAMETER_LIST |
| 299 | */ | 304 | */ |
| 300 | if (rc != 0) { | 305 | if (rc != 0) { |
| 301 | rc = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 306 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 307 | rc = -EINVAL; | ||
| 302 | goto out; | 308 | goto out; |
| 303 | } | 309 | } |
| 304 | } else { | 310 | } else { |
| @@ -335,7 +341,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
| 335 | * INVALID_PARAMETER_LIST | 341 | * INVALID_PARAMETER_LIST |
| 336 | */ | 342 | */ |
| 337 | if (rc != 0) { | 343 | if (rc != 0) { |
| 338 | rc = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 344 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 345 | rc = -EINVAL; | ||
| 339 | goto out; | 346 | goto out; |
| 340 | } | 347 | } |
| 341 | } | 348 | } |
| @@ -1184,7 +1191,6 @@ void core_alua_free_lu_gp(struct t10_alua_lu_gp *lu_gp) | |||
| 1184 | * struct t10_alua_lu_gp. | 1191 | * struct t10_alua_lu_gp. |
| 1185 | */ | 1192 | */ |
| 1186 | spin_lock(&lu_gps_lock); | 1193 | spin_lock(&lu_gps_lock); |
| 1187 | atomic_set(&lu_gp->lu_gp_shutdown, 1); | ||
| 1188 | list_del(&lu_gp->lu_gp_node); | 1194 | list_del(&lu_gp->lu_gp_node); |
| 1189 | alua_lu_gps_count--; | 1195 | alua_lu_gps_count--; |
| 1190 | spin_unlock(&lu_gps_lock); | 1196 | spin_unlock(&lu_gps_lock); |
| @@ -1438,7 +1444,6 @@ struct t10_alua_tg_pt_gp_member *core_alua_allocate_tg_pt_gp_mem( | |||
| 1438 | 1444 | ||
| 1439 | tg_pt_gp_mem->tg_pt = port; | 1445 | tg_pt_gp_mem->tg_pt = port; |
| 1440 | port->sep_alua_tg_pt_gp_mem = tg_pt_gp_mem; | 1446 | port->sep_alua_tg_pt_gp_mem = tg_pt_gp_mem; |
| 1441 | atomic_set(&port->sep_tg_pt_gp_active, 1); | ||
| 1442 | 1447 | ||
| 1443 | return tg_pt_gp_mem; | 1448 | return tg_pt_gp_mem; |
| 1444 | } | 1449 | } |
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 683ba02b8247..831468b3163d 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
| @@ -478,7 +478,7 @@ target_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) | |||
| 478 | if (cmd->data_length < 60) | 478 | if (cmd->data_length < 60) |
| 479 | return 0; | 479 | return 0; |
| 480 | 480 | ||
| 481 | buf[2] = 0x3c; | 481 | buf[3] = 0x3c; |
| 482 | /* Set HEADSUP, ORDSUP, SIMPSUP */ | 482 | /* Set HEADSUP, ORDSUP, SIMPSUP */ |
| 483 | buf[5] = 0x07; | 483 | buf[5] = 0x07; |
| 484 | 484 | ||
| @@ -703,6 +703,7 @@ int target_emulate_inquiry(struct se_task *task) | |||
| 703 | if (cmd->data_length < 4) { | 703 | if (cmd->data_length < 4) { |
| 704 | pr_err("SCSI Inquiry payload length: %u" | 704 | pr_err("SCSI Inquiry payload length: %u" |
| 705 | " too small for EVPD=1\n", cmd->data_length); | 705 | " too small for EVPD=1\n", cmd->data_length); |
| 706 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
| 706 | return -EINVAL; | 707 | return -EINVAL; |
| 707 | } | 708 | } |
| 708 | 709 | ||
| @@ -719,6 +720,7 @@ int target_emulate_inquiry(struct se_task *task) | |||
| 719 | } | 720 | } |
| 720 | 721 | ||
| 721 | pr_err("Unknown VPD Code: 0x%02x\n", cdb[2]); | 722 | pr_err("Unknown VPD Code: 0x%02x\n", cdb[2]); |
| 723 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; | ||
| 722 | ret = -EINVAL; | 724 | ret = -EINVAL; |
| 723 | 725 | ||
| 724 | out_unmap: | 726 | out_unmap: |
| @@ -969,7 +971,8 @@ int target_emulate_modesense(struct se_task *task) | |||
| 969 | default: | 971 | default: |
| 970 | pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", | 972 | pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", |
| 971 | cdb[2] & 0x3f, cdb[3]); | 973 | cdb[2] & 0x3f, cdb[3]); |
| 972 | return PYX_TRANSPORT_UNKNOWN_MODE_PAGE; | 974 | cmd->scsi_sense_reason = TCM_UNKNOWN_MODE_PAGE; |
| 975 | return -EINVAL; | ||
| 973 | } | 976 | } |
| 974 | offset += length; | 977 | offset += length; |
| 975 | 978 | ||
| @@ -1027,7 +1030,8 @@ int target_emulate_request_sense(struct se_task *task) | |||
| 1027 | if (cdb[1] & 0x01) { | 1030 | if (cdb[1] & 0x01) { |
| 1028 | pr_err("REQUEST_SENSE description emulation not" | 1031 | pr_err("REQUEST_SENSE description emulation not" |
| 1029 | " supported\n"); | 1032 | " supported\n"); |
| 1030 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 1033 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 1034 | return -ENOSYS; | ||
| 1031 | } | 1035 | } |
| 1032 | 1036 | ||
| 1033 | buf = transport_kmap_first_data_page(cmd); | 1037 | buf = transport_kmap_first_data_page(cmd); |
| @@ -1100,7 +1104,8 @@ int target_emulate_unmap(struct se_task *task) | |||
| 1100 | if (!dev->transport->do_discard) { | 1104 | if (!dev->transport->do_discard) { |
| 1101 | pr_err("UNMAP emulation not supported for: %s\n", | 1105 | pr_err("UNMAP emulation not supported for: %s\n", |
| 1102 | dev->transport->name); | 1106 | dev->transport->name); |
| 1103 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1107 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
| 1108 | return -ENOSYS; | ||
| 1104 | } | 1109 | } |
| 1105 | 1110 | ||
| 1106 | /* First UNMAP block descriptor starts at 8 byte offset */ | 1111 | /* First UNMAP block descriptor starts at 8 byte offset */ |
| @@ -1157,7 +1162,8 @@ int target_emulate_write_same(struct se_task *task) | |||
| 1157 | if (!dev->transport->do_discard) { | 1162 | if (!dev->transport->do_discard) { |
| 1158 | pr_err("WRITE_SAME emulation not supported" | 1163 | pr_err("WRITE_SAME emulation not supported" |
| 1159 | " for: %s\n", dev->transport->name); | 1164 | " for: %s\n", dev->transport->name); |
| 1160 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1165 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
| 1166 | return -ENOSYS; | ||
| 1161 | } | 1167 | } |
| 1162 | 1168 | ||
| 1163 | if (cmd->t_task_cdb[0] == WRITE_SAME) | 1169 | if (cmd->t_task_cdb[0] == WRITE_SAME) |
| @@ -1193,11 +1199,13 @@ int target_emulate_write_same(struct se_task *task) | |||
| 1193 | int target_emulate_synchronize_cache(struct se_task *task) | 1199 | int target_emulate_synchronize_cache(struct se_task *task) |
| 1194 | { | 1200 | { |
| 1195 | struct se_device *dev = task->task_se_cmd->se_dev; | 1201 | struct se_device *dev = task->task_se_cmd->se_dev; |
| 1202 | struct se_cmd *cmd = task->task_se_cmd; | ||
| 1196 | 1203 | ||
| 1197 | if (!dev->transport->do_sync_cache) { | 1204 | if (!dev->transport->do_sync_cache) { |
| 1198 | pr_err("SYNCHRONIZE_CACHE emulation not supported" | 1205 | pr_err("SYNCHRONIZE_CACHE emulation not supported" |
| 1199 | " for: %s\n", dev->transport->name); | 1206 | " for: %s\n", dev->transport->name); |
| 1200 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1207 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
| 1208 | return -ENOSYS; | ||
| 1201 | } | 1209 | } |
| 1202 | 1210 | ||
| 1203 | dev->transport->do_sync_cache(task); | 1211 | dev->transport->do_sync_cache(task); |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index e0c1e8a8dd4e..93d4f6a1b798 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
| @@ -67,9 +67,6 @@ static struct config_group target_core_hbagroup; | |||
| 67 | static struct config_group alua_group; | 67 | static struct config_group alua_group; |
| 68 | static struct config_group alua_lu_gps_group; | 68 | static struct config_group alua_lu_gps_group; |
| 69 | 69 | ||
| 70 | static DEFINE_SPINLOCK(se_device_lock); | ||
| 71 | static LIST_HEAD(se_dev_list); | ||
| 72 | |||
| 73 | static inline struct se_hba * | 70 | static inline struct se_hba * |
| 74 | item_to_hba(struct config_item *item) | 71 | item_to_hba(struct config_item *item) |
| 75 | { | 72 | { |
| @@ -2741,7 +2738,6 @@ static struct config_group *target_core_make_subdev( | |||
| 2741 | " struct se_subsystem_dev\n"); | 2738 | " struct se_subsystem_dev\n"); |
| 2742 | goto unlock; | 2739 | goto unlock; |
| 2743 | } | 2740 | } |
| 2744 | INIT_LIST_HEAD(&se_dev->se_dev_node); | ||
| 2745 | INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); | 2741 | INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); |
| 2746 | spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); | 2742 | spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); |
| 2747 | INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); | 2743 | INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); |
| @@ -2777,9 +2773,6 @@ static struct config_group *target_core_make_subdev( | |||
| 2777 | " from allocate_virtdevice()\n"); | 2773 | " from allocate_virtdevice()\n"); |
| 2778 | goto out; | 2774 | goto out; |
| 2779 | } | 2775 | } |
| 2780 | spin_lock(&se_device_lock); | ||
| 2781 | list_add_tail(&se_dev->se_dev_node, &se_dev_list); | ||
| 2782 | spin_unlock(&se_device_lock); | ||
| 2783 | 2776 | ||
| 2784 | config_group_init_type_name(&se_dev->se_dev_group, name, | 2777 | config_group_init_type_name(&se_dev->se_dev_group, name, |
| 2785 | &target_core_dev_cit); | 2778 | &target_core_dev_cit); |
| @@ -2874,10 +2867,6 @@ static void target_core_drop_subdev( | |||
| 2874 | mutex_lock(&hba->hba_access_mutex); | 2867 | mutex_lock(&hba->hba_access_mutex); |
| 2875 | t = hba->transport; | 2868 | t = hba->transport; |
| 2876 | 2869 | ||
| 2877 | spin_lock(&se_device_lock); | ||
| 2878 | list_del(&se_dev->se_dev_node); | ||
| 2879 | spin_unlock(&se_device_lock); | ||
| 2880 | |||
| 2881 | dev_stat_grp = &se_dev->dev_stat_grps.stat_group; | 2870 | dev_stat_grp = &se_dev->dev_stat_grps.stat_group; |
| 2882 | for (i = 0; dev_stat_grp->default_groups[i]; i++) { | 2871 | for (i = 0; dev_stat_grp->default_groups[i]; i++) { |
| 2883 | df_item = &dev_stat_grp->default_groups[i]->cg_item; | 2872 | df_item = &dev_stat_grp->default_groups[i]->cg_item; |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index ba5edec2c5f8..9b8639425472 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
| @@ -104,7 +104,6 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) | |||
| 104 | se_cmd->se_lun = deve->se_lun; | 104 | se_cmd->se_lun = deve->se_lun; |
| 105 | se_cmd->pr_res_key = deve->pr_res_key; | 105 | se_cmd->pr_res_key = deve->pr_res_key; |
| 106 | se_cmd->orig_fe_lun = unpacked_lun; | 106 | se_cmd->orig_fe_lun = unpacked_lun; |
| 107 | se_cmd->se_orig_obj_ptr = se_cmd->se_lun->lun_se_dev; | ||
| 108 | se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; | 107 | se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; |
| 109 | } | 108 | } |
| 110 | spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); | 109 | spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); |
| @@ -137,7 +136,6 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) | |||
| 137 | se_lun = &se_sess->se_tpg->tpg_virt_lun0; | 136 | se_lun = &se_sess->se_tpg->tpg_virt_lun0; |
| 138 | se_cmd->se_lun = &se_sess->se_tpg->tpg_virt_lun0; | 137 | se_cmd->se_lun = &se_sess->se_tpg->tpg_virt_lun0; |
| 139 | se_cmd->orig_fe_lun = 0; | 138 | se_cmd->orig_fe_lun = 0; |
| 140 | se_cmd->se_orig_obj_ptr = se_cmd->se_lun->lun_se_dev; | ||
| 141 | se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; | 139 | se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; |
| 142 | } | 140 | } |
| 143 | /* | 141 | /* |
| @@ -200,7 +198,6 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun) | |||
| 200 | se_lun = deve->se_lun; | 198 | se_lun = deve->se_lun; |
| 201 | se_cmd->pr_res_key = deve->pr_res_key; | 199 | se_cmd->pr_res_key = deve->pr_res_key; |
| 202 | se_cmd->orig_fe_lun = unpacked_lun; | 200 | se_cmd->orig_fe_lun = unpacked_lun; |
| 203 | se_cmd->se_orig_obj_ptr = se_cmd->se_dev; | ||
| 204 | } | 201 | } |
| 205 | spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); | 202 | spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); |
| 206 | 203 | ||
| @@ -708,7 +705,7 @@ done: | |||
| 708 | 705 | ||
| 709 | se_task->task_scsi_status = GOOD; | 706 | se_task->task_scsi_status = GOOD; |
| 710 | transport_complete_task(se_task, 1); | 707 | transport_complete_task(se_task, 1); |
| 711 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 708 | return 0; |
| 712 | } | 709 | } |
| 713 | 710 | ||
| 714 | /* se_release_device_for_hba(): | 711 | /* se_release_device_for_hba(): |
| @@ -957,8 +954,12 @@ int se_dev_set_emulate_dpo(struct se_device *dev, int flag) | |||
| 957 | return -EINVAL; | 954 | return -EINVAL; |
| 958 | } | 955 | } |
| 959 | 956 | ||
| 960 | pr_err("dpo_emulated not supported\n"); | 957 | if (flag) { |
| 961 | return -EINVAL; | 958 | pr_err("dpo_emulated not supported\n"); |
| 959 | return -EINVAL; | ||
| 960 | } | ||
| 961 | |||
| 962 | return 0; | ||
| 962 | } | 963 | } |
| 963 | 964 | ||
| 964 | int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) | 965 | int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) |
| @@ -968,7 +969,7 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) | |||
| 968 | return -EINVAL; | 969 | return -EINVAL; |
| 969 | } | 970 | } |
| 970 | 971 | ||
| 971 | if (dev->transport->fua_write_emulated == 0) { | 972 | if (flag && dev->transport->fua_write_emulated == 0) { |
| 972 | pr_err("fua_write_emulated not supported\n"); | 973 | pr_err("fua_write_emulated not supported\n"); |
| 973 | return -EINVAL; | 974 | return -EINVAL; |
| 974 | } | 975 | } |
| @@ -985,8 +986,12 @@ int se_dev_set_emulate_fua_read(struct se_device *dev, int flag) | |||
| 985 | return -EINVAL; | 986 | return -EINVAL; |
| 986 | } | 987 | } |
| 987 | 988 | ||
| 988 | pr_err("ua read emulated not supported\n"); | 989 | if (flag) { |
| 989 | return -EINVAL; | 990 | pr_err("ua read emulated not supported\n"); |
| 991 | return -EINVAL; | ||
| 992 | } | ||
| 993 | |||
| 994 | return 0; | ||
| 990 | } | 995 | } |
| 991 | 996 | ||
| 992 | int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) | 997 | int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) |
| @@ -995,7 +1000,7 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) | |||
| 995 | pr_err("Illegal value %d\n", flag); | 1000 | pr_err("Illegal value %d\n", flag); |
| 996 | return -EINVAL; | 1001 | return -EINVAL; |
| 997 | } | 1002 | } |
| 998 | if (dev->transport->write_cache_emulated == 0) { | 1003 | if (flag && dev->transport->write_cache_emulated == 0) { |
| 999 | pr_err("write_cache_emulated not supported\n"); | 1004 | pr_err("write_cache_emulated not supported\n"); |
| 1000 | return -EINVAL; | 1005 | return -EINVAL; |
| 1001 | } | 1006 | } |
| @@ -1056,7 +1061,7 @@ int se_dev_set_emulate_tpu(struct se_device *dev, int flag) | |||
| 1056 | * We expect this value to be non-zero when generic Block Layer | 1061 | * We expect this value to be non-zero when generic Block Layer |
| 1057 | * Discard supported is detected iblock_create_virtdevice(). | 1062 | * Discard supported is detected iblock_create_virtdevice(). |
| 1058 | */ | 1063 | */ |
| 1059 | if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { | 1064 | if (flag && !dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { |
| 1060 | pr_err("Generic Block Discard not supported\n"); | 1065 | pr_err("Generic Block Discard not supported\n"); |
| 1061 | return -ENOSYS; | 1066 | return -ENOSYS; |
| 1062 | } | 1067 | } |
| @@ -1077,7 +1082,7 @@ int se_dev_set_emulate_tpws(struct se_device *dev, int flag) | |||
| 1077 | * We expect this value to be non-zero when generic Block Layer | 1082 | * We expect this value to be non-zero when generic Block Layer |
| 1078 | * Discard supported is detected iblock_create_virtdevice(). | 1083 | * Discard supported is detected iblock_create_virtdevice(). |
| 1079 | */ | 1084 | */ |
| 1080 | if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { | 1085 | if (flag && !dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { |
| 1081 | pr_err("Generic Block Discard not supported\n"); | 1086 | pr_err("Generic Block Discard not supported\n"); |
| 1082 | return -ENOSYS; | 1087 | return -ENOSYS; |
| 1083 | } | 1088 | } |
| @@ -1587,7 +1592,6 @@ int core_dev_setup_virtual_lun0(void) | |||
| 1587 | ret = -ENOMEM; | 1592 | ret = -ENOMEM; |
| 1588 | goto out; | 1593 | goto out; |
| 1589 | } | 1594 | } |
| 1590 | INIT_LIST_HEAD(&se_dev->se_dev_node); | ||
| 1591 | INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); | 1595 | INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); |
| 1592 | spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); | 1596 | spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); |
| 1593 | INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); | 1597 | INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 67cd6fe05bfa..b4864fba4ef0 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
| @@ -289,9 +289,9 @@ static int fd_do_readv(struct se_task *task) | |||
| 289 | return -ENOMEM; | 289 | return -ENOMEM; |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | for (i = 0; i < task->task_sg_nents; i++) { | 292 | for_each_sg(task->task_sg, sg, task->task_sg_nents, i) { |
| 293 | iov[i].iov_len = sg[i].length; | 293 | iov[i].iov_len = sg->length; |
| 294 | iov[i].iov_base = sg_virt(&sg[i]); | 294 | iov[i].iov_base = sg_virt(sg); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | old_fs = get_fs(); | 297 | old_fs = get_fs(); |
| @@ -342,9 +342,9 @@ static int fd_do_writev(struct se_task *task) | |||
| 342 | return -ENOMEM; | 342 | return -ENOMEM; |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | for (i = 0; i < task->task_sg_nents; i++) { | 345 | for_each_sg(task->task_sg, sg, task->task_sg_nents, i) { |
| 346 | iov[i].iov_len = sg[i].length; | 346 | iov[i].iov_len = sg->length; |
| 347 | iov[i].iov_base = sg_virt(&sg[i]); | 347 | iov[i].iov_base = sg_virt(sg); |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | old_fs = get_fs(); | 350 | old_fs = get_fs(); |
| @@ -438,7 +438,7 @@ static int fd_do_task(struct se_task *task) | |||
| 438 | if (ret > 0 && | 438 | if (ret > 0 && |
| 439 | dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0 && | 439 | dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0 && |
| 440 | dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && | 440 | dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && |
| 441 | cmd->t_tasks_fua) { | 441 | (cmd->se_cmd_flags & SCF_FUA)) { |
| 442 | /* | 442 | /* |
| 443 | * We might need to be a bit smarter here | 443 | * We might need to be a bit smarter here |
| 444 | * and return some sense data to let the initiator | 444 | * and return some sense data to let the initiator |
| @@ -449,13 +449,15 @@ static int fd_do_task(struct se_task *task) | |||
| 449 | 449 | ||
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | if (ret < 0) | 452 | if (ret < 0) { |
| 453 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 453 | return ret; | 454 | return ret; |
| 455 | } | ||
| 454 | if (ret) { | 456 | if (ret) { |
| 455 | task->task_scsi_status = GOOD; | 457 | task->task_scsi_status = GOOD; |
| 456 | transport_complete_task(task, 1); | 458 | transport_complete_task(task, 1); |
| 457 | } | 459 | } |
| 458 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 460 | return 0; |
| 459 | } | 461 | } |
| 460 | 462 | ||
| 461 | /* fd_free_task(): (Part of se_subsystem_api_t template) | 463 | /* fd_free_task(): (Part of se_subsystem_api_t template) |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 7698efe29262..4aa992204438 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
| @@ -531,7 +531,7 @@ static int iblock_do_task(struct se_task *task) | |||
| 531 | */ | 531 | */ |
| 532 | if (dev->se_sub_dev->se_dev_attrib.emulate_write_cache == 0 || | 532 | if (dev->se_sub_dev->se_dev_attrib.emulate_write_cache == 0 || |
| 533 | (dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && | 533 | (dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && |
| 534 | task->task_se_cmd->t_tasks_fua)) | 534 | (cmd->se_cmd_flags & SCF_FUA))) |
| 535 | rw = WRITE_FUA; | 535 | rw = WRITE_FUA; |
| 536 | else | 536 | else |
| 537 | rw = WRITE; | 537 | rw = WRITE; |
| @@ -554,12 +554,15 @@ static int iblock_do_task(struct se_task *task) | |||
| 554 | else { | 554 | else { |
| 555 | pr_err("Unsupported SCSI -> BLOCK LBA conversion:" | 555 | pr_err("Unsupported SCSI -> BLOCK LBA conversion:" |
| 556 | " %u\n", dev->se_sub_dev->se_dev_attrib.block_size); | 556 | " %u\n", dev->se_sub_dev->se_dev_attrib.block_size); |
| 557 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 557 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 558 | return -ENOSYS; | ||
| 558 | } | 559 | } |
| 559 | 560 | ||
| 560 | bio = iblock_get_bio(task, block_lba, sg_num); | 561 | bio = iblock_get_bio(task, block_lba, sg_num); |
| 561 | if (!bio) | 562 | if (!bio) { |
| 562 | return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 563 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 564 | return -ENOMEM; | ||
| 565 | } | ||
| 563 | 566 | ||
| 564 | bio_list_init(&list); | 567 | bio_list_init(&list); |
| 565 | bio_list_add(&list, bio); | 568 | bio_list_add(&list, bio); |
| @@ -588,12 +591,13 @@ static int iblock_do_task(struct se_task *task) | |||
| 588 | submit_bio(rw, bio); | 591 | submit_bio(rw, bio); |
| 589 | blk_finish_plug(&plug); | 592 | blk_finish_plug(&plug); |
| 590 | 593 | ||
| 591 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 594 | return 0; |
| 592 | 595 | ||
| 593 | fail: | 596 | fail: |
| 594 | while ((bio = bio_list_pop(&list))) | 597 | while ((bio = bio_list_pop(&list))) |
| 595 | bio_put(bio); | 598 | bio_put(bio); |
| 596 | return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 599 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 600 | return -ENOMEM; | ||
| 597 | } | 601 | } |
| 598 | 602 | ||
| 599 | static u32 iblock_get_device_rev(struct se_device *dev) | 603 | static u32 iblock_get_device_rev(struct se_device *dev) |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 5a4ebfc3a54f..95dee7074aeb 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
| @@ -191,7 +191,7 @@ static int target_check_scsi2_reservation_conflict(struct se_cmd *cmd, int *ret) | |||
| 191 | pr_err("Received legacy SPC-2 RESERVE/RELEASE" | 191 | pr_err("Received legacy SPC-2 RESERVE/RELEASE" |
| 192 | " while active SPC-3 registrations exist," | 192 | " while active SPC-3 registrations exist," |
| 193 | " returning RESERVATION_CONFLICT\n"); | 193 | " returning RESERVATION_CONFLICT\n"); |
| 194 | *ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 194 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 195 | return true; | 195 | return true; |
| 196 | } | 196 | } |
| 197 | 197 | ||
| @@ -252,7 +252,8 @@ int target_scsi2_reservation_reserve(struct se_task *task) | |||
| 252 | (cmd->t_task_cdb[1] & 0x02)) { | 252 | (cmd->t_task_cdb[1] & 0x02)) { |
| 253 | pr_err("LongIO and Obselete Bits set, returning" | 253 | pr_err("LongIO and Obselete Bits set, returning" |
| 254 | " ILLEGAL_REQUEST\n"); | 254 | " ILLEGAL_REQUEST\n"); |
| 255 | ret = PYX_TRANSPORT_ILLEGAL_REQUEST; | 255 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
| 256 | ret = -EINVAL; | ||
| 256 | goto out; | 257 | goto out; |
| 257 | } | 258 | } |
| 258 | /* | 259 | /* |
| @@ -277,7 +278,8 @@ int target_scsi2_reservation_reserve(struct se_task *task) | |||
| 277 | " from %s \n", cmd->se_lun->unpacked_lun, | 278 | " from %s \n", cmd->se_lun->unpacked_lun, |
| 278 | cmd->se_deve->mapped_lun, | 279 | cmd->se_deve->mapped_lun, |
| 279 | sess->se_node_acl->initiatorname); | 280 | sess->se_node_acl->initiatorname); |
| 280 | ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 281 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 282 | ret = -EINVAL; | ||
| 281 | goto out_unlock; | 283 | goto out_unlock; |
| 282 | } | 284 | } |
| 283 | 285 | ||
| @@ -1510,7 +1512,8 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1510 | tidh_new = kzalloc(sizeof(struct pr_transport_id_holder), GFP_KERNEL); | 1512 | tidh_new = kzalloc(sizeof(struct pr_transport_id_holder), GFP_KERNEL); |
| 1511 | if (!tidh_new) { | 1513 | if (!tidh_new) { |
| 1512 | pr_err("Unable to allocate tidh_new\n"); | 1514 | pr_err("Unable to allocate tidh_new\n"); |
| 1513 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 1515 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 1516 | return -EINVAL; | ||
| 1514 | } | 1517 | } |
| 1515 | INIT_LIST_HEAD(&tidh_new->dest_list); | 1518 | INIT_LIST_HEAD(&tidh_new->dest_list); |
| 1516 | tidh_new->dest_tpg = tpg; | 1519 | tidh_new->dest_tpg = tpg; |
| @@ -1522,7 +1525,8 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1522 | sa_res_key, all_tg_pt, aptpl); | 1525 | sa_res_key, all_tg_pt, aptpl); |
| 1523 | if (!local_pr_reg) { | 1526 | if (!local_pr_reg) { |
| 1524 | kfree(tidh_new); | 1527 | kfree(tidh_new); |
| 1525 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 1528 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 1529 | return -ENOMEM; | ||
| 1526 | } | 1530 | } |
| 1527 | tidh_new->dest_pr_reg = local_pr_reg; | 1531 | tidh_new->dest_pr_reg = local_pr_reg; |
| 1528 | /* | 1532 | /* |
| @@ -1548,7 +1552,8 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1548 | pr_err("SPC-3 PR: Illegal tpdl: %u + 28 byte header" | 1552 | pr_err("SPC-3 PR: Illegal tpdl: %u + 28 byte header" |
| 1549 | " does not equal CDB data_length: %u\n", tpdl, | 1553 | " does not equal CDB data_length: %u\n", tpdl, |
| 1550 | cmd->data_length); | 1554 | cmd->data_length); |
| 1551 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1555 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 1556 | ret = -EINVAL; | ||
| 1552 | goto out; | 1557 | goto out; |
| 1553 | } | 1558 | } |
| 1554 | /* | 1559 | /* |
| @@ -1598,7 +1603,9 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1598 | " for tmp_tpg\n"); | 1603 | " for tmp_tpg\n"); |
| 1599 | atomic_dec(&tmp_tpg->tpg_pr_ref_count); | 1604 | atomic_dec(&tmp_tpg->tpg_pr_ref_count); |
| 1600 | smp_mb__after_atomic_dec(); | 1605 | smp_mb__after_atomic_dec(); |
| 1601 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 1606 | cmd->scsi_sense_reason = |
| 1607 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 1608 | ret = -EINVAL; | ||
| 1602 | goto out; | 1609 | goto out; |
| 1603 | } | 1610 | } |
| 1604 | /* | 1611 | /* |
| @@ -1628,7 +1635,9 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1628 | atomic_dec(&dest_node_acl->acl_pr_ref_count); | 1635 | atomic_dec(&dest_node_acl->acl_pr_ref_count); |
| 1629 | smp_mb__after_atomic_dec(); | 1636 | smp_mb__after_atomic_dec(); |
| 1630 | core_scsi3_tpg_undepend_item(tmp_tpg); | 1637 | core_scsi3_tpg_undepend_item(tmp_tpg); |
| 1631 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 1638 | cmd->scsi_sense_reason = |
| 1639 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 1640 | ret = -EINVAL; | ||
| 1632 | goto out; | 1641 | goto out; |
| 1633 | } | 1642 | } |
| 1634 | 1643 | ||
| @@ -1646,7 +1655,8 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1646 | if (!dest_tpg) { | 1655 | if (!dest_tpg) { |
| 1647 | pr_err("SPC-3 PR SPEC_I_PT: Unable to locate" | 1656 | pr_err("SPC-3 PR SPEC_I_PT: Unable to locate" |
| 1648 | " dest_tpg\n"); | 1657 | " dest_tpg\n"); |
| 1649 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1658 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 1659 | ret = -EINVAL; | ||
| 1650 | goto out; | 1660 | goto out; |
| 1651 | } | 1661 | } |
| 1652 | #if 0 | 1662 | #if 0 |
| @@ -1660,7 +1670,8 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1660 | " %u for Transport ID: %s\n", tid_len, ptr); | 1670 | " %u for Transport ID: %s\n", tid_len, ptr); |
| 1661 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1671 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
| 1662 | core_scsi3_tpg_undepend_item(dest_tpg); | 1672 | core_scsi3_tpg_undepend_item(dest_tpg); |
| 1663 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1673 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 1674 | ret = -EINVAL; | ||
| 1664 | goto out; | 1675 | goto out; |
| 1665 | } | 1676 | } |
| 1666 | /* | 1677 | /* |
| @@ -1678,7 +1689,8 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1678 | 1689 | ||
| 1679 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1690 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
| 1680 | core_scsi3_tpg_undepend_item(dest_tpg); | 1691 | core_scsi3_tpg_undepend_item(dest_tpg); |
| 1681 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1692 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 1693 | ret = -EINVAL; | ||
| 1682 | goto out; | 1694 | goto out; |
| 1683 | } | 1695 | } |
| 1684 | 1696 | ||
| @@ -1690,7 +1702,9 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1690 | smp_mb__after_atomic_dec(); | 1702 | smp_mb__after_atomic_dec(); |
| 1691 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1703 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
| 1692 | core_scsi3_tpg_undepend_item(dest_tpg); | 1704 | core_scsi3_tpg_undepend_item(dest_tpg); |
| 1693 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 1705 | cmd->scsi_sense_reason = |
| 1706 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 1707 | ret = -EINVAL; | ||
| 1694 | goto out; | 1708 | goto out; |
| 1695 | } | 1709 | } |
| 1696 | #if 0 | 1710 | #if 0 |
| @@ -1727,7 +1741,9 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1727 | core_scsi3_lunacl_undepend_item(dest_se_deve); | 1741 | core_scsi3_lunacl_undepend_item(dest_se_deve); |
| 1728 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1742 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
| 1729 | core_scsi3_tpg_undepend_item(dest_tpg); | 1743 | core_scsi3_tpg_undepend_item(dest_tpg); |
| 1730 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 1744 | cmd->scsi_sense_reason = |
| 1745 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 1746 | ret = -ENOMEM; | ||
| 1731 | goto out; | 1747 | goto out; |
| 1732 | } | 1748 | } |
| 1733 | INIT_LIST_HEAD(&tidh_new->dest_list); | 1749 | INIT_LIST_HEAD(&tidh_new->dest_list); |
| @@ -1759,7 +1775,8 @@ static int core_scsi3_decode_spec_i_port( | |||
| 1759 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1775 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
| 1760 | core_scsi3_tpg_undepend_item(dest_tpg); | 1776 | core_scsi3_tpg_undepend_item(dest_tpg); |
| 1761 | kfree(tidh_new); | 1777 | kfree(tidh_new); |
| 1762 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1778 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 1779 | ret = -EINVAL; | ||
| 1763 | goto out; | 1780 | goto out; |
| 1764 | } | 1781 | } |
| 1765 | tidh_new->dest_pr_reg = dest_pr_reg; | 1782 | tidh_new->dest_pr_reg = dest_pr_reg; |
| @@ -2098,7 +2115,8 @@ static int core_scsi3_emulate_pro_register( | |||
| 2098 | 2115 | ||
| 2099 | if (!se_sess || !se_lun) { | 2116 | if (!se_sess || !se_lun) { |
| 2100 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); | 2117 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); |
| 2101 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2118 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 2119 | return -EINVAL; | ||
| 2102 | } | 2120 | } |
| 2103 | se_tpg = se_sess->se_tpg; | 2121 | se_tpg = se_sess->se_tpg; |
| 2104 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; | 2122 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; |
| @@ -2117,13 +2135,14 @@ static int core_scsi3_emulate_pro_register( | |||
| 2117 | if (res_key) { | 2135 | if (res_key) { |
| 2118 | pr_warn("SPC-3 PR: Reservation Key non-zero" | 2136 | pr_warn("SPC-3 PR: Reservation Key non-zero" |
| 2119 | " for SA REGISTER, returning CONFLICT\n"); | 2137 | " for SA REGISTER, returning CONFLICT\n"); |
| 2120 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2138 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 2139 | return -EINVAL; | ||
| 2121 | } | 2140 | } |
| 2122 | /* | 2141 | /* |
| 2123 | * Do nothing but return GOOD status. | 2142 | * Do nothing but return GOOD status. |
| 2124 | */ | 2143 | */ |
| 2125 | if (!sa_res_key) | 2144 | if (!sa_res_key) |
| 2126 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 2145 | return 0; |
| 2127 | 2146 | ||
| 2128 | if (!spec_i_pt) { | 2147 | if (!spec_i_pt) { |
| 2129 | /* | 2148 | /* |
| @@ -2138,7 +2157,8 @@ static int core_scsi3_emulate_pro_register( | |||
| 2138 | if (ret != 0) { | 2157 | if (ret != 0) { |
| 2139 | pr_err("Unable to allocate" | 2158 | pr_err("Unable to allocate" |
| 2140 | " struct t10_pr_registration\n"); | 2159 | " struct t10_pr_registration\n"); |
| 2141 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 2160 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 2161 | return -EINVAL; | ||
| 2142 | } | 2162 | } |
| 2143 | } else { | 2163 | } else { |
| 2144 | /* | 2164 | /* |
| @@ -2197,14 +2217,16 @@ static int core_scsi3_emulate_pro_register( | |||
| 2197 | " 0x%016Lx\n", res_key, | 2217 | " 0x%016Lx\n", res_key, |
| 2198 | pr_reg->pr_res_key); | 2218 | pr_reg->pr_res_key); |
| 2199 | core_scsi3_put_pr_reg(pr_reg); | 2219 | core_scsi3_put_pr_reg(pr_reg); |
| 2200 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2220 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 2221 | return -EINVAL; | ||
| 2201 | } | 2222 | } |
| 2202 | } | 2223 | } |
| 2203 | if (spec_i_pt) { | 2224 | if (spec_i_pt) { |
| 2204 | pr_err("SPC-3 PR UNREGISTER: SPEC_I_PT" | 2225 | pr_err("SPC-3 PR UNREGISTER: SPEC_I_PT" |
| 2205 | " set while sa_res_key=0\n"); | 2226 | " set while sa_res_key=0\n"); |
| 2206 | core_scsi3_put_pr_reg(pr_reg); | 2227 | core_scsi3_put_pr_reg(pr_reg); |
| 2207 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 2228 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 2229 | return -EINVAL; | ||
| 2208 | } | 2230 | } |
| 2209 | /* | 2231 | /* |
| 2210 | * An existing ALL_TG_PT=1 registration being released | 2232 | * An existing ALL_TG_PT=1 registration being released |
| @@ -2215,7 +2237,8 @@ static int core_scsi3_emulate_pro_register( | |||
| 2215 | " registration exists, but ALL_TG_PT=1 bit not" | 2237 | " registration exists, but ALL_TG_PT=1 bit not" |
| 2216 | " present in received PROUT\n"); | 2238 | " present in received PROUT\n"); |
| 2217 | core_scsi3_put_pr_reg(pr_reg); | 2239 | core_scsi3_put_pr_reg(pr_reg); |
| 2218 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 2240 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 2241 | return -EINVAL; | ||
| 2219 | } | 2242 | } |
| 2220 | /* | 2243 | /* |
| 2221 | * Allocate APTPL metadata buffer used for UNREGISTER ops | 2244 | * Allocate APTPL metadata buffer used for UNREGISTER ops |
| @@ -2227,7 +2250,9 @@ static int core_scsi3_emulate_pro_register( | |||
| 2227 | pr_err("Unable to allocate" | 2250 | pr_err("Unable to allocate" |
| 2228 | " pr_aptpl_buf\n"); | 2251 | " pr_aptpl_buf\n"); |
| 2229 | core_scsi3_put_pr_reg(pr_reg); | 2252 | core_scsi3_put_pr_reg(pr_reg); |
| 2230 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2253 | cmd->scsi_sense_reason = |
| 2254 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 2255 | return -EINVAL; | ||
| 2231 | } | 2256 | } |
| 2232 | } | 2257 | } |
| 2233 | /* | 2258 | /* |
| @@ -2241,7 +2266,8 @@ static int core_scsi3_emulate_pro_register( | |||
| 2241 | if (pr_holder < 0) { | 2266 | if (pr_holder < 0) { |
| 2242 | kfree(pr_aptpl_buf); | 2267 | kfree(pr_aptpl_buf); |
| 2243 | core_scsi3_put_pr_reg(pr_reg); | 2268 | core_scsi3_put_pr_reg(pr_reg); |
| 2244 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2269 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 2270 | return -EINVAL; | ||
| 2245 | } | 2271 | } |
| 2246 | 2272 | ||
| 2247 | spin_lock(&pr_tmpl->registration_lock); | 2273 | spin_lock(&pr_tmpl->registration_lock); |
| @@ -2405,7 +2431,8 @@ static int core_scsi3_pro_reserve( | |||
| 2405 | 2431 | ||
| 2406 | if (!se_sess || !se_lun) { | 2432 | if (!se_sess || !se_lun) { |
| 2407 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); | 2433 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); |
| 2408 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2434 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 2435 | return -EINVAL; | ||
| 2409 | } | 2436 | } |
| 2410 | se_tpg = se_sess->se_tpg; | 2437 | se_tpg = se_sess->se_tpg; |
| 2411 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; | 2438 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; |
| @@ -2417,7 +2444,8 @@ static int core_scsi3_pro_reserve( | |||
| 2417 | if (!pr_reg) { | 2444 | if (!pr_reg) { |
| 2418 | pr_err("SPC-3 PR: Unable to locate" | 2445 | pr_err("SPC-3 PR: Unable to locate" |
| 2419 | " PR_REGISTERED *pr_reg for RESERVE\n"); | 2446 | " PR_REGISTERED *pr_reg for RESERVE\n"); |
| 2420 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2447 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 2448 | return -EINVAL; | ||
| 2421 | } | 2449 | } |
| 2422 | /* | 2450 | /* |
| 2423 | * From spc4r17 Section 5.7.9: Reserving: | 2451 | * From spc4r17 Section 5.7.9: Reserving: |
| @@ -2433,7 +2461,8 @@ static int core_scsi3_pro_reserve( | |||
| 2433 | " does not match existing SA REGISTER res_key:" | 2461 | " does not match existing SA REGISTER res_key:" |
| 2434 | " 0x%016Lx\n", res_key, pr_reg->pr_res_key); | 2462 | " 0x%016Lx\n", res_key, pr_reg->pr_res_key); |
| 2435 | core_scsi3_put_pr_reg(pr_reg); | 2463 | core_scsi3_put_pr_reg(pr_reg); |
| 2436 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2464 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 2465 | return -EINVAL; | ||
| 2437 | } | 2466 | } |
| 2438 | /* | 2467 | /* |
| 2439 | * From spc4r17 Section 5.7.9: Reserving: | 2468 | * From spc4r17 Section 5.7.9: Reserving: |
| @@ -2448,7 +2477,8 @@ static int core_scsi3_pro_reserve( | |||
| 2448 | if (scope != PR_SCOPE_LU_SCOPE) { | 2477 | if (scope != PR_SCOPE_LU_SCOPE) { |
| 2449 | pr_err("SPC-3 PR: Illegal SCOPE: 0x%02x\n", scope); | 2478 | pr_err("SPC-3 PR: Illegal SCOPE: 0x%02x\n", scope); |
| 2450 | core_scsi3_put_pr_reg(pr_reg); | 2479 | core_scsi3_put_pr_reg(pr_reg); |
| 2451 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 2480 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 2481 | return -EINVAL; | ||
| 2452 | } | 2482 | } |
| 2453 | /* | 2483 | /* |
| 2454 | * See if we have an existing PR reservation holder pointer at | 2484 | * See if we have an existing PR reservation holder pointer at |
| @@ -2480,7 +2510,8 @@ static int core_scsi3_pro_reserve( | |||
| 2480 | 2510 | ||
| 2481 | spin_unlock(&dev->dev_reservation_lock); | 2511 | spin_unlock(&dev->dev_reservation_lock); |
| 2482 | core_scsi3_put_pr_reg(pr_reg); | 2512 | core_scsi3_put_pr_reg(pr_reg); |
| 2483 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2513 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 2514 | return -EINVAL; | ||
| 2484 | } | 2515 | } |
| 2485 | /* | 2516 | /* |
| 2486 | * From spc4r17 Section 5.7.9: Reserving: | 2517 | * From spc4r17 Section 5.7.9: Reserving: |
| @@ -2503,7 +2534,8 @@ static int core_scsi3_pro_reserve( | |||
| 2503 | 2534 | ||
| 2504 | spin_unlock(&dev->dev_reservation_lock); | 2535 | spin_unlock(&dev->dev_reservation_lock); |
| 2505 | core_scsi3_put_pr_reg(pr_reg); | 2536 | core_scsi3_put_pr_reg(pr_reg); |
| 2506 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2537 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 2538 | return -EINVAL; | ||
| 2507 | } | 2539 | } |
| 2508 | /* | 2540 | /* |
| 2509 | * From spc4r17 Section 5.7.9: Reserving: | 2541 | * From spc4r17 Section 5.7.9: Reserving: |
| @@ -2517,7 +2549,7 @@ static int core_scsi3_pro_reserve( | |||
| 2517 | */ | 2549 | */ |
| 2518 | spin_unlock(&dev->dev_reservation_lock); | 2550 | spin_unlock(&dev->dev_reservation_lock); |
| 2519 | core_scsi3_put_pr_reg(pr_reg); | 2551 | core_scsi3_put_pr_reg(pr_reg); |
| 2520 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 2552 | return 0; |
| 2521 | } | 2553 | } |
| 2522 | /* | 2554 | /* |
| 2523 | * Otherwise, our *pr_reg becomes the PR reservation holder for said | 2555 | * Otherwise, our *pr_reg becomes the PR reservation holder for said |
| @@ -2574,7 +2606,8 @@ static int core_scsi3_emulate_pro_reserve( | |||
| 2574 | default: | 2606 | default: |
| 2575 | pr_err("SPC-3 PR: Unknown Service Action RESERVE Type:" | 2607 | pr_err("SPC-3 PR: Unknown Service Action RESERVE Type:" |
| 2576 | " 0x%02x\n", type); | 2608 | " 0x%02x\n", type); |
| 2577 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 2609 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 2610 | return -EINVAL; | ||
| 2578 | } | 2611 | } |
| 2579 | 2612 | ||
| 2580 | return ret; | 2613 | return ret; |
| @@ -2630,7 +2663,8 @@ static int core_scsi3_emulate_pro_release( | |||
| 2630 | 2663 | ||
| 2631 | if (!se_sess || !se_lun) { | 2664 | if (!se_sess || !se_lun) { |
| 2632 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); | 2665 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); |
| 2633 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2666 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 2667 | return -EINVAL; | ||
| 2634 | } | 2668 | } |
| 2635 | /* | 2669 | /* |
| 2636 | * Locate the existing *pr_reg via struct se_node_acl pointers | 2670 | * Locate the existing *pr_reg via struct se_node_acl pointers |
| @@ -2639,7 +2673,8 @@ static int core_scsi3_emulate_pro_release( | |||
| 2639 | if (!pr_reg) { | 2673 | if (!pr_reg) { |
| 2640 | pr_err("SPC-3 PR: Unable to locate" | 2674 | pr_err("SPC-3 PR: Unable to locate" |
| 2641 | " PR_REGISTERED *pr_reg for RELEASE\n"); | 2675 | " PR_REGISTERED *pr_reg for RELEASE\n"); |
| 2642 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2676 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 2677 | return -EINVAL; | ||
| 2643 | } | 2678 | } |
| 2644 | /* | 2679 | /* |
| 2645 | * From spc4r17 Section 5.7.11.2 Releasing: | 2680 | * From spc4r17 Section 5.7.11.2 Releasing: |
| @@ -2661,7 +2696,7 @@ static int core_scsi3_emulate_pro_release( | |||
| 2661 | */ | 2696 | */ |
| 2662 | spin_unlock(&dev->dev_reservation_lock); | 2697 | spin_unlock(&dev->dev_reservation_lock); |
| 2663 | core_scsi3_put_pr_reg(pr_reg); | 2698 | core_scsi3_put_pr_reg(pr_reg); |
| 2664 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 2699 | return 0; |
| 2665 | } | 2700 | } |
| 2666 | if ((pr_res_holder->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG) || | 2701 | if ((pr_res_holder->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG) || |
| 2667 | (pr_res_holder->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) | 2702 | (pr_res_holder->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) |
| @@ -2675,7 +2710,7 @@ static int core_scsi3_emulate_pro_release( | |||
| 2675 | */ | 2710 | */ |
| 2676 | spin_unlock(&dev->dev_reservation_lock); | 2711 | spin_unlock(&dev->dev_reservation_lock); |
| 2677 | core_scsi3_put_pr_reg(pr_reg); | 2712 | core_scsi3_put_pr_reg(pr_reg); |
| 2678 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 2713 | return 0; |
| 2679 | } | 2714 | } |
| 2680 | /* | 2715 | /* |
| 2681 | * From spc4r17 Section 5.7.11.2 Releasing: | 2716 | * From spc4r17 Section 5.7.11.2 Releasing: |
| @@ -2697,7 +2732,8 @@ static int core_scsi3_emulate_pro_release( | |||
| 2697 | " 0x%016Lx\n", res_key, pr_reg->pr_res_key); | 2732 | " 0x%016Lx\n", res_key, pr_reg->pr_res_key); |
| 2698 | spin_unlock(&dev->dev_reservation_lock); | 2733 | spin_unlock(&dev->dev_reservation_lock); |
| 2699 | core_scsi3_put_pr_reg(pr_reg); | 2734 | core_scsi3_put_pr_reg(pr_reg); |
| 2700 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2735 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 2736 | return -EINVAL; | ||
| 2701 | } | 2737 | } |
| 2702 | /* | 2738 | /* |
| 2703 | * From spc4r17 Section 5.7.11.2 Releasing and above: | 2739 | * From spc4r17 Section 5.7.11.2 Releasing and above: |
| @@ -2719,7 +2755,8 @@ static int core_scsi3_emulate_pro_release( | |||
| 2719 | 2755 | ||
| 2720 | spin_unlock(&dev->dev_reservation_lock); | 2756 | spin_unlock(&dev->dev_reservation_lock); |
| 2721 | core_scsi3_put_pr_reg(pr_reg); | 2757 | core_scsi3_put_pr_reg(pr_reg); |
| 2722 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2758 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 2759 | return -EINVAL; | ||
| 2723 | } | 2760 | } |
| 2724 | /* | 2761 | /* |
| 2725 | * In response to a persistent reservation release request from the | 2762 | * In response to a persistent reservation release request from the |
| @@ -2802,7 +2839,8 @@ static int core_scsi3_emulate_pro_clear( | |||
| 2802 | if (!pr_reg_n) { | 2839 | if (!pr_reg_n) { |
| 2803 | pr_err("SPC-3 PR: Unable to locate" | 2840 | pr_err("SPC-3 PR: Unable to locate" |
| 2804 | " PR_REGISTERED *pr_reg for CLEAR\n"); | 2841 | " PR_REGISTERED *pr_reg for CLEAR\n"); |
| 2805 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2842 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 2843 | return -EINVAL; | ||
| 2806 | } | 2844 | } |
| 2807 | /* | 2845 | /* |
| 2808 | * From spc4r17 section 5.7.11.6, Clearing: | 2846 | * From spc4r17 section 5.7.11.6, Clearing: |
| @@ -2821,7 +2859,8 @@ static int core_scsi3_emulate_pro_clear( | |||
| 2821 | " existing SA REGISTER res_key:" | 2859 | " existing SA REGISTER res_key:" |
| 2822 | " 0x%016Lx\n", res_key, pr_reg_n->pr_res_key); | 2860 | " 0x%016Lx\n", res_key, pr_reg_n->pr_res_key); |
| 2823 | core_scsi3_put_pr_reg(pr_reg_n); | 2861 | core_scsi3_put_pr_reg(pr_reg_n); |
| 2824 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2862 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 2863 | return -EINVAL; | ||
| 2825 | } | 2864 | } |
| 2826 | /* | 2865 | /* |
| 2827 | * a) Release the persistent reservation, if any; | 2866 | * a) Release the persistent reservation, if any; |
| @@ -2979,8 +3018,10 @@ static int core_scsi3_pro_preempt( | |||
| 2979 | int all_reg = 0, calling_it_nexus = 0, released_regs = 0; | 3018 | int all_reg = 0, calling_it_nexus = 0, released_regs = 0; |
| 2980 | int prh_type = 0, prh_scope = 0, ret; | 3019 | int prh_type = 0, prh_scope = 0, ret; |
| 2981 | 3020 | ||
| 2982 | if (!se_sess) | 3021 | if (!se_sess) { |
| 2983 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3022 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3023 | return -EINVAL; | ||
| 3024 | } | ||
| 2984 | 3025 | ||
| 2985 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; | 3026 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; |
| 2986 | pr_reg_n = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, | 3027 | pr_reg_n = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, |
| @@ -2989,16 +3030,19 @@ static int core_scsi3_pro_preempt( | |||
| 2989 | pr_err("SPC-3 PR: Unable to locate" | 3030 | pr_err("SPC-3 PR: Unable to locate" |
| 2990 | " PR_REGISTERED *pr_reg for PREEMPT%s\n", | 3031 | " PR_REGISTERED *pr_reg for PREEMPT%s\n", |
| 2991 | (abort) ? "_AND_ABORT" : ""); | 3032 | (abort) ? "_AND_ABORT" : ""); |
| 2992 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 3033 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 3034 | return -EINVAL; | ||
| 2993 | } | 3035 | } |
| 2994 | if (pr_reg_n->pr_res_key != res_key) { | 3036 | if (pr_reg_n->pr_res_key != res_key) { |
| 2995 | core_scsi3_put_pr_reg(pr_reg_n); | 3037 | core_scsi3_put_pr_reg(pr_reg_n); |
| 2996 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 3038 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 3039 | return -EINVAL; | ||
| 2997 | } | 3040 | } |
| 2998 | if (scope != PR_SCOPE_LU_SCOPE) { | 3041 | if (scope != PR_SCOPE_LU_SCOPE) { |
| 2999 | pr_err("SPC-3 PR: Illegal SCOPE: 0x%02x\n", scope); | 3042 | pr_err("SPC-3 PR: Illegal SCOPE: 0x%02x\n", scope); |
| 3000 | core_scsi3_put_pr_reg(pr_reg_n); | 3043 | core_scsi3_put_pr_reg(pr_reg_n); |
| 3001 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3044 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3045 | return -EINVAL; | ||
| 3002 | } | 3046 | } |
| 3003 | INIT_LIST_HEAD(&preempt_and_abort_list); | 3047 | INIT_LIST_HEAD(&preempt_and_abort_list); |
| 3004 | 3048 | ||
| @@ -3012,7 +3056,8 @@ static int core_scsi3_pro_preempt( | |||
| 3012 | if (!all_reg && !sa_res_key) { | 3056 | if (!all_reg && !sa_res_key) { |
| 3013 | spin_unlock(&dev->dev_reservation_lock); | 3057 | spin_unlock(&dev->dev_reservation_lock); |
| 3014 | core_scsi3_put_pr_reg(pr_reg_n); | 3058 | core_scsi3_put_pr_reg(pr_reg_n); |
| 3015 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3059 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3060 | return -EINVAL; | ||
| 3016 | } | 3061 | } |
| 3017 | /* | 3062 | /* |
| 3018 | * From spc4r17, section 5.7.11.4.4 Removing Registrations: | 3063 | * From spc4r17, section 5.7.11.4.4 Removing Registrations: |
| @@ -3106,7 +3151,8 @@ static int core_scsi3_pro_preempt( | |||
| 3106 | if (!released_regs) { | 3151 | if (!released_regs) { |
| 3107 | spin_unlock(&dev->dev_reservation_lock); | 3152 | spin_unlock(&dev->dev_reservation_lock); |
| 3108 | core_scsi3_put_pr_reg(pr_reg_n); | 3153 | core_scsi3_put_pr_reg(pr_reg_n); |
| 3109 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 3154 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 3155 | return -EINVAL; | ||
| 3110 | } | 3156 | } |
| 3111 | /* | 3157 | /* |
| 3112 | * For an existing all registrants type reservation | 3158 | * For an existing all registrants type reservation |
| @@ -3297,7 +3343,8 @@ static int core_scsi3_emulate_pro_preempt( | |||
| 3297 | default: | 3343 | default: |
| 3298 | pr_err("SPC-3 PR: Unknown Service Action PREEMPT%s" | 3344 | pr_err("SPC-3 PR: Unknown Service Action PREEMPT%s" |
| 3299 | " Type: 0x%02x\n", (abort) ? "_AND_ABORT" : "", type); | 3345 | " Type: 0x%02x\n", (abort) ? "_AND_ABORT" : "", type); |
| 3300 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 3346 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 3347 | return -EINVAL; | ||
| 3301 | } | 3348 | } |
| 3302 | 3349 | ||
| 3303 | return ret; | 3350 | return ret; |
| @@ -3331,7 +3378,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3331 | 3378 | ||
| 3332 | if (!se_sess || !se_lun) { | 3379 | if (!se_sess || !se_lun) { |
| 3333 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); | 3380 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); |
| 3334 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3381 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3382 | return -EINVAL; | ||
| 3335 | } | 3383 | } |
| 3336 | memset(dest_iport, 0, 64); | 3384 | memset(dest_iport, 0, 64); |
| 3337 | memset(i_buf, 0, PR_REG_ISID_ID_LEN); | 3385 | memset(i_buf, 0, PR_REG_ISID_ID_LEN); |
| @@ -3349,7 +3397,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3349 | if (!pr_reg) { | 3397 | if (!pr_reg) { |
| 3350 | pr_err("SPC-3 PR: Unable to locate PR_REGISTERED" | 3398 | pr_err("SPC-3 PR: Unable to locate PR_REGISTERED" |
| 3351 | " *pr_reg for REGISTER_AND_MOVE\n"); | 3399 | " *pr_reg for REGISTER_AND_MOVE\n"); |
| 3352 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3400 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3401 | return -EINVAL; | ||
| 3353 | } | 3402 | } |
| 3354 | /* | 3403 | /* |
| 3355 | * The provided reservation key much match the existing reservation key | 3404 | * The provided reservation key much match the existing reservation key |
| @@ -3360,7 +3409,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3360 | " res_key: 0x%016Lx does not match existing SA REGISTER" | 3409 | " res_key: 0x%016Lx does not match existing SA REGISTER" |
| 3361 | " res_key: 0x%016Lx\n", res_key, pr_reg->pr_res_key); | 3410 | " res_key: 0x%016Lx\n", res_key, pr_reg->pr_res_key); |
| 3362 | core_scsi3_put_pr_reg(pr_reg); | 3411 | core_scsi3_put_pr_reg(pr_reg); |
| 3363 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 3412 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 3413 | return -EINVAL; | ||
| 3364 | } | 3414 | } |
| 3365 | /* | 3415 | /* |
| 3366 | * The service active reservation key needs to be non zero | 3416 | * The service active reservation key needs to be non zero |
| @@ -3369,7 +3419,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3369 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: Received zero" | 3419 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: Received zero" |
| 3370 | " sa_res_key\n"); | 3420 | " sa_res_key\n"); |
| 3371 | core_scsi3_put_pr_reg(pr_reg); | 3421 | core_scsi3_put_pr_reg(pr_reg); |
| 3372 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3422 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3423 | return -EINVAL; | ||
| 3373 | } | 3424 | } |
| 3374 | 3425 | ||
| 3375 | /* | 3426 | /* |
| @@ -3392,7 +3443,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3392 | " does not equal CDB data_length: %u\n", tid_len, | 3443 | " does not equal CDB data_length: %u\n", tid_len, |
| 3393 | cmd->data_length); | 3444 | cmd->data_length); |
| 3394 | core_scsi3_put_pr_reg(pr_reg); | 3445 | core_scsi3_put_pr_reg(pr_reg); |
| 3395 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3446 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3447 | return -EINVAL; | ||
| 3396 | } | 3448 | } |
| 3397 | 3449 | ||
| 3398 | spin_lock(&dev->se_port_lock); | 3450 | spin_lock(&dev->se_port_lock); |
| @@ -3417,7 +3469,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3417 | atomic_dec(&dest_se_tpg->tpg_pr_ref_count); | 3469 | atomic_dec(&dest_se_tpg->tpg_pr_ref_count); |
| 3418 | smp_mb__after_atomic_dec(); | 3470 | smp_mb__after_atomic_dec(); |
| 3419 | core_scsi3_put_pr_reg(pr_reg); | 3471 | core_scsi3_put_pr_reg(pr_reg); |
| 3420 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3472 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3473 | return -EINVAL; | ||
| 3421 | } | 3474 | } |
| 3422 | 3475 | ||
| 3423 | spin_lock(&dev->se_port_lock); | 3476 | spin_lock(&dev->se_port_lock); |
| @@ -3430,7 +3483,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3430 | " fabric ops from Relative Target Port Identifier:" | 3483 | " fabric ops from Relative Target Port Identifier:" |
| 3431 | " %hu\n", rtpi); | 3484 | " %hu\n", rtpi); |
| 3432 | core_scsi3_put_pr_reg(pr_reg); | 3485 | core_scsi3_put_pr_reg(pr_reg); |
| 3433 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3486 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3487 | return -EINVAL; | ||
| 3434 | } | 3488 | } |
| 3435 | 3489 | ||
| 3436 | buf = transport_kmap_first_data_page(cmd); | 3490 | buf = transport_kmap_first_data_page(cmd); |
| @@ -3445,14 +3499,16 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3445 | " from fabric: %s\n", proto_ident, | 3499 | " from fabric: %s\n", proto_ident, |
| 3446 | dest_tf_ops->get_fabric_proto_ident(dest_se_tpg), | 3500 | dest_tf_ops->get_fabric_proto_ident(dest_se_tpg), |
| 3447 | dest_tf_ops->get_fabric_name()); | 3501 | dest_tf_ops->get_fabric_name()); |
| 3448 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3502 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3503 | ret = -EINVAL; | ||
| 3449 | goto out; | 3504 | goto out; |
| 3450 | } | 3505 | } |
| 3451 | if (dest_tf_ops->tpg_parse_pr_out_transport_id == NULL) { | 3506 | if (dest_tf_ops->tpg_parse_pr_out_transport_id == NULL) { |
| 3452 | pr_err("SPC-3 PR REGISTER_AND_MOVE: Fabric does not" | 3507 | pr_err("SPC-3 PR REGISTER_AND_MOVE: Fabric does not" |
| 3453 | " containg a valid tpg_parse_pr_out_transport_id" | 3508 | " containg a valid tpg_parse_pr_out_transport_id" |
| 3454 | " function pointer\n"); | 3509 | " function pointer\n"); |
| 3455 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 3510 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3511 | ret = -EINVAL; | ||
| 3456 | goto out; | 3512 | goto out; |
| 3457 | } | 3513 | } |
| 3458 | initiator_str = dest_tf_ops->tpg_parse_pr_out_transport_id(dest_se_tpg, | 3514 | initiator_str = dest_tf_ops->tpg_parse_pr_out_transport_id(dest_se_tpg, |
| @@ -3460,7 +3516,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3460 | if (!initiator_str) { | 3516 | if (!initiator_str) { |
| 3461 | pr_err("SPC-3 PR REGISTER_AND_MOVE: Unable to locate" | 3517 | pr_err("SPC-3 PR REGISTER_AND_MOVE: Unable to locate" |
| 3462 | " initiator_str from Transport ID\n"); | 3518 | " initiator_str from Transport ID\n"); |
| 3463 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3519 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3520 | ret = -EINVAL; | ||
| 3464 | goto out; | 3521 | goto out; |
| 3465 | } | 3522 | } |
| 3466 | 3523 | ||
| @@ -3489,7 +3546,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3489 | pr_err("SPC-3 PR REGISTER_AND_MOVE: TransportID: %s" | 3546 | pr_err("SPC-3 PR REGISTER_AND_MOVE: TransportID: %s" |
| 3490 | " matches: %s on received I_T Nexus\n", initiator_str, | 3547 | " matches: %s on received I_T Nexus\n", initiator_str, |
| 3491 | pr_reg_nacl->initiatorname); | 3548 | pr_reg_nacl->initiatorname); |
| 3492 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3549 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3550 | ret = -EINVAL; | ||
| 3493 | goto out; | 3551 | goto out; |
| 3494 | } | 3552 | } |
| 3495 | if (!strcmp(iport_ptr, pr_reg->pr_reg_isid)) { | 3553 | if (!strcmp(iport_ptr, pr_reg->pr_reg_isid)) { |
| @@ -3497,7 +3555,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
| 3497 | " matches: %s %s on received I_T Nexus\n", | 3555 | " matches: %s %s on received I_T Nexus\n", |
| 3498 | initiator_str, iport_ptr, pr_reg_nacl->initiatorname, | 3556 | initiator_str, iport_ptr, pr_reg_nacl->initiatorname, |
| 3499 | pr_reg->pr_reg_isid); | 3557 | pr_reg->pr_reg_isid); |
| 3500 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3558 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3559 | ret = -EINVAL; | ||
| 3501 | goto out; | 3560 | goto out; |
| 3502 | } | 3561 | } |
| 3503 | after_iport_check: | 3562 | after_iport_check: |
| @@ -3517,7 +3576,8 @@ after_iport_check: | |||
| 3517 | pr_err("Unable to locate %s dest_node_acl for" | 3576 | pr_err("Unable to locate %s dest_node_acl for" |
| 3518 | " TransportID%s\n", dest_tf_ops->get_fabric_name(), | 3577 | " TransportID%s\n", dest_tf_ops->get_fabric_name(), |
| 3519 | initiator_str); | 3578 | initiator_str); |
| 3520 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3579 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3580 | ret = -EINVAL; | ||
| 3521 | goto out; | 3581 | goto out; |
| 3522 | } | 3582 | } |
| 3523 | ret = core_scsi3_nodeacl_depend_item(dest_node_acl); | 3583 | ret = core_scsi3_nodeacl_depend_item(dest_node_acl); |
| @@ -3527,7 +3587,8 @@ after_iport_check: | |||
| 3527 | atomic_dec(&dest_node_acl->acl_pr_ref_count); | 3587 | atomic_dec(&dest_node_acl->acl_pr_ref_count); |
| 3528 | smp_mb__after_atomic_dec(); | 3588 | smp_mb__after_atomic_dec(); |
| 3529 | dest_node_acl = NULL; | 3589 | dest_node_acl = NULL; |
| 3530 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 3590 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3591 | ret = -EINVAL; | ||
| 3531 | goto out; | 3592 | goto out; |
| 3532 | } | 3593 | } |
| 3533 | #if 0 | 3594 | #if 0 |
| @@ -3543,7 +3604,8 @@ after_iport_check: | |||
| 3543 | if (!dest_se_deve) { | 3604 | if (!dest_se_deve) { |
| 3544 | pr_err("Unable to locate %s dest_se_deve from RTPI:" | 3605 | pr_err("Unable to locate %s dest_se_deve from RTPI:" |
| 3545 | " %hu\n", dest_tf_ops->get_fabric_name(), rtpi); | 3606 | " %hu\n", dest_tf_ops->get_fabric_name(), rtpi); |
| 3546 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3607 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3608 | ret = -EINVAL; | ||
| 3547 | goto out; | 3609 | goto out; |
| 3548 | } | 3610 | } |
| 3549 | 3611 | ||
| @@ -3553,7 +3615,8 @@ after_iport_check: | |||
| 3553 | atomic_dec(&dest_se_deve->pr_ref_count); | 3615 | atomic_dec(&dest_se_deve->pr_ref_count); |
| 3554 | smp_mb__after_atomic_dec(); | 3616 | smp_mb__after_atomic_dec(); |
| 3555 | dest_se_deve = NULL; | 3617 | dest_se_deve = NULL; |
| 3556 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 3618 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3619 | ret = -EINVAL; | ||
| 3557 | goto out; | 3620 | goto out; |
| 3558 | } | 3621 | } |
| 3559 | #if 0 | 3622 | #if 0 |
| @@ -3572,7 +3635,8 @@ after_iport_check: | |||
| 3572 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: No reservation" | 3635 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: No reservation" |
| 3573 | " currently held\n"); | 3636 | " currently held\n"); |
| 3574 | spin_unlock(&dev->dev_reservation_lock); | 3637 | spin_unlock(&dev->dev_reservation_lock); |
| 3575 | ret = PYX_TRANSPORT_INVALID_CDB_FIELD; | 3638 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 3639 | ret = -EINVAL; | ||
| 3576 | goto out; | 3640 | goto out; |
| 3577 | } | 3641 | } |
| 3578 | /* | 3642 | /* |
| @@ -3585,7 +3649,8 @@ after_iport_check: | |||
| 3585 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: Calling I_T" | 3649 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: Calling I_T" |
| 3586 | " Nexus is not reservation holder\n"); | 3650 | " Nexus is not reservation holder\n"); |
| 3587 | spin_unlock(&dev->dev_reservation_lock); | 3651 | spin_unlock(&dev->dev_reservation_lock); |
| 3588 | ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 3652 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 3653 | ret = -EINVAL; | ||
| 3589 | goto out; | 3654 | goto out; |
| 3590 | } | 3655 | } |
| 3591 | /* | 3656 | /* |
| @@ -3603,7 +3668,8 @@ after_iport_check: | |||
| 3603 | " reservation for type: %s\n", | 3668 | " reservation for type: %s\n", |
| 3604 | core_scsi3_pr_dump_type(pr_res_holder->pr_res_type)); | 3669 | core_scsi3_pr_dump_type(pr_res_holder->pr_res_type)); |
| 3605 | spin_unlock(&dev->dev_reservation_lock); | 3670 | spin_unlock(&dev->dev_reservation_lock); |
| 3606 | ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 3671 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 3672 | ret = -EINVAL; | ||
| 3607 | goto out; | 3673 | goto out; |
| 3608 | } | 3674 | } |
| 3609 | pr_res_nacl = pr_res_holder->pr_reg_nacl; | 3675 | pr_res_nacl = pr_res_holder->pr_reg_nacl; |
| @@ -3640,7 +3706,8 @@ after_iport_check: | |||
| 3640 | sa_res_key, 0, aptpl, 2, 1); | 3706 | sa_res_key, 0, aptpl, 2, 1); |
| 3641 | if (ret != 0) { | 3707 | if (ret != 0) { |
| 3642 | spin_unlock(&dev->dev_reservation_lock); | 3708 | spin_unlock(&dev->dev_reservation_lock); |
| 3643 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3709 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3710 | ret = -EINVAL; | ||
| 3644 | goto out; | 3711 | goto out; |
| 3645 | } | 3712 | } |
| 3646 | dest_pr_reg = __core_scsi3_locate_pr_reg(dev, dest_node_acl, | 3713 | dest_pr_reg = __core_scsi3_locate_pr_reg(dev, dest_node_acl, |
| @@ -3771,7 +3838,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
| 3771 | pr_err("Received PERSISTENT_RESERVE CDB while legacy" | 3838 | pr_err("Received PERSISTENT_RESERVE CDB while legacy" |
| 3772 | " SPC-2 reservation is held, returning" | 3839 | " SPC-2 reservation is held, returning" |
| 3773 | " RESERVATION_CONFLICT\n"); | 3840 | " RESERVATION_CONFLICT\n"); |
| 3774 | ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 3841 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 3842 | ret = EINVAL; | ||
| 3775 | goto out; | 3843 | goto out; |
| 3776 | } | 3844 | } |
| 3777 | 3845 | ||
| @@ -3779,13 +3847,16 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
| 3779 | * FIXME: A NULL struct se_session pointer means an this is not coming from | 3847 | * FIXME: A NULL struct se_session pointer means an this is not coming from |
| 3780 | * a $FABRIC_MOD's nexus, but from internal passthrough ops. | 3848 | * a $FABRIC_MOD's nexus, but from internal passthrough ops. |
| 3781 | */ | 3849 | */ |
| 3782 | if (!cmd->se_sess) | 3850 | if (!cmd->se_sess) { |
| 3783 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3851 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3852 | return -EINVAL; | ||
| 3853 | } | ||
| 3784 | 3854 | ||
| 3785 | if (cmd->data_length < 24) { | 3855 | if (cmd->data_length < 24) { |
| 3786 | pr_warn("SPC-PR: Received PR OUT parameter list" | 3856 | pr_warn("SPC-PR: Received PR OUT parameter list" |
| 3787 | " length too small: %u\n", cmd->data_length); | 3857 | " length too small: %u\n", cmd->data_length); |
| 3788 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3858 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3859 | ret = -EINVAL; | ||
| 3789 | goto out; | 3860 | goto out; |
| 3790 | } | 3861 | } |
| 3791 | /* | 3862 | /* |
| @@ -3820,7 +3891,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
| 3820 | * SPEC_I_PT=1 is only valid for Service action: REGISTER | 3891 | * SPEC_I_PT=1 is only valid for Service action: REGISTER |
| 3821 | */ | 3892 | */ |
| 3822 | if (spec_i_pt && ((cdb[1] & 0x1f) != PRO_REGISTER)) { | 3893 | if (spec_i_pt && ((cdb[1] & 0x1f) != PRO_REGISTER)) { |
| 3823 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3894 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3895 | ret = -EINVAL; | ||
| 3824 | goto out; | 3896 | goto out; |
| 3825 | } | 3897 | } |
| 3826 | 3898 | ||
| @@ -3837,7 +3909,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
| 3837 | (cmd->data_length != 24)) { | 3909 | (cmd->data_length != 24)) { |
| 3838 | pr_warn("SPC-PR: Received PR OUT illegal parameter" | 3910 | pr_warn("SPC-PR: Received PR OUT illegal parameter" |
| 3839 | " list length: %u\n", cmd->data_length); | 3911 | " list length: %u\n", cmd->data_length); |
| 3840 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3912 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
| 3913 | ret = -EINVAL; | ||
| 3841 | goto out; | 3914 | goto out; |
| 3842 | } | 3915 | } |
| 3843 | /* | 3916 | /* |
| @@ -3878,7 +3951,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
| 3878 | default: | 3951 | default: |
| 3879 | pr_err("Unknown PERSISTENT_RESERVE_OUT service" | 3952 | pr_err("Unknown PERSISTENT_RESERVE_OUT service" |
| 3880 | " action: 0x%02x\n", cdb[1] & 0x1f); | 3953 | " action: 0x%02x\n", cdb[1] & 0x1f); |
| 3881 | ret = PYX_TRANSPORT_INVALID_CDB_FIELD; | 3954 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 3955 | ret = -EINVAL; | ||
| 3882 | break; | 3956 | break; |
| 3883 | } | 3957 | } |
| 3884 | 3958 | ||
| @@ -3906,7 +3980,8 @@ static int core_scsi3_pri_read_keys(struct se_cmd *cmd) | |||
| 3906 | if (cmd->data_length < 8) { | 3980 | if (cmd->data_length < 8) { |
| 3907 | pr_err("PRIN SA READ_KEYS SCSI Data Length: %u" | 3981 | pr_err("PRIN SA READ_KEYS SCSI Data Length: %u" |
| 3908 | " too small\n", cmd->data_length); | 3982 | " too small\n", cmd->data_length); |
| 3909 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 3983 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 3984 | return -EINVAL; | ||
| 3910 | } | 3985 | } |
| 3911 | 3986 | ||
| 3912 | buf = transport_kmap_first_data_page(cmd); | 3987 | buf = transport_kmap_first_data_page(cmd); |
| @@ -3965,7 +4040,8 @@ static int core_scsi3_pri_read_reservation(struct se_cmd *cmd) | |||
| 3965 | if (cmd->data_length < 8) { | 4040 | if (cmd->data_length < 8) { |
| 3966 | pr_err("PRIN SA READ_RESERVATIONS SCSI Data Length: %u" | 4041 | pr_err("PRIN SA READ_RESERVATIONS SCSI Data Length: %u" |
| 3967 | " too small\n", cmd->data_length); | 4042 | " too small\n", cmd->data_length); |
| 3968 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 4043 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 4044 | return -EINVAL; | ||
| 3969 | } | 4045 | } |
| 3970 | 4046 | ||
| 3971 | buf = transport_kmap_first_data_page(cmd); | 4047 | buf = transport_kmap_first_data_page(cmd); |
| @@ -4047,7 +4123,8 @@ static int core_scsi3_pri_report_capabilities(struct se_cmd *cmd) | |||
| 4047 | if (cmd->data_length < 6) { | 4123 | if (cmd->data_length < 6) { |
| 4048 | pr_err("PRIN SA REPORT_CAPABILITIES SCSI Data Length:" | 4124 | pr_err("PRIN SA REPORT_CAPABILITIES SCSI Data Length:" |
| 4049 | " %u too small\n", cmd->data_length); | 4125 | " %u too small\n", cmd->data_length); |
| 4050 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 4126 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 4127 | return -EINVAL; | ||
| 4051 | } | 4128 | } |
| 4052 | 4129 | ||
| 4053 | buf = transport_kmap_first_data_page(cmd); | 4130 | buf = transport_kmap_first_data_page(cmd); |
| @@ -4108,7 +4185,8 @@ static int core_scsi3_pri_read_full_status(struct se_cmd *cmd) | |||
| 4108 | if (cmd->data_length < 8) { | 4185 | if (cmd->data_length < 8) { |
| 4109 | pr_err("PRIN SA READ_FULL_STATUS SCSI Data Length: %u" | 4186 | pr_err("PRIN SA READ_FULL_STATUS SCSI Data Length: %u" |
| 4110 | " too small\n", cmd->data_length); | 4187 | " too small\n", cmd->data_length); |
| 4111 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 4188 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 4189 | return -EINVAL; | ||
| 4112 | } | 4190 | } |
| 4113 | 4191 | ||
| 4114 | buf = transport_kmap_first_data_page(cmd); | 4192 | buf = transport_kmap_first_data_page(cmd); |
| @@ -4255,7 +4333,8 @@ int target_scsi3_emulate_pr_in(struct se_task *task) | |||
| 4255 | pr_err("Received PERSISTENT_RESERVE CDB while legacy" | 4333 | pr_err("Received PERSISTENT_RESERVE CDB while legacy" |
| 4256 | " SPC-2 reservation is held, returning" | 4334 | " SPC-2 reservation is held, returning" |
| 4257 | " RESERVATION_CONFLICT\n"); | 4335 | " RESERVATION_CONFLICT\n"); |
| 4258 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 4336 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 4337 | return -EINVAL; | ||
| 4259 | } | 4338 | } |
| 4260 | 4339 | ||
| 4261 | switch (cmd->t_task_cdb[1] & 0x1f) { | 4340 | switch (cmd->t_task_cdb[1] & 0x1f) { |
| @@ -4274,7 +4353,8 @@ int target_scsi3_emulate_pr_in(struct se_task *task) | |||
| 4274 | default: | 4353 | default: |
| 4275 | pr_err("Unknown PERSISTENT_RESERVE_IN service" | 4354 | pr_err("Unknown PERSISTENT_RESERVE_IN service" |
| 4276 | " action: 0x%02x\n", cmd->t_task_cdb[1] & 0x1f); | 4355 | " action: 0x%02x\n", cmd->t_task_cdb[1] & 0x1f); |
| 4277 | ret = PYX_TRANSPORT_INVALID_CDB_FIELD; | 4356 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
| 4357 | ret = -EINVAL; | ||
| 4278 | break; | 4358 | break; |
| 4279 | } | 4359 | } |
| 4280 | 4360 | ||
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index ed32e1efe429..8b15e56b0384 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
| @@ -963,6 +963,7 @@ static inline struct bio *pscsi_get_bio(int sg_num) | |||
| 963 | static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, | 963 | static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, |
| 964 | struct bio **hbio) | 964 | struct bio **hbio) |
| 965 | { | 965 | { |
| 966 | struct se_cmd *cmd = task->task_se_cmd; | ||
| 966 | struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; | 967 | struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; |
| 967 | u32 task_sg_num = task->task_sg_nents; | 968 | u32 task_sg_num = task->task_sg_nents; |
| 968 | struct bio *bio = NULL, *tbio = NULL; | 969 | struct bio *bio = NULL, *tbio = NULL; |
| @@ -971,7 +972,7 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, | |||
| 971 | u32 data_len = task->task_size, i, len, bytes, off; | 972 | u32 data_len = task->task_size, i, len, bytes, off; |
| 972 | int nr_pages = (task->task_size + task_sg[0].offset + | 973 | int nr_pages = (task->task_size + task_sg[0].offset + |
| 973 | PAGE_SIZE - 1) >> PAGE_SHIFT; | 974 | PAGE_SIZE - 1) >> PAGE_SHIFT; |
| 974 | int nr_vecs = 0, rc, ret = PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 975 | int nr_vecs = 0, rc; |
| 975 | int rw = (task->task_data_direction == DMA_TO_DEVICE); | 976 | int rw = (task->task_data_direction == DMA_TO_DEVICE); |
| 976 | 977 | ||
| 977 | *hbio = NULL; | 978 | *hbio = NULL; |
| @@ -1058,11 +1059,13 @@ fail: | |||
| 1058 | bio->bi_next = NULL; | 1059 | bio->bi_next = NULL; |
| 1059 | bio_endio(bio, 0); /* XXX: should be error */ | 1060 | bio_endio(bio, 0); /* XXX: should be error */ |
| 1060 | } | 1061 | } |
| 1061 | return ret; | 1062 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 1063 | return -ENOMEM; | ||
| 1062 | } | 1064 | } |
| 1063 | 1065 | ||
| 1064 | static int pscsi_do_task(struct se_task *task) | 1066 | static int pscsi_do_task(struct se_task *task) |
| 1065 | { | 1067 | { |
| 1068 | struct se_cmd *cmd = task->task_se_cmd; | ||
| 1066 | struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; | 1069 | struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; |
| 1067 | struct pscsi_plugin_task *pt = PSCSI_TASK(task); | 1070 | struct pscsi_plugin_task *pt = PSCSI_TASK(task); |
| 1068 | struct request *req; | 1071 | struct request *req; |
| @@ -1078,7 +1081,9 @@ static int pscsi_do_task(struct se_task *task) | |||
| 1078 | if (!req || IS_ERR(req)) { | 1081 | if (!req || IS_ERR(req)) { |
| 1079 | pr_err("PSCSI: blk_get_request() failed: %ld\n", | 1082 | pr_err("PSCSI: blk_get_request() failed: %ld\n", |
| 1080 | req ? IS_ERR(req) : -ENOMEM); | 1083 | req ? IS_ERR(req) : -ENOMEM); |
| 1081 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 1084 | cmd->scsi_sense_reason = |
| 1085 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 1086 | return -ENODEV; | ||
| 1082 | } | 1087 | } |
| 1083 | } else { | 1088 | } else { |
| 1084 | BUG_ON(!task->task_size); | 1089 | BUG_ON(!task->task_size); |
| @@ -1087,8 +1092,11 @@ static int pscsi_do_task(struct se_task *task) | |||
| 1087 | * Setup the main struct request for the task->task_sg[] payload | 1092 | * Setup the main struct request for the task->task_sg[] payload |
| 1088 | */ | 1093 | */ |
| 1089 | ret = pscsi_map_sg(task, task->task_sg, &hbio); | 1094 | ret = pscsi_map_sg(task, task->task_sg, &hbio); |
| 1090 | if (ret < 0) | 1095 | if (ret < 0) { |
| 1091 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 1096 | cmd->scsi_sense_reason = |
| 1097 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 1098 | return ret; | ||
| 1099 | } | ||
| 1092 | 1100 | ||
| 1093 | req = blk_make_request(pdv->pdv_sd->request_queue, hbio, | 1101 | req = blk_make_request(pdv->pdv_sd->request_queue, hbio, |
| 1094 | GFP_KERNEL); | 1102 | GFP_KERNEL); |
| @@ -1115,7 +1123,7 @@ static int pscsi_do_task(struct se_task *task) | |||
| 1115 | (task->task_se_cmd->sam_task_attr == MSG_HEAD_TAG), | 1123 | (task->task_se_cmd->sam_task_attr == MSG_HEAD_TAG), |
| 1116 | pscsi_req_done); | 1124 | pscsi_req_done); |
| 1117 | 1125 | ||
| 1118 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 1126 | return 0; |
| 1119 | 1127 | ||
| 1120 | fail: | 1128 | fail: |
| 1121 | while (hbio) { | 1129 | while (hbio) { |
| @@ -1124,7 +1132,8 @@ fail: | |||
| 1124 | bio->bi_next = NULL; | 1132 | bio->bi_next = NULL; |
| 1125 | bio_endio(bio, 0); /* XXX: should be error */ | 1133 | bio_endio(bio, 0); /* XXX: should be error */ |
| 1126 | } | 1134 | } |
| 1127 | return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 1135 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 1136 | return -ENOMEM; | ||
| 1128 | } | 1137 | } |
| 1129 | 1138 | ||
| 1130 | /* pscsi_get_sense_buffer(): | 1139 | /* pscsi_get_sense_buffer(): |
| @@ -1198,9 +1207,8 @@ static inline void pscsi_process_SAM_status( | |||
| 1198 | " 0x%02x Result: 0x%08x\n", task, pt->pscsi_cdb[0], | 1207 | " 0x%02x Result: 0x%08x\n", task, pt->pscsi_cdb[0], |
| 1199 | pt->pscsi_result); | 1208 | pt->pscsi_result); |
| 1200 | task->task_scsi_status = SAM_STAT_CHECK_CONDITION; | 1209 | task->task_scsi_status = SAM_STAT_CHECK_CONDITION; |
| 1201 | task->task_error_status = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1210 | task->task_se_cmd->scsi_sense_reason = |
| 1202 | task->task_se_cmd->transport_error_status = | 1211 | TCM_UNSUPPORTED_SCSI_OPCODE; |
| 1203 | PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | ||
| 1204 | transport_complete_task(task, 0); | 1212 | transport_complete_task(task, 0); |
| 1205 | break; | 1213 | break; |
| 1206 | } | 1214 | } |
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index 5158d3846f19..02e51faa2f4e 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c | |||
| @@ -343,235 +343,74 @@ static struct rd_dev_sg_table *rd_get_sg_table(struct rd_dev *rd_dev, u32 page) | |||
| 343 | return NULL; | 343 | return NULL; |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | /* rd_MEMCPY_read(): | 346 | static int rd_MEMCPY(struct rd_request *req, u32 read_rd) |
| 347 | * | ||
| 348 | * | ||
| 349 | */ | ||
| 350 | static int rd_MEMCPY_read(struct rd_request *req) | ||
| 351 | { | 347 | { |
| 352 | struct se_task *task = &req->rd_task; | 348 | struct se_task *task = &req->rd_task; |
| 353 | struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr; | 349 | struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr; |
| 354 | struct rd_dev_sg_table *table; | 350 | struct rd_dev_sg_table *table; |
| 355 | struct scatterlist *sg_d, *sg_s; | 351 | struct scatterlist *rd_sg; |
| 356 | void *dst, *src; | 352 | struct sg_mapping_iter m; |
| 357 | u32 i = 0, j = 0, dst_offset = 0, src_offset = 0; | ||
| 358 | u32 length, page_end = 0, table_sg_end; | ||
| 359 | u32 rd_offset = req->rd_offset; | 353 | u32 rd_offset = req->rd_offset; |
| 354 | u32 src_len; | ||
| 360 | 355 | ||
| 361 | table = rd_get_sg_table(dev, req->rd_page); | 356 | table = rd_get_sg_table(dev, req->rd_page); |
| 362 | if (!table) | 357 | if (!table) |
| 363 | return -EINVAL; | 358 | return -EINVAL; |
| 364 | 359 | ||
| 365 | table_sg_end = (table->page_end_offset - req->rd_page); | 360 | rd_sg = &table->sg_table[req->rd_page - table->page_start_offset]; |
| 366 | sg_d = task->task_sg; | ||
| 367 | sg_s = &table->sg_table[req->rd_page - table->page_start_offset]; | ||
| 368 | 361 | ||
| 369 | pr_debug("RD[%u]: Read LBA: %llu, Size: %u Page: %u, Offset:" | 362 | pr_debug("RD[%u]: %s LBA: %llu, Size: %u Page: %u, Offset: %u\n", |
| 370 | " %u\n", dev->rd_dev_id, task->task_lba, req->rd_size, | 363 | dev->rd_dev_id, read_rd ? "Read" : "Write", |
| 371 | req->rd_page, req->rd_offset); | 364 | task->task_lba, req->rd_size, req->rd_page, |
| 372 | 365 | rd_offset); | |
| 373 | src_offset = rd_offset; | ||
| 374 | 366 | ||
| 367 | src_len = PAGE_SIZE - rd_offset; | ||
| 368 | sg_miter_start(&m, task->task_sg, task->task_sg_nents, | ||
| 369 | read_rd ? SG_MITER_TO_SG : SG_MITER_FROM_SG); | ||
| 375 | while (req->rd_size) { | 370 | while (req->rd_size) { |
| 376 | if ((sg_d[i].length - dst_offset) < | 371 | u32 len; |
| 377 | (sg_s[j].length - src_offset)) { | 372 | void *rd_addr; |
| 378 | length = (sg_d[i].length - dst_offset); | ||
| 379 | |||
| 380 | pr_debug("Step 1 - sg_d[%d]: %p length: %d" | ||
| 381 | " offset: %u sg_s[%d].length: %u\n", i, | ||
| 382 | &sg_d[i], sg_d[i].length, sg_d[i].offset, j, | ||
| 383 | sg_s[j].length); | ||
| 384 | pr_debug("Step 1 - length: %u dst_offset: %u" | ||
| 385 | " src_offset: %u\n", length, dst_offset, | ||
| 386 | src_offset); | ||
| 387 | |||
| 388 | if (length > req->rd_size) | ||
| 389 | length = req->rd_size; | ||
| 390 | |||
| 391 | dst = sg_virt(&sg_d[i++]) + dst_offset; | ||
| 392 | BUG_ON(!dst); | ||
| 393 | |||
| 394 | src = sg_virt(&sg_s[j]) + src_offset; | ||
| 395 | BUG_ON(!src); | ||
| 396 | |||
| 397 | dst_offset = 0; | ||
| 398 | src_offset = length; | ||
| 399 | page_end = 0; | ||
| 400 | } else { | ||
| 401 | length = (sg_s[j].length - src_offset); | ||
| 402 | |||
| 403 | pr_debug("Step 2 - sg_d[%d]: %p length: %d" | ||
| 404 | " offset: %u sg_s[%d].length: %u\n", i, | ||
| 405 | &sg_d[i], sg_d[i].length, sg_d[i].offset, | ||
| 406 | j, sg_s[j].length); | ||
| 407 | pr_debug("Step 2 - length: %u dst_offset: %u" | ||
| 408 | " src_offset: %u\n", length, dst_offset, | ||
| 409 | src_offset); | ||
| 410 | |||
| 411 | if (length > req->rd_size) | ||
| 412 | length = req->rd_size; | ||
| 413 | |||
| 414 | dst = sg_virt(&sg_d[i]) + dst_offset; | ||
| 415 | BUG_ON(!dst); | ||
| 416 | |||
| 417 | if (sg_d[i].length == length) { | ||
| 418 | i++; | ||
| 419 | dst_offset = 0; | ||
| 420 | } else | ||
| 421 | dst_offset = length; | ||
| 422 | |||
| 423 | src = sg_virt(&sg_s[j++]) + src_offset; | ||
| 424 | BUG_ON(!src); | ||
| 425 | |||
| 426 | src_offset = 0; | ||
| 427 | page_end = 1; | ||
| 428 | } | ||
| 429 | 373 | ||
| 430 | memcpy(dst, src, length); | 374 | sg_miter_next(&m); |
| 375 | len = min((u32)m.length, src_len); | ||
| 376 | m.consumed = len; | ||
| 431 | 377 | ||
| 432 | pr_debug("page: %u, remaining size: %u, length: %u," | 378 | rd_addr = sg_virt(rd_sg) + rd_offset; |
| 433 | " i: %u, j: %u\n", req->rd_page, | ||
| 434 | (req->rd_size - length), length, i, j); | ||
| 435 | 379 | ||
| 436 | req->rd_size -= length; | 380 | if (read_rd) |
| 437 | if (!req->rd_size) | 381 | memcpy(m.addr, rd_addr, len); |
| 438 | return 0; | 382 | else |
| 383 | memcpy(rd_addr, m.addr, len); | ||
| 439 | 384 | ||
| 440 | if (!page_end) | 385 | req->rd_size -= len; |
| 386 | if (!req->rd_size) | ||
| 441 | continue; | 387 | continue; |
| 442 | 388 | ||
| 443 | if (++req->rd_page <= table->page_end_offset) { | 389 | src_len -= len; |
| 444 | pr_debug("page: %u in same page table\n", | 390 | if (src_len) { |
| 445 | req->rd_page); | 391 | rd_offset += len; |
| 446 | continue; | 392 | continue; |
| 447 | } | 393 | } |
| 448 | 394 | ||
| 449 | pr_debug("getting new page table for page: %u\n", | 395 | /* rd page completed, next one please */ |
| 450 | req->rd_page); | 396 | req->rd_page++; |
| 451 | 397 | rd_offset = 0; | |
| 452 | table = rd_get_sg_table(dev, req->rd_page); | 398 | src_len = PAGE_SIZE; |
| 453 | if (!table) | 399 | if (req->rd_page <= table->page_end_offset) { |
| 454 | return -EINVAL; | 400 | rd_sg++; |
| 455 | |||
| 456 | sg_s = &table->sg_table[j = 0]; | ||
| 457 | } | ||
| 458 | |||
| 459 | return 0; | ||
| 460 | } | ||
| 461 | |||
| 462 | /* rd_MEMCPY_write(): | ||
| 463 | * | ||
| 464 | * | ||
| 465 | */ | ||
| 466 | static int rd_MEMCPY_write(struct rd_request *req) | ||
| 467 | { | ||
| 468 | struct se_task *task = &req->rd_task; | ||
| 469 | struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr; | ||
| 470 | struct rd_dev_sg_table *table; | ||
| 471 | struct scatterlist *sg_d, *sg_s; | ||
| 472 | void *dst, *src; | ||
| 473 | u32 i = 0, j = 0, dst_offset = 0, src_offset = 0; | ||
| 474 | u32 length, page_end = 0, table_sg_end; | ||
| 475 | u32 rd_offset = req->rd_offset; | ||
| 476 | |||
| 477 | table = rd_get_sg_table(dev, req->rd_page); | ||
| 478 | if (!table) | ||
| 479 | return -EINVAL; | ||
| 480 | |||
| 481 | table_sg_end = (table->page_end_offset - req->rd_page); | ||
| 482 | sg_d = &table->sg_table[req->rd_page - table->page_start_offset]; | ||
| 483 | sg_s = task->task_sg; | ||
| 484 | |||
| 485 | pr_debug("RD[%d] Write LBA: %llu, Size: %u, Page: %u," | ||
| 486 | " Offset: %u\n", dev->rd_dev_id, task->task_lba, req->rd_size, | ||
| 487 | req->rd_page, req->rd_offset); | ||
| 488 | |||
| 489 | dst_offset = rd_offset; | ||
| 490 | |||
| 491 | while (req->rd_size) { | ||
| 492 | if ((sg_s[i].length - src_offset) < | ||
| 493 | (sg_d[j].length - dst_offset)) { | ||
| 494 | length = (sg_s[i].length - src_offset); | ||
| 495 | |||
| 496 | pr_debug("Step 1 - sg_s[%d]: %p length: %d" | ||
| 497 | " offset: %d sg_d[%d].length: %u\n", i, | ||
| 498 | &sg_s[i], sg_s[i].length, sg_s[i].offset, | ||
| 499 | j, sg_d[j].length); | ||
| 500 | pr_debug("Step 1 - length: %u src_offset: %u" | ||
| 501 | " dst_offset: %u\n", length, src_offset, | ||
| 502 | dst_offset); | ||
| 503 | |||
| 504 | if (length > req->rd_size) | ||
| 505 | length = req->rd_size; | ||
| 506 | |||
| 507 | src = sg_virt(&sg_s[i++]) + src_offset; | ||
| 508 | BUG_ON(!src); | ||
| 509 | |||
| 510 | dst = sg_virt(&sg_d[j]) + dst_offset; | ||
| 511 | BUG_ON(!dst); | ||
| 512 | |||
| 513 | src_offset = 0; | ||
| 514 | dst_offset = length; | ||
| 515 | page_end = 0; | ||
| 516 | } else { | ||
| 517 | length = (sg_d[j].length - dst_offset); | ||
| 518 | |||
| 519 | pr_debug("Step 2 - sg_s[%d]: %p length: %d" | ||
| 520 | " offset: %d sg_d[%d].length: %u\n", i, | ||
| 521 | &sg_s[i], sg_s[i].length, sg_s[i].offset, | ||
| 522 | j, sg_d[j].length); | ||
| 523 | pr_debug("Step 2 - length: %u src_offset: %u" | ||
| 524 | " dst_offset: %u\n", length, src_offset, | ||
| 525 | dst_offset); | ||
| 526 | |||
| 527 | if (length > req->rd_size) | ||
| 528 | length = req->rd_size; | ||
| 529 | |||
| 530 | src = sg_virt(&sg_s[i]) + src_offset; | ||
| 531 | BUG_ON(!src); | ||
| 532 | |||
| 533 | if (sg_s[i].length == length) { | ||
| 534 | i++; | ||
| 535 | src_offset = 0; | ||
| 536 | } else | ||
| 537 | src_offset = length; | ||
| 538 | |||
| 539 | dst = sg_virt(&sg_d[j++]) + dst_offset; | ||
| 540 | BUG_ON(!dst); | ||
| 541 | |||
| 542 | dst_offset = 0; | ||
| 543 | page_end = 1; | ||
| 544 | } | ||
| 545 | |||
| 546 | memcpy(dst, src, length); | ||
| 547 | |||
| 548 | pr_debug("page: %u, remaining size: %u, length: %u," | ||
| 549 | " i: %u, j: %u\n", req->rd_page, | ||
| 550 | (req->rd_size - length), length, i, j); | ||
| 551 | |||
| 552 | req->rd_size -= length; | ||
| 553 | if (!req->rd_size) | ||
| 554 | return 0; | ||
| 555 | |||
| 556 | if (!page_end) | ||
| 557 | continue; | ||
| 558 | |||
| 559 | if (++req->rd_page <= table->page_end_offset) { | ||
| 560 | pr_debug("page: %u in same page table\n", | ||
| 561 | req->rd_page); | ||
| 562 | continue; | 401 | continue; |
| 563 | } | 402 | } |
| 564 | 403 | ||
| 565 | pr_debug("getting new page table for page: %u\n", | ||
| 566 | req->rd_page); | ||
| 567 | |||
| 568 | table = rd_get_sg_table(dev, req->rd_page); | 404 | table = rd_get_sg_table(dev, req->rd_page); |
| 569 | if (!table) | 405 | if (!table) { |
| 406 | sg_miter_stop(&m); | ||
| 570 | return -EINVAL; | 407 | return -EINVAL; |
| 408 | } | ||
| 571 | 409 | ||
| 572 | sg_d = &table->sg_table[j = 0]; | 410 | /* since we increment, the first sg entry is correct */ |
| 411 | rd_sg = table->sg_table; | ||
| 573 | } | 412 | } |
| 574 | 413 | sg_miter_stop(&m); | |
| 575 | return 0; | 414 | return 0; |
| 576 | } | 415 | } |
| 577 | 416 | ||
| @@ -583,28 +422,21 @@ static int rd_MEMCPY_do_task(struct se_task *task) | |||
| 583 | { | 422 | { |
| 584 | struct se_device *dev = task->task_se_cmd->se_dev; | 423 | struct se_device *dev = task->task_se_cmd->se_dev; |
| 585 | struct rd_request *req = RD_REQ(task); | 424 | struct rd_request *req = RD_REQ(task); |
| 586 | unsigned long long lba; | 425 | u64 tmp; |
| 587 | int ret; | 426 | int ret; |
| 588 | 427 | ||
| 589 | req->rd_page = (task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size) / PAGE_SIZE; | 428 | tmp = task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size; |
| 590 | lba = task->task_lba; | 429 | req->rd_offset = do_div(tmp, PAGE_SIZE); |
| 591 | req->rd_offset = (do_div(lba, | 430 | req->rd_page = tmp; |
| 592 | (PAGE_SIZE / dev->se_sub_dev->se_dev_attrib.block_size))) * | ||
| 593 | dev->se_sub_dev->se_dev_attrib.block_size; | ||
| 594 | req->rd_size = task->task_size; | 431 | req->rd_size = task->task_size; |
| 595 | 432 | ||
| 596 | if (task->task_data_direction == DMA_FROM_DEVICE) | 433 | ret = rd_MEMCPY(req, task->task_data_direction == DMA_FROM_DEVICE); |
| 597 | ret = rd_MEMCPY_read(req); | ||
| 598 | else | ||
| 599 | ret = rd_MEMCPY_write(req); | ||
| 600 | |||
| 601 | if (ret != 0) | 434 | if (ret != 0) |
| 602 | return ret; | 435 | return ret; |
| 603 | 436 | ||
| 604 | task->task_scsi_status = GOOD; | 437 | task->task_scsi_status = GOOD; |
| 605 | transport_complete_task(task, 1); | 438 | transport_complete_task(task, 1); |
| 606 | 439 | return 0; | |
| 607 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | ||
| 608 | } | 440 | } |
| 609 | 441 | ||
| 610 | /* rd_free_task(): (Part of se_subsystem_api_t template) | 442 | /* rd_free_task(): (Part of se_subsystem_api_t template) |
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 217e29df6297..684522805a1f 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
| @@ -345,10 +345,6 @@ static void core_tmr_drain_cmd_list( | |||
| 345 | " %d t_fe_count: %d\n", (preempt_and_abort_list) ? | 345 | " %d t_fe_count: %d\n", (preempt_and_abort_list) ? |
| 346 | "Preempt" : "", cmd, cmd->t_state, | 346 | "Preempt" : "", cmd, cmd->t_state, |
| 347 | atomic_read(&cmd->t_fe_count)); | 347 | atomic_read(&cmd->t_fe_count)); |
| 348 | /* | ||
| 349 | * Signal that the command has failed via cmd->se_cmd_flags, | ||
| 350 | */ | ||
| 351 | transport_new_cmd_failure(cmd); | ||
| 352 | 348 | ||
| 353 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, | 349 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, |
| 354 | atomic_read(&cmd->t_fe_count)); | 350 | atomic_read(&cmd->t_fe_count)); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 3400ae6e93f8..0257658e2e3e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
| @@ -61,7 +61,6 @@ | |||
| 61 | static int sub_api_initialized; | 61 | static int sub_api_initialized; |
| 62 | 62 | ||
| 63 | static struct workqueue_struct *target_completion_wq; | 63 | static struct workqueue_struct *target_completion_wq; |
| 64 | static struct kmem_cache *se_cmd_cache; | ||
| 65 | static struct kmem_cache *se_sess_cache; | 64 | static struct kmem_cache *se_sess_cache; |
| 66 | struct kmem_cache *se_tmr_req_cache; | 65 | struct kmem_cache *se_tmr_req_cache; |
| 67 | struct kmem_cache *se_ua_cache; | 66 | struct kmem_cache *se_ua_cache; |
| @@ -82,24 +81,18 @@ static int transport_generic_get_mem(struct se_cmd *cmd); | |||
| 82 | static void transport_put_cmd(struct se_cmd *cmd); | 81 | static void transport_put_cmd(struct se_cmd *cmd); |
| 83 | static void transport_remove_cmd_from_queue(struct se_cmd *cmd); | 82 | static void transport_remove_cmd_from_queue(struct se_cmd *cmd); |
| 84 | static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq); | 83 | static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq); |
| 85 | static void transport_generic_request_failure(struct se_cmd *, int, int); | 84 | static void transport_generic_request_failure(struct se_cmd *); |
| 86 | static void target_complete_ok_work(struct work_struct *work); | 85 | static void target_complete_ok_work(struct work_struct *work); |
| 87 | 86 | ||
| 88 | int init_se_kmem_caches(void) | 87 | int init_se_kmem_caches(void) |
| 89 | { | 88 | { |
| 90 | se_cmd_cache = kmem_cache_create("se_cmd_cache", | ||
| 91 | sizeof(struct se_cmd), __alignof__(struct se_cmd), 0, NULL); | ||
| 92 | if (!se_cmd_cache) { | ||
| 93 | pr_err("kmem_cache_create for struct se_cmd failed\n"); | ||
| 94 | goto out; | ||
| 95 | } | ||
| 96 | se_tmr_req_cache = kmem_cache_create("se_tmr_cache", | 89 | se_tmr_req_cache = kmem_cache_create("se_tmr_cache", |
| 97 | sizeof(struct se_tmr_req), __alignof__(struct se_tmr_req), | 90 | sizeof(struct se_tmr_req), __alignof__(struct se_tmr_req), |
| 98 | 0, NULL); | 91 | 0, NULL); |
| 99 | if (!se_tmr_req_cache) { | 92 | if (!se_tmr_req_cache) { |
| 100 | pr_err("kmem_cache_create() for struct se_tmr_req" | 93 | pr_err("kmem_cache_create() for struct se_tmr_req" |
| 101 | " failed\n"); | 94 | " failed\n"); |
| 102 | goto out_free_cmd_cache; | 95 | goto out; |
| 103 | } | 96 | } |
| 104 | se_sess_cache = kmem_cache_create("se_sess_cache", | 97 | se_sess_cache = kmem_cache_create("se_sess_cache", |
| 105 | sizeof(struct se_session), __alignof__(struct se_session), | 98 | sizeof(struct se_session), __alignof__(struct se_session), |
| @@ -182,8 +175,6 @@ out_free_sess_cache: | |||
| 182 | kmem_cache_destroy(se_sess_cache); | 175 | kmem_cache_destroy(se_sess_cache); |
| 183 | out_free_tmr_req_cache: | 176 | out_free_tmr_req_cache: |
| 184 | kmem_cache_destroy(se_tmr_req_cache); | 177 | kmem_cache_destroy(se_tmr_req_cache); |
| 185 | out_free_cmd_cache: | ||
| 186 | kmem_cache_destroy(se_cmd_cache); | ||
| 187 | out: | 178 | out: |
| 188 | return -ENOMEM; | 179 | return -ENOMEM; |
| 189 | } | 180 | } |
| @@ -191,7 +182,6 @@ out: | |||
| 191 | void release_se_kmem_caches(void) | 182 | void release_se_kmem_caches(void) |
| 192 | { | 183 | { |
| 193 | destroy_workqueue(target_completion_wq); | 184 | destroy_workqueue(target_completion_wq); |
| 194 | kmem_cache_destroy(se_cmd_cache); | ||
| 195 | kmem_cache_destroy(se_tmr_req_cache); | 185 | kmem_cache_destroy(se_tmr_req_cache); |
| 196 | kmem_cache_destroy(se_sess_cache); | 186 | kmem_cache_destroy(se_sess_cache); |
| 197 | kmem_cache_destroy(se_ua_cache); | 187 | kmem_cache_destroy(se_ua_cache); |
| @@ -680,9 +670,9 @@ void transport_complete_sync_cache(struct se_cmd *cmd, int good) | |||
| 680 | task->task_scsi_status = GOOD; | 670 | task->task_scsi_status = GOOD; |
| 681 | } else { | 671 | } else { |
| 682 | task->task_scsi_status = SAM_STAT_CHECK_CONDITION; | 672 | task->task_scsi_status = SAM_STAT_CHECK_CONDITION; |
| 683 | task->task_error_status = PYX_TRANSPORT_ILLEGAL_REQUEST; | 673 | task->task_se_cmd->scsi_sense_reason = |
| 684 | task->task_se_cmd->transport_error_status = | 674 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 685 | PYX_TRANSPORT_ILLEGAL_REQUEST; | 675 | |
| 686 | } | 676 | } |
| 687 | 677 | ||
| 688 | transport_complete_task(task, good); | 678 | transport_complete_task(task, good); |
| @@ -693,7 +683,7 @@ static void target_complete_failure_work(struct work_struct *work) | |||
| 693 | { | 683 | { |
| 694 | struct se_cmd *cmd = container_of(work, struct se_cmd, work); | 684 | struct se_cmd *cmd = container_of(work, struct se_cmd, work); |
| 695 | 685 | ||
| 696 | transport_generic_request_failure(cmd, 1, 1); | 686 | transport_generic_request_failure(cmd); |
| 697 | } | 687 | } |
| 698 | 688 | ||
| 699 | /* transport_complete_task(): | 689 | /* transport_complete_task(): |
| @@ -755,10 +745,11 @@ void transport_complete_task(struct se_task *task, int success) | |||
| 755 | if (cmd->t_tasks_failed) { | 745 | if (cmd->t_tasks_failed) { |
| 756 | if (!task->task_error_status) { | 746 | if (!task->task_error_status) { |
| 757 | task->task_error_status = | 747 | task->task_error_status = |
| 758 | PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 748 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 759 | cmd->transport_error_status = | 749 | cmd->scsi_sense_reason = |
| 760 | PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 750 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 761 | } | 751 | } |
| 752 | |||
| 762 | INIT_WORK(&cmd->work, target_complete_failure_work); | 753 | INIT_WORK(&cmd->work, target_complete_failure_work); |
| 763 | } else { | 754 | } else { |
| 764 | atomic_set(&cmd->t_transport_complete, 1); | 755 | atomic_set(&cmd->t_transport_complete, 1); |
| @@ -1335,23 +1326,17 @@ struct se_device *transport_add_device_to_core_hba( | |||
| 1335 | dev->se_hba = hba; | 1326 | dev->se_hba = hba; |
| 1336 | dev->se_sub_dev = se_dev; | 1327 | dev->se_sub_dev = se_dev; |
| 1337 | dev->transport = transport; | 1328 | dev->transport = transport; |
| 1338 | atomic_set(&dev->active_cmds, 0); | ||
| 1339 | INIT_LIST_HEAD(&dev->dev_list); | 1329 | INIT_LIST_HEAD(&dev->dev_list); |
| 1340 | INIT_LIST_HEAD(&dev->dev_sep_list); | 1330 | INIT_LIST_HEAD(&dev->dev_sep_list); |
| 1341 | INIT_LIST_HEAD(&dev->dev_tmr_list); | 1331 | INIT_LIST_HEAD(&dev->dev_tmr_list); |
| 1342 | INIT_LIST_HEAD(&dev->execute_task_list); | 1332 | INIT_LIST_HEAD(&dev->execute_task_list); |
| 1343 | INIT_LIST_HEAD(&dev->delayed_cmd_list); | 1333 | INIT_LIST_HEAD(&dev->delayed_cmd_list); |
| 1344 | INIT_LIST_HEAD(&dev->ordered_cmd_list); | ||
| 1345 | INIT_LIST_HEAD(&dev->state_task_list); | 1334 | INIT_LIST_HEAD(&dev->state_task_list); |
| 1346 | INIT_LIST_HEAD(&dev->qf_cmd_list); | 1335 | INIT_LIST_HEAD(&dev->qf_cmd_list); |
| 1347 | spin_lock_init(&dev->execute_task_lock); | 1336 | spin_lock_init(&dev->execute_task_lock); |
| 1348 | spin_lock_init(&dev->delayed_cmd_lock); | 1337 | spin_lock_init(&dev->delayed_cmd_lock); |
| 1349 | spin_lock_init(&dev->ordered_cmd_lock); | ||
| 1350 | spin_lock_init(&dev->state_task_lock); | ||
| 1351 | spin_lock_init(&dev->dev_alua_lock); | ||
| 1352 | spin_lock_init(&dev->dev_reservation_lock); | 1338 | spin_lock_init(&dev->dev_reservation_lock); |
| 1353 | spin_lock_init(&dev->dev_status_lock); | 1339 | spin_lock_init(&dev->dev_status_lock); |
| 1354 | spin_lock_init(&dev->dev_status_thr_lock); | ||
| 1355 | spin_lock_init(&dev->se_port_lock); | 1340 | spin_lock_init(&dev->se_port_lock); |
| 1356 | spin_lock_init(&dev->se_tmr_lock); | 1341 | spin_lock_init(&dev->se_tmr_lock); |
| 1357 | spin_lock_init(&dev->qf_cmd_lock); | 1342 | spin_lock_init(&dev->qf_cmd_lock); |
| @@ -1507,7 +1492,6 @@ void transport_init_se_cmd( | |||
| 1507 | { | 1492 | { |
| 1508 | INIT_LIST_HEAD(&cmd->se_lun_node); | 1493 | INIT_LIST_HEAD(&cmd->se_lun_node); |
| 1509 | INIT_LIST_HEAD(&cmd->se_delayed_node); | 1494 | INIT_LIST_HEAD(&cmd->se_delayed_node); |
| 1510 | INIT_LIST_HEAD(&cmd->se_ordered_node); | ||
| 1511 | INIT_LIST_HEAD(&cmd->se_qf_node); | 1495 | INIT_LIST_HEAD(&cmd->se_qf_node); |
| 1512 | INIT_LIST_HEAD(&cmd->se_queue_node); | 1496 | INIT_LIST_HEAD(&cmd->se_queue_node); |
| 1513 | INIT_LIST_HEAD(&cmd->se_cmd_list); | 1497 | INIT_LIST_HEAD(&cmd->se_cmd_list); |
| @@ -1573,6 +1557,8 @@ int transport_generic_allocate_tasks( | |||
| 1573 | pr_err("Received SCSI CDB with command_size: %d that" | 1557 | pr_err("Received SCSI CDB with command_size: %d that" |
| 1574 | " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n", | 1558 | " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n", |
| 1575 | scsi_command_size(cdb), SCSI_MAX_VARLEN_CDB_SIZE); | 1559 | scsi_command_size(cdb), SCSI_MAX_VARLEN_CDB_SIZE); |
| 1560 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
| 1561 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
| 1576 | return -EINVAL; | 1562 | return -EINVAL; |
| 1577 | } | 1563 | } |
| 1578 | /* | 1564 | /* |
| @@ -1588,6 +1574,9 @@ int transport_generic_allocate_tasks( | |||
| 1588 | " %u > sizeof(cmd->__t_task_cdb): %lu ops\n", | 1574 | " %u > sizeof(cmd->__t_task_cdb): %lu ops\n", |
| 1589 | scsi_command_size(cdb), | 1575 | scsi_command_size(cdb), |
| 1590 | (unsigned long)sizeof(cmd->__t_task_cdb)); | 1576 | (unsigned long)sizeof(cmd->__t_task_cdb)); |
| 1577 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
| 1578 | cmd->scsi_sense_reason = | ||
| 1579 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 1591 | return -ENOMEM; | 1580 | return -ENOMEM; |
| 1592 | } | 1581 | } |
| 1593 | } else | 1582 | } else |
| @@ -1658,11 +1647,9 @@ int transport_handle_cdb_direct( | |||
| 1658 | * and call transport_generic_request_failure() if necessary.. | 1647 | * and call transport_generic_request_failure() if necessary.. |
| 1659 | */ | 1648 | */ |
| 1660 | ret = transport_generic_new_cmd(cmd); | 1649 | ret = transport_generic_new_cmd(cmd); |
| 1661 | if (ret < 0) { | 1650 | if (ret < 0) |
| 1662 | cmd->transport_error_status = ret; | 1651 | transport_generic_request_failure(cmd); |
| 1663 | transport_generic_request_failure(cmd, 0, | 1652 | |
| 1664 | (cmd->data_direction != DMA_TO_DEVICE)); | ||
| 1665 | } | ||
| 1666 | return 0; | 1653 | return 0; |
| 1667 | } | 1654 | } |
| 1668 | EXPORT_SYMBOL(transport_handle_cdb_direct); | 1655 | EXPORT_SYMBOL(transport_handle_cdb_direct); |
| @@ -1798,20 +1785,16 @@ static int transport_stop_tasks_for_cmd(struct se_cmd *cmd) | |||
| 1798 | /* | 1785 | /* |
| 1799 | * Handle SAM-esque emulation for generic transport request failures. | 1786 | * Handle SAM-esque emulation for generic transport request failures. |
| 1800 | */ | 1787 | */ |
| 1801 | static void transport_generic_request_failure( | 1788 | static void transport_generic_request_failure(struct se_cmd *cmd) |
| 1802 | struct se_cmd *cmd, | ||
| 1803 | int complete, | ||
| 1804 | int sc) | ||
| 1805 | { | 1789 | { |
| 1806 | int ret = 0; | 1790 | int ret = 0; |
| 1807 | 1791 | ||
| 1808 | pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08x" | 1792 | pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08x" |
| 1809 | " CDB: 0x%02x\n", cmd, cmd->se_tfo->get_task_tag(cmd), | 1793 | " CDB: 0x%02x\n", cmd, cmd->se_tfo->get_task_tag(cmd), |
| 1810 | cmd->t_task_cdb[0]); | 1794 | cmd->t_task_cdb[0]); |
| 1811 | pr_debug("-----[ i_state: %d t_state: %d transport_error_status: %d\n", | 1795 | pr_debug("-----[ i_state: %d t_state: %d scsi_sense_reason: %d\n", |
| 1812 | cmd->se_tfo->get_cmd_state(cmd), | 1796 | cmd->se_tfo->get_cmd_state(cmd), |
| 1813 | cmd->t_state, | 1797 | cmd->t_state, cmd->scsi_sense_reason); |
| 1814 | cmd->transport_error_status); | ||
| 1815 | pr_debug("-----[ t_tasks: %d t_task_cdbs_left: %d" | 1798 | pr_debug("-----[ t_tasks: %d t_task_cdbs_left: %d" |
| 1816 | " t_task_cdbs_sent: %d t_task_cdbs_ex_left: %d --" | 1799 | " t_task_cdbs_sent: %d t_task_cdbs_ex_left: %d --" |
| 1817 | " t_transport_active: %d t_transport_stop: %d" | 1800 | " t_transport_active: %d t_transport_stop: %d" |
| @@ -1829,46 +1812,19 @@ static void transport_generic_request_failure( | |||
| 1829 | if (cmd->se_dev->dev_task_attr_type == SAM_TASK_ATTR_EMULATED) | 1812 | if (cmd->se_dev->dev_task_attr_type == SAM_TASK_ATTR_EMULATED) |
| 1830 | transport_complete_task_attr(cmd); | 1813 | transport_complete_task_attr(cmd); |
| 1831 | 1814 | ||
| 1832 | if (complete) { | 1815 | switch (cmd->scsi_sense_reason) { |
| 1833 | cmd->transport_error_status = PYX_TRANSPORT_LU_COMM_FAILURE; | 1816 | case TCM_NON_EXISTENT_LUN: |
| 1834 | } | 1817 | case TCM_UNSUPPORTED_SCSI_OPCODE: |
| 1835 | 1818 | case TCM_INVALID_CDB_FIELD: | |
| 1836 | switch (cmd->transport_error_status) { | 1819 | case TCM_INVALID_PARAMETER_LIST: |
| 1837 | case PYX_TRANSPORT_UNKNOWN_SAM_OPCODE: | 1820 | case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE: |
| 1838 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; | 1821 | case TCM_UNKNOWN_MODE_PAGE: |
| 1839 | break; | 1822 | case TCM_WRITE_PROTECTED: |
| 1840 | case PYX_TRANSPORT_REQ_TOO_MANY_SECTORS: | 1823 | case TCM_CHECK_CONDITION_ABORT_CMD: |
| 1841 | cmd->scsi_sense_reason = TCM_SECTOR_COUNT_TOO_MANY; | 1824 | case TCM_CHECK_CONDITION_UNIT_ATTENTION: |
| 1842 | break; | 1825 | case TCM_CHECK_CONDITION_NOT_READY: |
| 1843 | case PYX_TRANSPORT_INVALID_CDB_FIELD: | ||
| 1844 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
| 1845 | break; | ||
| 1846 | case PYX_TRANSPORT_INVALID_PARAMETER_LIST: | ||
| 1847 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; | ||
| 1848 | break; | ||
| 1849 | case PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES: | ||
| 1850 | if (!sc) | ||
| 1851 | transport_new_cmd_failure(cmd); | ||
| 1852 | /* | ||
| 1853 | * Currently for PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES, | ||
| 1854 | * we force this session to fall back to session | ||
| 1855 | * recovery. | ||
| 1856 | */ | ||
| 1857 | cmd->se_tfo->fall_back_to_erl0(cmd->se_sess); | ||
| 1858 | cmd->se_tfo->stop_session(cmd->se_sess, 0, 0); | ||
| 1859 | |||
| 1860 | goto check_stop; | ||
| 1861 | case PYX_TRANSPORT_LU_COMM_FAILURE: | ||
| 1862 | case PYX_TRANSPORT_ILLEGAL_REQUEST: | ||
| 1863 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 1864 | break; | ||
| 1865 | case PYX_TRANSPORT_UNKNOWN_MODE_PAGE: | ||
| 1866 | cmd->scsi_sense_reason = TCM_UNKNOWN_MODE_PAGE; | ||
| 1867 | break; | ||
| 1868 | case PYX_TRANSPORT_WRITE_PROTECTED: | ||
| 1869 | cmd->scsi_sense_reason = TCM_WRITE_PROTECTED; | ||
| 1870 | break; | 1826 | break; |
| 1871 | case PYX_TRANSPORT_RESERVATION_CONFLICT: | 1827 | case TCM_RESERVATION_CONFLICT: |
| 1872 | /* | 1828 | /* |
| 1873 | * No SENSE Data payload for this case, set SCSI Status | 1829 | * No SENSE Data payload for this case, set SCSI Status |
| 1874 | * and queue the response to $FABRIC_MOD. | 1830 | * and queue the response to $FABRIC_MOD. |
| @@ -1893,15 +1849,9 @@ static void transport_generic_request_failure( | |||
| 1893 | if (ret == -EAGAIN || ret == -ENOMEM) | 1849 | if (ret == -EAGAIN || ret == -ENOMEM) |
| 1894 | goto queue_full; | 1850 | goto queue_full; |
| 1895 | goto check_stop; | 1851 | goto check_stop; |
| 1896 | case PYX_TRANSPORT_USE_SENSE_REASON: | ||
| 1897 | /* | ||
| 1898 | * struct se_cmd->scsi_sense_reason already set | ||
| 1899 | */ | ||
| 1900 | break; | ||
| 1901 | default: | 1852 | default: |
| 1902 | pr_err("Unknown transport error for CDB 0x%02x: %d\n", | 1853 | pr_err("Unknown transport error for CDB 0x%02x: %d\n", |
| 1903 | cmd->t_task_cdb[0], | 1854 | cmd->t_task_cdb[0], cmd->scsi_sense_reason); |
| 1904 | cmd->transport_error_status); | ||
| 1905 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; | 1855 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
| 1906 | break; | 1856 | break; |
| 1907 | } | 1857 | } |
| @@ -1912,14 +1862,10 @@ static void transport_generic_request_failure( | |||
| 1912 | * transport_send_check_condition_and_sense() after handling | 1862 | * transport_send_check_condition_and_sense() after handling |
| 1913 | * possible unsoliticied write data payloads. | 1863 | * possible unsoliticied write data payloads. |
| 1914 | */ | 1864 | */ |
| 1915 | if (!sc && !cmd->se_tfo->new_cmd_map) | 1865 | ret = transport_send_check_condition_and_sense(cmd, |
| 1916 | transport_new_cmd_failure(cmd); | 1866 | cmd->scsi_sense_reason, 0); |
| 1917 | else { | 1867 | if (ret == -EAGAIN || ret == -ENOMEM) |
| 1918 | ret = transport_send_check_condition_and_sense(cmd, | 1868 | goto queue_full; |
| 1919 | cmd->scsi_sense_reason, 0); | ||
| 1920 | if (ret == -EAGAIN || ret == -ENOMEM) | ||
| 1921 | goto queue_full; | ||
| 1922 | } | ||
| 1923 | 1869 | ||
| 1924 | check_stop: | 1870 | check_stop: |
| 1925 | transport_lun_remove_cmd(cmd); | 1871 | transport_lun_remove_cmd(cmd); |
| @@ -2002,19 +1948,12 @@ static inline int transport_execute_task_attr(struct se_cmd *cmd) | |||
| 2002 | * to allow the passed struct se_cmd list of tasks to the front of the list. | 1948 | * to allow the passed struct se_cmd list of tasks to the front of the list. |
| 2003 | */ | 1949 | */ |
| 2004 | if (cmd->sam_task_attr == MSG_HEAD_TAG) { | 1950 | if (cmd->sam_task_attr == MSG_HEAD_TAG) { |
| 2005 | atomic_inc(&cmd->se_dev->dev_hoq_count); | ||
| 2006 | smp_mb__after_atomic_inc(); | ||
| 2007 | pr_debug("Added HEAD_OF_QUEUE for CDB:" | 1951 | pr_debug("Added HEAD_OF_QUEUE for CDB:" |
| 2008 | " 0x%02x, se_ordered_id: %u\n", | 1952 | " 0x%02x, se_ordered_id: %u\n", |
| 2009 | cmd->t_task_cdb[0], | 1953 | cmd->t_task_cdb[0], |
| 2010 | cmd->se_ordered_id); | 1954 | cmd->se_ordered_id); |
| 2011 | return 1; | 1955 | return 1; |
| 2012 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { | 1956 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { |
| 2013 | spin_lock(&cmd->se_dev->ordered_cmd_lock); | ||
| 2014 | list_add_tail(&cmd->se_ordered_node, | ||
| 2015 | &cmd->se_dev->ordered_cmd_list); | ||
| 2016 | spin_unlock(&cmd->se_dev->ordered_cmd_lock); | ||
| 2017 | |||
| 2018 | atomic_inc(&cmd->se_dev->dev_ordered_sync); | 1957 | atomic_inc(&cmd->se_dev->dev_ordered_sync); |
| 2019 | smp_mb__after_atomic_inc(); | 1958 | smp_mb__after_atomic_inc(); |
| 2020 | 1959 | ||
| @@ -2076,9 +2015,9 @@ static int transport_execute_tasks(struct se_cmd *cmd) | |||
| 2076 | { | 2015 | { |
| 2077 | int add_tasks; | 2016 | int add_tasks; |
| 2078 | 2017 | ||
| 2079 | if (se_dev_check_online(cmd->se_orig_obj_ptr) != 0) { | 2018 | if (se_dev_check_online(cmd->se_dev) != 0) { |
| 2080 | cmd->transport_error_status = PYX_TRANSPORT_LU_COMM_FAILURE; | 2019 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 2081 | transport_generic_request_failure(cmd, 0, 1); | 2020 | transport_generic_request_failure(cmd); |
| 2082 | return 0; | 2021 | return 0; |
| 2083 | } | 2022 | } |
| 2084 | 2023 | ||
| @@ -2163,14 +2102,13 @@ check_depth: | |||
| 2163 | else | 2102 | else |
| 2164 | error = dev->transport->do_task(task); | 2103 | error = dev->transport->do_task(task); |
| 2165 | if (error != 0) { | 2104 | if (error != 0) { |
| 2166 | cmd->transport_error_status = error; | ||
| 2167 | spin_lock_irqsave(&cmd->t_state_lock, flags); | 2105 | spin_lock_irqsave(&cmd->t_state_lock, flags); |
| 2168 | task->task_flags &= ~TF_ACTIVE; | 2106 | task->task_flags &= ~TF_ACTIVE; |
| 2169 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 2107 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
| 2170 | atomic_set(&cmd->t_transport_sent, 0); | 2108 | atomic_set(&cmd->t_transport_sent, 0); |
| 2171 | transport_stop_tasks_for_cmd(cmd); | 2109 | transport_stop_tasks_for_cmd(cmd); |
| 2172 | atomic_inc(&dev->depth_left); | 2110 | atomic_inc(&dev->depth_left); |
| 2173 | transport_generic_request_failure(cmd, 0, 1); | 2111 | transport_generic_request_failure(cmd); |
| 2174 | } | 2112 | } |
| 2175 | 2113 | ||
| 2176 | goto check_depth; | 2114 | goto check_depth; |
| @@ -2178,19 +2116,6 @@ check_depth: | |||
| 2178 | return 0; | 2116 | return 0; |
| 2179 | } | 2117 | } |
| 2180 | 2118 | ||
| 2181 | void transport_new_cmd_failure(struct se_cmd *se_cmd) | ||
| 2182 | { | ||
| 2183 | unsigned long flags; | ||
| 2184 | /* | ||
| 2185 | * Any unsolicited data will get dumped for failed command inside of | ||
| 2186 | * the fabric plugin | ||
| 2187 | */ | ||
| 2188 | spin_lock_irqsave(&se_cmd->t_state_lock, flags); | ||
| 2189 | se_cmd->se_cmd_flags |= SCF_SE_CMD_FAILED; | ||
| 2190 | se_cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
| 2191 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); | ||
| 2192 | } | ||
| 2193 | |||
| 2194 | static inline u32 transport_get_sectors_6( | 2119 | static inline u32 transport_get_sectors_6( |
| 2195 | unsigned char *cdb, | 2120 | unsigned char *cdb, |
| 2196 | struct se_cmd *cmd, | 2121 | struct se_cmd *cmd, |
| @@ -2213,10 +2138,15 @@ static inline u32 transport_get_sectors_6( | |||
| 2213 | 2138 | ||
| 2214 | /* | 2139 | /* |
| 2215 | * Everything else assume TYPE_DISK Sector CDB location. | 2140 | * Everything else assume TYPE_DISK Sector CDB location. |
| 2216 | * Use 8-bit sector value. | 2141 | * Use 8-bit sector value. SBC-3 says: |
| 2142 | * | ||
| 2143 | * A TRANSFER LENGTH field set to zero specifies that 256 | ||
| 2144 | * logical blocks shall be written. Any other value | ||
| 2145 | * specifies the number of logical blocks that shall be | ||
| 2146 | * written. | ||
| 2217 | */ | 2147 | */ |
| 2218 | type_disk: | 2148 | type_disk: |
| 2219 | return (u32)cdb[4]; | 2149 | return cdb[4] ? : 256; |
| 2220 | } | 2150 | } |
| 2221 | 2151 | ||
| 2222 | static inline u32 transport_get_sectors_10( | 2152 | static inline u32 transport_get_sectors_10( |
| @@ -2460,27 +2390,6 @@ static int transport_get_sense_data(struct se_cmd *cmd) | |||
| 2460 | return -1; | 2390 | return -1; |
| 2461 | } | 2391 | } |
| 2462 | 2392 | ||
| 2463 | static int | ||
| 2464 | transport_handle_reservation_conflict(struct se_cmd *cmd) | ||
| 2465 | { | ||
| 2466 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
| 2467 | cmd->se_cmd_flags |= SCF_SCSI_RESERVATION_CONFLICT; | ||
| 2468 | cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT; | ||
| 2469 | /* | ||
| 2470 | * For UA Interlock Code 11b, a RESERVATION CONFLICT will | ||
| 2471 | * establish a UNIT ATTENTION with PREVIOUS RESERVATION | ||
| 2472 | * CONFLICT STATUS. | ||
| 2473 | * | ||
| 2474 | * See spc4r17, section 7.4.6 Control Mode Page, Table 349 | ||
| 2475 | */ | ||
| 2476 | if (cmd->se_sess && | ||
| 2477 | cmd->se_dev->se_sub_dev->se_dev_attrib.emulate_ua_intlck_ctrl == 2) | ||
| 2478 | core_scsi3_ua_allocate(cmd->se_sess->se_node_acl, | ||
| 2479 | cmd->orig_fe_lun, 0x2C, | ||
| 2480 | ASCQ_2CH_PREVIOUS_RESERVATION_CONFLICT_STATUS); | ||
| 2481 | return -EINVAL; | ||
| 2482 | } | ||
| 2483 | |||
| 2484 | static inline long long transport_dev_end_lba(struct se_device *dev) | 2393 | static inline long long transport_dev_end_lba(struct se_device *dev) |
| 2485 | { | 2394 | { |
| 2486 | return dev->transport->get_blocks(dev) + 1; | 2395 | return dev->transport->get_blocks(dev) + 1; |
| @@ -2595,8 +2504,12 @@ static int transport_generic_cmd_sequencer( | |||
| 2595 | */ | 2504 | */ |
| 2596 | if (su_dev->t10_pr.pr_ops.t10_reservation_check(cmd, &pr_reg_type) != 0) { | 2505 | if (su_dev->t10_pr.pr_ops.t10_reservation_check(cmd, &pr_reg_type) != 0) { |
| 2597 | if (su_dev->t10_pr.pr_ops.t10_seq_non_holder( | 2506 | if (su_dev->t10_pr.pr_ops.t10_seq_non_holder( |
| 2598 | cmd, cdb, pr_reg_type) != 0) | 2507 | cmd, cdb, pr_reg_type) != 0) { |
| 2599 | return transport_handle_reservation_conflict(cmd); | 2508 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; |
| 2509 | cmd->se_cmd_flags |= SCF_SCSI_RESERVATION_CONFLICT; | ||
| 2510 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; | ||
| 2511 | return -EBUSY; | ||
| 2512 | } | ||
| 2600 | /* | 2513 | /* |
| 2601 | * This means the CDB is allowed for the SCSI Initiator port | 2514 | * This means the CDB is allowed for the SCSI Initiator port |
| 2602 | * when said port is *NOT* holding the legacy SPC-2 or | 2515 | * when said port is *NOT* holding the legacy SPC-2 or |
| @@ -2658,7 +2571,8 @@ static int transport_generic_cmd_sequencer( | |||
| 2658 | goto out_unsupported_cdb; | 2571 | goto out_unsupported_cdb; |
| 2659 | size = transport_get_size(sectors, cdb, cmd); | 2572 | size = transport_get_size(sectors, cdb, cmd); |
| 2660 | cmd->t_task_lba = transport_lba_32(cdb); | 2573 | cmd->t_task_lba = transport_lba_32(cdb); |
| 2661 | cmd->t_tasks_fua = (cdb[1] & 0x8); | 2574 | if (cdb[1] & 0x8) |
| 2575 | cmd->se_cmd_flags |= SCF_FUA; | ||
| 2662 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; | 2576 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; |
| 2663 | break; | 2577 | break; |
| 2664 | case WRITE_12: | 2578 | case WRITE_12: |
| @@ -2667,7 +2581,8 @@ static int transport_generic_cmd_sequencer( | |||
| 2667 | goto out_unsupported_cdb; | 2581 | goto out_unsupported_cdb; |
| 2668 | size = transport_get_size(sectors, cdb, cmd); | 2582 | size = transport_get_size(sectors, cdb, cmd); |
| 2669 | cmd->t_task_lba = transport_lba_32(cdb); | 2583 | cmd->t_task_lba = transport_lba_32(cdb); |
| 2670 | cmd->t_tasks_fua = (cdb[1] & 0x8); | 2584 | if (cdb[1] & 0x8) |
| 2585 | cmd->se_cmd_flags |= SCF_FUA; | ||
| 2671 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; | 2586 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; |
| 2672 | break; | 2587 | break; |
| 2673 | case WRITE_16: | 2588 | case WRITE_16: |
| @@ -2676,12 +2591,13 @@ static int transport_generic_cmd_sequencer( | |||
| 2676 | goto out_unsupported_cdb; | 2591 | goto out_unsupported_cdb; |
| 2677 | size = transport_get_size(sectors, cdb, cmd); | 2592 | size = transport_get_size(sectors, cdb, cmd); |
| 2678 | cmd->t_task_lba = transport_lba_64(cdb); | 2593 | cmd->t_task_lba = transport_lba_64(cdb); |
| 2679 | cmd->t_tasks_fua = (cdb[1] & 0x8); | 2594 | if (cdb[1] & 0x8) |
| 2595 | cmd->se_cmd_flags |= SCF_FUA; | ||
| 2680 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; | 2596 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; |
| 2681 | break; | 2597 | break; |
| 2682 | case XDWRITEREAD_10: | 2598 | case XDWRITEREAD_10: |
| 2683 | if ((cmd->data_direction != DMA_TO_DEVICE) || | 2599 | if ((cmd->data_direction != DMA_TO_DEVICE) || |
| 2684 | !(cmd->t_tasks_bidi)) | 2600 | !(cmd->se_cmd_flags & SCF_BIDI)) |
| 2685 | goto out_invalid_cdb_field; | 2601 | goto out_invalid_cdb_field; |
| 2686 | sectors = transport_get_sectors_10(cdb, cmd, §or_ret); | 2602 | sectors = transport_get_sectors_10(cdb, cmd, §or_ret); |
| 2687 | if (sector_ret) | 2603 | if (sector_ret) |
| @@ -2700,7 +2616,8 @@ static int transport_generic_cmd_sequencer( | |||
| 2700 | * Setup BIDI XOR callback to be run after I/O completion. | 2616 | * Setup BIDI XOR callback to be run after I/O completion. |
| 2701 | */ | 2617 | */ |
| 2702 | cmd->transport_complete_callback = &transport_xor_callback; | 2618 | cmd->transport_complete_callback = &transport_xor_callback; |
| 2703 | cmd->t_tasks_fua = (cdb[1] & 0x8); | 2619 | if (cdb[1] & 0x8) |
| 2620 | cmd->se_cmd_flags |= SCF_FUA; | ||
| 2704 | break; | 2621 | break; |
| 2705 | case VARIABLE_LENGTH_CMD: | 2622 | case VARIABLE_LENGTH_CMD: |
| 2706 | service_action = get_unaligned_be16(&cdb[8]); | 2623 | service_action = get_unaligned_be16(&cdb[8]); |
| @@ -2728,7 +2645,8 @@ static int transport_generic_cmd_sequencer( | |||
| 2728 | * completion. | 2645 | * completion. |
| 2729 | */ | 2646 | */ |
| 2730 | cmd->transport_complete_callback = &transport_xor_callback; | 2647 | cmd->transport_complete_callback = &transport_xor_callback; |
| 2731 | cmd->t_tasks_fua = (cdb[10] & 0x8); | 2648 | if (cdb[1] & 0x8) |
| 2649 | cmd->se_cmd_flags |= SCF_FUA; | ||
| 2732 | break; | 2650 | break; |
| 2733 | case WRITE_SAME_32: | 2651 | case WRITE_SAME_32: |
| 2734 | sectors = transport_get_sectors_32(cdb, cmd, §or_ret); | 2652 | sectors = transport_get_sectors_32(cdb, cmd, §or_ret); |
| @@ -3171,18 +3089,13 @@ static void transport_complete_task_attr(struct se_cmd *cmd) | |||
| 3171 | " SIMPLE: %u\n", dev->dev_cur_ordered_id, | 3089 | " SIMPLE: %u\n", dev->dev_cur_ordered_id, |
| 3172 | cmd->se_ordered_id); | 3090 | cmd->se_ordered_id); |
| 3173 | } else if (cmd->sam_task_attr == MSG_HEAD_TAG) { | 3091 | } else if (cmd->sam_task_attr == MSG_HEAD_TAG) { |
| 3174 | atomic_dec(&dev->dev_hoq_count); | ||
| 3175 | smp_mb__after_atomic_dec(); | ||
| 3176 | dev->dev_cur_ordered_id++; | 3092 | dev->dev_cur_ordered_id++; |
| 3177 | pr_debug("Incremented dev_cur_ordered_id: %u for" | 3093 | pr_debug("Incremented dev_cur_ordered_id: %u for" |
| 3178 | " HEAD_OF_QUEUE: %u\n", dev->dev_cur_ordered_id, | 3094 | " HEAD_OF_QUEUE: %u\n", dev->dev_cur_ordered_id, |
| 3179 | cmd->se_ordered_id); | 3095 | cmd->se_ordered_id); |
| 3180 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { | 3096 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { |
| 3181 | spin_lock(&dev->ordered_cmd_lock); | ||
| 3182 | list_del(&cmd->se_ordered_node); | ||
| 3183 | atomic_dec(&dev->dev_ordered_sync); | 3097 | atomic_dec(&dev->dev_ordered_sync); |
| 3184 | smp_mb__after_atomic_dec(); | 3098 | smp_mb__after_atomic_dec(); |
| 3185 | spin_unlock(&dev->ordered_cmd_lock); | ||
| 3186 | 3099 | ||
| 3187 | dev->dev_cur_ordered_id++; | 3100 | dev->dev_cur_ordered_id++; |
| 3188 | pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED:" | 3101 | pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED:" |
| @@ -3495,6 +3408,18 @@ int transport_generic_map_mem_to_cmd( | |||
| 3495 | 3408 | ||
| 3496 | if ((cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) || | 3409 | if ((cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) || |
| 3497 | (cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB)) { | 3410 | (cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB)) { |
| 3411 | /* | ||
| 3412 | * Reject SCSI data overflow with map_mem_to_cmd() as incoming | ||
| 3413 | * scatterlists already have been set to follow what the fabric | ||
| 3414 | * passes for the original expected data transfer length. | ||
| 3415 | */ | ||
| 3416 | if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { | ||
| 3417 | pr_warn("Rejecting SCSI DATA overflow for fabric using" | ||
| 3418 | " SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC\n"); | ||
| 3419 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
| 3420 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
| 3421 | return -EINVAL; | ||
| 3422 | } | ||
| 3498 | 3423 | ||
| 3499 | cmd->t_data_sg = sgl; | 3424 | cmd->t_data_sg = sgl; |
| 3500 | cmd->t_data_nents = sgl_count; | 3425 | cmd->t_data_nents = sgl_count; |
| @@ -3813,7 +3738,7 @@ int transport_generic_new_cmd(struct se_cmd *cmd) | |||
| 3813 | cmd->data_length) { | 3738 | cmd->data_length) { |
| 3814 | ret = transport_generic_get_mem(cmd); | 3739 | ret = transport_generic_get_mem(cmd); |
| 3815 | if (ret < 0) | 3740 | if (ret < 0) |
| 3816 | return ret; | 3741 | goto out_fail; |
| 3817 | } | 3742 | } |
| 3818 | 3743 | ||
| 3819 | /* | 3744 | /* |
| @@ -3842,8 +3767,15 @@ int transport_generic_new_cmd(struct se_cmd *cmd) | |||
| 3842 | task_cdbs = transport_allocate_control_task(cmd); | 3767 | task_cdbs = transport_allocate_control_task(cmd); |
| 3843 | } | 3768 | } |
| 3844 | 3769 | ||
| 3845 | if (task_cdbs <= 0) | 3770 | if (task_cdbs < 0) |
| 3846 | goto out_fail; | 3771 | goto out_fail; |
| 3772 | else if (!task_cdbs && (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) { | ||
| 3773 | cmd->t_state = TRANSPORT_COMPLETE; | ||
| 3774 | atomic_set(&cmd->t_transport_active, 1); | ||
| 3775 | INIT_WORK(&cmd->work, target_complete_ok_work); | ||
| 3776 | queue_work(target_completion_wq, &cmd->work); | ||
| 3777 | return 0; | ||
| 3778 | } | ||
| 3847 | 3779 | ||
| 3848 | if (set_counts) { | 3780 | if (set_counts) { |
| 3849 | atomic_inc(&cmd->t_fe_count); | 3781 | atomic_inc(&cmd->t_fe_count); |
| @@ -3929,7 +3861,7 @@ static int transport_generic_write_pending(struct se_cmd *cmd) | |||
| 3929 | else if (ret < 0) | 3861 | else if (ret < 0) |
| 3930 | return ret; | 3862 | return ret; |
| 3931 | 3863 | ||
| 3932 | return PYX_TRANSPORT_WRITE_PENDING; | 3864 | return 1; |
| 3933 | 3865 | ||
| 3934 | queue_full: | 3866 | queue_full: |
| 3935 | pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd); | 3867 | pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd); |
| @@ -4602,9 +4534,6 @@ void transport_send_task_abort(struct se_cmd *cmd) | |||
| 4602 | if (cmd->se_tfo->write_pending_status(cmd) != 0) { | 4534 | if (cmd->se_tfo->write_pending_status(cmd) != 0) { |
| 4603 | atomic_inc(&cmd->t_transport_aborted); | 4535 | atomic_inc(&cmd->t_transport_aborted); |
| 4604 | smp_mb__after_atomic_inc(); | 4536 | smp_mb__after_atomic_inc(); |
| 4605 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; | ||
| 4606 | transport_new_cmd_failure(cmd); | ||
| 4607 | return; | ||
| 4608 | } | 4537 | } |
| 4609 | } | 4538 | } |
| 4610 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; | 4539 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; |
| @@ -4670,8 +4599,6 @@ static int transport_processing_thread(void *param) | |||
| 4670 | struct se_cmd *cmd; | 4599 | struct se_cmd *cmd; |
| 4671 | struct se_device *dev = (struct se_device *) param; | 4600 | struct se_device *dev = (struct se_device *) param; |
| 4672 | 4601 | ||
| 4673 | set_user_nice(current, -20); | ||
| 4674 | |||
| 4675 | while (!kthread_should_stop()) { | 4602 | while (!kthread_should_stop()) { |
| 4676 | ret = wait_event_interruptible(dev->dev_queue_obj.thread_wq, | 4603 | ret = wait_event_interruptible(dev->dev_queue_obj.thread_wq, |
| 4677 | atomic_read(&dev->dev_queue_obj.queue_cnt) || | 4604 | atomic_read(&dev->dev_queue_obj.queue_cnt) || |
| @@ -4698,18 +4625,13 @@ get_cmd: | |||
| 4698 | } | 4625 | } |
| 4699 | ret = cmd->se_tfo->new_cmd_map(cmd); | 4626 | ret = cmd->se_tfo->new_cmd_map(cmd); |
| 4700 | if (ret < 0) { | 4627 | if (ret < 0) { |
| 4701 | cmd->transport_error_status = ret; | 4628 | transport_generic_request_failure(cmd); |
| 4702 | transport_generic_request_failure(cmd, | ||
| 4703 | 0, (cmd->data_direction != | ||
| 4704 | DMA_TO_DEVICE)); | ||
| 4705 | break; | 4629 | break; |
| 4706 | } | 4630 | } |
| 4707 | ret = transport_generic_new_cmd(cmd); | 4631 | ret = transport_generic_new_cmd(cmd); |
| 4708 | if (ret < 0) { | 4632 | if (ret < 0) { |
| 4709 | cmd->transport_error_status = ret; | 4633 | transport_generic_request_failure(cmd); |
| 4710 | transport_generic_request_failure(cmd, | 4634 | break; |
| 4711 | 0, (cmd->data_direction != | ||
| 4712 | DMA_TO_DEVICE)); | ||
| 4713 | } | 4635 | } |
| 4714 | break; | 4636 | break; |
| 4715 | case TRANSPORT_PROCESS_WRITE: | 4637 | case TRANSPORT_PROCESS_WRITE: |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 4fac37c4c615..71fc9cea5dc9 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
| @@ -200,7 +200,7 @@ int ft_write_pending(struct se_cmd *se_cmd) | |||
| 200 | lport = ep->lp; | 200 | lport = ep->lp; |
| 201 | fp = fc_frame_alloc(lport, sizeof(*txrdy)); | 201 | fp = fc_frame_alloc(lport, sizeof(*txrdy)); |
| 202 | if (!fp) | 202 | if (!fp) |
| 203 | return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 203 | return -ENOMEM; /* Signal QUEUE_FULL */ |
| 204 | 204 | ||
| 205 | txrdy = fc_frame_payload_get(fp, sizeof(*txrdy)); | 205 | txrdy = fc_frame_payload_get(fp, sizeof(*txrdy)); |
| 206 | memset(txrdy, 0, sizeof(*txrdy)); | 206 | memset(txrdy, 0, sizeof(*txrdy)); |
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index 5f770412ca40..9402b7387cac 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c | |||
| @@ -436,8 +436,7 @@ static void ft_del_lport(struct se_wwn *wwn) | |||
| 436 | struct ft_lport_acl *lacl = container_of(wwn, | 436 | struct ft_lport_acl *lacl = container_of(wwn, |
| 437 | struct ft_lport_acl, fc_lport_wwn); | 437 | struct ft_lport_acl, fc_lport_wwn); |
| 438 | 438 | ||
| 439 | pr_debug("del lport %s\n", | 439 | pr_debug("del lport %s\n", lacl->name); |
| 440 | config_item_name(&wwn->wwn_group.cg_item)); | ||
| 441 | mutex_lock(&ft_lport_lock); | 440 | mutex_lock(&ft_lport_lock); |
| 442 | list_del(&lacl->list); | 441 | list_del(&lacl->list); |
| 443 | mutex_unlock(&ft_lport_lock); | 442 | mutex_unlock(&ft_lport_lock); |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e8c564a53346..a8078d0638fa 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -1458,6 +1458,16 @@ static const struct usb_device_id acm_ids[] = { | |||
| 1458 | }, | 1458 | }, |
| 1459 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ | 1459 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ |
| 1460 | }, | 1460 | }, |
| 1461 | /* Motorola H24 HSPA module: */ | ||
| 1462 | { USB_DEVICE(0x22b8, 0x2d91) }, /* modem */ | ||
| 1463 | { USB_DEVICE(0x22b8, 0x2d92) }, /* modem + diagnostics */ | ||
| 1464 | { USB_DEVICE(0x22b8, 0x2d93) }, /* modem + AT port */ | ||
| 1465 | { USB_DEVICE(0x22b8, 0x2d95) }, /* modem + AT port + diagnostics */ | ||
| 1466 | { USB_DEVICE(0x22b8, 0x2d96) }, /* modem + NMEA */ | ||
| 1467 | { USB_DEVICE(0x22b8, 0x2d97) }, /* modem + diagnostics + NMEA */ | ||
| 1468 | { USB_DEVICE(0x22b8, 0x2d99) }, /* modem + AT port + NMEA */ | ||
| 1469 | { USB_DEVICE(0x22b8, 0x2d9a) }, /* modem + AT port + diagnostics + NMEA */ | ||
| 1470 | |||
| 1461 | { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ | 1471 | { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ |
| 1462 | .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on | 1472 | .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on |
| 1463 | data interface instead of | 1473 | data interface instead of |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 717ebc9ff941..600d82348511 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
| @@ -264,7 +264,7 @@ static int __devinit dwc3_core_init(struct dwc3 *dwc) | |||
| 264 | ret = -ENODEV; | 264 | ret = -ENODEV; |
| 265 | goto err0; | 265 | goto err0; |
| 266 | } | 266 | } |
| 267 | dwc->revision = reg & DWC3_GSNPSREV_MASK; | 267 | dwc->revision = reg; |
| 268 | 268 | ||
| 269 | dwc3_core_soft_reset(dwc); | 269 | dwc3_core_soft_reset(dwc); |
| 270 | 270 | ||
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 596a0b464e61..4dff83d2f265 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c | |||
| @@ -130,9 +130,6 @@ ep_matches ( | |||
| 130 | num_req_streams = ep_comp->bmAttributes & 0x1f; | 130 | num_req_streams = ep_comp->bmAttributes & 0x1f; |
| 131 | if (num_req_streams > ep->max_streams) | 131 | if (num_req_streams > ep->max_streams) |
| 132 | return 0; | 132 | return 0; |
| 133 | /* Update the ep_comp descriptor if needed */ | ||
| 134 | if (num_req_streams != ep->max_streams) | ||
| 135 | ep_comp->bmAttributes = ep->max_streams; | ||
| 136 | } | 133 | } |
| 137 | 134 | ||
| 138 | } | 135 | } |
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index c39d58860fa0..1a6f415c0d02 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
| @@ -2975,6 +2975,7 @@ static void fsg_unbind(struct usb_configuration *c, struct usb_function *f) | |||
| 2975 | fsg_common_put(common); | 2975 | fsg_common_put(common); |
| 2976 | usb_free_descriptors(fsg->function.descriptors); | 2976 | usb_free_descriptors(fsg->function.descriptors); |
| 2977 | usb_free_descriptors(fsg->function.hs_descriptors); | 2977 | usb_free_descriptors(fsg->function.hs_descriptors); |
| 2978 | usb_free_descriptors(fsg->function.ss_descriptors); | ||
| 2978 | kfree(fsg); | 2979 | kfree(fsg); |
| 2979 | } | 2980 | } |
| 2980 | 2981 | ||
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index a7dc1e1d45f2..2ac4ac2e4ef9 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include "isp1760-hcd.h" | 19 | #include "isp1760-hcd.h" |
| 20 | 20 | ||
| 21 | #ifdef CONFIG_OF | 21 | #if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
| 24 | #include <linux/of_platform.h> | 24 | #include <linux/of_platform.h> |
| @@ -31,7 +31,7 @@ | |||
| 31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | #ifdef CONFIG_OF | 34 | #if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) |
| 35 | struct isp1760 { | 35 | struct isp1760 { |
| 36 | struct usb_hcd *hcd; | 36 | struct usb_hcd *hcd; |
| 37 | int rst_gpio; | 37 | int rst_gpio; |
| @@ -437,7 +437,7 @@ static int __init isp1760_init(void) | |||
| 437 | ret = platform_driver_register(&isp1760_plat_driver); | 437 | ret = platform_driver_register(&isp1760_plat_driver); |
| 438 | if (!ret) | 438 | if (!ret) |
| 439 | any_ret = 0; | 439 | any_ret = 0; |
| 440 | #ifdef CONFIG_OF | 440 | #if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) |
| 441 | ret = platform_driver_register(&isp1760_of_driver); | 441 | ret = platform_driver_register(&isp1760_of_driver); |
| 442 | if (!ret) | 442 | if (!ret) |
| 443 | any_ret = 0; | 443 | any_ret = 0; |
| @@ -457,7 +457,7 @@ module_init(isp1760_init); | |||
| 457 | static void __exit isp1760_exit(void) | 457 | static void __exit isp1760_exit(void) |
| 458 | { | 458 | { |
| 459 | platform_driver_unregister(&isp1760_plat_driver); | 459 | platform_driver_unregister(&isp1760_plat_driver); |
| 460 | #ifdef CONFIG_OF | 460 | #if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) |
| 461 | platform_driver_unregister(&isp1760_of_driver); | 461 | platform_driver_unregister(&isp1760_of_driver); |
| 462 | #endif | 462 | #endif |
| 463 | #ifdef CONFIG_PCI | 463 | #ifdef CONFIG_PCI |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 60ddba8066ea..79cb0af779fa 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
| @@ -774,6 +774,10 @@ static void musb_ep_program(struct musb *musb, u8 epnum, | |||
| 774 | if (musb->double_buffer_not_ok) | 774 | if (musb->double_buffer_not_ok) |
| 775 | musb_writew(epio, MUSB_TXMAXP, | 775 | musb_writew(epio, MUSB_TXMAXP, |
| 776 | hw_ep->max_packet_sz_tx); | 776 | hw_ep->max_packet_sz_tx); |
| 777 | else if (can_bulk_split(musb, qh->type)) | ||
| 778 | musb_writew(epio, MUSB_TXMAXP, packet_sz | ||
| 779 | | ((hw_ep->max_packet_sz_tx / | ||
| 780 | packet_sz) - 1) << 11); | ||
| 777 | else | 781 | else |
| 778 | musb_writew(epio, MUSB_TXMAXP, | 782 | musb_writew(epio, MUSB_TXMAXP, |
| 779 | qh->maxpacket | | 783 | qh->maxpacket | |
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c index 053f86d70009..ad96a3896729 100644 --- a/drivers/usb/renesas_usbhs/mod.c +++ b/drivers/usb/renesas_usbhs/mod.c | |||
| @@ -349,7 +349,7 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod) | |||
| 349 | if (mod->irq_attch) | 349 | if (mod->irq_attch) |
| 350 | intenb1 |= ATTCHE; | 350 | intenb1 |= ATTCHE; |
| 351 | 351 | ||
| 352 | if (mod->irq_attch) | 352 | if (mod->irq_dtch) |
| 353 | intenb1 |= DTCHE; | 353 | intenb1 |= DTCHE; |
| 354 | 354 | ||
| 355 | if (mod->irq_sign) | 355 | if (mod->irq_sign) |
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index bade761a1e52..7955de589951 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c | |||
| @@ -1267,6 +1267,7 @@ int usbhs_mod_host_probe(struct usbhs_priv *priv) | |||
| 1267 | dev_err(dev, "Failed to create hcd\n"); | 1267 | dev_err(dev, "Failed to create hcd\n"); |
| 1268 | return -ENOMEM; | 1268 | return -ENOMEM; |
| 1269 | } | 1269 | } |
| 1270 | hcd->has_tt = 1; /* for low/full speed */ | ||
| 1270 | 1271 | ||
| 1271 | pipe_info = kzalloc(sizeof(*pipe_info) * pipe_size, GFP_KERNEL); | 1272 | pipe_info = kzalloc(sizeof(*pipe_info) * pipe_size, GFP_KERNEL); |
| 1272 | if (!pipe_info) { | 1273 | if (!pipe_info) { |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e3426602dc82..6dd64534fad0 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -663,7 +663,12 @@ static const struct usb_device_id option_ids[] = { | |||
| 663 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) }, | 663 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) }, |
| 664 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x02) }, | 664 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x02) }, |
| 665 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x03) }, | 665 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x03) }, |
| 666 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x08) }, | 666 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x10) }, |
| 667 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x12) }, | ||
| 668 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x13) }, | ||
| 669 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x01) }, /* E398 3G Modem */ | ||
| 670 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x02) }, /* E398 3G PC UI Interface */ | ||
| 671 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x03) }, /* E398 3G Application Interface */ | ||
| 667 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, | 672 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, |
| 668 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, | 673 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, |
| 669 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, | 674 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, |
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 8e964b91c447..284798aaf8b1 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
| @@ -166,7 +166,7 @@ retry: | |||
| 166 | /* | 166 | /* |
| 167 | * Get IO TLB memory from any location. | 167 | * Get IO TLB memory from any location. |
| 168 | */ | 168 | */ |
| 169 | xen_io_tlb_start = alloc_bootmem(bytes); | 169 | xen_io_tlb_start = alloc_bootmem_pages(PAGE_ALIGN(bytes)); |
| 170 | if (!xen_io_tlb_start) { | 170 | if (!xen_io_tlb_start) { |
| 171 | m = "Cannot allocate Xen-SWIOTLB buffer!\n"; | 171 | m = "Cannot allocate Xen-SWIOTLB buffer!\n"; |
| 172 | goto error; | 172 | goto error; |
| @@ -179,7 +179,7 @@ retry: | |||
| 179 | bytes, | 179 | bytes, |
| 180 | xen_io_tlb_nslabs); | 180 | xen_io_tlb_nslabs); |
| 181 | if (rc) { | 181 | if (rc) { |
| 182 | free_bootmem(__pa(xen_io_tlb_start), bytes); | 182 | free_bootmem(__pa(xen_io_tlb_start), PAGE_ALIGN(bytes)); |
| 183 | m = "Failed to get contiguous memory for DMA from Xen!\n"\ | 183 | m = "Failed to get contiguous memory for DMA from Xen!\n"\ |
| 184 | "You either: don't have the permissions, do not have"\ | 184 | "You either: don't have the permissions, do not have"\ |
| 185 | " enough free memory under 4GB, or the hypervisor memory"\ | 185 | " enough free memory under 4GB, or the hypervisor memory"\ |
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index b3b8f2f3ad10..ede860f921df 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c | |||
| @@ -621,15 +621,6 @@ static struct xenbus_watch *find_watch(const char *token) | |||
| 621 | return NULL; | 621 | return NULL; |
| 622 | } | 622 | } |
| 623 | 623 | ||
| 624 | static void xs_reset_watches(void) | ||
| 625 | { | ||
| 626 | int err; | ||
| 627 | |||
| 628 | err = xs_error(xs_single(XBT_NIL, XS_RESET_WATCHES, "", NULL)); | ||
| 629 | if (err && err != -EEXIST) | ||
| 630 | printk(KERN_WARNING "xs_reset_watches failed: %d\n", err); | ||
| 631 | } | ||
| 632 | |||
| 633 | /* Register callback to watch this node. */ | 624 | /* Register callback to watch this node. */ |
| 634 | int register_xenbus_watch(struct xenbus_watch *watch) | 625 | int register_xenbus_watch(struct xenbus_watch *watch) |
| 635 | { | 626 | { |
| @@ -906,9 +897,5 @@ int xs_init(void) | |||
| 906 | if (IS_ERR(task)) | 897 | if (IS_ERR(task)) |
| 907 | return PTR_ERR(task); | 898 | return PTR_ERR(task); |
| 908 | 899 | ||
| 909 | /* shutdown watches for kexec boot */ | ||
| 910 | if (xen_hvm_domain()) | ||
| 911 | xs_reset_watches(); | ||
| 912 | |||
| 913 | return 0; | 900 | return 0; |
| 914 | } | 901 | } |
diff --git a/firmware/README.AddingFirmware b/firmware/README.AddingFirmware index e24cd8986d8b..ea78c3a17eec 100644 --- a/firmware/README.AddingFirmware +++ b/firmware/README.AddingFirmware | |||
| @@ -12,7 +12,7 @@ here. | |||
| 12 | This directory is _NOT_ for adding arbitrary new firmware images. The | 12 | This directory is _NOT_ for adding arbitrary new firmware images. The |
| 13 | place to add those is the separate linux-firmware repository: | 13 | place to add those is the separate linux-firmware repository: |
| 14 | 14 | ||
| 15 | git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git | 15 | git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git |
| 16 | 16 | ||
| 17 | That repository contains all these firmware images which have been | 17 | That repository contains all these firmware images which have been |
| 18 | extracted from older drivers, as well various new firmware images which | 18 | extracted from older drivers, as well various new firmware images which |
| @@ -22,6 +22,7 @@ been permitted to redistribute under separate cover. | |||
| 22 | To submit firmware to that repository, please send either a git binary | 22 | To submit firmware to that repository, please send either a git binary |
| 23 | diff or preferably a git pull request to: | 23 | diff or preferably a git pull request to: |
| 24 | David Woodhouse <dwmw2@infradead.org> | 24 | David Woodhouse <dwmw2@infradead.org> |
| 25 | Ben Hutchings <ben@decadent.org.uk> | ||
| 25 | 26 | ||
| 26 | Your commit should include an update to the WHENCE file clearly | 27 | Your commit should include an update to the WHENCE file clearly |
| 27 | identifying the licence under which the firmware is available, and | 28 | identifying the licence under which the firmware is available, and |
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 7ec14097fef1..0b394580d860 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c | |||
| @@ -64,6 +64,8 @@ struct btrfs_worker_thread { | |||
| 64 | int idle; | 64 | int idle; |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | static int __btrfs_start_workers(struct btrfs_workers *workers); | ||
| 68 | |||
| 67 | /* | 69 | /* |
| 68 | * btrfs_start_workers uses kthread_run, which can block waiting for memory | 70 | * btrfs_start_workers uses kthread_run, which can block waiting for memory |
| 69 | * for a very long time. It will actually throttle on page writeback, | 71 | * for a very long time. It will actually throttle on page writeback, |
| @@ -88,27 +90,10 @@ static void start_new_worker_func(struct btrfs_work *work) | |||
| 88 | { | 90 | { |
| 89 | struct worker_start *start; | 91 | struct worker_start *start; |
| 90 | start = container_of(work, struct worker_start, work); | 92 | start = container_of(work, struct worker_start, work); |
| 91 | btrfs_start_workers(start->queue, 1); | 93 | __btrfs_start_workers(start->queue); |
| 92 | kfree(start); | 94 | kfree(start); |
| 93 | } | 95 | } |
| 94 | 96 | ||
| 95 | static int start_new_worker(struct btrfs_workers *queue) | ||
| 96 | { | ||
| 97 | struct worker_start *start; | ||
| 98 | int ret; | ||
| 99 | |||
| 100 | start = kzalloc(sizeof(*start), GFP_NOFS); | ||
| 101 | if (!start) | ||
| 102 | return -ENOMEM; | ||
| 103 | |||
| 104 | start->work.func = start_new_worker_func; | ||
| 105 | start->queue = queue; | ||
| 106 | ret = btrfs_queue_worker(queue->atomic_worker_start, &start->work); | ||
| 107 | if (ret) | ||
| 108 | kfree(start); | ||
| 109 | return ret; | ||
| 110 | } | ||
| 111 | |||
| 112 | /* | 97 | /* |
| 113 | * helper function to move a thread onto the idle list after it | 98 | * helper function to move a thread onto the idle list after it |
| 114 | * has finished some requests. | 99 | * has finished some requests. |
| @@ -153,12 +138,20 @@ static void check_busy_worker(struct btrfs_worker_thread *worker) | |||
| 153 | static void check_pending_worker_creates(struct btrfs_worker_thread *worker) | 138 | static void check_pending_worker_creates(struct btrfs_worker_thread *worker) |
| 154 | { | 139 | { |
| 155 | struct btrfs_workers *workers = worker->workers; | 140 | struct btrfs_workers *workers = worker->workers; |
| 141 | struct worker_start *start; | ||
| 156 | unsigned long flags; | 142 | unsigned long flags; |
| 157 | 143 | ||
| 158 | rmb(); | 144 | rmb(); |
| 159 | if (!workers->atomic_start_pending) | 145 | if (!workers->atomic_start_pending) |
| 160 | return; | 146 | return; |
| 161 | 147 | ||
| 148 | start = kzalloc(sizeof(*start), GFP_NOFS); | ||
| 149 | if (!start) | ||
| 150 | return; | ||
| 151 | |||
| 152 | start->work.func = start_new_worker_func; | ||
| 153 | start->queue = workers; | ||
| 154 | |||
| 162 | spin_lock_irqsave(&workers->lock, flags); | 155 | spin_lock_irqsave(&workers->lock, flags); |
| 163 | if (!workers->atomic_start_pending) | 156 | if (!workers->atomic_start_pending) |
| 164 | goto out; | 157 | goto out; |
| @@ -170,10 +163,11 @@ static void check_pending_worker_creates(struct btrfs_worker_thread *worker) | |||
| 170 | 163 | ||
| 171 | workers->num_workers_starting += 1; | 164 | workers->num_workers_starting += 1; |
| 172 | spin_unlock_irqrestore(&workers->lock, flags); | 165 | spin_unlock_irqrestore(&workers->lock, flags); |
| 173 | start_new_worker(workers); | 166 | btrfs_queue_worker(workers->atomic_worker_start, &start->work); |
| 174 | return; | 167 | return; |
| 175 | 168 | ||
| 176 | out: | 169 | out: |
| 170 | kfree(start); | ||
| 177 | spin_unlock_irqrestore(&workers->lock, flags); | 171 | spin_unlock_irqrestore(&workers->lock, flags); |
| 178 | } | 172 | } |
| 179 | 173 | ||
| @@ -331,7 +325,7 @@ again: | |||
| 331 | run_ordered_completions(worker->workers, work); | 325 | run_ordered_completions(worker->workers, work); |
| 332 | 326 | ||
| 333 | check_pending_worker_creates(worker); | 327 | check_pending_worker_creates(worker); |
| 334 | 328 | cond_resched(); | |
| 335 | } | 329 | } |
| 336 | 330 | ||
| 337 | spin_lock_irq(&worker->lock); | 331 | spin_lock_irq(&worker->lock); |
| @@ -462,56 +456,55 @@ void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max, | |||
| 462 | * starts new worker threads. This does not enforce the max worker | 456 | * starts new worker threads. This does not enforce the max worker |
| 463 | * count in case you need to temporarily go past it. | 457 | * count in case you need to temporarily go past it. |
| 464 | */ | 458 | */ |
| 465 | static int __btrfs_start_workers(struct btrfs_workers *workers, | 459 | static int __btrfs_start_workers(struct btrfs_workers *workers) |
| 466 | int num_workers) | ||
| 467 | { | 460 | { |
| 468 | struct btrfs_worker_thread *worker; | 461 | struct btrfs_worker_thread *worker; |
| 469 | int ret = 0; | 462 | int ret = 0; |
| 470 | int i; | ||
| 471 | 463 | ||
| 472 | for (i = 0; i < num_workers; i++) { | 464 | worker = kzalloc(sizeof(*worker), GFP_NOFS); |
| 473 | worker = kzalloc(sizeof(*worker), GFP_NOFS); | 465 | if (!worker) { |
| 474 | if (!worker) { | 466 | ret = -ENOMEM; |
| 475 | ret = -ENOMEM; | 467 | goto fail; |
| 476 | goto fail; | 468 | } |
| 477 | } | ||
| 478 | 469 | ||
| 479 | INIT_LIST_HEAD(&worker->pending); | 470 | INIT_LIST_HEAD(&worker->pending); |
| 480 | INIT_LIST_HEAD(&worker->prio_pending); | 471 | INIT_LIST_HEAD(&worker->prio_pending); |
| 481 | INIT_LIST_HEAD(&worker->worker_list); | 472 | INIT_LIST_HEAD(&worker->worker_list); |
| 482 | spin_lock_init(&worker->lock); | 473 | spin_lock_init(&worker->lock); |
| 483 | 474 | ||
| 484 | atomic_set(&worker->num_pending, 0); | 475 | atomic_set(&worker->num_pending, 0); |
| 485 | atomic_set(&worker->refs, 1); | 476 | atomic_set(&worker->refs, 1); |
| 486 | worker->workers = workers; | 477 | worker->workers = workers; |
| 487 | worker->task = kthread_run(worker_loop, worker, | 478 | worker->task = kthread_run(worker_loop, worker, |
| 488 | "btrfs-%s-%d", workers->name, | 479 | "btrfs-%s-%d", workers->name, |
| 489 | workers->num_workers + i); | 480 | workers->num_workers + 1); |
| 490 | if (IS_ERR(worker->task)) { | 481 | if (IS_ERR(worker->task)) { |
| 491 | ret = PTR_ERR(worker->task); | 482 | ret = PTR_ERR(worker->task); |
| 492 | kfree(worker); | 483 | kfree(worker); |
| 493 | goto fail; | 484 | goto fail; |
| 494 | } | ||
| 495 | spin_lock_irq(&workers->lock); | ||
| 496 | list_add_tail(&worker->worker_list, &workers->idle_list); | ||
| 497 | worker->idle = 1; | ||
| 498 | workers->num_workers++; | ||
| 499 | workers->num_workers_starting--; | ||
| 500 | WARN_ON(workers->num_workers_starting < 0); | ||
| 501 | spin_unlock_irq(&workers->lock); | ||
| 502 | } | 485 | } |
| 486 | spin_lock_irq(&workers->lock); | ||
| 487 | list_add_tail(&worker->worker_list, &workers->idle_list); | ||
| 488 | worker->idle = 1; | ||
| 489 | workers->num_workers++; | ||
| 490 | workers->num_workers_starting--; | ||
| 491 | WARN_ON(workers->num_workers_starting < 0); | ||
| 492 | spin_unlock_irq(&workers->lock); | ||
| 493 | |||
| 503 | return 0; | 494 | return 0; |
| 504 | fail: | 495 | fail: |
| 505 | btrfs_stop_workers(workers); | 496 | spin_lock_irq(&workers->lock); |
| 497 | workers->num_workers_starting--; | ||
| 498 | spin_unlock_irq(&workers->lock); | ||
| 506 | return ret; | 499 | return ret; |
| 507 | } | 500 | } |
| 508 | 501 | ||
| 509 | int btrfs_start_workers(struct btrfs_workers *workers, int num_workers) | 502 | int btrfs_start_workers(struct btrfs_workers *workers) |
| 510 | { | 503 | { |
| 511 | spin_lock_irq(&workers->lock); | 504 | spin_lock_irq(&workers->lock); |
| 512 | workers->num_workers_starting += num_workers; | 505 | workers->num_workers_starting++; |
| 513 | spin_unlock_irq(&workers->lock); | 506 | spin_unlock_irq(&workers->lock); |
| 514 | return __btrfs_start_workers(workers, num_workers); | 507 | return __btrfs_start_workers(workers); |
| 515 | } | 508 | } |
| 516 | 509 | ||
| 517 | /* | 510 | /* |
| @@ -568,9 +561,10 @@ static struct btrfs_worker_thread *find_worker(struct btrfs_workers *workers) | |||
| 568 | struct btrfs_worker_thread *worker; | 561 | struct btrfs_worker_thread *worker; |
| 569 | unsigned long flags; | 562 | unsigned long flags; |
| 570 | struct list_head *fallback; | 563 | struct list_head *fallback; |
| 564 | int ret; | ||
| 571 | 565 | ||
| 572 | again: | ||
| 573 | spin_lock_irqsave(&workers->lock, flags); | 566 | spin_lock_irqsave(&workers->lock, flags); |
| 567 | again: | ||
| 574 | worker = next_worker(workers); | 568 | worker = next_worker(workers); |
| 575 | 569 | ||
| 576 | if (!worker) { | 570 | if (!worker) { |
| @@ -584,7 +578,10 @@ again: | |||
| 584 | workers->num_workers_starting++; | 578 | workers->num_workers_starting++; |
| 585 | spin_unlock_irqrestore(&workers->lock, flags); | 579 | spin_unlock_irqrestore(&workers->lock, flags); |
| 586 | /* we're below the limit, start another worker */ | 580 | /* we're below the limit, start another worker */ |
| 587 | __btrfs_start_workers(workers, 1); | 581 | ret = __btrfs_start_workers(workers); |
| 582 | spin_lock_irqsave(&workers->lock, flags); | ||
| 583 | if (ret) | ||
| 584 | goto fallback; | ||
| 588 | goto again; | 585 | goto again; |
| 589 | } | 586 | } |
| 590 | } | 587 | } |
| @@ -665,7 +662,7 @@ void btrfs_set_work_high_prio(struct btrfs_work *work) | |||
| 665 | /* | 662 | /* |
| 666 | * places a struct btrfs_work into the pending queue of one of the kthreads | 663 | * places a struct btrfs_work into the pending queue of one of the kthreads |
| 667 | */ | 664 | */ |
| 668 | int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) | 665 | void btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) |
| 669 | { | 666 | { |
| 670 | struct btrfs_worker_thread *worker; | 667 | struct btrfs_worker_thread *worker; |
| 671 | unsigned long flags; | 668 | unsigned long flags; |
| @@ -673,7 +670,7 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) | |||
| 673 | 670 | ||
| 674 | /* don't requeue something already on a list */ | 671 | /* don't requeue something already on a list */ |
| 675 | if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags)) | 672 | if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags)) |
| 676 | goto out; | 673 | return; |
| 677 | 674 | ||
| 678 | worker = find_worker(workers); | 675 | worker = find_worker(workers); |
| 679 | if (workers->ordered) { | 676 | if (workers->ordered) { |
| @@ -712,7 +709,4 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) | |||
| 712 | if (wake) | 709 | if (wake) |
| 713 | wake_up_process(worker->task); | 710 | wake_up_process(worker->task); |
| 714 | spin_unlock_irqrestore(&worker->lock, flags); | 711 | spin_unlock_irqrestore(&worker->lock, flags); |
| 715 | |||
| 716 | out: | ||
| 717 | return 0; | ||
| 718 | } | 712 | } |
diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h index 5077746cf85e..f34cc31fa3c9 100644 --- a/fs/btrfs/async-thread.h +++ b/fs/btrfs/async-thread.h | |||
| @@ -109,8 +109,8 @@ struct btrfs_workers { | |||
| 109 | char *name; | 109 | char *name; |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work); | 112 | void btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work); |
| 113 | int btrfs_start_workers(struct btrfs_workers *workers, int num_workers); | 113 | int btrfs_start_workers(struct btrfs_workers *workers); |
| 114 | int btrfs_stop_workers(struct btrfs_workers *workers); | 114 | int btrfs_stop_workers(struct btrfs_workers *workers); |
| 115 | void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max, | 115 | void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max, |
| 116 | struct btrfs_workers *async_starter); | 116 | struct btrfs_workers *async_starter); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 50634abef9b4..67385033323d 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -2692,7 +2692,8 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | |||
| 2692 | int btrfs_readpage(struct file *file, struct page *page); | 2692 | int btrfs_readpage(struct file *file, struct page *page); |
| 2693 | void btrfs_evict_inode(struct inode *inode); | 2693 | void btrfs_evict_inode(struct inode *inode); |
| 2694 | int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); | 2694 | int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc); |
| 2695 | void btrfs_dirty_inode(struct inode *inode, int flags); | 2695 | int btrfs_dirty_inode(struct inode *inode); |
| 2696 | int btrfs_update_time(struct file *file); | ||
| 2696 | struct inode *btrfs_alloc_inode(struct super_block *sb); | 2697 | struct inode *btrfs_alloc_inode(struct super_block *sb); |
| 2697 | void btrfs_destroy_inode(struct inode *inode); | 2698 | void btrfs_destroy_inode(struct inode *inode); |
| 2698 | int btrfs_drop_inode(struct inode *inode); | 2699 | int btrfs_drop_inode(struct inode *inode); |
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 5b163572e0ca..9c1eccc2c503 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c | |||
| @@ -640,8 +640,8 @@ static int btrfs_delayed_inode_reserve_metadata( | |||
| 640 | * Now if src_rsv == delalloc_block_rsv we'll let it just steal since | 640 | * Now if src_rsv == delalloc_block_rsv we'll let it just steal since |
| 641 | * we're accounted for. | 641 | * we're accounted for. |
| 642 | */ | 642 | */ |
| 643 | if (!trans->bytes_reserved && | 643 | if (!src_rsv || (!trans->bytes_reserved && |
| 644 | src_rsv != &root->fs_info->delalloc_block_rsv) { | 644 | src_rsv != &root->fs_info->delalloc_block_rsv)) { |
| 645 | ret = btrfs_block_rsv_add_noflush(root, dst_rsv, num_bytes); | 645 | ret = btrfs_block_rsv_add_noflush(root, dst_rsv, num_bytes); |
| 646 | /* | 646 | /* |
| 647 | * Since we're under a transaction reserve_metadata_bytes could | 647 | * Since we're under a transaction reserve_metadata_bytes could |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 632f8f3cc9db..f44b3928dc2d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -2194,19 +2194,27 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
| 2194 | fs_info->endio_meta_write_workers.idle_thresh = 2; | 2194 | fs_info->endio_meta_write_workers.idle_thresh = 2; |
| 2195 | fs_info->readahead_workers.idle_thresh = 2; | 2195 | fs_info->readahead_workers.idle_thresh = 2; |
| 2196 | 2196 | ||
| 2197 | btrfs_start_workers(&fs_info->workers, 1); | 2197 | /* |
| 2198 | btrfs_start_workers(&fs_info->generic_worker, 1); | 2198 | * btrfs_start_workers can really only fail because of ENOMEM so just |
| 2199 | btrfs_start_workers(&fs_info->submit_workers, 1); | 2199 | * return -ENOMEM if any of these fail. |
| 2200 | btrfs_start_workers(&fs_info->delalloc_workers, 1); | 2200 | */ |
| 2201 | btrfs_start_workers(&fs_info->fixup_workers, 1); | 2201 | ret = btrfs_start_workers(&fs_info->workers); |
| 2202 | btrfs_start_workers(&fs_info->endio_workers, 1); | 2202 | ret |= btrfs_start_workers(&fs_info->generic_worker); |
| 2203 | btrfs_start_workers(&fs_info->endio_meta_workers, 1); | 2203 | ret |= btrfs_start_workers(&fs_info->submit_workers); |
| 2204 | btrfs_start_workers(&fs_info->endio_meta_write_workers, 1); | 2204 | ret |= btrfs_start_workers(&fs_info->delalloc_workers); |
| 2205 | btrfs_start_workers(&fs_info->endio_write_workers, 1); | 2205 | ret |= btrfs_start_workers(&fs_info->fixup_workers); |
| 2206 | btrfs_start_workers(&fs_info->endio_freespace_worker, 1); | 2206 | ret |= btrfs_start_workers(&fs_info->endio_workers); |
| 2207 | btrfs_start_workers(&fs_info->delayed_workers, 1); | 2207 | ret |= btrfs_start_workers(&fs_info->endio_meta_workers); |
| 2208 | btrfs_start_workers(&fs_info->caching_workers, 1); | 2208 | ret |= btrfs_start_workers(&fs_info->endio_meta_write_workers); |
| 2209 | btrfs_start_workers(&fs_info->readahead_workers, 1); | 2209 | ret |= btrfs_start_workers(&fs_info->endio_write_workers); |
| 2210 | ret |= btrfs_start_workers(&fs_info->endio_freespace_worker); | ||
| 2211 | ret |= btrfs_start_workers(&fs_info->delayed_workers); | ||
| 2212 | ret |= btrfs_start_workers(&fs_info->caching_workers); | ||
| 2213 | ret |= btrfs_start_workers(&fs_info->readahead_workers); | ||
| 2214 | if (ret) { | ||
| 2215 | ret = -ENOMEM; | ||
| 2216 | goto fail_sb_buffer; | ||
| 2217 | } | ||
| 2210 | 2218 | ||
| 2211 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); | 2219 | fs_info->bdi.ra_pages *= btrfs_super_num_devices(disk_super); |
| 2212 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, | 2220 | fs_info->bdi.ra_pages = max(fs_info->bdi.ra_pages, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f0d5718d2587..f5fbe576d2ba 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -2822,7 +2822,7 @@ out_free: | |||
| 2822 | btrfs_release_path(path); | 2822 | btrfs_release_path(path); |
| 2823 | out: | 2823 | out: |
| 2824 | spin_lock(&block_group->lock); | 2824 | spin_lock(&block_group->lock); |
| 2825 | if (!ret) | 2825 | if (!ret && dcs == BTRFS_DC_SETUP) |
| 2826 | block_group->cache_generation = trans->transid; | 2826 | block_group->cache_generation = trans->transid; |
| 2827 | block_group->disk_cache_state = dcs; | 2827 | block_group->disk_cache_state = dcs; |
| 2828 | spin_unlock(&block_group->lock); | 2828 | spin_unlock(&block_group->lock); |
| @@ -4204,12 +4204,17 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
| 4204 | struct btrfs_root *root = BTRFS_I(inode)->root; | 4204 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 4205 | struct btrfs_block_rsv *block_rsv = &root->fs_info->delalloc_block_rsv; | 4205 | struct btrfs_block_rsv *block_rsv = &root->fs_info->delalloc_block_rsv; |
| 4206 | u64 to_reserve = 0; | 4206 | u64 to_reserve = 0; |
| 4207 | u64 csum_bytes; | ||
| 4207 | unsigned nr_extents = 0; | 4208 | unsigned nr_extents = 0; |
| 4209 | int extra_reserve = 0; | ||
| 4208 | int flush = 1; | 4210 | int flush = 1; |
| 4209 | int ret; | 4211 | int ret; |
| 4210 | 4212 | ||
| 4213 | /* Need to be holding the i_mutex here if we aren't free space cache */ | ||
| 4211 | if (btrfs_is_free_space_inode(root, inode)) | 4214 | if (btrfs_is_free_space_inode(root, inode)) |
| 4212 | flush = 0; | 4215 | flush = 0; |
| 4216 | else | ||
| 4217 | WARN_ON(!mutex_is_locked(&inode->i_mutex)); | ||
| 4213 | 4218 | ||
| 4214 | if (flush && btrfs_transaction_in_commit(root->fs_info)) | 4219 | if (flush && btrfs_transaction_in_commit(root->fs_info)) |
| 4215 | schedule_timeout(1); | 4220 | schedule_timeout(1); |
| @@ -4220,11 +4225,9 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
| 4220 | BTRFS_I(inode)->outstanding_extents++; | 4225 | BTRFS_I(inode)->outstanding_extents++; |
| 4221 | 4226 | ||
| 4222 | if (BTRFS_I(inode)->outstanding_extents > | 4227 | if (BTRFS_I(inode)->outstanding_extents > |
| 4223 | BTRFS_I(inode)->reserved_extents) { | 4228 | BTRFS_I(inode)->reserved_extents) |
| 4224 | nr_extents = BTRFS_I(inode)->outstanding_extents - | 4229 | nr_extents = BTRFS_I(inode)->outstanding_extents - |
| 4225 | BTRFS_I(inode)->reserved_extents; | 4230 | BTRFS_I(inode)->reserved_extents; |
| 4226 | BTRFS_I(inode)->reserved_extents += nr_extents; | ||
| 4227 | } | ||
| 4228 | 4231 | ||
| 4229 | /* | 4232 | /* |
| 4230 | * Add an item to reserve for updating the inode when we complete the | 4233 | * Add an item to reserve for updating the inode when we complete the |
| @@ -4232,11 +4235,12 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
| 4232 | */ | 4235 | */ |
| 4233 | if (!BTRFS_I(inode)->delalloc_meta_reserved) { | 4236 | if (!BTRFS_I(inode)->delalloc_meta_reserved) { |
| 4234 | nr_extents++; | 4237 | nr_extents++; |
| 4235 | BTRFS_I(inode)->delalloc_meta_reserved = 1; | 4238 | extra_reserve = 1; |
| 4236 | } | 4239 | } |
| 4237 | 4240 | ||
| 4238 | to_reserve = btrfs_calc_trans_metadata_size(root, nr_extents); | 4241 | to_reserve = btrfs_calc_trans_metadata_size(root, nr_extents); |
| 4239 | to_reserve += calc_csum_metadata_size(inode, num_bytes, 1); | 4242 | to_reserve += calc_csum_metadata_size(inode, num_bytes, 1); |
| 4243 | csum_bytes = BTRFS_I(inode)->csum_bytes; | ||
| 4240 | spin_unlock(&BTRFS_I(inode)->lock); | 4244 | spin_unlock(&BTRFS_I(inode)->lock); |
| 4241 | 4245 | ||
| 4242 | ret = reserve_metadata_bytes(root, block_rsv, to_reserve, flush); | 4246 | ret = reserve_metadata_bytes(root, block_rsv, to_reserve, flush); |
| @@ -4246,22 +4250,35 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
| 4246 | 4250 | ||
| 4247 | spin_lock(&BTRFS_I(inode)->lock); | 4251 | spin_lock(&BTRFS_I(inode)->lock); |
| 4248 | dropped = drop_outstanding_extent(inode); | 4252 | dropped = drop_outstanding_extent(inode); |
| 4249 | to_free = calc_csum_metadata_size(inode, num_bytes, 0); | ||
| 4250 | spin_unlock(&BTRFS_I(inode)->lock); | ||
| 4251 | to_free += btrfs_calc_trans_metadata_size(root, dropped); | ||
| 4252 | |||
| 4253 | /* | 4253 | /* |
| 4254 | * Somebody could have come in and twiddled with the | 4254 | * If the inodes csum_bytes is the same as the original |
| 4255 | * reservation, so if we have to free more than we would have | 4255 | * csum_bytes then we know we haven't raced with any free()ers |
| 4256 | * reserved from this reservation go ahead and release those | 4256 | * so we can just reduce our inodes csum bytes and carry on. |
| 4257 | * bytes. | 4257 | * Otherwise we have to do the normal free thing to account for |
| 4258 | * the case that the free side didn't free up its reserve | ||
| 4259 | * because of this outstanding reservation. | ||
| 4258 | */ | 4260 | */ |
| 4259 | to_free -= to_reserve; | 4261 | if (BTRFS_I(inode)->csum_bytes == csum_bytes) |
| 4262 | calc_csum_metadata_size(inode, num_bytes, 0); | ||
| 4263 | else | ||
| 4264 | to_free = calc_csum_metadata_size(inode, num_bytes, 0); | ||
| 4265 | spin_unlock(&BTRFS_I(inode)->lock); | ||
| 4266 | if (dropped) | ||
| 4267 | to_free += btrfs_calc_trans_metadata_size(root, dropped); | ||
| 4268 | |||
| 4260 | if (to_free) | 4269 | if (to_free) |
| 4261 | btrfs_block_rsv_release(root, block_rsv, to_free); | 4270 | btrfs_block_rsv_release(root, block_rsv, to_free); |
| 4262 | return ret; | 4271 | return ret; |
| 4263 | } | 4272 | } |
| 4264 | 4273 | ||
| 4274 | spin_lock(&BTRFS_I(inode)->lock); | ||
| 4275 | if (extra_reserve) { | ||
| 4276 | BTRFS_I(inode)->delalloc_meta_reserved = 1; | ||
| 4277 | nr_extents--; | ||
| 4278 | } | ||
| 4279 | BTRFS_I(inode)->reserved_extents += nr_extents; | ||
| 4280 | spin_unlock(&BTRFS_I(inode)->lock); | ||
| 4281 | |||
| 4265 | block_rsv_add_bytes(block_rsv, to_reserve, 1); | 4282 | block_rsv_add_bytes(block_rsv, to_reserve, 1); |
| 4266 | 4283 | ||
| 4267 | return 0; | 4284 | return 0; |
| @@ -5107,11 +5124,11 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
| 5107 | struct btrfs_root *root = orig_root->fs_info->extent_root; | 5124 | struct btrfs_root *root = orig_root->fs_info->extent_root; |
| 5108 | struct btrfs_free_cluster *last_ptr = NULL; | 5125 | struct btrfs_free_cluster *last_ptr = NULL; |
| 5109 | struct btrfs_block_group_cache *block_group = NULL; | 5126 | struct btrfs_block_group_cache *block_group = NULL; |
| 5127 | struct btrfs_block_group_cache *used_block_group; | ||
| 5110 | int empty_cluster = 2 * 1024 * 1024; | 5128 | int empty_cluster = 2 * 1024 * 1024; |
| 5111 | int allowed_chunk_alloc = 0; | 5129 | int allowed_chunk_alloc = 0; |
| 5112 | int done_chunk_alloc = 0; | 5130 | int done_chunk_alloc = 0; |
| 5113 | struct btrfs_space_info *space_info; | 5131 | struct btrfs_space_info *space_info; |
| 5114 | int last_ptr_loop = 0; | ||
| 5115 | int loop = 0; | 5132 | int loop = 0; |
| 5116 | int index = 0; | 5133 | int index = 0; |
| 5117 | int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ? | 5134 | int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ? |
| @@ -5173,6 +5190,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
| 5173 | ideal_cache: | 5190 | ideal_cache: |
| 5174 | block_group = btrfs_lookup_block_group(root->fs_info, | 5191 | block_group = btrfs_lookup_block_group(root->fs_info, |
| 5175 | search_start); | 5192 | search_start); |
| 5193 | used_block_group = block_group; | ||
| 5176 | /* | 5194 | /* |
| 5177 | * we don't want to use the block group if it doesn't match our | 5195 | * we don't want to use the block group if it doesn't match our |
| 5178 | * allocation bits, or if its not cached. | 5196 | * allocation bits, or if its not cached. |
| @@ -5210,6 +5228,7 @@ search: | |||
| 5210 | u64 offset; | 5228 | u64 offset; |
| 5211 | int cached; | 5229 | int cached; |
| 5212 | 5230 | ||
| 5231 | used_block_group = block_group; | ||
| 5213 | btrfs_get_block_group(block_group); | 5232 | btrfs_get_block_group(block_group); |
| 5214 | search_start = block_group->key.objectid; | 5233 | search_start = block_group->key.objectid; |
| 5215 | 5234 | ||
| @@ -5286,71 +5305,62 @@ alloc: | |||
| 5286 | spin_unlock(&block_group->free_space_ctl->tree_lock); | 5305 | spin_unlock(&block_group->free_space_ctl->tree_lock); |
| 5287 | 5306 | ||
| 5288 | /* | 5307 | /* |
| 5289 | * Ok we want to try and use the cluster allocator, so lets look | 5308 | * Ok we want to try and use the cluster allocator, so |
| 5290 | * there, unless we are on LOOP_NO_EMPTY_SIZE, since we will | 5309 | * lets look there |
| 5291 | * have tried the cluster allocator plenty of times at this | ||
| 5292 | * point and not have found anything, so we are likely way too | ||
| 5293 | * fragmented for the clustering stuff to find anything, so lets | ||
| 5294 | * just skip it and let the allocator find whatever block it can | ||
| 5295 | * find | ||
| 5296 | */ | 5310 | */ |
| 5297 | if (last_ptr && loop < LOOP_NO_EMPTY_SIZE) { | 5311 | if (last_ptr) { |
| 5298 | /* | 5312 | /* |
| 5299 | * the refill lock keeps out other | 5313 | * the refill lock keeps out other |
| 5300 | * people trying to start a new cluster | 5314 | * people trying to start a new cluster |
| 5301 | */ | 5315 | */ |
| 5302 | spin_lock(&last_ptr->refill_lock); | 5316 | spin_lock(&last_ptr->refill_lock); |
| 5303 | if (!last_ptr->block_group || | 5317 | used_block_group = last_ptr->block_group; |
| 5304 | last_ptr->block_group->ro || | 5318 | if (used_block_group != block_group && |
| 5305 | !block_group_bits(last_ptr->block_group, data)) | 5319 | (!used_block_group || |
| 5320 | used_block_group->ro || | ||
| 5321 | !block_group_bits(used_block_group, data))) { | ||
| 5322 | used_block_group = block_group; | ||
| 5306 | goto refill_cluster; | 5323 | goto refill_cluster; |
| 5324 | } | ||
| 5325 | |||
| 5326 | if (used_block_group != block_group) | ||
| 5327 | btrfs_get_block_group(used_block_group); | ||
| 5307 | 5328 | ||
| 5308 | offset = btrfs_alloc_from_cluster(block_group, last_ptr, | 5329 | offset = btrfs_alloc_from_cluster(used_block_group, |
| 5309 | num_bytes, search_start); | 5330 | last_ptr, num_bytes, used_block_group->key.objectid); |
| 5310 | if (offset) { | 5331 | if (offset) { |
| 5311 | /* we have a block, we're done */ | 5332 | /* we have a block, we're done */ |
| 5312 | spin_unlock(&last_ptr->refill_lock); | 5333 | spin_unlock(&last_ptr->refill_lock); |
| 5313 | goto checks; | 5334 | goto checks; |
| 5314 | } | 5335 | } |
| 5315 | 5336 | ||
| 5316 | spin_lock(&last_ptr->lock); | 5337 | WARN_ON(last_ptr->block_group != used_block_group); |
| 5317 | /* | 5338 | if (used_block_group != block_group) { |
| 5318 | * whoops, this cluster doesn't actually point to | 5339 | btrfs_put_block_group(used_block_group); |
| 5319 | * this block group. Get a ref on the block | 5340 | used_block_group = block_group; |
| 5320 | * group is does point to and try again | ||
| 5321 | */ | ||
| 5322 | if (!last_ptr_loop && last_ptr->block_group && | ||
| 5323 | last_ptr->block_group != block_group && | ||
| 5324 | index <= | ||
| 5325 | get_block_group_index(last_ptr->block_group)) { | ||
| 5326 | |||
| 5327 | btrfs_put_block_group(block_group); | ||
| 5328 | block_group = last_ptr->block_group; | ||
| 5329 | btrfs_get_block_group(block_group); | ||
| 5330 | spin_unlock(&last_ptr->lock); | ||
| 5331 | spin_unlock(&last_ptr->refill_lock); | ||
| 5332 | |||
| 5333 | last_ptr_loop = 1; | ||
| 5334 | search_start = block_group->key.objectid; | ||
| 5335 | /* | ||
| 5336 | * we know this block group is properly | ||
| 5337 | * in the list because | ||
| 5338 | * btrfs_remove_block_group, drops the | ||
| 5339 | * cluster before it removes the block | ||
| 5340 | * group from the list | ||
| 5341 | */ | ||
| 5342 | goto have_block_group; | ||
| 5343 | } | 5341 | } |
| 5344 | spin_unlock(&last_ptr->lock); | ||
| 5345 | refill_cluster: | 5342 | refill_cluster: |
| 5343 | BUG_ON(used_block_group != block_group); | ||
| 5344 | /* If we are on LOOP_NO_EMPTY_SIZE, we can't | ||
| 5345 | * set up a new clusters, so lets just skip it | ||
| 5346 | * and let the allocator find whatever block | ||
| 5347 | * it can find. If we reach this point, we | ||
| 5348 | * will have tried the cluster allocator | ||
| 5349 | * plenty of times and not have found | ||
| 5350 | * anything, so we are likely way too | ||
| 5351 | * fragmented for the clustering stuff to find | ||
| 5352 | * anything. */ | ||
| 5353 | if (loop >= LOOP_NO_EMPTY_SIZE) { | ||
| 5354 | spin_unlock(&last_ptr->refill_lock); | ||
| 5355 | goto unclustered_alloc; | ||
| 5356 | } | ||
| 5357 | |||
| 5346 | /* | 5358 | /* |
| 5347 | * this cluster didn't work out, free it and | 5359 | * this cluster didn't work out, free it and |
| 5348 | * start over | 5360 | * start over |
| 5349 | */ | 5361 | */ |
| 5350 | btrfs_return_cluster_to_free_space(NULL, last_ptr); | 5362 | btrfs_return_cluster_to_free_space(NULL, last_ptr); |
| 5351 | 5363 | ||
| 5352 | last_ptr_loop = 0; | ||
| 5353 | |||
| 5354 | /* allocate a cluster in this block group */ | 5364 | /* allocate a cluster in this block group */ |
| 5355 | ret = btrfs_find_space_cluster(trans, root, | 5365 | ret = btrfs_find_space_cluster(trans, root, |
| 5356 | block_group, last_ptr, | 5366 | block_group, last_ptr, |
| @@ -5390,6 +5400,7 @@ refill_cluster: | |||
| 5390 | goto loop; | 5400 | goto loop; |
| 5391 | } | 5401 | } |
| 5392 | 5402 | ||
| 5403 | unclustered_alloc: | ||
| 5393 | offset = btrfs_find_space_for_alloc(block_group, search_start, | 5404 | offset = btrfs_find_space_for_alloc(block_group, search_start, |
| 5394 | num_bytes, empty_size); | 5405 | num_bytes, empty_size); |
| 5395 | /* | 5406 | /* |
| @@ -5416,14 +5427,14 @@ checks: | |||
| 5416 | search_start = stripe_align(root, offset); | 5427 | search_start = stripe_align(root, offset); |
| 5417 | /* move on to the next group */ | 5428 | /* move on to the next group */ |
| 5418 | if (search_start + num_bytes >= search_end) { | 5429 | if (search_start + num_bytes >= search_end) { |
| 5419 | btrfs_add_free_space(block_group, offset, num_bytes); | 5430 | btrfs_add_free_space(used_block_group, offset, num_bytes); |
| 5420 | goto loop; | 5431 | goto loop; |
| 5421 | } | 5432 | } |
| 5422 | 5433 | ||
| 5423 | /* move on to the next group */ | 5434 | /* move on to the next group */ |
| 5424 | if (search_start + num_bytes > | 5435 | if (search_start + num_bytes > |
| 5425 | block_group->key.objectid + block_group->key.offset) { | 5436 | used_block_group->key.objectid + used_block_group->key.offset) { |
| 5426 | btrfs_add_free_space(block_group, offset, num_bytes); | 5437 | btrfs_add_free_space(used_block_group, offset, num_bytes); |
| 5427 | goto loop; | 5438 | goto loop; |
| 5428 | } | 5439 | } |
| 5429 | 5440 | ||
| @@ -5431,14 +5442,14 @@ checks: | |||
| 5431 | ins->offset = num_bytes; | 5442 | ins->offset = num_bytes; |
| 5432 | 5443 | ||
| 5433 | if (offset < search_start) | 5444 | if (offset < search_start) |
| 5434 | btrfs_add_free_space(block_group, offset, | 5445 | btrfs_add_free_space(used_block_group, offset, |
| 5435 | search_start - offset); | 5446 | search_start - offset); |
| 5436 | BUG_ON(offset > search_start); | 5447 | BUG_ON(offset > search_start); |
| 5437 | 5448 | ||
| 5438 | ret = btrfs_update_reserved_bytes(block_group, num_bytes, | 5449 | ret = btrfs_update_reserved_bytes(used_block_group, num_bytes, |
| 5439 | alloc_type); | 5450 | alloc_type); |
| 5440 | if (ret == -EAGAIN) { | 5451 | if (ret == -EAGAIN) { |
| 5441 | btrfs_add_free_space(block_group, offset, num_bytes); | 5452 | btrfs_add_free_space(used_block_group, offset, num_bytes); |
| 5442 | goto loop; | 5453 | goto loop; |
| 5443 | } | 5454 | } |
| 5444 | 5455 | ||
| @@ -5447,15 +5458,19 @@ checks: | |||
| 5447 | ins->offset = num_bytes; | 5458 | ins->offset = num_bytes; |
| 5448 | 5459 | ||
| 5449 | if (offset < search_start) | 5460 | if (offset < search_start) |
| 5450 | btrfs_add_free_space(block_group, offset, | 5461 | btrfs_add_free_space(used_block_group, offset, |
| 5451 | search_start - offset); | 5462 | search_start - offset); |
| 5452 | BUG_ON(offset > search_start); | 5463 | BUG_ON(offset > search_start); |
| 5464 | if (used_block_group != block_group) | ||
| 5465 | btrfs_put_block_group(used_block_group); | ||
| 5453 | btrfs_put_block_group(block_group); | 5466 | btrfs_put_block_group(block_group); |
| 5454 | break; | 5467 | break; |
| 5455 | loop: | 5468 | loop: |
| 5456 | failed_cluster_refill = false; | 5469 | failed_cluster_refill = false; |
| 5457 | failed_alloc = false; | 5470 | failed_alloc = false; |
| 5458 | BUG_ON(index != get_block_group_index(block_group)); | 5471 | BUG_ON(index != get_block_group_index(block_group)); |
| 5472 | if (used_block_group != block_group) | ||
| 5473 | btrfs_put_block_group(used_block_group); | ||
| 5459 | btrfs_put_block_group(block_group); | 5474 | btrfs_put_block_group(block_group); |
| 5460 | } | 5475 | } |
| 5461 | up_read(&space_info->groups_sem); | 5476 | up_read(&space_info->groups_sem); |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index be1bf627a14b..49f3c9dc09f4 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -935,8 +935,10 @@ again: | |||
| 935 | node = tree_search(tree, start); | 935 | node = tree_search(tree, start); |
| 936 | if (!node) { | 936 | if (!node) { |
| 937 | prealloc = alloc_extent_state_atomic(prealloc); | 937 | prealloc = alloc_extent_state_atomic(prealloc); |
| 938 | if (!prealloc) | 938 | if (!prealloc) { |
| 939 | return -ENOMEM; | 939 | err = -ENOMEM; |
| 940 | goto out; | ||
| 941 | } | ||
| 940 | err = insert_state(tree, prealloc, start, end, &bits); | 942 | err = insert_state(tree, prealloc, start, end, &bits); |
| 941 | prealloc = NULL; | 943 | prealloc = NULL; |
| 942 | BUG_ON(err == -EEXIST); | 944 | BUG_ON(err == -EEXIST); |
| @@ -992,8 +994,10 @@ hit_next: | |||
| 992 | */ | 994 | */ |
| 993 | if (state->start < start) { | 995 | if (state->start < start) { |
| 994 | prealloc = alloc_extent_state_atomic(prealloc); | 996 | prealloc = alloc_extent_state_atomic(prealloc); |
| 995 | if (!prealloc) | 997 | if (!prealloc) { |
| 996 | return -ENOMEM; | 998 | err = -ENOMEM; |
| 999 | goto out; | ||
| 1000 | } | ||
| 997 | err = split_state(tree, state, prealloc, start); | 1001 | err = split_state(tree, state, prealloc, start); |
| 998 | BUG_ON(err == -EEXIST); | 1002 | BUG_ON(err == -EEXIST); |
| 999 | prealloc = NULL; | 1003 | prealloc = NULL; |
| @@ -1024,8 +1028,10 @@ hit_next: | |||
| 1024 | this_end = last_start - 1; | 1028 | this_end = last_start - 1; |
| 1025 | 1029 | ||
| 1026 | prealloc = alloc_extent_state_atomic(prealloc); | 1030 | prealloc = alloc_extent_state_atomic(prealloc); |
| 1027 | if (!prealloc) | 1031 | if (!prealloc) { |
| 1028 | return -ENOMEM; | 1032 | err = -ENOMEM; |
| 1033 | goto out; | ||
| 1034 | } | ||
| 1029 | 1035 | ||
| 1030 | /* | 1036 | /* |
| 1031 | * Avoid to free 'prealloc' if it can be merged with | 1037 | * Avoid to free 'prealloc' if it can be merged with |
| @@ -1051,8 +1057,10 @@ hit_next: | |||
| 1051 | */ | 1057 | */ |
| 1052 | if (state->start <= end && state->end > end) { | 1058 | if (state->start <= end && state->end > end) { |
| 1053 | prealloc = alloc_extent_state_atomic(prealloc); | 1059 | prealloc = alloc_extent_state_atomic(prealloc); |
| 1054 | if (!prealloc) | 1060 | if (!prealloc) { |
| 1055 | return -ENOMEM; | 1061 | err = -ENOMEM; |
| 1062 | goto out; | ||
| 1063 | } | ||
| 1056 | 1064 | ||
| 1057 | err = split_state(tree, state, prealloc, end + 1); | 1065 | err = split_state(tree, state, prealloc, end + 1); |
| 1058 | BUG_ON(err == -EEXIST); | 1066 | BUG_ON(err == -EEXIST); |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index dafdfa059bf6..97fbe939c050 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
| @@ -1167,6 +1167,8 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file, | |||
| 1167 | nrptrs = min((iov_iter_count(i) + PAGE_CACHE_SIZE - 1) / | 1167 | nrptrs = min((iov_iter_count(i) + PAGE_CACHE_SIZE - 1) / |
| 1168 | PAGE_CACHE_SIZE, PAGE_CACHE_SIZE / | 1168 | PAGE_CACHE_SIZE, PAGE_CACHE_SIZE / |
| 1169 | (sizeof(struct page *))); | 1169 | (sizeof(struct page *))); |
| 1170 | nrptrs = min(nrptrs, current->nr_dirtied_pause - current->nr_dirtied); | ||
| 1171 | nrptrs = max(nrptrs, 8); | ||
| 1170 | pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL); | 1172 | pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL); |
| 1171 | if (!pages) | 1173 | if (!pages) |
| 1172 | return -ENOMEM; | 1174 | return -ENOMEM; |
| @@ -1387,7 +1389,11 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
| 1387 | goto out; | 1389 | goto out; |
| 1388 | } | 1390 | } |
| 1389 | 1391 | ||
| 1390 | file_update_time(file); | 1392 | err = btrfs_update_time(file); |
| 1393 | if (err) { | ||
| 1394 | mutex_unlock(&inode->i_mutex); | ||
| 1395 | goto out; | ||
| 1396 | } | ||
| 1391 | BTRFS_I(inode)->sequence++; | 1397 | BTRFS_I(inode)->sequence++; |
| 1392 | 1398 | ||
| 1393 | start_pos = round_down(pos, root->sectorsize); | 1399 | start_pos = round_down(pos, root->sectorsize); |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 2c984f7d4c2a..fd1a06df5bc6 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include <linux/falloc.h> | 38 | #include <linux/falloc.h> |
| 39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
| 40 | #include <linux/ratelimit.h> | 40 | #include <linux/ratelimit.h> |
| 41 | #include <linux/mount.h> | ||
| 41 | #include "compat.h" | 42 | #include "compat.h" |
| 42 | #include "ctree.h" | 43 | #include "ctree.h" |
| 43 | #include "disk-io.h" | 44 | #include "disk-io.h" |
| @@ -2031,7 +2032,7 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode) | |||
| 2031 | /* insert an orphan item to track this unlinked/truncated file */ | 2032 | /* insert an orphan item to track this unlinked/truncated file */ |
| 2032 | if (insert >= 1) { | 2033 | if (insert >= 1) { |
| 2033 | ret = btrfs_insert_orphan_item(trans, root, btrfs_ino(inode)); | 2034 | ret = btrfs_insert_orphan_item(trans, root, btrfs_ino(inode)); |
| 2034 | BUG_ON(ret); | 2035 | BUG_ON(ret && ret != -EEXIST); |
| 2035 | } | 2036 | } |
| 2036 | 2037 | ||
| 2037 | /* insert an orphan item to track subvolume contains orphan files */ | 2038 | /* insert an orphan item to track subvolume contains orphan files */ |
| @@ -2158,6 +2159,38 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) | |||
| 2158 | if (ret && ret != -ESTALE) | 2159 | if (ret && ret != -ESTALE) |
| 2159 | goto out; | 2160 | goto out; |
| 2160 | 2161 | ||
| 2162 | if (ret == -ESTALE && root == root->fs_info->tree_root) { | ||
| 2163 | struct btrfs_root *dead_root; | ||
| 2164 | struct btrfs_fs_info *fs_info = root->fs_info; | ||
| 2165 | int is_dead_root = 0; | ||
| 2166 | |||
| 2167 | /* | ||
| 2168 | * this is an orphan in the tree root. Currently these | ||
| 2169 | * could come from 2 sources: | ||
| 2170 | * a) a snapshot deletion in progress | ||
| 2171 | * b) a free space cache inode | ||
| 2172 | * We need to distinguish those two, as the snapshot | ||
| 2173 | * orphan must not get deleted. | ||
| 2174 | * find_dead_roots already ran before us, so if this | ||
| 2175 | * is a snapshot deletion, we should find the root | ||
| 2176 | * in the dead_roots list | ||
| 2177 | */ | ||
| 2178 | spin_lock(&fs_info->trans_lock); | ||
| 2179 | list_for_each_entry(dead_root, &fs_info->dead_roots, | ||
| 2180 | root_list) { | ||
| 2181 | if (dead_root->root_key.objectid == | ||
| 2182 | found_key.objectid) { | ||
| 2183 | is_dead_root = 1; | ||
| 2184 | break; | ||
| 2185 | } | ||
| 2186 | } | ||
| 2187 | spin_unlock(&fs_info->trans_lock); | ||
| 2188 | if (is_dead_root) { | ||
| 2189 | /* prevent this orphan from being found again */ | ||
| 2190 | key.offset = found_key.objectid - 1; | ||
| 2191 | continue; | ||
| 2192 | } | ||
| 2193 | } | ||
| 2161 | /* | 2194 | /* |
| 2162 | * Inode is already gone but the orphan item is still there, | 2195 | * Inode is already gone but the orphan item is still there, |
| 2163 | * kill the orphan item. | 2196 | * kill the orphan item. |
| @@ -2191,7 +2224,14 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) | |||
| 2191 | continue; | 2224 | continue; |
| 2192 | } | 2225 | } |
| 2193 | nr_truncate++; | 2226 | nr_truncate++; |
| 2227 | /* | ||
| 2228 | * Need to hold the imutex for reservation purposes, not | ||
| 2229 | * a huge deal here but I have a WARN_ON in | ||
| 2230 | * btrfs_delalloc_reserve_space to catch offenders. | ||
| 2231 | */ | ||
| 2232 | mutex_lock(&inode->i_mutex); | ||
| 2194 | ret = btrfs_truncate(inode); | 2233 | ret = btrfs_truncate(inode); |
| 2234 | mutex_unlock(&inode->i_mutex); | ||
| 2195 | } else { | 2235 | } else { |
| 2196 | nr_unlink++; | 2236 | nr_unlink++; |
| 2197 | } | 2237 | } |
| @@ -3327,7 +3367,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
| 3327 | u64 hint_byte = 0; | 3367 | u64 hint_byte = 0; |
| 3328 | hole_size = last_byte - cur_offset; | 3368 | hole_size = last_byte - cur_offset; |
| 3329 | 3369 | ||
| 3330 | trans = btrfs_start_transaction(root, 2); | 3370 | trans = btrfs_start_transaction(root, 3); |
| 3331 | if (IS_ERR(trans)) { | 3371 | if (IS_ERR(trans)) { |
| 3332 | err = PTR_ERR(trans); | 3372 | err = PTR_ERR(trans); |
| 3333 | break; | 3373 | break; |
| @@ -3337,6 +3377,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
| 3337 | cur_offset + hole_size, | 3377 | cur_offset + hole_size, |
| 3338 | &hint_byte, 1); | 3378 | &hint_byte, 1); |
| 3339 | if (err) { | 3379 | if (err) { |
| 3380 | btrfs_update_inode(trans, root, inode); | ||
| 3340 | btrfs_end_transaction(trans, root); | 3381 | btrfs_end_transaction(trans, root); |
| 3341 | break; | 3382 | break; |
| 3342 | } | 3383 | } |
| @@ -3346,6 +3387,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
| 3346 | 0, hole_size, 0, hole_size, | 3387 | 0, hole_size, 0, hole_size, |
| 3347 | 0, 0, 0); | 3388 | 0, 0, 0); |
| 3348 | if (err) { | 3389 | if (err) { |
| 3390 | btrfs_update_inode(trans, root, inode); | ||
| 3349 | btrfs_end_transaction(trans, root); | 3391 | btrfs_end_transaction(trans, root); |
| 3350 | break; | 3392 | break; |
| 3351 | } | 3393 | } |
| @@ -3353,6 +3395,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
| 3353 | btrfs_drop_extent_cache(inode, hole_start, | 3395 | btrfs_drop_extent_cache(inode, hole_start, |
| 3354 | last_byte - 1, 0); | 3396 | last_byte - 1, 0); |
| 3355 | 3397 | ||
| 3398 | btrfs_update_inode(trans, root, inode); | ||
| 3356 | btrfs_end_transaction(trans, root); | 3399 | btrfs_end_transaction(trans, root); |
| 3357 | } | 3400 | } |
| 3358 | free_extent_map(em); | 3401 | free_extent_map(em); |
| @@ -3370,6 +3413,8 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) | |||
| 3370 | 3413 | ||
| 3371 | static int btrfs_setsize(struct inode *inode, loff_t newsize) | 3414 | static int btrfs_setsize(struct inode *inode, loff_t newsize) |
| 3372 | { | 3415 | { |
| 3416 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
| 3417 | struct btrfs_trans_handle *trans; | ||
| 3373 | loff_t oldsize = i_size_read(inode); | 3418 | loff_t oldsize = i_size_read(inode); |
| 3374 | int ret; | 3419 | int ret; |
| 3375 | 3420 | ||
| @@ -3377,16 +3422,19 @@ static int btrfs_setsize(struct inode *inode, loff_t newsize) | |||
| 3377 | return 0; | 3422 | return 0; |
| 3378 | 3423 | ||
| 3379 | if (newsize > oldsize) { | 3424 | if (newsize > oldsize) { |
| 3380 | i_size_write(inode, newsize); | ||
| 3381 | btrfs_ordered_update_i_size(inode, i_size_read(inode), NULL); | ||
| 3382 | truncate_pagecache(inode, oldsize, newsize); | 3425 | truncate_pagecache(inode, oldsize, newsize); |
| 3383 | ret = btrfs_cont_expand(inode, oldsize, newsize); | 3426 | ret = btrfs_cont_expand(inode, oldsize, newsize); |
| 3384 | if (ret) { | 3427 | if (ret) |
| 3385 | btrfs_setsize(inode, oldsize); | ||
| 3386 | return ret; | 3428 | return ret; |
| 3387 | } | ||
| 3388 | 3429 | ||
| 3389 | mark_inode_dirty(inode); | 3430 | trans = btrfs_start_transaction(root, 1); |
| 3431 | if (IS_ERR(trans)) | ||
| 3432 | return PTR_ERR(trans); | ||
| 3433 | |||
| 3434 | i_size_write(inode, newsize); | ||
| 3435 | btrfs_ordered_update_i_size(inode, i_size_read(inode), NULL); | ||
| 3436 | ret = btrfs_update_inode(trans, root, inode); | ||
| 3437 | btrfs_end_transaction_throttle(trans, root); | ||
| 3390 | } else { | 3438 | } else { |
| 3391 | 3439 | ||
| 3392 | /* | 3440 | /* |
| @@ -3426,9 +3474,9 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 3426 | 3474 | ||
| 3427 | if (attr->ia_valid) { | 3475 | if (attr->ia_valid) { |
| 3428 | setattr_copy(inode, attr); | 3476 | setattr_copy(inode, attr); |
| 3429 | mark_inode_dirty(inode); | 3477 | err = btrfs_dirty_inode(inode); |
| 3430 | 3478 | ||
| 3431 | if (attr->ia_valid & ATTR_MODE) | 3479 | if (!err && attr->ia_valid & ATTR_MODE) |
| 3432 | err = btrfs_acl_chmod(inode); | 3480 | err = btrfs_acl_chmod(inode); |
| 3433 | } | 3481 | } |
| 3434 | 3482 | ||
| @@ -4204,42 +4252,80 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 4204 | * FIXME, needs more benchmarking...there are no reasons other than performance | 4252 | * FIXME, needs more benchmarking...there are no reasons other than performance |
| 4205 | * to keep or drop this code. | 4253 | * to keep or drop this code. |
| 4206 | */ | 4254 | */ |
| 4207 | void btrfs_dirty_inode(struct inode *inode, int flags) | 4255 | int btrfs_dirty_inode(struct inode *inode) |
| 4208 | { | 4256 | { |
| 4209 | struct btrfs_root *root = BTRFS_I(inode)->root; | 4257 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 4210 | struct btrfs_trans_handle *trans; | 4258 | struct btrfs_trans_handle *trans; |
| 4211 | int ret; | 4259 | int ret; |
| 4212 | 4260 | ||
| 4213 | if (BTRFS_I(inode)->dummy_inode) | 4261 | if (BTRFS_I(inode)->dummy_inode) |
| 4214 | return; | 4262 | return 0; |
| 4215 | 4263 | ||
| 4216 | trans = btrfs_join_transaction(root); | 4264 | trans = btrfs_join_transaction(root); |
| 4217 | BUG_ON(IS_ERR(trans)); | 4265 | if (IS_ERR(trans)) |
| 4266 | return PTR_ERR(trans); | ||
| 4218 | 4267 | ||
| 4219 | ret = btrfs_update_inode(trans, root, inode); | 4268 | ret = btrfs_update_inode(trans, root, inode); |
| 4220 | if (ret && ret == -ENOSPC) { | 4269 | if (ret && ret == -ENOSPC) { |
| 4221 | /* whoops, lets try again with the full transaction */ | 4270 | /* whoops, lets try again with the full transaction */ |
| 4222 | btrfs_end_transaction(trans, root); | 4271 | btrfs_end_transaction(trans, root); |
| 4223 | trans = btrfs_start_transaction(root, 1); | 4272 | trans = btrfs_start_transaction(root, 1); |
| 4224 | if (IS_ERR(trans)) { | 4273 | if (IS_ERR(trans)) |
| 4225 | printk_ratelimited(KERN_ERR "btrfs: fail to " | 4274 | return PTR_ERR(trans); |
| 4226 | "dirty inode %llu error %ld\n", | ||
| 4227 | (unsigned long long)btrfs_ino(inode), | ||
| 4228 | PTR_ERR(trans)); | ||
| 4229 | return; | ||
| 4230 | } | ||
| 4231 | 4275 | ||
| 4232 | ret = btrfs_update_inode(trans, root, inode); | 4276 | ret = btrfs_update_inode(trans, root, inode); |
| 4233 | if (ret) { | ||
| 4234 | printk_ratelimited(KERN_ERR "btrfs: fail to " | ||
| 4235 | "dirty inode %llu error %d\n", | ||
| 4236 | (unsigned long long)btrfs_ino(inode), | ||
| 4237 | ret); | ||
| 4238 | } | ||
| 4239 | } | 4277 | } |
| 4240 | btrfs_end_transaction(trans, root); | 4278 | btrfs_end_transaction(trans, root); |
| 4241 | if (BTRFS_I(inode)->delayed_node) | 4279 | if (BTRFS_I(inode)->delayed_node) |
| 4242 | btrfs_balance_delayed_items(root); | 4280 | btrfs_balance_delayed_items(root); |
| 4281 | |||
| 4282 | return ret; | ||
| 4283 | } | ||
| 4284 | |||
| 4285 | /* | ||
| 4286 | * This is a copy of file_update_time. We need this so we can return error on | ||
| 4287 | * ENOSPC for updating the inode in the case of file write and mmap writes. | ||
| 4288 | */ | ||
| 4289 | int btrfs_update_time(struct file *file) | ||
| 4290 | { | ||
| 4291 | struct inode *inode = file->f_path.dentry->d_inode; | ||
| 4292 | struct timespec now; | ||
| 4293 | int ret; | ||
| 4294 | enum { S_MTIME = 1, S_CTIME = 2, S_VERSION = 4 } sync_it = 0; | ||
| 4295 | |||
| 4296 | /* First try to exhaust all avenues to not sync */ | ||
| 4297 | if (IS_NOCMTIME(inode)) | ||
| 4298 | return 0; | ||
| 4299 | |||
| 4300 | now = current_fs_time(inode->i_sb); | ||
| 4301 | if (!timespec_equal(&inode->i_mtime, &now)) | ||
| 4302 | sync_it = S_MTIME; | ||
| 4303 | |||
| 4304 | if (!timespec_equal(&inode->i_ctime, &now)) | ||
| 4305 | sync_it |= S_CTIME; | ||
| 4306 | |||
| 4307 | if (IS_I_VERSION(inode)) | ||
| 4308 | sync_it |= S_VERSION; | ||
| 4309 | |||
| 4310 | if (!sync_it) | ||
| 4311 | return 0; | ||
| 4312 | |||
| 4313 | /* Finally allowed to write? Takes lock. */ | ||
| 4314 | if (mnt_want_write_file(file)) | ||
| 4315 | return 0; | ||
| 4316 | |||
| 4317 | /* Only change inode inside the lock region */ | ||
| 4318 | if (sync_it & S_VERSION) | ||
| 4319 | inode_inc_iversion(inode); | ||
| 4320 | if (sync_it & S_CTIME) | ||
| 4321 | inode->i_ctime = now; | ||
| 4322 | if (sync_it & S_MTIME) | ||
| 4323 | inode->i_mtime = now; | ||
| 4324 | ret = btrfs_dirty_inode(inode); | ||
| 4325 | if (!ret) | ||
| 4326 | mark_inode_dirty_sync(inode); | ||
| 4327 | mnt_drop_write(file->f_path.mnt); | ||
| 4328 | return ret; | ||
| 4243 | } | 4329 | } |
| 4244 | 4330 | ||
| 4245 | /* | 4331 | /* |
| @@ -4504,10 +4590,6 @@ static int btrfs_add_nondir(struct btrfs_trans_handle *trans, | |||
| 4504 | int err = btrfs_add_link(trans, dir, inode, | 4590 | int err = btrfs_add_link(trans, dir, inode, |
| 4505 | dentry->d_name.name, dentry->d_name.len, | 4591 | dentry->d_name.name, dentry->d_name.len, |
| 4506 | backref, index); | 4592 | backref, index); |
| 4507 | if (!err) { | ||
| 4508 | d_instantiate(dentry, inode); | ||
| 4509 | return 0; | ||
| 4510 | } | ||
| 4511 | if (err > 0) | 4593 | if (err > 0) |
| 4512 | err = -EEXIST; | 4594 | err = -EEXIST; |
| 4513 | return err; | 4595 | return err; |
| @@ -4555,13 +4637,21 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
| 4555 | goto out_unlock; | 4637 | goto out_unlock; |
| 4556 | } | 4638 | } |
| 4557 | 4639 | ||
| 4640 | /* | ||
| 4641 | * If the active LSM wants to access the inode during | ||
| 4642 | * d_instantiate it needs these. Smack checks to see | ||
| 4643 | * if the filesystem supports xattrs by looking at the | ||
| 4644 | * ops vector. | ||
| 4645 | */ | ||
| 4646 | |||
| 4647 | inode->i_op = &btrfs_special_inode_operations; | ||
| 4558 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 4648 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
| 4559 | if (err) | 4649 | if (err) |
| 4560 | drop_inode = 1; | 4650 | drop_inode = 1; |
| 4561 | else { | 4651 | else { |
| 4562 | inode->i_op = &btrfs_special_inode_operations; | ||
| 4563 | init_special_inode(inode, inode->i_mode, rdev); | 4652 | init_special_inode(inode, inode->i_mode, rdev); |
| 4564 | btrfs_update_inode(trans, root, inode); | 4653 | btrfs_update_inode(trans, root, inode); |
| 4654 | d_instantiate(dentry, inode); | ||
| 4565 | } | 4655 | } |
| 4566 | out_unlock: | 4656 | out_unlock: |
| 4567 | nr = trans->blocks_used; | 4657 | nr = trans->blocks_used; |
| @@ -4613,15 +4703,23 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
| 4613 | goto out_unlock; | 4703 | goto out_unlock; |
| 4614 | } | 4704 | } |
| 4615 | 4705 | ||
| 4706 | /* | ||
| 4707 | * If the active LSM wants to access the inode during | ||
| 4708 | * d_instantiate it needs these. Smack checks to see | ||
| 4709 | * if the filesystem supports xattrs by looking at the | ||
| 4710 | * ops vector. | ||
| 4711 | */ | ||
| 4712 | inode->i_fop = &btrfs_file_operations; | ||
| 4713 | inode->i_op = &btrfs_file_inode_operations; | ||
| 4714 | |||
| 4616 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 4715 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
| 4617 | if (err) | 4716 | if (err) |
| 4618 | drop_inode = 1; | 4717 | drop_inode = 1; |
| 4619 | else { | 4718 | else { |
| 4620 | inode->i_mapping->a_ops = &btrfs_aops; | 4719 | inode->i_mapping->a_ops = &btrfs_aops; |
| 4621 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | 4720 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; |
| 4622 | inode->i_fop = &btrfs_file_operations; | ||
| 4623 | inode->i_op = &btrfs_file_inode_operations; | ||
| 4624 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 4721 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
| 4722 | d_instantiate(dentry, inode); | ||
| 4625 | } | 4723 | } |
| 4626 | out_unlock: | 4724 | out_unlock: |
| 4627 | nr = trans->blocks_used; | 4725 | nr = trans->blocks_used; |
| @@ -4679,6 +4777,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
| 4679 | struct dentry *parent = dentry->d_parent; | 4777 | struct dentry *parent = dentry->d_parent; |
| 4680 | err = btrfs_update_inode(trans, root, inode); | 4778 | err = btrfs_update_inode(trans, root, inode); |
| 4681 | BUG_ON(err); | 4779 | BUG_ON(err); |
| 4780 | d_instantiate(dentry, inode); | ||
| 4682 | btrfs_log_new_name(trans, inode, NULL, parent); | 4781 | btrfs_log_new_name(trans, inode, NULL, parent); |
| 4683 | } | 4782 | } |
| 4684 | 4783 | ||
| @@ -6303,7 +6402,12 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 6303 | u64 page_start; | 6402 | u64 page_start; |
| 6304 | u64 page_end; | 6403 | u64 page_end; |
| 6305 | 6404 | ||
| 6405 | /* Need this to keep space reservations serialized */ | ||
| 6406 | mutex_lock(&inode->i_mutex); | ||
| 6306 | ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); | 6407 | ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); |
| 6408 | mutex_unlock(&inode->i_mutex); | ||
| 6409 | if (!ret) | ||
| 6410 | ret = btrfs_update_time(vma->vm_file); | ||
| 6307 | if (ret) { | 6411 | if (ret) { |
| 6308 | if (ret == -ENOMEM) | 6412 | if (ret == -ENOMEM) |
| 6309 | ret = VM_FAULT_OOM; | 6413 | ret = VM_FAULT_OOM; |
| @@ -6515,8 +6619,9 @@ static int btrfs_truncate(struct inode *inode) | |||
| 6515 | /* Just need the 1 for updating the inode */ | 6619 | /* Just need the 1 for updating the inode */ |
| 6516 | trans = btrfs_start_transaction(root, 1); | 6620 | trans = btrfs_start_transaction(root, 1); |
| 6517 | if (IS_ERR(trans)) { | 6621 | if (IS_ERR(trans)) { |
| 6518 | err = PTR_ERR(trans); | 6622 | ret = err = PTR_ERR(trans); |
| 6519 | goto out; | 6623 | trans = NULL; |
| 6624 | break; | ||
| 6520 | } | 6625 | } |
| 6521 | } | 6626 | } |
| 6522 | 6627 | ||
| @@ -7076,14 +7181,21 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
| 7076 | goto out_unlock; | 7181 | goto out_unlock; |
| 7077 | } | 7182 | } |
| 7078 | 7183 | ||
| 7184 | /* | ||
| 7185 | * If the active LSM wants to access the inode during | ||
| 7186 | * d_instantiate it needs these. Smack checks to see | ||
| 7187 | * if the filesystem supports xattrs by looking at the | ||
| 7188 | * ops vector. | ||
| 7189 | */ | ||
| 7190 | inode->i_fop = &btrfs_file_operations; | ||
| 7191 | inode->i_op = &btrfs_file_inode_operations; | ||
| 7192 | |||
| 7079 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 7193 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
| 7080 | if (err) | 7194 | if (err) |
| 7081 | drop_inode = 1; | 7195 | drop_inode = 1; |
| 7082 | else { | 7196 | else { |
| 7083 | inode->i_mapping->a_ops = &btrfs_aops; | 7197 | inode->i_mapping->a_ops = &btrfs_aops; |
| 7084 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | 7198 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; |
| 7085 | inode->i_fop = &btrfs_file_operations; | ||
| 7086 | inode->i_op = &btrfs_file_inode_operations; | ||
| 7087 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 7199 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
| 7088 | } | 7200 | } |
| 7089 | if (drop_inode) | 7201 | if (drop_inode) |
| @@ -7132,6 +7244,8 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
| 7132 | drop_inode = 1; | 7244 | drop_inode = 1; |
| 7133 | 7245 | ||
| 7134 | out_unlock: | 7246 | out_unlock: |
| 7247 | if (!err) | ||
| 7248 | d_instantiate(dentry, inode); | ||
| 7135 | nr = trans->blocks_used; | 7249 | nr = trans->blocks_used; |
| 7136 | btrfs_end_transaction_throttle(trans, root); | 7250 | btrfs_end_transaction_throttle(trans, root); |
| 7137 | if (drop_inode) { | 7251 | if (drop_inode) { |
| @@ -7353,6 +7467,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = { | |||
| 7353 | .follow_link = page_follow_link_light, | 7467 | .follow_link = page_follow_link_light, |
| 7354 | .put_link = page_put_link, | 7468 | .put_link = page_put_link, |
| 7355 | .getattr = btrfs_getattr, | 7469 | .getattr = btrfs_getattr, |
| 7470 | .setattr = btrfs_setattr, | ||
| 7356 | .permission = btrfs_permission, | 7471 | .permission = btrfs_permission, |
| 7357 | .setxattr = btrfs_setxattr, | 7472 | .setxattr = btrfs_setxattr, |
| 7358 | .getxattr = btrfs_getxattr, | 7473 | .getxattr = btrfs_getxattr, |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 72d461656f60..c04f02c7d5bb 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -252,11 +252,11 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
| 252 | trans = btrfs_join_transaction(root); | 252 | trans = btrfs_join_transaction(root); |
| 253 | BUG_ON(IS_ERR(trans)); | 253 | BUG_ON(IS_ERR(trans)); |
| 254 | 254 | ||
| 255 | btrfs_update_iflags(inode); | ||
| 256 | inode->i_ctime = CURRENT_TIME; | ||
| 255 | ret = btrfs_update_inode(trans, root, inode); | 257 | ret = btrfs_update_inode(trans, root, inode); |
| 256 | BUG_ON(ret); | 258 | BUG_ON(ret); |
| 257 | 259 | ||
| 258 | btrfs_update_iflags(inode); | ||
| 259 | inode->i_ctime = CURRENT_TIME; | ||
| 260 | btrfs_end_transaction(trans, root); | 260 | btrfs_end_transaction(trans, root); |
| 261 | 261 | ||
| 262 | mnt_drop_write(file->f_path.mnt); | 262 | mnt_drop_write(file->f_path.mnt); |
| @@ -858,8 +858,10 @@ static int cluster_pages_for_defrag(struct inode *inode, | |||
| 858 | return 0; | 858 | return 0; |
| 859 | file_end = (isize - 1) >> PAGE_CACHE_SHIFT; | 859 | file_end = (isize - 1) >> PAGE_CACHE_SHIFT; |
| 860 | 860 | ||
| 861 | mutex_lock(&inode->i_mutex); | ||
| 861 | ret = btrfs_delalloc_reserve_space(inode, | 862 | ret = btrfs_delalloc_reserve_space(inode, |
| 862 | num_pages << PAGE_CACHE_SHIFT); | 863 | num_pages << PAGE_CACHE_SHIFT); |
| 864 | mutex_unlock(&inode->i_mutex); | ||
| 863 | if (ret) | 865 | if (ret) |
| 864 | return ret; | 866 | return ret; |
| 865 | again: | 867 | again: |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index dff29d5e151a..cfb55434a469 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
| @@ -2947,7 +2947,9 @@ static int relocate_file_extent_cluster(struct inode *inode, | |||
| 2947 | index = (cluster->start - offset) >> PAGE_CACHE_SHIFT; | 2947 | index = (cluster->start - offset) >> PAGE_CACHE_SHIFT; |
| 2948 | last_index = (cluster->end - offset) >> PAGE_CACHE_SHIFT; | 2948 | last_index = (cluster->end - offset) >> PAGE_CACHE_SHIFT; |
| 2949 | while (index <= last_index) { | 2949 | while (index <= last_index) { |
| 2950 | mutex_lock(&inode->i_mutex); | ||
| 2950 | ret = btrfs_delalloc_reserve_metadata(inode, PAGE_CACHE_SIZE); | 2951 | ret = btrfs_delalloc_reserve_metadata(inode, PAGE_CACHE_SIZE); |
| 2952 | mutex_unlock(&inode->i_mutex); | ||
| 2951 | if (ret) | 2953 | if (ret) |
| 2952 | goto out; | 2954 | goto out; |
| 2953 | 2955 | ||
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index c27bcb67f330..ddf2c90d3fc0 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
| @@ -1535,18 +1535,22 @@ static noinline_for_stack int scrub_supers(struct scrub_dev *sdev) | |||
| 1535 | static noinline_for_stack int scrub_workers_get(struct btrfs_root *root) | 1535 | static noinline_for_stack int scrub_workers_get(struct btrfs_root *root) |
| 1536 | { | 1536 | { |
| 1537 | struct btrfs_fs_info *fs_info = root->fs_info; | 1537 | struct btrfs_fs_info *fs_info = root->fs_info; |
| 1538 | int ret = 0; | ||
| 1538 | 1539 | ||
| 1539 | mutex_lock(&fs_info->scrub_lock); | 1540 | mutex_lock(&fs_info->scrub_lock); |
| 1540 | if (fs_info->scrub_workers_refcnt == 0) { | 1541 | if (fs_info->scrub_workers_refcnt == 0) { |
| 1541 | btrfs_init_workers(&fs_info->scrub_workers, "scrub", | 1542 | btrfs_init_workers(&fs_info->scrub_workers, "scrub", |
| 1542 | fs_info->thread_pool_size, &fs_info->generic_worker); | 1543 | fs_info->thread_pool_size, &fs_info->generic_worker); |
| 1543 | fs_info->scrub_workers.idle_thresh = 4; | 1544 | fs_info->scrub_workers.idle_thresh = 4; |
| 1544 | btrfs_start_workers(&fs_info->scrub_workers, 1); | 1545 | ret = btrfs_start_workers(&fs_info->scrub_workers); |
| 1546 | if (ret) | ||
| 1547 | goto out; | ||
| 1545 | } | 1548 | } |
| 1546 | ++fs_info->scrub_workers_refcnt; | 1549 | ++fs_info->scrub_workers_refcnt; |
| 1550 | out: | ||
| 1547 | mutex_unlock(&fs_info->scrub_lock); | 1551 | mutex_unlock(&fs_info->scrub_lock); |
| 1548 | 1552 | ||
| 1549 | return 0; | 1553 | return ret; |
| 1550 | } | 1554 | } |
| 1551 | 1555 | ||
| 1552 | static noinline_for_stack void scrub_workers_put(struct btrfs_root *root) | 1556 | static noinline_for_stack void scrub_workers_put(struct btrfs_root *root) |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index e28ad4baf483..200f63bc6675 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
| 42 | #include <linux/cleancache.h> | 42 | #include <linux/cleancache.h> |
| 43 | #include <linux/mnt_namespace.h> | 43 | #include <linux/mnt_namespace.h> |
| 44 | #include <linux/ratelimit.h> | ||
| 44 | #include "compat.h" | 45 | #include "compat.h" |
| 45 | #include "delayed-inode.h" | 46 | #include "delayed-inode.h" |
| 46 | #include "ctree.h" | 47 | #include "ctree.h" |
| @@ -1053,7 +1054,7 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
| 1053 | u64 avail_space; | 1054 | u64 avail_space; |
| 1054 | u64 used_space; | 1055 | u64 used_space; |
| 1055 | u64 min_stripe_size; | 1056 | u64 min_stripe_size; |
| 1056 | int min_stripes = 1; | 1057 | int min_stripes = 1, num_stripes = 1; |
| 1057 | int i = 0, nr_devices; | 1058 | int i = 0, nr_devices; |
| 1058 | int ret; | 1059 | int ret; |
| 1059 | 1060 | ||
| @@ -1067,12 +1068,16 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
| 1067 | 1068 | ||
| 1068 | /* calc min stripe number for data space alloction */ | 1069 | /* calc min stripe number for data space alloction */ |
| 1069 | type = btrfs_get_alloc_profile(root, 1); | 1070 | type = btrfs_get_alloc_profile(root, 1); |
| 1070 | if (type & BTRFS_BLOCK_GROUP_RAID0) | 1071 | if (type & BTRFS_BLOCK_GROUP_RAID0) { |
| 1071 | min_stripes = 2; | 1072 | min_stripes = 2; |
| 1072 | else if (type & BTRFS_BLOCK_GROUP_RAID1) | 1073 | num_stripes = nr_devices; |
| 1074 | } else if (type & BTRFS_BLOCK_GROUP_RAID1) { | ||
| 1073 | min_stripes = 2; | 1075 | min_stripes = 2; |
| 1074 | else if (type & BTRFS_BLOCK_GROUP_RAID10) | 1076 | num_stripes = 2; |
| 1077 | } else if (type & BTRFS_BLOCK_GROUP_RAID10) { | ||
| 1075 | min_stripes = 4; | 1078 | min_stripes = 4; |
| 1079 | num_stripes = 4; | ||
| 1080 | } | ||
| 1076 | 1081 | ||
| 1077 | if (type & BTRFS_BLOCK_GROUP_DUP) | 1082 | if (type & BTRFS_BLOCK_GROUP_DUP) |
| 1078 | min_stripe_size = 2 * BTRFS_STRIPE_LEN; | 1083 | min_stripe_size = 2 * BTRFS_STRIPE_LEN; |
| @@ -1141,13 +1146,16 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
| 1141 | i = nr_devices - 1; | 1146 | i = nr_devices - 1; |
| 1142 | avail_space = 0; | 1147 | avail_space = 0; |
| 1143 | while (nr_devices >= min_stripes) { | 1148 | while (nr_devices >= min_stripes) { |
| 1149 | if (num_stripes > nr_devices) | ||
| 1150 | num_stripes = nr_devices; | ||
| 1151 | |||
| 1144 | if (devices_info[i].max_avail >= min_stripe_size) { | 1152 | if (devices_info[i].max_avail >= min_stripe_size) { |
| 1145 | int j; | 1153 | int j; |
| 1146 | u64 alloc_size; | 1154 | u64 alloc_size; |
| 1147 | 1155 | ||
| 1148 | avail_space += devices_info[i].max_avail * min_stripes; | 1156 | avail_space += devices_info[i].max_avail * num_stripes; |
| 1149 | alloc_size = devices_info[i].max_avail; | 1157 | alloc_size = devices_info[i].max_avail; |
| 1150 | for (j = i + 1 - min_stripes; j <= i; j++) | 1158 | for (j = i + 1 - num_stripes; j <= i; j++) |
| 1151 | devices_info[j].max_avail -= alloc_size; | 1159 | devices_info[j].max_avail -= alloc_size; |
| 1152 | } | 1160 | } |
| 1153 | i--; | 1161 | i--; |
| @@ -1264,6 +1272,16 @@ static int btrfs_unfreeze(struct super_block *sb) | |||
| 1264 | return 0; | 1272 | return 0; |
| 1265 | } | 1273 | } |
| 1266 | 1274 | ||
| 1275 | static void btrfs_fs_dirty_inode(struct inode *inode, int flags) | ||
| 1276 | { | ||
| 1277 | int ret; | ||
| 1278 | |||
| 1279 | ret = btrfs_dirty_inode(inode); | ||
| 1280 | if (ret) | ||
| 1281 | printk_ratelimited(KERN_ERR "btrfs: fail to dirty inode %Lu " | ||
| 1282 | "error %d\n", btrfs_ino(inode), ret); | ||
| 1283 | } | ||
| 1284 | |||
| 1267 | static const struct super_operations btrfs_super_ops = { | 1285 | static const struct super_operations btrfs_super_ops = { |
| 1268 | .drop_inode = btrfs_drop_inode, | 1286 | .drop_inode = btrfs_drop_inode, |
| 1269 | .evict_inode = btrfs_evict_inode, | 1287 | .evict_inode = btrfs_evict_inode, |
| @@ -1271,7 +1289,7 @@ static const struct super_operations btrfs_super_ops = { | |||
| 1271 | .sync_fs = btrfs_sync_fs, | 1289 | .sync_fs = btrfs_sync_fs, |
| 1272 | .show_options = btrfs_show_options, | 1290 | .show_options = btrfs_show_options, |
| 1273 | .write_inode = btrfs_write_inode, | 1291 | .write_inode = btrfs_write_inode, |
| 1274 | .dirty_inode = btrfs_dirty_inode, | 1292 | .dirty_inode = btrfs_fs_dirty_inode, |
| 1275 | .alloc_inode = btrfs_alloc_inode, | 1293 | .alloc_inode = btrfs_alloc_inode, |
| 1276 | .destroy_inode = btrfs_destroy_inode, | 1294 | .destroy_inode = btrfs_destroy_inode, |
| 1277 | .statfs = btrfs_statfs, | 1295 | .statfs = btrfs_statfs, |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c37433d3cd82..f4b839fd3c9d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -295,6 +295,12 @@ loop_lock: | |||
| 295 | btrfs_requeue_work(&device->work); | 295 | btrfs_requeue_work(&device->work); |
| 296 | goto done; | 296 | goto done; |
| 297 | } | 297 | } |
| 298 | /* unplug every 64 requests just for good measure */ | ||
| 299 | if (batch_run % 64 == 0) { | ||
| 300 | blk_finish_plug(&plug); | ||
| 301 | blk_start_plug(&plug); | ||
| 302 | sync_pending = 0; | ||
| 303 | } | ||
| 298 | } | 304 | } |
| 299 | 305 | ||
| 300 | cond_resched(); | 306 | cond_resched(); |
| @@ -1611,7 +1617,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
| 1611 | if ((sb->s_flags & MS_RDONLY) && !root->fs_info->fs_devices->seeding) | 1617 | if ((sb->s_flags & MS_RDONLY) && !root->fs_info->fs_devices->seeding) |
| 1612 | return -EINVAL; | 1618 | return -EINVAL; |
| 1613 | 1619 | ||
| 1614 | bdev = blkdev_get_by_path(device_path, FMODE_EXCL, | 1620 | bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL, |
| 1615 | root->fs_info->bdev_holder); | 1621 | root->fs_info->bdev_holder); |
| 1616 | if (IS_ERR(bdev)) | 1622 | if (IS_ERR(bdev)) |
| 1617 | return PTR_ERR(bdev); | 1623 | return PTR_ERR(bdev); |
| @@ -3258,7 +3264,7 @@ static void btrfs_end_bio(struct bio *bio, int err) | |||
| 3258 | */ | 3264 | */ |
| 3259 | if (atomic_read(&bbio->error) > bbio->max_errors) { | 3265 | if (atomic_read(&bbio->error) > bbio->max_errors) { |
| 3260 | err = -EIO; | 3266 | err = -EIO; |
| 3261 | } else if (err) { | 3267 | } else { |
| 3262 | /* | 3268 | /* |
| 3263 | * this bio is actually up to date, we didn't | 3269 | * this bio is actually up to date, we didn't |
| 3264 | * go over the max number of errors | 3270 | * go over the max number of errors |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 4144caf2f9d3..173b1d22e59b 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
| @@ -87,7 +87,7 @@ static int ceph_set_page_dirty(struct page *page) | |||
| 87 | snapc = ceph_get_snap_context(ci->i_snap_realm->cached_context); | 87 | snapc = ceph_get_snap_context(ci->i_snap_realm->cached_context); |
| 88 | 88 | ||
| 89 | /* dirty the head */ | 89 | /* dirty the head */ |
| 90 | spin_lock(&inode->i_lock); | 90 | spin_lock(&ci->i_ceph_lock); |
| 91 | if (ci->i_head_snapc == NULL) | 91 | if (ci->i_head_snapc == NULL) |
| 92 | ci->i_head_snapc = ceph_get_snap_context(snapc); | 92 | ci->i_head_snapc = ceph_get_snap_context(snapc); |
| 93 | ++ci->i_wrbuffer_ref_head; | 93 | ++ci->i_wrbuffer_ref_head; |
| @@ -100,7 +100,7 @@ static int ceph_set_page_dirty(struct page *page) | |||
| 100 | ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref_head-1, | 100 | ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref_head-1, |
| 101 | ci->i_wrbuffer_ref, ci->i_wrbuffer_ref_head, | 101 | ci->i_wrbuffer_ref, ci->i_wrbuffer_ref_head, |
| 102 | snapc, snapc->seq, snapc->num_snaps); | 102 | snapc, snapc->seq, snapc->num_snaps); |
| 103 | spin_unlock(&inode->i_lock); | 103 | spin_unlock(&ci->i_ceph_lock); |
| 104 | 104 | ||
| 105 | /* now adjust page */ | 105 | /* now adjust page */ |
| 106 | spin_lock_irq(&mapping->tree_lock); | 106 | spin_lock_irq(&mapping->tree_lock); |
| @@ -391,7 +391,7 @@ static struct ceph_snap_context *get_oldest_context(struct inode *inode, | |||
| 391 | struct ceph_snap_context *snapc = NULL; | 391 | struct ceph_snap_context *snapc = NULL; |
| 392 | struct ceph_cap_snap *capsnap = NULL; | 392 | struct ceph_cap_snap *capsnap = NULL; |
| 393 | 393 | ||
| 394 | spin_lock(&inode->i_lock); | 394 | spin_lock(&ci->i_ceph_lock); |
| 395 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { | 395 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { |
| 396 | dout(" cap_snap %p snapc %p has %d dirty pages\n", capsnap, | 396 | dout(" cap_snap %p snapc %p has %d dirty pages\n", capsnap, |
| 397 | capsnap->context, capsnap->dirty_pages); | 397 | capsnap->context, capsnap->dirty_pages); |
| @@ -407,7 +407,7 @@ static struct ceph_snap_context *get_oldest_context(struct inode *inode, | |||
| 407 | dout(" head snapc %p has %d dirty pages\n", | 407 | dout(" head snapc %p has %d dirty pages\n", |
| 408 | snapc, ci->i_wrbuffer_ref_head); | 408 | snapc, ci->i_wrbuffer_ref_head); |
| 409 | } | 409 | } |
| 410 | spin_unlock(&inode->i_lock); | 410 | spin_unlock(&ci->i_ceph_lock); |
| 411 | return snapc; | 411 | return snapc; |
| 412 | } | 412 | } |
| 413 | 413 | ||
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 0f327c6c9679..8b53193e4f7c 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
| @@ -309,7 +309,7 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, | |||
| 309 | /* | 309 | /* |
| 310 | * Find ceph_cap for given mds, if any. | 310 | * Find ceph_cap for given mds, if any. |
| 311 | * | 311 | * |
| 312 | * Called with i_lock held. | 312 | * Called with i_ceph_lock held. |
| 313 | */ | 313 | */ |
| 314 | static struct ceph_cap *__get_cap_for_mds(struct ceph_inode_info *ci, int mds) | 314 | static struct ceph_cap *__get_cap_for_mds(struct ceph_inode_info *ci, int mds) |
| 315 | { | 315 | { |
| @@ -332,9 +332,9 @@ struct ceph_cap *ceph_get_cap_for_mds(struct ceph_inode_info *ci, int mds) | |||
| 332 | { | 332 | { |
| 333 | struct ceph_cap *cap; | 333 | struct ceph_cap *cap; |
| 334 | 334 | ||
| 335 | spin_lock(&ci->vfs_inode.i_lock); | 335 | spin_lock(&ci->i_ceph_lock); |
| 336 | cap = __get_cap_for_mds(ci, mds); | 336 | cap = __get_cap_for_mds(ci, mds); |
| 337 | spin_unlock(&ci->vfs_inode.i_lock); | 337 | spin_unlock(&ci->i_ceph_lock); |
| 338 | return cap; | 338 | return cap; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| @@ -361,15 +361,16 @@ static int __ceph_get_cap_mds(struct ceph_inode_info *ci) | |||
| 361 | 361 | ||
| 362 | int ceph_get_cap_mds(struct inode *inode) | 362 | int ceph_get_cap_mds(struct inode *inode) |
| 363 | { | 363 | { |
| 364 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
| 364 | int mds; | 365 | int mds; |
| 365 | spin_lock(&inode->i_lock); | 366 | spin_lock(&ci->i_ceph_lock); |
| 366 | mds = __ceph_get_cap_mds(ceph_inode(inode)); | 367 | mds = __ceph_get_cap_mds(ceph_inode(inode)); |
| 367 | spin_unlock(&inode->i_lock); | 368 | spin_unlock(&ci->i_ceph_lock); |
| 368 | return mds; | 369 | return mds; |
| 369 | } | 370 | } |
| 370 | 371 | ||
| 371 | /* | 372 | /* |
| 372 | * Called under i_lock. | 373 | * Called under i_ceph_lock. |
| 373 | */ | 374 | */ |
| 374 | static void __insert_cap_node(struct ceph_inode_info *ci, | 375 | static void __insert_cap_node(struct ceph_inode_info *ci, |
| 375 | struct ceph_cap *new) | 376 | struct ceph_cap *new) |
| @@ -415,7 +416,7 @@ static void __cap_set_timeouts(struct ceph_mds_client *mdsc, | |||
| 415 | * | 416 | * |
| 416 | * If I_FLUSH is set, leave the inode at the front of the list. | 417 | * If I_FLUSH is set, leave the inode at the front of the list. |
| 417 | * | 418 | * |
| 418 | * Caller holds i_lock | 419 | * Caller holds i_ceph_lock |
| 419 | * -> we take mdsc->cap_delay_lock | 420 | * -> we take mdsc->cap_delay_lock |
| 420 | */ | 421 | */ |
| 421 | static void __cap_delay_requeue(struct ceph_mds_client *mdsc, | 422 | static void __cap_delay_requeue(struct ceph_mds_client *mdsc, |
| @@ -457,7 +458,7 @@ static void __cap_delay_requeue_front(struct ceph_mds_client *mdsc, | |||
| 457 | /* | 458 | /* |
| 458 | * Cancel delayed work on cap. | 459 | * Cancel delayed work on cap. |
| 459 | * | 460 | * |
| 460 | * Caller must hold i_lock. | 461 | * Caller must hold i_ceph_lock. |
| 461 | */ | 462 | */ |
| 462 | static void __cap_delay_cancel(struct ceph_mds_client *mdsc, | 463 | static void __cap_delay_cancel(struct ceph_mds_client *mdsc, |
| 463 | struct ceph_inode_info *ci) | 464 | struct ceph_inode_info *ci) |
| @@ -532,14 +533,14 @@ int ceph_add_cap(struct inode *inode, | |||
| 532 | wanted |= ceph_caps_for_mode(fmode); | 533 | wanted |= ceph_caps_for_mode(fmode); |
| 533 | 534 | ||
| 534 | retry: | 535 | retry: |
| 535 | spin_lock(&inode->i_lock); | 536 | spin_lock(&ci->i_ceph_lock); |
| 536 | cap = __get_cap_for_mds(ci, mds); | 537 | cap = __get_cap_for_mds(ci, mds); |
| 537 | if (!cap) { | 538 | if (!cap) { |
| 538 | if (new_cap) { | 539 | if (new_cap) { |
| 539 | cap = new_cap; | 540 | cap = new_cap; |
| 540 | new_cap = NULL; | 541 | new_cap = NULL; |
| 541 | } else { | 542 | } else { |
| 542 | spin_unlock(&inode->i_lock); | 543 | spin_unlock(&ci->i_ceph_lock); |
| 543 | new_cap = get_cap(mdsc, caps_reservation); | 544 | new_cap = get_cap(mdsc, caps_reservation); |
| 544 | if (new_cap == NULL) | 545 | if (new_cap == NULL) |
| 545 | return -ENOMEM; | 546 | return -ENOMEM; |
| @@ -625,7 +626,7 @@ retry: | |||
| 625 | 626 | ||
| 626 | if (fmode >= 0) | 627 | if (fmode >= 0) |
| 627 | __ceph_get_fmode(ci, fmode); | 628 | __ceph_get_fmode(ci, fmode); |
| 628 | spin_unlock(&inode->i_lock); | 629 | spin_unlock(&ci->i_ceph_lock); |
| 629 | wake_up_all(&ci->i_cap_wq); | 630 | wake_up_all(&ci->i_cap_wq); |
| 630 | return 0; | 631 | return 0; |
| 631 | } | 632 | } |
| @@ -792,7 +793,7 @@ int ceph_caps_revoking(struct ceph_inode_info *ci, int mask) | |||
| 792 | struct rb_node *p; | 793 | struct rb_node *p; |
| 793 | int ret = 0; | 794 | int ret = 0; |
| 794 | 795 | ||
| 795 | spin_lock(&inode->i_lock); | 796 | spin_lock(&ci->i_ceph_lock); |
| 796 | for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) { | 797 | for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) { |
| 797 | cap = rb_entry(p, struct ceph_cap, ci_node); | 798 | cap = rb_entry(p, struct ceph_cap, ci_node); |
| 798 | if (__cap_is_valid(cap) && | 799 | if (__cap_is_valid(cap) && |
| @@ -801,7 +802,7 @@ int ceph_caps_revoking(struct ceph_inode_info *ci, int mask) | |||
| 801 | break; | 802 | break; |
| 802 | } | 803 | } |
| 803 | } | 804 | } |
| 804 | spin_unlock(&inode->i_lock); | 805 | spin_unlock(&ci->i_ceph_lock); |
| 805 | dout("ceph_caps_revoking %p %s = %d\n", inode, | 806 | dout("ceph_caps_revoking %p %s = %d\n", inode, |
| 806 | ceph_cap_string(mask), ret); | 807 | ceph_cap_string(mask), ret); |
| 807 | return ret; | 808 | return ret; |
| @@ -855,7 +856,7 @@ int __ceph_caps_mds_wanted(struct ceph_inode_info *ci) | |||
| 855 | } | 856 | } |
| 856 | 857 | ||
| 857 | /* | 858 | /* |
| 858 | * called under i_lock | 859 | * called under i_ceph_lock |
| 859 | */ | 860 | */ |
| 860 | static int __ceph_is_any_caps(struct ceph_inode_info *ci) | 861 | static int __ceph_is_any_caps(struct ceph_inode_info *ci) |
| 861 | { | 862 | { |
| @@ -865,7 +866,7 @@ static int __ceph_is_any_caps(struct ceph_inode_info *ci) | |||
| 865 | /* | 866 | /* |
| 866 | * Remove a cap. Take steps to deal with a racing iterate_session_caps. | 867 | * Remove a cap. Take steps to deal with a racing iterate_session_caps. |
| 867 | * | 868 | * |
| 868 | * caller should hold i_lock. | 869 | * caller should hold i_ceph_lock. |
| 869 | * caller will not hold session s_mutex if called from destroy_inode. | 870 | * caller will not hold session s_mutex if called from destroy_inode. |
| 870 | */ | 871 | */ |
| 871 | void __ceph_remove_cap(struct ceph_cap *cap) | 872 | void __ceph_remove_cap(struct ceph_cap *cap) |
| @@ -1028,7 +1029,7 @@ static void __queue_cap_release(struct ceph_mds_session *session, | |||
| 1028 | 1029 | ||
| 1029 | /* | 1030 | /* |
| 1030 | * Queue cap releases when an inode is dropped from our cache. Since | 1031 | * Queue cap releases when an inode is dropped from our cache. Since |
| 1031 | * inode is about to be destroyed, there is no need for i_lock. | 1032 | * inode is about to be destroyed, there is no need for i_ceph_lock. |
| 1032 | */ | 1033 | */ |
| 1033 | void ceph_queue_caps_release(struct inode *inode) | 1034 | void ceph_queue_caps_release(struct inode *inode) |
| 1034 | { | 1035 | { |
| @@ -1049,7 +1050,7 @@ void ceph_queue_caps_release(struct inode *inode) | |||
| 1049 | 1050 | ||
| 1050 | /* | 1051 | /* |
| 1051 | * Send a cap msg on the given inode. Update our caps state, then | 1052 | * Send a cap msg on the given inode. Update our caps state, then |
| 1052 | * drop i_lock and send the message. | 1053 | * drop i_ceph_lock and send the message. |
| 1053 | * | 1054 | * |
| 1054 | * Make note of max_size reported/requested from mds, revoked caps | 1055 | * Make note of max_size reported/requested from mds, revoked caps |
| 1055 | * that have now been implemented. | 1056 | * that have now been implemented. |
| @@ -1061,13 +1062,13 @@ void ceph_queue_caps_release(struct inode *inode) | |||
| 1061 | * Return non-zero if delayed release, or we experienced an error | 1062 | * Return non-zero if delayed release, or we experienced an error |
| 1062 | * such that the caller should requeue + retry later. | 1063 | * such that the caller should requeue + retry later. |
| 1063 | * | 1064 | * |
| 1064 | * called with i_lock, then drops it. | 1065 | * called with i_ceph_lock, then drops it. |
| 1065 | * caller should hold snap_rwsem (read), s_mutex. | 1066 | * caller should hold snap_rwsem (read), s_mutex. |
| 1066 | */ | 1067 | */ |
| 1067 | static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | 1068 | static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, |
| 1068 | int op, int used, int want, int retain, int flushing, | 1069 | int op, int used, int want, int retain, int flushing, |
| 1069 | unsigned *pflush_tid) | 1070 | unsigned *pflush_tid) |
| 1070 | __releases(cap->ci->vfs_inode->i_lock) | 1071 | __releases(cap->ci->i_ceph_lock) |
| 1071 | { | 1072 | { |
| 1072 | struct ceph_inode_info *ci = cap->ci; | 1073 | struct ceph_inode_info *ci = cap->ci; |
| 1073 | struct inode *inode = &ci->vfs_inode; | 1074 | struct inode *inode = &ci->vfs_inode; |
| @@ -1170,7 +1171,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | |||
| 1170 | xattr_version = ci->i_xattrs.version; | 1171 | xattr_version = ci->i_xattrs.version; |
| 1171 | } | 1172 | } |
| 1172 | 1173 | ||
| 1173 | spin_unlock(&inode->i_lock); | 1174 | spin_unlock(&ci->i_ceph_lock); |
| 1174 | 1175 | ||
| 1175 | ret = send_cap_msg(session, ceph_vino(inode).ino, cap_id, | 1176 | ret = send_cap_msg(session, ceph_vino(inode).ino, cap_id, |
| 1176 | op, keep, want, flushing, seq, flush_tid, issue_seq, mseq, | 1177 | op, keep, want, flushing, seq, flush_tid, issue_seq, mseq, |
| @@ -1198,13 +1199,13 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | |||
| 1198 | * Unless @again is true, skip cap_snaps that were already sent to | 1199 | * Unless @again is true, skip cap_snaps that were already sent to |
| 1199 | * the MDS (i.e., during this session). | 1200 | * the MDS (i.e., during this session). |
| 1200 | * | 1201 | * |
| 1201 | * Called under i_lock. Takes s_mutex as needed. | 1202 | * Called under i_ceph_lock. Takes s_mutex as needed. |
| 1202 | */ | 1203 | */ |
| 1203 | void __ceph_flush_snaps(struct ceph_inode_info *ci, | 1204 | void __ceph_flush_snaps(struct ceph_inode_info *ci, |
| 1204 | struct ceph_mds_session **psession, | 1205 | struct ceph_mds_session **psession, |
| 1205 | int again) | 1206 | int again) |
| 1206 | __releases(ci->vfs_inode->i_lock) | 1207 | __releases(ci->i_ceph_lock) |
| 1207 | __acquires(ci->vfs_inode->i_lock) | 1208 | __acquires(ci->i_ceph_lock) |
| 1208 | { | 1209 | { |
| 1209 | struct inode *inode = &ci->vfs_inode; | 1210 | struct inode *inode = &ci->vfs_inode; |
| 1210 | int mds; | 1211 | int mds; |
| @@ -1261,7 +1262,7 @@ retry: | |||
| 1261 | session = NULL; | 1262 | session = NULL; |
| 1262 | } | 1263 | } |
| 1263 | if (!session) { | 1264 | if (!session) { |
| 1264 | spin_unlock(&inode->i_lock); | 1265 | spin_unlock(&ci->i_ceph_lock); |
| 1265 | mutex_lock(&mdsc->mutex); | 1266 | mutex_lock(&mdsc->mutex); |
| 1266 | session = __ceph_lookup_mds_session(mdsc, mds); | 1267 | session = __ceph_lookup_mds_session(mdsc, mds); |
| 1267 | mutex_unlock(&mdsc->mutex); | 1268 | mutex_unlock(&mdsc->mutex); |
| @@ -1275,7 +1276,7 @@ retry: | |||
| 1275 | * deletion or migration. retry, and we'll | 1276 | * deletion or migration. retry, and we'll |
| 1276 | * get a better @mds value next time. | 1277 | * get a better @mds value next time. |
| 1277 | */ | 1278 | */ |
| 1278 | spin_lock(&inode->i_lock); | 1279 | spin_lock(&ci->i_ceph_lock); |
| 1279 | goto retry; | 1280 | goto retry; |
| 1280 | } | 1281 | } |
| 1281 | 1282 | ||
| @@ -1285,7 +1286,7 @@ retry: | |||
| 1285 | list_del_init(&capsnap->flushing_item); | 1286 | list_del_init(&capsnap->flushing_item); |
| 1286 | list_add_tail(&capsnap->flushing_item, | 1287 | list_add_tail(&capsnap->flushing_item, |
| 1287 | &session->s_cap_snaps_flushing); | 1288 | &session->s_cap_snaps_flushing); |
| 1288 | spin_unlock(&inode->i_lock); | 1289 | spin_unlock(&ci->i_ceph_lock); |
| 1289 | 1290 | ||
| 1290 | dout("flush_snaps %p cap_snap %p follows %lld tid %llu\n", | 1291 | dout("flush_snaps %p cap_snap %p follows %lld tid %llu\n", |
| 1291 | inode, capsnap, capsnap->follows, capsnap->flush_tid); | 1292 | inode, capsnap, capsnap->follows, capsnap->flush_tid); |
| @@ -1302,7 +1303,7 @@ retry: | |||
| 1302 | next_follows = capsnap->follows + 1; | 1303 | next_follows = capsnap->follows + 1; |
| 1303 | ceph_put_cap_snap(capsnap); | 1304 | ceph_put_cap_snap(capsnap); |
| 1304 | 1305 | ||
| 1305 | spin_lock(&inode->i_lock); | 1306 | spin_lock(&ci->i_ceph_lock); |
| 1306 | goto retry; | 1307 | goto retry; |
| 1307 | } | 1308 | } |
| 1308 | 1309 | ||
| @@ -1322,11 +1323,9 @@ out: | |||
| 1322 | 1323 | ||
| 1323 | static void ceph_flush_snaps(struct ceph_inode_info *ci) | 1324 | static void ceph_flush_snaps(struct ceph_inode_info *ci) |
| 1324 | { | 1325 | { |
| 1325 | struct inode *inode = &ci->vfs_inode; | 1326 | spin_lock(&ci->i_ceph_lock); |
| 1326 | |||
| 1327 | spin_lock(&inode->i_lock); | ||
| 1328 | __ceph_flush_snaps(ci, NULL, 0); | 1327 | __ceph_flush_snaps(ci, NULL, 0); |
| 1329 | spin_unlock(&inode->i_lock); | 1328 | spin_unlock(&ci->i_ceph_lock); |
| 1330 | } | 1329 | } |
| 1331 | 1330 | ||
| 1332 | /* | 1331 | /* |
| @@ -1373,7 +1372,7 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) | |||
| 1373 | * Add dirty inode to the flushing list. Assigned a seq number so we | 1372 | * Add dirty inode to the flushing list. Assigned a seq number so we |
| 1374 | * can wait for caps to flush without starving. | 1373 | * can wait for caps to flush without starving. |
| 1375 | * | 1374 | * |
| 1376 | * Called under i_lock. | 1375 | * Called under i_ceph_lock. |
| 1377 | */ | 1376 | */ |
| 1378 | static int __mark_caps_flushing(struct inode *inode, | 1377 | static int __mark_caps_flushing(struct inode *inode, |
| 1379 | struct ceph_mds_session *session) | 1378 | struct ceph_mds_session *session) |
| @@ -1421,9 +1420,9 @@ static int try_nonblocking_invalidate(struct inode *inode) | |||
| 1421 | struct ceph_inode_info *ci = ceph_inode(inode); | 1420 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 1422 | u32 invalidating_gen = ci->i_rdcache_gen; | 1421 | u32 invalidating_gen = ci->i_rdcache_gen; |
| 1423 | 1422 | ||
| 1424 | spin_unlock(&inode->i_lock); | 1423 | spin_unlock(&ci->i_ceph_lock); |
| 1425 | invalidate_mapping_pages(&inode->i_data, 0, -1); | 1424 | invalidate_mapping_pages(&inode->i_data, 0, -1); |
| 1426 | spin_lock(&inode->i_lock); | 1425 | spin_lock(&ci->i_ceph_lock); |
| 1427 | 1426 | ||
| 1428 | if (inode->i_data.nrpages == 0 && | 1427 | if (inode->i_data.nrpages == 0 && |
| 1429 | invalidating_gen == ci->i_rdcache_gen) { | 1428 | invalidating_gen == ci->i_rdcache_gen) { |
| @@ -1470,7 +1469,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags, | |||
| 1470 | if (mdsc->stopping) | 1469 | if (mdsc->stopping) |
| 1471 | is_delayed = 1; | 1470 | is_delayed = 1; |
| 1472 | 1471 | ||
| 1473 | spin_lock(&inode->i_lock); | 1472 | spin_lock(&ci->i_ceph_lock); |
| 1474 | 1473 | ||
| 1475 | if (ci->i_ceph_flags & CEPH_I_FLUSH) | 1474 | if (ci->i_ceph_flags & CEPH_I_FLUSH) |
| 1476 | flags |= CHECK_CAPS_FLUSH; | 1475 | flags |= CHECK_CAPS_FLUSH; |
| @@ -1480,7 +1479,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags, | |||
| 1480 | __ceph_flush_snaps(ci, &session, 0); | 1479 | __ceph_flush_snaps(ci, &session, 0); |
| 1481 | goto retry_locked; | 1480 | goto retry_locked; |
| 1482 | retry: | 1481 | retry: |
| 1483 | spin_lock(&inode->i_lock); | 1482 | spin_lock(&ci->i_ceph_lock); |
| 1484 | retry_locked: | 1483 | retry_locked: |
| 1485 | file_wanted = __ceph_caps_file_wanted(ci); | 1484 | file_wanted = __ceph_caps_file_wanted(ci); |
| 1486 | used = __ceph_caps_used(ci); | 1485 | used = __ceph_caps_used(ci); |
| @@ -1634,7 +1633,7 @@ ack: | |||
| 1634 | if (mutex_trylock(&session->s_mutex) == 0) { | 1633 | if (mutex_trylock(&session->s_mutex) == 0) { |
| 1635 | dout("inverting session/ino locks on %p\n", | 1634 | dout("inverting session/ino locks on %p\n", |
| 1636 | session); | 1635 | session); |
| 1637 | spin_unlock(&inode->i_lock); | 1636 | spin_unlock(&ci->i_ceph_lock); |
| 1638 | if (took_snap_rwsem) { | 1637 | if (took_snap_rwsem) { |
| 1639 | up_read(&mdsc->snap_rwsem); | 1638 | up_read(&mdsc->snap_rwsem); |
| 1640 | took_snap_rwsem = 0; | 1639 | took_snap_rwsem = 0; |
| @@ -1648,7 +1647,7 @@ ack: | |||
| 1648 | if (down_read_trylock(&mdsc->snap_rwsem) == 0) { | 1647 | if (down_read_trylock(&mdsc->snap_rwsem) == 0) { |
| 1649 | dout("inverting snap/in locks on %p\n", | 1648 | dout("inverting snap/in locks on %p\n", |
| 1650 | inode); | 1649 | inode); |
| 1651 | spin_unlock(&inode->i_lock); | 1650 | spin_unlock(&ci->i_ceph_lock); |
| 1652 | down_read(&mdsc->snap_rwsem); | 1651 | down_read(&mdsc->snap_rwsem); |
| 1653 | took_snap_rwsem = 1; | 1652 | took_snap_rwsem = 1; |
| 1654 | goto retry; | 1653 | goto retry; |
| @@ -1664,10 +1663,10 @@ ack: | |||
| 1664 | mds = cap->mds; /* remember mds, so we don't repeat */ | 1663 | mds = cap->mds; /* remember mds, so we don't repeat */ |
| 1665 | sent++; | 1664 | sent++; |
| 1666 | 1665 | ||
| 1667 | /* __send_cap drops i_lock */ | 1666 | /* __send_cap drops i_ceph_lock */ |
| 1668 | delayed += __send_cap(mdsc, cap, CEPH_CAP_OP_UPDATE, used, want, | 1667 | delayed += __send_cap(mdsc, cap, CEPH_CAP_OP_UPDATE, used, want, |
| 1669 | retain, flushing, NULL); | 1668 | retain, flushing, NULL); |
| 1670 | goto retry; /* retake i_lock and restart our cap scan. */ | 1669 | goto retry; /* retake i_ceph_lock and restart our cap scan. */ |
| 1671 | } | 1670 | } |
| 1672 | 1671 | ||
| 1673 | /* | 1672 | /* |
| @@ -1681,7 +1680,7 @@ ack: | |||
| 1681 | else if (!is_delayed || force_requeue) | 1680 | else if (!is_delayed || force_requeue) |
| 1682 | __cap_delay_requeue(mdsc, ci); | 1681 | __cap_delay_requeue(mdsc, ci); |
| 1683 | 1682 | ||
| 1684 | spin_unlock(&inode->i_lock); | 1683 | spin_unlock(&ci->i_ceph_lock); |
| 1685 | 1684 | ||
| 1686 | if (queue_invalidate) | 1685 | if (queue_invalidate) |
| 1687 | ceph_queue_invalidate(inode); | 1686 | ceph_queue_invalidate(inode); |
| @@ -1704,7 +1703,7 @@ static int try_flush_caps(struct inode *inode, struct ceph_mds_session *session, | |||
| 1704 | int flushing = 0; | 1703 | int flushing = 0; |
| 1705 | 1704 | ||
| 1706 | retry: | 1705 | retry: |
| 1707 | spin_lock(&inode->i_lock); | 1706 | spin_lock(&ci->i_ceph_lock); |
| 1708 | if (ci->i_ceph_flags & CEPH_I_NOFLUSH) { | 1707 | if (ci->i_ceph_flags & CEPH_I_NOFLUSH) { |
| 1709 | dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode); | 1708 | dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode); |
| 1710 | goto out; | 1709 | goto out; |
| @@ -1716,7 +1715,7 @@ retry: | |||
| 1716 | int delayed; | 1715 | int delayed; |
| 1717 | 1716 | ||
| 1718 | if (!session) { | 1717 | if (!session) { |
| 1719 | spin_unlock(&inode->i_lock); | 1718 | spin_unlock(&ci->i_ceph_lock); |
| 1720 | session = cap->session; | 1719 | session = cap->session; |
| 1721 | mutex_lock(&session->s_mutex); | 1720 | mutex_lock(&session->s_mutex); |
| 1722 | goto retry; | 1721 | goto retry; |
| @@ -1727,18 +1726,18 @@ retry: | |||
| 1727 | 1726 | ||
| 1728 | flushing = __mark_caps_flushing(inode, session); | 1727 | flushing = __mark_caps_flushing(inode, session); |
| 1729 | 1728 | ||
| 1730 | /* __send_cap drops i_lock */ | 1729 | /* __send_cap drops i_ceph_lock */ |
| 1731 | delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, used, want, | 1730 | delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, used, want, |
| 1732 | cap->issued | cap->implemented, flushing, | 1731 | cap->issued | cap->implemented, flushing, |
| 1733 | flush_tid); | 1732 | flush_tid); |
| 1734 | if (!delayed) | 1733 | if (!delayed) |
| 1735 | goto out_unlocked; | 1734 | goto out_unlocked; |
| 1736 | 1735 | ||
| 1737 | spin_lock(&inode->i_lock); | 1736 | spin_lock(&ci->i_ceph_lock); |
| 1738 | __cap_delay_requeue(mdsc, ci); | 1737 | __cap_delay_requeue(mdsc, ci); |
| 1739 | } | 1738 | } |
| 1740 | out: | 1739 | out: |
| 1741 | spin_unlock(&inode->i_lock); | 1740 | spin_unlock(&ci->i_ceph_lock); |
| 1742 | out_unlocked: | 1741 | out_unlocked: |
| 1743 | if (session && unlock_session) | 1742 | if (session && unlock_session) |
| 1744 | mutex_unlock(&session->s_mutex); | 1743 | mutex_unlock(&session->s_mutex); |
| @@ -1753,7 +1752,7 @@ static int caps_are_flushed(struct inode *inode, unsigned tid) | |||
| 1753 | struct ceph_inode_info *ci = ceph_inode(inode); | 1752 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 1754 | int i, ret = 1; | 1753 | int i, ret = 1; |
| 1755 | 1754 | ||
| 1756 | spin_lock(&inode->i_lock); | 1755 | spin_lock(&ci->i_ceph_lock); |
| 1757 | for (i = 0; i < CEPH_CAP_BITS; i++) | 1756 | for (i = 0; i < CEPH_CAP_BITS; i++) |
| 1758 | if ((ci->i_flushing_caps & (1 << i)) && | 1757 | if ((ci->i_flushing_caps & (1 << i)) && |
| 1759 | ci->i_cap_flush_tid[i] <= tid) { | 1758 | ci->i_cap_flush_tid[i] <= tid) { |
| @@ -1761,7 +1760,7 @@ static int caps_are_flushed(struct inode *inode, unsigned tid) | |||
| 1761 | ret = 0; | 1760 | ret = 0; |
| 1762 | break; | 1761 | break; |
| 1763 | } | 1762 | } |
| 1764 | spin_unlock(&inode->i_lock); | 1763 | spin_unlock(&ci->i_ceph_lock); |
| 1765 | return ret; | 1764 | return ret; |
| 1766 | } | 1765 | } |
| 1767 | 1766 | ||
| @@ -1868,10 +1867,10 @@ int ceph_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 1868 | struct ceph_mds_client *mdsc = | 1867 | struct ceph_mds_client *mdsc = |
| 1869 | ceph_sb_to_client(inode->i_sb)->mdsc; | 1868 | ceph_sb_to_client(inode->i_sb)->mdsc; |
| 1870 | 1869 | ||
| 1871 | spin_lock(&inode->i_lock); | 1870 | spin_lock(&ci->i_ceph_lock); |
| 1872 | if (__ceph_caps_dirty(ci)) | 1871 | if (__ceph_caps_dirty(ci)) |
| 1873 | __cap_delay_requeue_front(mdsc, ci); | 1872 | __cap_delay_requeue_front(mdsc, ci); |
| 1874 | spin_unlock(&inode->i_lock); | 1873 | spin_unlock(&ci->i_ceph_lock); |
| 1875 | } | 1874 | } |
| 1876 | return err; | 1875 | return err; |
| 1877 | } | 1876 | } |
| @@ -1894,7 +1893,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc, | |||
| 1894 | struct inode *inode = &ci->vfs_inode; | 1893 | struct inode *inode = &ci->vfs_inode; |
| 1895 | struct ceph_cap *cap; | 1894 | struct ceph_cap *cap; |
| 1896 | 1895 | ||
| 1897 | spin_lock(&inode->i_lock); | 1896 | spin_lock(&ci->i_ceph_lock); |
| 1898 | cap = ci->i_auth_cap; | 1897 | cap = ci->i_auth_cap; |
| 1899 | if (cap && cap->session == session) { | 1898 | if (cap && cap->session == session) { |
| 1900 | dout("kick_flushing_caps %p cap %p capsnap %p\n", inode, | 1899 | dout("kick_flushing_caps %p cap %p capsnap %p\n", inode, |
| @@ -1904,7 +1903,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc, | |||
| 1904 | pr_err("%p auth cap %p not mds%d ???\n", inode, | 1903 | pr_err("%p auth cap %p not mds%d ???\n", inode, |
| 1905 | cap, session->s_mds); | 1904 | cap, session->s_mds); |
| 1906 | } | 1905 | } |
| 1907 | spin_unlock(&inode->i_lock); | 1906 | spin_unlock(&ci->i_ceph_lock); |
| 1908 | } | 1907 | } |
| 1909 | } | 1908 | } |
| 1910 | 1909 | ||
| @@ -1921,7 +1920,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
| 1921 | struct ceph_cap *cap; | 1920 | struct ceph_cap *cap; |
| 1922 | int delayed = 0; | 1921 | int delayed = 0; |
| 1923 | 1922 | ||
| 1924 | spin_lock(&inode->i_lock); | 1923 | spin_lock(&ci->i_ceph_lock); |
| 1925 | cap = ci->i_auth_cap; | 1924 | cap = ci->i_auth_cap; |
| 1926 | if (cap && cap->session == session) { | 1925 | if (cap && cap->session == session) { |
| 1927 | dout("kick_flushing_caps %p cap %p %s\n", inode, | 1926 | dout("kick_flushing_caps %p cap %p %s\n", inode, |
| @@ -1932,14 +1931,14 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
| 1932 | cap->issued | cap->implemented, | 1931 | cap->issued | cap->implemented, |
| 1933 | ci->i_flushing_caps, NULL); | 1932 | ci->i_flushing_caps, NULL); |
| 1934 | if (delayed) { | 1933 | if (delayed) { |
| 1935 | spin_lock(&inode->i_lock); | 1934 | spin_lock(&ci->i_ceph_lock); |
| 1936 | __cap_delay_requeue(mdsc, ci); | 1935 | __cap_delay_requeue(mdsc, ci); |
| 1937 | spin_unlock(&inode->i_lock); | 1936 | spin_unlock(&ci->i_ceph_lock); |
| 1938 | } | 1937 | } |
| 1939 | } else { | 1938 | } else { |
| 1940 | pr_err("%p auth cap %p not mds%d ???\n", inode, | 1939 | pr_err("%p auth cap %p not mds%d ???\n", inode, |
| 1941 | cap, session->s_mds); | 1940 | cap, session->s_mds); |
| 1942 | spin_unlock(&inode->i_lock); | 1941 | spin_unlock(&ci->i_ceph_lock); |
| 1943 | } | 1942 | } |
| 1944 | } | 1943 | } |
| 1945 | } | 1944 | } |
| @@ -1952,7 +1951,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, | |||
| 1952 | struct ceph_cap *cap; | 1951 | struct ceph_cap *cap; |
| 1953 | int delayed = 0; | 1952 | int delayed = 0; |
| 1954 | 1953 | ||
| 1955 | spin_lock(&inode->i_lock); | 1954 | spin_lock(&ci->i_ceph_lock); |
| 1956 | cap = ci->i_auth_cap; | 1955 | cap = ci->i_auth_cap; |
| 1957 | dout("kick_flushing_inode_caps %p flushing %s flush_seq %lld\n", inode, | 1956 | dout("kick_flushing_inode_caps %p flushing %s flush_seq %lld\n", inode, |
| 1958 | ceph_cap_string(ci->i_flushing_caps), ci->i_cap_flush_seq); | 1957 | ceph_cap_string(ci->i_flushing_caps), ci->i_cap_flush_seq); |
| @@ -1964,12 +1963,12 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, | |||
| 1964 | cap->issued | cap->implemented, | 1963 | cap->issued | cap->implemented, |
| 1965 | ci->i_flushing_caps, NULL); | 1964 | ci->i_flushing_caps, NULL); |
| 1966 | if (delayed) { | 1965 | if (delayed) { |
| 1967 | spin_lock(&inode->i_lock); | 1966 | spin_lock(&ci->i_ceph_lock); |
| 1968 | __cap_delay_requeue(mdsc, ci); | 1967 | __cap_delay_requeue(mdsc, ci); |
| 1969 | spin_unlock(&inode->i_lock); | 1968 | spin_unlock(&ci->i_ceph_lock); |
| 1970 | } | 1969 | } |
| 1971 | } else { | 1970 | } else { |
| 1972 | spin_unlock(&inode->i_lock); | 1971 | spin_unlock(&ci->i_ceph_lock); |
| 1973 | } | 1972 | } |
| 1974 | } | 1973 | } |
| 1975 | 1974 | ||
| @@ -1978,7 +1977,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, | |||
| 1978 | * Take references to capabilities we hold, so that we don't release | 1977 | * Take references to capabilities we hold, so that we don't release |
| 1979 | * them to the MDS prematurely. | 1978 | * them to the MDS prematurely. |
| 1980 | * | 1979 | * |
| 1981 | * Protected by i_lock. | 1980 | * Protected by i_ceph_lock. |
| 1982 | */ | 1981 | */ |
| 1983 | static void __take_cap_refs(struct ceph_inode_info *ci, int got) | 1982 | static void __take_cap_refs(struct ceph_inode_info *ci, int got) |
| 1984 | { | 1983 | { |
| @@ -2016,7 +2015,7 @@ static int try_get_cap_refs(struct ceph_inode_info *ci, int need, int want, | |||
| 2016 | 2015 | ||
| 2017 | dout("get_cap_refs %p need %s want %s\n", inode, | 2016 | dout("get_cap_refs %p need %s want %s\n", inode, |
| 2018 | ceph_cap_string(need), ceph_cap_string(want)); | 2017 | ceph_cap_string(need), ceph_cap_string(want)); |
| 2019 | spin_lock(&inode->i_lock); | 2018 | spin_lock(&ci->i_ceph_lock); |
| 2020 | 2019 | ||
| 2021 | /* make sure file is actually open */ | 2020 | /* make sure file is actually open */ |
| 2022 | file_wanted = __ceph_caps_file_wanted(ci); | 2021 | file_wanted = __ceph_caps_file_wanted(ci); |
| @@ -2077,7 +2076,7 @@ static int try_get_cap_refs(struct ceph_inode_info *ci, int need, int want, | |||
| 2077 | ceph_cap_string(have), ceph_cap_string(need)); | 2076 | ceph_cap_string(have), ceph_cap_string(need)); |
| 2078 | } | 2077 | } |
| 2079 | out: | 2078 | out: |
| 2080 | spin_unlock(&inode->i_lock); | 2079 | spin_unlock(&ci->i_ceph_lock); |
| 2081 | dout("get_cap_refs %p ret %d got %s\n", inode, | 2080 | dout("get_cap_refs %p ret %d got %s\n", inode, |
| 2082 | ret, ceph_cap_string(*got)); | 2081 | ret, ceph_cap_string(*got)); |
| 2083 | return ret; | 2082 | return ret; |
| @@ -2094,7 +2093,7 @@ static void check_max_size(struct inode *inode, loff_t endoff) | |||
| 2094 | int check = 0; | 2093 | int check = 0; |
| 2095 | 2094 | ||
| 2096 | /* do we need to explicitly request a larger max_size? */ | 2095 | /* do we need to explicitly request a larger max_size? */ |
| 2097 | spin_lock(&inode->i_lock); | 2096 | spin_lock(&ci->i_ceph_lock); |
| 2098 | if ((endoff >= ci->i_max_size || | 2097 | if ((endoff >= ci->i_max_size || |
| 2099 | endoff > (inode->i_size << 1)) && | 2098 | endoff > (inode->i_size << 1)) && |
| 2100 | endoff > ci->i_wanted_max_size) { | 2099 | endoff > ci->i_wanted_max_size) { |
| @@ -2103,7 +2102,7 @@ static void check_max_size(struct inode *inode, loff_t endoff) | |||
| 2103 | ci->i_wanted_max_size = endoff; | 2102 | ci->i_wanted_max_size = endoff; |
| 2104 | check = 1; | 2103 | check = 1; |
| 2105 | } | 2104 | } |
| 2106 | spin_unlock(&inode->i_lock); | 2105 | spin_unlock(&ci->i_ceph_lock); |
| 2107 | if (check) | 2106 | if (check) |
| 2108 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); | 2107 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); |
| 2109 | } | 2108 | } |
| @@ -2140,9 +2139,9 @@ retry: | |||
| 2140 | */ | 2139 | */ |
| 2141 | void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps) | 2140 | void ceph_get_cap_refs(struct ceph_inode_info *ci, int caps) |
| 2142 | { | 2141 | { |
| 2143 | spin_lock(&ci->vfs_inode.i_lock); | 2142 | spin_lock(&ci->i_ceph_lock); |
| 2144 | __take_cap_refs(ci, caps); | 2143 | __take_cap_refs(ci, caps); |
| 2145 | spin_unlock(&ci->vfs_inode.i_lock); | 2144 | spin_unlock(&ci->i_ceph_lock); |
| 2146 | } | 2145 | } |
| 2147 | 2146 | ||
| 2148 | /* | 2147 | /* |
| @@ -2160,7 +2159,7 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had) | |||
| 2160 | int last = 0, put = 0, flushsnaps = 0, wake = 0; | 2159 | int last = 0, put = 0, flushsnaps = 0, wake = 0; |
| 2161 | struct ceph_cap_snap *capsnap; | 2160 | struct ceph_cap_snap *capsnap; |
| 2162 | 2161 | ||
| 2163 | spin_lock(&inode->i_lock); | 2162 | spin_lock(&ci->i_ceph_lock); |
| 2164 | if (had & CEPH_CAP_PIN) | 2163 | if (had & CEPH_CAP_PIN) |
| 2165 | --ci->i_pin_ref; | 2164 | --ci->i_pin_ref; |
| 2166 | if (had & CEPH_CAP_FILE_RD) | 2165 | if (had & CEPH_CAP_FILE_RD) |
| @@ -2193,7 +2192,7 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had) | |||
| 2193 | } | 2192 | } |
| 2194 | } | 2193 | } |
| 2195 | } | 2194 | } |
| 2196 | spin_unlock(&inode->i_lock); | 2195 | spin_unlock(&ci->i_ceph_lock); |
| 2197 | 2196 | ||
| 2198 | dout("put_cap_refs %p had %s%s%s\n", inode, ceph_cap_string(had), | 2197 | dout("put_cap_refs %p had %s%s%s\n", inode, ceph_cap_string(had), |
| 2199 | last ? " last" : "", put ? " put" : ""); | 2198 | last ? " last" : "", put ? " put" : ""); |
| @@ -2225,7 +2224,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | |||
| 2225 | int found = 0; | 2224 | int found = 0; |
| 2226 | struct ceph_cap_snap *capsnap = NULL; | 2225 | struct ceph_cap_snap *capsnap = NULL; |
| 2227 | 2226 | ||
| 2228 | spin_lock(&inode->i_lock); | 2227 | spin_lock(&ci->i_ceph_lock); |
| 2229 | ci->i_wrbuffer_ref -= nr; | 2228 | ci->i_wrbuffer_ref -= nr; |
| 2230 | last = !ci->i_wrbuffer_ref; | 2229 | last = !ci->i_wrbuffer_ref; |
| 2231 | 2230 | ||
| @@ -2274,7 +2273,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | |||
| 2274 | } | 2273 | } |
| 2275 | } | 2274 | } |
| 2276 | 2275 | ||
| 2277 | spin_unlock(&inode->i_lock); | 2276 | spin_unlock(&ci->i_ceph_lock); |
| 2278 | 2277 | ||
| 2279 | if (last) { | 2278 | if (last) { |
| 2280 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); | 2279 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); |
| @@ -2291,7 +2290,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | |||
| 2291 | * Handle a cap GRANT message from the MDS. (Note that a GRANT may | 2290 | * Handle a cap GRANT message from the MDS. (Note that a GRANT may |
| 2292 | * actually be a revocation if it specifies a smaller cap set.) | 2291 | * actually be a revocation if it specifies a smaller cap set.) |
| 2293 | * | 2292 | * |
| 2294 | * caller holds s_mutex and i_lock, we drop both. | 2293 | * caller holds s_mutex and i_ceph_lock, we drop both. |
| 2295 | * | 2294 | * |
| 2296 | * return value: | 2295 | * return value: |
| 2297 | * 0 - ok | 2296 | * 0 - ok |
| @@ -2302,7 +2301,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
| 2302 | struct ceph_mds_session *session, | 2301 | struct ceph_mds_session *session, |
| 2303 | struct ceph_cap *cap, | 2302 | struct ceph_cap *cap, |
| 2304 | struct ceph_buffer *xattr_buf) | 2303 | struct ceph_buffer *xattr_buf) |
| 2305 | __releases(inode->i_lock) | 2304 | __releases(ci->i_ceph_lock) |
| 2306 | { | 2305 | { |
| 2307 | struct ceph_inode_info *ci = ceph_inode(inode); | 2306 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 2308 | int mds = session->s_mds; | 2307 | int mds = session->s_mds; |
| @@ -2453,7 +2452,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
| 2453 | } | 2452 | } |
| 2454 | BUG_ON(cap->issued & ~cap->implemented); | 2453 | BUG_ON(cap->issued & ~cap->implemented); |
| 2455 | 2454 | ||
| 2456 | spin_unlock(&inode->i_lock); | 2455 | spin_unlock(&ci->i_ceph_lock); |
| 2457 | if (writeback) | 2456 | if (writeback) |
| 2458 | /* | 2457 | /* |
| 2459 | * queue inode for writeback: we can't actually call | 2458 | * queue inode for writeback: we can't actually call |
| @@ -2483,7 +2482,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, | |||
| 2483 | struct ceph_mds_caps *m, | 2482 | struct ceph_mds_caps *m, |
| 2484 | struct ceph_mds_session *session, | 2483 | struct ceph_mds_session *session, |
| 2485 | struct ceph_cap *cap) | 2484 | struct ceph_cap *cap) |
| 2486 | __releases(inode->i_lock) | 2485 | __releases(ci->i_ceph_lock) |
| 2487 | { | 2486 | { |
| 2488 | struct ceph_inode_info *ci = ceph_inode(inode); | 2487 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 2489 | struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; | 2488 | struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc; |
| @@ -2539,7 +2538,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, | |||
| 2539 | wake_up_all(&ci->i_cap_wq); | 2538 | wake_up_all(&ci->i_cap_wq); |
| 2540 | 2539 | ||
| 2541 | out: | 2540 | out: |
| 2542 | spin_unlock(&inode->i_lock); | 2541 | spin_unlock(&ci->i_ceph_lock); |
| 2543 | if (drop) | 2542 | if (drop) |
| 2544 | iput(inode); | 2543 | iput(inode); |
| 2545 | } | 2544 | } |
| @@ -2562,7 +2561,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, | |||
| 2562 | dout("handle_cap_flushsnap_ack inode %p ci %p mds%d follows %lld\n", | 2561 | dout("handle_cap_flushsnap_ack inode %p ci %p mds%d follows %lld\n", |
| 2563 | inode, ci, session->s_mds, follows); | 2562 | inode, ci, session->s_mds, follows); |
| 2564 | 2563 | ||
| 2565 | spin_lock(&inode->i_lock); | 2564 | spin_lock(&ci->i_ceph_lock); |
| 2566 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { | 2565 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { |
| 2567 | if (capsnap->follows == follows) { | 2566 | if (capsnap->follows == follows) { |
| 2568 | if (capsnap->flush_tid != flush_tid) { | 2567 | if (capsnap->flush_tid != flush_tid) { |
| @@ -2585,7 +2584,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, | |||
| 2585 | capsnap, capsnap->follows); | 2584 | capsnap, capsnap->follows); |
| 2586 | } | 2585 | } |
| 2587 | } | 2586 | } |
| 2588 | spin_unlock(&inode->i_lock); | 2587 | spin_unlock(&ci->i_ceph_lock); |
| 2589 | if (drop) | 2588 | if (drop) |
| 2590 | iput(inode); | 2589 | iput(inode); |
| 2591 | } | 2590 | } |
| @@ -2598,7 +2597,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, | |||
| 2598 | static void handle_cap_trunc(struct inode *inode, | 2597 | static void handle_cap_trunc(struct inode *inode, |
| 2599 | struct ceph_mds_caps *trunc, | 2598 | struct ceph_mds_caps *trunc, |
| 2600 | struct ceph_mds_session *session) | 2599 | struct ceph_mds_session *session) |
| 2601 | __releases(inode->i_lock) | 2600 | __releases(ci->i_ceph_lock) |
| 2602 | { | 2601 | { |
| 2603 | struct ceph_inode_info *ci = ceph_inode(inode); | 2602 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 2604 | int mds = session->s_mds; | 2603 | int mds = session->s_mds; |
| @@ -2617,7 +2616,7 @@ static void handle_cap_trunc(struct inode *inode, | |||
| 2617 | inode, mds, seq, truncate_size, truncate_seq); | 2616 | inode, mds, seq, truncate_size, truncate_seq); |
| 2618 | queue_trunc = ceph_fill_file_size(inode, issued, | 2617 | queue_trunc = ceph_fill_file_size(inode, issued, |
| 2619 | truncate_seq, truncate_size, size); | 2618 | truncate_seq, truncate_size, size); |
| 2620 | spin_unlock(&inode->i_lock); | 2619 | spin_unlock(&ci->i_ceph_lock); |
| 2621 | 2620 | ||
| 2622 | if (queue_trunc) | 2621 | if (queue_trunc) |
| 2623 | ceph_queue_vmtruncate(inode); | 2622 | ceph_queue_vmtruncate(inode); |
| @@ -2646,7 +2645,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, | |||
| 2646 | dout("handle_cap_export inode %p ci %p mds%d mseq %d\n", | 2645 | dout("handle_cap_export inode %p ci %p mds%d mseq %d\n", |
| 2647 | inode, ci, mds, mseq); | 2646 | inode, ci, mds, mseq); |
| 2648 | 2647 | ||
| 2649 | spin_lock(&inode->i_lock); | 2648 | spin_lock(&ci->i_ceph_lock); |
| 2650 | 2649 | ||
| 2651 | /* make sure we haven't seen a higher mseq */ | 2650 | /* make sure we haven't seen a higher mseq */ |
| 2652 | for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) { | 2651 | for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) { |
| @@ -2690,7 +2689,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, | |||
| 2690 | } | 2689 | } |
| 2691 | /* else, we already released it */ | 2690 | /* else, we already released it */ |
| 2692 | 2691 | ||
| 2693 | spin_unlock(&inode->i_lock); | 2692 | spin_unlock(&ci->i_ceph_lock); |
| 2694 | } | 2693 | } |
| 2695 | 2694 | ||
| 2696 | /* | 2695 | /* |
| @@ -2745,9 +2744,9 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, | |||
| 2745 | up_read(&mdsc->snap_rwsem); | 2744 | up_read(&mdsc->snap_rwsem); |
| 2746 | 2745 | ||
| 2747 | /* make sure we re-request max_size, if necessary */ | 2746 | /* make sure we re-request max_size, if necessary */ |
| 2748 | spin_lock(&inode->i_lock); | 2747 | spin_lock(&ci->i_ceph_lock); |
| 2749 | ci->i_requested_max_size = 0; | 2748 | ci->i_requested_max_size = 0; |
| 2750 | spin_unlock(&inode->i_lock); | 2749 | spin_unlock(&ci->i_ceph_lock); |
| 2751 | } | 2750 | } |
| 2752 | 2751 | ||
| 2753 | /* | 2752 | /* |
| @@ -2762,6 +2761,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
| 2762 | struct ceph_mds_client *mdsc = session->s_mdsc; | 2761 | struct ceph_mds_client *mdsc = session->s_mdsc; |
| 2763 | struct super_block *sb = mdsc->fsc->sb; | 2762 | struct super_block *sb = mdsc->fsc->sb; |
| 2764 | struct inode *inode; | 2763 | struct inode *inode; |
| 2764 | struct ceph_inode_info *ci; | ||
| 2765 | struct ceph_cap *cap; | 2765 | struct ceph_cap *cap; |
| 2766 | struct ceph_mds_caps *h; | 2766 | struct ceph_mds_caps *h; |
| 2767 | int mds = session->s_mds; | 2767 | int mds = session->s_mds; |
| @@ -2815,6 +2815,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
| 2815 | 2815 | ||
| 2816 | /* lookup ino */ | 2816 | /* lookup ino */ |
| 2817 | inode = ceph_find_inode(sb, vino); | 2817 | inode = ceph_find_inode(sb, vino); |
| 2818 | ci = ceph_inode(inode); | ||
| 2818 | dout(" op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op), vino.ino, | 2819 | dout(" op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op), vino.ino, |
| 2819 | vino.snap, inode); | 2820 | vino.snap, inode); |
| 2820 | if (!inode) { | 2821 | if (!inode) { |
| @@ -2844,16 +2845,16 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
| 2844 | } | 2845 | } |
| 2845 | 2846 | ||
| 2846 | /* the rest require a cap */ | 2847 | /* the rest require a cap */ |
| 2847 | spin_lock(&inode->i_lock); | 2848 | spin_lock(&ci->i_ceph_lock); |
| 2848 | cap = __get_cap_for_mds(ceph_inode(inode), mds); | 2849 | cap = __get_cap_for_mds(ceph_inode(inode), mds); |
| 2849 | if (!cap) { | 2850 | if (!cap) { |
| 2850 | dout(" no cap on %p ino %llx.%llx from mds%d\n", | 2851 | dout(" no cap on %p ino %llx.%llx from mds%d\n", |
| 2851 | inode, ceph_ino(inode), ceph_snap(inode), mds); | 2852 | inode, ceph_ino(inode), ceph_snap(inode), mds); |
| 2852 | spin_unlock(&inode->i_lock); | 2853 | spin_unlock(&ci->i_ceph_lock); |
| 2853 | goto flush_cap_releases; | 2854 | goto flush_cap_releases; |
| 2854 | } | 2855 | } |
| 2855 | 2856 | ||
| 2856 | /* note that each of these drops i_lock for us */ | 2857 | /* note that each of these drops i_ceph_lock for us */ |
| 2857 | switch (op) { | 2858 | switch (op) { |
| 2858 | case CEPH_CAP_OP_REVOKE: | 2859 | case CEPH_CAP_OP_REVOKE: |
| 2859 | case CEPH_CAP_OP_GRANT: | 2860 | case CEPH_CAP_OP_GRANT: |
| @@ -2869,7 +2870,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
| 2869 | break; | 2870 | break; |
| 2870 | 2871 | ||
| 2871 | default: | 2872 | default: |
| 2872 | spin_unlock(&inode->i_lock); | 2873 | spin_unlock(&ci->i_ceph_lock); |
| 2873 | pr_err("ceph_handle_caps: unknown cap op %d %s\n", op, | 2874 | pr_err("ceph_handle_caps: unknown cap op %d %s\n", op, |
| 2874 | ceph_cap_op_name(op)); | 2875 | ceph_cap_op_name(op)); |
| 2875 | } | 2876 | } |
| @@ -2962,13 +2963,13 @@ void ceph_put_fmode(struct ceph_inode_info *ci, int fmode) | |||
| 2962 | struct inode *inode = &ci->vfs_inode; | 2963 | struct inode *inode = &ci->vfs_inode; |
| 2963 | int last = 0; | 2964 | int last = 0; |
| 2964 | 2965 | ||
| 2965 | spin_lock(&inode->i_lock); | 2966 | spin_lock(&ci->i_ceph_lock); |
| 2966 | dout("put_fmode %p fmode %d %d -> %d\n", inode, fmode, | 2967 | dout("put_fmode %p fmode %d %d -> %d\n", inode, fmode, |
| 2967 | ci->i_nr_by_mode[fmode], ci->i_nr_by_mode[fmode]-1); | 2968 | ci->i_nr_by_mode[fmode], ci->i_nr_by_mode[fmode]-1); |
| 2968 | BUG_ON(ci->i_nr_by_mode[fmode] == 0); | 2969 | BUG_ON(ci->i_nr_by_mode[fmode] == 0); |
| 2969 | if (--ci->i_nr_by_mode[fmode] == 0) | 2970 | if (--ci->i_nr_by_mode[fmode] == 0) |
| 2970 | last++; | 2971 | last++; |
| 2971 | spin_unlock(&inode->i_lock); | 2972 | spin_unlock(&ci->i_ceph_lock); |
| 2972 | 2973 | ||
| 2973 | if (last && ci->i_vino.snap == CEPH_NOSNAP) | 2974 | if (last && ci->i_vino.snap == CEPH_NOSNAP) |
| 2974 | ceph_check_caps(ci, 0, NULL); | 2975 | ceph_check_caps(ci, 0, NULL); |
| @@ -2991,7 +2992,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, | |||
| 2991 | int used, dirty; | 2992 | int used, dirty; |
| 2992 | int ret = 0; | 2993 | int ret = 0; |
| 2993 | 2994 | ||
| 2994 | spin_lock(&inode->i_lock); | 2995 | spin_lock(&ci->i_ceph_lock); |
| 2995 | used = __ceph_caps_used(ci); | 2996 | used = __ceph_caps_used(ci); |
| 2996 | dirty = __ceph_caps_dirty(ci); | 2997 | dirty = __ceph_caps_dirty(ci); |
| 2997 | 2998 | ||
| @@ -3046,7 +3047,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, | |||
| 3046 | inode, cap, ceph_cap_string(cap->issued)); | 3047 | inode, cap, ceph_cap_string(cap->issued)); |
| 3047 | } | 3048 | } |
| 3048 | } | 3049 | } |
| 3049 | spin_unlock(&inode->i_lock); | 3050 | spin_unlock(&ci->i_ceph_lock); |
| 3050 | return ret; | 3051 | return ret; |
| 3051 | } | 3052 | } |
| 3052 | 3053 | ||
| @@ -3061,7 +3062,7 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry, | |||
| 3061 | 3062 | ||
| 3062 | /* | 3063 | /* |
| 3063 | * force an record for the directory caps if we have a dentry lease. | 3064 | * force an record for the directory caps if we have a dentry lease. |
| 3064 | * this is racy (can't take i_lock and d_lock together), but it | 3065 | * this is racy (can't take i_ceph_lock and d_lock together), but it |
| 3065 | * doesn't have to be perfect; the mds will revoke anything we don't | 3066 | * doesn't have to be perfect; the mds will revoke anything we don't |
| 3066 | * release. | 3067 | * release. |
| 3067 | */ | 3068 | */ |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index bca3948e9dbf..3eeb97661262 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
| @@ -281,18 +281,18 @@ static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | /* can we use the dcache? */ | 283 | /* can we use the dcache? */ |
| 284 | spin_lock(&inode->i_lock); | 284 | spin_lock(&ci->i_ceph_lock); |
| 285 | if ((filp->f_pos == 2 || fi->dentry) && | 285 | if ((filp->f_pos == 2 || fi->dentry) && |
| 286 | !ceph_test_mount_opt(fsc, NOASYNCREADDIR) && | 286 | !ceph_test_mount_opt(fsc, NOASYNCREADDIR) && |
| 287 | ceph_snap(inode) != CEPH_SNAPDIR && | 287 | ceph_snap(inode) != CEPH_SNAPDIR && |
| 288 | ceph_dir_test_complete(inode) && | 288 | ceph_dir_test_complete(inode) && |
| 289 | __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1)) { | 289 | __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1)) { |
| 290 | spin_unlock(&inode->i_lock); | 290 | spin_unlock(&ci->i_ceph_lock); |
| 291 | err = __dcache_readdir(filp, dirent, filldir); | 291 | err = __dcache_readdir(filp, dirent, filldir); |
| 292 | if (err != -EAGAIN) | 292 | if (err != -EAGAIN) |
| 293 | return err; | 293 | return err; |
| 294 | } else { | 294 | } else { |
| 295 | spin_unlock(&inode->i_lock); | 295 | spin_unlock(&ci->i_ceph_lock); |
| 296 | } | 296 | } |
| 297 | if (fi->dentry) { | 297 | if (fi->dentry) { |
| 298 | err = note_last_dentry(fi, fi->dentry->d_name.name, | 298 | err = note_last_dentry(fi, fi->dentry->d_name.name, |
| @@ -428,12 +428,12 @@ more: | |||
| 428 | * were released during the whole readdir, and we should have | 428 | * were released during the whole readdir, and we should have |
| 429 | * the complete dir contents in our cache. | 429 | * the complete dir contents in our cache. |
| 430 | */ | 430 | */ |
| 431 | spin_lock(&inode->i_lock); | 431 | spin_lock(&ci->i_ceph_lock); |
| 432 | if (ci->i_release_count == fi->dir_release_count) { | 432 | if (ci->i_release_count == fi->dir_release_count) { |
| 433 | ceph_dir_set_complete(inode); | 433 | ceph_dir_set_complete(inode); |
| 434 | ci->i_max_offset = filp->f_pos; | 434 | ci->i_max_offset = filp->f_pos; |
| 435 | } | 435 | } |
| 436 | spin_unlock(&inode->i_lock); | 436 | spin_unlock(&ci->i_ceph_lock); |
| 437 | 437 | ||
| 438 | dout("readdir %p filp %p done.\n", inode, filp); | 438 | dout("readdir %p filp %p done.\n", inode, filp); |
| 439 | return 0; | 439 | return 0; |
| @@ -607,7 +607,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, | |||
| 607 | struct ceph_inode_info *ci = ceph_inode(dir); | 607 | struct ceph_inode_info *ci = ceph_inode(dir); |
| 608 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 608 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
| 609 | 609 | ||
| 610 | spin_lock(&dir->i_lock); | 610 | spin_lock(&ci->i_ceph_lock); |
| 611 | dout(" dir %p flags are %d\n", dir, ci->i_ceph_flags); | 611 | dout(" dir %p flags are %d\n", dir, ci->i_ceph_flags); |
| 612 | if (strncmp(dentry->d_name.name, | 612 | if (strncmp(dentry->d_name.name, |
| 613 | fsc->mount_options->snapdir_name, | 613 | fsc->mount_options->snapdir_name, |
| @@ -615,13 +615,13 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, | |||
| 615 | !is_root_ceph_dentry(dir, dentry) && | 615 | !is_root_ceph_dentry(dir, dentry) && |
| 616 | ceph_dir_test_complete(dir) && | 616 | ceph_dir_test_complete(dir) && |
| 617 | (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) { | 617 | (__ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1))) { |
| 618 | spin_unlock(&dir->i_lock); | 618 | spin_unlock(&ci->i_ceph_lock); |
| 619 | dout(" dir %p complete, -ENOENT\n", dir); | 619 | dout(" dir %p complete, -ENOENT\n", dir); |
| 620 | d_add(dentry, NULL); | 620 | d_add(dentry, NULL); |
| 621 | di->lease_shared_gen = ci->i_shared_gen; | 621 | di->lease_shared_gen = ci->i_shared_gen; |
| 622 | return NULL; | 622 | return NULL; |
| 623 | } | 623 | } |
| 624 | spin_unlock(&dir->i_lock); | 624 | spin_unlock(&ci->i_ceph_lock); |
| 625 | } | 625 | } |
| 626 | 626 | ||
| 627 | op = ceph_snap(dir) == CEPH_SNAPDIR ? | 627 | op = ceph_snap(dir) == CEPH_SNAPDIR ? |
| @@ -841,12 +841,12 @@ static int drop_caps_for_unlink(struct inode *inode) | |||
| 841 | struct ceph_inode_info *ci = ceph_inode(inode); | 841 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 842 | int drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL; | 842 | int drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL; |
| 843 | 843 | ||
| 844 | spin_lock(&inode->i_lock); | 844 | spin_lock(&ci->i_ceph_lock); |
| 845 | if (inode->i_nlink == 1) { | 845 | if (inode->i_nlink == 1) { |
| 846 | drop |= ~(__ceph_caps_wanted(ci) | CEPH_CAP_PIN); | 846 | drop |= ~(__ceph_caps_wanted(ci) | CEPH_CAP_PIN); |
| 847 | ci->i_ceph_flags |= CEPH_I_NODELAY; | 847 | ci->i_ceph_flags |= CEPH_I_NODELAY; |
| 848 | } | 848 | } |
| 849 | spin_unlock(&inode->i_lock); | 849 | spin_unlock(&ci->i_ceph_lock); |
| 850 | return drop; | 850 | return drop; |
| 851 | } | 851 | } |
| 852 | 852 | ||
| @@ -1015,10 +1015,10 @@ static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry) | |||
| 1015 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 1015 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
| 1016 | int valid = 0; | 1016 | int valid = 0; |
| 1017 | 1017 | ||
| 1018 | spin_lock(&dir->i_lock); | 1018 | spin_lock(&ci->i_ceph_lock); |
| 1019 | if (ci->i_shared_gen == di->lease_shared_gen) | 1019 | if (ci->i_shared_gen == di->lease_shared_gen) |
| 1020 | valid = __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1); | 1020 | valid = __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1); |
| 1021 | spin_unlock(&dir->i_lock); | 1021 | spin_unlock(&ci->i_ceph_lock); |
| 1022 | dout("dir_lease_is_valid dir %p v%u dentry %p v%u = %d\n", | 1022 | dout("dir_lease_is_valid dir %p v%u dentry %p v%u = %d\n", |
| 1023 | dir, (unsigned)ci->i_shared_gen, dentry, | 1023 | dir, (unsigned)ci->i_shared_gen, dentry, |
| 1024 | (unsigned)di->lease_shared_gen, valid); | 1024 | (unsigned)di->lease_shared_gen, valid); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index ce549d31eeb7..ed72428d9c75 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
| @@ -147,9 +147,9 @@ int ceph_open(struct inode *inode, struct file *file) | |||
| 147 | 147 | ||
| 148 | /* trivially open snapdir */ | 148 | /* trivially open snapdir */ |
| 149 | if (ceph_snap(inode) == CEPH_SNAPDIR) { | 149 | if (ceph_snap(inode) == CEPH_SNAPDIR) { |
| 150 | spin_lock(&inode->i_lock); | 150 | spin_lock(&ci->i_ceph_lock); |
| 151 | __ceph_get_fmode(ci, fmode); | 151 | __ceph_get_fmode(ci, fmode); |
| 152 | spin_unlock(&inode->i_lock); | 152 | spin_unlock(&ci->i_ceph_lock); |
| 153 | return ceph_init_file(inode, file, fmode); | 153 | return ceph_init_file(inode, file, fmode); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| @@ -158,7 +158,7 @@ int ceph_open(struct inode *inode, struct file *file) | |||
| 158 | * write) or any MDS (for read). Update wanted set | 158 | * write) or any MDS (for read). Update wanted set |
| 159 | * asynchronously. | 159 | * asynchronously. |
| 160 | */ | 160 | */ |
| 161 | spin_lock(&inode->i_lock); | 161 | spin_lock(&ci->i_ceph_lock); |
| 162 | if (__ceph_is_any_real_caps(ci) && | 162 | if (__ceph_is_any_real_caps(ci) && |
| 163 | (((fmode & CEPH_FILE_MODE_WR) == 0) || ci->i_auth_cap)) { | 163 | (((fmode & CEPH_FILE_MODE_WR) == 0) || ci->i_auth_cap)) { |
| 164 | int mds_wanted = __ceph_caps_mds_wanted(ci); | 164 | int mds_wanted = __ceph_caps_mds_wanted(ci); |
| @@ -168,7 +168,7 @@ int ceph_open(struct inode *inode, struct file *file) | |||
| 168 | inode, fmode, ceph_cap_string(wanted), | 168 | inode, fmode, ceph_cap_string(wanted), |
| 169 | ceph_cap_string(issued)); | 169 | ceph_cap_string(issued)); |
| 170 | __ceph_get_fmode(ci, fmode); | 170 | __ceph_get_fmode(ci, fmode); |
| 171 | spin_unlock(&inode->i_lock); | 171 | spin_unlock(&ci->i_ceph_lock); |
| 172 | 172 | ||
| 173 | /* adjust wanted? */ | 173 | /* adjust wanted? */ |
| 174 | if ((issued & wanted) != wanted && | 174 | if ((issued & wanted) != wanted && |
| @@ -180,10 +180,10 @@ int ceph_open(struct inode *inode, struct file *file) | |||
| 180 | } else if (ceph_snap(inode) != CEPH_NOSNAP && | 180 | } else if (ceph_snap(inode) != CEPH_NOSNAP && |
| 181 | (ci->i_snap_caps & wanted) == wanted) { | 181 | (ci->i_snap_caps & wanted) == wanted) { |
| 182 | __ceph_get_fmode(ci, fmode); | 182 | __ceph_get_fmode(ci, fmode); |
| 183 | spin_unlock(&inode->i_lock); | 183 | spin_unlock(&ci->i_ceph_lock); |
| 184 | return ceph_init_file(inode, file, fmode); | 184 | return ceph_init_file(inode, file, fmode); |
| 185 | } | 185 | } |
| 186 | spin_unlock(&inode->i_lock); | 186 | spin_unlock(&ci->i_ceph_lock); |
| 187 | 187 | ||
| 188 | dout("open fmode %d wants %s\n", fmode, ceph_cap_string(wanted)); | 188 | dout("open fmode %d wants %s\n", fmode, ceph_cap_string(wanted)); |
| 189 | req = prepare_open_request(inode->i_sb, flags, 0); | 189 | req = prepare_open_request(inode->i_sb, flags, 0); |
| @@ -743,9 +743,9 @@ retry_snap: | |||
| 743 | */ | 743 | */ |
| 744 | int dirty; | 744 | int dirty; |
| 745 | 745 | ||
| 746 | spin_lock(&inode->i_lock); | 746 | spin_lock(&ci->i_ceph_lock); |
| 747 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); | 747 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); |
| 748 | spin_unlock(&inode->i_lock); | 748 | spin_unlock(&ci->i_ceph_lock); |
| 749 | ceph_put_cap_refs(ci, got); | 749 | ceph_put_cap_refs(ci, got); |
| 750 | 750 | ||
| 751 | ret = generic_file_aio_write(iocb, iov, nr_segs, pos); | 751 | ret = generic_file_aio_write(iocb, iov, nr_segs, pos); |
| @@ -764,9 +764,9 @@ retry_snap: | |||
| 764 | 764 | ||
| 765 | if (ret >= 0) { | 765 | if (ret >= 0) { |
| 766 | int dirty; | 766 | int dirty; |
| 767 | spin_lock(&inode->i_lock); | 767 | spin_lock(&ci->i_ceph_lock); |
| 768 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); | 768 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR); |
| 769 | spin_unlock(&inode->i_lock); | 769 | spin_unlock(&ci->i_ceph_lock); |
| 770 | if (dirty) | 770 | if (dirty) |
| 771 | __mark_inode_dirty(inode, dirty); | 771 | __mark_inode_dirty(inode, dirty); |
| 772 | } | 772 | } |
| @@ -797,7 +797,8 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin) | |||
| 797 | 797 | ||
| 798 | mutex_lock(&inode->i_mutex); | 798 | mutex_lock(&inode->i_mutex); |
| 799 | __ceph_do_pending_vmtruncate(inode); | 799 | __ceph_do_pending_vmtruncate(inode); |
| 800 | if (origin != SEEK_CUR || origin != SEEK_SET) { | 800 | |
| 801 | if (origin == SEEK_END || origin == SEEK_DATA || origin == SEEK_HOLE) { | ||
| 801 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE); | 802 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE); |
| 802 | if (ret < 0) { | 803 | if (ret < 0) { |
| 803 | offset = ret; | 804 | offset = ret; |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 116f36502f17..87fb132fb330 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
| @@ -297,6 +297,8 @@ struct inode *ceph_alloc_inode(struct super_block *sb) | |||
| 297 | 297 | ||
| 298 | dout("alloc_inode %p\n", &ci->vfs_inode); | 298 | dout("alloc_inode %p\n", &ci->vfs_inode); |
| 299 | 299 | ||
| 300 | spin_lock_init(&ci->i_ceph_lock); | ||
| 301 | |||
| 300 | ci->i_version = 0; | 302 | ci->i_version = 0; |
| 301 | ci->i_time_warp_seq = 0; | 303 | ci->i_time_warp_seq = 0; |
| 302 | ci->i_ceph_flags = 0; | 304 | ci->i_ceph_flags = 0; |
| @@ -583,7 +585,7 @@ static int fill_inode(struct inode *inode, | |||
| 583 | iinfo->xattr_len); | 585 | iinfo->xattr_len); |
| 584 | } | 586 | } |
| 585 | 587 | ||
| 586 | spin_lock(&inode->i_lock); | 588 | spin_lock(&ci->i_ceph_lock); |
| 587 | 589 | ||
| 588 | /* | 590 | /* |
| 589 | * provided version will be odd if inode value is projected, | 591 | * provided version will be odd if inode value is projected, |
| @@ -680,7 +682,7 @@ static int fill_inode(struct inode *inode, | |||
| 680 | char *sym; | 682 | char *sym; |
| 681 | 683 | ||
| 682 | BUG_ON(symlen != inode->i_size); | 684 | BUG_ON(symlen != inode->i_size); |
| 683 | spin_unlock(&inode->i_lock); | 685 | spin_unlock(&ci->i_ceph_lock); |
| 684 | 686 | ||
| 685 | err = -ENOMEM; | 687 | err = -ENOMEM; |
| 686 | sym = kmalloc(symlen+1, GFP_NOFS); | 688 | sym = kmalloc(symlen+1, GFP_NOFS); |
| @@ -689,7 +691,7 @@ static int fill_inode(struct inode *inode, | |||
| 689 | memcpy(sym, iinfo->symlink, symlen); | 691 | memcpy(sym, iinfo->symlink, symlen); |
| 690 | sym[symlen] = 0; | 692 | sym[symlen] = 0; |
| 691 | 693 | ||
| 692 | spin_lock(&inode->i_lock); | 694 | spin_lock(&ci->i_ceph_lock); |
| 693 | if (!ci->i_symlink) | 695 | if (!ci->i_symlink) |
| 694 | ci->i_symlink = sym; | 696 | ci->i_symlink = sym; |
| 695 | else | 697 | else |
| @@ -715,7 +717,7 @@ static int fill_inode(struct inode *inode, | |||
| 715 | } | 717 | } |
| 716 | 718 | ||
| 717 | no_change: | 719 | no_change: |
| 718 | spin_unlock(&inode->i_lock); | 720 | spin_unlock(&ci->i_ceph_lock); |
| 719 | 721 | ||
| 720 | /* queue truncate if we saw i_size decrease */ | 722 | /* queue truncate if we saw i_size decrease */ |
| 721 | if (queue_trunc) | 723 | if (queue_trunc) |
| @@ -750,13 +752,13 @@ no_change: | |||
| 750 | info->cap.flags, | 752 | info->cap.flags, |
| 751 | caps_reservation); | 753 | caps_reservation); |
| 752 | } else { | 754 | } else { |
| 753 | spin_lock(&inode->i_lock); | 755 | spin_lock(&ci->i_ceph_lock); |
| 754 | dout(" %p got snap_caps %s\n", inode, | 756 | dout(" %p got snap_caps %s\n", inode, |
| 755 | ceph_cap_string(le32_to_cpu(info->cap.caps))); | 757 | ceph_cap_string(le32_to_cpu(info->cap.caps))); |
| 756 | ci->i_snap_caps |= le32_to_cpu(info->cap.caps); | 758 | ci->i_snap_caps |= le32_to_cpu(info->cap.caps); |
| 757 | if (cap_fmode >= 0) | 759 | if (cap_fmode >= 0) |
| 758 | __ceph_get_fmode(ci, cap_fmode); | 760 | __ceph_get_fmode(ci, cap_fmode); |
| 759 | spin_unlock(&inode->i_lock); | 761 | spin_unlock(&ci->i_ceph_lock); |
| 760 | } | 762 | } |
| 761 | } else if (cap_fmode >= 0) { | 763 | } else if (cap_fmode >= 0) { |
| 762 | pr_warning("mds issued no caps on %llx.%llx\n", | 764 | pr_warning("mds issued no caps on %llx.%llx\n", |
| @@ -849,19 +851,20 @@ static void ceph_set_dentry_offset(struct dentry *dn) | |||
| 849 | { | 851 | { |
| 850 | struct dentry *dir = dn->d_parent; | 852 | struct dentry *dir = dn->d_parent; |
| 851 | struct inode *inode = dir->d_inode; | 853 | struct inode *inode = dir->d_inode; |
| 854 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
| 852 | struct ceph_dentry_info *di; | 855 | struct ceph_dentry_info *di; |
| 853 | 856 | ||
| 854 | BUG_ON(!inode); | 857 | BUG_ON(!inode); |
| 855 | 858 | ||
| 856 | di = ceph_dentry(dn); | 859 | di = ceph_dentry(dn); |
| 857 | 860 | ||
| 858 | spin_lock(&inode->i_lock); | 861 | spin_lock(&ci->i_ceph_lock); |
| 859 | if (!ceph_dir_test_complete(inode)) { | 862 | if (!ceph_dir_test_complete(inode)) { |
| 860 | spin_unlock(&inode->i_lock); | 863 | spin_unlock(&ci->i_ceph_lock); |
| 861 | return; | 864 | return; |
| 862 | } | 865 | } |
| 863 | di->offset = ceph_inode(inode)->i_max_offset++; | 866 | di->offset = ceph_inode(inode)->i_max_offset++; |
| 864 | spin_unlock(&inode->i_lock); | 867 | spin_unlock(&ci->i_ceph_lock); |
| 865 | 868 | ||
| 866 | spin_lock(&dir->d_lock); | 869 | spin_lock(&dir->d_lock); |
| 867 | spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); | 870 | spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); |
| @@ -1308,7 +1311,7 @@ int ceph_inode_set_size(struct inode *inode, loff_t size) | |||
| 1308 | struct ceph_inode_info *ci = ceph_inode(inode); | 1311 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 1309 | int ret = 0; | 1312 | int ret = 0; |
| 1310 | 1313 | ||
| 1311 | spin_lock(&inode->i_lock); | 1314 | spin_lock(&ci->i_ceph_lock); |
| 1312 | dout("set_size %p %llu -> %llu\n", inode, inode->i_size, size); | 1315 | dout("set_size %p %llu -> %llu\n", inode, inode->i_size, size); |
| 1313 | inode->i_size = size; | 1316 | inode->i_size = size; |
| 1314 | inode->i_blocks = (size + (1 << 9) - 1) >> 9; | 1317 | inode->i_blocks = (size + (1 << 9) - 1) >> 9; |
| @@ -1318,7 +1321,7 @@ int ceph_inode_set_size(struct inode *inode, loff_t size) | |||
| 1318 | (ci->i_reported_size << 1) < ci->i_max_size) | 1321 | (ci->i_reported_size << 1) < ci->i_max_size) |
| 1319 | ret = 1; | 1322 | ret = 1; |
| 1320 | 1323 | ||
| 1321 | spin_unlock(&inode->i_lock); | 1324 | spin_unlock(&ci->i_ceph_lock); |
| 1322 | return ret; | 1325 | return ret; |
| 1323 | } | 1326 | } |
| 1324 | 1327 | ||
| @@ -1376,20 +1379,20 @@ static void ceph_invalidate_work(struct work_struct *work) | |||
| 1376 | u32 orig_gen; | 1379 | u32 orig_gen; |
| 1377 | int check = 0; | 1380 | int check = 0; |
| 1378 | 1381 | ||
| 1379 | spin_lock(&inode->i_lock); | 1382 | spin_lock(&ci->i_ceph_lock); |
| 1380 | dout("invalidate_pages %p gen %d revoking %d\n", inode, | 1383 | dout("invalidate_pages %p gen %d revoking %d\n", inode, |
| 1381 | ci->i_rdcache_gen, ci->i_rdcache_revoking); | 1384 | ci->i_rdcache_gen, ci->i_rdcache_revoking); |
| 1382 | if (ci->i_rdcache_revoking != ci->i_rdcache_gen) { | 1385 | if (ci->i_rdcache_revoking != ci->i_rdcache_gen) { |
| 1383 | /* nevermind! */ | 1386 | /* nevermind! */ |
| 1384 | spin_unlock(&inode->i_lock); | 1387 | spin_unlock(&ci->i_ceph_lock); |
| 1385 | goto out; | 1388 | goto out; |
| 1386 | } | 1389 | } |
| 1387 | orig_gen = ci->i_rdcache_gen; | 1390 | orig_gen = ci->i_rdcache_gen; |
| 1388 | spin_unlock(&inode->i_lock); | 1391 | spin_unlock(&ci->i_ceph_lock); |
| 1389 | 1392 | ||
| 1390 | truncate_inode_pages(&inode->i_data, 0); | 1393 | truncate_inode_pages(&inode->i_data, 0); |
| 1391 | 1394 | ||
| 1392 | spin_lock(&inode->i_lock); | 1395 | spin_lock(&ci->i_ceph_lock); |
| 1393 | if (orig_gen == ci->i_rdcache_gen && | 1396 | if (orig_gen == ci->i_rdcache_gen && |
| 1394 | orig_gen == ci->i_rdcache_revoking) { | 1397 | orig_gen == ci->i_rdcache_revoking) { |
| 1395 | dout("invalidate_pages %p gen %d successful\n", inode, | 1398 | dout("invalidate_pages %p gen %d successful\n", inode, |
| @@ -1401,7 +1404,7 @@ static void ceph_invalidate_work(struct work_struct *work) | |||
| 1401 | inode, orig_gen, ci->i_rdcache_gen, | 1404 | inode, orig_gen, ci->i_rdcache_gen, |
| 1402 | ci->i_rdcache_revoking); | 1405 | ci->i_rdcache_revoking); |
| 1403 | } | 1406 | } |
| 1404 | spin_unlock(&inode->i_lock); | 1407 | spin_unlock(&ci->i_ceph_lock); |
| 1405 | 1408 | ||
| 1406 | if (check) | 1409 | if (check) |
| 1407 | ceph_check_caps(ci, 0, NULL); | 1410 | ceph_check_caps(ci, 0, NULL); |
| @@ -1460,10 +1463,10 @@ void __ceph_do_pending_vmtruncate(struct inode *inode) | |||
| 1460 | int wrbuffer_refs, wake = 0; | 1463 | int wrbuffer_refs, wake = 0; |
| 1461 | 1464 | ||
| 1462 | retry: | 1465 | retry: |
| 1463 | spin_lock(&inode->i_lock); | 1466 | spin_lock(&ci->i_ceph_lock); |
| 1464 | if (ci->i_truncate_pending == 0) { | 1467 | if (ci->i_truncate_pending == 0) { |
| 1465 | dout("__do_pending_vmtruncate %p none pending\n", inode); | 1468 | dout("__do_pending_vmtruncate %p none pending\n", inode); |
| 1466 | spin_unlock(&inode->i_lock); | 1469 | spin_unlock(&ci->i_ceph_lock); |
| 1467 | return; | 1470 | return; |
| 1468 | } | 1471 | } |
| 1469 | 1472 | ||
| @@ -1474,7 +1477,7 @@ retry: | |||
| 1474 | if (ci->i_wrbuffer_ref_head < ci->i_wrbuffer_ref) { | 1477 | if (ci->i_wrbuffer_ref_head < ci->i_wrbuffer_ref) { |
| 1475 | dout("__do_pending_vmtruncate %p flushing snaps first\n", | 1478 | dout("__do_pending_vmtruncate %p flushing snaps first\n", |
| 1476 | inode); | 1479 | inode); |
| 1477 | spin_unlock(&inode->i_lock); | 1480 | spin_unlock(&ci->i_ceph_lock); |
| 1478 | filemap_write_and_wait_range(&inode->i_data, 0, | 1481 | filemap_write_and_wait_range(&inode->i_data, 0, |
| 1479 | inode->i_sb->s_maxbytes); | 1482 | inode->i_sb->s_maxbytes); |
| 1480 | goto retry; | 1483 | goto retry; |
| @@ -1484,15 +1487,15 @@ retry: | |||
| 1484 | wrbuffer_refs = ci->i_wrbuffer_ref; | 1487 | wrbuffer_refs = ci->i_wrbuffer_ref; |
| 1485 | dout("__do_pending_vmtruncate %p (%d) to %lld\n", inode, | 1488 | dout("__do_pending_vmtruncate %p (%d) to %lld\n", inode, |
| 1486 | ci->i_truncate_pending, to); | 1489 | ci->i_truncate_pending, to); |
| 1487 | spin_unlock(&inode->i_lock); | 1490 | spin_unlock(&ci->i_ceph_lock); |
| 1488 | 1491 | ||
| 1489 | truncate_inode_pages(inode->i_mapping, to); | 1492 | truncate_inode_pages(inode->i_mapping, to); |
| 1490 | 1493 | ||
| 1491 | spin_lock(&inode->i_lock); | 1494 | spin_lock(&ci->i_ceph_lock); |
| 1492 | ci->i_truncate_pending--; | 1495 | ci->i_truncate_pending--; |
| 1493 | if (ci->i_truncate_pending == 0) | 1496 | if (ci->i_truncate_pending == 0) |
| 1494 | wake = 1; | 1497 | wake = 1; |
| 1495 | spin_unlock(&inode->i_lock); | 1498 | spin_unlock(&ci->i_ceph_lock); |
| 1496 | 1499 | ||
| 1497 | if (wrbuffer_refs == 0) | 1500 | if (wrbuffer_refs == 0) |
| 1498 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); | 1501 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); |
| @@ -1547,7 +1550,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 1547 | if (IS_ERR(req)) | 1550 | if (IS_ERR(req)) |
| 1548 | return PTR_ERR(req); | 1551 | return PTR_ERR(req); |
| 1549 | 1552 | ||
| 1550 | spin_lock(&inode->i_lock); | 1553 | spin_lock(&ci->i_ceph_lock); |
| 1551 | issued = __ceph_caps_issued(ci, NULL); | 1554 | issued = __ceph_caps_issued(ci, NULL); |
| 1552 | dout("setattr %p issued %s\n", inode, ceph_cap_string(issued)); | 1555 | dout("setattr %p issued %s\n", inode, ceph_cap_string(issued)); |
| 1553 | 1556 | ||
| @@ -1695,7 +1698,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 1695 | } | 1698 | } |
| 1696 | 1699 | ||
| 1697 | release &= issued; | 1700 | release &= issued; |
| 1698 | spin_unlock(&inode->i_lock); | 1701 | spin_unlock(&ci->i_ceph_lock); |
| 1699 | 1702 | ||
| 1700 | if (inode_dirty_flags) | 1703 | if (inode_dirty_flags) |
| 1701 | __mark_inode_dirty(inode, inode_dirty_flags); | 1704 | __mark_inode_dirty(inode, inode_dirty_flags); |
| @@ -1717,7 +1720,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 1717 | __ceph_do_pending_vmtruncate(inode); | 1720 | __ceph_do_pending_vmtruncate(inode); |
| 1718 | return err; | 1721 | return err; |
| 1719 | out: | 1722 | out: |
| 1720 | spin_unlock(&inode->i_lock); | 1723 | spin_unlock(&ci->i_ceph_lock); |
| 1721 | ceph_mdsc_put_request(req); | 1724 | ceph_mdsc_put_request(req); |
| 1722 | return err; | 1725 | return err; |
| 1723 | } | 1726 | } |
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index 5a14c29cbba6..790914a598dd 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c | |||
| @@ -241,11 +241,11 @@ static long ceph_ioctl_lazyio(struct file *file) | |||
| 241 | struct ceph_inode_info *ci = ceph_inode(inode); | 241 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 242 | 242 | ||
| 243 | if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) { | 243 | if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) { |
| 244 | spin_lock(&inode->i_lock); | 244 | spin_lock(&ci->i_ceph_lock); |
| 245 | ci->i_nr_by_mode[fi->fmode]--; | 245 | ci->i_nr_by_mode[fi->fmode]--; |
| 246 | fi->fmode |= CEPH_FILE_MODE_LAZY; | 246 | fi->fmode |= CEPH_FILE_MODE_LAZY; |
| 247 | ci->i_nr_by_mode[fi->fmode]++; | 247 | ci->i_nr_by_mode[fi->fmode]++; |
| 248 | spin_unlock(&inode->i_lock); | 248 | spin_unlock(&ci->i_ceph_lock); |
| 249 | dout("ioctl_layzio: file %p marked lazy\n", file); | 249 | dout("ioctl_layzio: file %p marked lazy\n", file); |
| 250 | 250 | ||
| 251 | ceph_check_caps(ci, 0, NULL); | 251 | ceph_check_caps(ci, 0, NULL); |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 264ab701154f..6203d805eb45 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
| @@ -732,21 +732,21 @@ static int __choose_mds(struct ceph_mds_client *mdsc, | |||
| 732 | } | 732 | } |
| 733 | } | 733 | } |
| 734 | 734 | ||
| 735 | spin_lock(&inode->i_lock); | 735 | spin_lock(&ci->i_ceph_lock); |
| 736 | cap = NULL; | 736 | cap = NULL; |
| 737 | if (mode == USE_AUTH_MDS) | 737 | if (mode == USE_AUTH_MDS) |
| 738 | cap = ci->i_auth_cap; | 738 | cap = ci->i_auth_cap; |
| 739 | if (!cap && !RB_EMPTY_ROOT(&ci->i_caps)) | 739 | if (!cap && !RB_EMPTY_ROOT(&ci->i_caps)) |
| 740 | cap = rb_entry(rb_first(&ci->i_caps), struct ceph_cap, ci_node); | 740 | cap = rb_entry(rb_first(&ci->i_caps), struct ceph_cap, ci_node); |
| 741 | if (!cap) { | 741 | if (!cap) { |
| 742 | spin_unlock(&inode->i_lock); | 742 | spin_unlock(&ci->i_ceph_lock); |
| 743 | goto random; | 743 | goto random; |
| 744 | } | 744 | } |
| 745 | mds = cap->session->s_mds; | 745 | mds = cap->session->s_mds; |
| 746 | dout("choose_mds %p %llx.%llx mds%d (%scap %p)\n", | 746 | dout("choose_mds %p %llx.%llx mds%d (%scap %p)\n", |
| 747 | inode, ceph_vinop(inode), mds, | 747 | inode, ceph_vinop(inode), mds, |
| 748 | cap == ci->i_auth_cap ? "auth " : "", cap); | 748 | cap == ci->i_auth_cap ? "auth " : "", cap); |
| 749 | spin_unlock(&inode->i_lock); | 749 | spin_unlock(&ci->i_ceph_lock); |
| 750 | return mds; | 750 | return mds; |
| 751 | 751 | ||
| 752 | random: | 752 | random: |
| @@ -951,7 +951,7 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, | |||
| 951 | 951 | ||
| 952 | dout("removing cap %p, ci is %p, inode is %p\n", | 952 | dout("removing cap %p, ci is %p, inode is %p\n", |
| 953 | cap, ci, &ci->vfs_inode); | 953 | cap, ci, &ci->vfs_inode); |
| 954 | spin_lock(&inode->i_lock); | 954 | spin_lock(&ci->i_ceph_lock); |
| 955 | __ceph_remove_cap(cap); | 955 | __ceph_remove_cap(cap); |
| 956 | if (!__ceph_is_any_real_caps(ci)) { | 956 | if (!__ceph_is_any_real_caps(ci)) { |
| 957 | struct ceph_mds_client *mdsc = | 957 | struct ceph_mds_client *mdsc = |
| @@ -984,7 +984,7 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, | |||
| 984 | } | 984 | } |
| 985 | spin_unlock(&mdsc->cap_dirty_lock); | 985 | spin_unlock(&mdsc->cap_dirty_lock); |
| 986 | } | 986 | } |
| 987 | spin_unlock(&inode->i_lock); | 987 | spin_unlock(&ci->i_ceph_lock); |
| 988 | while (drop--) | 988 | while (drop--) |
| 989 | iput(inode); | 989 | iput(inode); |
| 990 | return 0; | 990 | return 0; |
| @@ -1015,10 +1015,10 @@ static int wake_up_session_cb(struct inode *inode, struct ceph_cap *cap, | |||
| 1015 | 1015 | ||
| 1016 | wake_up_all(&ci->i_cap_wq); | 1016 | wake_up_all(&ci->i_cap_wq); |
| 1017 | if (arg) { | 1017 | if (arg) { |
| 1018 | spin_lock(&inode->i_lock); | 1018 | spin_lock(&ci->i_ceph_lock); |
| 1019 | ci->i_wanted_max_size = 0; | 1019 | ci->i_wanted_max_size = 0; |
| 1020 | ci->i_requested_max_size = 0; | 1020 | ci->i_requested_max_size = 0; |
| 1021 | spin_unlock(&inode->i_lock); | 1021 | spin_unlock(&ci->i_ceph_lock); |
| 1022 | } | 1022 | } |
| 1023 | return 0; | 1023 | return 0; |
| 1024 | } | 1024 | } |
| @@ -1151,7 +1151,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) | |||
| 1151 | if (session->s_trim_caps <= 0) | 1151 | if (session->s_trim_caps <= 0) |
| 1152 | return -1; | 1152 | return -1; |
| 1153 | 1153 | ||
| 1154 | spin_lock(&inode->i_lock); | 1154 | spin_lock(&ci->i_ceph_lock); |
| 1155 | mine = cap->issued | cap->implemented; | 1155 | mine = cap->issued | cap->implemented; |
| 1156 | used = __ceph_caps_used(ci); | 1156 | used = __ceph_caps_used(ci); |
| 1157 | oissued = __ceph_caps_issued_other(ci, cap); | 1157 | oissued = __ceph_caps_issued_other(ci, cap); |
| @@ -1170,7 +1170,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) | |||
| 1170 | __ceph_remove_cap(cap); | 1170 | __ceph_remove_cap(cap); |
| 1171 | } else { | 1171 | } else { |
| 1172 | /* try to drop referring dentries */ | 1172 | /* try to drop referring dentries */ |
| 1173 | spin_unlock(&inode->i_lock); | 1173 | spin_unlock(&ci->i_ceph_lock); |
| 1174 | d_prune_aliases(inode); | 1174 | d_prune_aliases(inode); |
| 1175 | dout("trim_caps_cb %p cap %p pruned, count now %d\n", | 1175 | dout("trim_caps_cb %p cap %p pruned, count now %d\n", |
| 1176 | inode, cap, atomic_read(&inode->i_count)); | 1176 | inode, cap, atomic_read(&inode->i_count)); |
| @@ -1178,7 +1178,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) | |||
| 1178 | } | 1178 | } |
| 1179 | 1179 | ||
| 1180 | out: | 1180 | out: |
| 1181 | spin_unlock(&inode->i_lock); | 1181 | spin_unlock(&ci->i_ceph_lock); |
| 1182 | return 0; | 1182 | return 0; |
| 1183 | } | 1183 | } |
| 1184 | 1184 | ||
| @@ -1296,7 +1296,7 @@ static int check_cap_flush(struct ceph_mds_client *mdsc, u64 want_flush_seq) | |||
| 1296 | i_flushing_item); | 1296 | i_flushing_item); |
| 1297 | struct inode *inode = &ci->vfs_inode; | 1297 | struct inode *inode = &ci->vfs_inode; |
| 1298 | 1298 | ||
| 1299 | spin_lock(&inode->i_lock); | 1299 | spin_lock(&ci->i_ceph_lock); |
| 1300 | if (ci->i_cap_flush_seq <= want_flush_seq) { | 1300 | if (ci->i_cap_flush_seq <= want_flush_seq) { |
| 1301 | dout("check_cap_flush still flushing %p " | 1301 | dout("check_cap_flush still flushing %p " |
| 1302 | "seq %lld <= %lld to mds%d\n", inode, | 1302 | "seq %lld <= %lld to mds%d\n", inode, |
| @@ -1304,7 +1304,7 @@ static int check_cap_flush(struct ceph_mds_client *mdsc, u64 want_flush_seq) | |||
| 1304 | session->s_mds); | 1304 | session->s_mds); |
| 1305 | ret = 0; | 1305 | ret = 0; |
| 1306 | } | 1306 | } |
| 1307 | spin_unlock(&inode->i_lock); | 1307 | spin_unlock(&ci->i_ceph_lock); |
| 1308 | } | 1308 | } |
| 1309 | mutex_unlock(&session->s_mutex); | 1309 | mutex_unlock(&session->s_mutex); |
| 1310 | ceph_put_mds_session(session); | 1310 | ceph_put_mds_session(session); |
| @@ -1495,6 +1495,7 @@ retry: | |||
| 1495 | pos, temp); | 1495 | pos, temp); |
| 1496 | } else if (stop_on_nosnap && inode && | 1496 | } else if (stop_on_nosnap && inode && |
| 1497 | ceph_snap(inode) == CEPH_NOSNAP) { | 1497 | ceph_snap(inode) == CEPH_NOSNAP) { |
| 1498 | spin_unlock(&temp->d_lock); | ||
| 1498 | break; | 1499 | break; |
| 1499 | } else { | 1500 | } else { |
| 1500 | pos -= temp->d_name.len; | 1501 | pos -= temp->d_name.len; |
| @@ -2011,10 +2012,10 @@ void ceph_invalidate_dir_request(struct ceph_mds_request *req) | |||
| 2011 | struct ceph_inode_info *ci = ceph_inode(inode); | 2012 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 2012 | 2013 | ||
| 2013 | dout("invalidate_dir_request %p (D_COMPLETE, lease(s))\n", inode); | 2014 | dout("invalidate_dir_request %p (D_COMPLETE, lease(s))\n", inode); |
| 2014 | spin_lock(&inode->i_lock); | 2015 | spin_lock(&ci->i_ceph_lock); |
| 2015 | ceph_dir_clear_complete(inode); | 2016 | ceph_dir_clear_complete(inode); |
| 2016 | ci->i_release_count++; | 2017 | ci->i_release_count++; |
| 2017 | spin_unlock(&inode->i_lock); | 2018 | spin_unlock(&ci->i_ceph_lock); |
| 2018 | 2019 | ||
| 2019 | if (req->r_dentry) | 2020 | if (req->r_dentry) |
| 2020 | ceph_invalidate_dentry_lease(req->r_dentry); | 2021 | ceph_invalidate_dentry_lease(req->r_dentry); |
| @@ -2422,7 +2423,7 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap, | |||
| 2422 | if (err) | 2423 | if (err) |
| 2423 | goto out_free; | 2424 | goto out_free; |
| 2424 | 2425 | ||
| 2425 | spin_lock(&inode->i_lock); | 2426 | spin_lock(&ci->i_ceph_lock); |
| 2426 | cap->seq = 0; /* reset cap seq */ | 2427 | cap->seq = 0; /* reset cap seq */ |
| 2427 | cap->issue_seq = 0; /* and issue_seq */ | 2428 | cap->issue_seq = 0; /* and issue_seq */ |
| 2428 | 2429 | ||
| @@ -2445,7 +2446,7 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap, | |||
| 2445 | rec.v1.pathbase = cpu_to_le64(pathbase); | 2446 | rec.v1.pathbase = cpu_to_le64(pathbase); |
| 2446 | reclen = sizeof(rec.v1); | 2447 | reclen = sizeof(rec.v1); |
| 2447 | } | 2448 | } |
| 2448 | spin_unlock(&inode->i_lock); | 2449 | spin_unlock(&ci->i_ceph_lock); |
| 2449 | 2450 | ||
| 2450 | if (recon_state->flock) { | 2451 | if (recon_state->flock) { |
| 2451 | int num_fcntl_locks, num_flock_locks; | 2452 | int num_fcntl_locks, num_flock_locks; |
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index 4bb239921dbd..a50ca0e39475 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | * | 20 | * |
| 21 | * mdsc->snap_rwsem | 21 | * mdsc->snap_rwsem |
| 22 | * | 22 | * |
| 23 | * inode->i_lock | 23 | * ci->i_ceph_lock |
| 24 | * mdsc->snap_flush_lock | 24 | * mdsc->snap_flush_lock |
| 25 | * mdsc->cap_delay_lock | 25 | * mdsc->cap_delay_lock |
| 26 | * | 26 | * |
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index e26437191333..a559c80f127a 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c | |||
| @@ -446,7 +446,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) | |||
| 446 | return; | 446 | return; |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | spin_lock(&inode->i_lock); | 449 | spin_lock(&ci->i_ceph_lock); |
| 450 | used = __ceph_caps_used(ci); | 450 | used = __ceph_caps_used(ci); |
| 451 | dirty = __ceph_caps_dirty(ci); | 451 | dirty = __ceph_caps_dirty(ci); |
| 452 | 452 | ||
| @@ -528,7 +528,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) | |||
| 528 | kfree(capsnap); | 528 | kfree(capsnap); |
| 529 | } | 529 | } |
| 530 | 530 | ||
| 531 | spin_unlock(&inode->i_lock); | 531 | spin_unlock(&ci->i_ceph_lock); |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | /* | 534 | /* |
| @@ -537,7 +537,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) | |||
| 537 | * | 537 | * |
| 538 | * If capsnap can now be flushed, add to snap_flush list, and return 1. | 538 | * If capsnap can now be flushed, add to snap_flush list, and return 1. |
| 539 | * | 539 | * |
| 540 | * Caller must hold i_lock. | 540 | * Caller must hold i_ceph_lock. |
| 541 | */ | 541 | */ |
| 542 | int __ceph_finish_cap_snap(struct ceph_inode_info *ci, | 542 | int __ceph_finish_cap_snap(struct ceph_inode_info *ci, |
| 543 | struct ceph_cap_snap *capsnap) | 543 | struct ceph_cap_snap *capsnap) |
| @@ -739,9 +739,9 @@ static void flush_snaps(struct ceph_mds_client *mdsc) | |||
| 739 | inode = &ci->vfs_inode; | 739 | inode = &ci->vfs_inode; |
| 740 | ihold(inode); | 740 | ihold(inode); |
| 741 | spin_unlock(&mdsc->snap_flush_lock); | 741 | spin_unlock(&mdsc->snap_flush_lock); |
| 742 | spin_lock(&inode->i_lock); | 742 | spin_lock(&ci->i_ceph_lock); |
| 743 | __ceph_flush_snaps(ci, &session, 0); | 743 | __ceph_flush_snaps(ci, &session, 0); |
| 744 | spin_unlock(&inode->i_lock); | 744 | spin_unlock(&ci->i_ceph_lock); |
| 745 | iput(inode); | 745 | iput(inode); |
| 746 | spin_lock(&mdsc->snap_flush_lock); | 746 | spin_lock(&mdsc->snap_flush_lock); |
| 747 | } | 747 | } |
| @@ -847,7 +847,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, | |||
| 847 | continue; | 847 | continue; |
| 848 | ci = ceph_inode(inode); | 848 | ci = ceph_inode(inode); |
| 849 | 849 | ||
| 850 | spin_lock(&inode->i_lock); | 850 | spin_lock(&ci->i_ceph_lock); |
| 851 | if (!ci->i_snap_realm) | 851 | if (!ci->i_snap_realm) |
| 852 | goto skip_inode; | 852 | goto skip_inode; |
| 853 | /* | 853 | /* |
| @@ -876,7 +876,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, | |||
| 876 | oldrealm = ci->i_snap_realm; | 876 | oldrealm = ci->i_snap_realm; |
| 877 | ci->i_snap_realm = realm; | 877 | ci->i_snap_realm = realm; |
| 878 | spin_unlock(&realm->inodes_with_caps_lock); | 878 | spin_unlock(&realm->inodes_with_caps_lock); |
| 879 | spin_unlock(&inode->i_lock); | 879 | spin_unlock(&ci->i_ceph_lock); |
| 880 | 880 | ||
| 881 | ceph_get_snap_realm(mdsc, realm); | 881 | ceph_get_snap_realm(mdsc, realm); |
| 882 | ceph_put_snap_realm(mdsc, oldrealm); | 882 | ceph_put_snap_realm(mdsc, oldrealm); |
| @@ -885,7 +885,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, | |||
| 885 | continue; | 885 | continue; |
| 886 | 886 | ||
| 887 | skip_inode: | 887 | skip_inode: |
| 888 | spin_unlock(&inode->i_lock); | 888 | spin_unlock(&ci->i_ceph_lock); |
| 889 | iput(inode); | 889 | iput(inode); |
| 890 | } | 890 | } |
| 891 | 891 | ||
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 8dc73a594a90..b48f15f101a0 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
| @@ -383,7 +383,7 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
| 383 | if (fsopt->rsize != CEPH_RSIZE_DEFAULT) | 383 | if (fsopt->rsize != CEPH_RSIZE_DEFAULT) |
| 384 | seq_printf(m, ",rsize=%d", fsopt->rsize); | 384 | seq_printf(m, ",rsize=%d", fsopt->rsize); |
| 385 | if (fsopt->rasize != CEPH_RASIZE_DEFAULT) | 385 | if (fsopt->rasize != CEPH_RASIZE_DEFAULT) |
| 386 | seq_printf(m, ",rasize=%d", fsopt->rsize); | 386 | seq_printf(m, ",rasize=%d", fsopt->rasize); |
| 387 | if (fsopt->congestion_kb != default_congestion_kb()) | 387 | if (fsopt->congestion_kb != default_congestion_kb()) |
| 388 | seq_printf(m, ",write_congestion_kb=%d", fsopt->congestion_kb); | 388 | seq_printf(m, ",write_congestion_kb=%d", fsopt->congestion_kb); |
| 389 | if (fsopt->caps_wanted_delay_min != CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT) | 389 | if (fsopt->caps_wanted_delay_min != CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT) |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 01bf189e08a9..edcbf3774a56 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
| @@ -220,7 +220,7 @@ struct ceph_dentry_info { | |||
| 220 | * The locking for D_COMPLETE is a bit odd: | 220 | * The locking for D_COMPLETE is a bit odd: |
| 221 | * - we can clear it at almost any time (see ceph_d_prune) | 221 | * - we can clear it at almost any time (see ceph_d_prune) |
| 222 | * - it is only meaningful if: | 222 | * - it is only meaningful if: |
| 223 | * - we hold dir inode i_lock | 223 | * - we hold dir inode i_ceph_lock |
| 224 | * - we hold dir FILE_SHARED caps | 224 | * - we hold dir FILE_SHARED caps |
| 225 | * - the dentry D_COMPLETE is set | 225 | * - the dentry D_COMPLETE is set |
| 226 | */ | 226 | */ |
| @@ -250,6 +250,8 @@ struct ceph_inode_xattrs_info { | |||
| 250 | struct ceph_inode_info { | 250 | struct ceph_inode_info { |
| 251 | struct ceph_vino i_vino; /* ceph ino + snap */ | 251 | struct ceph_vino i_vino; /* ceph ino + snap */ |
| 252 | 252 | ||
| 253 | spinlock_t i_ceph_lock; | ||
| 254 | |||
| 253 | u64 i_version; | 255 | u64 i_version; |
| 254 | u32 i_time_warp_seq; | 256 | u32 i_time_warp_seq; |
| 255 | 257 | ||
| @@ -271,7 +273,7 @@ struct ceph_inode_info { | |||
| 271 | 273 | ||
| 272 | struct ceph_inode_xattrs_info i_xattrs; | 274 | struct ceph_inode_xattrs_info i_xattrs; |
| 273 | 275 | ||
| 274 | /* capabilities. protected _both_ by i_lock and cap->session's | 276 | /* capabilities. protected _both_ by i_ceph_lock and cap->session's |
| 275 | * s_mutex. */ | 277 | * s_mutex. */ |
| 276 | struct rb_root i_caps; /* cap list */ | 278 | struct rb_root i_caps; /* cap list */ |
| 277 | struct ceph_cap *i_auth_cap; /* authoritative cap, if any */ | 279 | struct ceph_cap *i_auth_cap; /* authoritative cap, if any */ |
| @@ -437,18 +439,18 @@ static inline void ceph_i_clear(struct inode *inode, unsigned mask) | |||
| 437 | { | 439 | { |
| 438 | struct ceph_inode_info *ci = ceph_inode(inode); | 440 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 439 | 441 | ||
| 440 | spin_lock(&inode->i_lock); | 442 | spin_lock(&ci->i_ceph_lock); |
| 441 | ci->i_ceph_flags &= ~mask; | 443 | ci->i_ceph_flags &= ~mask; |
| 442 | spin_unlock(&inode->i_lock); | 444 | spin_unlock(&ci->i_ceph_lock); |
| 443 | } | 445 | } |
| 444 | 446 | ||
| 445 | static inline void ceph_i_set(struct inode *inode, unsigned mask) | 447 | static inline void ceph_i_set(struct inode *inode, unsigned mask) |
| 446 | { | 448 | { |
| 447 | struct ceph_inode_info *ci = ceph_inode(inode); | 449 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 448 | 450 | ||
| 449 | spin_lock(&inode->i_lock); | 451 | spin_lock(&ci->i_ceph_lock); |
| 450 | ci->i_ceph_flags |= mask; | 452 | ci->i_ceph_flags |= mask; |
| 451 | spin_unlock(&inode->i_lock); | 453 | spin_unlock(&ci->i_ceph_lock); |
| 452 | } | 454 | } |
| 453 | 455 | ||
| 454 | static inline bool ceph_i_test(struct inode *inode, unsigned mask) | 456 | static inline bool ceph_i_test(struct inode *inode, unsigned mask) |
| @@ -456,9 +458,9 @@ static inline bool ceph_i_test(struct inode *inode, unsigned mask) | |||
| 456 | struct ceph_inode_info *ci = ceph_inode(inode); | 458 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 457 | bool r; | 459 | bool r; |
| 458 | 460 | ||
| 459 | spin_lock(&inode->i_lock); | 461 | spin_lock(&ci->i_ceph_lock); |
| 460 | r = (ci->i_ceph_flags & mask) == mask; | 462 | r = (ci->i_ceph_flags & mask) == mask; |
| 461 | spin_unlock(&inode->i_lock); | 463 | spin_unlock(&ci->i_ceph_lock); |
| 462 | return r; | 464 | return r; |
| 463 | } | 465 | } |
| 464 | 466 | ||
| @@ -508,9 +510,9 @@ extern int __ceph_caps_issued_other(struct ceph_inode_info *ci, | |||
| 508 | static inline int ceph_caps_issued(struct ceph_inode_info *ci) | 510 | static inline int ceph_caps_issued(struct ceph_inode_info *ci) |
| 509 | { | 511 | { |
| 510 | int issued; | 512 | int issued; |
| 511 | spin_lock(&ci->vfs_inode.i_lock); | 513 | spin_lock(&ci->i_ceph_lock); |
| 512 | issued = __ceph_caps_issued(ci, NULL); | 514 | issued = __ceph_caps_issued(ci, NULL); |
| 513 | spin_unlock(&ci->vfs_inode.i_lock); | 515 | spin_unlock(&ci->i_ceph_lock); |
| 514 | return issued; | 516 | return issued; |
| 515 | } | 517 | } |
| 516 | 518 | ||
| @@ -518,9 +520,9 @@ static inline int ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, | |||
| 518 | int touch) | 520 | int touch) |
| 519 | { | 521 | { |
| 520 | int r; | 522 | int r; |
| 521 | spin_lock(&ci->vfs_inode.i_lock); | 523 | spin_lock(&ci->i_ceph_lock); |
| 522 | r = __ceph_caps_issued_mask(ci, mask, touch); | 524 | r = __ceph_caps_issued_mask(ci, mask, touch); |
| 523 | spin_unlock(&ci->vfs_inode.i_lock); | 525 | spin_unlock(&ci->i_ceph_lock); |
| 524 | return r; | 526 | return r; |
| 525 | } | 527 | } |
| 526 | 528 | ||
| @@ -743,10 +745,9 @@ extern int ceph_add_cap(struct inode *inode, | |||
| 743 | extern void __ceph_remove_cap(struct ceph_cap *cap); | 745 | extern void __ceph_remove_cap(struct ceph_cap *cap); |
| 744 | static inline void ceph_remove_cap(struct ceph_cap *cap) | 746 | static inline void ceph_remove_cap(struct ceph_cap *cap) |
| 745 | { | 747 | { |
| 746 | struct inode *inode = &cap->ci->vfs_inode; | 748 | spin_lock(&cap->ci->i_ceph_lock); |
| 747 | spin_lock(&inode->i_lock); | ||
| 748 | __ceph_remove_cap(cap); | 749 | __ceph_remove_cap(cap); |
| 749 | spin_unlock(&inode->i_lock); | 750 | spin_unlock(&cap->ci->i_ceph_lock); |
| 750 | } | 751 | } |
| 751 | extern void ceph_put_cap(struct ceph_mds_client *mdsc, | 752 | extern void ceph_put_cap(struct ceph_mds_client *mdsc, |
| 752 | struct ceph_cap *cap); | 753 | struct ceph_cap *cap); |
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 96c6739a0280..a5e36e4488a7 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
| @@ -343,8 +343,8 @@ void __ceph_destroy_xattrs(struct ceph_inode_info *ci) | |||
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | static int __build_xattrs(struct inode *inode) | 345 | static int __build_xattrs(struct inode *inode) |
| 346 | __releases(inode->i_lock) | 346 | __releases(ci->i_ceph_lock) |
| 347 | __acquires(inode->i_lock) | 347 | __acquires(ci->i_ceph_lock) |
| 348 | { | 348 | { |
| 349 | u32 namelen; | 349 | u32 namelen; |
| 350 | u32 numattr = 0; | 350 | u32 numattr = 0; |
| @@ -372,7 +372,7 @@ start: | |||
| 372 | end = p + ci->i_xattrs.blob->vec.iov_len; | 372 | end = p + ci->i_xattrs.blob->vec.iov_len; |
| 373 | ceph_decode_32_safe(&p, end, numattr, bad); | 373 | ceph_decode_32_safe(&p, end, numattr, bad); |
| 374 | xattr_version = ci->i_xattrs.version; | 374 | xattr_version = ci->i_xattrs.version; |
| 375 | spin_unlock(&inode->i_lock); | 375 | spin_unlock(&ci->i_ceph_lock); |
| 376 | 376 | ||
| 377 | xattrs = kcalloc(numattr, sizeof(struct ceph_xattr *), | 377 | xattrs = kcalloc(numattr, sizeof(struct ceph_xattr *), |
| 378 | GFP_NOFS); | 378 | GFP_NOFS); |
| @@ -387,7 +387,7 @@ start: | |||
| 387 | goto bad_lock; | 387 | goto bad_lock; |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | spin_lock(&inode->i_lock); | 390 | spin_lock(&ci->i_ceph_lock); |
| 391 | if (ci->i_xattrs.version != xattr_version) { | 391 | if (ci->i_xattrs.version != xattr_version) { |
| 392 | /* lost a race, retry */ | 392 | /* lost a race, retry */ |
| 393 | for (i = 0; i < numattr; i++) | 393 | for (i = 0; i < numattr; i++) |
| @@ -418,7 +418,7 @@ start: | |||
| 418 | 418 | ||
| 419 | return err; | 419 | return err; |
| 420 | bad_lock: | 420 | bad_lock: |
| 421 | spin_lock(&inode->i_lock); | 421 | spin_lock(&ci->i_ceph_lock); |
| 422 | bad: | 422 | bad: |
| 423 | if (xattrs) { | 423 | if (xattrs) { |
| 424 | for (i = 0; i < numattr; i++) | 424 | for (i = 0; i < numattr; i++) |
| @@ -512,7 +512,7 @@ ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value, | |||
| 512 | if (vxattrs) | 512 | if (vxattrs) |
| 513 | vxattr = ceph_match_vxattr(vxattrs, name); | 513 | vxattr = ceph_match_vxattr(vxattrs, name); |
| 514 | 514 | ||
| 515 | spin_lock(&inode->i_lock); | 515 | spin_lock(&ci->i_ceph_lock); |
| 516 | dout("getxattr %p ver=%lld index_ver=%lld\n", inode, | 516 | dout("getxattr %p ver=%lld index_ver=%lld\n", inode, |
| 517 | ci->i_xattrs.version, ci->i_xattrs.index_version); | 517 | ci->i_xattrs.version, ci->i_xattrs.index_version); |
| 518 | 518 | ||
| @@ -520,14 +520,14 @@ ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value, | |||
| 520 | (ci->i_xattrs.index_version >= ci->i_xattrs.version)) { | 520 | (ci->i_xattrs.index_version >= ci->i_xattrs.version)) { |
| 521 | goto get_xattr; | 521 | goto get_xattr; |
| 522 | } else { | 522 | } else { |
| 523 | spin_unlock(&inode->i_lock); | 523 | spin_unlock(&ci->i_ceph_lock); |
| 524 | /* get xattrs from mds (if we don't already have them) */ | 524 | /* get xattrs from mds (if we don't already have them) */ |
| 525 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR); | 525 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR); |
| 526 | if (err) | 526 | if (err) |
| 527 | return err; | 527 | return err; |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | spin_lock(&inode->i_lock); | 530 | spin_lock(&ci->i_ceph_lock); |
| 531 | 531 | ||
| 532 | if (vxattr && vxattr->readonly) { | 532 | if (vxattr && vxattr->readonly) { |
| 533 | err = vxattr->getxattr_cb(ci, value, size); | 533 | err = vxattr->getxattr_cb(ci, value, size); |
| @@ -558,7 +558,7 @@ get_xattr: | |||
| 558 | memcpy(value, xattr->val, xattr->val_len); | 558 | memcpy(value, xattr->val, xattr->val_len); |
| 559 | 559 | ||
| 560 | out: | 560 | out: |
| 561 | spin_unlock(&inode->i_lock); | 561 | spin_unlock(&ci->i_ceph_lock); |
| 562 | return err; | 562 | return err; |
| 563 | } | 563 | } |
| 564 | 564 | ||
| @@ -573,7 +573,7 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) | |||
| 573 | u32 len; | 573 | u32 len; |
| 574 | int i; | 574 | int i; |
| 575 | 575 | ||
| 576 | spin_lock(&inode->i_lock); | 576 | spin_lock(&ci->i_ceph_lock); |
| 577 | dout("listxattr %p ver=%lld index_ver=%lld\n", inode, | 577 | dout("listxattr %p ver=%lld index_ver=%lld\n", inode, |
| 578 | ci->i_xattrs.version, ci->i_xattrs.index_version); | 578 | ci->i_xattrs.version, ci->i_xattrs.index_version); |
| 579 | 579 | ||
| @@ -581,13 +581,13 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) | |||
| 581 | (ci->i_xattrs.index_version >= ci->i_xattrs.version)) { | 581 | (ci->i_xattrs.index_version >= ci->i_xattrs.version)) { |
| 582 | goto list_xattr; | 582 | goto list_xattr; |
| 583 | } else { | 583 | } else { |
| 584 | spin_unlock(&inode->i_lock); | 584 | spin_unlock(&ci->i_ceph_lock); |
| 585 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR); | 585 | err = ceph_do_getattr(inode, CEPH_STAT_CAP_XATTR); |
| 586 | if (err) | 586 | if (err) |
| 587 | return err; | 587 | return err; |
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | spin_lock(&inode->i_lock); | 590 | spin_lock(&ci->i_ceph_lock); |
| 591 | 591 | ||
| 592 | err = __build_xattrs(inode); | 592 | err = __build_xattrs(inode); |
| 593 | if (err < 0) | 593 | if (err < 0) |
| @@ -619,7 +619,7 @@ list_xattr: | |||
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | out: | 621 | out: |
| 622 | spin_unlock(&inode->i_lock); | 622 | spin_unlock(&ci->i_ceph_lock); |
| 623 | return err; | 623 | return err; |
| 624 | } | 624 | } |
| 625 | 625 | ||
| @@ -739,7 +739,7 @@ int ceph_setxattr(struct dentry *dentry, const char *name, | |||
| 739 | if (!xattr) | 739 | if (!xattr) |
| 740 | goto out; | 740 | goto out; |
| 741 | 741 | ||
| 742 | spin_lock(&inode->i_lock); | 742 | spin_lock(&ci->i_ceph_lock); |
| 743 | retry: | 743 | retry: |
| 744 | issued = __ceph_caps_issued(ci, NULL); | 744 | issued = __ceph_caps_issued(ci, NULL); |
| 745 | if (!(issued & CEPH_CAP_XATTR_EXCL)) | 745 | if (!(issued & CEPH_CAP_XATTR_EXCL)) |
| @@ -752,12 +752,12 @@ retry: | |||
| 752 | required_blob_size > ci->i_xattrs.prealloc_blob->alloc_len) { | 752 | required_blob_size > ci->i_xattrs.prealloc_blob->alloc_len) { |
| 753 | struct ceph_buffer *blob = NULL; | 753 | struct ceph_buffer *blob = NULL; |
| 754 | 754 | ||
| 755 | spin_unlock(&inode->i_lock); | 755 | spin_unlock(&ci->i_ceph_lock); |
| 756 | dout(" preaallocating new blob size=%d\n", required_blob_size); | 756 | dout(" preaallocating new blob size=%d\n", required_blob_size); |
| 757 | blob = ceph_buffer_new(required_blob_size, GFP_NOFS); | 757 | blob = ceph_buffer_new(required_blob_size, GFP_NOFS); |
| 758 | if (!blob) | 758 | if (!blob) |
| 759 | goto out; | 759 | goto out; |
| 760 | spin_lock(&inode->i_lock); | 760 | spin_lock(&ci->i_ceph_lock); |
| 761 | if (ci->i_xattrs.prealloc_blob) | 761 | if (ci->i_xattrs.prealloc_blob) |
| 762 | ceph_buffer_put(ci->i_xattrs.prealloc_blob); | 762 | ceph_buffer_put(ci->i_xattrs.prealloc_blob); |
| 763 | ci->i_xattrs.prealloc_blob = blob; | 763 | ci->i_xattrs.prealloc_blob = blob; |
| @@ -770,13 +770,13 @@ retry: | |||
| 770 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); | 770 | dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); |
| 771 | ci->i_xattrs.dirty = true; | 771 | ci->i_xattrs.dirty = true; |
| 772 | inode->i_ctime = CURRENT_TIME; | 772 | inode->i_ctime = CURRENT_TIME; |
| 773 | spin_unlock(&inode->i_lock); | 773 | spin_unlock(&ci->i_ceph_lock); |
| 774 | if (dirty) | 774 | if (dirty) |
| 775 | __mark_inode_dirty(inode, dirty); | 775 | __mark_inode_dirty(inode, dirty); |
| 776 | return err; | 776 | return err; |
| 777 | 777 | ||
| 778 | do_sync: | 778 | do_sync: |
| 779 | spin_unlock(&inode->i_lock); | 779 | spin_unlock(&ci->i_ceph_lock); |
| 780 | err = ceph_sync_setxattr(dentry, name, value, size, flags); | 780 | err = ceph_sync_setxattr(dentry, name, value, size, flags); |
| 781 | out: | 781 | out: |
| 782 | kfree(newname); | 782 | kfree(newname); |
| @@ -833,7 +833,7 @@ int ceph_removexattr(struct dentry *dentry, const char *name) | |||
| 833 | return -EOPNOTSUPP; | 833 | return -EOPNOTSUPP; |
| 834 | } | 834 | } |
| 835 | 835 | ||
| 836 | spin_lock(&inode->i_lock); | 836 | spin_lock(&ci->i_ceph_lock); |
| 837 | __build_xattrs(inode); | 837 | __build_xattrs(inode); |
| 838 | issued = __ceph_caps_issued(ci, NULL); | 838 | issued = __ceph_caps_issued(ci, NULL); |
| 839 | dout("removexattr %p issued %s\n", inode, ceph_cap_string(issued)); | 839 | dout("removexattr %p issued %s\n", inode, ceph_cap_string(issued)); |
| @@ -846,12 +846,12 @@ int ceph_removexattr(struct dentry *dentry, const char *name) | |||
| 846 | ci->i_xattrs.dirty = true; | 846 | ci->i_xattrs.dirty = true; |
| 847 | inode->i_ctime = CURRENT_TIME; | 847 | inode->i_ctime = CURRENT_TIME; |
| 848 | 848 | ||
| 849 | spin_unlock(&inode->i_lock); | 849 | spin_unlock(&ci->i_ceph_lock); |
| 850 | if (dirty) | 850 | if (dirty) |
| 851 | __mark_inode_dirty(inode, dirty); | 851 | __mark_inode_dirty(inode, dirty); |
| 852 | return err; | 852 | return err; |
| 853 | do_sync: | 853 | do_sync: |
| 854 | spin_unlock(&inode->i_lock); | 854 | spin_unlock(&ci->i_ceph_lock); |
| 855 | err = ceph_send_removexattr(dentry, name); | 855 | err = ceph_send_removexattr(dentry, name); |
| 856 | return err; | 856 | return err; |
| 857 | } | 857 | } |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index d6a972df0338..8cd4b52d4217 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -441,6 +441,8 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct kvec *iov_orig, | |||
| 441 | smb_msg.msg_controllen = 0; | 441 | smb_msg.msg_controllen = 0; |
| 442 | 442 | ||
| 443 | for (total_read = 0; to_read; total_read += length, to_read -= length) { | 443 | for (total_read = 0; to_read; total_read += length, to_read -= length) { |
| 444 | try_to_freeze(); | ||
| 445 | |||
| 444 | if (server_unresponsive(server)) { | 446 | if (server_unresponsive(server)) { |
| 445 | total_read = -EAGAIN; | 447 | total_read = -EAGAIN; |
| 446 | break; | 448 | break; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index cf0b1539b321..4dd9283885e7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
| @@ -702,6 +702,13 @@ cifs_find_lock_conflict(struct cifsInodeInfo *cinode, struct cifsLockInfo *lock, | |||
| 702 | lock->type, lock->netfid, conf_lock); | 702 | lock->type, lock->netfid, conf_lock); |
| 703 | } | 703 | } |
| 704 | 704 | ||
| 705 | /* | ||
| 706 | * Check if there is another lock that prevents us to set the lock (mandatory | ||
| 707 | * style). If such a lock exists, update the flock structure with its | ||
| 708 | * properties. Otherwise, set the flock type to F_UNLCK if we can cache brlocks | ||
| 709 | * or leave it the same if we can't. Returns 0 if we don't need to request to | ||
| 710 | * the server or 1 otherwise. | ||
| 711 | */ | ||
| 705 | static int | 712 | static int |
| 706 | cifs_lock_test(struct cifsInodeInfo *cinode, __u64 offset, __u64 length, | 713 | cifs_lock_test(struct cifsInodeInfo *cinode, __u64 offset, __u64 length, |
| 707 | __u8 type, __u16 netfid, struct file_lock *flock) | 714 | __u8 type, __u16 netfid, struct file_lock *flock) |
| @@ -739,6 +746,12 @@ cifs_lock_add(struct cifsInodeInfo *cinode, struct cifsLockInfo *lock) | |||
| 739 | mutex_unlock(&cinode->lock_mutex); | 746 | mutex_unlock(&cinode->lock_mutex); |
| 740 | } | 747 | } |
| 741 | 748 | ||
| 749 | /* | ||
| 750 | * Set the byte-range lock (mandatory style). Returns: | ||
| 751 | * 1) 0, if we set the lock and don't need to request to the server; | ||
| 752 | * 2) 1, if no locks prevent us but we need to request to the server; | ||
| 753 | * 3) -EACCESS, if there is a lock that prevents us and wait is false. | ||
| 754 | */ | ||
| 742 | static int | 755 | static int |
| 743 | cifs_lock_add_if(struct cifsInodeInfo *cinode, struct cifsLockInfo *lock, | 756 | cifs_lock_add_if(struct cifsInodeInfo *cinode, struct cifsLockInfo *lock, |
| 744 | bool wait) | 757 | bool wait) |
| @@ -778,6 +791,13 @@ try_again: | |||
| 778 | return rc; | 791 | return rc; |
| 779 | } | 792 | } |
| 780 | 793 | ||
| 794 | /* | ||
| 795 | * Check if there is another lock that prevents us to set the lock (posix | ||
| 796 | * style). If such a lock exists, update the flock structure with its | ||
| 797 | * properties. Otherwise, set the flock type to F_UNLCK if we can cache brlocks | ||
| 798 | * or leave it the same if we can't. Returns 0 if we don't need to request to | ||
| 799 | * the server or 1 otherwise. | ||
| 800 | */ | ||
| 781 | static int | 801 | static int |
| 782 | cifs_posix_lock_test(struct file *file, struct file_lock *flock) | 802 | cifs_posix_lock_test(struct file *file, struct file_lock *flock) |
| 783 | { | 803 | { |
| @@ -800,6 +820,12 @@ cifs_posix_lock_test(struct file *file, struct file_lock *flock) | |||
| 800 | return rc; | 820 | return rc; |
| 801 | } | 821 | } |
| 802 | 822 | ||
| 823 | /* | ||
| 824 | * Set the byte-range lock (posix style). Returns: | ||
| 825 | * 1) 0, if we set the lock and don't need to request to the server; | ||
| 826 | * 2) 1, if we need to request to the server; | ||
| 827 | * 3) <0, if the error occurs while setting the lock. | ||
| 828 | */ | ||
| 803 | static int | 829 | static int |
| 804 | cifs_posix_lock_set(struct file *file, struct file_lock *flock) | 830 | cifs_posix_lock_set(struct file *file, struct file_lock *flock) |
| 805 | { | 831 | { |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 5de03ec20144..a090bbe6ee29 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
| @@ -554,7 +554,10 @@ static int find_cifs_entry(const int xid, struct cifs_tcon *pTcon, | |||
| 554 | rc); | 554 | rc); |
| 555 | return rc; | 555 | return rc; |
| 556 | } | 556 | } |
| 557 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile); | 557 | /* FindFirst/Next set last_entry to NULL on malformed reply */ |
| 558 | if (cifsFile->srch_inf.last_entry) | ||
| 559 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, | ||
| 560 | cifsFile); | ||
| 558 | } | 561 | } |
| 559 | 562 | ||
| 560 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && | 563 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && |
| @@ -562,7 +565,10 @@ static int find_cifs_entry(const int xid, struct cifs_tcon *pTcon, | |||
| 562 | cFYI(1, "calling findnext2"); | 565 | cFYI(1, "calling findnext2"); |
| 563 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, | 566 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, |
| 564 | &cifsFile->srch_inf); | 567 | &cifsFile->srch_inf); |
| 565 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile); | 568 | /* FindFirst/Next set last_entry to NULL on malformed reply */ |
| 569 | if (cifsFile->srch_inf.last_entry) | ||
| 570 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, | ||
| 571 | cifsFile); | ||
| 566 | if (rc) | 572 | if (rc) |
| 567 | return -ENOENT; | 573 | return -ENOENT; |
| 568 | } | 574 | } |
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index 7cacba12b8f1..80d850881938 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c | |||
| @@ -209,7 +209,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16, | |||
| 209 | { | 209 | { |
| 210 | int rc; | 210 | int rc; |
| 211 | int len; | 211 | int len; |
| 212 | __u16 wpwd[129]; | 212 | __le16 wpwd[129]; |
| 213 | 213 | ||
| 214 | /* Password cannot be longer than 128 characters */ | 214 | /* Password cannot be longer than 128 characters */ |
| 215 | if (passwd) /* Password must be converted to NT unicode */ | 215 | if (passwd) /* Password must be converted to NT unicode */ |
| @@ -219,8 +219,8 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16, | |||
| 219 | *wpwd = 0; /* Ensure string is null terminated */ | 219 | *wpwd = 0; /* Ensure string is null terminated */ |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__u16)); | 222 | rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16)); |
| 223 | memset(wpwd, 0, 129 * sizeof(__u16)); | 223 | memset(wpwd, 0, 129 * sizeof(__le16)); |
| 224 | 224 | ||
| 225 | return rc; | 225 | return rc; |
| 226 | } | 226 | } |
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index ca418aaf6352..9d8715c45f25 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
| @@ -292,7 +292,7 @@ int __init configfs_inode_init(void) | |||
| 292 | return bdi_init(&configfs_backing_dev_info); | 292 | return bdi_init(&configfs_backing_dev_info); |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | void __exit configfs_inode_exit(void) | 295 | void configfs_inode_exit(void) |
| 296 | { | 296 | { |
| 297 | bdi_destroy(&configfs_backing_dev_info); | 297 | bdi_destroy(&configfs_backing_dev_info); |
| 298 | } | 298 | } |
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index ecc62178beda..276e15cafd58 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
| @@ -143,28 +143,26 @@ static int __init configfs_init(void) | |||
| 143 | goto out; | 143 | goto out; |
| 144 | 144 | ||
| 145 | config_kobj = kobject_create_and_add("config", kernel_kobj); | 145 | config_kobj = kobject_create_and_add("config", kernel_kobj); |
| 146 | if (!config_kobj) { | 146 | if (!config_kobj) |
| 147 | kmem_cache_destroy(configfs_dir_cachep); | 147 | goto out2; |
| 148 | configfs_dir_cachep = NULL; | 148 | |
| 149 | goto out; | 149 | err = configfs_inode_init(); |
| 150 | } | 150 | if (err) |
| 151 | goto out3; | ||
| 151 | 152 | ||
| 152 | err = register_filesystem(&configfs_fs_type); | 153 | err = register_filesystem(&configfs_fs_type); |
| 153 | if (err) { | 154 | if (err) |
| 154 | printk(KERN_ERR "configfs: Unable to register filesystem!\n"); | 155 | goto out4; |
| 155 | kobject_put(config_kobj); | ||
| 156 | kmem_cache_destroy(configfs_dir_cachep); | ||
| 157 | configfs_dir_cachep = NULL; | ||
| 158 | goto out; | ||
| 159 | } | ||
| 160 | 156 | ||
| 161 | err = configfs_inode_init(); | 157 | return 0; |
| 162 | if (err) { | 158 | out4: |
| 163 | unregister_filesystem(&configfs_fs_type); | 159 | printk(KERN_ERR "configfs: Unable to register filesystem!\n"); |
| 164 | kobject_put(config_kobj); | 160 | configfs_inode_exit(); |
| 165 | kmem_cache_destroy(configfs_dir_cachep); | 161 | out3: |
| 166 | configfs_dir_cachep = NULL; | 162 | kobject_put(config_kobj); |
| 167 | } | 163 | out2: |
| 164 | kmem_cache_destroy(configfs_dir_cachep); | ||
| 165 | configfs_dir_cachep = NULL; | ||
| 168 | out: | 166 | out: |
| 169 | return err; | 167 | return err; |
| 170 | } | 168 | } |
diff --git a/fs/dcache.c b/fs/dcache.c index 10ba92def3f6..89509b5a090e 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -2439,16 +2439,14 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name) | |||
| 2439 | /** | 2439 | /** |
| 2440 | * prepend_path - Prepend path string to a buffer | 2440 | * prepend_path - Prepend path string to a buffer |
| 2441 | * @path: the dentry/vfsmount to report | 2441 | * @path: the dentry/vfsmount to report |
| 2442 | * @root: root vfsmnt/dentry (may be modified by this function) | 2442 | * @root: root vfsmnt/dentry |
| 2443 | * @buffer: pointer to the end of the buffer | 2443 | * @buffer: pointer to the end of the buffer |
| 2444 | * @buflen: pointer to buffer length | 2444 | * @buflen: pointer to buffer length |
| 2445 | * | 2445 | * |
| 2446 | * Caller holds the rename_lock. | 2446 | * Caller holds the rename_lock. |
| 2447 | * | ||
| 2448 | * If path is not reachable from the supplied root, then the value of | ||
| 2449 | * root is changed (without modifying refcounts). | ||
| 2450 | */ | 2447 | */ |
| 2451 | static int prepend_path(const struct path *path, struct path *root, | 2448 | static int prepend_path(const struct path *path, |
| 2449 | const struct path *root, | ||
| 2452 | char **buffer, int *buflen) | 2450 | char **buffer, int *buflen) |
| 2453 | { | 2451 | { |
| 2454 | struct dentry *dentry = path->dentry; | 2452 | struct dentry *dentry = path->dentry; |
| @@ -2483,10 +2481,10 @@ static int prepend_path(const struct path *path, struct path *root, | |||
| 2483 | dentry = parent; | 2481 | dentry = parent; |
| 2484 | } | 2482 | } |
| 2485 | 2483 | ||
| 2486 | out: | ||
| 2487 | if (!error && !slash) | 2484 | if (!error && !slash) |
| 2488 | error = prepend(buffer, buflen, "/", 1); | 2485 | error = prepend(buffer, buflen, "/", 1); |
| 2489 | 2486 | ||
| 2487 | out: | ||
| 2490 | br_read_unlock(vfsmount_lock); | 2488 | br_read_unlock(vfsmount_lock); |
| 2491 | return error; | 2489 | return error; |
| 2492 | 2490 | ||
| @@ -2500,15 +2498,17 @@ global_root: | |||
| 2500 | WARN(1, "Root dentry has weird name <%.*s>\n", | 2498 | WARN(1, "Root dentry has weird name <%.*s>\n", |
| 2501 | (int) dentry->d_name.len, dentry->d_name.name); | 2499 | (int) dentry->d_name.len, dentry->d_name.name); |
| 2502 | } | 2500 | } |
| 2503 | root->mnt = vfsmnt; | 2501 | if (!slash) |
| 2504 | root->dentry = dentry; | 2502 | error = prepend(buffer, buflen, "/", 1); |
| 2503 | if (!error) | ||
| 2504 | error = vfsmnt->mnt_ns ? 1 : 2; | ||
| 2505 | goto out; | 2505 | goto out; |
| 2506 | } | 2506 | } |
| 2507 | 2507 | ||
| 2508 | /** | 2508 | /** |
| 2509 | * __d_path - return the path of a dentry | 2509 | * __d_path - return the path of a dentry |
| 2510 | * @path: the dentry/vfsmount to report | 2510 | * @path: the dentry/vfsmount to report |
| 2511 | * @root: root vfsmnt/dentry (may be modified by this function) | 2511 | * @root: root vfsmnt/dentry |
| 2512 | * @buf: buffer to return value in | 2512 | * @buf: buffer to return value in |
| 2513 | * @buflen: buffer length | 2513 | * @buflen: buffer length |
| 2514 | * | 2514 | * |
| @@ -2519,10 +2519,10 @@ global_root: | |||
| 2519 | * | 2519 | * |
| 2520 | * "buflen" should be positive. | 2520 | * "buflen" should be positive. |
| 2521 | * | 2521 | * |
| 2522 | * If path is not reachable from the supplied root, then the value of | 2522 | * If the path is not reachable from the supplied root, return %NULL. |
| 2523 | * root is changed (without modifying refcounts). | ||
| 2524 | */ | 2523 | */ |
| 2525 | char *__d_path(const struct path *path, struct path *root, | 2524 | char *__d_path(const struct path *path, |
| 2525 | const struct path *root, | ||
| 2526 | char *buf, int buflen) | 2526 | char *buf, int buflen) |
| 2527 | { | 2527 | { |
| 2528 | char *res = buf + buflen; | 2528 | char *res = buf + buflen; |
| @@ -2533,7 +2533,28 @@ char *__d_path(const struct path *path, struct path *root, | |||
| 2533 | error = prepend_path(path, root, &res, &buflen); | 2533 | error = prepend_path(path, root, &res, &buflen); |
| 2534 | write_sequnlock(&rename_lock); | 2534 | write_sequnlock(&rename_lock); |
| 2535 | 2535 | ||
| 2536 | if (error) | 2536 | if (error < 0) |
| 2537 | return ERR_PTR(error); | ||
| 2538 | if (error > 0) | ||
| 2539 | return NULL; | ||
| 2540 | return res; | ||
| 2541 | } | ||
| 2542 | |||
| 2543 | char *d_absolute_path(const struct path *path, | ||
| 2544 | char *buf, int buflen) | ||
| 2545 | { | ||
| 2546 | struct path root = {}; | ||
| 2547 | char *res = buf + buflen; | ||
| 2548 | int error; | ||
| 2549 | |||
| 2550 | prepend(&res, &buflen, "\0", 1); | ||
| 2551 | write_seqlock(&rename_lock); | ||
| 2552 | error = prepend_path(path, &root, &res, &buflen); | ||
| 2553 | write_sequnlock(&rename_lock); | ||
| 2554 | |||
| 2555 | if (error > 1) | ||
| 2556 | error = -EINVAL; | ||
| 2557 | if (error < 0) | ||
| 2537 | return ERR_PTR(error); | 2558 | return ERR_PTR(error); |
| 2538 | return res; | 2559 | return res; |
| 2539 | } | 2560 | } |
| @@ -2541,8 +2562,9 @@ char *__d_path(const struct path *path, struct path *root, | |||
| 2541 | /* | 2562 | /* |
| 2542 | * same as __d_path but appends "(deleted)" for unlinked files. | 2563 | * same as __d_path but appends "(deleted)" for unlinked files. |
| 2543 | */ | 2564 | */ |
| 2544 | static int path_with_deleted(const struct path *path, struct path *root, | 2565 | static int path_with_deleted(const struct path *path, |
| 2545 | char **buf, int *buflen) | 2566 | const struct path *root, |
| 2567 | char **buf, int *buflen) | ||
| 2546 | { | 2568 | { |
| 2547 | prepend(buf, buflen, "\0", 1); | 2569 | prepend(buf, buflen, "\0", 1); |
| 2548 | if (d_unlinked(path->dentry)) { | 2570 | if (d_unlinked(path->dentry)) { |
| @@ -2579,7 +2601,6 @@ char *d_path(const struct path *path, char *buf, int buflen) | |||
| 2579 | { | 2601 | { |
| 2580 | char *res = buf + buflen; | 2602 | char *res = buf + buflen; |
| 2581 | struct path root; | 2603 | struct path root; |
| 2582 | struct path tmp; | ||
| 2583 | int error; | 2604 | int error; |
| 2584 | 2605 | ||
| 2585 | /* | 2606 | /* |
| @@ -2594,9 +2615,8 @@ char *d_path(const struct path *path, char *buf, int buflen) | |||
| 2594 | 2615 | ||
| 2595 | get_fs_root(current->fs, &root); | 2616 | get_fs_root(current->fs, &root); |
| 2596 | write_seqlock(&rename_lock); | 2617 | write_seqlock(&rename_lock); |
| 2597 | tmp = root; | 2618 | error = path_with_deleted(path, &root, &res, &buflen); |
| 2598 | error = path_with_deleted(path, &tmp, &res, &buflen); | 2619 | if (error < 0) |
| 2599 | if (error) | ||
| 2600 | res = ERR_PTR(error); | 2620 | res = ERR_PTR(error); |
| 2601 | write_sequnlock(&rename_lock); | 2621 | write_sequnlock(&rename_lock); |
| 2602 | path_put(&root); | 2622 | path_put(&root); |
| @@ -2617,7 +2637,6 @@ char *d_path_with_unreachable(const struct path *path, char *buf, int buflen) | |||
| 2617 | { | 2637 | { |
| 2618 | char *res = buf + buflen; | 2638 | char *res = buf + buflen; |
| 2619 | struct path root; | 2639 | struct path root; |
| 2620 | struct path tmp; | ||
| 2621 | int error; | 2640 | int error; |
| 2622 | 2641 | ||
| 2623 | if (path->dentry->d_op && path->dentry->d_op->d_dname) | 2642 | if (path->dentry->d_op && path->dentry->d_op->d_dname) |
| @@ -2625,9 +2644,8 @@ char *d_path_with_unreachable(const struct path *path, char *buf, int buflen) | |||
| 2625 | 2644 | ||
| 2626 | get_fs_root(current->fs, &root); | 2645 | get_fs_root(current->fs, &root); |
| 2627 | write_seqlock(&rename_lock); | 2646 | write_seqlock(&rename_lock); |
| 2628 | tmp = root; | 2647 | error = path_with_deleted(path, &root, &res, &buflen); |
| 2629 | error = path_with_deleted(path, &tmp, &res, &buflen); | 2648 | if (error > 0) |
| 2630 | if (!error && !path_equal(&tmp, &root)) | ||
| 2631 | error = prepend_unreachable(&res, &buflen); | 2649 | error = prepend_unreachable(&res, &buflen); |
| 2632 | write_sequnlock(&rename_lock); | 2650 | write_sequnlock(&rename_lock); |
| 2633 | path_put(&root); | 2651 | path_put(&root); |
| @@ -2758,19 +2776,18 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) | |||
| 2758 | write_seqlock(&rename_lock); | 2776 | write_seqlock(&rename_lock); |
| 2759 | if (!d_unlinked(pwd.dentry)) { | 2777 | if (!d_unlinked(pwd.dentry)) { |
| 2760 | unsigned long len; | 2778 | unsigned long len; |
| 2761 | struct path tmp = root; | ||
| 2762 | char *cwd = page + PAGE_SIZE; | 2779 | char *cwd = page + PAGE_SIZE; |
| 2763 | int buflen = PAGE_SIZE; | 2780 | int buflen = PAGE_SIZE; |
| 2764 | 2781 | ||
| 2765 | prepend(&cwd, &buflen, "\0", 1); | 2782 | prepend(&cwd, &buflen, "\0", 1); |
| 2766 | error = prepend_path(&pwd, &tmp, &cwd, &buflen); | 2783 | error = prepend_path(&pwd, &root, &cwd, &buflen); |
| 2767 | write_sequnlock(&rename_lock); | 2784 | write_sequnlock(&rename_lock); |
| 2768 | 2785 | ||
| 2769 | if (error) | 2786 | if (error < 0) |
| 2770 | goto out; | 2787 | goto out; |
| 2771 | 2788 | ||
| 2772 | /* Unreachable from current root */ | 2789 | /* Unreachable from current root */ |
| 2773 | if (!path_equal(&tmp, &root)) { | 2790 | if (error > 0) { |
| 2774 | error = prepend_unreachable(&cwd, &buflen); | 2791 | error = prepend_unreachable(&cwd, &buflen); |
| 2775 | if (error) | 2792 | if (error) |
| 2776 | goto out; | 2793 | goto out; |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 61fa9e1614af..607b1557d292 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
| @@ -1095,7 +1095,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode, | |||
| 1095 | le32_to_cpu(EXT_FIRST_INDEX(neh)->ei_block), | 1095 | le32_to_cpu(EXT_FIRST_INDEX(neh)->ei_block), |
| 1096 | ext4_idx_pblock(EXT_FIRST_INDEX(neh))); | 1096 | ext4_idx_pblock(EXT_FIRST_INDEX(neh))); |
| 1097 | 1097 | ||
| 1098 | neh->eh_depth = cpu_to_le16(neh->eh_depth + 1); | 1098 | neh->eh_depth = cpu_to_le16(le16_to_cpu(neh->eh_depth) + 1); |
| 1099 | ext4_mark_inode_dirty(handle, inode); | 1099 | ext4_mark_inode_dirty(handle, inode); |
| 1100 | out: | 1100 | out: |
| 1101 | brelse(bh); | 1101 | brelse(bh); |
| @@ -2955,7 +2955,6 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
| 2955 | /* Pre-conditions */ | 2955 | /* Pre-conditions */ |
| 2956 | BUG_ON(!ext4_ext_is_uninitialized(ex)); | 2956 | BUG_ON(!ext4_ext_is_uninitialized(ex)); |
| 2957 | BUG_ON(!in_range(map->m_lblk, ee_block, ee_len)); | 2957 | BUG_ON(!in_range(map->m_lblk, ee_block, ee_len)); |
| 2958 | BUG_ON(map->m_lblk + map->m_len > ee_block + ee_len); | ||
| 2959 | 2958 | ||
| 2960 | /* | 2959 | /* |
| 2961 | * Attempt to transfer newly initialized blocks from the currently | 2960 | * Attempt to transfer newly initialized blocks from the currently |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 848f436df29f..92655fd89657 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -1339,8 +1339,11 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd, | |||
| 1339 | clear_buffer_unwritten(bh); | 1339 | clear_buffer_unwritten(bh); |
| 1340 | } | 1340 | } |
| 1341 | 1341 | ||
| 1342 | /* skip page if block allocation undone */ | 1342 | /* |
| 1343 | if (buffer_delay(bh) || buffer_unwritten(bh)) | 1343 | * skip page if block allocation undone and |
| 1344 | * block is dirty | ||
| 1345 | */ | ||
| 1346 | if (ext4_bh_delay_or_unwritten(NULL, bh)) | ||
| 1344 | skip_page = 1; | 1347 | skip_page = 1; |
| 1345 | bh = bh->b_this_page; | 1348 | bh = bh->b_this_page; |
| 1346 | block_start += bh->b_size; | 1349 | block_start += bh->b_size; |
| @@ -2387,7 +2390,6 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, | |||
| 2387 | pgoff_t index; | 2390 | pgoff_t index; |
| 2388 | struct inode *inode = mapping->host; | 2391 | struct inode *inode = mapping->host; |
| 2389 | handle_t *handle; | 2392 | handle_t *handle; |
| 2390 | loff_t page_len; | ||
| 2391 | 2393 | ||
| 2392 | index = pos >> PAGE_CACHE_SHIFT; | 2394 | index = pos >> PAGE_CACHE_SHIFT; |
| 2393 | 2395 | ||
| @@ -2434,13 +2436,6 @@ retry: | |||
| 2434 | */ | 2436 | */ |
| 2435 | if (pos + len > inode->i_size) | 2437 | if (pos + len > inode->i_size) |
| 2436 | ext4_truncate_failed_write(inode); | 2438 | ext4_truncate_failed_write(inode); |
| 2437 | } else { | ||
| 2438 | page_len = pos & (PAGE_CACHE_SIZE - 1); | ||
| 2439 | if (page_len > 0) { | ||
| 2440 | ret = ext4_discard_partial_page_buffers_no_lock(handle, | ||
| 2441 | inode, page, pos - page_len, page_len, | ||
| 2442 | EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED); | ||
| 2443 | } | ||
| 2444 | } | 2439 | } |
| 2445 | 2440 | ||
| 2446 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) | 2441 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) |
| @@ -2483,7 +2478,6 @@ static int ext4_da_write_end(struct file *file, | |||
| 2483 | loff_t new_i_size; | 2478 | loff_t new_i_size; |
| 2484 | unsigned long start, end; | 2479 | unsigned long start, end; |
| 2485 | int write_mode = (int)(unsigned long)fsdata; | 2480 | int write_mode = (int)(unsigned long)fsdata; |
| 2486 | loff_t page_len; | ||
| 2487 | 2481 | ||
| 2488 | if (write_mode == FALL_BACK_TO_NONDELALLOC) { | 2482 | if (write_mode == FALL_BACK_TO_NONDELALLOC) { |
| 2489 | if (ext4_should_order_data(inode)) { | 2483 | if (ext4_should_order_data(inode)) { |
| @@ -2508,7 +2502,7 @@ static int ext4_da_write_end(struct file *file, | |||
| 2508 | */ | 2502 | */ |
| 2509 | 2503 | ||
| 2510 | new_i_size = pos + copied; | 2504 | new_i_size = pos + copied; |
| 2511 | if (new_i_size > EXT4_I(inode)->i_disksize) { | 2505 | if (copied && new_i_size > EXT4_I(inode)->i_disksize) { |
| 2512 | if (ext4_da_should_update_i_disksize(page, end)) { | 2506 | if (ext4_da_should_update_i_disksize(page, end)) { |
| 2513 | down_write(&EXT4_I(inode)->i_data_sem); | 2507 | down_write(&EXT4_I(inode)->i_data_sem); |
| 2514 | if (new_i_size > EXT4_I(inode)->i_disksize) { | 2508 | if (new_i_size > EXT4_I(inode)->i_disksize) { |
| @@ -2532,16 +2526,6 @@ static int ext4_da_write_end(struct file *file, | |||
| 2532 | } | 2526 | } |
| 2533 | ret2 = generic_write_end(file, mapping, pos, len, copied, | 2527 | ret2 = generic_write_end(file, mapping, pos, len, copied, |
| 2534 | page, fsdata); | 2528 | page, fsdata); |
| 2535 | |||
| 2536 | page_len = PAGE_CACHE_SIZE - | ||
| 2537 | ((pos + copied - 1) & (PAGE_CACHE_SIZE - 1)); | ||
| 2538 | |||
| 2539 | if (page_len > 0) { | ||
| 2540 | ret = ext4_discard_partial_page_buffers_no_lock(handle, | ||
| 2541 | inode, page, pos + copied - 1, page_len, | ||
| 2542 | EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED); | ||
| 2543 | } | ||
| 2544 | |||
| 2545 | copied = ret2; | 2529 | copied = ret2; |
| 2546 | if (ret2 < 0) | 2530 | if (ret2 < 0) |
| 2547 | ret = ret2; | 2531 | ret = ret2; |
| @@ -2781,10 +2765,11 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset, | |||
| 2781 | iocb->private, io_end->inode->i_ino, iocb, offset, | 2765 | iocb->private, io_end->inode->i_ino, iocb, offset, |
| 2782 | size); | 2766 | size); |
| 2783 | 2767 | ||
| 2768 | iocb->private = NULL; | ||
| 2769 | |||
| 2784 | /* if not aio dio with unwritten extents, just free io and return */ | 2770 | /* if not aio dio with unwritten extents, just free io and return */ |
| 2785 | if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { | 2771 | if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { |
| 2786 | ext4_free_io_end(io_end); | 2772 | ext4_free_io_end(io_end); |
| 2787 | iocb->private = NULL; | ||
| 2788 | out: | 2773 | out: |
| 2789 | if (is_async) | 2774 | if (is_async) |
| 2790 | aio_complete(iocb, ret, 0); | 2775 | aio_complete(iocb, ret, 0); |
| @@ -2807,7 +2792,6 @@ out: | |||
| 2807 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); | 2792 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); |
| 2808 | 2793 | ||
| 2809 | /* queue the work to convert unwritten extents to written */ | 2794 | /* queue the work to convert unwritten extents to written */ |
| 2810 | iocb->private = NULL; | ||
| 2811 | queue_work(wq, &io_end->work); | 2795 | queue_work(wq, &io_end->work); |
| 2812 | 2796 | ||
| 2813 | /* XXX: probably should move into the real I/O completion handler */ | 2797 | /* XXX: probably should move into the real I/O completion handler */ |
| @@ -3203,26 +3187,8 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle, | |||
| 3203 | 3187 | ||
| 3204 | iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); | 3188 | iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); |
| 3205 | 3189 | ||
| 3206 | if (!page_has_buffers(page)) { | 3190 | if (!page_has_buffers(page)) |
| 3207 | /* | 3191 | create_empty_buffers(page, blocksize, 0); |
| 3208 | * If the range to be discarded covers a partial block | ||
| 3209 | * we need to get the page buffers. This is because | ||
| 3210 | * partial blocks cannot be released and the page needs | ||
| 3211 | * to be updated with the contents of the block before | ||
| 3212 | * we write the zeros on top of it. | ||
| 3213 | */ | ||
| 3214 | if ((from & (blocksize - 1)) || | ||
| 3215 | ((from + length) & (blocksize - 1))) { | ||
| 3216 | create_empty_buffers(page, blocksize, 0); | ||
| 3217 | } else { | ||
| 3218 | /* | ||
| 3219 | * If there are no partial blocks, | ||
| 3220 | * there is nothing to update, | ||
| 3221 | * so we can return now | ||
| 3222 | */ | ||
| 3223 | return 0; | ||
| 3224 | } | ||
| 3225 | } | ||
| 3226 | 3192 | ||
| 3227 | /* Find the buffer that contains "offset" */ | 3193 | /* Find the buffer that contains "offset" */ |
| 3228 | bh = page_buffers(page); | 3194 | bh = page_buffers(page); |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 7ce1d0b19c94..7e106c810c62 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
| @@ -385,6 +385,18 @@ int ext4_bio_write_page(struct ext4_io_submit *io, | |||
| 385 | 385 | ||
| 386 | block_end = block_start + blocksize; | 386 | block_end = block_start + blocksize; |
| 387 | if (block_start >= len) { | 387 | if (block_start >= len) { |
| 388 | /* | ||
| 389 | * Comments copied from block_write_full_page_endio: | ||
| 390 | * | ||
| 391 | * The page straddles i_size. It must be zeroed out on | ||
| 392 | * each and every writepage invocation because it may | ||
| 393 | * be mmapped. "A file is mapped in multiples of the | ||
| 394 | * page size. For a file that is not a multiple of | ||
| 395 | * the page size, the remaining memory is zeroed when | ||
| 396 | * mapped, and writes to that region are not written | ||
| 397 | * out to the file." | ||
| 398 | */ | ||
| 399 | zero_user_segment(page, block_start, block_end); | ||
| 388 | clear_buffer_dirty(bh); | 400 | clear_buffer_dirty(bh); |
| 389 | set_buffer_uptodate(bh); | 401 | set_buffer_uptodate(bh); |
| 390 | continue; | 402 | continue; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3858767ec672..3e1329e2f826 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -1155,9 +1155,9 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
| 1155 | seq_puts(seq, ",block_validity"); | 1155 | seq_puts(seq, ",block_validity"); |
| 1156 | 1156 | ||
| 1157 | if (!test_opt(sb, INIT_INODE_TABLE)) | 1157 | if (!test_opt(sb, INIT_INODE_TABLE)) |
| 1158 | seq_puts(seq, ",noinit_inode_table"); | 1158 | seq_puts(seq, ",noinit_itable"); |
| 1159 | else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT) | 1159 | else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT) |
| 1160 | seq_printf(seq, ",init_inode_table=%u", | 1160 | seq_printf(seq, ",init_itable=%u", |
| 1161 | (unsigned) sbi->s_li_wait_mult); | 1161 | (unsigned) sbi->s_li_wait_mult); |
| 1162 | 1162 | ||
| 1163 | ext4_show_quota_options(seq, sb); | 1163 | ext4_show_quota_options(seq, sb); |
| @@ -1333,8 +1333,7 @@ enum { | |||
| 1333 | Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity, | 1333 | Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity, |
| 1334 | Opt_inode_readahead_blks, Opt_journal_ioprio, | 1334 | Opt_inode_readahead_blks, Opt_journal_ioprio, |
| 1335 | Opt_dioread_nolock, Opt_dioread_lock, | 1335 | Opt_dioread_nolock, Opt_dioread_lock, |
| 1336 | Opt_discard, Opt_nodiscard, | 1336 | Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable, |
| 1337 | Opt_init_inode_table, Opt_noinit_inode_table, | ||
| 1338 | }; | 1337 | }; |
| 1339 | 1338 | ||
| 1340 | static const match_table_t tokens = { | 1339 | static const match_table_t tokens = { |
| @@ -1407,9 +1406,9 @@ static const match_table_t tokens = { | |||
| 1407 | {Opt_dioread_lock, "dioread_lock"}, | 1406 | {Opt_dioread_lock, "dioread_lock"}, |
| 1408 | {Opt_discard, "discard"}, | 1407 | {Opt_discard, "discard"}, |
| 1409 | {Opt_nodiscard, "nodiscard"}, | 1408 | {Opt_nodiscard, "nodiscard"}, |
| 1410 | {Opt_init_inode_table, "init_itable=%u"}, | 1409 | {Opt_init_itable, "init_itable=%u"}, |
| 1411 | {Opt_init_inode_table, "init_itable"}, | 1410 | {Opt_init_itable, "init_itable"}, |
| 1412 | {Opt_noinit_inode_table, "noinit_itable"}, | 1411 | {Opt_noinit_itable, "noinit_itable"}, |
| 1413 | {Opt_err, NULL}, | 1412 | {Opt_err, NULL}, |
| 1414 | }; | 1413 | }; |
| 1415 | 1414 | ||
| @@ -1892,7 +1891,7 @@ set_qf_format: | |||
| 1892 | case Opt_dioread_lock: | 1891 | case Opt_dioread_lock: |
| 1893 | clear_opt(sb, DIOREAD_NOLOCK); | 1892 | clear_opt(sb, DIOREAD_NOLOCK); |
| 1894 | break; | 1893 | break; |
| 1895 | case Opt_init_inode_table: | 1894 | case Opt_init_itable: |
| 1896 | set_opt(sb, INIT_INODE_TABLE); | 1895 | set_opt(sb, INIT_INODE_TABLE); |
| 1897 | if (args[0].from) { | 1896 | if (args[0].from) { |
| 1898 | if (match_int(&args[0], &option)) | 1897 | if (match_int(&args[0], &option)) |
| @@ -1903,7 +1902,7 @@ set_qf_format: | |||
| 1903 | return 0; | 1902 | return 0; |
| 1904 | sbi->s_li_wait_mult = option; | 1903 | sbi->s_li_wait_mult = option; |
| 1905 | break; | 1904 | break; |
| 1906 | case Opt_noinit_inode_table: | 1905 | case Opt_noinit_itable: |
| 1907 | clear_opt(sb, INIT_INODE_TABLE); | 1906 | clear_opt(sb, INIT_INODE_TABLE); |
| 1908 | break; | 1907 | break; |
| 1909 | default: | 1908 | default: |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 73c3992b2bb4..517f211a3bd4 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -47,17 +47,6 @@ struct wb_writeback_work { | |||
| 47 | struct completion *done; /* set if the caller waits */ | 47 | struct completion *done; /* set if the caller waits */ |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | const char *wb_reason_name[] = { | ||
| 51 | [WB_REASON_BACKGROUND] = "background", | ||
| 52 | [WB_REASON_TRY_TO_FREE_PAGES] = "try_to_free_pages", | ||
| 53 | [WB_REASON_SYNC] = "sync", | ||
| 54 | [WB_REASON_PERIODIC] = "periodic", | ||
| 55 | [WB_REASON_LAPTOP_TIMER] = "laptop_timer", | ||
| 56 | [WB_REASON_FREE_MORE_MEM] = "free_more_memory", | ||
| 57 | [WB_REASON_FS_FREE_SPACE] = "fs_free_space", | ||
| 58 | [WB_REASON_FORKER_THREAD] = "forker_thread" | ||
| 59 | }; | ||
| 60 | |||
| 61 | /* | 50 | /* |
| 62 | * Include the creation of the trace points after defining the | 51 | * Include the creation of the trace points after defining the |
| 63 | * wb_writeback_work structure so that the definition remains local to this | 52 | * wb_writeback_work structure so that the definition remains local to this |
| @@ -156,6 +145,7 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, | |||
| 156 | * bdi_start_writeback - start writeback | 145 | * bdi_start_writeback - start writeback |
| 157 | * @bdi: the backing device to write from | 146 | * @bdi: the backing device to write from |
| 158 | * @nr_pages: the number of pages to write | 147 | * @nr_pages: the number of pages to write |
| 148 | * @reason: reason why some writeback work was initiated | ||
| 159 | * | 149 | * |
| 160 | * Description: | 150 | * Description: |
| 161 | * This does WB_SYNC_NONE opportunistic writeback. The IO is only | 151 | * This does WB_SYNC_NONE opportunistic writeback. The IO is only |
| @@ -1223,6 +1213,7 @@ static void wait_sb_inodes(struct super_block *sb) | |||
| 1223 | * writeback_inodes_sb_nr - writeback dirty inodes from given super_block | 1213 | * writeback_inodes_sb_nr - writeback dirty inodes from given super_block |
| 1224 | * @sb: the superblock | 1214 | * @sb: the superblock |
| 1225 | * @nr: the number of pages to write | 1215 | * @nr: the number of pages to write |
| 1216 | * @reason: reason why some writeback work initiated | ||
| 1226 | * | 1217 | * |
| 1227 | * Start writeback on some inodes on this super_block. No guarantees are made | 1218 | * Start writeback on some inodes on this super_block. No guarantees are made |
| 1228 | * on how many (if any) will be written, and this function does not wait | 1219 | * on how many (if any) will be written, and this function does not wait |
| @@ -1251,6 +1242,7 @@ EXPORT_SYMBOL(writeback_inodes_sb_nr); | |||
| 1251 | /** | 1242 | /** |
| 1252 | * writeback_inodes_sb - writeback dirty inodes from given super_block | 1243 | * writeback_inodes_sb - writeback dirty inodes from given super_block |
| 1253 | * @sb: the superblock | 1244 | * @sb: the superblock |
| 1245 | * @reason: reason why some writeback work was initiated | ||
| 1254 | * | 1246 | * |
| 1255 | * Start writeback on some inodes on this super_block. No guarantees are made | 1247 | * Start writeback on some inodes on this super_block. No guarantees are made |
| 1256 | * on how many (if any) will be written, and this function does not wait | 1248 | * on how many (if any) will be written, and this function does not wait |
| @@ -1265,6 +1257,7 @@ EXPORT_SYMBOL(writeback_inodes_sb); | |||
| 1265 | /** | 1257 | /** |
| 1266 | * writeback_inodes_sb_if_idle - start writeback if none underway | 1258 | * writeback_inodes_sb_if_idle - start writeback if none underway |
| 1267 | * @sb: the superblock | 1259 | * @sb: the superblock |
| 1260 | * @reason: reason why some writeback work was initiated | ||
| 1268 | * | 1261 | * |
| 1269 | * Invoke writeback_inodes_sb if no writeback is currently underway. | 1262 | * Invoke writeback_inodes_sb if no writeback is currently underway. |
| 1270 | * Returns 1 if writeback was started, 0 if not. | 1263 | * Returns 1 if writeback was started, 0 if not. |
| @@ -1285,6 +1278,7 @@ EXPORT_SYMBOL(writeback_inodes_sb_if_idle); | |||
| 1285 | * writeback_inodes_sb_if_idle - start writeback if none underway | 1278 | * writeback_inodes_sb_if_idle - start writeback if none underway |
| 1286 | * @sb: the superblock | 1279 | * @sb: the superblock |
| 1287 | * @nr: the number of pages to write | 1280 | * @nr: the number of pages to write |
| 1281 | * @reason: reason why some writeback work was initiated | ||
| 1288 | * | 1282 | * |
| 1289 | * Invoke writeback_inodes_sb if no writeback is currently underway. | 1283 | * Invoke writeback_inodes_sb if no writeback is currently underway. |
| 1290 | * Returns 1 if writeback was started, 0 if not. | 1284 | * Returns 1 if writeback was started, 0 if not. |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 5cb8614508c3..2aaf3eaaf13d 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
| @@ -1512,7 +1512,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, | |||
| 1512 | else if (outarg->offset + num > file_size) | 1512 | else if (outarg->offset + num > file_size) |
| 1513 | num = file_size - outarg->offset; | 1513 | num = file_size - outarg->offset; |
| 1514 | 1514 | ||
| 1515 | while (num) { | 1515 | while (num && req->num_pages < FUSE_MAX_PAGES_PER_REQ) { |
| 1516 | struct page *page; | 1516 | struct page *page; |
| 1517 | unsigned int this_num; | 1517 | unsigned int this_num; |
| 1518 | 1518 | ||
| @@ -1526,6 +1526,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, | |||
| 1526 | 1526 | ||
| 1527 | num -= this_num; | 1527 | num -= this_num; |
| 1528 | total_len += this_num; | 1528 | total_len += this_num; |
| 1529 | index++; | ||
| 1529 | } | 1530 | } |
| 1530 | req->misc.retrieve_in.offset = outarg->offset; | 1531 | req->misc.retrieve_in.offset = outarg->offset; |
| 1531 | req->misc.retrieve_in.size = total_len; | 1532 | req->misc.retrieve_in.size = total_len; |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 594f07a81c28..0c84100acd44 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
| @@ -1556,7 +1556,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) | |||
| 1556 | struct inode *inode = file->f_path.dentry->d_inode; | 1556 | struct inode *inode = file->f_path.dentry->d_inode; |
| 1557 | 1557 | ||
| 1558 | mutex_lock(&inode->i_mutex); | 1558 | mutex_lock(&inode->i_mutex); |
| 1559 | if (origin != SEEK_CUR || origin != SEEK_SET) { | 1559 | if (origin != SEEK_CUR && origin != SEEK_SET) { |
| 1560 | retval = fuse_update_attributes(inode, NULL, file, NULL); | 1560 | retval = fuse_update_attributes(inode, NULL, file, NULL); |
| 1561 | if (retval) | 1561 | if (retval) |
| 1562 | goto exit; | 1562 | goto exit; |
| @@ -1567,6 +1567,10 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) | |||
| 1567 | offset += i_size_read(inode); | 1567 | offset += i_size_read(inode); |
| 1568 | break; | 1568 | break; |
| 1569 | case SEEK_CUR: | 1569 | case SEEK_CUR: |
| 1570 | if (offset == 0) { | ||
| 1571 | retval = file->f_pos; | ||
| 1572 | goto exit; | ||
| 1573 | } | ||
| 1570 | offset += file->f_pos; | 1574 | offset += file->f_pos; |
| 1571 | break; | 1575 | break; |
| 1572 | case SEEK_DATA: | 1576 | case SEEK_DATA: |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 3e6d72756479..aa83109b9431 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
| @@ -1138,28 +1138,28 @@ static int __init fuse_fs_init(void) | |||
| 1138 | { | 1138 | { |
| 1139 | int err; | 1139 | int err; |
| 1140 | 1140 | ||
| 1141 | err = register_filesystem(&fuse_fs_type); | ||
| 1142 | if (err) | ||
| 1143 | goto out; | ||
| 1144 | |||
| 1145 | err = register_fuseblk(); | ||
| 1146 | if (err) | ||
| 1147 | goto out_unreg; | ||
| 1148 | |||
| 1149 | fuse_inode_cachep = kmem_cache_create("fuse_inode", | 1141 | fuse_inode_cachep = kmem_cache_create("fuse_inode", |
| 1150 | sizeof(struct fuse_inode), | 1142 | sizeof(struct fuse_inode), |
| 1151 | 0, SLAB_HWCACHE_ALIGN, | 1143 | 0, SLAB_HWCACHE_ALIGN, |
| 1152 | fuse_inode_init_once); | 1144 | fuse_inode_init_once); |
| 1153 | err = -ENOMEM; | 1145 | err = -ENOMEM; |
| 1154 | if (!fuse_inode_cachep) | 1146 | if (!fuse_inode_cachep) |
| 1155 | goto out_unreg2; | 1147 | goto out; |
| 1148 | |||
| 1149 | err = register_fuseblk(); | ||
| 1150 | if (err) | ||
| 1151 | goto out2; | ||
| 1152 | |||
| 1153 | err = register_filesystem(&fuse_fs_type); | ||
| 1154 | if (err) | ||
| 1155 | goto out3; | ||
| 1156 | 1156 | ||
| 1157 | return 0; | 1157 | return 0; |
| 1158 | 1158 | ||
| 1159 | out_unreg2: | 1159 | out3: |
| 1160 | unregister_fuseblk(); | 1160 | unregister_fuseblk(); |
| 1161 | out_unreg: | 1161 | out2: |
| 1162 | unregister_filesystem(&fuse_fs_type); | 1162 | kmem_cache_destroy(fuse_inode_cachep); |
| 1163 | out: | 1163 | out: |
| 1164 | return err; | 1164 | return err; |
| 1165 | } | 1165 | } |
diff --git a/fs/namespace.c b/fs/namespace.c index 6d3a1963879b..cfc6d4448aa5 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
| @@ -1048,15 +1048,12 @@ static int show_mountinfo(struct seq_file *m, void *v) | |||
| 1048 | if (err) | 1048 | if (err) |
| 1049 | goto out; | 1049 | goto out; |
| 1050 | seq_putc(m, ' '); | 1050 | seq_putc(m, ' '); |
| 1051 | seq_path_root(m, &mnt_path, &root, " \t\n\\"); | 1051 | |
| 1052 | if (root.mnt != p->root.mnt || root.dentry != p->root.dentry) { | 1052 | /* mountpoints outside of chroot jail will give SEQ_SKIP on this */ |
| 1053 | /* | 1053 | err = seq_path_root(m, &mnt_path, &root, " \t\n\\"); |
| 1054 | * Mountpoint is outside root, discard that one. Ugly, | 1054 | if (err) |
| 1055 | * but less so than trying to do that in iterator in a | 1055 | goto out; |
| 1056 | * race-free way (due to renames). | 1056 | |
| 1057 | */ | ||
| 1058 | return SEQ_SKIP; | ||
| 1059 | } | ||
| 1060 | seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw"); | 1057 | seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw"); |
| 1061 | show_mnt_opts(m, mnt); | 1058 | show_mnt_opts(m, mnt); |
| 1062 | 1059 | ||
| @@ -2776,3 +2773,8 @@ void kern_unmount(struct vfsmount *mnt) | |||
| 2776 | } | 2773 | } |
| 2777 | } | 2774 | } |
| 2778 | EXPORT_SYMBOL(kern_unmount); | 2775 | EXPORT_SYMBOL(kern_unmount); |
| 2776 | |||
| 2777 | bool our_mnt(struct vfsmount *mnt) | ||
| 2778 | { | ||
| 2779 | return check_mnt(mnt); | ||
| 2780 | } | ||
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index 5b5fa33b6b9d..cbd1a61c110a 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
| @@ -548,7 +548,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
| 548 | 548 | ||
| 549 | error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY); | 549 | error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY); |
| 550 | if (error) | 550 | if (error) |
| 551 | goto out_bdi; | 551 | goto out_fput; |
| 552 | 552 | ||
| 553 | server->ncp_filp = ncp_filp; | 553 | server->ncp_filp = ncp_filp; |
| 554 | server->ncp_sock = sock; | 554 | server->ncp_sock = sock; |
| @@ -559,7 +559,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
| 559 | error = -EBADF; | 559 | error = -EBADF; |
| 560 | server->info_filp = fget(data.info_fd); | 560 | server->info_filp = fget(data.info_fd); |
| 561 | if (!server->info_filp) | 561 | if (!server->info_filp) |
| 562 | goto out_fput; | 562 | goto out_bdi; |
| 563 | error = -ENOTSOCK; | 563 | error = -ENOTSOCK; |
| 564 | sock_inode = server->info_filp->f_path.dentry->d_inode; | 564 | sock_inode = server->info_filp->f_path.dentry->d_inode; |
| 565 | if (!S_ISSOCK(sock_inode->i_mode)) | 565 | if (!S_ISSOCK(sock_inode->i_mode)) |
| @@ -746,9 +746,9 @@ out_nls: | |||
| 746 | out_fput2: | 746 | out_fput2: |
| 747 | if (server->info_filp) | 747 | if (server->info_filp) |
| 748 | fput(server->info_filp); | 748 | fput(server->info_filp); |
| 749 | out_fput: | ||
| 750 | bdi_destroy(&server->bdi); | ||
| 751 | out_bdi: | 749 | out_bdi: |
| 750 | bdi_destroy(&server->bdi); | ||
| 751 | out_fput: | ||
| 752 | /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: | 752 | /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: |
| 753 | * | 753 | * |
| 754 | * The previously used put_filp(ncp_filp); was bogus, since | 754 | * The previously used put_filp(ncp_filp); was bogus, since |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index eca56d4b39c0..606ef0f20aed 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
| @@ -147,7 +147,7 @@ static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin) | |||
| 147 | * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate | 147 | * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate |
| 148 | * the cached file length | 148 | * the cached file length |
| 149 | */ | 149 | */ |
| 150 | if (origin != SEEK_SET || origin != SEEK_CUR) { | 150 | if (origin != SEEK_SET && origin != SEEK_CUR) { |
| 151 | struct inode *inode = filp->f_mapping->host; | 151 | struct inode *inode = filp->f_mapping->host; |
| 152 | 152 | ||
| 153 | int retval = nfs_revalidate_file_size(inode, filp); | 153 | int retval = nfs_revalidate_file_size(inode, filp); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index be2bbac13817..d9f4d78c3413 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -39,6 +39,8 @@ | |||
| 39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
| 40 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
| 41 | #include <linux/string.h> | 41 | #include <linux/string.h> |
| 42 | #include <linux/ratelimit.h> | ||
| 43 | #include <linux/printk.h> | ||
| 42 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
| 43 | #include <linux/sunrpc/clnt.h> | 45 | #include <linux/sunrpc/clnt.h> |
| 44 | #include <linux/sunrpc/gss_api.h> | 46 | #include <linux/sunrpc/gss_api.h> |
| @@ -894,6 +896,8 @@ out: | |||
| 894 | 896 | ||
| 895 | static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode) | 897 | static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode) |
| 896 | { | 898 | { |
| 899 | if (delegation == NULL) | ||
| 900 | return 0; | ||
| 897 | if ((delegation->type & fmode) != fmode) | 901 | if ((delegation->type & fmode) != fmode) |
| 898 | return 0; | 902 | return 0; |
| 899 | if (test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags)) | 903 | if (test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags)) |
| @@ -1036,8 +1040,7 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata) | |||
| 1036 | } | 1040 | } |
| 1037 | rcu_read_lock(); | 1041 | rcu_read_lock(); |
| 1038 | delegation = rcu_dereference(nfsi->delegation); | 1042 | delegation = rcu_dereference(nfsi->delegation); |
| 1039 | if (delegation == NULL || | 1043 | if (!can_open_delegated(delegation, fmode)) { |
| 1040 | !can_open_delegated(delegation, fmode)) { | ||
| 1041 | rcu_read_unlock(); | 1044 | rcu_read_unlock(); |
| 1042 | break; | 1045 | break; |
| 1043 | } | 1046 | } |
| @@ -1091,7 +1094,12 @@ static struct nfs4_state *nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data | |||
| 1091 | if (delegation) | 1094 | if (delegation) |
| 1092 | delegation_flags = delegation->flags; | 1095 | delegation_flags = delegation->flags; |
| 1093 | rcu_read_unlock(); | 1096 | rcu_read_unlock(); |
| 1094 | if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0) | 1097 | if (data->o_arg.claim == NFS4_OPEN_CLAIM_DELEGATE_CUR) { |
| 1098 | pr_err_ratelimited("NFS: Broken NFSv4 server %s is " | ||
| 1099 | "returning a delegation for " | ||
| 1100 | "OPEN(CLAIM_DELEGATE_CUR)\n", | ||
| 1101 | NFS_CLIENT(inode)->cl_server); | ||
| 1102 | } else if ((delegation_flags & 1UL<<NFS_DELEGATION_NEED_RECLAIM) == 0) | ||
| 1095 | nfs_inode_set_delegation(state->inode, | 1103 | nfs_inode_set_delegation(state->inode, |
| 1096 | data->owner->so_cred, | 1104 | data->owner->so_cred, |
| 1097 | &data->o_res); | 1105 | &data->o_res); |
| @@ -1423,11 +1431,9 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) | |||
| 1423 | goto out_no_action; | 1431 | goto out_no_action; |
| 1424 | rcu_read_lock(); | 1432 | rcu_read_lock(); |
| 1425 | delegation = rcu_dereference(NFS_I(data->state->inode)->delegation); | 1433 | delegation = rcu_dereference(NFS_I(data->state->inode)->delegation); |
| 1426 | if (delegation != NULL && | 1434 | if (data->o_arg.claim != NFS4_OPEN_CLAIM_DELEGATE_CUR && |
| 1427 | test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags) == 0) { | 1435 | can_open_delegated(delegation, data->o_arg.fmode)) |
| 1428 | rcu_read_unlock(); | 1436 | goto unlock_no_action; |
| 1429 | goto out_no_action; | ||
| 1430 | } | ||
| 1431 | rcu_read_unlock(); | 1437 | rcu_read_unlock(); |
| 1432 | } | 1438 | } |
| 1433 | /* Update sequence id. */ | 1439 | /* Update sequence id. */ |
| @@ -1444,6 +1450,8 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) | |||
| 1444 | return; | 1450 | return; |
| 1445 | rpc_call_start(task); | 1451 | rpc_call_start(task); |
| 1446 | return; | 1452 | return; |
| 1453 | unlock_no_action: | ||
| 1454 | rcu_read_unlock(); | ||
| 1447 | out_no_action: | 1455 | out_no_action: |
| 1448 | task->tk_action = NULL; | 1456 | task->tk_action = NULL; |
| 1449 | 1457 | ||
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 39914be40b03..6a7107ae6b72 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
| @@ -1156,11 +1156,13 @@ restart: | |||
| 1156 | if (status >= 0) { | 1156 | if (status >= 0) { |
| 1157 | status = nfs4_reclaim_locks(state, ops); | 1157 | status = nfs4_reclaim_locks(state, ops); |
| 1158 | if (status >= 0) { | 1158 | if (status >= 0) { |
| 1159 | spin_lock(&state->state_lock); | ||
| 1159 | list_for_each_entry(lock, &state->lock_states, ls_locks) { | 1160 | list_for_each_entry(lock, &state->lock_states, ls_locks) { |
| 1160 | if (!(lock->ls_flags & NFS_LOCK_INITIALIZED)) | 1161 | if (!(lock->ls_flags & NFS_LOCK_INITIALIZED)) |
| 1161 | printk("%s: Lock reclaim failed!\n", | 1162 | printk("%s: Lock reclaim failed!\n", |
| 1162 | __func__); | 1163 | __func__); |
| 1163 | } | 1164 | } |
| 1165 | spin_unlock(&state->state_lock); | ||
| 1164 | nfs4_put_open_state(state); | 1166 | nfs4_put_open_state(state); |
| 1165 | goto restart; | 1167 | goto restart; |
| 1166 | } | 1168 | } |
| @@ -1224,10 +1226,12 @@ static void nfs4_clear_open_state(struct nfs4_state *state) | |||
| 1224 | clear_bit(NFS_O_RDONLY_STATE, &state->flags); | 1226 | clear_bit(NFS_O_RDONLY_STATE, &state->flags); |
| 1225 | clear_bit(NFS_O_WRONLY_STATE, &state->flags); | 1227 | clear_bit(NFS_O_WRONLY_STATE, &state->flags); |
| 1226 | clear_bit(NFS_O_RDWR_STATE, &state->flags); | 1228 | clear_bit(NFS_O_RDWR_STATE, &state->flags); |
| 1229 | spin_lock(&state->state_lock); | ||
| 1227 | list_for_each_entry(lock, &state->lock_states, ls_locks) { | 1230 | list_for_each_entry(lock, &state->lock_states, ls_locks) { |
| 1228 | lock->ls_seqid.flags = 0; | 1231 | lock->ls_seqid.flags = 0; |
| 1229 | lock->ls_flags &= ~NFS_LOCK_INITIALIZED; | 1232 | lock->ls_flags &= ~NFS_LOCK_INITIALIZED; |
| 1230 | } | 1233 | } |
| 1234 | spin_unlock(&state->state_lock); | ||
| 1231 | } | 1235 | } |
| 1232 | 1236 | ||
| 1233 | static void nfs4_reset_seqids(struct nfs_server *server, | 1237 | static void nfs4_reset_seqids(struct nfs_server *server, |
| @@ -1350,12 +1354,14 @@ static void nfs4_warn_keyexpired(const char *s) | |||
| 1350 | static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) | 1354 | static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) |
| 1351 | { | 1355 | { |
| 1352 | switch (error) { | 1356 | switch (error) { |
| 1357 | case 0: | ||
| 1358 | break; | ||
| 1353 | case -NFS4ERR_CB_PATH_DOWN: | 1359 | case -NFS4ERR_CB_PATH_DOWN: |
| 1354 | nfs_handle_cb_pathdown(clp); | 1360 | nfs_handle_cb_pathdown(clp); |
| 1355 | return 0; | 1361 | break; |
| 1356 | case -NFS4ERR_NO_GRACE: | 1362 | case -NFS4ERR_NO_GRACE: |
| 1357 | nfs4_state_end_reclaim_reboot(clp); | 1363 | nfs4_state_end_reclaim_reboot(clp); |
| 1358 | return 0; | 1364 | break; |
| 1359 | case -NFS4ERR_STALE_CLIENTID: | 1365 | case -NFS4ERR_STALE_CLIENTID: |
| 1360 | case -NFS4ERR_LEASE_MOVED: | 1366 | case -NFS4ERR_LEASE_MOVED: |
| 1361 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); | 1367 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); |
| @@ -1375,13 +1381,15 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) | |||
| 1375 | case -NFS4ERR_SEQ_MISORDERED: | 1381 | case -NFS4ERR_SEQ_MISORDERED: |
| 1376 | set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); | 1382 | set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); |
| 1377 | /* Zero session reset errors */ | 1383 | /* Zero session reset errors */ |
| 1378 | return 0; | 1384 | break; |
| 1379 | case -EKEYEXPIRED: | 1385 | case -EKEYEXPIRED: |
| 1380 | /* Nothing we can do */ | 1386 | /* Nothing we can do */ |
| 1381 | nfs4_warn_keyexpired(clp->cl_hostname); | 1387 | nfs4_warn_keyexpired(clp->cl_hostname); |
| 1382 | return 0; | 1388 | break; |
| 1389 | default: | ||
| 1390 | return error; | ||
| 1383 | } | 1391 | } |
| 1384 | return error; | 1392 | return 0; |
| 1385 | } | 1393 | } |
| 1386 | 1394 | ||
| 1387 | static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops) | 1395 | static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops) |
| @@ -1428,7 +1436,7 @@ static int nfs4_check_lease(struct nfs_client *clp) | |||
| 1428 | struct rpc_cred *cred; | 1436 | struct rpc_cred *cred; |
| 1429 | const struct nfs4_state_maintenance_ops *ops = | 1437 | const struct nfs4_state_maintenance_ops *ops = |
| 1430 | clp->cl_mvops->state_renewal_ops; | 1438 | clp->cl_mvops->state_renewal_ops; |
| 1431 | int status = -NFS4ERR_EXPIRED; | 1439 | int status; |
| 1432 | 1440 | ||
| 1433 | /* Is the client already known to have an expired lease? */ | 1441 | /* Is the client already known to have an expired lease? */ |
| 1434 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) | 1442 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) |
| @@ -1438,6 +1446,7 @@ static int nfs4_check_lease(struct nfs_client *clp) | |||
| 1438 | spin_unlock(&clp->cl_lock); | 1446 | spin_unlock(&clp->cl_lock); |
| 1439 | if (cred == NULL) { | 1447 | if (cred == NULL) { |
| 1440 | cred = nfs4_get_setclientid_cred(clp); | 1448 | cred = nfs4_get_setclientid_cred(clp); |
| 1449 | status = -ENOKEY; | ||
| 1441 | if (cred == NULL) | 1450 | if (cred == NULL) |
| 1442 | goto out; | 1451 | goto out; |
| 1443 | } | 1452 | } |
| @@ -1525,16 +1534,16 @@ void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags) | |||
| 1525 | { | 1534 | { |
| 1526 | if (!flags) | 1535 | if (!flags) |
| 1527 | return; | 1536 | return; |
| 1528 | else if (flags & SEQ4_STATUS_RESTART_RECLAIM_NEEDED) | 1537 | if (flags & SEQ4_STATUS_RESTART_RECLAIM_NEEDED) |
| 1529 | nfs41_handle_server_reboot(clp); | 1538 | nfs41_handle_server_reboot(clp); |
| 1530 | else if (flags & (SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED | | 1539 | if (flags & (SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED | |
| 1531 | SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED | | 1540 | SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED | |
| 1532 | SEQ4_STATUS_ADMIN_STATE_REVOKED | | 1541 | SEQ4_STATUS_ADMIN_STATE_REVOKED | |
| 1533 | SEQ4_STATUS_LEASE_MOVED)) | 1542 | SEQ4_STATUS_LEASE_MOVED)) |
| 1534 | nfs41_handle_state_revoked(clp); | 1543 | nfs41_handle_state_revoked(clp); |
| 1535 | else if (flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED) | 1544 | if (flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED) |
| 1536 | nfs41_handle_recallable_state_revoked(clp); | 1545 | nfs41_handle_recallable_state_revoked(clp); |
| 1537 | else if (flags & (SEQ4_STATUS_CB_PATH_DOWN | | 1546 | if (flags & (SEQ4_STATUS_CB_PATH_DOWN | |
| 1538 | SEQ4_STATUS_BACKCHANNEL_FAULT | | 1547 | SEQ4_STATUS_BACKCHANNEL_FAULT | |
| 1539 | SEQ4_STATUS_CB_PATH_DOWN_SESSION)) | 1548 | SEQ4_STATUS_CB_PATH_DOWN_SESSION)) |
| 1540 | nfs41_handle_cb_path_down(clp); | 1549 | nfs41_handle_cb_path_down(clp); |
| @@ -1662,10 +1671,10 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
| 1662 | 1671 | ||
| 1663 | if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) { | 1672 | if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) { |
| 1664 | status = nfs4_check_lease(clp); | 1673 | status = nfs4_check_lease(clp); |
| 1674 | if (status < 0) | ||
| 1675 | goto out_error; | ||
| 1665 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) | 1676 | if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) |
| 1666 | continue; | 1677 | continue; |
| 1667 | if (status < 0 && status != -NFS4ERR_CB_PATH_DOWN) | ||
| 1668 | goto out_error; | ||
| 1669 | } | 1678 | } |
| 1670 | 1679 | ||
| 1671 | /* Initialize or reset the session */ | 1680 | /* Initialize or reset the session */ |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 41d6743d303c..ac258beeda3c 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
| @@ -625,6 +625,9 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, | |||
| 625 | if (argv[n].v_nmembs > nsegs * nilfs->ns_blocks_per_segment) | 625 | if (argv[n].v_nmembs > nsegs * nilfs->ns_blocks_per_segment) |
| 626 | goto out_free; | 626 | goto out_free; |
| 627 | 627 | ||
| 628 | if (argv[n].v_nmembs >= UINT_MAX / argv[n].v_size) | ||
| 629 | goto out_free; | ||
| 630 | |||
| 628 | len = argv[n].v_size * argv[n].v_nmembs; | 631 | len = argv[n].v_size * argv[n].v_nmembs; |
| 629 | base = (void __user *)(unsigned long)argv[n].v_base; | 632 | base = (void __user *)(unsigned long)argv[n].v_base; |
| 630 | if (len == 0) { | 633 | if (len == 0) { |
| @@ -842,6 +845,19 @@ long nilfs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 842 | case FS_IOC32_GETVERSION: | 845 | case FS_IOC32_GETVERSION: |
| 843 | cmd = FS_IOC_GETVERSION; | 846 | cmd = FS_IOC_GETVERSION; |
| 844 | break; | 847 | break; |
| 848 | case NILFS_IOCTL_CHANGE_CPMODE: | ||
| 849 | case NILFS_IOCTL_DELETE_CHECKPOINT: | ||
| 850 | case NILFS_IOCTL_GET_CPINFO: | ||
| 851 | case NILFS_IOCTL_GET_CPSTAT: | ||
| 852 | case NILFS_IOCTL_GET_SUINFO: | ||
| 853 | case NILFS_IOCTL_GET_SUSTAT: | ||
| 854 | case NILFS_IOCTL_GET_VINFO: | ||
| 855 | case NILFS_IOCTL_GET_BDESCS: | ||
| 856 | case NILFS_IOCTL_CLEAN_SEGMENTS: | ||
| 857 | case NILFS_IOCTL_SYNC: | ||
| 858 | case NILFS_IOCTL_RESIZE: | ||
| 859 | case NILFS_IOCTL_SET_ALLOC_RANGE: | ||
| 860 | break; | ||
| 845 | default: | 861 | default: |
| 846 | return -ENOIOCTLCMD; | 862 | return -ENOIOCTLCMD; |
| 847 | } | 863 | } |
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index 586174168e2a..80e4645f7990 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c | |||
| @@ -131,12 +131,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
| 131 | K(i.freeswap), | 131 | K(i.freeswap), |
| 132 | K(global_page_state(NR_FILE_DIRTY)), | 132 | K(global_page_state(NR_FILE_DIRTY)), |
| 133 | K(global_page_state(NR_WRITEBACK)), | 133 | K(global_page_state(NR_WRITEBACK)), |
| 134 | K(global_page_state(NR_ANON_PAGES) | ||
| 135 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 134 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| 135 | K(global_page_state(NR_ANON_PAGES) | ||
| 136 | + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * | 136 | + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * |
| 137 | HPAGE_PMD_NR | 137 | HPAGE_PMD_NR), |
| 138 | #else | ||
| 139 | K(global_page_state(NR_ANON_PAGES)), | ||
| 138 | #endif | 140 | #endif |
| 139 | ), | ||
| 140 | K(global_page_state(NR_FILE_MAPPED)), | 141 | K(global_page_state(NR_FILE_MAPPED)), |
| 141 | K(global_page_state(NR_SHMEM)), | 142 | K(global_page_state(NR_SHMEM)), |
| 142 | K(global_page_state(NR_SLAB_RECLAIMABLE) + | 143 | K(global_page_state(NR_SLAB_RECLAIMABLE) + |
diff --git a/fs/proc/root.c b/fs/proc/root.c index 9a8a2b77b874..03102d978180 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
| @@ -91,20 +91,18 @@ static struct file_system_type proc_fs_type = { | |||
| 91 | 91 | ||
| 92 | void __init proc_root_init(void) | 92 | void __init proc_root_init(void) |
| 93 | { | 93 | { |
| 94 | struct vfsmount *mnt; | ||
| 95 | int err; | 94 | int err; |
| 96 | 95 | ||
| 97 | proc_init_inodecache(); | 96 | proc_init_inodecache(); |
| 98 | err = register_filesystem(&proc_fs_type); | 97 | err = register_filesystem(&proc_fs_type); |
| 99 | if (err) | 98 | if (err) |
| 100 | return; | 99 | return; |
| 101 | mnt = kern_mount_data(&proc_fs_type, &init_pid_ns); | 100 | err = pid_ns_prepare_proc(&init_pid_ns); |
| 102 | if (IS_ERR(mnt)) { | 101 | if (err) { |
| 103 | unregister_filesystem(&proc_fs_type); | 102 | unregister_filesystem(&proc_fs_type); |
| 104 | return; | 103 | return; |
| 105 | } | 104 | } |
| 106 | 105 | ||
| 107 | init_pid_ns.proc_mnt = mnt; | ||
| 108 | proc_symlink("mounts", NULL, "self/mounts"); | 106 | proc_symlink("mounts", NULL, "self/mounts"); |
| 109 | 107 | ||
| 110 | proc_net_init(); | 108 | proc_net_init(); |
| @@ -209,5 +207,5 @@ int pid_ns_prepare_proc(struct pid_namespace *ns) | |||
| 209 | 207 | ||
| 210 | void pid_ns_release_proc(struct pid_namespace *ns) | 208 | void pid_ns_release_proc(struct pid_namespace *ns) |
| 211 | { | 209 | { |
| 212 | mntput(ns->proc_mnt); | 210 | kern_unmount(ns->proc_mnt); |
| 213 | } | 211 | } |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 42b274da92c3..2a30d67dd6b8 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
| @@ -32,7 +32,7 @@ static cputime64_t get_idle_time(int cpu) | |||
| 32 | idle = kstat_cpu(cpu).cpustat.idle; | 32 | idle = kstat_cpu(cpu).cpustat.idle; |
| 33 | idle = cputime64_add(idle, arch_idle_time(cpu)); | 33 | idle = cputime64_add(idle, arch_idle_time(cpu)); |
| 34 | } else | 34 | } else |
| 35 | idle = usecs_to_cputime(idle_time); | 35 | idle = nsecs_to_jiffies64(1000 * idle_time); |
| 36 | 36 | ||
| 37 | return idle; | 37 | return idle; |
| 38 | } | 38 | } |
| @@ -46,7 +46,7 @@ static cputime64_t get_iowait_time(int cpu) | |||
| 46 | /* !NO_HZ so we can rely on cpustat.iowait */ | 46 | /* !NO_HZ so we can rely on cpustat.iowait */ |
| 47 | iowait = kstat_cpu(cpu).cpustat.iowait; | 47 | iowait = kstat_cpu(cpu).cpustat.iowait; |
| 48 | else | 48 | else |
| 49 | iowait = usecs_to_cputime(iowait_time); | 49 | iowait = nsecs_to_jiffies64(1000 * iowait_time); |
| 50 | 50 | ||
| 51 | return iowait; | 51 | return iowait; |
| 52 | } | 52 | } |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 05d6b0e78c95..dba43c3ea3af 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
| @@ -449,8 +449,6 @@ EXPORT_SYMBOL(seq_path); | |||
| 449 | 449 | ||
| 450 | /* | 450 | /* |
| 451 | * Same as seq_path, but relative to supplied root. | 451 | * Same as seq_path, but relative to supplied root. |
| 452 | * | ||
| 453 | * root may be changed, see __d_path(). | ||
| 454 | */ | 452 | */ |
| 455 | int seq_path_root(struct seq_file *m, struct path *path, struct path *root, | 453 | int seq_path_root(struct seq_file *m, struct path *path, struct path *root, |
| 456 | char *esc) | 454 | char *esc) |
| @@ -463,6 +461,8 @@ int seq_path_root(struct seq_file *m, struct path *path, struct path *root, | |||
| 463 | char *p; | 461 | char *p; |
| 464 | 462 | ||
| 465 | p = __d_path(path, root, buf, size); | 463 | p = __d_path(path, root, buf, size); |
| 464 | if (!p) | ||
| 465 | return SEQ_SKIP; | ||
| 466 | res = PTR_ERR(p); | 466 | res = PTR_ERR(p); |
| 467 | if (!IS_ERR(p)) { | 467 | if (!IS_ERR(p)) { |
| 468 | char *end = mangle_path(buf, p, esc); | 468 | char *end = mangle_path(buf, p, esc); |
| @@ -474,7 +474,7 @@ int seq_path_root(struct seq_file *m, struct path *path, struct path *root, | |||
| 474 | } | 474 | } |
| 475 | seq_commit(m, res); | 475 | seq_commit(m, res); |
| 476 | 476 | ||
| 477 | return res < 0 ? res : 0; | 477 | return res < 0 && res != -ENAMETOOLONG ? res : 0; |
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | /* | 480 | /* |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 20403dc5d437..ae0e76bb6ebf 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
| @@ -2264,19 +2264,12 @@ static int __init ubifs_init(void) | |||
| 2264 | return -EINVAL; | 2264 | return -EINVAL; |
| 2265 | } | 2265 | } |
| 2266 | 2266 | ||
| 2267 | err = register_filesystem(&ubifs_fs_type); | ||
| 2268 | if (err) { | ||
| 2269 | ubifs_err("cannot register file system, error %d", err); | ||
| 2270 | return err; | ||
| 2271 | } | ||
| 2272 | |||
| 2273 | err = -ENOMEM; | ||
| 2274 | ubifs_inode_slab = kmem_cache_create("ubifs_inode_slab", | 2267 | ubifs_inode_slab = kmem_cache_create("ubifs_inode_slab", |
| 2275 | sizeof(struct ubifs_inode), 0, | 2268 | sizeof(struct ubifs_inode), 0, |
| 2276 | SLAB_MEM_SPREAD | SLAB_RECLAIM_ACCOUNT, | 2269 | SLAB_MEM_SPREAD | SLAB_RECLAIM_ACCOUNT, |
| 2277 | &inode_slab_ctor); | 2270 | &inode_slab_ctor); |
| 2278 | if (!ubifs_inode_slab) | 2271 | if (!ubifs_inode_slab) |
| 2279 | goto out_reg; | 2272 | return -ENOMEM; |
| 2280 | 2273 | ||
| 2281 | register_shrinker(&ubifs_shrinker_info); | 2274 | register_shrinker(&ubifs_shrinker_info); |
| 2282 | 2275 | ||
| @@ -2288,15 +2281,20 @@ static int __init ubifs_init(void) | |||
| 2288 | if (err) | 2281 | if (err) |
| 2289 | goto out_compr; | 2282 | goto out_compr; |
| 2290 | 2283 | ||
| 2284 | err = register_filesystem(&ubifs_fs_type); | ||
| 2285 | if (err) { | ||
| 2286 | ubifs_err("cannot register file system, error %d", err); | ||
| 2287 | goto out_dbg; | ||
| 2288 | } | ||
| 2291 | return 0; | 2289 | return 0; |
| 2292 | 2290 | ||
| 2291 | out_dbg: | ||
| 2292 | dbg_debugfs_exit(); | ||
| 2293 | out_compr: | 2293 | out_compr: |
| 2294 | ubifs_compressors_exit(); | 2294 | ubifs_compressors_exit(); |
| 2295 | out_shrinker: | 2295 | out_shrinker: |
| 2296 | unregister_shrinker(&ubifs_shrinker_info); | 2296 | unregister_shrinker(&ubifs_shrinker_info); |
| 2297 | kmem_cache_destroy(ubifs_inode_slab); | 2297 | kmem_cache_destroy(ubifs_inode_slab); |
| 2298 | out_reg: | ||
| 2299 | unregister_filesystem(&ubifs_fs_type); | ||
| 2300 | return err; | 2298 | return err; |
| 2301 | } | 2299 | } |
| 2302 | /* late_initcall to let compressors initialize first */ | 2300 | /* late_initcall to let compressors initialize first */ |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index c68baeb0974a..d0ab78837057 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
| @@ -2383,6 +2383,8 @@ xfs_bmap_btalloc( | |||
| 2383 | int tryagain; | 2383 | int tryagain; |
| 2384 | int error; | 2384 | int error; |
| 2385 | 2385 | ||
| 2386 | ASSERT(ap->length); | ||
| 2387 | |||
| 2386 | mp = ap->ip->i_mount; | 2388 | mp = ap->ip->i_mount; |
| 2387 | align = ap->userdata ? xfs_get_extsz_hint(ap->ip) : 0; | 2389 | align = ap->userdata ? xfs_get_extsz_hint(ap->ip) : 0; |
| 2388 | if (unlikely(align)) { | 2390 | if (unlikely(align)) { |
| @@ -4629,6 +4631,8 @@ xfs_bmapi_allocate( | |||
| 4629 | int error; | 4631 | int error; |
| 4630 | int rt; | 4632 | int rt; |
| 4631 | 4633 | ||
| 4634 | ASSERT(bma->length > 0); | ||
| 4635 | |||
| 4632 | rt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(bma->ip); | 4636 | rt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(bma->ip); |
| 4633 | 4637 | ||
| 4634 | /* | 4638 | /* |
| @@ -4849,6 +4853,7 @@ xfs_bmapi_write( | |||
| 4849 | ASSERT(*nmap <= XFS_BMAP_MAX_NMAP); | 4853 | ASSERT(*nmap <= XFS_BMAP_MAX_NMAP); |
| 4850 | ASSERT(!(flags & XFS_BMAPI_IGSTATE)); | 4854 | ASSERT(!(flags & XFS_BMAPI_IGSTATE)); |
| 4851 | ASSERT(tp != NULL); | 4855 | ASSERT(tp != NULL); |
| 4856 | ASSERT(len > 0); | ||
| 4852 | 4857 | ||
| 4853 | whichfork = (flags & XFS_BMAPI_ATTRFORK) ? | 4858 | whichfork = (flags & XFS_BMAPI_ATTRFORK) ? |
| 4854 | XFS_ATTR_FORK : XFS_DATA_FORK; | 4859 | XFS_ATTR_FORK : XFS_DATA_FORK; |
| @@ -4918,9 +4923,22 @@ xfs_bmapi_write( | |||
| 4918 | bma.eof = eof; | 4923 | bma.eof = eof; |
| 4919 | bma.conv = !!(flags & XFS_BMAPI_CONVERT); | 4924 | bma.conv = !!(flags & XFS_BMAPI_CONVERT); |
| 4920 | bma.wasdel = wasdelay; | 4925 | bma.wasdel = wasdelay; |
| 4921 | bma.length = len; | ||
| 4922 | bma.offset = bno; | 4926 | bma.offset = bno; |
| 4923 | 4927 | ||
| 4928 | /* | ||
| 4929 | * There's a 32/64 bit type mismatch between the | ||
| 4930 | * allocation length request (which can be 64 bits in | ||
| 4931 | * length) and the bma length request, which is | ||
| 4932 | * xfs_extlen_t and therefore 32 bits. Hence we have to | ||
| 4933 | * check for 32-bit overflows and handle them here. | ||
| 4934 | */ | ||
| 4935 | if (len > (xfs_filblks_t)MAXEXTLEN) | ||
| 4936 | bma.length = MAXEXTLEN; | ||
| 4937 | else | ||
| 4938 | bma.length = len; | ||
| 4939 | |||
| 4940 | ASSERT(len > 0); | ||
| 4941 | ASSERT(bma.length > 0); | ||
| 4924 | error = xfs_bmapi_allocate(&bma, flags); | 4942 | error = xfs_bmapi_allocate(&bma, flags); |
| 4925 | if (error) | 4943 | if (error) |
| 4926 | goto error0; | 4944 | goto error0; |
diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c index da108977b21f..558910f5e3c0 100644 --- a/fs/xfs/xfs_export.c +++ b/fs/xfs/xfs_export.c | |||
| @@ -98,22 +98,22 @@ xfs_fs_encode_fh( | |||
| 98 | switch (fileid_type) { | 98 | switch (fileid_type) { |
| 99 | case FILEID_INO32_GEN_PARENT: | 99 | case FILEID_INO32_GEN_PARENT: |
| 100 | spin_lock(&dentry->d_lock); | 100 | spin_lock(&dentry->d_lock); |
| 101 | fid->i32.parent_ino = dentry->d_parent->d_inode->i_ino; | 101 | fid->i32.parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino; |
| 102 | fid->i32.parent_gen = dentry->d_parent->d_inode->i_generation; | 102 | fid->i32.parent_gen = dentry->d_parent->d_inode->i_generation; |
| 103 | spin_unlock(&dentry->d_lock); | 103 | spin_unlock(&dentry->d_lock); |
| 104 | /*FALLTHRU*/ | 104 | /*FALLTHRU*/ |
| 105 | case FILEID_INO32_GEN: | 105 | case FILEID_INO32_GEN: |
| 106 | fid->i32.ino = inode->i_ino; | 106 | fid->i32.ino = XFS_I(inode)->i_ino; |
| 107 | fid->i32.gen = inode->i_generation; | 107 | fid->i32.gen = inode->i_generation; |
| 108 | break; | 108 | break; |
| 109 | case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG: | 109 | case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG: |
| 110 | spin_lock(&dentry->d_lock); | 110 | spin_lock(&dentry->d_lock); |
| 111 | fid64->parent_ino = dentry->d_parent->d_inode->i_ino; | 111 | fid64->parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino; |
| 112 | fid64->parent_gen = dentry->d_parent->d_inode->i_generation; | 112 | fid64->parent_gen = dentry->d_parent->d_inode->i_generation; |
| 113 | spin_unlock(&dentry->d_lock); | 113 | spin_unlock(&dentry->d_lock); |
| 114 | /*FALLTHRU*/ | 114 | /*FALLTHRU*/ |
| 115 | case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG: | 115 | case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG: |
| 116 | fid64->ino = inode->i_ino; | 116 | fid64->ino = XFS_I(inode)->i_ino; |
| 117 | fid64->gen = inode->i_generation; | 117 | fid64->gen = inode->i_generation; |
| 118 | break; | 118 | break; |
| 119 | } | 119 | } |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index a14cd89fe465..34817adf4b9e 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
| @@ -150,6 +150,117 @@ xlog_grant_add_space( | |||
| 150 | } while (head_val != old); | 150 | } while (head_val != old); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | STATIC bool | ||
| 154 | xlog_reserveq_wake( | ||
| 155 | struct log *log, | ||
| 156 | int *free_bytes) | ||
| 157 | { | ||
| 158 | struct xlog_ticket *tic; | ||
| 159 | int need_bytes; | ||
| 160 | |||
| 161 | list_for_each_entry(tic, &log->l_reserveq, t_queue) { | ||
| 162 | if (tic->t_flags & XLOG_TIC_PERM_RESERV) | ||
| 163 | need_bytes = tic->t_unit_res * tic->t_cnt; | ||
| 164 | else | ||
| 165 | need_bytes = tic->t_unit_res; | ||
| 166 | |||
| 167 | if (*free_bytes < need_bytes) | ||
| 168 | return false; | ||
| 169 | *free_bytes -= need_bytes; | ||
| 170 | |||
| 171 | trace_xfs_log_grant_wake_up(log, tic); | ||
| 172 | wake_up(&tic->t_wait); | ||
| 173 | } | ||
| 174 | |||
| 175 | return true; | ||
| 176 | } | ||
| 177 | |||
| 178 | STATIC bool | ||
| 179 | xlog_writeq_wake( | ||
| 180 | struct log *log, | ||
| 181 | int *free_bytes) | ||
| 182 | { | ||
| 183 | struct xlog_ticket *tic; | ||
| 184 | int need_bytes; | ||
| 185 | |||
| 186 | list_for_each_entry(tic, &log->l_writeq, t_queue) { | ||
| 187 | ASSERT(tic->t_flags & XLOG_TIC_PERM_RESERV); | ||
| 188 | |||
| 189 | need_bytes = tic->t_unit_res; | ||
| 190 | |||
| 191 | if (*free_bytes < need_bytes) | ||
| 192 | return false; | ||
| 193 | *free_bytes -= need_bytes; | ||
| 194 | |||
| 195 | trace_xfs_log_regrant_write_wake_up(log, tic); | ||
| 196 | wake_up(&tic->t_wait); | ||
| 197 | } | ||
| 198 | |||
| 199 | return true; | ||
| 200 | } | ||
| 201 | |||
| 202 | STATIC int | ||
| 203 | xlog_reserveq_wait( | ||
| 204 | struct log *log, | ||
| 205 | struct xlog_ticket *tic, | ||
| 206 | int need_bytes) | ||
| 207 | { | ||
| 208 | list_add_tail(&tic->t_queue, &log->l_reserveq); | ||
| 209 | |||
| 210 | do { | ||
| 211 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
| 212 | goto shutdown; | ||
| 213 | xlog_grant_push_ail(log, need_bytes); | ||
| 214 | |||
| 215 | XFS_STATS_INC(xs_sleep_logspace); | ||
| 216 | trace_xfs_log_grant_sleep(log, tic); | ||
| 217 | |||
| 218 | xlog_wait(&tic->t_wait, &log->l_grant_reserve_lock); | ||
| 219 | trace_xfs_log_grant_wake(log, tic); | ||
| 220 | |||
| 221 | spin_lock(&log->l_grant_reserve_lock); | ||
| 222 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
| 223 | goto shutdown; | ||
| 224 | } while (xlog_space_left(log, &log->l_grant_reserve_head) < need_bytes); | ||
| 225 | |||
| 226 | list_del_init(&tic->t_queue); | ||
| 227 | return 0; | ||
| 228 | shutdown: | ||
| 229 | list_del_init(&tic->t_queue); | ||
| 230 | return XFS_ERROR(EIO); | ||
| 231 | } | ||
| 232 | |||
| 233 | STATIC int | ||
| 234 | xlog_writeq_wait( | ||
| 235 | struct log *log, | ||
| 236 | struct xlog_ticket *tic, | ||
| 237 | int need_bytes) | ||
| 238 | { | ||
| 239 | list_add_tail(&tic->t_queue, &log->l_writeq); | ||
| 240 | |||
| 241 | do { | ||
| 242 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
| 243 | goto shutdown; | ||
| 244 | xlog_grant_push_ail(log, need_bytes); | ||
| 245 | |||
| 246 | XFS_STATS_INC(xs_sleep_logspace); | ||
| 247 | trace_xfs_log_regrant_write_sleep(log, tic); | ||
| 248 | |||
| 249 | xlog_wait(&tic->t_wait, &log->l_grant_write_lock); | ||
| 250 | trace_xfs_log_regrant_write_wake(log, tic); | ||
| 251 | |||
| 252 | spin_lock(&log->l_grant_write_lock); | ||
| 253 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
| 254 | goto shutdown; | ||
| 255 | } while (xlog_space_left(log, &log->l_grant_write_head) < need_bytes); | ||
| 256 | |||
| 257 | list_del_init(&tic->t_queue); | ||
| 258 | return 0; | ||
| 259 | shutdown: | ||
| 260 | list_del_init(&tic->t_queue); | ||
| 261 | return XFS_ERROR(EIO); | ||
| 262 | } | ||
| 263 | |||
| 153 | static void | 264 | static void |
| 154 | xlog_tic_reset_res(xlog_ticket_t *tic) | 265 | xlog_tic_reset_res(xlog_ticket_t *tic) |
| 155 | { | 266 | { |
| @@ -350,8 +461,19 @@ xfs_log_reserve( | |||
| 350 | retval = xlog_grant_log_space(log, internal_ticket); | 461 | retval = xlog_grant_log_space(log, internal_ticket); |
| 351 | } | 462 | } |
| 352 | 463 | ||
| 464 | if (unlikely(retval)) { | ||
| 465 | /* | ||
| 466 | * If we are failing, make sure the ticket doesn't have any | ||
| 467 | * current reservations. We don't want to add this back | ||
| 468 | * when the ticket/ transaction gets cancelled. | ||
| 469 | */ | ||
| 470 | internal_ticket->t_curr_res = 0; | ||
| 471 | /* ungrant will give back unit_res * t_cnt. */ | ||
| 472 | internal_ticket->t_cnt = 0; | ||
| 473 | } | ||
| 474 | |||
| 353 | return retval; | 475 | return retval; |
| 354 | } /* xfs_log_reserve */ | 476 | } |
| 355 | 477 | ||
| 356 | 478 | ||
| 357 | /* | 479 | /* |
| @@ -2481,8 +2603,8 @@ restart: | |||
| 2481 | /* | 2603 | /* |
| 2482 | * Atomically get the log space required for a log ticket. | 2604 | * Atomically get the log space required for a log ticket. |
| 2483 | * | 2605 | * |
| 2484 | * Once a ticket gets put onto the reserveq, it will only return after | 2606 | * Once a ticket gets put onto the reserveq, it will only return after the |
| 2485 | * the needed reservation is satisfied. | 2607 | * needed reservation is satisfied. |
| 2486 | * | 2608 | * |
| 2487 | * This function is structured so that it has a lock free fast path. This is | 2609 | * This function is structured so that it has a lock free fast path. This is |
| 2488 | * necessary because every new transaction reservation will come through this | 2610 | * necessary because every new transaction reservation will come through this |
| @@ -2490,113 +2612,53 @@ restart: | |||
| 2490 | * every pass. | 2612 | * every pass. |
| 2491 | * | 2613 | * |
| 2492 | * As tickets are only ever moved on and off the reserveq under the | 2614 | * As tickets are only ever moved on and off the reserveq under the |
| 2493 | * l_grant_reserve_lock, we only need to take that lock if we are going | 2615 | * l_grant_reserve_lock, we only need to take that lock if we are going to add |
| 2494 | * to add the ticket to the queue and sleep. We can avoid taking the lock if the | 2616 | * the ticket to the queue and sleep. We can avoid taking the lock if the ticket |
| 2495 | * ticket was never added to the reserveq because the t_queue list head will be | 2617 | * was never added to the reserveq because the t_queue list head will be empty |
| 2496 | * empty and we hold the only reference to it so it can safely be checked | 2618 | * and we hold the only reference to it so it can safely be checked unlocked. |
| 2497 | * unlocked. | ||
| 2498 | */ | 2619 | */ |
| 2499 | STATIC int | 2620 | STATIC int |
| 2500 | xlog_grant_log_space(xlog_t *log, | 2621 | xlog_grant_log_space( |
| 2501 | xlog_ticket_t *tic) | 2622 | struct log *log, |
| 2623 | struct xlog_ticket *tic) | ||
| 2502 | { | 2624 | { |
| 2503 | int free_bytes; | 2625 | int free_bytes, need_bytes; |
| 2504 | int need_bytes; | 2626 | int error = 0; |
| 2505 | 2627 | ||
| 2506 | #ifdef DEBUG | 2628 | ASSERT(!(log->l_flags & XLOG_ACTIVE_RECOVERY)); |
| 2507 | if (log->l_flags & XLOG_ACTIVE_RECOVERY) | ||
| 2508 | panic("grant Recovery problem"); | ||
| 2509 | #endif | ||
| 2510 | 2629 | ||
| 2511 | trace_xfs_log_grant_enter(log, tic); | 2630 | trace_xfs_log_grant_enter(log, tic); |
| 2512 | 2631 | ||
| 2632 | /* | ||
| 2633 | * If there are other waiters on the queue then give them a chance at | ||
| 2634 | * logspace before us. Wake up the first waiters, if we do not wake | ||
| 2635 | * up all the waiters then go to sleep waiting for more free space, | ||
| 2636 | * otherwise try to get some space for this transaction. | ||
| 2637 | */ | ||
| 2513 | need_bytes = tic->t_unit_res; | 2638 | need_bytes = tic->t_unit_res; |
| 2514 | if (tic->t_flags & XFS_LOG_PERM_RESERV) | 2639 | if (tic->t_flags & XFS_LOG_PERM_RESERV) |
| 2515 | need_bytes *= tic->t_ocnt; | 2640 | need_bytes *= tic->t_ocnt; |
| 2516 | |||
| 2517 | /* something is already sleeping; insert new transaction at end */ | ||
| 2518 | if (!list_empty_careful(&log->l_reserveq)) { | ||
| 2519 | spin_lock(&log->l_grant_reserve_lock); | ||
| 2520 | /* recheck the queue now we are locked */ | ||
| 2521 | if (list_empty(&log->l_reserveq)) { | ||
| 2522 | spin_unlock(&log->l_grant_reserve_lock); | ||
| 2523 | goto redo; | ||
| 2524 | } | ||
| 2525 | list_add_tail(&tic->t_queue, &log->l_reserveq); | ||
| 2526 | |||
| 2527 | trace_xfs_log_grant_sleep1(log, tic); | ||
| 2528 | |||
| 2529 | /* | ||
| 2530 | * Gotta check this before going to sleep, while we're | ||
| 2531 | * holding the grant lock. | ||
| 2532 | */ | ||
| 2533 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
| 2534 | goto error_return; | ||
| 2535 | |||
| 2536 | XFS_STATS_INC(xs_sleep_logspace); | ||
| 2537 | xlog_wait(&tic->t_wait, &log->l_grant_reserve_lock); | ||
| 2538 | |||
| 2539 | /* | ||
| 2540 | * If we got an error, and the filesystem is shutting down, | ||
| 2541 | * we'll catch it down below. So just continue... | ||
| 2542 | */ | ||
| 2543 | trace_xfs_log_grant_wake1(log, tic); | ||
| 2544 | } | ||
| 2545 | |||
| 2546 | redo: | ||
| 2547 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
| 2548 | goto error_return_unlocked; | ||
| 2549 | |||
| 2550 | free_bytes = xlog_space_left(log, &log->l_grant_reserve_head); | 2641 | free_bytes = xlog_space_left(log, &log->l_grant_reserve_head); |
| 2551 | if (free_bytes < need_bytes) { | 2642 | if (!list_empty_careful(&log->l_reserveq)) { |
| 2552 | spin_lock(&log->l_grant_reserve_lock); | 2643 | spin_lock(&log->l_grant_reserve_lock); |
| 2553 | if (list_empty(&tic->t_queue)) | 2644 | if (!xlog_reserveq_wake(log, &free_bytes) || |
| 2554 | list_add_tail(&tic->t_queue, &log->l_reserveq); | 2645 | free_bytes < need_bytes) |
| 2555 | 2646 | error = xlog_reserveq_wait(log, tic, need_bytes); | |
| 2556 | trace_xfs_log_grant_sleep2(log, tic); | 2647 | spin_unlock(&log->l_grant_reserve_lock); |
| 2557 | 2648 | } else if (free_bytes < need_bytes) { | |
| 2558 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
| 2559 | goto error_return; | ||
| 2560 | |||
| 2561 | xlog_grant_push_ail(log, need_bytes); | ||
| 2562 | |||
| 2563 | XFS_STATS_INC(xs_sleep_logspace); | ||
| 2564 | xlog_wait(&tic->t_wait, &log->l_grant_reserve_lock); | ||
| 2565 | |||
| 2566 | trace_xfs_log_grant_wake2(log, tic); | ||
| 2567 | goto redo; | ||
| 2568 | } | ||
| 2569 | |||
| 2570 | if (!list_empty(&tic->t_queue)) { | ||
| 2571 | spin_lock(&log->l_grant_reserve_lock); | 2649 | spin_lock(&log->l_grant_reserve_lock); |
| 2572 | list_del_init(&tic->t_queue); | 2650 | error = xlog_reserveq_wait(log, tic, need_bytes); |
| 2573 | spin_unlock(&log->l_grant_reserve_lock); | 2651 | spin_unlock(&log->l_grant_reserve_lock); |
| 2574 | } | 2652 | } |
| 2653 | if (error) | ||
| 2654 | return error; | ||
| 2575 | 2655 | ||
| 2576 | /* we've got enough space */ | ||
| 2577 | xlog_grant_add_space(log, &log->l_grant_reserve_head, need_bytes); | 2656 | xlog_grant_add_space(log, &log->l_grant_reserve_head, need_bytes); |
| 2578 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); | 2657 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); |
| 2579 | trace_xfs_log_grant_exit(log, tic); | 2658 | trace_xfs_log_grant_exit(log, tic); |
| 2580 | xlog_verify_grant_tail(log); | 2659 | xlog_verify_grant_tail(log); |
| 2581 | return 0; | 2660 | return 0; |
| 2582 | 2661 | } | |
| 2583 | error_return_unlocked: | ||
| 2584 | spin_lock(&log->l_grant_reserve_lock); | ||
| 2585 | error_return: | ||
| 2586 | list_del_init(&tic->t_queue); | ||
| 2587 | spin_unlock(&log->l_grant_reserve_lock); | ||
| 2588 | trace_xfs_log_grant_error(log, tic); | ||
| 2589 | |||
| 2590 | /* | ||
| 2591 | * If we are failing, make sure the ticket doesn't have any | ||
| 2592 | * current reservations. We don't want to add this back when | ||
| 2593 | * the ticket/transaction gets cancelled. | ||
| 2594 | */ | ||
| 2595 | tic->t_curr_res = 0; | ||
| 2596 | tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */ | ||
| 2597 | return XFS_ERROR(EIO); | ||
| 2598 | } /* xlog_grant_log_space */ | ||
| 2599 | |||
| 2600 | 2662 | ||
| 2601 | /* | 2663 | /* |
| 2602 | * Replenish the byte reservation required by moving the grant write head. | 2664 | * Replenish the byte reservation required by moving the grant write head. |
| @@ -2605,10 +2667,12 @@ error_return: | |||
| 2605 | * free fast path. | 2667 | * free fast path. |
| 2606 | */ | 2668 | */ |
| 2607 | STATIC int | 2669 | STATIC int |
| 2608 | xlog_regrant_write_log_space(xlog_t *log, | 2670 | xlog_regrant_write_log_space( |
| 2609 | xlog_ticket_t *tic) | 2671 | struct log *log, |
| 2672 | struct xlog_ticket *tic) | ||
| 2610 | { | 2673 | { |
| 2611 | int free_bytes, need_bytes; | 2674 | int free_bytes, need_bytes; |
| 2675 | int error = 0; | ||
| 2612 | 2676 | ||
| 2613 | tic->t_curr_res = tic->t_unit_res; | 2677 | tic->t_curr_res = tic->t_unit_res; |
| 2614 | xlog_tic_reset_res(tic); | 2678 | xlog_tic_reset_res(tic); |
| @@ -2616,104 +2680,38 @@ xlog_regrant_write_log_space(xlog_t *log, | |||
| 2616 | if (tic->t_cnt > 0) | 2680 | if (tic->t_cnt > 0) |
| 2617 | return 0; | 2681 | return 0; |
| 2618 | 2682 | ||
| 2619 | #ifdef DEBUG | 2683 | ASSERT(!(log->l_flags & XLOG_ACTIVE_RECOVERY)); |
| 2620 | if (log->l_flags & XLOG_ACTIVE_RECOVERY) | ||
| 2621 | panic("regrant Recovery problem"); | ||
| 2622 | #endif | ||
| 2623 | 2684 | ||
| 2624 | trace_xfs_log_regrant_write_enter(log, tic); | 2685 | trace_xfs_log_regrant_write_enter(log, tic); |
| 2625 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
| 2626 | goto error_return_unlocked; | ||
| 2627 | 2686 | ||
| 2628 | /* If there are other waiters on the queue then give them a | 2687 | /* |
| 2629 | * chance at logspace before us. Wake up the first waiters, | 2688 | * If there are other waiters on the queue then give them a chance at |
| 2630 | * if we do not wake up all the waiters then go to sleep waiting | 2689 | * logspace before us. Wake up the first waiters, if we do not wake |
| 2631 | * for more free space, otherwise try to get some space for | 2690 | * up all the waiters then go to sleep waiting for more free space, |
| 2632 | * this transaction. | 2691 | * otherwise try to get some space for this transaction. |
| 2633 | */ | 2692 | */ |
| 2634 | need_bytes = tic->t_unit_res; | 2693 | need_bytes = tic->t_unit_res; |
| 2635 | if (!list_empty_careful(&log->l_writeq)) { | ||
| 2636 | struct xlog_ticket *ntic; | ||
| 2637 | |||
| 2638 | spin_lock(&log->l_grant_write_lock); | ||
| 2639 | free_bytes = xlog_space_left(log, &log->l_grant_write_head); | ||
| 2640 | list_for_each_entry(ntic, &log->l_writeq, t_queue) { | ||
| 2641 | ASSERT(ntic->t_flags & XLOG_TIC_PERM_RESERV); | ||
| 2642 | |||
| 2643 | if (free_bytes < ntic->t_unit_res) | ||
| 2644 | break; | ||
| 2645 | free_bytes -= ntic->t_unit_res; | ||
| 2646 | wake_up(&ntic->t_wait); | ||
| 2647 | } | ||
| 2648 | |||
| 2649 | if (ntic != list_first_entry(&log->l_writeq, | ||
| 2650 | struct xlog_ticket, t_queue)) { | ||
| 2651 | if (list_empty(&tic->t_queue)) | ||
| 2652 | list_add_tail(&tic->t_queue, &log->l_writeq); | ||
| 2653 | trace_xfs_log_regrant_write_sleep1(log, tic); | ||
| 2654 | |||
| 2655 | xlog_grant_push_ail(log, need_bytes); | ||
| 2656 | |||
| 2657 | XFS_STATS_INC(xs_sleep_logspace); | ||
| 2658 | xlog_wait(&tic->t_wait, &log->l_grant_write_lock); | ||
| 2659 | trace_xfs_log_regrant_write_wake1(log, tic); | ||
| 2660 | } else | ||
| 2661 | spin_unlock(&log->l_grant_write_lock); | ||
| 2662 | } | ||
| 2663 | |||
| 2664 | redo: | ||
| 2665 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
| 2666 | goto error_return_unlocked; | ||
| 2667 | |||
| 2668 | free_bytes = xlog_space_left(log, &log->l_grant_write_head); | 2694 | free_bytes = xlog_space_left(log, &log->l_grant_write_head); |
| 2669 | if (free_bytes < need_bytes) { | 2695 | if (!list_empty_careful(&log->l_writeq)) { |
| 2670 | spin_lock(&log->l_grant_write_lock); | 2696 | spin_lock(&log->l_grant_write_lock); |
| 2671 | if (list_empty(&tic->t_queue)) | 2697 | if (!xlog_writeq_wake(log, &free_bytes) || |
| 2672 | list_add_tail(&tic->t_queue, &log->l_writeq); | 2698 | free_bytes < need_bytes) |
| 2673 | 2699 | error = xlog_writeq_wait(log, tic, need_bytes); | |
| 2674 | if (XLOG_FORCED_SHUTDOWN(log)) | 2700 | spin_unlock(&log->l_grant_write_lock); |
| 2675 | goto error_return; | 2701 | } else if (free_bytes < need_bytes) { |
| 2676 | |||
| 2677 | xlog_grant_push_ail(log, need_bytes); | ||
| 2678 | |||
| 2679 | XFS_STATS_INC(xs_sleep_logspace); | ||
| 2680 | trace_xfs_log_regrant_write_sleep2(log, tic); | ||
| 2681 | xlog_wait(&tic->t_wait, &log->l_grant_write_lock); | ||
| 2682 | |||
| 2683 | trace_xfs_log_regrant_write_wake2(log, tic); | ||
| 2684 | goto redo; | ||
| 2685 | } | ||
| 2686 | |||
| 2687 | if (!list_empty(&tic->t_queue)) { | ||
| 2688 | spin_lock(&log->l_grant_write_lock); | 2702 | spin_lock(&log->l_grant_write_lock); |
| 2689 | list_del_init(&tic->t_queue); | 2703 | error = xlog_writeq_wait(log, tic, need_bytes); |
| 2690 | spin_unlock(&log->l_grant_write_lock); | 2704 | spin_unlock(&log->l_grant_write_lock); |
| 2691 | } | 2705 | } |
| 2692 | 2706 | ||
| 2693 | /* we've got enough space */ | 2707 | if (error) |
| 2708 | return error; | ||
| 2709 | |||
| 2694 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); | 2710 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); |
| 2695 | trace_xfs_log_regrant_write_exit(log, tic); | 2711 | trace_xfs_log_regrant_write_exit(log, tic); |
| 2696 | xlog_verify_grant_tail(log); | 2712 | xlog_verify_grant_tail(log); |
| 2697 | return 0; | 2713 | return 0; |
| 2698 | 2714 | } | |
| 2699 | |||
| 2700 | error_return_unlocked: | ||
| 2701 | spin_lock(&log->l_grant_write_lock); | ||
| 2702 | error_return: | ||
| 2703 | list_del_init(&tic->t_queue); | ||
| 2704 | spin_unlock(&log->l_grant_write_lock); | ||
| 2705 | trace_xfs_log_regrant_write_error(log, tic); | ||
| 2706 | |||
| 2707 | /* | ||
| 2708 | * If we are failing, make sure the ticket doesn't have any | ||
| 2709 | * current reservations. We don't want to add this back when | ||
| 2710 | * the ticket/transaction gets cancelled. | ||
| 2711 | */ | ||
| 2712 | tic->t_curr_res = 0; | ||
| 2713 | tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */ | ||
| 2714 | return XFS_ERROR(EIO); | ||
| 2715 | } /* xlog_regrant_write_log_space */ | ||
| 2716 | |||
| 2717 | 2715 | ||
| 2718 | /* The first cnt-1 times through here we don't need to | 2716 | /* The first cnt-1 times through here we don't need to |
| 2719 | * move the grant write head because the permanent | 2717 | * move the grant write head because the permanent |
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index f1d2802b2f07..494035798873 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h | |||
| @@ -834,18 +834,14 @@ DEFINE_LOGGRANT_EVENT(xfs_log_umount_write); | |||
| 834 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter); | 834 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter); |
| 835 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit); | 835 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit); |
| 836 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_error); | 836 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_error); |
| 837 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep1); | 837 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep); |
| 838 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake1); | 838 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake); |
| 839 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep2); | ||
| 840 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake2); | ||
| 841 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up); | 839 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up); |
| 842 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter); | 840 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter); |
| 843 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit); | 841 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit); |
| 844 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error); | 842 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error); |
| 845 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep1); | 843 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep); |
| 846 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake1); | 844 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake); |
| 847 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep2); | ||
| 848 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake2); | ||
| 849 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake_up); | 845 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake_up); |
| 850 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter); | 846 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter); |
| 851 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit); | 847 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit); |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index f4c38d8c6674..2292d1af9d70 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
| @@ -685,9 +685,15 @@ __SYSCALL(__NR_syncfs, sys_syncfs) | |||
| 685 | __SYSCALL(__NR_setns, sys_setns) | 685 | __SYSCALL(__NR_setns, sys_setns) |
| 686 | #define __NR_sendmmsg 269 | 686 | #define __NR_sendmmsg 269 |
| 687 | __SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg) | 687 | __SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg) |
| 688 | #define __NR_process_vm_readv 270 | ||
| 689 | __SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \ | ||
| 690 | compat_sys_process_vm_readv) | ||
| 691 | #define __NR_process_vm_writev 271 | ||
| 692 | __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ | ||
| 693 | compat_sys_process_vm_writev) | ||
| 688 | 694 | ||
| 689 | #undef __NR_syscalls | 695 | #undef __NR_syscalls |
| 690 | #define __NR_syscalls 270 | 696 | #define __NR_syscalls 272 |
| 691 | 697 | ||
| 692 | /* | 698 | /* |
| 693 | * All syscalls below here should go away really, | 699 | * All syscalls below here should go away really, |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 4e4fbb820e20..14b6cd022284 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -182,8 +182,11 @@ | |||
| 182 | {0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 182 | {0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
| 183 | {0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 183 | {0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
| 184 | {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 184 | {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
| 185 | {0x1002, 0x6751, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 185 | {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 186 | {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
| 186 | {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 187 | {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
| 188 | {0x1002, 0x675B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 189 | {0x1002, 0x675D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 187 | {0x1002, 0x675F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | 190 | {0x1002, 0x675F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ |
| 188 | {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 191 | {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 189 | {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 192 | {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| @@ -195,8 +198,10 @@ | |||
| 195 | {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 198 | {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 196 | {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 199 | {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 197 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 200 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 201 | {0x1002, 0x6772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
| 198 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 202 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 199 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 203 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 204 | {0x1002, 0x677B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | ||
| 200 | {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 205 | {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 201 | {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 206 | {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 202 | {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 207 | {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| @@ -246,6 +251,7 @@ | |||
| 246 | {0x1002, 0x68f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | 251 | {0x1002, 0x68f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ |
| 247 | {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | 252 | {0x1002, 0x68f8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ |
| 248 | {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | 253 | {0x1002, 0x68f9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ |
| 254 | {0x1002, 0x68fa, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | ||
| 249 | {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ | 255 | {0x1002, 0x68fe, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CEDAR|RADEON_NEW_MEMMAP}, \ |
| 250 | {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \ | 256 | {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \ |
| 251 | {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 257 | {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| @@ -488,6 +494,8 @@ | |||
| 488 | {0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ | 494 | {0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ |
| 489 | {0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ | 495 | {0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ |
| 490 | {0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 496 | {0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 497 | {0x1002, 0x964b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 498 | {0x1002, 0x964c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 491 | {0x1002, 0x964e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ | 499 | {0x1002, 0x964e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ |
| 492 | {0x1002, 0x964f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ | 500 | {0x1002, 0x964f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\ |
| 493 | {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 501 | {0x1002, 0x9710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| @@ -502,6 +510,8 @@ | |||
| 502 | {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 510 | {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 503 | {0x1002, 0x9806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 511 | {0x1002, 0x9806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 504 | {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | 512 | {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ |
| 513 | {0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 514 | {0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ | ||
| 505 | {0, 0, 0} | 515 | {0, 0, 0} |
| 506 | 516 | ||
| 507 | #define r128_PCI_IDS \ | 517 | #define r128_PCI_IDS \ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c7a6d3b5bc7b..94acd8172b5b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -805,9 +805,6 @@ extern void blk_unprep_request(struct request *); | |||
| 805 | */ | 805 | */ |
| 806 | extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, | 806 | extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, |
| 807 | spinlock_t *lock, int node_id); | 807 | spinlock_t *lock, int node_id); |
| 808 | extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *, | ||
| 809 | request_fn_proc *, | ||
| 810 | spinlock_t *, int node_id); | ||
| 811 | extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); | 808 | extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); |
| 812 | extern struct request_queue *blk_init_allocated_queue(struct request_queue *, | 809 | extern struct request_queue *blk_init_allocated_queue(struct request_queue *, |
| 813 | request_fn_proc *, spinlock_t *); | 810 | request_fn_proc *, spinlock_t *); |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index c86c940d1de3..081147da0564 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -71,7 +71,7 @@ struct timecounter { | |||
| 71 | 71 | ||
| 72 | /** | 72 | /** |
| 73 | * cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds | 73 | * cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds |
| 74 | * @tc: Pointer to cycle counter. | 74 | * @cc: Pointer to cycle counter. |
| 75 | * @cycles: Cycles | 75 | * @cycles: Cycles |
| 76 | * | 76 | * |
| 77 | * XXX - This could use some mult_lxl_ll() asm optimization. Same code | 77 | * XXX - This could use some mult_lxl_ll() asm optimization. Same code |
| @@ -114,7 +114,7 @@ extern u64 timecounter_read(struct timecounter *tc); | |||
| 114 | * time base as values returned by | 114 | * time base as values returned by |
| 115 | * timecounter_read() | 115 | * timecounter_read() |
| 116 | * @tc: Pointer to time counter. | 116 | * @tc: Pointer to time counter. |
| 117 | * @cycle: a value returned by tc->cc->read() | 117 | * @cycle_tstamp: a value returned by tc->cc->read() |
| 118 | * | 118 | * |
| 119 | * Cycle counts that are converted correctly as long as they | 119 | * Cycle counts that are converted correctly as long as they |
| 120 | * fall into the interval [-1/2 max cycle count, +1/2 max cycle count], | 120 | * fall into the interval [-1/2 max cycle count, +1/2 max cycle count], |
| @@ -156,11 +156,12 @@ extern u64 timecounter_cyc2time(struct timecounter *tc, | |||
| 156 | * @mult: cycle to nanosecond multiplier | 156 | * @mult: cycle to nanosecond multiplier |
| 157 | * @shift: cycle to nanosecond divisor (power of two) | 157 | * @shift: cycle to nanosecond divisor (power of two) |
| 158 | * @max_idle_ns: max idle time permitted by the clocksource (nsecs) | 158 | * @max_idle_ns: max idle time permitted by the clocksource (nsecs) |
| 159 | * @maxadj maximum adjustment value to mult (~11%) | 159 | * @maxadj: maximum adjustment value to mult (~11%) |
| 160 | * @flags: flags describing special properties | 160 | * @flags: flags describing special properties |
| 161 | * @archdata: arch-specific data | 161 | * @archdata: arch-specific data |
| 162 | * @suspend: suspend function for the clocksource, if necessary | 162 | * @suspend: suspend function for the clocksource, if necessary |
| 163 | * @resume: resume function for the clocksource, if necessary | 163 | * @resume: resume function for the clocksource, if necessary |
| 164 | * @cycle_last: most recent cycle counter value seen by ::read() | ||
| 164 | */ | 165 | */ |
| 165 | struct clocksource { | 166 | struct clocksource { |
| 166 | /* | 167 | /* |
| @@ -187,6 +188,7 @@ struct clocksource { | |||
| 187 | void (*suspend)(struct clocksource *cs); | 188 | void (*suspend)(struct clocksource *cs); |
| 188 | void (*resume)(struct clocksource *cs); | 189 | void (*resume)(struct clocksource *cs); |
| 189 | 190 | ||
| 191 | /* private: */ | ||
| 190 | #ifdef CONFIG_CLOCKSOURCE_WATCHDOG | 192 | #ifdef CONFIG_CLOCKSOURCE_WATCHDOG |
| 191 | /* Watchdog related data, used by the framework */ | 193 | /* Watchdog related data, used by the framework */ |
| 192 | struct list_head wd_list; | 194 | struct list_head wd_list; |
| @@ -261,6 +263,9 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant) | |||
| 261 | 263 | ||
| 262 | /** | 264 | /** |
| 263 | * clocksource_cyc2ns - converts clocksource cycles to nanoseconds | 265 | * clocksource_cyc2ns - converts clocksource cycles to nanoseconds |
| 266 | * @cycles: cycles | ||
| 267 | * @mult: cycle to nanosecond multiplier | ||
| 268 | * @shift: cycle to nanosecond divisor (power of two) | ||
| 264 | * | 269 | * |
| 265 | * Converts cycles to nanoseconds, using the given mult and shift. | 270 | * Converts cycles to nanoseconds, using the given mult and shift. |
| 266 | * | 271 | * |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 154bf5683015..66ed067fb729 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
| @@ -552,5 +552,14 @@ extern ssize_t compat_rw_copy_check_uvector(int type, | |||
| 552 | 552 | ||
| 553 | extern void __user *compat_alloc_user_space(unsigned long len); | 553 | extern void __user *compat_alloc_user_space(unsigned long len); |
| 554 | 554 | ||
| 555 | asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid, | ||
| 556 | const struct compat_iovec __user *lvec, | ||
| 557 | unsigned long liovcnt, const struct compat_iovec __user *rvec, | ||
| 558 | unsigned long riovcnt, unsigned long flags); | ||
| 559 | asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid, | ||
| 560 | const struct compat_iovec __user *lvec, | ||
| 561 | unsigned long liovcnt, const struct compat_iovec __user *rvec, | ||
| 562 | unsigned long riovcnt, unsigned long flags); | ||
| 563 | |||
| 555 | #endif /* CONFIG_COMPAT */ | 564 | #endif /* CONFIG_COMPAT */ |
| 556 | #endif /* _LINUX_COMPAT_H */ | 565 | #endif /* _LINUX_COMPAT_H */ |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 4df926199369..ed9f74f6c519 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
| @@ -339,7 +339,8 @@ extern int d_validate(struct dentry *, struct dentry *); | |||
| 339 | */ | 339 | */ |
| 340 | extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); | 340 | extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); |
| 341 | 341 | ||
| 342 | extern char *__d_path(const struct path *path, struct path *root, char *, int); | 342 | extern char *__d_path(const struct path *, const struct path *, char *, int); |
| 343 | extern char *d_absolute_path(const struct path *, char *, int); | ||
| 343 | extern char *d_path(const struct path *, char *, int); | 344 | extern char *d_path(const struct path *, char *, int); |
| 344 | extern char *d_path_with_unreachable(const struct path *, char *, int); | 345 | extern char *d_path_with_unreachable(const struct path *, char *, int); |
| 345 | extern char *dentry_path_raw(struct dentry *, char *, int); | 346 | extern char *dentry_path_raw(struct dentry *, char *, int); |
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h index ef90cbd8e173..57c9a8ae4f2d 100644 --- a/include/linux/dma_remapping.h +++ b/include/linux/dma_remapping.h | |||
| @@ -31,6 +31,7 @@ extern void free_dmar_iommu(struct intel_iommu *iommu); | |||
| 31 | extern int iommu_calculate_agaw(struct intel_iommu *iommu); | 31 | extern int iommu_calculate_agaw(struct intel_iommu *iommu); |
| 32 | extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); | 32 | extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); |
| 33 | extern int dmar_disabled; | 33 | extern int dmar_disabled; |
| 34 | extern int intel_iommu_enabled; | ||
| 34 | #else | 35 | #else |
| 35 | static inline int iommu_calculate_agaw(struct intel_iommu *iommu) | 36 | static inline int iommu_calculate_agaw(struct intel_iommu *iommu) |
| 36 | { | 37 | { |
| @@ -44,6 +45,7 @@ static inline void free_dmar_iommu(struct intel_iommu *iommu) | |||
| 44 | { | 45 | { |
| 45 | } | 46 | } |
| 46 | #define dmar_disabled (1) | 47 | #define dmar_disabled (1) |
| 48 | #define intel_iommu_enabled (0) | ||
| 47 | #endif | 49 | #endif |
| 48 | 50 | ||
| 49 | 51 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index e3130220ce3e..e0bc4ffb8e7f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -393,8 +393,8 @@ struct inodes_stat_t { | |||
| 393 | #include <linux/semaphore.h> | 393 | #include <linux/semaphore.h> |
| 394 | #include <linux/fiemap.h> | 394 | #include <linux/fiemap.h> |
| 395 | #include <linux/rculist_bl.h> | 395 | #include <linux/rculist_bl.h> |
| 396 | #include <linux/shrinker.h> | ||
| 397 | #include <linux/atomic.h> | 396 | #include <linux/atomic.h> |
| 397 | #include <linux/shrinker.h> | ||
| 398 | 398 | ||
| 399 | #include <asm/byteorder.h> | 399 | #include <asm/byteorder.h> |
| 400 | 400 | ||
| @@ -1942,6 +1942,7 @@ extern int fd_statfs(int, struct kstatfs *); | |||
| 1942 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); | 1942 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); |
| 1943 | extern int freeze_super(struct super_block *super); | 1943 | extern int freeze_super(struct super_block *super); |
| 1944 | extern int thaw_super(struct super_block *super); | 1944 | extern int thaw_super(struct super_block *super); |
| 1945 | extern bool our_mnt(struct vfsmount *mnt); | ||
| 1945 | 1946 | ||
| 1946 | extern int current_umask(void); | 1947 | extern int current_umask(void); |
| 1947 | 1948 | ||
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 96efa6794ea5..c3da42dd22ba 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
| @@ -172,6 +172,7 @@ enum { | |||
| 172 | TRACE_EVENT_FL_FILTERED_BIT, | 172 | TRACE_EVENT_FL_FILTERED_BIT, |
| 173 | TRACE_EVENT_FL_RECORDED_CMD_BIT, | 173 | TRACE_EVENT_FL_RECORDED_CMD_BIT, |
| 174 | TRACE_EVENT_FL_CAP_ANY_BIT, | 174 | TRACE_EVENT_FL_CAP_ANY_BIT, |
| 175 | TRACE_EVENT_FL_NO_SET_FILTER_BIT, | ||
| 175 | }; | 176 | }; |
| 176 | 177 | ||
| 177 | enum { | 178 | enum { |
| @@ -179,6 +180,7 @@ enum { | |||
| 179 | TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), | 180 | TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), |
| 180 | TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), | 181 | TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), |
| 181 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), | 182 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), |
| 183 | TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), | ||
| 182 | }; | 184 | }; |
| 183 | 185 | ||
| 184 | struct ftrace_event_call { | 186 | struct ftrace_event_call { |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 94b1e356c02a..32574eef9394 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
| @@ -126,6 +126,8 @@ extern struct cred init_cred; | |||
| 126 | # define INIT_PERF_EVENTS(tsk) | 126 | # define INIT_PERF_EVENTS(tsk) |
| 127 | #endif | 127 | #endif |
| 128 | 128 | ||
| 129 | #define INIT_TASK_COMM "swapper" | ||
| 130 | |||
| 129 | /* | 131 | /* |
| 130 | * INIT_TASK is used to set up the first task table, touch at | 132 | * INIT_TASK is used to set up the first task table, touch at |
| 131 | * your own risk!. Base=0, limit=0x1fffff (=2MB) | 133 | * your own risk!. Base=0, limit=0x1fffff (=2MB) |
| @@ -162,7 +164,7 @@ extern struct cred init_cred; | |||
| 162 | .group_leader = &tsk, \ | 164 | .group_leader = &tsk, \ |
| 163 | RCU_INIT_POINTER(.real_cred, &init_cred), \ | 165 | RCU_INIT_POINTER(.real_cred, &init_cred), \ |
| 164 | RCU_INIT_POINTER(.cred, &init_cred), \ | 166 | RCU_INIT_POINTER(.cred, &init_cred), \ |
| 165 | .comm = "swapper", \ | 167 | .comm = INIT_TASK_COMM, \ |
| 166 | .thread = INIT_THREAD, \ | 168 | .thread = INIT_THREAD, \ |
| 167 | .fs = &init_fs, \ | 169 | .fs = &init_fs, \ |
| 168 | .files = &init_files, \ | 170 | .files = &init_files, \ |
diff --git a/include/linux/lglock.h b/include/linux/lglock.h index f549056fb20b..87f402ccec55 100644 --- a/include/linux/lglock.h +++ b/include/linux/lglock.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
| 23 | #include <linux/lockdep.h> | 23 | #include <linux/lockdep.h> |
| 24 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
| 25 | #include <linux/cpu.h> | ||
| 25 | 26 | ||
| 26 | /* can make br locks by using local lock for read side, global lock for write */ | 27 | /* can make br locks by using local lock for read side, global lock for write */ |
| 27 | #define br_lock_init(name) name##_lock_init() | 28 | #define br_lock_init(name) name##_lock_init() |
| @@ -72,9 +73,31 @@ | |||
| 72 | 73 | ||
| 73 | #define DEFINE_LGLOCK(name) \ | 74 | #define DEFINE_LGLOCK(name) \ |
| 74 | \ | 75 | \ |
| 76 | DEFINE_SPINLOCK(name##_cpu_lock); \ | ||
| 77 | cpumask_t name##_cpus __read_mostly; \ | ||
| 75 | DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \ | 78 | DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \ |
| 76 | DEFINE_LGLOCK_LOCKDEP(name); \ | 79 | DEFINE_LGLOCK_LOCKDEP(name); \ |
| 77 | \ | 80 | \ |
| 81 | static int \ | ||
| 82 | name##_lg_cpu_callback(struct notifier_block *nb, \ | ||
| 83 | unsigned long action, void *hcpu) \ | ||
| 84 | { \ | ||
| 85 | switch (action & ~CPU_TASKS_FROZEN) { \ | ||
| 86 | case CPU_UP_PREPARE: \ | ||
| 87 | spin_lock(&name##_cpu_lock); \ | ||
| 88 | cpu_set((unsigned long)hcpu, name##_cpus); \ | ||
| 89 | spin_unlock(&name##_cpu_lock); \ | ||
| 90 | break; \ | ||
| 91 | case CPU_UP_CANCELED: case CPU_DEAD: \ | ||
| 92 | spin_lock(&name##_cpu_lock); \ | ||
| 93 | cpu_clear((unsigned long)hcpu, name##_cpus); \ | ||
| 94 | spin_unlock(&name##_cpu_lock); \ | ||
| 95 | } \ | ||
| 96 | return NOTIFY_OK; \ | ||
| 97 | } \ | ||
| 98 | static struct notifier_block name##_lg_cpu_notifier = { \ | ||
| 99 | .notifier_call = name##_lg_cpu_callback, \ | ||
| 100 | }; \ | ||
| 78 | void name##_lock_init(void) { \ | 101 | void name##_lock_init(void) { \ |
| 79 | int i; \ | 102 | int i; \ |
| 80 | LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \ | 103 | LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \ |
| @@ -83,6 +106,11 @@ | |||
| 83 | lock = &per_cpu(name##_lock, i); \ | 106 | lock = &per_cpu(name##_lock, i); \ |
| 84 | *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \ | 107 | *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \ |
| 85 | } \ | 108 | } \ |
| 109 | register_hotcpu_notifier(&name##_lg_cpu_notifier); \ | ||
| 110 | get_online_cpus(); \ | ||
| 111 | for_each_online_cpu(i) \ | ||
| 112 | cpu_set(i, name##_cpus); \ | ||
| 113 | put_online_cpus(); \ | ||
| 86 | } \ | 114 | } \ |
| 87 | EXPORT_SYMBOL(name##_lock_init); \ | 115 | EXPORT_SYMBOL(name##_lock_init); \ |
| 88 | \ | 116 | \ |
| @@ -124,9 +152,9 @@ | |||
| 124 | \ | 152 | \ |
| 125 | void name##_global_lock_online(void) { \ | 153 | void name##_global_lock_online(void) { \ |
| 126 | int i; \ | 154 | int i; \ |
| 127 | preempt_disable(); \ | 155 | spin_lock(&name##_cpu_lock); \ |
| 128 | rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ | 156 | rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ |
| 129 | for_each_online_cpu(i) { \ | 157 | for_each_cpu(i, &name##_cpus) { \ |
| 130 | arch_spinlock_t *lock; \ | 158 | arch_spinlock_t *lock; \ |
| 131 | lock = &per_cpu(name##_lock, i); \ | 159 | lock = &per_cpu(name##_lock, i); \ |
| 132 | arch_spin_lock(lock); \ | 160 | arch_spin_lock(lock); \ |
| @@ -137,12 +165,12 @@ | |||
| 137 | void name##_global_unlock_online(void) { \ | 165 | void name##_global_unlock_online(void) { \ |
| 138 | int i; \ | 166 | int i; \ |
| 139 | rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ | 167 | rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ |
| 140 | for_each_online_cpu(i) { \ | 168 | for_each_cpu(i, &name##_cpus) { \ |
| 141 | arch_spinlock_t *lock; \ | 169 | arch_spinlock_t *lock; \ |
| 142 | lock = &per_cpu(name##_lock, i); \ | 170 | lock = &per_cpu(name##_lock, i); \ |
| 143 | arch_spin_unlock(lock); \ | 171 | arch_spin_unlock(lock); \ |
| 144 | } \ | 172 | } \ |
| 145 | preempt_enable(); \ | 173 | spin_unlock(&name##_cpu_lock); \ |
| 146 | } \ | 174 | } \ |
| 147 | EXPORT_SYMBOL(name##_global_unlock_online); \ | 175 | EXPORT_SYMBOL(name##_global_unlock_online); \ |
| 148 | \ | 176 | \ |
diff --git a/include/linux/log2.h b/include/linux/log2.h index 25b808631cd9..fd7ff3d91e6a 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h | |||
| @@ -185,7 +185,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n) | |||
| 185 | #define rounddown_pow_of_two(n) \ | 185 | #define rounddown_pow_of_two(n) \ |
| 186 | ( \ | 186 | ( \ |
| 187 | __builtin_constant_p(n) ? ( \ | 187 | __builtin_constant_p(n) ? ( \ |
| 188 | (n == 1) ? 0 : \ | ||
| 189 | (1UL << ilog2(n))) : \ | 188 | (1UL << ilog2(n))) : \ |
| 190 | __rounddown_pow_of_two(n) \ | 189 | __rounddown_pow_of_two(n) \ |
| 191 | ) | 190 | ) |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 3dc3a8c2c485..4baadd18f4ad 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <linux/mmzone.h> | 10 | #include <linux/mmzone.h> |
| 11 | #include <linux/rbtree.h> | 11 | #include <linux/rbtree.h> |
| 12 | #include <linux/prio_tree.h> | 12 | #include <linux/prio_tree.h> |
| 13 | #include <linux/atomic.h> | ||
| 13 | #include <linux/debug_locks.h> | 14 | #include <linux/debug_locks.h> |
| 14 | #include <linux/mm_types.h> | 15 | #include <linux/mm_types.h> |
| 15 | #include <linux/range.h> | 16 | #include <linux/range.h> |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 415f2db414e1..c8ef9bc54d50 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
| @@ -218,6 +218,7 @@ struct mmc_card { | |||
| 218 | #define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ | 218 | #define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ |
| 219 | #define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ | 219 | #define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ |
| 220 | #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */ | 220 | #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */ |
| 221 | #define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */ | ||
| 221 | /* byte mode */ | 222 | /* byte mode */ |
| 222 | unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */ | 223 | unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */ |
| 223 | #define MMC_NO_POWER_NOTIFICATION 0 | 224 | #define MMC_NO_POWER_NOTIFICATION 0 |
| @@ -433,6 +434,11 @@ static inline int mmc_card_broken_byte_mode_512(const struct mmc_card *c) | |||
| 433 | return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512; | 434 | return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512; |
| 434 | } | 435 | } |
| 435 | 436 | ||
| 437 | static inline int mmc_card_long_read_time(const struct mmc_card *c) | ||
| 438 | { | ||
| 439 | return c->quirks & MMC_QUIRK_LONG_READ_TIME; | ||
| 440 | } | ||
| 441 | |||
| 436 | #define mmc_card_name(c) ((c)->cid.prod_name) | 442 | #define mmc_card_name(c) ((c)->cid.prod_name) |
| 437 | #define mmc_card_id(c) (dev_name(&(c)->dev)) | 443 | #define mmc_card_id(c) (dev_name(&(c)->dev)) |
| 438 | 444 | ||
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 172ba70306d1..2aaee0ca9da8 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -517,8 +517,12 @@ | |||
| 517 | #define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 | 517 | #define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 |
| 518 | #define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 | 518 | #define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 |
| 519 | #define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 | 519 | #define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 |
| 520 | #define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600 | ||
| 521 | #define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601 | ||
| 522 | #define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602 | ||
| 520 | #define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 | 523 | #define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 |
| 521 | #define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604 | 524 | #define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604 |
| 525 | #define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605 | ||
| 522 | #define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 | 526 | #define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 |
| 523 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 | 527 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 |
| 524 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 | 528 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 1e9ebe5e0091..b1f89122bf6a 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -822,6 +822,7 @@ struct perf_event { | |||
| 822 | int mmap_locked; | 822 | int mmap_locked; |
| 823 | struct user_struct *mmap_user; | 823 | struct user_struct *mmap_user; |
| 824 | struct ring_buffer *rb; | 824 | struct ring_buffer *rb; |
| 825 | struct list_head rb_entry; | ||
| 825 | 826 | ||
| 826 | /* poll related */ | 827 | /* poll related */ |
| 827 | wait_queue_head_t waitq; | 828 | wait_queue_head_t waitq; |
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index a83833a1f7a2..07ceb97d53fa 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h | |||
| @@ -35,7 +35,7 @@ struct shrinker { | |||
| 35 | 35 | ||
| 36 | /* These are for internal use */ | 36 | /* These are for internal use */ |
| 37 | struct list_head list; | 37 | struct list_head list; |
| 38 | long nr; /* objs pending delete */ | 38 | atomic_long_t nr_in_batch; /* objs pending delete */ |
| 39 | }; | 39 | }; |
| 40 | #define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ | 40 | #define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ |
| 41 | extern void register_shrinker(struct shrinker *); | 41 | extern void register_shrinker(struct shrinker *); |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index b1377b931eb7..5fb2c3d10c05 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
| @@ -254,7 +254,7 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl, | |||
| 254 | static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client) | 254 | static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client) |
| 255 | { | 255 | { |
| 256 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 256 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| 257 | struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; | 257 | struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); |
| 258 | return icd ? icd->vdev : NULL; | 258 | return icd ? icd->vdev : NULL; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| @@ -279,6 +279,11 @@ static inline struct soc_camera_device *soc_camera_from_vbq(const struct videobu | |||
| 279 | return container_of(vq, struct soc_camera_device, vb_vidq); | 279 | return container_of(vq, struct soc_camera_device, vb_vidq); |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | static inline u32 soc_camera_grp_id(const struct soc_camera_device *icd) | ||
| 283 | { | ||
| 284 | return (icd->iface << 8) | (icd->devnum + 1); | ||
| 285 | } | ||
| 286 | |||
| 282 | void soc_camera_lock(struct vb2_queue *vq); | 287 | void soc_camera_lock(struct vb2_queue *vq); |
| 283 | void soc_camera_unlock(struct vb2_queue *vq); | 288 | void soc_camera_unlock(struct vb2_queue *vq); |
| 284 | 289 | ||
diff --git a/include/net/dst.h b/include/net/dst.h index 6faec1a60216..75766b42660e 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -53,6 +53,7 @@ struct dst_entry { | |||
| 53 | #define DST_NOHASH 0x0008 | 53 | #define DST_NOHASH 0x0008 |
| 54 | #define DST_NOCACHE 0x0010 | 54 | #define DST_NOCACHE 0x0010 |
| 55 | #define DST_NOCOUNT 0x0020 | 55 | #define DST_NOCOUNT 0x0020 |
| 56 | #define DST_NOPEER 0x0040 | ||
| 56 | 57 | ||
| 57 | short error; | 58 | short error; |
| 58 | short obsolete; | 59 | short obsolete; |
diff --git a/include/net/flow.h b/include/net/flow.h index a09447749e2d..57f15a7f1cdd 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
| @@ -207,6 +207,7 @@ extern struct flow_cache_object *flow_cache_lookup( | |||
| 207 | u8 dir, flow_resolve_t resolver, void *ctx); | 207 | u8 dir, flow_resolve_t resolver, void *ctx); |
| 208 | 208 | ||
| 209 | extern void flow_cache_flush(void); | 209 | extern void flow_cache_flush(void); |
| 210 | extern void flow_cache_flush_deferred(void); | ||
| 210 | extern atomic_t flow_cache_genid; | 211 | extern atomic_t flow_cache_genid; |
| 211 | 212 | ||
| 212 | #endif | 213 | #endif |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index e90e7a9935dd..a15432da27c3 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
| @@ -241,6 +241,9 @@ extern struct sctp_globals { | |||
| 241 | * bits is an indicator of when to send and window update SACK. | 241 | * bits is an indicator of when to send and window update SACK. |
| 242 | */ | 242 | */ |
| 243 | int rwnd_update_shift; | 243 | int rwnd_update_shift; |
| 244 | |||
| 245 | /* Threshold for autoclose timeout, in seconds. */ | ||
| 246 | unsigned long max_autoclose; | ||
| 244 | } sctp_globals; | 247 | } sctp_globals; |
| 245 | 248 | ||
| 246 | #define sctp_rto_initial (sctp_globals.rto_initial) | 249 | #define sctp_rto_initial (sctp_globals.rto_initial) |
| @@ -281,6 +284,7 @@ extern struct sctp_globals { | |||
| 281 | #define sctp_auth_enable (sctp_globals.auth_enable) | 284 | #define sctp_auth_enable (sctp_globals.auth_enable) |
| 282 | #define sctp_checksum_disable (sctp_globals.checksum_disable) | 285 | #define sctp_checksum_disable (sctp_globals.checksum_disable) |
| 283 | #define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift) | 286 | #define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift) |
| 287 | #define sctp_max_autoclose (sctp_globals.max_autoclose) | ||
| 284 | 288 | ||
| 285 | /* SCTP Socket type: UDP or TCP style. */ | 289 | /* SCTP Socket type: UDP or TCP style. */ |
| 286 | typedef enum { | 290 | typedef enum { |
diff --git a/include/net/sock.h b/include/net/sock.h index abb6e0f0c3c3..32e39371fba6 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -637,12 +637,14 @@ static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) | |||
| 637 | 637 | ||
| 638 | /* | 638 | /* |
| 639 | * Take into account size of receive queue and backlog queue | 639 | * Take into account size of receive queue and backlog queue |
| 640 | * Do not take into account this skb truesize, | ||
| 641 | * to allow even a single big packet to come. | ||
| 640 | */ | 642 | */ |
| 641 | static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb) | 643 | static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb) |
| 642 | { | 644 | { |
| 643 | unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc); | 645 | unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc); |
| 644 | 646 | ||
| 645 | return qsize + skb->truesize > sk->sk_rcvbuf; | 647 | return qsize > sk->sk_rcvbuf; |
| 646 | } | 648 | } |
| 647 | 649 | ||
| 648 | /* The per-socket spinlock must be held here. */ | 650 | /* The per-socket spinlock must be held here. */ |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index d1e95c6ac776..5a35a2a2d3c5 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
| @@ -147,6 +147,7 @@ struct fcoe_ctlr { | |||
| 147 | u8 map_dest; | 147 | u8 map_dest; |
| 148 | u8 spma; | 148 | u8 spma; |
| 149 | u8 probe_tries; | 149 | u8 probe_tries; |
| 150 | u8 priority; | ||
| 150 | u8 dest_addr[ETH_ALEN]; | 151 | u8 dest_addr[ETH_ALEN]; |
| 151 | u8 ctl_src_addr[ETH_ALEN]; | 152 | u8 ctl_src_addr[ETH_ALEN]; |
| 152 | 153 | ||
| @@ -301,6 +302,7 @@ struct fcoe_percpu_s { | |||
| 301 | * @lport: The associated local port | 302 | * @lport: The associated local port |
| 302 | * @fcoe_pending_queue: The pending Rx queue of skbs | 303 | * @fcoe_pending_queue: The pending Rx queue of skbs |
| 303 | * @fcoe_pending_queue_active: Indicates if the pending queue is active | 304 | * @fcoe_pending_queue_active: Indicates if the pending queue is active |
| 305 | * @priority: Packet priority (DCB) | ||
| 304 | * @max_queue_depth: Max queue depth of pending queue | 306 | * @max_queue_depth: Max queue depth of pending queue |
| 305 | * @min_queue_depth: Min queue depth of pending queue | 307 | * @min_queue_depth: Min queue depth of pending queue |
| 306 | * @timer: The queue timer | 308 | * @timer: The queue timer |
| @@ -316,6 +318,7 @@ struct fcoe_port { | |||
| 316 | struct fc_lport *lport; | 318 | struct fc_lport *lport; |
| 317 | struct sk_buff_head fcoe_pending_queue; | 319 | struct sk_buff_head fcoe_pending_queue; |
| 318 | u8 fcoe_pending_queue_active; | 320 | u8 fcoe_pending_queue_active; |
| 321 | u8 priority; | ||
| 319 | u32 max_queue_depth; | 322 | u32 max_queue_depth; |
| 320 | u32 min_queue_depth; | 323 | u32 min_queue_depth; |
| 321 | struct timer_list timer; | 324 | struct timer_list timer; |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 7f5fed3c89e1..6873c7dd9145 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
| @@ -103,9 +103,10 @@ enum se_cmd_flags_table { | |||
| 103 | SCF_SCSI_NON_DATA_CDB = 0x00000040, | 103 | SCF_SCSI_NON_DATA_CDB = 0x00000040, |
| 104 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, | 104 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, |
| 105 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, | 105 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, |
| 106 | SCF_SE_CMD_FAILED = 0x00000400, | 106 | SCF_FUA = 0x00000200, |
| 107 | SCF_SE_LUN_CMD = 0x00000800, | 107 | SCF_SE_LUN_CMD = 0x00000800, |
| 108 | SCF_SE_ALLOW_EOO = 0x00001000, | 108 | SCF_SE_ALLOW_EOO = 0x00001000, |
| 109 | SCF_BIDI = 0x00002000, | ||
| 109 | SCF_SENT_CHECK_CONDITION = 0x00004000, | 110 | SCF_SENT_CHECK_CONDITION = 0x00004000, |
| 110 | SCF_OVERFLOW_BIT = 0x00008000, | 111 | SCF_OVERFLOW_BIT = 0x00008000, |
| 111 | SCF_UNDERFLOW_BIT = 0x00010000, | 112 | SCF_UNDERFLOW_BIT = 0x00010000, |
| @@ -154,6 +155,7 @@ enum tcm_sense_reason_table { | |||
| 154 | TCM_CHECK_CONDITION_ABORT_CMD = 0x0d, | 155 | TCM_CHECK_CONDITION_ABORT_CMD = 0x0d, |
| 155 | TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, | 156 | TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, |
| 156 | TCM_CHECK_CONDITION_NOT_READY = 0x0f, | 157 | TCM_CHECK_CONDITION_NOT_READY = 0x0f, |
| 158 | TCM_RESERVATION_CONFLICT = 0x10, | ||
| 157 | }; | 159 | }; |
| 158 | 160 | ||
| 159 | struct se_obj { | 161 | struct se_obj { |
| @@ -211,7 +213,6 @@ struct t10_alua_lu_gp { | |||
| 211 | u16 lu_gp_id; | 213 | u16 lu_gp_id; |
| 212 | int lu_gp_valid_id; | 214 | int lu_gp_valid_id; |
| 213 | u32 lu_gp_members; | 215 | u32 lu_gp_members; |
| 214 | atomic_t lu_gp_shutdown; | ||
| 215 | atomic_t lu_gp_ref_cnt; | 216 | atomic_t lu_gp_ref_cnt; |
| 216 | spinlock_t lu_gp_lock; | 217 | spinlock_t lu_gp_lock; |
| 217 | struct config_group lu_gp_group; | 218 | struct config_group lu_gp_group; |
| @@ -422,11 +423,9 @@ struct se_cmd { | |||
| 422 | int sam_task_attr; | 423 | int sam_task_attr; |
| 423 | /* Transport protocol dependent state, see transport_state_table */ | 424 | /* Transport protocol dependent state, see transport_state_table */ |
| 424 | enum transport_state_table t_state; | 425 | enum transport_state_table t_state; |
| 425 | /* Transport specific error status */ | ||
| 426 | int transport_error_status; | ||
| 427 | /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ | 426 | /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ |
| 428 | int check_release:1; | 427 | unsigned check_release:1; |
| 429 | int cmd_wait_set:1; | 428 | unsigned cmd_wait_set:1; |
| 430 | /* See se_cmd_flags_table */ | 429 | /* See se_cmd_flags_table */ |
| 431 | u32 se_cmd_flags; | 430 | u32 se_cmd_flags; |
| 432 | u32 se_ordered_id; | 431 | u32 se_ordered_id; |
| @@ -441,13 +440,10 @@ struct se_cmd { | |||
| 441 | /* Used for sense data */ | 440 | /* Used for sense data */ |
| 442 | void *sense_buffer; | 441 | void *sense_buffer; |
| 443 | struct list_head se_delayed_node; | 442 | struct list_head se_delayed_node; |
| 444 | struct list_head se_ordered_node; | ||
| 445 | struct list_head se_lun_node; | 443 | struct list_head se_lun_node; |
| 446 | struct list_head se_qf_node; | 444 | struct list_head se_qf_node; |
| 447 | struct se_device *se_dev; | 445 | struct se_device *se_dev; |
| 448 | struct se_dev_entry *se_deve; | 446 | struct se_dev_entry *se_deve; |
| 449 | struct se_device *se_obj_ptr; | ||
| 450 | struct se_device *se_orig_obj_ptr; | ||
| 451 | struct se_lun *se_lun; | 447 | struct se_lun *se_lun; |
| 452 | /* Only used for internal passthrough and legacy TCM fabric modules */ | 448 | /* Only used for internal passthrough and legacy TCM fabric modules */ |
| 453 | struct se_session *se_sess; | 449 | struct se_session *se_sess; |
| @@ -463,8 +459,6 @@ struct se_cmd { | |||
| 463 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; | 459 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; |
| 464 | unsigned long long t_task_lba; | 460 | unsigned long long t_task_lba; |
| 465 | int t_tasks_failed; | 461 | int t_tasks_failed; |
| 466 | int t_tasks_fua; | ||
| 467 | bool t_tasks_bidi; | ||
| 468 | u32 t_tasks_sg_chained_no; | 462 | u32 t_tasks_sg_chained_no; |
| 469 | atomic_t t_fe_count; | 463 | atomic_t t_fe_count; |
| 470 | atomic_t t_se_count; | 464 | atomic_t t_se_count; |
| @@ -489,14 +483,6 @@ struct se_cmd { | |||
| 489 | 483 | ||
| 490 | struct work_struct work; | 484 | struct work_struct work; |
| 491 | 485 | ||
| 492 | /* | ||
| 493 | * Used for pre-registered fabric SGL passthrough WRITE and READ | ||
| 494 | * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop | ||
| 495 | * and other HW target mode fabric modules. | ||
| 496 | */ | ||
| 497 | struct scatterlist *t_task_pt_sgl; | ||
| 498 | u32 t_task_pt_sgl_num; | ||
| 499 | |||
| 500 | struct scatterlist *t_data_sg; | 486 | struct scatterlist *t_data_sg; |
| 501 | unsigned int t_data_nents; | 487 | unsigned int t_data_nents; |
| 502 | struct scatterlist *t_bidi_data_sg; | 488 | struct scatterlist *t_bidi_data_sg; |
| @@ -562,7 +548,7 @@ struct se_node_acl { | |||
| 562 | } ____cacheline_aligned; | 548 | } ____cacheline_aligned; |
| 563 | 549 | ||
| 564 | struct se_session { | 550 | struct se_session { |
| 565 | int sess_tearing_down:1; | 551 | unsigned sess_tearing_down:1; |
| 566 | u64 sess_bin_isid; | 552 | u64 sess_bin_isid; |
| 567 | struct se_node_acl *se_node_acl; | 553 | struct se_node_acl *se_node_acl; |
| 568 | struct se_portal_group *se_tpg; | 554 | struct se_portal_group *se_tpg; |
| @@ -683,7 +669,6 @@ struct se_subsystem_dev { | |||
| 683 | struct t10_reservation t10_pr; | 669 | struct t10_reservation t10_pr; |
| 684 | spinlock_t se_dev_lock; | 670 | spinlock_t se_dev_lock; |
| 685 | void *se_dev_su_ptr; | 671 | void *se_dev_su_ptr; |
| 686 | struct list_head se_dev_node; | ||
| 687 | struct config_group se_dev_group; | 672 | struct config_group se_dev_group; |
| 688 | /* For T10 Reservations */ | 673 | /* For T10 Reservations */ |
| 689 | struct config_group se_dev_pr_group; | 674 | struct config_group se_dev_pr_group; |
| @@ -692,9 +677,6 @@ struct se_subsystem_dev { | |||
| 692 | } ____cacheline_aligned; | 677 | } ____cacheline_aligned; |
| 693 | 678 | ||
| 694 | struct se_device { | 679 | struct se_device { |
| 695 | /* Set to 1 if thread is NOT sleeping on thread_sem */ | ||
| 696 | u8 thread_active; | ||
| 697 | u8 dev_status_timer_flags; | ||
| 698 | /* RELATIVE TARGET PORT IDENTIFER Counter */ | 680 | /* RELATIVE TARGET PORT IDENTIFER Counter */ |
| 699 | u16 dev_rpti_counter; | 681 | u16 dev_rpti_counter; |
| 700 | /* Used for SAM Task Attribute ordering */ | 682 | /* Used for SAM Task Attribute ordering */ |
| @@ -719,14 +701,10 @@ struct se_device { | |||
| 719 | u64 write_bytes; | 701 | u64 write_bytes; |
| 720 | spinlock_t stats_lock; | 702 | spinlock_t stats_lock; |
| 721 | /* Active commands on this virtual SE device */ | 703 | /* Active commands on this virtual SE device */ |
| 722 | atomic_t active_cmds; | ||
| 723 | atomic_t simple_cmds; | 704 | atomic_t simple_cmds; |
| 724 | atomic_t depth_left; | 705 | atomic_t depth_left; |
| 725 | atomic_t dev_ordered_id; | 706 | atomic_t dev_ordered_id; |
| 726 | atomic_t dev_tur_active; | ||
| 727 | atomic_t execute_tasks; | 707 | atomic_t execute_tasks; |
| 728 | atomic_t dev_status_thr_count; | ||
| 729 | atomic_t dev_hoq_count; | ||
| 730 | atomic_t dev_ordered_sync; | 708 | atomic_t dev_ordered_sync; |
| 731 | atomic_t dev_qf_count; | 709 | atomic_t dev_qf_count; |
| 732 | struct se_obj dev_obj; | 710 | struct se_obj dev_obj; |
| @@ -734,14 +712,9 @@ struct se_device { | |||
| 734 | struct se_obj dev_export_obj; | 712 | struct se_obj dev_export_obj; |
| 735 | struct se_queue_obj dev_queue_obj; | 713 | struct se_queue_obj dev_queue_obj; |
| 736 | spinlock_t delayed_cmd_lock; | 714 | spinlock_t delayed_cmd_lock; |
| 737 | spinlock_t ordered_cmd_lock; | ||
| 738 | spinlock_t execute_task_lock; | 715 | spinlock_t execute_task_lock; |
| 739 | spinlock_t state_task_lock; | ||
| 740 | spinlock_t dev_alua_lock; | ||
| 741 | spinlock_t dev_reservation_lock; | 716 | spinlock_t dev_reservation_lock; |
| 742 | spinlock_t dev_state_lock; | ||
| 743 | spinlock_t dev_status_lock; | 717 | spinlock_t dev_status_lock; |
| 744 | spinlock_t dev_status_thr_lock; | ||
| 745 | spinlock_t se_port_lock; | 718 | spinlock_t se_port_lock; |
| 746 | spinlock_t se_tmr_lock; | 719 | spinlock_t se_tmr_lock; |
| 747 | spinlock_t qf_cmd_lock; | 720 | spinlock_t qf_cmd_lock; |
| @@ -753,14 +726,10 @@ struct se_device { | |||
| 753 | struct t10_pr_registration *dev_pr_res_holder; | 726 | struct t10_pr_registration *dev_pr_res_holder; |
| 754 | struct list_head dev_sep_list; | 727 | struct list_head dev_sep_list; |
| 755 | struct list_head dev_tmr_list; | 728 | struct list_head dev_tmr_list; |
| 756 | struct timer_list dev_status_timer; | ||
| 757 | /* Pointer to descriptor for processing thread */ | 729 | /* Pointer to descriptor for processing thread */ |
| 758 | struct task_struct *process_thread; | 730 | struct task_struct *process_thread; |
| 759 | pid_t process_thread_pid; | ||
| 760 | struct task_struct *dev_mgmt_thread; | ||
| 761 | struct work_struct qf_work_queue; | 731 | struct work_struct qf_work_queue; |
| 762 | struct list_head delayed_cmd_list; | 732 | struct list_head delayed_cmd_list; |
| 763 | struct list_head ordered_cmd_list; | ||
| 764 | struct list_head execute_task_list; | 733 | struct list_head execute_task_list; |
| 765 | struct list_head state_task_list; | 734 | struct list_head state_task_list; |
| 766 | struct list_head qf_cmd_list; | 735 | struct list_head qf_cmd_list; |
| @@ -771,8 +740,6 @@ struct se_device { | |||
| 771 | struct se_subsystem_api *transport; | 740 | struct se_subsystem_api *transport; |
| 772 | /* Linked list for struct se_hba struct se_device list */ | 741 | /* Linked list for struct se_hba struct se_device list */ |
| 773 | struct list_head dev_list; | 742 | struct list_head dev_list; |
| 774 | /* Linked list for struct se_global->g_se_dev_list */ | ||
| 775 | struct list_head g_se_dev_list; | ||
| 776 | } ____cacheline_aligned; | 743 | } ____cacheline_aligned; |
| 777 | 744 | ||
| 778 | struct se_hba { | 745 | struct se_hba { |
| @@ -834,7 +801,6 @@ struct se_port { | |||
| 834 | u32 sep_index; | 801 | u32 sep_index; |
| 835 | struct scsi_port_stats sep_stats; | 802 | struct scsi_port_stats sep_stats; |
| 836 | /* Used for ALUA Target Port Groups membership */ | 803 | /* Used for ALUA Target Port Groups membership */ |
| 837 | atomic_t sep_tg_pt_gp_active; | ||
| 838 | atomic_t sep_tg_pt_secondary_offline; | 804 | atomic_t sep_tg_pt_secondary_offline; |
| 839 | /* Used for PR ALL_TG_PT=1 */ | 805 | /* Used for PR ALL_TG_PT=1 */ |
| 840 | atomic_t sep_tg_pt_ref_cnt; | 806 | atomic_t sep_tg_pt_ref_cnt; |
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h index c16e9431dd01..dac4f2d859fd 100644 --- a/include/target/target_core_transport.h +++ b/include/target/target_core_transport.h | |||
| @@ -10,29 +10,6 @@ | |||
| 10 | 10 | ||
| 11 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ | 11 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ |
| 12 | 12 | ||
| 13 | #define PYX_TRANSPORT_SENT_TO_TRANSPORT 0 | ||
| 14 | #define PYX_TRANSPORT_WRITE_PENDING 1 | ||
| 15 | |||
| 16 | #define PYX_TRANSPORT_UNKNOWN_SAM_OPCODE -1 | ||
| 17 | #define PYX_TRANSPORT_HBA_QUEUE_FULL -2 | ||
| 18 | #define PYX_TRANSPORT_REQ_TOO_MANY_SECTORS -3 | ||
| 19 | #define PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES -4 | ||
| 20 | #define PYX_TRANSPORT_INVALID_CDB_FIELD -5 | ||
| 21 | #define PYX_TRANSPORT_INVALID_PARAMETER_LIST -6 | ||
| 22 | #define PYX_TRANSPORT_LU_COMM_FAILURE -7 | ||
| 23 | #define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -8 | ||
| 24 | #define PYX_TRANSPORT_WRITE_PROTECTED -9 | ||
| 25 | #define PYX_TRANSPORT_RESERVATION_CONFLICT -10 | ||
| 26 | #define PYX_TRANSPORT_ILLEGAL_REQUEST -11 | ||
| 27 | #define PYX_TRANSPORT_USE_SENSE_REASON -12 | ||
| 28 | |||
| 29 | #ifndef SAM_STAT_RESERVATION_CONFLICT | ||
| 30 | #define SAM_STAT_RESERVATION_CONFLICT 0x18 | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #define TRANSPORT_PLUGIN_FREE 0 | ||
| 34 | #define TRANSPORT_PLUGIN_REGISTERED 1 | ||
| 35 | |||
| 36 | #define TRANSPORT_PLUGIN_PHBA_PDEV 1 | 13 | #define TRANSPORT_PLUGIN_PHBA_PDEV 1 |
| 37 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 | 14 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 |
| 38 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 | 15 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 |
| @@ -158,7 +135,6 @@ extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | |||
| 158 | extern int transport_handle_cdb_direct(struct se_cmd *); | 135 | extern int transport_handle_cdb_direct(struct se_cmd *); |
| 159 | extern int transport_generic_handle_cdb_map(struct se_cmd *); | 136 | extern int transport_generic_handle_cdb_map(struct se_cmd *); |
| 160 | extern int transport_generic_handle_data(struct se_cmd *); | 137 | extern int transport_generic_handle_data(struct se_cmd *); |
| 161 | extern void transport_new_cmd_failure(struct se_cmd *); | ||
| 162 | extern int transport_generic_handle_tmr(struct se_cmd *); | 138 | extern int transport_generic_handle_tmr(struct se_cmd *); |
| 163 | extern bool target_stop_task(struct se_task *task, unsigned long *flags); | 139 | extern bool target_stop_task(struct se_task *task, unsigned long *flags); |
| 164 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, | 140 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, |
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index b99caa8b780c..99d1d0decf88 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
| @@ -21,6 +21,16 @@ | |||
| 21 | {I_REFERENCED, "I_REFERENCED"} \ | 21 | {I_REFERENCED, "I_REFERENCED"} \ |
| 22 | ) | 22 | ) |
| 23 | 23 | ||
| 24 | #define WB_WORK_REASON \ | ||
| 25 | {WB_REASON_BACKGROUND, "background"}, \ | ||
| 26 | {WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages"}, \ | ||
| 27 | {WB_REASON_SYNC, "sync"}, \ | ||
| 28 | {WB_REASON_PERIODIC, "periodic"}, \ | ||
| 29 | {WB_REASON_LAPTOP_TIMER, "laptop_timer"}, \ | ||
| 30 | {WB_REASON_FREE_MORE_MEM, "free_more_memory"}, \ | ||
| 31 | {WB_REASON_FS_FREE_SPACE, "fs_free_space"}, \ | ||
| 32 | {WB_REASON_FORKER_THREAD, "forker_thread"} | ||
| 33 | |||
| 24 | struct wb_writeback_work; | 34 | struct wb_writeback_work; |
| 25 | 35 | ||
| 26 | DECLARE_EVENT_CLASS(writeback_work_class, | 36 | DECLARE_EVENT_CLASS(writeback_work_class, |
| @@ -55,7 +65,7 @@ DECLARE_EVENT_CLASS(writeback_work_class, | |||
| 55 | __entry->for_kupdate, | 65 | __entry->for_kupdate, |
| 56 | __entry->range_cyclic, | 66 | __entry->range_cyclic, |
| 57 | __entry->for_background, | 67 | __entry->for_background, |
| 58 | wb_reason_name[__entry->reason] | 68 | __print_symbolic(__entry->reason, WB_WORK_REASON) |
| 59 | ) | 69 | ) |
| 60 | ); | 70 | ); |
| 61 | #define DEFINE_WRITEBACK_WORK_EVENT(name) \ | 71 | #define DEFINE_WRITEBACK_WORK_EVENT(name) \ |
| @@ -184,7 +194,8 @@ TRACE_EVENT(writeback_queue_io, | |||
| 184 | __entry->older, /* older_than_this in jiffies */ | 194 | __entry->older, /* older_than_this in jiffies */ |
| 185 | __entry->age, /* older_than_this in relative milliseconds */ | 195 | __entry->age, /* older_than_this in relative milliseconds */ |
| 186 | __entry->moved, | 196 | __entry->moved, |
| 187 | wb_reason_name[__entry->reason]) | 197 | __print_symbolic(__entry->reason, WB_WORK_REASON) |
| 198 | ) | ||
| 188 | ); | 199 | ); |
| 189 | 200 | ||
| 190 | TRACE_EVENT(global_dirty_state, | 201 | TRACE_EVENT(global_dirty_state, |
diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h index f0b6890370be..f6f07aa35af5 100644 --- a/include/xen/interface/io/xs_wire.h +++ b/include/xen/interface/io/xs_wire.h | |||
| @@ -29,8 +29,7 @@ enum xsd_sockmsg_type | |||
| 29 | XS_IS_DOMAIN_INTRODUCED, | 29 | XS_IS_DOMAIN_INTRODUCED, |
| 30 | XS_RESUME, | 30 | XS_RESUME, |
| 31 | XS_SET_TARGET, | 31 | XS_SET_TARGET, |
| 32 | XS_RESTRICT, | 32 | XS_RESTRICT |
| 33 | XS_RESET_WATCHES | ||
| 34 | }; | 33 | }; |
| 35 | 34 | ||
| 36 | #define XS_WRITE_NONE "NONE" | 35 | #define XS_WRITE_NONE "NONE" |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 2e0ecfcc881d..5b4293d9819d 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
| @@ -1269,7 +1269,7 @@ void mq_clear_sbinfo(struct ipc_namespace *ns) | |||
| 1269 | 1269 | ||
| 1270 | void mq_put_mnt(struct ipc_namespace *ns) | 1270 | void mq_put_mnt(struct ipc_namespace *ns) |
| 1271 | { | 1271 | { |
| 1272 | mntput(ns->mq_mnt); | 1272 | kern_unmount(ns->mq_mnt); |
| 1273 | } | 1273 | } |
| 1274 | 1274 | ||
| 1275 | static int __init init_mqueue_fs(void) | 1275 | static int __init init_mqueue_fs(void) |
| @@ -1291,11 +1291,9 @@ static int __init init_mqueue_fs(void) | |||
| 1291 | 1291 | ||
| 1292 | spin_lock_init(&mq_lock); | 1292 | spin_lock_init(&mq_lock); |
| 1293 | 1293 | ||
| 1294 | init_ipc_ns.mq_mnt = kern_mount_data(&mqueue_fs_type, &init_ipc_ns); | 1294 | error = mq_init_ns(&init_ipc_ns); |
| 1295 | if (IS_ERR(init_ipc_ns.mq_mnt)) { | 1295 | if (error) |
| 1296 | error = PTR_ERR(init_ipc_ns.mq_mnt); | ||
| 1297 | goto out_filesystem; | 1296 | goto out_filesystem; |
| 1298 | } | ||
| 1299 | 1297 | ||
| 1300 | return 0; | 1298 | return 0; |
| 1301 | 1299 | ||
diff --git a/ipc/msgutil.c b/ipc/msgutil.c index 8b5ce5d3f3ef..5652101cdac0 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c | |||
| @@ -27,11 +27,6 @@ DEFINE_SPINLOCK(mq_lock); | |||
| 27 | */ | 27 | */ |
| 28 | struct ipc_namespace init_ipc_ns = { | 28 | struct ipc_namespace init_ipc_ns = { |
| 29 | .count = ATOMIC_INIT(1), | 29 | .count = ATOMIC_INIT(1), |
| 30 | #ifdef CONFIG_POSIX_MQUEUE | ||
| 31 | .mq_queues_max = DFLT_QUEUESMAX, | ||
| 32 | .mq_msg_max = DFLT_MSGMAX, | ||
| 33 | .mq_msgsize_max = DFLT_MSGSIZEMAX, | ||
| 34 | #endif | ||
| 35 | .user_ns = &init_user_ns, | 30 | .user_ns = &init_user_ns, |
| 36 | }; | 31 | }; |
| 37 | 32 | ||
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index d9d5648f3cdc..a184470cf9b5 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -2098,11 +2098,6 @@ int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader) | |||
| 2098 | continue; | 2098 | continue; |
| 2099 | /* get old css_set pointer */ | 2099 | /* get old css_set pointer */ |
| 2100 | task_lock(tsk); | 2100 | task_lock(tsk); |
| 2101 | if (tsk->flags & PF_EXITING) { | ||
| 2102 | /* ignore this task if it's going away */ | ||
| 2103 | task_unlock(tsk); | ||
| 2104 | continue; | ||
| 2105 | } | ||
| 2106 | oldcg = tsk->cgroups; | 2101 | oldcg = tsk->cgroups; |
| 2107 | get_css_set(oldcg); | 2102 | get_css_set(oldcg); |
| 2108 | task_unlock(tsk); | 2103 | task_unlock(tsk); |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 9fe58c46a426..0b1712dba587 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
| @@ -123,6 +123,19 @@ static inline struct cpuset *task_cs(struct task_struct *task) | |||
| 123 | struct cpuset, css); | 123 | struct cpuset, css); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | #ifdef CONFIG_NUMA | ||
| 127 | static inline bool task_has_mempolicy(struct task_struct *task) | ||
| 128 | { | ||
| 129 | return task->mempolicy; | ||
| 130 | } | ||
| 131 | #else | ||
| 132 | static inline bool task_has_mempolicy(struct task_struct *task) | ||
| 133 | { | ||
| 134 | return false; | ||
| 135 | } | ||
| 136 | #endif | ||
| 137 | |||
| 138 | |||
| 126 | /* bits in struct cpuset flags field */ | 139 | /* bits in struct cpuset flags field */ |
| 127 | typedef enum { | 140 | typedef enum { |
| 128 | CS_CPU_EXCLUSIVE, | 141 | CS_CPU_EXCLUSIVE, |
| @@ -949,7 +962,7 @@ static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from, | |||
| 949 | static void cpuset_change_task_nodemask(struct task_struct *tsk, | 962 | static void cpuset_change_task_nodemask(struct task_struct *tsk, |
| 950 | nodemask_t *newmems) | 963 | nodemask_t *newmems) |
| 951 | { | 964 | { |
| 952 | bool masks_disjoint = !nodes_intersects(*newmems, tsk->mems_allowed); | 965 | bool need_loop; |
| 953 | 966 | ||
| 954 | repeat: | 967 | repeat: |
| 955 | /* | 968 | /* |
| @@ -962,6 +975,14 @@ repeat: | |||
| 962 | return; | 975 | return; |
| 963 | 976 | ||
| 964 | task_lock(tsk); | 977 | task_lock(tsk); |
| 978 | /* | ||
| 979 | * Determine if a loop is necessary if another thread is doing | ||
| 980 | * get_mems_allowed(). If at least one node remains unchanged and | ||
| 981 | * tsk does not have a mempolicy, then an empty nodemask will not be | ||
| 982 | * possible when mems_allowed is larger than a word. | ||
| 983 | */ | ||
| 984 | need_loop = task_has_mempolicy(tsk) || | ||
| 985 | !nodes_intersects(*newmems, tsk->mems_allowed); | ||
| 965 | nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); | 986 | nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems); |
| 966 | mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP1); | 987 | mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP1); |
| 967 | 988 | ||
| @@ -981,11 +1002,9 @@ repeat: | |||
| 981 | 1002 | ||
| 982 | /* | 1003 | /* |
| 983 | * Allocation of memory is very fast, we needn't sleep when waiting | 1004 | * Allocation of memory is very fast, we needn't sleep when waiting |
| 984 | * for the read-side. No wait is necessary, however, if at least one | 1005 | * for the read-side. |
| 985 | * node remains unchanged. | ||
| 986 | */ | 1006 | */ |
| 987 | while (masks_disjoint && | 1007 | while (need_loop && ACCESS_ONCE(tsk->mems_allowed_change_disable)) { |
| 988 | ACCESS_ONCE(tsk->mems_allowed_change_disable)) { | ||
| 989 | task_unlock(tsk); | 1008 | task_unlock(tsk); |
| 990 | if (!task_curr(tsk)) | 1009 | if (!task_curr(tsk)) |
| 991 | yield(); | 1010 | yield(); |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 0e8457da6f95..58690af323e4 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
| @@ -185,6 +185,9 @@ static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx, | |||
| 185 | static void update_context_time(struct perf_event_context *ctx); | 185 | static void update_context_time(struct perf_event_context *ctx); |
| 186 | static u64 perf_event_time(struct perf_event *event); | 186 | static u64 perf_event_time(struct perf_event *event); |
| 187 | 187 | ||
| 188 | static void ring_buffer_attach(struct perf_event *event, | ||
| 189 | struct ring_buffer *rb); | ||
| 190 | |||
| 188 | void __weak perf_event_print_debug(void) { } | 191 | void __weak perf_event_print_debug(void) { } |
| 189 | 192 | ||
| 190 | extern __weak const char *perf_pmu_name(void) | 193 | extern __weak const char *perf_pmu_name(void) |
| @@ -2171,9 +2174,10 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx, | |||
| 2171 | */ | 2174 | */ |
| 2172 | cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); | 2175 | cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); |
| 2173 | 2176 | ||
| 2174 | perf_event_sched_in(cpuctx, ctx, task); | 2177 | if (ctx->nr_events) |
| 2178 | cpuctx->task_ctx = ctx; | ||
| 2175 | 2179 | ||
| 2176 | cpuctx->task_ctx = ctx; | 2180 | perf_event_sched_in(cpuctx, cpuctx->task_ctx, task); |
| 2177 | 2181 | ||
| 2178 | perf_pmu_enable(ctx->pmu); | 2182 | perf_pmu_enable(ctx->pmu); |
| 2179 | perf_ctx_unlock(cpuctx, ctx); | 2183 | perf_ctx_unlock(cpuctx, ctx); |
| @@ -3190,12 +3194,33 @@ static unsigned int perf_poll(struct file *file, poll_table *wait) | |||
| 3190 | struct ring_buffer *rb; | 3194 | struct ring_buffer *rb; |
| 3191 | unsigned int events = POLL_HUP; | 3195 | unsigned int events = POLL_HUP; |
| 3192 | 3196 | ||
| 3197 | /* | ||
| 3198 | * Race between perf_event_set_output() and perf_poll(): perf_poll() | ||
| 3199 | * grabs the rb reference but perf_event_set_output() overrides it. | ||
| 3200 | * Here is the timeline for two threads T1, T2: | ||
| 3201 | * t0: T1, rb = rcu_dereference(event->rb) | ||
| 3202 | * t1: T2, old_rb = event->rb | ||
| 3203 | * t2: T2, event->rb = new rb | ||
| 3204 | * t3: T2, ring_buffer_detach(old_rb) | ||
| 3205 | * t4: T1, ring_buffer_attach(rb1) | ||
| 3206 | * t5: T1, poll_wait(event->waitq) | ||
| 3207 | * | ||
| 3208 | * To avoid this problem, we grab mmap_mutex in perf_poll() | ||
| 3209 | * thereby ensuring that the assignment of the new ring buffer | ||
| 3210 | * and the detachment of the old buffer appear atomic to perf_poll() | ||
| 3211 | */ | ||
| 3212 | mutex_lock(&event->mmap_mutex); | ||
| 3213 | |||
| 3193 | rcu_read_lock(); | 3214 | rcu_read_lock(); |
| 3194 | rb = rcu_dereference(event->rb); | 3215 | rb = rcu_dereference(event->rb); |
| 3195 | if (rb) | 3216 | if (rb) { |
| 3217 | ring_buffer_attach(event, rb); | ||
| 3196 | events = atomic_xchg(&rb->poll, 0); | 3218 | events = atomic_xchg(&rb->poll, 0); |
| 3219 | } | ||
| 3197 | rcu_read_unlock(); | 3220 | rcu_read_unlock(); |
| 3198 | 3221 | ||
| 3222 | mutex_unlock(&event->mmap_mutex); | ||
| 3223 | |||
| 3199 | poll_wait(file, &event->waitq, wait); | 3224 | poll_wait(file, &event->waitq, wait); |
| 3200 | 3225 | ||
| 3201 | return events; | 3226 | return events; |
| @@ -3496,6 +3521,53 @@ unlock: | |||
| 3496 | return ret; | 3521 | return ret; |
| 3497 | } | 3522 | } |
| 3498 | 3523 | ||
| 3524 | static void ring_buffer_attach(struct perf_event *event, | ||
| 3525 | struct ring_buffer *rb) | ||
| 3526 | { | ||
| 3527 | unsigned long flags; | ||
| 3528 | |||
| 3529 | if (!list_empty(&event->rb_entry)) | ||
| 3530 | return; | ||
| 3531 | |||
| 3532 | spin_lock_irqsave(&rb->event_lock, flags); | ||
| 3533 | if (!list_empty(&event->rb_entry)) | ||
| 3534 | goto unlock; | ||
| 3535 | |||
| 3536 | list_add(&event->rb_entry, &rb->event_list); | ||
| 3537 | unlock: | ||
| 3538 | spin_unlock_irqrestore(&rb->event_lock, flags); | ||
| 3539 | } | ||
| 3540 | |||
| 3541 | static void ring_buffer_detach(struct perf_event *event, | ||
| 3542 | struct ring_buffer *rb) | ||
| 3543 | { | ||
| 3544 | unsigned long flags; | ||
| 3545 | |||
| 3546 | if (list_empty(&event->rb_entry)) | ||
| 3547 | return; | ||
| 3548 | |||
| 3549 | spin_lock_irqsave(&rb->event_lock, flags); | ||
| 3550 | list_del_init(&event->rb_entry); | ||
| 3551 | wake_up_all(&event->waitq); | ||
| 3552 | spin_unlock_irqrestore(&rb->event_lock, flags); | ||
| 3553 | } | ||
| 3554 | |||
| 3555 | static void ring_buffer_wakeup(struct perf_event *event) | ||
| 3556 | { | ||
| 3557 | struct ring_buffer *rb; | ||
| 3558 | |||
| 3559 | rcu_read_lock(); | ||
| 3560 | rb = rcu_dereference(event->rb); | ||
| 3561 | if (!rb) | ||
| 3562 | goto unlock; | ||
| 3563 | |||
| 3564 | list_for_each_entry_rcu(event, &rb->event_list, rb_entry) | ||
| 3565 | wake_up_all(&event->waitq); | ||
| 3566 | |||
| 3567 | unlock: | ||
| 3568 | rcu_read_unlock(); | ||
| 3569 | } | ||
| 3570 | |||
| 3499 | static void rb_free_rcu(struct rcu_head *rcu_head) | 3571 | static void rb_free_rcu(struct rcu_head *rcu_head) |
| 3500 | { | 3572 | { |
| 3501 | struct ring_buffer *rb; | 3573 | struct ring_buffer *rb; |
| @@ -3521,9 +3593,19 @@ static struct ring_buffer *ring_buffer_get(struct perf_event *event) | |||
| 3521 | 3593 | ||
| 3522 | static void ring_buffer_put(struct ring_buffer *rb) | 3594 | static void ring_buffer_put(struct ring_buffer *rb) |
| 3523 | { | 3595 | { |
| 3596 | struct perf_event *event, *n; | ||
| 3597 | unsigned long flags; | ||
| 3598 | |||
| 3524 | if (!atomic_dec_and_test(&rb->refcount)) | 3599 | if (!atomic_dec_and_test(&rb->refcount)) |
| 3525 | return; | 3600 | return; |
| 3526 | 3601 | ||
| 3602 | spin_lock_irqsave(&rb->event_lock, flags); | ||
| 3603 | list_for_each_entry_safe(event, n, &rb->event_list, rb_entry) { | ||
| 3604 | list_del_init(&event->rb_entry); | ||
| 3605 | wake_up_all(&event->waitq); | ||
| 3606 | } | ||
| 3607 | spin_unlock_irqrestore(&rb->event_lock, flags); | ||
| 3608 | |||
| 3527 | call_rcu(&rb->rcu_head, rb_free_rcu); | 3609 | call_rcu(&rb->rcu_head, rb_free_rcu); |
| 3528 | } | 3610 | } |
| 3529 | 3611 | ||
| @@ -3546,6 +3628,7 @@ static void perf_mmap_close(struct vm_area_struct *vma) | |||
| 3546 | atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm); | 3628 | atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm); |
| 3547 | vma->vm_mm->pinned_vm -= event->mmap_locked; | 3629 | vma->vm_mm->pinned_vm -= event->mmap_locked; |
| 3548 | rcu_assign_pointer(event->rb, NULL); | 3630 | rcu_assign_pointer(event->rb, NULL); |
| 3631 | ring_buffer_detach(event, rb); | ||
| 3549 | mutex_unlock(&event->mmap_mutex); | 3632 | mutex_unlock(&event->mmap_mutex); |
| 3550 | 3633 | ||
| 3551 | ring_buffer_put(rb); | 3634 | ring_buffer_put(rb); |
| @@ -3700,7 +3783,7 @@ static const struct file_operations perf_fops = { | |||
| 3700 | 3783 | ||
| 3701 | void perf_event_wakeup(struct perf_event *event) | 3784 | void perf_event_wakeup(struct perf_event *event) |
| 3702 | { | 3785 | { |
| 3703 | wake_up_all(&event->waitq); | 3786 | ring_buffer_wakeup(event); |
| 3704 | 3787 | ||
| 3705 | if (event->pending_kill) { | 3788 | if (event->pending_kill) { |
| 3706 | kill_fasync(&event->fasync, SIGIO, event->pending_kill); | 3789 | kill_fasync(&event->fasync, SIGIO, event->pending_kill); |
| @@ -5822,6 +5905,8 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, | |||
| 5822 | INIT_LIST_HEAD(&event->group_entry); | 5905 | INIT_LIST_HEAD(&event->group_entry); |
| 5823 | INIT_LIST_HEAD(&event->event_entry); | 5906 | INIT_LIST_HEAD(&event->event_entry); |
| 5824 | INIT_LIST_HEAD(&event->sibling_list); | 5907 | INIT_LIST_HEAD(&event->sibling_list); |
| 5908 | INIT_LIST_HEAD(&event->rb_entry); | ||
| 5909 | |||
| 5825 | init_waitqueue_head(&event->waitq); | 5910 | init_waitqueue_head(&event->waitq); |
| 5826 | init_irq_work(&event->pending, perf_pending_event); | 5911 | init_irq_work(&event->pending, perf_pending_event); |
| 5827 | 5912 | ||
| @@ -6028,6 +6113,8 @@ set: | |||
| 6028 | 6113 | ||
| 6029 | old_rb = event->rb; | 6114 | old_rb = event->rb; |
| 6030 | rcu_assign_pointer(event->rb, rb); | 6115 | rcu_assign_pointer(event->rb, rb); |
| 6116 | if (old_rb) | ||
| 6117 | ring_buffer_detach(event, old_rb); | ||
| 6031 | ret = 0; | 6118 | ret = 0; |
| 6032 | unlock: | 6119 | unlock: |
| 6033 | mutex_unlock(&event->mmap_mutex); | 6120 | mutex_unlock(&event->mmap_mutex); |
diff --git a/kernel/events/internal.h b/kernel/events/internal.h index 09097dd8116c..64568a699375 100644 --- a/kernel/events/internal.h +++ b/kernel/events/internal.h | |||
| @@ -22,6 +22,9 @@ struct ring_buffer { | |||
| 22 | local_t lost; /* nr records lost */ | 22 | local_t lost; /* nr records lost */ |
| 23 | 23 | ||
| 24 | long watermark; /* wakeup watermark */ | 24 | long watermark; /* wakeup watermark */ |
| 25 | /* poll crap */ | ||
| 26 | spinlock_t event_lock; | ||
| 27 | struct list_head event_list; | ||
| 25 | 28 | ||
| 26 | struct perf_event_mmap_page *user_page; | 29 | struct perf_event_mmap_page *user_page; |
| 27 | void *data_pages[0]; | 30 | void *data_pages[0]; |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index a2a29205cc0f..7f3011c6b57f 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
| @@ -209,6 +209,9 @@ ring_buffer_init(struct ring_buffer *rb, long watermark, int flags) | |||
| 209 | rb->writable = 1; | 209 | rb->writable = 1; |
| 210 | 210 | ||
| 211 | atomic_set(&rb->refcount, 1); | 211 | atomic_set(&rb->refcount, 1); |
| 212 | |||
| 213 | INIT_LIST_HEAD(&rb->event_list); | ||
| 214 | spin_lock_init(&rb->event_lock); | ||
| 212 | } | 215 | } |
| 213 | 216 | ||
| 214 | #ifndef CONFIG_PERF_USE_VMALLOC | 217 | #ifndef CONFIG_PERF_USE_VMALLOC |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 0e2b179bc7b3..1da999f5e746 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
| @@ -623,8 +623,9 @@ static irqreturn_t irq_nested_primary_handler(int irq, void *dev_id) | |||
| 623 | 623 | ||
| 624 | static int irq_wait_for_interrupt(struct irqaction *action) | 624 | static int irq_wait_for_interrupt(struct irqaction *action) |
| 625 | { | 625 | { |
| 626 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 627 | |||
| 626 | while (!kthread_should_stop()) { | 628 | while (!kthread_should_stop()) { |
| 627 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 628 | 629 | ||
| 629 | if (test_and_clear_bit(IRQTF_RUNTHREAD, | 630 | if (test_and_clear_bit(IRQTF_RUNTHREAD, |
| 630 | &action->thread_flags)) { | 631 | &action->thread_flags)) { |
| @@ -632,7 +633,9 @@ static int irq_wait_for_interrupt(struct irqaction *action) | |||
| 632 | return 0; | 633 | return 0; |
| 633 | } | 634 | } |
| 634 | schedule(); | 635 | schedule(); |
| 636 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 635 | } | 637 | } |
| 638 | __set_current_state(TASK_RUNNING); | ||
| 636 | return -1; | 639 | return -1; |
| 637 | } | 640 | } |
| 638 | 641 | ||
diff --git a/kernel/jump_label.c b/kernel/jump_label.c index bbdfe2a462a0..66ff7109f697 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c | |||
| @@ -66,8 +66,9 @@ void jump_label_inc(struct jump_label_key *key) | |||
| 66 | return; | 66 | return; |
| 67 | 67 | ||
| 68 | jump_label_lock(); | 68 | jump_label_lock(); |
| 69 | if (atomic_add_return(1, &key->enabled) == 1) | 69 | if (atomic_read(&key->enabled) == 0) |
| 70 | jump_label_update(key, JUMP_LABEL_ENABLE); | 70 | jump_label_update(key, JUMP_LABEL_ENABLE); |
| 71 | atomic_inc(&key->enabled); | ||
| 71 | jump_label_unlock(); | 72 | jump_label_unlock(); |
| 72 | } | 73 | } |
| 73 | 74 | ||
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index e69434b070da..b2e08c932d91 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #include <linux/stringify.h> | 44 | #include <linux/stringify.h> |
| 45 | #include <linux/bitops.h> | 45 | #include <linux/bitops.h> |
| 46 | #include <linux/gfp.h> | 46 | #include <linux/gfp.h> |
| 47 | #include <linux/kmemcheck.h> | ||
| 47 | 48 | ||
| 48 | #include <asm/sections.h> | 49 | #include <asm/sections.h> |
| 49 | 50 | ||
| @@ -2948,7 +2949,12 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this, | |||
| 2948 | void lockdep_init_map(struct lockdep_map *lock, const char *name, | 2949 | void lockdep_init_map(struct lockdep_map *lock, const char *name, |
| 2949 | struct lock_class_key *key, int subclass) | 2950 | struct lock_class_key *key, int subclass) |
| 2950 | { | 2951 | { |
| 2951 | memset(lock, 0, sizeof(*lock)); | 2952 | int i; |
| 2953 | |||
| 2954 | kmemcheck_mark_initialized(lock, sizeof(*lock)); | ||
| 2955 | |||
| 2956 | for (i = 0; i < NR_LOCKDEP_CACHING_CLASSES; i++) | ||
| 2957 | lock->class_cache[i] = NULL; | ||
| 2952 | 2958 | ||
| 2953 | #ifdef CONFIG_LOCK_STAT | 2959 | #ifdef CONFIG_LOCK_STAT |
| 2954 | lock->cpu = raw_smp_processor_id(); | 2960 | lock->cpu = raw_smp_processor_id(); |
diff --git a/kernel/printk.c b/kernel/printk.c index 1455a0d4eedd..7982a0a841ea 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
| @@ -1293,10 +1293,11 @@ again: | |||
| 1293 | raw_spin_lock(&logbuf_lock); | 1293 | raw_spin_lock(&logbuf_lock); |
| 1294 | if (con_start != log_end) | 1294 | if (con_start != log_end) |
| 1295 | retry = 1; | 1295 | retry = 1; |
| 1296 | raw_spin_unlock_irqrestore(&logbuf_lock, flags); | ||
| 1297 | |||
| 1296 | if (retry && console_trylock()) | 1298 | if (retry && console_trylock()) |
| 1297 | goto again; | 1299 | goto again; |
| 1298 | 1300 | ||
| 1299 | raw_spin_unlock_irqrestore(&logbuf_lock, flags); | ||
| 1300 | if (wake_klogd) | 1301 | if (wake_klogd) |
| 1301 | wake_up_klogd(); | 1302 | wake_up_klogd(); |
| 1302 | } | 1303 | } |
diff --git a/kernel/sched.c b/kernel/sched.c index 0e9344a71be3..d6b149ccf925 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -71,6 +71,7 @@ | |||
| 71 | #include <linux/ctype.h> | 71 | #include <linux/ctype.h> |
| 72 | #include <linux/ftrace.h> | 72 | #include <linux/ftrace.h> |
| 73 | #include <linux/slab.h> | 73 | #include <linux/slab.h> |
| 74 | #include <linux/init_task.h> | ||
| 74 | 75 | ||
| 75 | #include <asm/tlb.h> | 76 | #include <asm/tlb.h> |
| 76 | #include <asm/irq_regs.h> | 77 | #include <asm/irq_regs.h> |
| @@ -4810,6 +4811,9 @@ EXPORT_SYMBOL(wait_for_completion); | |||
| 4810 | * This waits for either a completion of a specific task to be signaled or for a | 4811 | * This waits for either a completion of a specific task to be signaled or for a |
| 4811 | * specified timeout to expire. The timeout is in jiffies. It is not | 4812 | * specified timeout to expire. The timeout is in jiffies. It is not |
| 4812 | * interruptible. | 4813 | * interruptible. |
| 4814 | * | ||
| 4815 | * The return value is 0 if timed out, and positive (at least 1, or number of | ||
| 4816 | * jiffies left till timeout) if completed. | ||
| 4813 | */ | 4817 | */ |
| 4814 | unsigned long __sched | 4818 | unsigned long __sched |
| 4815 | wait_for_completion_timeout(struct completion *x, unsigned long timeout) | 4819 | wait_for_completion_timeout(struct completion *x, unsigned long timeout) |
| @@ -4824,6 +4828,8 @@ EXPORT_SYMBOL(wait_for_completion_timeout); | |||
| 4824 | * | 4828 | * |
| 4825 | * This waits for completion of a specific task to be signaled. It is | 4829 | * This waits for completion of a specific task to be signaled. It is |
| 4826 | * interruptible. | 4830 | * interruptible. |
| 4831 | * | ||
| 4832 | * The return value is -ERESTARTSYS if interrupted, 0 if completed. | ||
| 4827 | */ | 4833 | */ |
| 4828 | int __sched wait_for_completion_interruptible(struct completion *x) | 4834 | int __sched wait_for_completion_interruptible(struct completion *x) |
| 4829 | { | 4835 | { |
| @@ -4841,6 +4847,9 @@ EXPORT_SYMBOL(wait_for_completion_interruptible); | |||
| 4841 | * | 4847 | * |
| 4842 | * This waits for either a completion of a specific task to be signaled or for a | 4848 | * This waits for either a completion of a specific task to be signaled or for a |
| 4843 | * specified timeout to expire. It is interruptible. The timeout is in jiffies. | 4849 | * specified timeout to expire. It is interruptible. The timeout is in jiffies. |
| 4850 | * | ||
| 4851 | * The return value is -ERESTARTSYS if interrupted, 0 if timed out, | ||
| 4852 | * positive (at least 1, or number of jiffies left till timeout) if completed. | ||
| 4844 | */ | 4853 | */ |
| 4845 | long __sched | 4854 | long __sched |
| 4846 | wait_for_completion_interruptible_timeout(struct completion *x, | 4855 | wait_for_completion_interruptible_timeout(struct completion *x, |
| @@ -4856,6 +4865,8 @@ EXPORT_SYMBOL(wait_for_completion_interruptible_timeout); | |||
| 4856 | * | 4865 | * |
| 4857 | * This waits to be signaled for completion of a specific task. It can be | 4866 | * This waits to be signaled for completion of a specific task. It can be |
| 4858 | * interrupted by a kill signal. | 4867 | * interrupted by a kill signal. |
| 4868 | * | ||
| 4869 | * The return value is -ERESTARTSYS if interrupted, 0 if completed. | ||
| 4859 | */ | 4870 | */ |
| 4860 | int __sched wait_for_completion_killable(struct completion *x) | 4871 | int __sched wait_for_completion_killable(struct completion *x) |
| 4861 | { | 4872 | { |
| @@ -4874,6 +4885,9 @@ EXPORT_SYMBOL(wait_for_completion_killable); | |||
| 4874 | * This waits for either a completion of a specific task to be | 4885 | * This waits for either a completion of a specific task to be |
| 4875 | * signaled or for a specified timeout to expire. It can be | 4886 | * signaled or for a specified timeout to expire. It can be |
| 4876 | * interrupted by a kill signal. The timeout is in jiffies. | 4887 | * interrupted by a kill signal. The timeout is in jiffies. |
| 4888 | * | ||
| 4889 | * The return value is -ERESTARTSYS if interrupted, 0 if timed out, | ||
| 4890 | * positive (at least 1, or number of jiffies left till timeout) if completed. | ||
| 4877 | */ | 4891 | */ |
| 4878 | long __sched | 4892 | long __sched |
| 4879 | wait_for_completion_killable_timeout(struct completion *x, | 4893 | wait_for_completion_killable_timeout(struct completion *x, |
| @@ -6099,6 +6113,9 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) | |||
| 6099 | */ | 6113 | */ |
| 6100 | idle->sched_class = &idle_sched_class; | 6114 | idle->sched_class = &idle_sched_class; |
| 6101 | ftrace_graph_init_idle_task(idle, cpu); | 6115 | ftrace_graph_init_idle_task(idle, cpu); |
| 6116 | #if defined(CONFIG_SMP) | ||
| 6117 | sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu); | ||
| 6118 | #endif | ||
| 6102 | } | 6119 | } |
| 6103 | 6120 | ||
| 6104 | /* | 6121 | /* |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 5c9e67923b7c..8a39fa3e3c6c 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
| @@ -772,19 +772,32 @@ static void update_cfs_load(struct cfs_rq *cfs_rq, int global_update) | |||
| 772 | list_del_leaf_cfs_rq(cfs_rq); | 772 | list_del_leaf_cfs_rq(cfs_rq); |
| 773 | } | 773 | } |
| 774 | 774 | ||
| 775 | static inline long calc_tg_weight(struct task_group *tg, struct cfs_rq *cfs_rq) | ||
| 776 | { | ||
| 777 | long tg_weight; | ||
| 778 | |||
| 779 | /* | ||
| 780 | * Use this CPU's actual weight instead of the last load_contribution | ||
| 781 | * to gain a more accurate current total weight. See | ||
| 782 | * update_cfs_rq_load_contribution(). | ||
| 783 | */ | ||
| 784 | tg_weight = atomic_read(&tg->load_weight); | ||
| 785 | tg_weight -= cfs_rq->load_contribution; | ||
| 786 | tg_weight += cfs_rq->load.weight; | ||
| 787 | |||
| 788 | return tg_weight; | ||
| 789 | } | ||
| 790 | |||
| 775 | static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) | 791 | static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) |
| 776 | { | 792 | { |
| 777 | long load_weight, load, shares; | 793 | long tg_weight, load, shares; |
| 778 | 794 | ||
| 795 | tg_weight = calc_tg_weight(tg, cfs_rq); | ||
| 779 | load = cfs_rq->load.weight; | 796 | load = cfs_rq->load.weight; |
| 780 | 797 | ||
| 781 | load_weight = atomic_read(&tg->load_weight); | ||
| 782 | load_weight += load; | ||
| 783 | load_weight -= cfs_rq->load_contribution; | ||
| 784 | |||
| 785 | shares = (tg->shares * load); | 798 | shares = (tg->shares * load); |
| 786 | if (load_weight) | 799 | if (tg_weight) |
| 787 | shares /= load_weight; | 800 | shares /= tg_weight; |
| 788 | 801 | ||
| 789 | if (shares < MIN_SHARES) | 802 | if (shares < MIN_SHARES) |
| 790 | shares = MIN_SHARES; | 803 | shares = MIN_SHARES; |
| @@ -1743,7 +1756,7 @@ static void __return_cfs_rq_runtime(struct cfs_rq *cfs_rq) | |||
| 1743 | 1756 | ||
| 1744 | static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) | 1757 | static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) |
| 1745 | { | 1758 | { |
| 1746 | if (!cfs_rq->runtime_enabled || !cfs_rq->nr_running) | 1759 | if (!cfs_rq->runtime_enabled || cfs_rq->nr_running) |
| 1747 | return; | 1760 | return; |
| 1748 | 1761 | ||
| 1749 | __return_cfs_rq_runtime(cfs_rq); | 1762 | __return_cfs_rq_runtime(cfs_rq); |
| @@ -2036,36 +2049,100 @@ static void task_waking_fair(struct task_struct *p) | |||
| 2036 | * Adding load to a group doesn't make a group heavier, but can cause movement | 2049 | * Adding load to a group doesn't make a group heavier, but can cause movement |
| 2037 | * of group shares between cpus. Assuming the shares were perfectly aligned one | 2050 | * of group shares between cpus. Assuming the shares were perfectly aligned one |
| 2038 | * can calculate the shift in shares. | 2051 | * can calculate the shift in shares. |
| 2052 | * | ||
| 2053 | * Calculate the effective load difference if @wl is added (subtracted) to @tg | ||
| 2054 | * on this @cpu and results in a total addition (subtraction) of @wg to the | ||
| 2055 | * total group weight. | ||
| 2056 | * | ||
| 2057 | * Given a runqueue weight distribution (rw_i) we can compute a shares | ||
| 2058 | * distribution (s_i) using: | ||
| 2059 | * | ||
| 2060 | * s_i = rw_i / \Sum rw_j (1) | ||
| 2061 | * | ||
| 2062 | * Suppose we have 4 CPUs and our @tg is a direct child of the root group and | ||
| 2063 | * has 7 equal weight tasks, distributed as below (rw_i), with the resulting | ||
| 2064 | * shares distribution (s_i): | ||
| 2065 | * | ||
| 2066 | * rw_i = { 2, 4, 1, 0 } | ||
| 2067 | * s_i = { 2/7, 4/7, 1/7, 0 } | ||
| 2068 | * | ||
| 2069 | * As per wake_affine() we're interested in the load of two CPUs (the CPU the | ||
| 2070 | * task used to run on and the CPU the waker is running on), we need to | ||
| 2071 | * compute the effect of waking a task on either CPU and, in case of a sync | ||
| 2072 | * wakeup, compute the effect of the current task going to sleep. | ||
| 2073 | * | ||
| 2074 | * So for a change of @wl to the local @cpu with an overall group weight change | ||
| 2075 | * of @wl we can compute the new shares distribution (s'_i) using: | ||
| 2076 | * | ||
| 2077 | * s'_i = (rw_i + @wl) / (@wg + \Sum rw_j) (2) | ||
| 2078 | * | ||
| 2079 | * Suppose we're interested in CPUs 0 and 1, and want to compute the load | ||
| 2080 | * differences in waking a task to CPU 0. The additional task changes the | ||
| 2081 | * weight and shares distributions like: | ||
| 2082 | * | ||
| 2083 | * rw'_i = { 3, 4, 1, 0 } | ||
| 2084 | * s'_i = { 3/8, 4/8, 1/8, 0 } | ||
| 2085 | * | ||
| 2086 | * We can then compute the difference in effective weight by using: | ||
| 2087 | * | ||
| 2088 | * dw_i = S * (s'_i - s_i) (3) | ||
| 2089 | * | ||
| 2090 | * Where 'S' is the group weight as seen by its parent. | ||
| 2091 | * | ||
| 2092 | * Therefore the effective change in loads on CPU 0 would be 5/56 (3/8 - 2/7) | ||
| 2093 | * times the weight of the group. The effect on CPU 1 would be -4/56 (4/8 - | ||
| 2094 | * 4/7) times the weight of the group. | ||
| 2039 | */ | 2095 | */ |
| 2040 | static long effective_load(struct task_group *tg, int cpu, long wl, long wg) | 2096 | static long effective_load(struct task_group *tg, int cpu, long wl, long wg) |
| 2041 | { | 2097 | { |
| 2042 | struct sched_entity *se = tg->se[cpu]; | 2098 | struct sched_entity *se = tg->se[cpu]; |
| 2043 | 2099 | ||
| 2044 | if (!tg->parent) | 2100 | if (!tg->parent) /* the trivial, non-cgroup case */ |
| 2045 | return wl; | 2101 | return wl; |
| 2046 | 2102 | ||
| 2047 | for_each_sched_entity(se) { | 2103 | for_each_sched_entity(se) { |
| 2048 | long lw, w; | 2104 | long w, W; |
| 2049 | 2105 | ||
| 2050 | tg = se->my_q->tg; | 2106 | tg = se->my_q->tg; |
| 2051 | w = se->my_q->load.weight; | ||
| 2052 | 2107 | ||
| 2053 | /* use this cpu's instantaneous contribution */ | 2108 | /* |
| 2054 | lw = atomic_read(&tg->load_weight); | 2109 | * W = @wg + \Sum rw_j |
| 2055 | lw -= se->my_q->load_contribution; | 2110 | */ |
| 2056 | lw += w + wg; | 2111 | W = wg + calc_tg_weight(tg, se->my_q); |
| 2057 | 2112 | ||
| 2058 | wl += w; | 2113 | /* |
| 2114 | * w = rw_i + @wl | ||
| 2115 | */ | ||
| 2116 | w = se->my_q->load.weight + wl; | ||
| 2059 | 2117 | ||
| 2060 | if (lw > 0 && wl < lw) | 2118 | /* |
| 2061 | wl = (wl * tg->shares) / lw; | 2119 | * wl = S * s'_i; see (2) |
| 2120 | */ | ||
| 2121 | if (W > 0 && w < W) | ||
| 2122 | wl = (w * tg->shares) / W; | ||
| 2062 | else | 2123 | else |
| 2063 | wl = tg->shares; | 2124 | wl = tg->shares; |
| 2064 | 2125 | ||
| 2065 | /* zero point is MIN_SHARES */ | 2126 | /* |
| 2127 | * Per the above, wl is the new se->load.weight value; since | ||
| 2128 | * those are clipped to [MIN_SHARES, ...) do so now. See | ||
| 2129 | * calc_cfs_shares(). | ||
| 2130 | */ | ||
| 2066 | if (wl < MIN_SHARES) | 2131 | if (wl < MIN_SHARES) |
| 2067 | wl = MIN_SHARES; | 2132 | wl = MIN_SHARES; |
| 2133 | |||
| 2134 | /* | ||
| 2135 | * wl = dw_i = S * (s'_i - s_i); see (3) | ||
| 2136 | */ | ||
| 2068 | wl -= se->load.weight; | 2137 | wl -= se->load.weight; |
| 2138 | |||
| 2139 | /* | ||
| 2140 | * Recursively apply this logic to all parent groups to compute | ||
| 2141 | * the final effective load change on the root group. Since | ||
| 2142 | * only the @tg group gets extra weight, all parent groups can | ||
| 2143 | * only redistribute existing shares. @wl is the shift in shares | ||
| 2144 | * resulting from this level per the above. | ||
| 2145 | */ | ||
| 2069 | wg = 0; | 2146 | wg = 0; |
| 2070 | } | 2147 | } |
| 2071 | 2148 | ||
| @@ -2249,7 +2326,8 @@ static int select_idle_sibling(struct task_struct *p, int target) | |||
| 2249 | int cpu = smp_processor_id(); | 2326 | int cpu = smp_processor_id(); |
| 2250 | int prev_cpu = task_cpu(p); | 2327 | int prev_cpu = task_cpu(p); |
| 2251 | struct sched_domain *sd; | 2328 | struct sched_domain *sd; |
| 2252 | int i; | 2329 | struct sched_group *sg; |
| 2330 | int i, smt = 0; | ||
| 2253 | 2331 | ||
| 2254 | /* | 2332 | /* |
| 2255 | * If the task is going to be woken-up on this cpu and if it is | 2333 | * If the task is going to be woken-up on this cpu and if it is |
| @@ -2269,25 +2347,40 @@ static int select_idle_sibling(struct task_struct *p, int target) | |||
| 2269 | * Otherwise, iterate the domains and find an elegible idle cpu. | 2347 | * Otherwise, iterate the domains and find an elegible idle cpu. |
| 2270 | */ | 2348 | */ |
| 2271 | rcu_read_lock(); | 2349 | rcu_read_lock(); |
| 2350 | again: | ||
| 2272 | for_each_domain(target, sd) { | 2351 | for_each_domain(target, sd) { |
| 2352 | if (!smt && (sd->flags & SD_SHARE_CPUPOWER)) | ||
| 2353 | continue; | ||
| 2354 | |||
| 2355 | if (smt && !(sd->flags & SD_SHARE_CPUPOWER)) | ||
| 2356 | break; | ||
| 2357 | |||
| 2273 | if (!(sd->flags & SD_SHARE_PKG_RESOURCES)) | 2358 | if (!(sd->flags & SD_SHARE_PKG_RESOURCES)) |
| 2274 | break; | 2359 | break; |
| 2275 | 2360 | ||
| 2276 | for_each_cpu_and(i, sched_domain_span(sd), tsk_cpus_allowed(p)) { | 2361 | sg = sd->groups; |
| 2277 | if (idle_cpu(i)) { | 2362 | do { |
| 2278 | target = i; | 2363 | if (!cpumask_intersects(sched_group_cpus(sg), |
| 2279 | break; | 2364 | tsk_cpus_allowed(p))) |
| 2365 | goto next; | ||
| 2366 | |||
| 2367 | for_each_cpu(i, sched_group_cpus(sg)) { | ||
| 2368 | if (!idle_cpu(i)) | ||
| 2369 | goto next; | ||
| 2280 | } | 2370 | } |
| 2281 | } | ||
| 2282 | 2371 | ||
| 2283 | /* | 2372 | target = cpumask_first_and(sched_group_cpus(sg), |
| 2284 | * Lets stop looking for an idle sibling when we reached | 2373 | tsk_cpus_allowed(p)); |
| 2285 | * the domain that spans the current cpu and prev_cpu. | 2374 | goto done; |
| 2286 | */ | 2375 | next: |
| 2287 | if (cpumask_test_cpu(cpu, sched_domain_span(sd)) && | 2376 | sg = sg->next; |
| 2288 | cpumask_test_cpu(prev_cpu, sched_domain_span(sd))) | 2377 | } while (sg != sd->groups); |
| 2289 | break; | 2378 | } |
| 2379 | if (!smt) { | ||
| 2380 | smt = 1; | ||
| 2381 | goto again; | ||
| 2290 | } | 2382 | } |
| 2383 | done: | ||
| 2291 | rcu_read_unlock(); | 2384 | rcu_read_unlock(); |
| 2292 | 2385 | ||
| 2293 | return target; | 2386 | return target; |
| @@ -3511,7 +3604,7 @@ static bool update_sd_pick_busiest(struct sched_domain *sd, | |||
| 3511 | } | 3604 | } |
| 3512 | 3605 | ||
| 3513 | /** | 3606 | /** |
| 3514 | * update_sd_lb_stats - Update sched_group's statistics for load balancing. | 3607 | * update_sd_lb_stats - Update sched_domain's statistics for load balancing. |
| 3515 | * @sd: sched_domain whose statistics are to be updated. | 3608 | * @sd: sched_domain whose statistics are to be updated. |
| 3516 | * @this_cpu: Cpu for which load balance is currently performed. | 3609 | * @this_cpu: Cpu for which load balance is currently performed. |
| 3517 | * @idle: Idle status of this_cpu | 3610 | * @idle: Idle status of this_cpu |
diff --git a/kernel/sched_features.h b/kernel/sched_features.h index efa0a7b75dde..84802245abd2 100644 --- a/kernel/sched_features.h +++ b/kernel/sched_features.h | |||
| @@ -67,3 +67,4 @@ SCHED_FEAT(NONTASK_POWER, 1) | |||
| 67 | SCHED_FEAT(TTWU_QUEUE, 1) | 67 | SCHED_FEAT(TTWU_QUEUE, 1) |
| 68 | 68 | ||
| 69 | SCHED_FEAT(FORCE_SD_OVERLAP, 0) | 69 | SCHED_FEAT(FORCE_SD_OVERLAP, 0) |
| 70 | SCHED_FEAT(RT_RUNTIME_SHARE, 1) | ||
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index 056cbd2e2a27..583a1368afe6 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
| @@ -560,6 +560,9 @@ static int balance_runtime(struct rt_rq *rt_rq) | |||
| 560 | { | 560 | { |
| 561 | int more = 0; | 561 | int more = 0; |
| 562 | 562 | ||
| 563 | if (!sched_feat(RT_RUNTIME_SHARE)) | ||
| 564 | return more; | ||
| 565 | |||
| 563 | if (rt_rq->rt_time > rt_rq->rt_runtime) { | 566 | if (rt_rq->rt_time > rt_rq->rt_runtime) { |
| 564 | raw_spin_unlock(&rt_rq->rt_runtime_lock); | 567 | raw_spin_unlock(&rt_rq->rt_runtime_lock); |
| 565 | more = do_balance_runtime(rt_rq); | 568 | more = do_balance_runtime(rt_rq); |
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c index 6318b511afa1..a650694883a1 100644 --- a/kernel/sysctl_binary.c +++ b/kernel/sysctl_binary.c | |||
| @@ -1354,7 +1354,7 @@ static ssize_t binary_sysctl(const int *name, int nlen, | |||
| 1354 | 1354 | ||
| 1355 | fput(file); | 1355 | fput(file); |
| 1356 | out_putname: | 1356 | out_putname: |
| 1357 | putname(pathname); | 1357 | __putname(pathname); |
| 1358 | out: | 1358 | out: |
| 1359 | return result; | 1359 | return result; |
| 1360 | } | 1360 | } |
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index c436e790b21b..8a46f5d64504 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c | |||
| @@ -195,7 +195,7 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer) | |||
| 195 | struct alarm *alarm; | 195 | struct alarm *alarm; |
| 196 | ktime_t expired = next->expires; | 196 | ktime_t expired = next->expires; |
| 197 | 197 | ||
| 198 | if (expired.tv64 >= now.tv64) | 198 | if (expired.tv64 > now.tv64) |
| 199 | break; | 199 | break; |
| 200 | 200 | ||
| 201 | alarm = container_of(next, struct alarm, node); | 201 | alarm = container_of(next, struct alarm, node); |
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 1ecd6ba36d6c..c4eb71c8b2ea 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
| @@ -387,6 +387,7 @@ void clockevents_exchange_device(struct clock_event_device *old, | |||
| 387 | * released list and do a notify add later. | 387 | * released list and do a notify add later. |
| 388 | */ | 388 | */ |
| 389 | if (old) { | 389 | if (old) { |
| 390 | old->event_handler = clockevents_handle_noop; | ||
| 390 | clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED); | 391 | clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED); |
| 391 | list_del(&old->list); | 392 | list_del(&old->list); |
| 392 | list_add(&old->list, &clockevents_released); | 393 | list_add(&old->list, &clockevents_released); |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index cfc65e1eb9fb..d3ad022136e5 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
| @@ -548,7 +548,7 @@ static u64 clocksource_max_deferment(struct clocksource *cs) | |||
| 548 | * note a margin of 12.5% is used because this can be computed with | 548 | * note a margin of 12.5% is used because this can be computed with |
| 549 | * a shift, versus say 10% which would require division. | 549 | * a shift, versus say 10% which would require division. |
| 550 | */ | 550 | */ |
| 551 | return max_nsecs - (max_nsecs >> 5); | 551 | return max_nsecs - (max_nsecs >> 3); |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET | 554 | #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET |
| @@ -647,7 +647,7 @@ static void clocksource_enqueue(struct clocksource *cs) | |||
| 647 | 647 | ||
| 648 | /** | 648 | /** |
| 649 | * __clocksource_updatefreq_scale - Used update clocksource with new freq | 649 | * __clocksource_updatefreq_scale - Used update clocksource with new freq |
| 650 | * @t: clocksource to be registered | 650 | * @cs: clocksource to be registered |
| 651 | * @scale: Scale factor multiplied against freq to get clocksource hz | 651 | * @scale: Scale factor multiplied against freq to get clocksource hz |
| 652 | * @freq: clocksource frequency (cycles per second) divided by scale | 652 | * @freq: clocksource frequency (cycles per second) divided by scale |
| 653 | * | 653 | * |
| @@ -669,7 +669,7 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq) | |||
| 669 | * ~ 0.06ppm granularity for NTP. We apply the same 12.5% | 669 | * ~ 0.06ppm granularity for NTP. We apply the same 12.5% |
| 670 | * margin as we do in clocksource_max_deferment() | 670 | * margin as we do in clocksource_max_deferment() |
| 671 | */ | 671 | */ |
| 672 | sec = (cs->mask - (cs->mask >> 5)); | 672 | sec = (cs->mask - (cs->mask >> 3)); |
| 673 | do_div(sec, freq); | 673 | do_div(sec, freq); |
| 674 | do_div(sec, scale); | 674 | do_div(sec, scale); |
| 675 | if (!sec) | 675 | if (!sec) |
| @@ -699,7 +699,7 @@ EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale); | |||
| 699 | 699 | ||
| 700 | /** | 700 | /** |
| 701 | * __clocksource_register_scale - Used to install new clocksources | 701 | * __clocksource_register_scale - Used to install new clocksources |
| 702 | * @t: clocksource to be registered | 702 | * @cs: clocksource to be registered |
| 703 | * @scale: Scale factor multiplied against freq to get clocksource hz | 703 | * @scale: Scale factor multiplied against freq to get clocksource hz |
| 704 | * @freq: clocksource frequency (cycles per second) divided by scale | 704 | * @freq: clocksource frequency (cycles per second) divided by scale |
| 705 | * | 705 | * |
| @@ -727,7 +727,7 @@ EXPORT_SYMBOL_GPL(__clocksource_register_scale); | |||
| 727 | 727 | ||
| 728 | /** | 728 | /** |
| 729 | * clocksource_register - Used to install new clocksources | 729 | * clocksource_register - Used to install new clocksources |
| 730 | * @t: clocksource to be registered | 730 | * @cs: clocksource to be registered |
| 731 | * | 731 | * |
| 732 | * Returns -EBUSY if registration fails, zero otherwise. | 732 | * Returns -EBUSY if registration fails, zero otherwise. |
| 733 | */ | 733 | */ |
| @@ -761,6 +761,8 @@ static void __clocksource_change_rating(struct clocksource *cs, int rating) | |||
| 761 | 761 | ||
| 762 | /** | 762 | /** |
| 763 | * clocksource_change_rating - Change the rating of a registered clocksource | 763 | * clocksource_change_rating - Change the rating of a registered clocksource |
| 764 | * @cs: clocksource to be changed | ||
| 765 | * @rating: new rating | ||
| 764 | */ | 766 | */ |
| 765 | void clocksource_change_rating(struct clocksource *cs, int rating) | 767 | void clocksource_change_rating(struct clocksource *cs, int rating) |
| 766 | { | 768 | { |
| @@ -772,6 +774,7 @@ EXPORT_SYMBOL(clocksource_change_rating); | |||
| 772 | 774 | ||
| 773 | /** | 775 | /** |
| 774 | * clocksource_unregister - remove a registered clocksource | 776 | * clocksource_unregister - remove a registered clocksource |
| 777 | * @cs: clocksource to be unregistered | ||
| 775 | */ | 778 | */ |
| 776 | void clocksource_unregister(struct clocksource *cs) | 779 | void clocksource_unregister(struct clocksource *cs) |
| 777 | { | 780 | { |
| @@ -787,6 +790,7 @@ EXPORT_SYMBOL(clocksource_unregister); | |||
| 787 | /** | 790 | /** |
| 788 | * sysfs_show_current_clocksources - sysfs interface for current clocksource | 791 | * sysfs_show_current_clocksources - sysfs interface for current clocksource |
| 789 | * @dev: unused | 792 | * @dev: unused |
| 793 | * @attr: unused | ||
| 790 | * @buf: char buffer to be filled with clocksource list | 794 | * @buf: char buffer to be filled with clocksource list |
| 791 | * | 795 | * |
| 792 | * Provides sysfs interface for listing current clocksource. | 796 | * Provides sysfs interface for listing current clocksource. |
| @@ -807,6 +811,7 @@ sysfs_show_current_clocksources(struct sys_device *dev, | |||
| 807 | /** | 811 | /** |
| 808 | * sysfs_override_clocksource - interface for manually overriding clocksource | 812 | * sysfs_override_clocksource - interface for manually overriding clocksource |
| 809 | * @dev: unused | 813 | * @dev: unused |
| 814 | * @attr: unused | ||
| 810 | * @buf: name of override clocksource | 815 | * @buf: name of override clocksource |
| 811 | * @count: length of buffer | 816 | * @count: length of buffer |
| 812 | * | 817 | * |
| @@ -842,6 +847,7 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev, | |||
| 842 | /** | 847 | /** |
| 843 | * sysfs_show_available_clocksources - sysfs interface for listing clocksource | 848 | * sysfs_show_available_clocksources - sysfs interface for listing clocksource |
| 844 | * @dev: unused | 849 | * @dev: unused |
| 850 | * @attr: unused | ||
| 845 | * @buf: char buffer to be filled with clocksource list | 851 | * @buf: char buffer to be filled with clocksource list |
| 846 | * | 852 | * |
| 847 | * Provides sysfs interface for listing registered clocksources | 853 | * Provides sysfs interface for listing registered clocksources |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index f954282d9a82..fd4a7b1625a2 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
| @@ -71,7 +71,7 @@ int tick_check_broadcast_device(struct clock_event_device *dev) | |||
| 71 | (dev->features & CLOCK_EVT_FEAT_C3STOP)) | 71 | (dev->features & CLOCK_EVT_FEAT_C3STOP)) |
| 72 | return 0; | 72 | return 0; |
| 73 | 73 | ||
| 74 | clockevents_exchange_device(NULL, dev); | 74 | clockevents_exchange_device(tick_broadcast_device.evtdev, dev); |
| 75 | tick_broadcast_device.evtdev = dev; | 75 | tick_broadcast_device.evtdev = dev; |
| 76 | if (!cpumask_empty(tick_get_broadcast_mask())) | 76 | if (!cpumask_empty(tick_get_broadcast_mask())) |
| 77 | tick_broadcast_start_periodic(dev); | 77 | tick_broadcast_start_periodic(dev); |
diff --git a/kernel/timer.c b/kernel/timer.c index dbaa62422b13..9c3c62b0c4bc 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
| @@ -1368,7 +1368,7 @@ SYSCALL_DEFINE0(getppid) | |||
| 1368 | int pid; | 1368 | int pid; |
| 1369 | 1369 | ||
| 1370 | rcu_read_lock(); | 1370 | rcu_read_lock(); |
| 1371 | pid = task_tgid_vnr(current->real_parent); | 1371 | pid = task_tgid_vnr(rcu_dereference(current->real_parent)); |
| 1372 | rcu_read_unlock(); | 1372 | rcu_read_unlock(); |
| 1373 | 1373 | ||
| 1374 | return pid; | 1374 | return pid; |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 900b409543db..b1e8943fed1d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -152,7 +152,6 @@ void clear_ftrace_function(void) | |||
| 152 | ftrace_pid_function = ftrace_stub; | 152 | ftrace_pid_function = ftrace_stub; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | #undef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST | ||
| 156 | #ifndef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST | 155 | #ifndef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST |
| 157 | /* | 156 | /* |
| 158 | * For those archs that do not test ftrace_trace_stop in their | 157 | * For those archs that do not test ftrace_trace_stop in their |
| @@ -1212,7 +1211,9 @@ ftrace_hash_move(struct ftrace_ops *ops, int enable, | |||
| 1212 | if (!src->count) { | 1211 | if (!src->count) { |
| 1213 | free_ftrace_hash_rcu(*dst); | 1212 | free_ftrace_hash_rcu(*dst); |
| 1214 | rcu_assign_pointer(*dst, EMPTY_HASH); | 1213 | rcu_assign_pointer(*dst, EMPTY_HASH); |
| 1215 | return 0; | 1214 | /* still need to update the function records */ |
| 1215 | ret = 0; | ||
| 1216 | goto out; | ||
| 1216 | } | 1217 | } |
| 1217 | 1218 | ||
| 1218 | /* | 1219 | /* |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 581876f9f387..c212a7f934ec 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
| @@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events) | |||
| 1078 | /* First see if we did not already create this dir */ | 1078 | /* First see if we did not already create this dir */ |
| 1079 | list_for_each_entry(system, &event_subsystems, list) { | 1079 | list_for_each_entry(system, &event_subsystems, list) { |
| 1080 | if (strcmp(system->name, name) == 0) { | 1080 | if (strcmp(system->name, name) == 0) { |
| 1081 | __get_system(system); | ||
| 1082 | system->nr_events++; | 1081 | system->nr_events++; |
| 1083 | return system->entry; | 1082 | return system->entry; |
| 1084 | } | 1083 | } |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 816d3d074979..95dc31efd6dd 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
| @@ -1649,7 +1649,9 @@ static int replace_system_preds(struct event_subsystem *system, | |||
| 1649 | */ | 1649 | */ |
| 1650 | err = replace_preds(call, NULL, ps, filter_string, true); | 1650 | err = replace_preds(call, NULL, ps, filter_string, true); |
| 1651 | if (err) | 1651 | if (err) |
| 1652 | goto fail; | 1652 | call->flags |= TRACE_EVENT_FL_NO_SET_FILTER; |
| 1653 | else | ||
| 1654 | call->flags &= ~TRACE_EVENT_FL_NO_SET_FILTER; | ||
| 1653 | } | 1655 | } |
| 1654 | 1656 | ||
| 1655 | list_for_each_entry(call, &ftrace_events, list) { | 1657 | list_for_each_entry(call, &ftrace_events, list) { |
| @@ -1658,6 +1660,9 @@ static int replace_system_preds(struct event_subsystem *system, | |||
| 1658 | if (strcmp(call->class->system, system->name) != 0) | 1660 | if (strcmp(call->class->system, system->name) != 0) |
| 1659 | continue; | 1661 | continue; |
| 1660 | 1662 | ||
| 1663 | if (call->flags & TRACE_EVENT_FL_NO_SET_FILTER) | ||
| 1664 | continue; | ||
| 1665 | |||
| 1661 | filter_item = kzalloc(sizeof(*filter_item), GFP_KERNEL); | 1666 | filter_item = kzalloc(sizeof(*filter_item), GFP_KERNEL); |
| 1662 | if (!filter_item) | 1667 | if (!filter_item) |
| 1663 | goto fail_mem; | 1668 | goto fail_mem; |
| @@ -1686,7 +1691,7 @@ static int replace_system_preds(struct event_subsystem *system, | |||
| 1686 | * replace the filter for the call. | 1691 | * replace the filter for the call. |
| 1687 | */ | 1692 | */ |
| 1688 | filter = call->filter; | 1693 | filter = call->filter; |
| 1689 | call->filter = filter_item->filter; | 1694 | rcu_assign_pointer(call->filter, filter_item->filter); |
| 1690 | filter_item->filter = filter; | 1695 | filter_item->filter = filter; |
| 1691 | 1696 | ||
| 1692 | fail = false; | 1697 | fail = false; |
| @@ -1741,7 +1746,7 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string) | |||
| 1741 | filter = call->filter; | 1746 | filter = call->filter; |
| 1742 | if (!filter) | 1747 | if (!filter) |
| 1743 | goto out_unlock; | 1748 | goto out_unlock; |
| 1744 | call->filter = NULL; | 1749 | RCU_INIT_POINTER(call->filter, NULL); |
| 1745 | /* Make sure the filter is not being used */ | 1750 | /* Make sure the filter is not being used */ |
| 1746 | synchronize_sched(); | 1751 | synchronize_sched(); |
| 1747 | __free_filter(filter); | 1752 | __free_filter(filter); |
| @@ -1782,7 +1787,7 @@ out: | |||
| 1782 | * string | 1787 | * string |
| 1783 | */ | 1788 | */ |
| 1784 | tmp = call->filter; | 1789 | tmp = call->filter; |
| 1785 | call->filter = filter; | 1790 | rcu_assign_pointer(call->filter, filter); |
| 1786 | if (tmp) { | 1791 | if (tmp) { |
| 1787 | /* Make sure the call is done with the filter */ | 1792 | /* Make sure the call is done with the filter */ |
| 1788 | synchronize_sched(); | 1793 | synchronize_sched(); |
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 74c6c7fce749..fea790a2b176 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
| @@ -245,7 +245,7 @@ static void put_hash_bucket(struct hash_bucket *bucket, | |||
| 245 | 245 | ||
| 246 | static bool exact_match(struct dma_debug_entry *a, struct dma_debug_entry *b) | 246 | static bool exact_match(struct dma_debug_entry *a, struct dma_debug_entry *b) |
| 247 | { | 247 | { |
| 248 | return ((a->dev_addr == a->dev_addr) && | 248 | return ((a->dev_addr == b->dev_addr) && |
| 249 | (a->dev == b->dev)) ? true : false; | 249 | (a->dev == b->dev)) ? true : false; |
| 250 | } | 250 | } |
| 251 | 251 | ||
diff --git a/mm/filemap.c b/mm/filemap.c index c0018f2d50e0..5f0a3c91fdac 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
| @@ -1828,7 +1828,7 @@ repeat: | |||
| 1828 | page = __page_cache_alloc(gfp | __GFP_COLD); | 1828 | page = __page_cache_alloc(gfp | __GFP_COLD); |
| 1829 | if (!page) | 1829 | if (!page) |
| 1830 | return ERR_PTR(-ENOMEM); | 1830 | return ERR_PTR(-ENOMEM); |
| 1831 | err = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL); | 1831 | err = add_to_page_cache_lru(page, mapping, index, gfp); |
| 1832 | if (unlikely(err)) { | 1832 | if (unlikely(err)) { |
| 1833 | page_cache_release(page); | 1833 | page_cache_release(page); |
| 1834 | if (err == -EEXIST) | 1834 | if (err == -EEXIST) |
| @@ -1925,10 +1925,7 @@ static struct page *wait_on_page_read(struct page *page) | |||
| 1925 | * @gfp: the page allocator flags to use if allocating | 1925 | * @gfp: the page allocator flags to use if allocating |
| 1926 | * | 1926 | * |
| 1927 | * This is the same as "read_mapping_page(mapping, index, NULL)", but with | 1927 | * This is the same as "read_mapping_page(mapping, index, NULL)", but with |
| 1928 | * any new page allocations done using the specified allocation flags. Note | 1928 | * any new page allocations done using the specified allocation flags. |
| 1929 | * that the Radix tree operations will still use GFP_KERNEL, so you can't | ||
| 1930 | * expect to do this atomically or anything like that - but you can pass in | ||
| 1931 | * other page requirements. | ||
| 1932 | * | 1929 | * |
| 1933 | * If the page does not get brought uptodate, return -EIO. | 1930 | * If the page does not get brought uptodate, return -EIO. |
| 1934 | */ | 1931 | */ |
| @@ -2407,7 +2404,6 @@ static ssize_t generic_perform_write(struct file *file, | |||
| 2407 | iov_iter_count(i)); | 2404 | iov_iter_count(i)); |
| 2408 | 2405 | ||
| 2409 | again: | 2406 | again: |
| 2410 | |||
| 2411 | /* | 2407 | /* |
| 2412 | * Bring in the user page that we will copy from _first_. | 2408 | * Bring in the user page that we will copy from _first_. |
| 2413 | * Otherwise there's a nasty deadlock on copying from the | 2409 | * Otherwise there's a nasty deadlock on copying from the |
| @@ -2463,7 +2459,10 @@ again: | |||
| 2463 | written += copied; | 2459 | written += copied; |
| 2464 | 2460 | ||
| 2465 | balance_dirty_pages_ratelimited(mapping); | 2461 | balance_dirty_pages_ratelimited(mapping); |
| 2466 | 2462 | if (fatal_signal_pending(current)) { | |
| 2463 | status = -EINTR; | ||
| 2464 | break; | ||
| 2465 | } | ||
| 2467 | } while (iov_iter_count(i)); | 2466 | } while (iov_iter_count(i)); |
| 2468 | 2467 | ||
| 2469 | return written ? written : status; | 2468 | return written ? written : status; |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 4298abaae153..36b3d988b4ef 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
| @@ -2259,12 +2259,8 @@ static void khugepaged_do_scan(struct page **hpage) | |||
| 2259 | 2259 | ||
| 2260 | static void khugepaged_alloc_sleep(void) | 2260 | static void khugepaged_alloc_sleep(void) |
| 2261 | { | 2261 | { |
| 2262 | DEFINE_WAIT(wait); | 2262 | wait_event_freezable_timeout(khugepaged_wait, false, |
| 2263 | add_wait_queue(&khugepaged_wait, &wait); | 2263 | msecs_to_jiffies(khugepaged_alloc_sleep_millisecs)); |
| 2264 | schedule_timeout_interruptible( | ||
| 2265 | msecs_to_jiffies( | ||
| 2266 | khugepaged_alloc_sleep_millisecs)); | ||
| 2267 | remove_wait_queue(&khugepaged_wait, &wait); | ||
| 2268 | } | 2264 | } |
| 2269 | 2265 | ||
| 2270 | #ifndef CONFIG_NUMA | 2266 | #ifndef CONFIG_NUMA |
| @@ -2313,14 +2309,10 @@ static void khugepaged_loop(void) | |||
| 2313 | if (unlikely(kthread_should_stop())) | 2309 | if (unlikely(kthread_should_stop())) |
| 2314 | break; | 2310 | break; |
| 2315 | if (khugepaged_has_work()) { | 2311 | if (khugepaged_has_work()) { |
| 2316 | DEFINE_WAIT(wait); | ||
| 2317 | if (!khugepaged_scan_sleep_millisecs) | 2312 | if (!khugepaged_scan_sleep_millisecs) |
| 2318 | continue; | 2313 | continue; |
| 2319 | add_wait_queue(&khugepaged_wait, &wait); | 2314 | wait_event_freezable_timeout(khugepaged_wait, false, |
| 2320 | schedule_timeout_interruptible( | 2315 | msecs_to_jiffies(khugepaged_scan_sleep_millisecs)); |
| 2321 | msecs_to_jiffies( | ||
| 2322 | khugepaged_scan_sleep_millisecs)); | ||
| 2323 | remove_wait_queue(&khugepaged_wait, &wait); | ||
| 2324 | } else if (khugepaged_enabled()) | 2316 | } else if (khugepaged_enabled()) |
| 2325 | wait_event_freezable(khugepaged_wait, | 2317 | wait_event_freezable(khugepaged_wait, |
| 2326 | khugepaged_wait_event()); | 2318 | khugepaged_wait_event()); |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index bb28a5f9db8d..73f17c0293c0 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
| @@ -576,6 +576,7 @@ static void prep_compound_gigantic_page(struct page *page, unsigned long order) | |||
| 576 | __SetPageHead(page); | 576 | __SetPageHead(page); |
| 577 | for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) { | 577 | for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) { |
| 578 | __SetPageTail(p); | 578 | __SetPageTail(p); |
| 579 | set_page_count(p, 0); | ||
| 579 | p->first_page = page; | 580 | p->first_page = page; |
| 580 | } | 581 | } |
| 581 | } | 582 | } |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 6aff93c98aca..b63f5f7dfa07 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -4907,9 +4907,9 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) | |||
| 4907 | int cpu; | 4907 | int cpu; |
| 4908 | enable_swap_cgroup(); | 4908 | enable_swap_cgroup(); |
| 4909 | parent = NULL; | 4909 | parent = NULL; |
| 4910 | root_mem_cgroup = memcg; | ||
| 4911 | if (mem_cgroup_soft_limit_tree_init()) | 4910 | if (mem_cgroup_soft_limit_tree_init()) |
| 4912 | goto free_out; | 4911 | goto free_out; |
| 4912 | root_mem_cgroup = memcg; | ||
| 4913 | for_each_possible_cpu(cpu) { | 4913 | for_each_possible_cpu(cpu) { |
| 4914 | struct memcg_stock_pcp *stock = | 4914 | struct memcg_stock_pcp *stock = |
| 4915 | &per_cpu(memcg_stock, cpu); | 4915 | &per_cpu(memcg_stock, cpu); |
| @@ -4948,7 +4948,6 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) | |||
| 4948 | return &memcg->css; | 4948 | return &memcg->css; |
| 4949 | free_out: | 4949 | free_out: |
| 4950 | __mem_cgroup_free(memcg); | 4950 | __mem_cgroup_free(memcg); |
| 4951 | root_mem_cgroup = NULL; | ||
| 4952 | return ERR_PTR(error); | 4951 | return ERR_PTR(error); |
| 4953 | } | 4952 | } |
| 4954 | 4953 | ||
diff --git a/mm/migrate.c b/mm/migrate.c index 578e29174fa6..177aca424a06 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
| @@ -871,9 +871,9 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, | |||
| 871 | 871 | ||
| 872 | if (anon_vma) | 872 | if (anon_vma) |
| 873 | put_anon_vma(anon_vma); | 873 | put_anon_vma(anon_vma); |
| 874 | out: | ||
| 875 | unlock_page(hpage); | 874 | unlock_page(hpage); |
| 876 | 875 | ||
| 876 | out: | ||
| 877 | if (rc != -EAGAIN) { | 877 | if (rc != -EAGAIN) { |
| 878 | list_del(&hpage->lru); | 878 | list_del(&hpage->lru); |
| 879 | put_page(hpage); | 879 | put_page(hpage); |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 76f2c5ae908e..069b64e521fc 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
| @@ -176,7 +176,7 @@ static bool oom_unkillable_task(struct task_struct *p, | |||
| 176 | unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, | 176 | unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, |
| 177 | const nodemask_t *nodemask, unsigned long totalpages) | 177 | const nodemask_t *nodemask, unsigned long totalpages) |
| 178 | { | 178 | { |
| 179 | int points; | 179 | long points; |
| 180 | 180 | ||
| 181 | if (oom_unkillable_task(p, mem, nodemask)) | 181 | if (oom_unkillable_task(p, mem, nodemask)) |
| 182 | return 0; | 182 | return 0; |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 71252486bc6f..50f08241f981 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
| @@ -411,8 +411,13 @@ void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty) | |||
| 411 | * | 411 | * |
| 412 | * Returns @bdi's dirty limit in pages. The term "dirty" in the context of | 412 | * Returns @bdi's dirty limit in pages. The term "dirty" in the context of |
| 413 | * dirty balancing includes all PG_dirty, PG_writeback and NFS unstable pages. | 413 | * dirty balancing includes all PG_dirty, PG_writeback and NFS unstable pages. |
| 414 | * And the "limit" in the name is not seriously taken as hard limit in | 414 | * |
| 415 | * balance_dirty_pages(). | 415 | * Note that balance_dirty_pages() will only seriously take it as a hard limit |
| 416 | * when sleeping max_pause per page is not enough to keep the dirty pages under | ||
| 417 | * control. For example, when the device is completely stalled due to some error | ||
| 418 | * conditions, or when there are 1000 dd tasks writing to a slow 10MB/s USB key. | ||
| 419 | * In the other normal situations, it acts more gently by throttling the tasks | ||
| 420 | * more (rather than completely block them) when the bdi dirty pages go high. | ||
| 416 | * | 421 | * |
| 417 | * It allocates high/low dirty limits to fast/slow devices, in order to prevent | 422 | * It allocates high/low dirty limits to fast/slow devices, in order to prevent |
| 418 | * - starving fast devices | 423 | * - starving fast devices |
| @@ -594,6 +599,13 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi, | |||
| 594 | */ | 599 | */ |
| 595 | if (unlikely(bdi_thresh > thresh)) | 600 | if (unlikely(bdi_thresh > thresh)) |
| 596 | bdi_thresh = thresh; | 601 | bdi_thresh = thresh; |
| 602 | /* | ||
| 603 | * It's very possible that bdi_thresh is close to 0 not because the | ||
| 604 | * device is slow, but that it has remained inactive for long time. | ||
| 605 | * Honour such devices a reasonable good (hopefully IO efficient) | ||
| 606 | * threshold, so that the occasional writes won't be blocked and active | ||
| 607 | * writes can rampup the threshold quickly. | ||
| 608 | */ | ||
| 597 | bdi_thresh = max(bdi_thresh, (limit - dirty) / 8); | 609 | bdi_thresh = max(bdi_thresh, (limit - dirty) / 8); |
| 598 | /* | 610 | /* |
| 599 | * scale global setpoint to bdi's: | 611 | * scale global setpoint to bdi's: |
| @@ -977,8 +989,7 @@ static unsigned long bdi_max_pause(struct backing_dev_info *bdi, | |||
| 977 | * | 989 | * |
| 978 | * 8 serves as the safety ratio. | 990 | * 8 serves as the safety ratio. |
| 979 | */ | 991 | */ |
| 980 | if (bdi_dirty) | 992 | t = min(t, bdi_dirty * HZ / (8 * bw + 1)); |
| 981 | t = min(t, bdi_dirty * HZ / (8 * bw + 1)); | ||
| 982 | 993 | ||
| 983 | /* | 994 | /* |
| 984 | * The pause time will be settled within range (max_pause/4, max_pause). | 995 | * The pause time will be settled within range (max_pause/4, max_pause). |
| @@ -1136,6 +1147,19 @@ pause: | |||
| 1136 | if (task_ratelimit) | 1147 | if (task_ratelimit) |
| 1137 | break; | 1148 | break; |
| 1138 | 1149 | ||
| 1150 | /* | ||
| 1151 | * In the case of an unresponding NFS server and the NFS dirty | ||
| 1152 | * pages exceeds dirty_thresh, give the other good bdi's a pipe | ||
| 1153 | * to go through, so that tasks on them still remain responsive. | ||
| 1154 | * | ||
| 1155 | * In theory 1 page is enough to keep the comsumer-producer | ||
| 1156 | * pipe going: the flusher cleans 1 page => the task dirties 1 | ||
| 1157 | * more page. However bdi_dirty has accounting errors. So use | ||
| 1158 | * the larger and more IO friendly bdi_stat_error. | ||
| 1159 | */ | ||
| 1160 | if (bdi_dirty <= bdi_stat_error(bdi)) | ||
| 1161 | break; | ||
| 1162 | |||
| 1139 | if (fatal_signal_pending(current)) | 1163 | if (fatal_signal_pending(current)) |
| 1140 | break; | 1164 | break; |
| 1141 | } | 1165 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9dd443d89d8b..2b8ba3aebf6e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
| @@ -356,8 +356,8 @@ void prep_compound_page(struct page *page, unsigned long order) | |||
| 356 | __SetPageHead(page); | 356 | __SetPageHead(page); |
| 357 | for (i = 1; i < nr_pages; i++) { | 357 | for (i = 1; i < nr_pages; i++) { |
| 358 | struct page *p = page + i; | 358 | struct page *p = page + i; |
| 359 | |||
| 360 | __SetPageTail(p); | 359 | __SetPageTail(p); |
| 360 | set_page_count(p, 0); | ||
| 361 | p->first_page = page; | 361 | p->first_page = page; |
| 362 | } | 362 | } |
| 363 | } | 363 | } |
| @@ -3377,9 +3377,15 @@ static void setup_zone_migrate_reserve(struct zone *zone) | |||
| 3377 | unsigned long block_migratetype; | 3377 | unsigned long block_migratetype; |
| 3378 | int reserve; | 3378 | int reserve; |
| 3379 | 3379 | ||
| 3380 | /* Get the start pfn, end pfn and the number of blocks to reserve */ | 3380 | /* |
| 3381 | * Get the start pfn, end pfn and the number of blocks to reserve | ||
| 3382 | * We have to be careful to be aligned to pageblock_nr_pages to | ||
| 3383 | * make sure that we always check pfn_valid for the first page in | ||
| 3384 | * the block. | ||
| 3385 | */ | ||
| 3381 | start_pfn = zone->zone_start_pfn; | 3386 | start_pfn = zone->zone_start_pfn; |
| 3382 | end_pfn = start_pfn + zone->spanned_pages; | 3387 | end_pfn = start_pfn + zone->spanned_pages; |
| 3388 | start_pfn = roundup(start_pfn, pageblock_nr_pages); | ||
| 3383 | reserve = roundup(min_wmark_pages(zone), pageblock_nr_pages) >> | 3389 | reserve = roundup(min_wmark_pages(zone), pageblock_nr_pages) >> |
| 3384 | pageblock_order; | 3390 | pageblock_order; |
| 3385 | 3391 | ||
diff --git a/mm/percpu.c b/mm/percpu.c index 3bb810a72006..716eb4acf2fc 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
| @@ -1023,9 +1023,11 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr) | |||
| 1023 | if (!is_vmalloc_addr(addr)) | 1023 | if (!is_vmalloc_addr(addr)) |
| 1024 | return __pa(addr); | 1024 | return __pa(addr); |
| 1025 | else | 1025 | else |
| 1026 | return page_to_phys(vmalloc_to_page(addr)); | 1026 | return page_to_phys(vmalloc_to_page(addr)) + |
| 1027 | offset_in_page(addr); | ||
| 1027 | } else | 1028 | } else |
| 1028 | return page_to_phys(pcpu_addr_to_page(addr)); | 1029 | return page_to_phys(pcpu_addr_to_page(addr)) + |
| 1030 | offset_in_page(addr); | ||
| 1029 | } | 1031 | } |
| 1030 | 1032 | ||
| 1031 | /** | 1033 | /** |
| @@ -595,6 +595,7 @@ static enum { | |||
| 595 | PARTIAL_AC, | 595 | PARTIAL_AC, |
| 596 | PARTIAL_L3, | 596 | PARTIAL_L3, |
| 597 | EARLY, | 597 | EARLY, |
| 598 | LATE, | ||
| 598 | FULL | 599 | FULL |
| 599 | } g_cpucache_up; | 600 | } g_cpucache_up; |
| 600 | 601 | ||
| @@ -671,7 +672,7 @@ static void init_node_lock_keys(int q) | |||
| 671 | { | 672 | { |
| 672 | struct cache_sizes *s = malloc_sizes; | 673 | struct cache_sizes *s = malloc_sizes; |
| 673 | 674 | ||
| 674 | if (g_cpucache_up != FULL) | 675 | if (g_cpucache_up < LATE) |
| 675 | return; | 676 | return; |
| 676 | 677 | ||
| 677 | for (s = malloc_sizes; s->cs_size != ULONG_MAX; s++) { | 678 | for (s = malloc_sizes; s->cs_size != ULONG_MAX; s++) { |
| @@ -1666,6 +1667,8 @@ void __init kmem_cache_init_late(void) | |||
| 1666 | { | 1667 | { |
| 1667 | struct kmem_cache *cachep; | 1668 | struct kmem_cache *cachep; |
| 1668 | 1669 | ||
| 1670 | g_cpucache_up = LATE; | ||
| 1671 | |||
| 1669 | /* Annotate slab for lockdep -- annotate the malloc caches */ | 1672 | /* Annotate slab for lockdep -- annotate the malloc caches */ |
| 1670 | init_lock_keys(); | 1673 | init_lock_keys(); |
| 1671 | 1674 | ||
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 3231bf332878..27be2f0d4cb7 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
| @@ -1290,7 +1290,7 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, | |||
| 1290 | unsigned long align, unsigned long flags, unsigned long start, | 1290 | unsigned long align, unsigned long flags, unsigned long start, |
| 1291 | unsigned long end, int node, gfp_t gfp_mask, void *caller) | 1291 | unsigned long end, int node, gfp_t gfp_mask, void *caller) |
| 1292 | { | 1292 | { |
| 1293 | static struct vmap_area *va; | 1293 | struct vmap_area *va; |
| 1294 | struct vm_struct *area; | 1294 | struct vm_struct *area; |
| 1295 | 1295 | ||
| 1296 | BUG_ON(in_interrupt()); | 1296 | BUG_ON(in_interrupt()); |
| @@ -1633,6 +1633,8 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, | |||
| 1633 | goto fail; | 1633 | goto fail; |
| 1634 | 1634 | ||
| 1635 | addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller); | 1635 | addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller); |
| 1636 | if (!addr) | ||
| 1637 | return NULL; | ||
| 1636 | 1638 | ||
| 1637 | /* | 1639 | /* |
| 1638 | * In this function, newly allocated vm_struct is not added | 1640 | * In this function, newly allocated vm_struct is not added |
diff --git a/mm/vmscan.c b/mm/vmscan.c index a1893c050795..f54a05b7a61d 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
| @@ -183,7 +183,7 @@ static unsigned long zone_nr_lru_pages(struct zone *zone, | |||
| 183 | */ | 183 | */ |
| 184 | void register_shrinker(struct shrinker *shrinker) | 184 | void register_shrinker(struct shrinker *shrinker) |
| 185 | { | 185 | { |
| 186 | shrinker->nr = 0; | 186 | atomic_long_set(&shrinker->nr_in_batch, 0); |
| 187 | down_write(&shrinker_rwsem); | 187 | down_write(&shrinker_rwsem); |
| 188 | list_add_tail(&shrinker->list, &shrinker_list); | 188 | list_add_tail(&shrinker->list, &shrinker_list); |
| 189 | up_write(&shrinker_rwsem); | 189 | up_write(&shrinker_rwsem); |
| @@ -247,25 +247,26 @@ unsigned long shrink_slab(struct shrink_control *shrink, | |||
| 247 | 247 | ||
| 248 | list_for_each_entry(shrinker, &shrinker_list, list) { | 248 | list_for_each_entry(shrinker, &shrinker_list, list) { |
| 249 | unsigned long long delta; | 249 | unsigned long long delta; |
| 250 | unsigned long total_scan; | 250 | long total_scan; |
| 251 | unsigned long max_pass; | 251 | long max_pass; |
| 252 | int shrink_ret = 0; | 252 | int shrink_ret = 0; |
| 253 | long nr; | 253 | long nr; |
| 254 | long new_nr; | 254 | long new_nr; |
| 255 | long batch_size = shrinker->batch ? shrinker->batch | 255 | long batch_size = shrinker->batch ? shrinker->batch |
| 256 | : SHRINK_BATCH; | 256 | : SHRINK_BATCH; |
| 257 | 257 | ||
| 258 | max_pass = do_shrinker_shrink(shrinker, shrink, 0); | ||
| 259 | if (max_pass <= 0) | ||
| 260 | continue; | ||
| 261 | |||
| 258 | /* | 262 | /* |
| 259 | * copy the current shrinker scan count into a local variable | 263 | * copy the current shrinker scan count into a local variable |
| 260 | * and zero it so that other concurrent shrinker invocations | 264 | * and zero it so that other concurrent shrinker invocations |
| 261 | * don't also do this scanning work. | 265 | * don't also do this scanning work. |
| 262 | */ | 266 | */ |
| 263 | do { | 267 | nr = atomic_long_xchg(&shrinker->nr_in_batch, 0); |
| 264 | nr = shrinker->nr; | ||
| 265 | } while (cmpxchg(&shrinker->nr, nr, 0) != nr); | ||
| 266 | 268 | ||
| 267 | total_scan = nr; | 269 | total_scan = nr; |
| 268 | max_pass = do_shrinker_shrink(shrinker, shrink, 0); | ||
| 269 | delta = (4 * nr_pages_scanned) / shrinker->seeks; | 270 | delta = (4 * nr_pages_scanned) / shrinker->seeks; |
| 270 | delta *= max_pass; | 271 | delta *= max_pass; |
| 271 | do_div(delta, lru_pages + 1); | 272 | do_div(delta, lru_pages + 1); |
| @@ -325,12 +326,11 @@ unsigned long shrink_slab(struct shrink_control *shrink, | |||
| 325 | * manner that handles concurrent updates. If we exhausted the | 326 | * manner that handles concurrent updates. If we exhausted the |
| 326 | * scan, there is no need to do an update. | 327 | * scan, there is no need to do an update. |
| 327 | */ | 328 | */ |
| 328 | do { | 329 | if (total_scan > 0) |
| 329 | nr = shrinker->nr; | 330 | new_nr = atomic_long_add_return(total_scan, |
| 330 | new_nr = total_scan + nr; | 331 | &shrinker->nr_in_batch); |
| 331 | if (total_scan <= 0) | 332 | else |
| 332 | break; | 333 | new_nr = atomic_long_read(&shrinker->nr_in_batch); |
| 333 | } while (cmpxchg(&shrinker->nr, nr, new_nr) != nr); | ||
| 334 | 334 | ||
| 335 | trace_mm_shrink_slab_end(shrinker, shrink_ret, nr, new_nr); | 335 | trace_mm_shrink_slab_end(shrinker, shrink_ret, nr, new_nr); |
| 336 | } | 336 | } |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index c7aafc7c5ed4..5f09a578d49d 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
| @@ -245,9 +245,11 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
| 245 | if (tt_global_entry) { | 245 | if (tt_global_entry) { |
| 246 | /* This node is probably going to update its tt table */ | 246 | /* This node is probably going to update its tt table */ |
| 247 | tt_global_entry->orig_node->tt_poss_change = true; | 247 | tt_global_entry->orig_node->tt_poss_change = true; |
| 248 | /* The global entry has to be marked as PENDING and has to be | 248 | /* The global entry has to be marked as ROAMING and has to be |
| 249 | * kept for consistency purpose */ | 249 | * kept for consistency purpose */ |
| 250 | tt_global_entry->flags |= TT_CLIENT_PENDING; | 250 | tt_global_entry->flags |= TT_CLIENT_ROAM; |
| 251 | tt_global_entry->roam_at = jiffies; | ||
| 252 | |||
| 251 | send_roam_adv(bat_priv, tt_global_entry->addr, | 253 | send_roam_adv(bat_priv, tt_global_entry->addr, |
| 252 | tt_global_entry->orig_node); | 254 | tt_global_entry->orig_node); |
| 253 | } | 255 | } |
| @@ -694,6 +696,7 @@ void tt_global_del(struct bat_priv *bat_priv, | |||
| 694 | const char *message, bool roaming) | 696 | const char *message, bool roaming) |
| 695 | { | 697 | { |
| 696 | struct tt_global_entry *tt_global_entry = NULL; | 698 | struct tt_global_entry *tt_global_entry = NULL; |
| 699 | struct tt_local_entry *tt_local_entry = NULL; | ||
| 697 | 700 | ||
| 698 | tt_global_entry = tt_global_hash_find(bat_priv, addr); | 701 | tt_global_entry = tt_global_hash_find(bat_priv, addr); |
| 699 | if (!tt_global_entry) | 702 | if (!tt_global_entry) |
| @@ -701,15 +704,29 @@ void tt_global_del(struct bat_priv *bat_priv, | |||
| 701 | 704 | ||
| 702 | if (tt_global_entry->orig_node == orig_node) { | 705 | if (tt_global_entry->orig_node == orig_node) { |
| 703 | if (roaming) { | 706 | if (roaming) { |
| 704 | tt_global_entry->flags |= TT_CLIENT_ROAM; | 707 | /* if we are deleting a global entry due to a roam |
| 705 | tt_global_entry->roam_at = jiffies; | 708 | * event, there are two possibilities: |
| 706 | goto out; | 709 | * 1) the client roamed from node A to node B => we mark |
| 710 | * it with TT_CLIENT_ROAM, we start a timer and we | ||
| 711 | * wait for node B to claim it. In case of timeout | ||
| 712 | * the entry is purged. | ||
| 713 | * 2) the client roamed to us => we can directly delete | ||
| 714 | * the global entry, since it is useless now. */ | ||
| 715 | tt_local_entry = tt_local_hash_find(bat_priv, | ||
| 716 | tt_global_entry->addr); | ||
| 717 | if (!tt_local_entry) { | ||
| 718 | tt_global_entry->flags |= TT_CLIENT_ROAM; | ||
| 719 | tt_global_entry->roam_at = jiffies; | ||
| 720 | goto out; | ||
| 721 | } | ||
| 707 | } | 722 | } |
| 708 | _tt_global_del(bat_priv, tt_global_entry, message); | 723 | _tt_global_del(bat_priv, tt_global_entry, message); |
| 709 | } | 724 | } |
| 710 | out: | 725 | out: |
| 711 | if (tt_global_entry) | 726 | if (tt_global_entry) |
| 712 | tt_global_entry_free_ref(tt_global_entry); | 727 | tt_global_entry_free_ref(tt_global_entry); |
| 728 | if (tt_local_entry) | ||
| 729 | tt_local_entry_free_ref(tt_local_entry); | ||
| 713 | } | 730 | } |
| 714 | 731 | ||
| 715 | void tt_global_del_orig(struct bat_priv *bat_priv, | 732 | void tt_global_del_orig(struct bat_priv *bat_priv, |
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index 91bcd3a961ec..1eea8208b2cc 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
| @@ -79,17 +79,12 @@ static struct bnep_session *__bnep_get_session(u8 *dst) | |||
| 79 | 79 | ||
| 80 | static void __bnep_link_session(struct bnep_session *s) | 80 | static void __bnep_link_session(struct bnep_session *s) |
| 81 | { | 81 | { |
| 82 | /* It's safe to call __module_get() here because sessions are added | ||
| 83 | by the socket layer which has to hold the reference to this module. | ||
| 84 | */ | ||
| 85 | __module_get(THIS_MODULE); | ||
| 86 | list_add(&s->list, &bnep_session_list); | 82 | list_add(&s->list, &bnep_session_list); |
| 87 | } | 83 | } |
| 88 | 84 | ||
| 89 | static void __bnep_unlink_session(struct bnep_session *s) | 85 | static void __bnep_unlink_session(struct bnep_session *s) |
| 90 | { | 86 | { |
| 91 | list_del(&s->list); | 87 | list_del(&s->list); |
| 92 | module_put(THIS_MODULE); | ||
| 93 | } | 88 | } |
| 94 | 89 | ||
| 95 | static int bnep_send(struct bnep_session *s, void *data, size_t len) | 90 | static int bnep_send(struct bnep_session *s, void *data, size_t len) |
| @@ -530,6 +525,7 @@ static int bnep_session(void *arg) | |||
| 530 | 525 | ||
| 531 | up_write(&bnep_session_sem); | 526 | up_write(&bnep_session_sem); |
| 532 | free_netdev(dev); | 527 | free_netdev(dev); |
| 528 | module_put_and_exit(0); | ||
| 533 | return 0; | 529 | return 0; |
| 534 | } | 530 | } |
| 535 | 531 | ||
| @@ -616,9 +612,11 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) | |||
| 616 | 612 | ||
| 617 | __bnep_link_session(s); | 613 | __bnep_link_session(s); |
| 618 | 614 | ||
| 615 | __module_get(THIS_MODULE); | ||
| 619 | s->task = kthread_run(bnep_session, s, "kbnepd %s", dev->name); | 616 | s->task = kthread_run(bnep_session, s, "kbnepd %s", dev->name); |
| 620 | if (IS_ERR(s->task)) { | 617 | if (IS_ERR(s->task)) { |
| 621 | /* Session thread start failed, gotta cleanup. */ | 618 | /* Session thread start failed, gotta cleanup. */ |
| 619 | module_put(THIS_MODULE); | ||
| 622 | unregister_netdev(dev); | 620 | unregister_netdev(dev); |
| 623 | __bnep_unlink_session(s); | 621 | __bnep_unlink_session(s); |
| 624 | err = PTR_ERR(s->task); | 622 | err = PTR_ERR(s->task); |
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 7d00ddf9e9dc..5a6e634f7fca 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c | |||
| @@ -67,14 +67,12 @@ static struct cmtp_session *__cmtp_get_session(bdaddr_t *bdaddr) | |||
| 67 | 67 | ||
| 68 | static void __cmtp_link_session(struct cmtp_session *session) | 68 | static void __cmtp_link_session(struct cmtp_session *session) |
| 69 | { | 69 | { |
| 70 | __module_get(THIS_MODULE); | ||
| 71 | list_add(&session->list, &cmtp_session_list); | 70 | list_add(&session->list, &cmtp_session_list); |
| 72 | } | 71 | } |
| 73 | 72 | ||
| 74 | static void __cmtp_unlink_session(struct cmtp_session *session) | 73 | static void __cmtp_unlink_session(struct cmtp_session *session) |
| 75 | { | 74 | { |
| 76 | list_del(&session->list); | 75 | list_del(&session->list); |
| 77 | module_put(THIS_MODULE); | ||
| 78 | } | 76 | } |
| 79 | 77 | ||
| 80 | static void __cmtp_copy_session(struct cmtp_session *session, struct cmtp_conninfo *ci) | 78 | static void __cmtp_copy_session(struct cmtp_session *session, struct cmtp_conninfo *ci) |
| @@ -327,6 +325,7 @@ static int cmtp_session(void *arg) | |||
| 327 | up_write(&cmtp_session_sem); | 325 | up_write(&cmtp_session_sem); |
| 328 | 326 | ||
| 329 | kfree(session); | 327 | kfree(session); |
| 328 | module_put_and_exit(0); | ||
| 330 | return 0; | 329 | return 0; |
| 331 | } | 330 | } |
| 332 | 331 | ||
| @@ -376,9 +375,11 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) | |||
| 376 | 375 | ||
| 377 | __cmtp_link_session(session); | 376 | __cmtp_link_session(session); |
| 378 | 377 | ||
| 378 | __module_get(THIS_MODULE); | ||
| 379 | session->task = kthread_run(cmtp_session, session, "kcmtpd_ctr_%d", | 379 | session->task = kthread_run(cmtp_session, session, "kcmtpd_ctr_%d", |
| 380 | session->num); | 380 | session->num); |
| 381 | if (IS_ERR(session->task)) { | 381 | if (IS_ERR(session->task)) { |
| 382 | module_put(THIS_MODULE); | ||
| 382 | err = PTR_ERR(session->task); | 383 | err = PTR_ERR(session->task); |
| 383 | goto unlink; | 384 | goto unlink; |
| 384 | } | 385 | } |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index e0af7237cd92..c1c597e3e198 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
| @@ -673,7 +673,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
| 673 | goto encrypt; | 673 | goto encrypt; |
| 674 | 674 | ||
| 675 | auth: | 675 | auth: |
| 676 | if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) | 676 | if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) |
| 677 | return 0; | 677 | return 0; |
| 678 | 678 | ||
| 679 | if (!hci_conn_auth(conn, sec_level, auth_type)) | 679 | if (!hci_conn_auth(conn, sec_level, auth_type)) |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index d7d96b6b1f0d..643a41b76e2e 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -545,7 +545,7 @@ static void hci_setup(struct hci_dev *hdev) | |||
| 545 | { | 545 | { |
| 546 | hci_setup_event_mask(hdev); | 546 | hci_setup_event_mask(hdev); |
| 547 | 547 | ||
| 548 | if (hdev->lmp_ver > 1) | 548 | if (hdev->hci_ver > 1) |
| 549 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); | 549 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); |
| 550 | 550 | ||
| 551 | if (hdev->features[6] & LMP_SIMPLE_PAIR) { | 551 | if (hdev->features[6] & LMP_SIMPLE_PAIR) { |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 5ea94a1eecf2..17b5b1cd9657 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
| @@ -2152,7 +2152,7 @@ static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len, voi | |||
| 2152 | void *ptr = req->data; | 2152 | void *ptr = req->data; |
| 2153 | int type, olen; | 2153 | int type, olen; |
| 2154 | unsigned long val; | 2154 | unsigned long val; |
| 2155 | struct l2cap_conf_rfc rfc; | 2155 | struct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC }; |
| 2156 | 2156 | ||
| 2157 | BT_DBG("chan %p, rsp %p, len %d, req %p", chan, rsp, len, data); | 2157 | BT_DBG("chan %p, rsp %p, len %d, req %p", chan, rsp, len, data); |
| 2158 | 2158 | ||
| @@ -2271,6 +2271,16 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len) | |||
| 2271 | } | 2271 | } |
| 2272 | } | 2272 | } |
| 2273 | 2273 | ||
| 2274 | /* Use sane default values in case a misbehaving remote device | ||
| 2275 | * did not send an RFC option. | ||
| 2276 | */ | ||
| 2277 | rfc.mode = chan->mode; | ||
| 2278 | rfc.retrans_timeout = cpu_to_le16(L2CAP_DEFAULT_RETRANS_TO); | ||
| 2279 | rfc.monitor_timeout = cpu_to_le16(L2CAP_DEFAULT_MONITOR_TO); | ||
| 2280 | rfc.max_pdu_size = cpu_to_le16(chan->imtu); | ||
| 2281 | |||
| 2282 | BT_ERR("Expected RFC option was not found, using defaults"); | ||
| 2283 | |||
| 2274 | done: | 2284 | done: |
| 2275 | switch (rfc.mode) { | 2285 | switch (rfc.mode) { |
| 2276 | case L2CAP_MODE_ERTM: | 2286 | case L2CAP_MODE_ERTM: |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 4e32e18211f9..2d28dfe98389 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
| @@ -1146,6 +1146,7 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci) | |||
| 1146 | if (list_empty(&s->dlcs)) { | 1146 | if (list_empty(&s->dlcs)) { |
| 1147 | s->state = BT_DISCONN; | 1147 | s->state = BT_DISCONN; |
| 1148 | rfcomm_send_disc(s, 0); | 1148 | rfcomm_send_disc(s, 0); |
| 1149 | rfcomm_session_clear_timer(s); | ||
| 1149 | } | 1150 | } |
| 1150 | 1151 | ||
| 1151 | break; | 1152 | break; |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index d6ec3720c77e..fa8b8f763580 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
| @@ -114,12 +114,18 @@ static struct neighbour *fake_neigh_lookup(const struct dst_entry *dst, const vo | |||
| 114 | return NULL; | 114 | return NULL; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | static unsigned int fake_mtu(const struct dst_entry *dst) | ||
| 118 | { | ||
| 119 | return dst->dev->mtu; | ||
| 120 | } | ||
| 121 | |||
| 117 | static struct dst_ops fake_dst_ops = { | 122 | static struct dst_ops fake_dst_ops = { |
| 118 | .family = AF_INET, | 123 | .family = AF_INET, |
| 119 | .protocol = cpu_to_be16(ETH_P_IP), | 124 | .protocol = cpu_to_be16(ETH_P_IP), |
| 120 | .update_pmtu = fake_update_pmtu, | 125 | .update_pmtu = fake_update_pmtu, |
| 121 | .cow_metrics = fake_cow_metrics, | 126 | .cow_metrics = fake_cow_metrics, |
| 122 | .neigh_lookup = fake_neigh_lookup, | 127 | .neigh_lookup = fake_neigh_lookup, |
| 128 | .mtu = fake_mtu, | ||
| 123 | }; | 129 | }; |
| 124 | 130 | ||
| 125 | /* | 131 | /* |
| @@ -141,7 +147,7 @@ void br_netfilter_rtable_init(struct net_bridge *br) | |||
| 141 | rt->dst.dev = br->dev; | 147 | rt->dst.dev = br->dev; |
| 142 | rt->dst.path = &rt->dst; | 148 | rt->dst.path = &rt->dst; |
| 143 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); | 149 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); |
| 144 | rt->dst.flags = DST_NOXFRM; | 150 | rt->dst.flags = DST_NOXFRM | DST_NOPEER; |
| 145 | rt->dst.ops = &fake_dst_ops; | 151 | rt->dst.ops = &fake_dst_ops; |
| 146 | } | 152 | } |
| 147 | 153 | ||
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c index 42599e31dcad..3a94eae7abe9 100644 --- a/net/ceph/crush/mapper.c +++ b/net/ceph/crush/mapper.c | |||
| @@ -477,7 +477,6 @@ int crush_do_rule(struct crush_map *map, | |||
| 477 | int i, j; | 477 | int i, j; |
| 478 | int numrep; | 478 | int numrep; |
| 479 | int firstn; | 479 | int firstn; |
| 480 | int rc = -1; | ||
| 481 | 480 | ||
| 482 | BUG_ON(ruleno >= map->max_rules); | 481 | BUG_ON(ruleno >= map->max_rules); |
| 483 | 482 | ||
| @@ -491,23 +490,18 @@ int crush_do_rule(struct crush_map *map, | |||
| 491 | * that this may or may not correspond to the specific types | 490 | * that this may or may not correspond to the specific types |
| 492 | * referenced by the crush rule. | 491 | * referenced by the crush rule. |
| 493 | */ | 492 | */ |
| 494 | if (force >= 0) { | 493 | if (force >= 0 && |
| 495 | if (force >= map->max_devices || | 494 | force < map->max_devices && |
| 496 | map->device_parents[force] == 0) { | 495 | map->device_parents[force] != 0 && |
| 497 | /*dprintk("CRUSH: forcefed device dne\n");*/ | 496 | !is_out(map, weight, force, x)) { |
| 498 | rc = -1; /* force fed device dne */ | 497 | while (1) { |
| 499 | goto out; | 498 | force_context[++force_pos] = force; |
| 500 | } | 499 | if (force >= 0) |
| 501 | if (!is_out(map, weight, force, x)) { | 500 | force = map->device_parents[force]; |
| 502 | while (1) { | 501 | else |
| 503 | force_context[++force_pos] = force; | 502 | force = map->bucket_parents[-1-force]; |
| 504 | if (force >= 0) | 503 | if (force == 0) |
| 505 | force = map->device_parents[force]; | 504 | break; |
| 506 | else | ||
| 507 | force = map->bucket_parents[-1-force]; | ||
| 508 | if (force == 0) | ||
| 509 | break; | ||
| 510 | } | ||
| 511 | } | 505 | } |
| 512 | } | 506 | } |
| 513 | 507 | ||
| @@ -600,10 +594,7 @@ int crush_do_rule(struct crush_map *map, | |||
| 600 | BUG_ON(1); | 594 | BUG_ON(1); |
| 601 | } | 595 | } |
| 602 | } | 596 | } |
| 603 | rc = result_len; | 597 | return result_len; |
| 604 | |||
| 605 | out: | ||
| 606 | return rc; | ||
| 607 | } | 598 | } |
| 608 | 599 | ||
| 609 | 600 | ||
diff --git a/net/core/flow.c b/net/core/flow.c index 8ae42de9c79e..e318c7e98042 100644 --- a/net/core/flow.c +++ b/net/core/flow.c | |||
| @@ -358,6 +358,18 @@ void flow_cache_flush(void) | |||
| 358 | put_online_cpus(); | 358 | put_online_cpus(); |
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | static void flow_cache_flush_task(struct work_struct *work) | ||
| 362 | { | ||
| 363 | flow_cache_flush(); | ||
| 364 | } | ||
| 365 | |||
| 366 | static DECLARE_WORK(flow_cache_flush_work, flow_cache_flush_task); | ||
| 367 | |||
| 368 | void flow_cache_flush_deferred(void) | ||
| 369 | { | ||
| 370 | schedule_work(&flow_cache_flush_work); | ||
| 371 | } | ||
| 372 | |||
| 361 | static int __cpuinit flow_cache_cpu_prepare(struct flow_cache *fc, int cpu) | 373 | static int __cpuinit flow_cache_cpu_prepare(struct flow_cache *fc, int cpu) |
| 362 | { | 374 | { |
| 363 | struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, cpu); | 375 | struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, cpu); |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index c71c434a4c05..385aefe53648 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
| @@ -665,11 +665,14 @@ static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue, | |||
| 665 | if (count) { | 665 | if (count) { |
| 666 | int i; | 666 | int i; |
| 667 | 667 | ||
| 668 | if (count > 1<<30) { | 668 | if (count > INT_MAX) |
| 669 | return -EINVAL; | ||
| 670 | count = roundup_pow_of_two(count); | ||
| 671 | if (count > (ULONG_MAX - sizeof(struct rps_dev_flow_table)) | ||
| 672 | / sizeof(struct rps_dev_flow)) { | ||
| 669 | /* Enforce a limit to prevent overflow */ | 673 | /* Enforce a limit to prevent overflow */ |
| 670 | return -EINVAL; | 674 | return -EINVAL; |
| 671 | } | 675 | } |
| 672 | count = roundup_pow_of_two(count); | ||
| 673 | table = vmalloc(RPS_DEV_FLOW_TABLE_SIZE(count)); | 676 | table = vmalloc(RPS_DEV_FLOW_TABLE_SIZE(count)); |
| 674 | if (!table) | 677 | if (!table) |
| 675 | return -ENOMEM; | 678 | return -ENOMEM; |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 182236b2510a..9b570a6a33c5 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
| @@ -26,10 +26,11 @@ | |||
| 26 | * but then some measure against one socket starving all other sockets | 26 | * but then some measure against one socket starving all other sockets |
| 27 | * would be needed. | 27 | * would be needed. |
| 28 | * | 28 | * |
| 29 | * It was 128 by default. Experiments with real servers show, that | 29 | * The minimum value of it is 128. Experiments with real servers show that |
| 30 | * it is absolutely not enough even at 100conn/sec. 256 cures most | 30 | * it is absolutely not enough even at 100conn/sec. 256 cures most |
| 31 | * of problems. This value is adjusted to 128 for very small machines | 31 | * of problems. |
| 32 | * (<=32Mb of memory) and to 1024 on normal or better ones (>=256Mb). | 32 | * This value is adjusted to 128 for low memory machines, |
| 33 | * and it will increase in proportion to the memory of machine. | ||
| 33 | * Note : Dont forget somaxconn that may limit backlog too. | 34 | * Note : Dont forget somaxconn that may limit backlog too. |
| 34 | */ | 35 | */ |
| 35 | int sysctl_max_syn_backlog = 256; | 36 | int sysctl_max_syn_backlog = 256; |
diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c index 025233de25f9..925991ae6f52 100644 --- a/net/core/secure_seq.c +++ b/net/core/secure_seq.c | |||
| @@ -19,6 +19,7 @@ static int __init net_secret_init(void) | |||
| 19 | } | 19 | } |
| 20 | late_initcall(net_secret_init); | 20 | late_initcall(net_secret_init); |
| 21 | 21 | ||
| 22 | #ifdef CONFIG_INET | ||
| 22 | static u32 seq_scale(u32 seq) | 23 | static u32 seq_scale(u32 seq) |
| 23 | { | 24 | { |
| 24 | /* | 25 | /* |
| @@ -33,6 +34,7 @@ static u32 seq_scale(u32 seq) | |||
| 33 | */ | 34 | */ |
| 34 | return seq + (ktime_to_ns(ktime_get_real()) >> 6); | 35 | return seq + (ktime_to_ns(ktime_get_real()) >> 6); |
| 35 | } | 36 | } |
| 37 | #endif | ||
| 36 | 38 | ||
| 37 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 39 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 38 | __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, | 40 | __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, |
diff --git a/net/core/sock.c b/net/core/sock.c index 4ed7b1d12f5e..b23f174ab84c 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
| @@ -288,11 +288,7 @@ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
| 288 | unsigned long flags; | 288 | unsigned long flags; |
| 289 | struct sk_buff_head *list = &sk->sk_receive_queue; | 289 | struct sk_buff_head *list = &sk->sk_receive_queue; |
| 290 | 290 | ||
| 291 | /* Cast sk->rcvbuf to unsigned... It's pointless, but reduces | 291 | if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) { |
| 292 | number of warnings when compiling with -W --ANK | ||
| 293 | */ | ||
| 294 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | ||
| 295 | (unsigned)sk->sk_rcvbuf) { | ||
| 296 | atomic_inc(&sk->sk_drops); | 292 | atomic_inc(&sk->sk_drops); |
| 297 | trace_sock_rcvqueue_full(sk, skb); | 293 | trace_sock_rcvqueue_full(sk, skb); |
| 298 | return -ENOMEM; | 294 | return -ENOMEM; |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 0da2afc97f32..99ec116bef14 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
| @@ -253,6 +253,10 @@ static int __init ic_open_devs(void) | |||
| 253 | } | 253 | } |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | /* no point in waiting if we could not bring up at least one device */ | ||
| 257 | if (!ic_first_dev) | ||
| 258 | goto have_carrier; | ||
| 259 | |||
| 256 | /* wait for a carrier on at least one device */ | 260 | /* wait for a carrier on at least one device */ |
| 257 | start = jiffies; | 261 | start = jiffies; |
| 258 | while (jiffies - start < msecs_to_jiffies(CONF_CARRIER_TIMEOUT)) { | 262 | while (jiffies - start < msecs_to_jiffies(CONF_CARRIER_TIMEOUT)) { |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 065effd8349a..0b2e7329abda 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
| @@ -285,6 +285,8 @@ static struct ip_tunnel * ipip_tunnel_locate(struct net *net, | |||
| 285 | if (register_netdevice(dev) < 0) | 285 | if (register_netdevice(dev) < 0) |
| 286 | goto failed_free; | 286 | goto failed_free; |
| 287 | 287 | ||
| 288 | strcpy(nt->parms.name, dev->name); | ||
| 289 | |||
| 288 | dev_hold(dev); | 290 | dev_hold(dev); |
| 289 | ipip_tunnel_link(ipn, nt); | 291 | ipip_tunnel_link(ipn, nt); |
| 290 | return nt; | 292 | return nt; |
| @@ -759,7 +761,6 @@ static int ipip_tunnel_init(struct net_device *dev) | |||
| 759 | struct ip_tunnel *tunnel = netdev_priv(dev); | 761 | struct ip_tunnel *tunnel = netdev_priv(dev); |
| 760 | 762 | ||
| 761 | tunnel->dev = dev; | 763 | tunnel->dev = dev; |
| 762 | strcpy(tunnel->parms.name, dev->name); | ||
| 763 | 764 | ||
| 764 | memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); | 765 | memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); |
| 765 | memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); | 766 | memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); |
| @@ -825,6 +826,7 @@ static void ipip_destroy_tunnels(struct ipip_net *ipn, struct list_head *head) | |||
| 825 | static int __net_init ipip_init_net(struct net *net) | 826 | static int __net_init ipip_init_net(struct net *net) |
| 826 | { | 827 | { |
| 827 | struct ipip_net *ipn = net_generic(net, ipip_net_id); | 828 | struct ipip_net *ipn = net_generic(net, ipip_net_id); |
| 829 | struct ip_tunnel *t; | ||
| 828 | int err; | 830 | int err; |
| 829 | 831 | ||
| 830 | ipn->tunnels[0] = ipn->tunnels_wc; | 832 | ipn->tunnels[0] = ipn->tunnels_wc; |
| @@ -848,6 +850,9 @@ static int __net_init ipip_init_net(struct net *net) | |||
| 848 | if ((err = register_netdev(ipn->fb_tunnel_dev))) | 850 | if ((err = register_netdev(ipn->fb_tunnel_dev))) |
| 849 | goto err_reg_dev; | 851 | goto err_reg_dev; |
| 850 | 852 | ||
| 853 | t = netdev_priv(ipn->fb_tunnel_dev); | ||
| 854 | |||
| 855 | strcpy(t->parms.name, ipn->fb_tunnel_dev->name); | ||
| 851 | return 0; | 856 | return 0; |
| 852 | 857 | ||
| 853 | err_reg_dev: | 858 | err_reg_dev: |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index ca5e237df029..94cdbc55ca7e 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
| @@ -91,6 +91,7 @@ | |||
| 91 | #include <linux/rcupdate.h> | 91 | #include <linux/rcupdate.h> |
| 92 | #include <linux/times.h> | 92 | #include <linux/times.h> |
| 93 | #include <linux/slab.h> | 93 | #include <linux/slab.h> |
| 94 | #include <linux/prefetch.h> | ||
| 94 | #include <net/dst.h> | 95 | #include <net/dst.h> |
| 95 | #include <net/net_namespace.h> | 96 | #include <net/net_namespace.h> |
| 96 | #include <net/protocol.h> | 97 | #include <net/protocol.h> |
| @@ -112,7 +113,7 @@ | |||
| 112 | #include <net/secure_seq.h> | 113 | #include <net/secure_seq.h> |
| 113 | 114 | ||
| 114 | #define RT_FL_TOS(oldflp4) \ | 115 | #define RT_FL_TOS(oldflp4) \ |
| 115 | ((u32)(oldflp4->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK))) | 116 | ((oldflp4)->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK)) |
| 116 | 117 | ||
| 117 | #define IP_MAX_MTU 0xFFF0 | 118 | #define IP_MAX_MTU 0xFFF0 |
| 118 | 119 | ||
| @@ -120,6 +121,7 @@ | |||
| 120 | 121 | ||
| 121 | static int ip_rt_max_size; | 122 | static int ip_rt_max_size; |
| 122 | static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT; | 123 | static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT; |
| 124 | static int ip_rt_gc_interval __read_mostly = 60 * HZ; | ||
| 123 | static int ip_rt_gc_min_interval __read_mostly = HZ / 2; | 125 | static int ip_rt_gc_min_interval __read_mostly = HZ / 2; |
| 124 | static int ip_rt_redirect_number __read_mostly = 9; | 126 | static int ip_rt_redirect_number __read_mostly = 9; |
| 125 | static int ip_rt_redirect_load __read_mostly = HZ / 50; | 127 | static int ip_rt_redirect_load __read_mostly = HZ / 50; |
| @@ -133,6 +135,9 @@ static int ip_rt_min_advmss __read_mostly = 256; | |||
| 133 | static int rt_chain_length_max __read_mostly = 20; | 135 | static int rt_chain_length_max __read_mostly = 20; |
| 134 | static int redirect_genid; | 136 | static int redirect_genid; |
| 135 | 137 | ||
| 138 | static struct delayed_work expires_work; | ||
| 139 | static unsigned long expires_ljiffies; | ||
| 140 | |||
| 136 | /* | 141 | /* |
| 137 | * Interface to generic destination cache. | 142 | * Interface to generic destination cache. |
| 138 | */ | 143 | */ |
| @@ -830,6 +835,97 @@ static int has_noalias(const struct rtable *head, const struct rtable *rth) | |||
| 830 | return ONE; | 835 | return ONE; |
| 831 | } | 836 | } |
| 832 | 837 | ||
| 838 | static void rt_check_expire(void) | ||
| 839 | { | ||
| 840 | static unsigned int rover; | ||
| 841 | unsigned int i = rover, goal; | ||
| 842 | struct rtable *rth; | ||
| 843 | struct rtable __rcu **rthp; | ||
| 844 | unsigned long samples = 0; | ||
| 845 | unsigned long sum = 0, sum2 = 0; | ||
| 846 | unsigned long delta; | ||
| 847 | u64 mult; | ||
| 848 | |||
| 849 | delta = jiffies - expires_ljiffies; | ||
| 850 | expires_ljiffies = jiffies; | ||
| 851 | mult = ((u64)delta) << rt_hash_log; | ||
| 852 | if (ip_rt_gc_timeout > 1) | ||
| 853 | do_div(mult, ip_rt_gc_timeout); | ||
| 854 | goal = (unsigned int)mult; | ||
| 855 | if (goal > rt_hash_mask) | ||
| 856 | goal = rt_hash_mask + 1; | ||
| 857 | for (; goal > 0; goal--) { | ||
| 858 | unsigned long tmo = ip_rt_gc_timeout; | ||
| 859 | unsigned long length; | ||
| 860 | |||
| 861 | i = (i + 1) & rt_hash_mask; | ||
| 862 | rthp = &rt_hash_table[i].chain; | ||
| 863 | |||
| 864 | if (need_resched()) | ||
| 865 | cond_resched(); | ||
| 866 | |||
| 867 | samples++; | ||
| 868 | |||
| 869 | if (rcu_dereference_raw(*rthp) == NULL) | ||
| 870 | continue; | ||
| 871 | length = 0; | ||
| 872 | spin_lock_bh(rt_hash_lock_addr(i)); | ||
| 873 | while ((rth = rcu_dereference_protected(*rthp, | ||
| 874 | lockdep_is_held(rt_hash_lock_addr(i)))) != NULL) { | ||
| 875 | prefetch(rth->dst.rt_next); | ||
| 876 | if (rt_is_expired(rth)) { | ||
| 877 | *rthp = rth->dst.rt_next; | ||
| 878 | rt_free(rth); | ||
| 879 | continue; | ||
| 880 | } | ||
| 881 | if (rth->dst.expires) { | ||
| 882 | /* Entry is expired even if it is in use */ | ||
| 883 | if (time_before_eq(jiffies, rth->dst.expires)) { | ||
| 884 | nofree: | ||
| 885 | tmo >>= 1; | ||
| 886 | rthp = &rth->dst.rt_next; | ||
| 887 | /* | ||
| 888 | * We only count entries on | ||
| 889 | * a chain with equal hash inputs once | ||
| 890 | * so that entries for different QOS | ||
| 891 | * levels, and other non-hash input | ||
| 892 | * attributes don't unfairly skew | ||
| 893 | * the length computation | ||
| 894 | */ | ||
| 895 | length += has_noalias(rt_hash_table[i].chain, rth); | ||
| 896 | continue; | ||
| 897 | } | ||
| 898 | } else if (!rt_may_expire(rth, tmo, ip_rt_gc_timeout)) | ||
| 899 | goto nofree; | ||
| 900 | |||
| 901 | /* Cleanup aged off entries. */ | ||
| 902 | *rthp = rth->dst.rt_next; | ||
| 903 | rt_free(rth); | ||
| 904 | } | ||
| 905 | spin_unlock_bh(rt_hash_lock_addr(i)); | ||
| 906 | sum += length; | ||
| 907 | sum2 += length*length; | ||
| 908 | } | ||
| 909 | if (samples) { | ||
| 910 | unsigned long avg = sum / samples; | ||
| 911 | unsigned long sd = int_sqrt(sum2 / samples - avg*avg); | ||
| 912 | rt_chain_length_max = max_t(unsigned long, | ||
| 913 | ip_rt_gc_elasticity, | ||
| 914 | (avg + 4*sd) >> FRACT_BITS); | ||
| 915 | } | ||
| 916 | rover = i; | ||
| 917 | } | ||
| 918 | |||
| 919 | /* | ||
| 920 | * rt_worker_func() is run in process context. | ||
| 921 | * we call rt_check_expire() to scan part of the hash table | ||
| 922 | */ | ||
| 923 | static void rt_worker_func(struct work_struct *work) | ||
| 924 | { | ||
| 925 | rt_check_expire(); | ||
| 926 | schedule_delayed_work(&expires_work, ip_rt_gc_interval); | ||
| 927 | } | ||
| 928 | |||
| 833 | /* | 929 | /* |
| 834 | * Perturbation of rt_genid by a small quantity [1..256] | 930 | * Perturbation of rt_genid by a small quantity [1..256] |
| 835 | * Using 8 bits of shuffling ensure we can call rt_cache_invalidate() | 931 | * Using 8 bits of shuffling ensure we can call rt_cache_invalidate() |
| @@ -1271,7 +1367,7 @@ void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more) | |||
| 1271 | { | 1367 | { |
| 1272 | struct rtable *rt = (struct rtable *) dst; | 1368 | struct rtable *rt = (struct rtable *) dst; |
| 1273 | 1369 | ||
| 1274 | if (rt) { | 1370 | if (rt && !(rt->dst.flags & DST_NOPEER)) { |
| 1275 | if (rt->peer == NULL) | 1371 | if (rt->peer == NULL) |
| 1276 | rt_bind_peer(rt, rt->rt_dst, 1); | 1372 | rt_bind_peer(rt, rt->rt_dst, 1); |
| 1277 | 1373 | ||
| @@ -1282,7 +1378,7 @@ void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more) | |||
| 1282 | iph->id = htons(inet_getid(rt->peer, more)); | 1378 | iph->id = htons(inet_getid(rt->peer, more)); |
| 1283 | return; | 1379 | return; |
| 1284 | } | 1380 | } |
| 1285 | } else | 1381 | } else if (!rt) |
| 1286 | printk(KERN_DEBUG "rt_bind_peer(0) @%p\n", | 1382 | printk(KERN_DEBUG "rt_bind_peer(0) @%p\n", |
| 1287 | __builtin_return_address(0)); | 1383 | __builtin_return_address(0)); |
| 1288 | 1384 | ||
| @@ -1310,7 +1406,7 @@ static void rt_del(unsigned hash, struct rtable *rt) | |||
| 1310 | spin_unlock_bh(rt_hash_lock_addr(hash)); | 1406 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
| 1311 | } | 1407 | } |
| 1312 | 1408 | ||
| 1313 | static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) | 1409 | static void check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) |
| 1314 | { | 1410 | { |
| 1315 | struct rtable *rt = (struct rtable *) dst; | 1411 | struct rtable *rt = (struct rtable *) dst; |
| 1316 | __be32 orig_gw = rt->rt_gateway; | 1412 | __be32 orig_gw = rt->rt_gateway; |
| @@ -1321,21 +1417,19 @@ static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) | |||
| 1321 | rt->rt_gateway = peer->redirect_learned.a4; | 1417 | rt->rt_gateway = peer->redirect_learned.a4; |
| 1322 | 1418 | ||
| 1323 | n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway); | 1419 | n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway); |
| 1324 | if (IS_ERR(n)) | 1420 | if (IS_ERR(n)) { |
| 1325 | return PTR_ERR(n); | 1421 | rt->rt_gateway = orig_gw; |
| 1422 | return; | ||
| 1423 | } | ||
| 1326 | old_n = xchg(&rt->dst._neighbour, n); | 1424 | old_n = xchg(&rt->dst._neighbour, n); |
| 1327 | if (old_n) | 1425 | if (old_n) |
| 1328 | neigh_release(old_n); | 1426 | neigh_release(old_n); |
| 1329 | if (!n || !(n->nud_state & NUD_VALID)) { | 1427 | if (!(n->nud_state & NUD_VALID)) { |
| 1330 | if (n) | 1428 | neigh_event_send(n, NULL); |
| 1331 | neigh_event_send(n, NULL); | ||
| 1332 | rt->rt_gateway = orig_gw; | ||
| 1333 | return -EAGAIN; | ||
| 1334 | } else { | 1429 | } else { |
| 1335 | rt->rt_flags |= RTCF_REDIRECTED; | 1430 | rt->rt_flags |= RTCF_REDIRECTED; |
| 1336 | call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n); | 1431 | call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n); |
| 1337 | } | 1432 | } |
| 1338 | return 0; | ||
| 1339 | } | 1433 | } |
| 1340 | 1434 | ||
| 1341 | /* called in rcu_read_lock() section */ | 1435 | /* called in rcu_read_lock() section */ |
| @@ -1693,7 +1787,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
| 1693 | } | 1787 | } |
| 1694 | 1788 | ||
| 1695 | 1789 | ||
| 1696 | static struct rtable *ipv4_validate_peer(struct rtable *rt) | 1790 | static void ipv4_validate_peer(struct rtable *rt) |
| 1697 | { | 1791 | { |
| 1698 | if (rt->rt_peer_genid != rt_peer_genid()) { | 1792 | if (rt->rt_peer_genid != rt_peer_genid()) { |
| 1699 | struct inet_peer *peer; | 1793 | struct inet_peer *peer; |
| @@ -1708,15 +1802,12 @@ static struct rtable *ipv4_validate_peer(struct rtable *rt) | |||
| 1708 | if (peer->redirect_genid != redirect_genid) | 1802 | if (peer->redirect_genid != redirect_genid) |
| 1709 | peer->redirect_learned.a4 = 0; | 1803 | peer->redirect_learned.a4 = 0; |
| 1710 | if (peer->redirect_learned.a4 && | 1804 | if (peer->redirect_learned.a4 && |
| 1711 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1805 | peer->redirect_learned.a4 != rt->rt_gateway) |
| 1712 | if (check_peer_redir(&rt->dst, peer)) | 1806 | check_peer_redir(&rt->dst, peer); |
| 1713 | return NULL; | ||
| 1714 | } | ||
| 1715 | } | 1807 | } |
| 1716 | 1808 | ||
| 1717 | rt->rt_peer_genid = rt_peer_genid(); | 1809 | rt->rt_peer_genid = rt_peer_genid(); |
| 1718 | } | 1810 | } |
| 1719 | return rt; | ||
| 1720 | } | 1811 | } |
| 1721 | 1812 | ||
| 1722 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | 1813 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) |
| @@ -1725,7 +1816,7 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | |||
| 1725 | 1816 | ||
| 1726 | if (rt_is_expired(rt)) | 1817 | if (rt_is_expired(rt)) |
| 1727 | return NULL; | 1818 | return NULL; |
| 1728 | dst = (struct dst_entry *) ipv4_validate_peer(rt); | 1819 | ipv4_validate_peer(rt); |
| 1729 | return dst; | 1820 | return dst; |
| 1730 | } | 1821 | } |
| 1731 | 1822 | ||
| @@ -2380,9 +2471,7 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
| 2380 | rth->rt_mark == skb->mark && | 2471 | rth->rt_mark == skb->mark && |
| 2381 | net_eq(dev_net(rth->dst.dev), net) && | 2472 | net_eq(dev_net(rth->dst.dev), net) && |
| 2382 | !rt_is_expired(rth)) { | 2473 | !rt_is_expired(rth)) { |
| 2383 | rth = ipv4_validate_peer(rth); | 2474 | ipv4_validate_peer(rth); |
| 2384 | if (!rth) | ||
| 2385 | continue; | ||
| 2386 | if (noref) { | 2475 | if (noref) { |
| 2387 | dst_use_noref(&rth->dst, jiffies); | 2476 | dst_use_noref(&rth->dst, jiffies); |
| 2388 | skb_dst_set_noref(skb, &rth->dst); | 2477 | skb_dst_set_noref(skb, &rth->dst); |
| @@ -2441,11 +2530,11 @@ EXPORT_SYMBOL(ip_route_input_common); | |||
| 2441 | static struct rtable *__mkroute_output(const struct fib_result *res, | 2530 | static struct rtable *__mkroute_output(const struct fib_result *res, |
| 2442 | const struct flowi4 *fl4, | 2531 | const struct flowi4 *fl4, |
| 2443 | __be32 orig_daddr, __be32 orig_saddr, | 2532 | __be32 orig_daddr, __be32 orig_saddr, |
| 2444 | int orig_oif, struct net_device *dev_out, | 2533 | int orig_oif, __u8 orig_rtos, |
| 2534 | struct net_device *dev_out, | ||
| 2445 | unsigned int flags) | 2535 | unsigned int flags) |
| 2446 | { | 2536 | { |
| 2447 | struct fib_info *fi = res->fi; | 2537 | struct fib_info *fi = res->fi; |
| 2448 | u32 tos = RT_FL_TOS(fl4); | ||
| 2449 | struct in_device *in_dev; | 2538 | struct in_device *in_dev; |
| 2450 | u16 type = res->type; | 2539 | u16 type = res->type; |
| 2451 | struct rtable *rth; | 2540 | struct rtable *rth; |
| @@ -2496,7 +2585,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
| 2496 | rth->rt_genid = rt_genid(dev_net(dev_out)); | 2585 | rth->rt_genid = rt_genid(dev_net(dev_out)); |
| 2497 | rth->rt_flags = flags; | 2586 | rth->rt_flags = flags; |
| 2498 | rth->rt_type = type; | 2587 | rth->rt_type = type; |
| 2499 | rth->rt_key_tos = tos; | 2588 | rth->rt_key_tos = orig_rtos; |
| 2500 | rth->rt_dst = fl4->daddr; | 2589 | rth->rt_dst = fl4->daddr; |
| 2501 | rth->rt_src = fl4->saddr; | 2590 | rth->rt_src = fl4->saddr; |
| 2502 | rth->rt_route_iif = 0; | 2591 | rth->rt_route_iif = 0; |
| @@ -2546,7 +2635,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
| 2546 | static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) | 2635 | static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) |
| 2547 | { | 2636 | { |
| 2548 | struct net_device *dev_out = NULL; | 2637 | struct net_device *dev_out = NULL; |
| 2549 | u32 tos = RT_FL_TOS(fl4); | 2638 | __u8 tos = RT_FL_TOS(fl4); |
| 2550 | unsigned int flags = 0; | 2639 | unsigned int flags = 0; |
| 2551 | struct fib_result res; | 2640 | struct fib_result res; |
| 2552 | struct rtable *rth; | 2641 | struct rtable *rth; |
| @@ -2722,7 +2811,7 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) | |||
| 2722 | 2811 | ||
| 2723 | make_route: | 2812 | make_route: |
| 2724 | rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif, | 2813 | rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif, |
| 2725 | dev_out, flags); | 2814 | tos, dev_out, flags); |
| 2726 | if (!IS_ERR(rth)) { | 2815 | if (!IS_ERR(rth)) { |
| 2727 | unsigned int hash; | 2816 | unsigned int hash; |
| 2728 | 2817 | ||
| @@ -2758,9 +2847,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *flp4) | |||
| 2758 | (IPTOS_RT_MASK | RTO_ONLINK)) && | 2847 | (IPTOS_RT_MASK | RTO_ONLINK)) && |
| 2759 | net_eq(dev_net(rth->dst.dev), net) && | 2848 | net_eq(dev_net(rth->dst.dev), net) && |
| 2760 | !rt_is_expired(rth)) { | 2849 | !rt_is_expired(rth)) { |
| 2761 | rth = ipv4_validate_peer(rth); | 2850 | ipv4_validate_peer(rth); |
| 2762 | if (!rth) | ||
| 2763 | continue; | ||
| 2764 | dst_use(&rth->dst, jiffies); | 2851 | dst_use(&rth->dst, jiffies); |
| 2765 | RT_CACHE_STAT_INC(out_hit); | 2852 | RT_CACHE_STAT_INC(out_hit); |
| 2766 | rcu_read_unlock_bh(); | 2853 | rcu_read_unlock_bh(); |
| @@ -3188,6 +3275,13 @@ static ctl_table ipv4_route_table[] = { | |||
| 3188 | .proc_handler = proc_dointvec_jiffies, | 3275 | .proc_handler = proc_dointvec_jiffies, |
| 3189 | }, | 3276 | }, |
| 3190 | { | 3277 | { |
| 3278 | .procname = "gc_interval", | ||
| 3279 | .data = &ip_rt_gc_interval, | ||
| 3280 | .maxlen = sizeof(int), | ||
| 3281 | .mode = 0644, | ||
| 3282 | .proc_handler = proc_dointvec_jiffies, | ||
| 3283 | }, | ||
| 3284 | { | ||
| 3191 | .procname = "redirect_load", | 3285 | .procname = "redirect_load", |
| 3192 | .data = &ip_rt_redirect_load, | 3286 | .data = &ip_rt_redirect_load, |
| 3193 | .maxlen = sizeof(int), | 3287 | .maxlen = sizeof(int), |
| @@ -3397,6 +3491,11 @@ int __init ip_rt_init(void) | |||
| 3397 | devinet_init(); | 3491 | devinet_init(); |
| 3398 | ip_fib_init(); | 3492 | ip_fib_init(); |
| 3399 | 3493 | ||
| 3494 | INIT_DELAYED_WORK_DEFERRABLE(&expires_work, rt_worker_func); | ||
| 3495 | expires_ljiffies = jiffies; | ||
| 3496 | schedule_delayed_work(&expires_work, | ||
| 3497 | net_random() % ip_rt_gc_interval + ip_rt_gc_interval); | ||
| 3498 | |||
| 3400 | if (ip_rt_proc_init()) | 3499 | if (ip_rt_proc_init()) |
| 3401 | printk(KERN_ERR "Unable to create route proc files\n"); | 3500 | printk(KERN_ERR "Unable to create route proc files\n"); |
| 3402 | #ifdef CONFIG_XFRM | 3501 | #ifdef CONFIG_XFRM |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index cf88df82e2c2..36806def8cfd 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -1805,7 +1805,8 @@ static struct inet6_dev *addrconf_add_dev(struct net_device *dev) | |||
| 1805 | return ERR_PTR(-EACCES); | 1805 | return ERR_PTR(-EACCES); |
| 1806 | 1806 | ||
| 1807 | /* Add default multicast route */ | 1807 | /* Add default multicast route */ |
| 1808 | addrconf_add_mroute(dev); | 1808 | if (!(dev->flags & IFF_LOOPBACK)) |
| 1809 | addrconf_add_mroute(dev); | ||
| 1809 | 1810 | ||
| 1810 | /* Add link local route */ | 1811 | /* Add link local route */ |
| 1811 | addrconf_add_lroute(dev); | 1812 | addrconf_add_lroute(dev); |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 84d0bd5cac93..ec562713db9b 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
| @@ -603,7 +603,7 @@ void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) | |||
| 603 | static atomic_t ipv6_fragmentation_id; | 603 | static atomic_t ipv6_fragmentation_id; |
| 604 | int old, new; | 604 | int old, new; |
| 605 | 605 | ||
| 606 | if (rt) { | 606 | if (rt && !(rt->dst.flags & DST_NOPEER)) { |
| 607 | struct inet_peer *peer; | 607 | struct inet_peer *peer; |
| 608 | 608 | ||
| 609 | if (!rt->rt6i_peer) | 609 | if (!rt->rt6i_peer) |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 3399dd326287..b582a0a0f1c5 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -728,7 +728,7 @@ static struct rt6_info *rt6_alloc_cow(const struct rt6_info *ort, | |||
| 728 | int attempts = !in_softirq(); | 728 | int attempts = !in_softirq(); |
| 729 | 729 | ||
| 730 | if (!(rt->rt6i_flags&RTF_GATEWAY)) { | 730 | if (!(rt->rt6i_flags&RTF_GATEWAY)) { |
| 731 | if (rt->rt6i_dst.plen != 128 && | 731 | if (ort->rt6i_dst.plen != 128 && |
| 732 | ipv6_addr_equal(&ort->rt6i_dst.addr, daddr)) | 732 | ipv6_addr_equal(&ort->rt6i_dst.addr, daddr)) |
| 733 | rt->rt6i_flags |= RTF_ANYCAST; | 733 | rt->rt6i_flags |= RTF_ANYCAST; |
| 734 | ipv6_addr_copy(&rt->rt6i_gateway, daddr); | 734 | ipv6_addr_copy(&rt->rt6i_gateway, daddr); |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index a7a18602a046..96f3623618e3 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
| @@ -263,6 +263,8 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, | |||
| 263 | if (register_netdevice(dev) < 0) | 263 | if (register_netdevice(dev) < 0) |
| 264 | goto failed_free; | 264 | goto failed_free; |
| 265 | 265 | ||
| 266 | strcpy(nt->parms.name, dev->name); | ||
| 267 | |||
| 266 | dev_hold(dev); | 268 | dev_hold(dev); |
| 267 | 269 | ||
| 268 | ipip6_tunnel_link(sitn, nt); | 270 | ipip6_tunnel_link(sitn, nt); |
| @@ -1144,7 +1146,6 @@ static int ipip6_tunnel_init(struct net_device *dev) | |||
| 1144 | struct ip_tunnel *tunnel = netdev_priv(dev); | 1146 | struct ip_tunnel *tunnel = netdev_priv(dev); |
| 1145 | 1147 | ||
| 1146 | tunnel->dev = dev; | 1148 | tunnel->dev = dev; |
| 1147 | strcpy(tunnel->parms.name, dev->name); | ||
| 1148 | 1149 | ||
| 1149 | memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); | 1150 | memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); |
| 1150 | memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); | 1151 | memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); |
| @@ -1207,6 +1208,7 @@ static void __net_exit sit_destroy_tunnels(struct sit_net *sitn, struct list_hea | |||
| 1207 | static int __net_init sit_init_net(struct net *net) | 1208 | static int __net_init sit_init_net(struct net *net) |
| 1208 | { | 1209 | { |
| 1209 | struct sit_net *sitn = net_generic(net, sit_net_id); | 1210 | struct sit_net *sitn = net_generic(net, sit_net_id); |
| 1211 | struct ip_tunnel *t; | ||
| 1210 | int err; | 1212 | int err; |
| 1211 | 1213 | ||
| 1212 | sitn->tunnels[0] = sitn->tunnels_wc; | 1214 | sitn->tunnels[0] = sitn->tunnels_wc; |
| @@ -1231,6 +1233,9 @@ static int __net_init sit_init_net(struct net *net) | |||
| 1231 | if ((err = register_netdev(sitn->fb_tunnel_dev))) | 1233 | if ((err = register_netdev(sitn->fb_tunnel_dev))) |
| 1232 | goto err_reg_dev; | 1234 | goto err_reg_dev; |
| 1233 | 1235 | ||
| 1236 | t = netdev_priv(sitn->fb_tunnel_dev); | ||
| 1237 | |||
| 1238 | strcpy(t->parms.name, sitn->fb_tunnel_dev->name); | ||
| 1234 | return 0; | 1239 | return 0; |
| 1235 | 1240 | ||
| 1236 | err_reg_dev: | 1241 | err_reg_dev: |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index dfd3a648a551..a18e6c3d36e3 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
| @@ -833,15 +833,15 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 833 | copied += used; | 833 | copied += used; |
| 834 | len -= used; | 834 | len -= used; |
| 835 | 835 | ||
| 836 | /* For non stream protcols we get one packet per recvmsg call */ | ||
| 837 | if (sk->sk_type != SOCK_STREAM) | ||
| 838 | goto copy_uaddr; | ||
| 839 | |||
| 836 | if (!(flags & MSG_PEEK)) { | 840 | if (!(flags & MSG_PEEK)) { |
| 837 | sk_eat_skb(sk, skb, 0); | 841 | sk_eat_skb(sk, skb, 0); |
| 838 | *seq = 0; | 842 | *seq = 0; |
| 839 | } | 843 | } |
| 840 | 844 | ||
| 841 | /* For non stream protcols we get one packet per recvmsg call */ | ||
| 842 | if (sk->sk_type != SOCK_STREAM) | ||
| 843 | goto copy_uaddr; | ||
| 844 | |||
| 845 | /* Partial read */ | 845 | /* Partial read */ |
| 846 | if (used + offset < skb->len) | 846 | if (used + offset < skb->len) |
| 847 | continue; | 847 | continue; |
| @@ -857,6 +857,12 @@ copy_uaddr: | |||
| 857 | } | 857 | } |
| 858 | if (llc_sk(sk)->cmsg_flags) | 858 | if (llc_sk(sk)->cmsg_flags) |
| 859 | llc_cmsg_rcv(msg, skb); | 859 | llc_cmsg_rcv(msg, skb); |
| 860 | |||
| 861 | if (!(flags & MSG_PEEK)) { | ||
| 862 | sk_eat_skb(sk, skb, 0); | ||
| 863 | *seq = 0; | ||
| 864 | } | ||
| 865 | |||
| 860 | goto out; | 866 | goto out; |
| 861 | } | 867 | } |
| 862 | 868 | ||
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index b064e4df12c6..2e4b961648d4 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
| @@ -303,6 +303,38 @@ ieee80211_wake_queue_agg(struct ieee80211_local *local, int tid) | |||
| 303 | __release(agg_queue); | 303 | __release(agg_queue); |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | /* | ||
| 307 | * splice packets from the STA's pending to the local pending, | ||
| 308 | * requires a call to ieee80211_agg_splice_finish later | ||
| 309 | */ | ||
| 310 | static void __acquires(agg_queue) | ||
| 311 | ieee80211_agg_splice_packets(struct ieee80211_local *local, | ||
| 312 | struct tid_ampdu_tx *tid_tx, u16 tid) | ||
| 313 | { | ||
| 314 | int queue = ieee80211_ac_from_tid(tid); | ||
| 315 | unsigned long flags; | ||
| 316 | |||
| 317 | ieee80211_stop_queue_agg(local, tid); | ||
| 318 | |||
| 319 | if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates" | ||
| 320 | " from the pending queue\n", tid)) | ||
| 321 | return; | ||
| 322 | |||
| 323 | if (!skb_queue_empty(&tid_tx->pending)) { | ||
| 324 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); | ||
| 325 | /* copy over remaining packets */ | ||
| 326 | skb_queue_splice_tail_init(&tid_tx->pending, | ||
| 327 | &local->pending[queue]); | ||
| 328 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); | ||
| 329 | } | ||
| 330 | } | ||
| 331 | |||
| 332 | static void __releases(agg_queue) | ||
| 333 | ieee80211_agg_splice_finish(struct ieee80211_local *local, u16 tid) | ||
| 334 | { | ||
| 335 | ieee80211_wake_queue_agg(local, tid); | ||
| 336 | } | ||
| 337 | |||
| 306 | void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) | 338 | void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) |
| 307 | { | 339 | { |
| 308 | struct tid_ampdu_tx *tid_tx; | 340 | struct tid_ampdu_tx *tid_tx; |
| @@ -314,19 +346,17 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) | |||
| 314 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); | 346 | tid_tx = rcu_dereference_protected_tid_tx(sta, tid); |
| 315 | 347 | ||
| 316 | /* | 348 | /* |
| 317 | * While we're asking the driver about the aggregation, | 349 | * Start queuing up packets for this aggregation session. |
| 318 | * stop the AC queue so that we don't have to worry | 350 | * We're going to release them once the driver is OK with |
| 319 | * about frames that came in while we were doing that, | 351 | * that. |
| 320 | * which would require us to put them to the AC pending | ||
| 321 | * afterwards which just makes the code more complex. | ||
| 322 | */ | 352 | */ |
| 323 | ieee80211_stop_queue_agg(local, tid); | ||
| 324 | |||
| 325 | clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state); | 353 | clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state); |
| 326 | 354 | ||
| 327 | /* | 355 | /* |
| 328 | * make sure no packets are being processed to get | 356 | * Make sure no packets are being processed. This ensures that |
| 329 | * valid starting sequence number | 357 | * we have a valid starting sequence number and that in-flight |
| 358 | * packets have been flushed out and no packets for this TID | ||
| 359 | * will go into the driver during the ampdu_action call. | ||
| 330 | */ | 360 | */ |
| 331 | synchronize_net(); | 361 | synchronize_net(); |
| 332 | 362 | ||
| @@ -340,17 +370,15 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) | |||
| 340 | " tid %d\n", tid); | 370 | " tid %d\n", tid); |
| 341 | #endif | 371 | #endif |
| 342 | spin_lock_bh(&sta->lock); | 372 | spin_lock_bh(&sta->lock); |
| 373 | ieee80211_agg_splice_packets(local, tid_tx, tid); | ||
| 343 | ieee80211_assign_tid_tx(sta, tid, NULL); | 374 | ieee80211_assign_tid_tx(sta, tid, NULL); |
| 375 | ieee80211_agg_splice_finish(local, tid); | ||
| 344 | spin_unlock_bh(&sta->lock); | 376 | spin_unlock_bh(&sta->lock); |
| 345 | 377 | ||
| 346 | ieee80211_wake_queue_agg(local, tid); | ||
| 347 | kfree_rcu(tid_tx, rcu_head); | 378 | kfree_rcu(tid_tx, rcu_head); |
| 348 | return; | 379 | return; |
| 349 | } | 380 | } |
| 350 | 381 | ||
| 351 | /* we can take packets again now */ | ||
| 352 | ieee80211_wake_queue_agg(local, tid); | ||
| 353 | |||
| 354 | /* activate the timer for the recipient's addBA response */ | 382 | /* activate the timer for the recipient's addBA response */ |
| 355 | mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL); | 383 | mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL); |
| 356 | #ifdef CONFIG_MAC80211_HT_DEBUG | 384 | #ifdef CONFIG_MAC80211_HT_DEBUG |
| @@ -466,38 +494,6 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, | |||
| 466 | } | 494 | } |
| 467 | EXPORT_SYMBOL(ieee80211_start_tx_ba_session); | 495 | EXPORT_SYMBOL(ieee80211_start_tx_ba_session); |
| 468 | 496 | ||
| 469 | /* | ||
| 470 | * splice packets from the STA's pending to the local pending, | ||
| 471 | * requires a call to ieee80211_agg_splice_finish later | ||
| 472 | */ | ||
| 473 | static void __acquires(agg_queue) | ||
| 474 | ieee80211_agg_splice_packets(struct ieee80211_local *local, | ||
| 475 | struct tid_ampdu_tx *tid_tx, u16 tid) | ||
| 476 | { | ||
| 477 | int queue = ieee80211_ac_from_tid(tid); | ||
| 478 | unsigned long flags; | ||
| 479 | |||
| 480 | ieee80211_stop_queue_agg(local, tid); | ||
| 481 | |||
| 482 | if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates" | ||
| 483 | " from the pending queue\n", tid)) | ||
| 484 | return; | ||
| 485 | |||
| 486 | if (!skb_queue_empty(&tid_tx->pending)) { | ||
| 487 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); | ||
| 488 | /* copy over remaining packets */ | ||
| 489 | skb_queue_splice_tail_init(&tid_tx->pending, | ||
| 490 | &local->pending[queue]); | ||
| 491 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); | ||
| 492 | } | ||
| 493 | } | ||
| 494 | |||
| 495 | static void __releases(agg_queue) | ||
| 496 | ieee80211_agg_splice_finish(struct ieee80211_local *local, u16 tid) | ||
| 497 | { | ||
| 498 | ieee80211_wake_queue_agg(local, tid); | ||
| 499 | } | ||
| 500 | |||
| 501 | static void ieee80211_agg_tx_operational(struct ieee80211_local *local, | 497 | static void ieee80211_agg_tx_operational(struct ieee80211_local *local, |
| 502 | struct sta_info *sta, u16 tid) | 498 | struct sta_info *sta, u16 tid) |
| 503 | { | 499 | { |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index d999bf3b84e1..cae443563ec9 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
| @@ -757,6 +757,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
| 757 | if (!local->int_scan_req) | 757 | if (!local->int_scan_req) |
| 758 | return -ENOMEM; | 758 | return -ENOMEM; |
| 759 | 759 | ||
| 760 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | ||
| 761 | if (!local->hw.wiphy->bands[band]) | ||
| 762 | continue; | ||
| 763 | local->int_scan_req->rates[band] = (u32) -1; | ||
| 764 | } | ||
| 765 | |||
| 760 | /* if low-level driver supports AP, we also support VLAN */ | 766 | /* if low-level driver supports AP, we also support VLAN */ |
| 761 | if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { | 767 | if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { |
| 762 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); | 768 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index eca0fad09709..d5230ecc784d 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
| @@ -1039,7 +1039,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
| 1039 | struct ieee80211_sub_if_data, | 1039 | struct ieee80211_sub_if_data, |
| 1040 | u.ap); | 1040 | u.ap); |
| 1041 | 1041 | ||
| 1042 | memset(&sta->sta.drv_priv, 0, hw->sta_data_size); | ||
| 1043 | WARN_ON(drv_sta_add(local, sdata, &sta->sta)); | 1042 | WARN_ON(drv_sta_add(local, sdata, &sta->sta)); |
| 1044 | } | 1043 | } |
| 1045 | } | 1044 | } |
diff --git a/net/netfilter/xt_connbytes.c b/net/netfilter/xt_connbytes.c index 5b138506690e..9ddf1c3bfb39 100644 --- a/net/netfilter/xt_connbytes.c +++ b/net/netfilter/xt_connbytes.c | |||
| @@ -87,10 +87,10 @@ connbytes_mt(const struct sk_buff *skb, struct xt_action_param *par) | |||
| 87 | break; | 87 | break; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | if (sinfo->count.to) | 90 | if (sinfo->count.to >= sinfo->count.from) |
| 91 | return what <= sinfo->count.to && what >= sinfo->count.from; | 91 | return what <= sinfo->count.to && what >= sinfo->count.from; |
| 92 | else | 92 | else /* inverted */ |
| 93 | return what >= sinfo->count.from; | 93 | return what < sinfo->count.to || what > sinfo->count.from; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | static int connbytes_mt_check(const struct xt_mtchk_param *par) | 96 | static int connbytes_mt_check(const struct xt_mtchk_param *par) |
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 3925c6578767..ea66034499ce 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
| @@ -69,7 +69,7 @@ static int __nci_request(struct nci_dev *ndev, | |||
| 69 | __u32 timeout) | 69 | __u32 timeout) |
| 70 | { | 70 | { |
| 71 | int rc = 0; | 71 | int rc = 0; |
| 72 | unsigned long completion_rc; | 72 | long completion_rc; |
| 73 | 73 | ||
| 74 | ndev->req_status = NCI_REQ_PEND; | 74 | ndev->req_status = NCI_REQ_PEND; |
| 75 | 75 | ||
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 82a6f34d39d0..3891702b81df 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
| @@ -1630,8 +1630,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, | |||
| 1630 | if (snaplen > res) | 1630 | if (snaplen > res) |
| 1631 | snaplen = res; | 1631 | snaplen = res; |
| 1632 | 1632 | ||
| 1633 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | 1633 | if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) |
| 1634 | (unsigned)sk->sk_rcvbuf) | ||
| 1635 | goto drop_n_acct; | 1634 | goto drop_n_acct; |
| 1636 | 1635 | ||
| 1637 | if (skb_shared(skb)) { | 1636 | if (skb_shared(skb)) { |
| @@ -1762,8 +1761,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
| 1762 | if (po->tp_version <= TPACKET_V2) { | 1761 | if (po->tp_version <= TPACKET_V2) { |
| 1763 | if (macoff + snaplen > po->rx_ring.frame_size) { | 1762 | if (macoff + snaplen > po->rx_ring.frame_size) { |
| 1764 | if (po->copy_thresh && | 1763 | if (po->copy_thresh && |
| 1765 | atomic_read(&sk->sk_rmem_alloc) + skb->truesize | 1764 | atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf) { |
| 1766 | < (unsigned)sk->sk_rcvbuf) { | ||
| 1767 | if (skb_shared(skb)) { | 1765 | if (skb_shared(skb)) { |
| 1768 | copy_skb = skb_clone(skb, GFP_ATOMIC); | 1766 | copy_skb = skb_clone(skb, GFP_ATOMIC); |
| 1769 | } else { | 1767 | } else { |
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index b9493a09a870..6cd8ddfb512d 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c | |||
| @@ -385,7 +385,7 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp, | |||
| 385 | struct gred_sched_data *q; | 385 | struct gred_sched_data *q; |
| 386 | 386 | ||
| 387 | if (table->tab[dp] == NULL) { | 387 | if (table->tab[dp] == NULL) { |
| 388 | table->tab[dp] = kzalloc(sizeof(*q), GFP_KERNEL); | 388 | table->tab[dp] = kzalloc(sizeof(*q), GFP_ATOMIC); |
| 389 | if (table->tab[dp] == NULL) | 389 | if (table->tab[dp] == NULL) |
| 390 | return -ENOMEM; | 390 | return -ENOMEM; |
| 391 | } | 391 | } |
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index f88256cbacbf..28de43092330 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c | |||
| @@ -107,7 +107,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt) | |||
| 107 | if (!netif_is_multiqueue(dev)) | 107 | if (!netif_is_multiqueue(dev)) |
| 108 | return -EOPNOTSUPP; | 108 | return -EOPNOTSUPP; |
| 109 | 109 | ||
| 110 | if (nla_len(opt) < sizeof(*qopt)) | 110 | if (!opt || nla_len(opt) < sizeof(*qopt)) |
| 111 | return -EINVAL; | 111 | return -EINVAL; |
| 112 | 112 | ||
| 113 | qopt = nla_data(opt); | 113 | qopt = nla_data(opt); |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 152b5b3c3fff..acd2edbc073e 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
| @@ -173,7 +173,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a | |||
| 173 | asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; | 173 | asoc->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] = 0; |
| 174 | asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; | 174 | asoc->timeouts[SCTP_EVENT_TIMEOUT_SACK] = asoc->sackdelay; |
| 175 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = | 175 | asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE] = |
| 176 | (unsigned long)sp->autoclose * HZ; | 176 | min_t(unsigned long, sp->autoclose, sctp_max_autoclose) * HZ; |
| 177 | 177 | ||
| 178 | /* Initializes the timers */ | 178 | /* Initializes the timers */ |
| 179 | for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) | 179 | for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) |
diff --git a/net/sctp/output.c b/net/sctp/output.c index 08b3cead6503..817174eb5f41 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
| @@ -697,13 +697,7 @@ static void sctp_packet_append_data(struct sctp_packet *packet, | |||
| 697 | /* Keep track of how many bytes are in flight to the receiver. */ | 697 | /* Keep track of how many bytes are in flight to the receiver. */ |
| 698 | asoc->outqueue.outstanding_bytes += datasize; | 698 | asoc->outqueue.outstanding_bytes += datasize; |
| 699 | 699 | ||
| 700 | /* Update our view of the receiver's rwnd. Include sk_buff overhead | 700 | /* Update our view of the receiver's rwnd. */ |
| 701 | * while updating peer.rwnd so that it reduces the chances of a | ||
| 702 | * receiver running out of receive buffer space even when receive | ||
| 703 | * window is still open. This can happen when a sender is sending | ||
| 704 | * sending small messages. | ||
| 705 | */ | ||
| 706 | datasize += sizeof(struct sk_buff); | ||
| 707 | if (datasize < rwnd) | 701 | if (datasize < rwnd) |
| 708 | rwnd -= datasize; | 702 | rwnd -= datasize; |
| 709 | else | 703 | else |
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 14c2b06028ff..cfeb1d4a1ee6 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
| @@ -411,8 +411,7 @@ void sctp_retransmit_mark(struct sctp_outq *q, | |||
| 411 | chunk->transport->flight_size -= | 411 | chunk->transport->flight_size -= |
| 412 | sctp_data_size(chunk); | 412 | sctp_data_size(chunk); |
| 413 | q->outstanding_bytes -= sctp_data_size(chunk); | 413 | q->outstanding_bytes -= sctp_data_size(chunk); |
| 414 | q->asoc->peer.rwnd += (sctp_data_size(chunk) + | 414 | q->asoc->peer.rwnd += sctp_data_size(chunk); |
| 415 | sizeof(struct sk_buff)); | ||
| 416 | } | 415 | } |
| 417 | continue; | 416 | continue; |
| 418 | } | 417 | } |
| @@ -432,8 +431,7 @@ void sctp_retransmit_mark(struct sctp_outq *q, | |||
| 432 | * (Section 7.2.4)), add the data size of those | 431 | * (Section 7.2.4)), add the data size of those |
| 433 | * chunks to the rwnd. | 432 | * chunks to the rwnd. |
| 434 | */ | 433 | */ |
| 435 | q->asoc->peer.rwnd += (sctp_data_size(chunk) + | 434 | q->asoc->peer.rwnd += sctp_data_size(chunk); |
| 436 | sizeof(struct sk_buff)); | ||
| 437 | q->outstanding_bytes -= sctp_data_size(chunk); | 435 | q->outstanding_bytes -= sctp_data_size(chunk); |
| 438 | if (chunk->transport) | 436 | if (chunk->transport) |
| 439 | transport->flight_size -= sctp_data_size(chunk); | 437 | transport->flight_size -= sctp_data_size(chunk); |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 61b9fca5a173..6f6ad8686833 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
| @@ -1285,6 +1285,9 @@ SCTP_STATIC __init int sctp_init(void) | |||
| 1285 | sctp_max_instreams = SCTP_DEFAULT_INSTREAMS; | 1285 | sctp_max_instreams = SCTP_DEFAULT_INSTREAMS; |
| 1286 | sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS; | 1286 | sctp_max_outstreams = SCTP_DEFAULT_OUTSTREAMS; |
| 1287 | 1287 | ||
| 1288 | /* Initialize maximum autoclose timeout. */ | ||
| 1289 | sctp_max_autoclose = INT_MAX / HZ; | ||
| 1290 | |||
| 1288 | /* Initialize handle used for association ids. */ | 1291 | /* Initialize handle used for association ids. */ |
| 1289 | idr_init(&sctp_assocs_id); | 1292 | idr_init(&sctp_assocs_id); |
| 1290 | 1293 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 13bf5fcdbff1..54a7cd2fdd7a 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -2200,8 +2200,6 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, | |||
| 2200 | return -EINVAL; | 2200 | return -EINVAL; |
| 2201 | if (copy_from_user(&sp->autoclose, optval, optlen)) | 2201 | if (copy_from_user(&sp->autoclose, optval, optlen)) |
| 2202 | return -EFAULT; | 2202 | return -EFAULT; |
| 2203 | /* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */ | ||
| 2204 | sp->autoclose = min_t(long, sp->autoclose, MAX_SCHEDULE_TIMEOUT / HZ); | ||
| 2205 | 2203 | ||
| 2206 | return 0; | 2204 | return 0; |
| 2207 | } | 2205 | } |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 6b3952961b85..60ffbd067ff7 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
| @@ -53,6 +53,10 @@ static int sack_timer_min = 1; | |||
| 53 | static int sack_timer_max = 500; | 53 | static int sack_timer_max = 500; |
| 54 | static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */ | 54 | static int addr_scope_max = 3; /* check sctp_scope_policy_t in include/net/sctp/constants.h for max entries */ |
| 55 | static int rwnd_scale_max = 16; | 55 | static int rwnd_scale_max = 16; |
| 56 | static unsigned long max_autoclose_min = 0; | ||
| 57 | static unsigned long max_autoclose_max = | ||
| 58 | (MAX_SCHEDULE_TIMEOUT / HZ > UINT_MAX) | ||
| 59 | ? UINT_MAX : MAX_SCHEDULE_TIMEOUT / HZ; | ||
| 56 | 60 | ||
| 57 | extern long sysctl_sctp_mem[3]; | 61 | extern long sysctl_sctp_mem[3]; |
| 58 | extern int sysctl_sctp_rmem[3]; | 62 | extern int sysctl_sctp_rmem[3]; |
| @@ -258,6 +262,15 @@ static ctl_table sctp_table[] = { | |||
| 258 | .extra1 = &one, | 262 | .extra1 = &one, |
| 259 | .extra2 = &rwnd_scale_max, | 263 | .extra2 = &rwnd_scale_max, |
| 260 | }, | 264 | }, |
| 265 | { | ||
| 266 | .procname = "max_autoclose", | ||
| 267 | .data = &sctp_max_autoclose, | ||
| 268 | .maxlen = sizeof(unsigned long), | ||
| 269 | .mode = 0644, | ||
| 270 | .proc_handler = &proc_doulongvec_minmax, | ||
| 271 | .extra1 = &max_autoclose_min, | ||
| 272 | .extra2 = &max_autoclose_max, | ||
| 273 | }, | ||
| 261 | 274 | ||
| 262 | { /* sentinel */ } | 275 | { /* sentinel */ } |
| 263 | }; | 276 | }; |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index d12ffa545811..00a1a2acd587 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
| @@ -590,6 +590,27 @@ void rpc_prepare_task(struct rpc_task *task) | |||
| 590 | task->tk_ops->rpc_call_prepare(task, task->tk_calldata); | 590 | task->tk_ops->rpc_call_prepare(task, task->tk_calldata); |
| 591 | } | 591 | } |
| 592 | 592 | ||
| 593 | static void | ||
| 594 | rpc_init_task_statistics(struct rpc_task *task) | ||
| 595 | { | ||
| 596 | /* Initialize retry counters */ | ||
| 597 | task->tk_garb_retry = 2; | ||
| 598 | task->tk_cred_retry = 2; | ||
| 599 | task->tk_rebind_retry = 2; | ||
| 600 | |||
| 601 | /* starting timestamp */ | ||
| 602 | task->tk_start = ktime_get(); | ||
| 603 | } | ||
| 604 | |||
| 605 | static void | ||
| 606 | rpc_reset_task_statistics(struct rpc_task *task) | ||
| 607 | { | ||
| 608 | task->tk_timeouts = 0; | ||
| 609 | task->tk_flags &= ~(RPC_CALL_MAJORSEEN|RPC_TASK_KILLED|RPC_TASK_SENT); | ||
| 610 | |||
| 611 | rpc_init_task_statistics(task); | ||
| 612 | } | ||
| 613 | |||
| 593 | /* | 614 | /* |
| 594 | * Helper that calls task->tk_ops->rpc_call_done if it exists | 615 | * Helper that calls task->tk_ops->rpc_call_done if it exists |
| 595 | */ | 616 | */ |
| @@ -602,6 +623,7 @@ void rpc_exit_task(struct rpc_task *task) | |||
| 602 | WARN_ON(RPC_ASSASSINATED(task)); | 623 | WARN_ON(RPC_ASSASSINATED(task)); |
| 603 | /* Always release the RPC slot and buffer memory */ | 624 | /* Always release the RPC slot and buffer memory */ |
| 604 | xprt_release(task); | 625 | xprt_release(task); |
| 626 | rpc_reset_task_statistics(task); | ||
| 605 | } | 627 | } |
| 606 | } | 628 | } |
| 607 | } | 629 | } |
| @@ -804,11 +826,6 @@ static void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *ta | |||
| 804 | task->tk_calldata = task_setup_data->callback_data; | 826 | task->tk_calldata = task_setup_data->callback_data; |
| 805 | INIT_LIST_HEAD(&task->tk_task); | 827 | INIT_LIST_HEAD(&task->tk_task); |
| 806 | 828 | ||
| 807 | /* Initialize retry counters */ | ||
| 808 | task->tk_garb_retry = 2; | ||
| 809 | task->tk_cred_retry = 2; | ||
| 810 | task->tk_rebind_retry = 2; | ||
| 811 | |||
| 812 | task->tk_priority = task_setup_data->priority - RPC_PRIORITY_LOW; | 829 | task->tk_priority = task_setup_data->priority - RPC_PRIORITY_LOW; |
| 813 | task->tk_owner = current->tgid; | 830 | task->tk_owner = current->tgid; |
| 814 | 831 | ||
| @@ -818,8 +835,7 @@ static void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *ta | |||
| 818 | if (task->tk_ops->rpc_call_prepare != NULL) | 835 | if (task->tk_ops->rpc_call_prepare != NULL) |
| 819 | task->tk_action = rpc_prepare_task; | 836 | task->tk_action = rpc_prepare_task; |
| 820 | 837 | ||
| 821 | /* starting timestamp */ | 838 | rpc_init_task_statistics(task); |
| 822 | task->tk_start = ktime_get(); | ||
| 823 | 839 | ||
| 824 | dprintk("RPC: new task initialized, procpid %u\n", | 840 | dprintk("RPC: new task initialized, procpid %u\n", |
| 825 | task_pid_nr(current)); | 841 | task_pid_nr(current)); |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index f4385e45a5fc..c64c0ef519b5 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
| @@ -995,13 +995,11 @@ out_init_req: | |||
| 995 | 995 | ||
| 996 | static void xprt_free_slot(struct rpc_xprt *xprt, struct rpc_rqst *req) | 996 | static void xprt_free_slot(struct rpc_xprt *xprt, struct rpc_rqst *req) |
| 997 | { | 997 | { |
| 998 | if (xprt_dynamic_free_slot(xprt, req)) | ||
| 999 | return; | ||
| 1000 | |||
| 1001 | memset(req, 0, sizeof(*req)); /* mark unused */ | ||
| 1002 | |||
| 1003 | spin_lock(&xprt->reserve_lock); | 998 | spin_lock(&xprt->reserve_lock); |
| 1004 | list_add(&req->rq_list, &xprt->free); | 999 | if (!xprt_dynamic_free_slot(xprt, req)) { |
| 1000 | memset(req, 0, sizeof(*req)); /* mark unused */ | ||
| 1001 | list_add(&req->rq_list, &xprt->free); | ||
| 1002 | } | ||
| 1005 | rpc_wake_up_next(&xprt->backlog); | 1003 | rpc_wake_up_next(&xprt->backlog); |
| 1006 | spin_unlock(&xprt->reserve_lock); | 1004 | spin_unlock(&xprt->reserve_lock); |
| 1007 | } | 1005 | } |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 77e926738014..3302c56f60d1 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
| @@ -57,8 +57,17 @@ | |||
| 57 | #define REG_DBG_PRINT(args...) | 57 | #define REG_DBG_PRINT(args...) |
| 58 | #endif | 58 | #endif |
| 59 | 59 | ||
| 60 | static struct regulatory_request core_request_world = { | ||
| 61 | .initiator = NL80211_REGDOM_SET_BY_CORE, | ||
| 62 | .alpha2[0] = '0', | ||
| 63 | .alpha2[1] = '0', | ||
| 64 | .intersect = false, | ||
| 65 | .processed = true, | ||
| 66 | .country_ie_env = ENVIRON_ANY, | ||
| 67 | }; | ||
| 68 | |||
| 60 | /* Receipt of information from last regulatory request */ | 69 | /* Receipt of information from last regulatory request */ |
| 61 | static struct regulatory_request *last_request; | 70 | static struct regulatory_request *last_request = &core_request_world; |
| 62 | 71 | ||
| 63 | /* To trigger userspace events */ | 72 | /* To trigger userspace events */ |
| 64 | static struct platform_device *reg_pdev; | 73 | static struct platform_device *reg_pdev; |
| @@ -150,7 +159,7 @@ static char user_alpha2[2]; | |||
| 150 | module_param(ieee80211_regdom, charp, 0444); | 159 | module_param(ieee80211_regdom, charp, 0444); |
| 151 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); | 160 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); |
| 152 | 161 | ||
| 153 | static void reset_regdomains(void) | 162 | static void reset_regdomains(bool full_reset) |
| 154 | { | 163 | { |
| 155 | /* avoid freeing static information or freeing something twice */ | 164 | /* avoid freeing static information or freeing something twice */ |
| 156 | if (cfg80211_regdomain == cfg80211_world_regdom) | 165 | if (cfg80211_regdomain == cfg80211_world_regdom) |
| @@ -165,6 +174,13 @@ static void reset_regdomains(void) | |||
| 165 | 174 | ||
| 166 | cfg80211_world_regdom = &world_regdom; | 175 | cfg80211_world_regdom = &world_regdom; |
| 167 | cfg80211_regdomain = NULL; | 176 | cfg80211_regdomain = NULL; |
| 177 | |||
| 178 | if (!full_reset) | ||
| 179 | return; | ||
| 180 | |||
| 181 | if (last_request != &core_request_world) | ||
| 182 | kfree(last_request); | ||
| 183 | last_request = &core_request_world; | ||
| 168 | } | 184 | } |
| 169 | 185 | ||
| 170 | /* | 186 | /* |
| @@ -175,7 +191,7 @@ static void update_world_regdomain(const struct ieee80211_regdomain *rd) | |||
| 175 | { | 191 | { |
| 176 | BUG_ON(!last_request); | 192 | BUG_ON(!last_request); |
| 177 | 193 | ||
| 178 | reset_regdomains(); | 194 | reset_regdomains(false); |
| 179 | 195 | ||
| 180 | cfg80211_world_regdom = rd; | 196 | cfg80211_world_regdom = rd; |
| 181 | cfg80211_regdomain = rd; | 197 | cfg80211_regdomain = rd; |
| @@ -1407,7 +1423,8 @@ static int __regulatory_hint(struct wiphy *wiphy, | |||
| 1407 | } | 1423 | } |
| 1408 | 1424 | ||
| 1409 | new_request: | 1425 | new_request: |
| 1410 | kfree(last_request); | 1426 | if (last_request != &core_request_world) |
| 1427 | kfree(last_request); | ||
| 1411 | 1428 | ||
| 1412 | last_request = pending_request; | 1429 | last_request = pending_request; |
| 1413 | last_request->intersect = intersect; | 1430 | last_request->intersect = intersect; |
| @@ -1577,9 +1594,6 @@ static int regulatory_hint_core(const char *alpha2) | |||
| 1577 | { | 1594 | { |
| 1578 | struct regulatory_request *request; | 1595 | struct regulatory_request *request; |
| 1579 | 1596 | ||
| 1580 | kfree(last_request); | ||
| 1581 | last_request = NULL; | ||
| 1582 | |||
| 1583 | request = kzalloc(sizeof(struct regulatory_request), | 1597 | request = kzalloc(sizeof(struct regulatory_request), |
| 1584 | GFP_KERNEL); | 1598 | GFP_KERNEL); |
| 1585 | if (!request) | 1599 | if (!request) |
| @@ -1777,7 +1791,7 @@ static void restore_regulatory_settings(bool reset_user) | |||
| 1777 | mutex_lock(&cfg80211_mutex); | 1791 | mutex_lock(&cfg80211_mutex); |
| 1778 | mutex_lock(®_mutex); | 1792 | mutex_lock(®_mutex); |
| 1779 | 1793 | ||
| 1780 | reset_regdomains(); | 1794 | reset_regdomains(true); |
| 1781 | restore_alpha2(alpha2, reset_user); | 1795 | restore_alpha2(alpha2, reset_user); |
| 1782 | 1796 | ||
| 1783 | /* | 1797 | /* |
| @@ -2037,8 +2051,10 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
| 2037 | } | 2051 | } |
| 2038 | 2052 | ||
| 2039 | request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); | 2053 | request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); |
| 2040 | if (!request_wiphy) { | 2054 | if (!request_wiphy && |
| 2041 | reg_set_request_processed(); | 2055 | (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER || |
| 2056 | last_request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE)) { | ||
| 2057 | schedule_delayed_work(®_timeout, 0); | ||
| 2042 | return -ENODEV; | 2058 | return -ENODEV; |
| 2043 | } | 2059 | } |
| 2044 | 2060 | ||
| @@ -2046,7 +2062,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
| 2046 | int r; | 2062 | int r; |
| 2047 | 2063 | ||
| 2048 | if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { | 2064 | if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { |
| 2049 | reset_regdomains(); | 2065 | reset_regdomains(false); |
| 2050 | cfg80211_regdomain = rd; | 2066 | cfg80211_regdomain = rd; |
| 2051 | return 0; | 2067 | return 0; |
| 2052 | } | 2068 | } |
| @@ -2067,7 +2083,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
| 2067 | if (r) | 2083 | if (r) |
| 2068 | return r; | 2084 | return r; |
| 2069 | 2085 | ||
| 2070 | reset_regdomains(); | 2086 | reset_regdomains(false); |
| 2071 | cfg80211_regdomain = rd; | 2087 | cfg80211_regdomain = rd; |
| 2072 | return 0; | 2088 | return 0; |
| 2073 | } | 2089 | } |
| @@ -2092,7 +2108,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
| 2092 | 2108 | ||
| 2093 | rd = NULL; | 2109 | rd = NULL; |
| 2094 | 2110 | ||
| 2095 | reset_regdomains(); | 2111 | reset_regdomains(false); |
| 2096 | cfg80211_regdomain = intersected_rd; | 2112 | cfg80211_regdomain = intersected_rd; |
| 2097 | 2113 | ||
| 2098 | return 0; | 2114 | return 0; |
| @@ -2112,7 +2128,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
| 2112 | kfree(rd); | 2128 | kfree(rd); |
| 2113 | rd = NULL; | 2129 | rd = NULL; |
| 2114 | 2130 | ||
| 2115 | reset_regdomains(); | 2131 | reset_regdomains(false); |
| 2116 | cfg80211_regdomain = intersected_rd; | 2132 | cfg80211_regdomain = intersected_rd; |
| 2117 | 2133 | ||
| 2118 | return 0; | 2134 | return 0; |
| @@ -2265,11 +2281,8 @@ void /* __init_or_exit */ regulatory_exit(void) | |||
| 2265 | mutex_lock(&cfg80211_mutex); | 2281 | mutex_lock(&cfg80211_mutex); |
| 2266 | mutex_lock(®_mutex); | 2282 | mutex_lock(®_mutex); |
| 2267 | 2283 | ||
| 2268 | reset_regdomains(); | 2284 | reset_regdomains(true); |
| 2269 | |||
| 2270 | kfree(last_request); | ||
| 2271 | 2285 | ||
| 2272 | last_request = NULL; | ||
| 2273 | dev_set_uevent_suppress(®_pdev->dev, true); | 2286 | dev_set_uevent_suppress(®_pdev->dev, true); |
| 2274 | 2287 | ||
| 2275 | platform_device_unregister(reg_pdev); | 2288 | platform_device_unregister(reg_pdev); |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 2118d6446630..9049a5caeb25 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
| @@ -2276,8 +2276,6 @@ static void __xfrm_garbage_collect(struct net *net) | |||
| 2276 | { | 2276 | { |
| 2277 | struct dst_entry *head, *next; | 2277 | struct dst_entry *head, *next; |
| 2278 | 2278 | ||
| 2279 | flow_cache_flush(); | ||
| 2280 | |||
| 2281 | spin_lock_bh(&xfrm_policy_sk_bundle_lock); | 2279 | spin_lock_bh(&xfrm_policy_sk_bundle_lock); |
| 2282 | head = xfrm_policy_sk_bundles; | 2280 | head = xfrm_policy_sk_bundles; |
| 2283 | xfrm_policy_sk_bundles = NULL; | 2281 | xfrm_policy_sk_bundles = NULL; |
| @@ -2290,6 +2288,18 @@ static void __xfrm_garbage_collect(struct net *net) | |||
| 2290 | } | 2288 | } |
| 2291 | } | 2289 | } |
| 2292 | 2290 | ||
| 2291 | static void xfrm_garbage_collect(struct net *net) | ||
| 2292 | { | ||
| 2293 | flow_cache_flush(); | ||
| 2294 | __xfrm_garbage_collect(net); | ||
| 2295 | } | ||
| 2296 | |||
| 2297 | static void xfrm_garbage_collect_deferred(struct net *net) | ||
| 2298 | { | ||
| 2299 | flow_cache_flush_deferred(); | ||
| 2300 | __xfrm_garbage_collect(net); | ||
| 2301 | } | ||
| 2302 | |||
| 2293 | static void xfrm_init_pmtu(struct dst_entry *dst) | 2303 | static void xfrm_init_pmtu(struct dst_entry *dst) |
| 2294 | { | 2304 | { |
| 2295 | do { | 2305 | do { |
| @@ -2422,7 +2432,7 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
| 2422 | if (likely(dst_ops->neigh_lookup == NULL)) | 2432 | if (likely(dst_ops->neigh_lookup == NULL)) |
| 2423 | dst_ops->neigh_lookup = xfrm_neigh_lookup; | 2433 | dst_ops->neigh_lookup = xfrm_neigh_lookup; |
| 2424 | if (likely(afinfo->garbage_collect == NULL)) | 2434 | if (likely(afinfo->garbage_collect == NULL)) |
| 2425 | afinfo->garbage_collect = __xfrm_garbage_collect; | 2435 | afinfo->garbage_collect = xfrm_garbage_collect_deferred; |
| 2426 | xfrm_policy_afinfo[afinfo->family] = afinfo; | 2436 | xfrm_policy_afinfo[afinfo->family] = afinfo; |
| 2427 | } | 2437 | } |
| 2428 | write_unlock_bh(&xfrm_policy_afinfo_lock); | 2438 | write_unlock_bh(&xfrm_policy_afinfo_lock); |
| @@ -2516,7 +2526,7 @@ static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void | |||
| 2516 | 2526 | ||
| 2517 | switch (event) { | 2527 | switch (event) { |
| 2518 | case NETDEV_DOWN: | 2528 | case NETDEV_DOWN: |
| 2519 | __xfrm_garbage_collect(dev_net(dev)); | 2529 | xfrm_garbage_collect(dev_net(dev)); |
| 2520 | } | 2530 | } |
| 2521 | return NOTIFY_DONE; | 2531 | return NOTIFY_DONE; |
| 2522 | } | 2532 | } |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index ba573fe7c74d..914833d99b06 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
| @@ -60,8 +60,8 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h | |||
| 60 | --directory=$(srctree) --directory=$(objtree) \ | 60 | --directory=$(srctree) --directory=$(objtree) \ |
| 61 | --output $(obj)/config.pot | 61 | --output $(obj)/config.pot |
| 62 | $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot | 62 | $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot |
| 63 | $(Q)ln -fs Kconfig.x86 arch/um/Kconfig | 63 | $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ |
| 64 | $(Q)(for i in `ls $(srctree)/arch/*/Kconfig`; \ | 64 | $(srctree)/arch/*/um/Kconfig`; \ |
| 65 | do \ | 65 | do \ |
| 66 | echo " GEN $$i"; \ | 66 | echo " GEN $$i"; \ |
| 67 | $(obj)/kxgettext $$i \ | 67 | $(obj)/kxgettext $$i \ |
| @@ -69,7 +69,6 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h | |||
| 69 | done ) | 69 | done ) |
| 70 | $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ | 70 | $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ |
| 71 | --output $(obj)/linux.pot | 71 | --output $(obj)/linux.pot |
| 72 | $(Q)rm -f $(srctree)/arch/um/Kconfig | ||
| 73 | $(Q)rm -f $(obj)/config.pot | 72 | $(Q)rm -f $(obj)/config.pot |
| 74 | 73 | ||
| 75 | PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig | 74 | PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig |
diff --git a/security/apparmor/path.c b/security/apparmor/path.c index 36cc0cc39e78..b566eba4a65c 100644 --- a/security/apparmor/path.c +++ b/security/apparmor/path.c | |||
| @@ -57,23 +57,44 @@ static int prepend(char **buffer, int buflen, const char *str, int namelen) | |||
| 57 | static int d_namespace_path(struct path *path, char *buf, int buflen, | 57 | static int d_namespace_path(struct path *path, char *buf, int buflen, |
| 58 | char **name, int flags) | 58 | char **name, int flags) |
| 59 | { | 59 | { |
| 60 | struct path root, tmp; | ||
| 61 | char *res; | 60 | char *res; |
| 62 | int connected, error = 0; | 61 | int error = 0; |
| 62 | int connected = 1; | ||
| 63 | |||
| 64 | if (path->mnt->mnt_flags & MNT_INTERNAL) { | ||
| 65 | /* it's not mounted anywhere */ | ||
| 66 | res = dentry_path(path->dentry, buf, buflen); | ||
| 67 | *name = res; | ||
| 68 | if (IS_ERR(res)) { | ||
| 69 | *name = buf; | ||
| 70 | return PTR_ERR(res); | ||
| 71 | } | ||
| 72 | if (path->dentry->d_sb->s_magic == PROC_SUPER_MAGIC && | ||
| 73 | strncmp(*name, "/sys/", 5) == 0) { | ||
| 74 | /* TODO: convert over to using a per namespace | ||
| 75 | * control instead of hard coded /proc | ||
| 76 | */ | ||
| 77 | return prepend(name, *name - buf, "/proc", 5); | ||
| 78 | } | ||
| 79 | return 0; | ||
| 80 | } | ||
| 63 | 81 | ||
| 64 | /* Get the root we want to resolve too, released below */ | 82 | /* resolve paths relative to chroot?*/ |
| 65 | if (flags & PATH_CHROOT_REL) { | 83 | if (flags & PATH_CHROOT_REL) { |
| 66 | /* resolve paths relative to chroot */ | 84 | struct path root; |
| 67 | get_fs_root(current->fs, &root); | 85 | get_fs_root(current->fs, &root); |
| 68 | } else { | 86 | res = __d_path(path, &root, buf, buflen); |
| 69 | /* resolve paths relative to namespace */ | 87 | if (res && !IS_ERR(res)) { |
| 70 | root.mnt = current->nsproxy->mnt_ns->root; | 88 | /* everything's fine */ |
| 71 | root.dentry = root.mnt->mnt_root; | 89 | *name = res; |
| 72 | path_get(&root); | 90 | path_put(&root); |
| 91 | goto ok; | ||
| 92 | } | ||
| 93 | path_put(&root); | ||
| 94 | connected = 0; | ||
| 73 | } | 95 | } |
| 74 | 96 | ||
| 75 | tmp = root; | 97 | res = d_absolute_path(path, buf, buflen); |
| 76 | res = __d_path(path, &tmp, buf, buflen); | ||
| 77 | 98 | ||
| 78 | *name = res; | 99 | *name = res; |
| 79 | /* handle error conditions - and still allow a partial path to | 100 | /* handle error conditions - and still allow a partial path to |
| @@ -84,7 +105,10 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, | |||
| 84 | *name = buf; | 105 | *name = buf; |
| 85 | goto out; | 106 | goto out; |
| 86 | } | 107 | } |
| 108 | if (!our_mnt(path->mnt)) | ||
| 109 | connected = 0; | ||
| 87 | 110 | ||
| 111 | ok: | ||
| 88 | /* Handle two cases: | 112 | /* Handle two cases: |
| 89 | * 1. A deleted dentry && profile is not allowing mediation of deleted | 113 | * 1. A deleted dentry && profile is not allowing mediation of deleted |
| 90 | * 2. On some filesystems, newly allocated dentries appear to the | 114 | * 2. On some filesystems, newly allocated dentries appear to the |
| @@ -97,10 +121,7 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, | |||
| 97 | goto out; | 121 | goto out; |
| 98 | } | 122 | } |
| 99 | 123 | ||
| 100 | /* Determine if the path is connected to the expected root */ | 124 | /* If the path is not connected to the expected root, |
| 101 | connected = tmp.dentry == root.dentry && tmp.mnt == root.mnt; | ||
| 102 | |||
| 103 | /* If the path is not connected, | ||
| 104 | * check if it is a sysctl and handle specially else remove any | 125 | * check if it is a sysctl and handle specially else remove any |
| 105 | * leading / that __d_path may have returned. | 126 | * leading / that __d_path may have returned. |
| 106 | * Unless | 127 | * Unless |
| @@ -112,17 +133,9 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, | |||
| 112 | * namespace root. | 133 | * namespace root. |
| 113 | */ | 134 | */ |
| 114 | if (!connected) { | 135 | if (!connected) { |
| 115 | /* is the disconnect path a sysctl? */ | 136 | if (!(flags & PATH_CONNECT_PATH) && |
| 116 | if (tmp.dentry->d_sb->s_magic == PROC_SUPER_MAGIC && | ||
| 117 | strncmp(*name, "/sys/", 5) == 0) { | ||
| 118 | /* TODO: convert over to using a per namespace | ||
| 119 | * control instead of hard coded /proc | ||
| 120 | */ | ||
| 121 | error = prepend(name, *name - buf, "/proc", 5); | ||
| 122 | } else if (!(flags & PATH_CONNECT_PATH) && | ||
| 123 | !(((flags & CHROOT_NSCONNECT) == CHROOT_NSCONNECT) && | 137 | !(((flags & CHROOT_NSCONNECT) == CHROOT_NSCONNECT) && |
| 124 | (tmp.mnt == current->nsproxy->mnt_ns->root && | 138 | our_mnt(path->mnt))) { |
| 125 | tmp.dentry == tmp.mnt->mnt_root))) { | ||
| 126 | /* disconnected path, don't return pathname starting | 139 | /* disconnected path, don't return pathname starting |
| 127 | * with '/' | 140 | * with '/' |
| 128 | */ | 141 | */ |
| @@ -133,8 +146,6 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, | |||
| 133 | } | 146 | } |
| 134 | 147 | ||
| 135 | out: | 148 | out: |
| 136 | path_put(&root); | ||
| 137 | |||
| 138 | return error; | 149 | return error; |
| 139 | } | 150 | } |
| 140 | 151 | ||
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c index 5dd5b140242c..8738deff26fa 100644 --- a/security/integrity/evm/evm_crypto.c +++ b/security/integrity/evm/evm_crypto.c | |||
| @@ -27,20 +27,35 @@ static int evmkey_len = MAX_KEY_SIZE; | |||
| 27 | 27 | ||
| 28 | struct crypto_shash *hmac_tfm; | 28 | struct crypto_shash *hmac_tfm; |
| 29 | 29 | ||
| 30 | static DEFINE_MUTEX(mutex); | ||
| 31 | |||
| 30 | static struct shash_desc *init_desc(void) | 32 | static struct shash_desc *init_desc(void) |
| 31 | { | 33 | { |
| 32 | int rc; | 34 | int rc; |
| 33 | struct shash_desc *desc; | 35 | struct shash_desc *desc; |
| 34 | 36 | ||
| 35 | if (hmac_tfm == NULL) { | 37 | if (hmac_tfm == NULL) { |
| 38 | mutex_lock(&mutex); | ||
| 39 | if (hmac_tfm) | ||
| 40 | goto out; | ||
| 36 | hmac_tfm = crypto_alloc_shash(evm_hmac, 0, CRYPTO_ALG_ASYNC); | 41 | hmac_tfm = crypto_alloc_shash(evm_hmac, 0, CRYPTO_ALG_ASYNC); |
| 37 | if (IS_ERR(hmac_tfm)) { | 42 | if (IS_ERR(hmac_tfm)) { |
| 38 | pr_err("Can not allocate %s (reason: %ld)\n", | 43 | pr_err("Can not allocate %s (reason: %ld)\n", |
| 39 | evm_hmac, PTR_ERR(hmac_tfm)); | 44 | evm_hmac, PTR_ERR(hmac_tfm)); |
| 40 | rc = PTR_ERR(hmac_tfm); | 45 | rc = PTR_ERR(hmac_tfm); |
| 41 | hmac_tfm = NULL; | 46 | hmac_tfm = NULL; |
| 47 | mutex_unlock(&mutex); | ||
| 48 | return ERR_PTR(rc); | ||
| 49 | } | ||
| 50 | rc = crypto_shash_setkey(hmac_tfm, evmkey, evmkey_len); | ||
| 51 | if (rc) { | ||
| 52 | crypto_free_shash(hmac_tfm); | ||
| 53 | hmac_tfm = NULL; | ||
| 54 | mutex_unlock(&mutex); | ||
| 42 | return ERR_PTR(rc); | 55 | return ERR_PTR(rc); |
| 43 | } | 56 | } |
| 57 | out: | ||
| 58 | mutex_unlock(&mutex); | ||
| 44 | } | 59 | } |
| 45 | 60 | ||
| 46 | desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(hmac_tfm), | 61 | desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(hmac_tfm), |
| @@ -51,11 +66,7 @@ static struct shash_desc *init_desc(void) | |||
| 51 | desc->tfm = hmac_tfm; | 66 | desc->tfm = hmac_tfm; |
| 52 | desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP; | 67 | desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP; |
| 53 | 68 | ||
| 54 | rc = crypto_shash_setkey(hmac_tfm, evmkey, evmkey_len); | ||
| 55 | if (rc) | ||
| 56 | goto out; | ||
| 57 | rc = crypto_shash_init(desc); | 69 | rc = crypto_shash_init(desc); |
| 58 | out: | ||
| 59 | if (rc) { | 70 | if (rc) { |
| 60 | kfree(desc); | 71 | kfree(desc); |
| 61 | return ERR_PTR(rc); | 72 | return ERR_PTR(rc); |
diff --git a/security/selinux/netport.c b/security/selinux/netport.c index 0b62bd112461..7b9eb1faf68b 100644 --- a/security/selinux/netport.c +++ b/security/selinux/netport.c | |||
| @@ -123,7 +123,9 @@ static void sel_netport_insert(struct sel_netport *port) | |||
| 123 | if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) { | 123 | if (sel_netport_hash[idx].size == SEL_NETPORT_HASH_BKT_LIMIT) { |
| 124 | struct sel_netport *tail; | 124 | struct sel_netport *tail; |
| 125 | tail = list_entry( | 125 | tail = list_entry( |
| 126 | rcu_dereference(sel_netport_hash[idx].list.prev), | 126 | rcu_dereference_protected( |
| 127 | sel_netport_hash[idx].list.prev, | ||
| 128 | lockdep_is_held(&sel_netport_lock)), | ||
| 127 | struct sel_netport, list); | 129 | struct sel_netport, list); |
| 128 | list_del_rcu(&tail->list); | 130 | list_del_rcu(&tail->list); |
| 129 | kfree_rcu(tail, rcu); | 131 | kfree_rcu(tail, rcu); |
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index 738bbdf8d4c7..d9f3ced8756e 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
| @@ -101,9 +101,8 @@ static char *tomoyo_get_absolute_path(struct path *path, char * const buffer, | |||
| 101 | { | 101 | { |
| 102 | char *pos = ERR_PTR(-ENOMEM); | 102 | char *pos = ERR_PTR(-ENOMEM); |
| 103 | if (buflen >= 256) { | 103 | if (buflen >= 256) { |
| 104 | struct path ns_root = { }; | ||
| 105 | /* go to whatever namespace root we are under */ | 104 | /* go to whatever namespace root we are under */ |
| 106 | pos = __d_path(path, &ns_root, buffer, buflen - 1); | 105 | pos = d_absolute_path(path, buffer, buflen - 1); |
| 107 | if (!IS_ERR(pos) && *pos == '/' && pos[1]) { | 106 | if (!IS_ERR(pos) && *pos == '/' && pos[1]) { |
| 108 | struct inode *inode = path->dentry->d_inode; | 107 | struct inode *inode = path->dentry->d_inode; |
| 109 | if (inode && S_ISDIR(inode->i_mode)) { | 108 | if (inode && S_ISDIR(inode->i_mode)) { |
| @@ -294,8 +293,16 @@ char *tomoyo_realpath_from_path(struct path *path) | |||
| 294 | pos = tomoyo_get_local_path(path->dentry, buf, | 293 | pos = tomoyo_get_local_path(path->dentry, buf, |
| 295 | buf_len - 1); | 294 | buf_len - 1); |
| 296 | /* Get absolute name for the rest. */ | 295 | /* Get absolute name for the rest. */ |
| 297 | else | 296 | else { |
| 298 | pos = tomoyo_get_absolute_path(path, buf, buf_len - 1); | 297 | pos = tomoyo_get_absolute_path(path, buf, buf_len - 1); |
| 298 | /* | ||
| 299 | * Fall back to local name if absolute name is not | ||
| 300 | * available. | ||
| 301 | */ | ||
| 302 | if (pos == ERR_PTR(-EINVAL)) | ||
| 303 | pos = tomoyo_get_local_path(path->dentry, buf, | ||
| 304 | buf_len - 1); | ||
| 305 | } | ||
| 299 | encode: | 306 | encode: |
| 300 | if (IS_ERR(pos)) | 307 | if (IS_ERR(pos)) |
| 301 | continue; | 308 | continue; |
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 6e5addeb236b..73516f69ac7c 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c | |||
| @@ -899,6 +899,10 @@ static void atmel_ac97c_reset(struct atmel_ac97c *chip) | |||
| 899 | /* AC97 v2.2 specifications says minimum 1 us. */ | 899 | /* AC97 v2.2 specifications says minimum 1 us. */ |
| 900 | udelay(2); | 900 | udelay(2); |
| 901 | gpio_set_value(chip->reset_pin, 1); | 901 | gpio_set_value(chip->reset_pin, 1); |
| 902 | } else { | ||
| 903 | ac97c_writel(chip, MR, AC97C_MR_WRST | AC97C_MR_ENA); | ||
| 904 | udelay(2); | ||
| 905 | ac97c_writel(chip, MR, AC97C_MR_ENA); | ||
| 902 | } | 906 | } |
| 903 | } | 907 | } |
| 904 | 908 | ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 7d98240def0b..c2f79e63124d 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -2507,6 +2507,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { | |||
| 2507 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2507 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
| 2508 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2508 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
| 2509 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), | 2509 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), |
| 2510 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS 1101HA", POS_FIX_LPIB), | ||
| 2510 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), | 2511 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), |
| 2511 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), | 2512 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), |
| 2512 | SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), | 2513 | SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), |
| @@ -2970,7 +2971,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
| 2970 | /* SCH */ | 2971 | /* SCH */ |
| 2971 | { PCI_DEVICE(0x8086, 0x811b), | 2972 | { PCI_DEVICE(0x8086, 0x811b), |
| 2972 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | | 2973 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | |
| 2973 | AZX_DCAPS_BUFSIZE}, | 2974 | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Poulsbo */ |
| 2975 | /* ICH */ | ||
| 2974 | { PCI_DEVICE(0x8086, 0x2668), | 2976 | { PCI_DEVICE(0x8086, 0x2668), |
| 2975 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | | 2977 | .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | |
| 2976 | AZX_DCAPS_BUFSIZE }, /* ICH6 */ | 2978 | AZX_DCAPS_BUFSIZE }, /* ICH6 */ |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index cbde019d3d52..1d07e8fa2433 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -297,6 +297,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
| 297 | imux = &spec->input_mux[mux_idx]; | 297 | imux = &spec->input_mux[mux_idx]; |
| 298 | if (!imux->num_items && mux_idx > 0) | 298 | if (!imux->num_items && mux_idx > 0) |
| 299 | imux = &spec->input_mux[0]; | 299 | imux = &spec->input_mux[0]; |
| 300 | if (!imux->num_items) | ||
| 301 | return 0; | ||
| 300 | 302 | ||
| 301 | if (idx >= imux->num_items) | 303 | if (idx >= imux->num_items) |
| 302 | idx = imux->num_items - 1; | 304 | idx = imux->num_items - 1; |
| @@ -2629,6 +2631,8 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, | |||
| 2629 | case AUTO_PIN_SPEAKER_OUT: | 2631 | case AUTO_PIN_SPEAKER_OUT: |
| 2630 | if (cfg->line_outs == 1) | 2632 | if (cfg->line_outs == 1) |
| 2631 | return "Speaker"; | 2633 | return "Speaker"; |
| 2634 | if (cfg->line_outs == 2) | ||
| 2635 | return ch ? "Bass Speaker" : "Speaker"; | ||
| 2632 | break; | 2636 | break; |
| 2633 | case AUTO_PIN_HP_OUT: | 2637 | case AUTO_PIN_HP_OUT: |
| 2634 | /* for multi-io case, only the primary out */ | 2638 | /* for multi-io case, only the primary out */ |
| @@ -2902,7 +2906,7 @@ static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |||
| 2902 | if (!nid) | 2906 | if (!nid) |
| 2903 | continue; | 2907 | continue; |
| 2904 | if (found_in_nid_list(nid, spec->multiout.dac_nids, | 2908 | if (found_in_nid_list(nid, spec->multiout.dac_nids, |
| 2905 | spec->multiout.num_dacs)) | 2909 | ARRAY_SIZE(spec->private_dac_nids))) |
| 2906 | continue; | 2910 | continue; |
| 2907 | if (found_in_nid_list(nid, spec->multiout.hp_out_nid, | 2911 | if (found_in_nid_list(nid, spec->multiout.hp_out_nid, |
| 2908 | ARRAY_SIZE(spec->multiout.hp_out_nid))) | 2912 | ARRAY_SIZE(spec->multiout.hp_out_nid))) |
| @@ -2923,6 +2927,7 @@ static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) | |||
| 2923 | return 0; | 2927 | return 0; |
| 2924 | } | 2928 | } |
| 2925 | 2929 | ||
| 2930 | /* return 0 if no possible DAC is found, 1 if one or more found */ | ||
| 2926 | static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, | 2931 | static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, |
| 2927 | const hda_nid_t *pins, hda_nid_t *dacs) | 2932 | const hda_nid_t *pins, hda_nid_t *dacs) |
| 2928 | { | 2933 | { |
| @@ -2940,7 +2945,7 @@ static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, | |||
| 2940 | if (!dacs[i]) | 2945 | if (!dacs[i]) |
| 2941 | dacs[i] = alc_auto_look_for_dac(codec, pins[i]); | 2946 | dacs[i] = alc_auto_look_for_dac(codec, pins[i]); |
| 2942 | } | 2947 | } |
| 2943 | return 0; | 2948 | return 1; |
| 2944 | } | 2949 | } |
| 2945 | 2950 | ||
| 2946 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, | 2951 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
| @@ -2950,7 +2955,7 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec, | |||
| 2950 | static int alc_auto_fill_dac_nids(struct hda_codec *codec) | 2955 | static int alc_auto_fill_dac_nids(struct hda_codec *codec) |
| 2951 | { | 2956 | { |
| 2952 | struct alc_spec *spec = codec->spec; | 2957 | struct alc_spec *spec = codec->spec; |
| 2953 | const struct auto_pin_cfg *cfg = &spec->autocfg; | 2958 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2954 | bool redone = false; | 2959 | bool redone = false; |
| 2955 | int i; | 2960 | int i; |
| 2956 | 2961 | ||
| @@ -2961,6 +2966,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
| 2961 | spec->multiout.extra_out_nid[0] = 0; | 2966 | spec->multiout.extra_out_nid[0] = 0; |
| 2962 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); | 2967 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); |
| 2963 | spec->multiout.dac_nids = spec->private_dac_nids; | 2968 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 2969 | spec->multi_ios = 0; | ||
| 2964 | 2970 | ||
| 2965 | /* fill hard-wired DACs first */ | 2971 | /* fill hard-wired DACs first */ |
| 2966 | if (!redone) { | 2972 | if (!redone) { |
| @@ -2994,10 +3000,12 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
| 2994 | for (i = 0; i < cfg->line_outs; i++) { | 3000 | for (i = 0; i < cfg->line_outs; i++) { |
| 2995 | if (spec->private_dac_nids[i]) | 3001 | if (spec->private_dac_nids[i]) |
| 2996 | spec->multiout.num_dacs++; | 3002 | spec->multiout.num_dacs++; |
| 2997 | else | 3003 | else { |
| 2998 | memmove(spec->private_dac_nids + i, | 3004 | memmove(spec->private_dac_nids + i, |
| 2999 | spec->private_dac_nids + i + 1, | 3005 | spec->private_dac_nids + i + 1, |
| 3000 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); | 3006 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); |
| 3007 | spec->private_dac_nids[cfg->line_outs - 1] = 0; | ||
| 3008 | } | ||
| 3001 | } | 3009 | } |
| 3002 | 3010 | ||
| 3003 | if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | 3011 | if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| @@ -3019,9 +3027,28 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
| 3019 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | 3027 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
| 3020 | alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins, | 3028 | alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins, |
| 3021 | spec->multiout.hp_out_nid); | 3029 | spec->multiout.hp_out_nid); |
| 3022 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) | 3030 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
| 3023 | alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, cfg->speaker_pins, | 3031 | int err = alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, |
| 3024 | spec->multiout.extra_out_nid); | 3032 | cfg->speaker_pins, |
| 3033 | spec->multiout.extra_out_nid); | ||
| 3034 | /* if no speaker volume is assigned, try again as the primary | ||
| 3035 | * output | ||
| 3036 | */ | ||
| 3037 | if (!err && cfg->speaker_outs > 0 && | ||
| 3038 | cfg->line_out_type == AUTO_PIN_HP_OUT) { | ||
| 3039 | cfg->hp_outs = cfg->line_outs; | ||
| 3040 | memcpy(cfg->hp_pins, cfg->line_out_pins, | ||
| 3041 | sizeof(cfg->hp_pins)); | ||
| 3042 | cfg->line_outs = cfg->speaker_outs; | ||
| 3043 | memcpy(cfg->line_out_pins, cfg->speaker_pins, | ||
| 3044 | sizeof(cfg->speaker_pins)); | ||
| 3045 | cfg->speaker_outs = 0; | ||
| 3046 | memset(cfg->speaker_pins, 0, sizeof(cfg->speaker_pins)); | ||
| 3047 | cfg->line_out_type = AUTO_PIN_SPEAKER_OUT; | ||
| 3048 | redone = false; | ||
| 3049 | goto again; | ||
| 3050 | } | ||
| 3051 | } | ||
| 3025 | 3052 | ||
| 3026 | return 0; | 3053 | return 0; |
| 3027 | } | 3054 | } |
| @@ -3171,7 +3198,8 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
| 3171 | } | 3198 | } |
| 3172 | 3199 | ||
| 3173 | static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | 3200 | static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
| 3174 | hda_nid_t dac, const char *pfx) | 3201 | hda_nid_t dac, const char *pfx, |
| 3202 | int cidx) | ||
| 3175 | { | 3203 | { |
| 3176 | struct alc_spec *spec = codec->spec; | 3204 | struct alc_spec *spec = codec->spec; |
| 3177 | hda_nid_t sw, vol; | 3205 | hda_nid_t sw, vol; |
| @@ -3187,15 +3215,15 @@ static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |||
| 3187 | if (is_ctl_used(spec->sw_ctls, val)) | 3215 | if (is_ctl_used(spec->sw_ctls, val)) |
| 3188 | return 0; /* already created */ | 3216 | return 0; /* already created */ |
| 3189 | mark_ctl_usage(spec->sw_ctls, val); | 3217 | mark_ctl_usage(spec->sw_ctls, val); |
| 3190 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); | 3218 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, cidx, val); |
| 3191 | } | 3219 | } |
| 3192 | 3220 | ||
| 3193 | sw = alc_look_for_out_mute_nid(codec, pin, dac); | 3221 | sw = alc_look_for_out_mute_nid(codec, pin, dac); |
| 3194 | vol = alc_look_for_out_vol_nid(codec, pin, dac); | 3222 | vol = alc_look_for_out_vol_nid(codec, pin, dac); |
| 3195 | err = alc_auto_add_stereo_vol(codec, pfx, 0, vol); | 3223 | err = alc_auto_add_stereo_vol(codec, pfx, cidx, vol); |
| 3196 | if (err < 0) | 3224 | if (err < 0) |
| 3197 | return err; | 3225 | return err; |
| 3198 | err = alc_auto_add_stereo_sw(codec, pfx, 0, sw); | 3226 | err = alc_auto_add_stereo_sw(codec, pfx, cidx, sw); |
| 3199 | if (err < 0) | 3227 | if (err < 0) |
| 3200 | return err; | 3228 | return err; |
| 3201 | return 0; | 3229 | return 0; |
| @@ -3236,16 +3264,21 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins, | |||
| 3236 | hda_nid_t dac = *dacs; | 3264 | hda_nid_t dac = *dacs; |
| 3237 | if (!dac) | 3265 | if (!dac) |
| 3238 | dac = spec->multiout.dac_nids[0]; | 3266 | dac = spec->multiout.dac_nids[0]; |
| 3239 | return alc_auto_create_extra_out(codec, *pins, dac, pfx); | 3267 | return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0); |
| 3240 | } | 3268 | } |
| 3241 | 3269 | ||
| 3242 | if (dacs[num_pins - 1]) { | 3270 | if (dacs[num_pins - 1]) { |
| 3243 | /* OK, we have a multi-output system with individual volumes */ | 3271 | /* OK, we have a multi-output system with individual volumes */ |
| 3244 | for (i = 0; i < num_pins; i++) { | 3272 | for (i = 0; i < num_pins; i++) { |
| 3245 | snprintf(name, sizeof(name), "%s %s", | 3273 | if (num_pins >= 3) { |
| 3246 | pfx, channel_name[i]); | 3274 | snprintf(name, sizeof(name), "%s %s", |
| 3247 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], | 3275 | pfx, channel_name[i]); |
| 3248 | name); | 3276 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], |
| 3277 | name, 0); | ||
| 3278 | } else { | ||
| 3279 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], | ||
| 3280 | pfx, i); | ||
| 3281 | } | ||
| 3249 | if (err < 0) | 3282 | if (err < 0) |
| 3250 | return err; | 3283 | return err; |
| 3251 | } | 3284 | } |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index d8d2f9dccd9b..616678fde486 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -215,6 +215,7 @@ struct sigmatel_spec { | |||
| 215 | unsigned int gpio_mute; | 215 | unsigned int gpio_mute; |
| 216 | unsigned int gpio_led; | 216 | unsigned int gpio_led; |
| 217 | unsigned int gpio_led_polarity; | 217 | unsigned int gpio_led_polarity; |
| 218 | unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */ | ||
| 218 | unsigned int vref_led; | 219 | unsigned int vref_led; |
| 219 | 220 | ||
| 220 | /* stream */ | 221 | /* stream */ |
| @@ -4318,12 +4319,10 @@ static void stac_store_hints(struct hda_codec *codec) | |||
| 4318 | spec->eapd_switch = val; | 4319 | spec->eapd_switch = val; |
| 4319 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); | 4320 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); |
| 4320 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { | 4321 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { |
| 4321 | if (spec->gpio_led <= 8) { | 4322 | spec->gpio_mask |= spec->gpio_led; |
| 4322 | spec->gpio_mask |= spec->gpio_led; | 4323 | spec->gpio_dir |= spec->gpio_led; |
| 4323 | spec->gpio_dir |= spec->gpio_led; | 4324 | if (spec->gpio_led_polarity) |
| 4324 | if (spec->gpio_led_polarity) | 4325 | spec->gpio_data |= spec->gpio_led; |
| 4325 | spec->gpio_data |= spec->gpio_led; | ||
| 4326 | } | ||
| 4327 | } | 4326 | } |
| 4328 | } | 4327 | } |
| 4329 | 4328 | ||
| @@ -4443,7 +4442,7 @@ static int stac92xx_init(struct hda_codec *codec) | |||
| 4443 | /* power on when no jack detection is available */ | 4442 | /* power on when no jack detection is available */ |
| 4444 | /* or when the VREF is used for controlling LED */ | 4443 | /* or when the VREF is used for controlling LED */ |
| 4445 | if (!spec->hp_detect || | 4444 | if (!spec->hp_detect || |
| 4446 | (spec->gpio_led > 8 && spec->gpio_led == nid)) { | 4445 | spec->vref_mute_led_nid == nid) { |
| 4447 | stac_toggle_power_map(codec, nid, 1); | 4446 | stac_toggle_power_map(codec, nid, 1); |
| 4448 | continue; | 4447 | continue; |
| 4449 | } | 4448 | } |
| @@ -4915,8 +4914,14 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) | |||
| 4915 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", | 4914 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", |
| 4916 | &spec->gpio_led_polarity, | 4915 | &spec->gpio_led_polarity, |
| 4917 | &spec->gpio_led) == 2) { | 4916 | &spec->gpio_led) == 2) { |
| 4918 | if (spec->gpio_led < 4) | 4917 | unsigned int max_gpio; |
| 4918 | max_gpio = snd_hda_param_read(codec, codec->afg, | ||
| 4919 | AC_PAR_GPIO_CAP); | ||
| 4920 | max_gpio &= AC_GPIO_IO_COUNT; | ||
| 4921 | if (spec->gpio_led < max_gpio) | ||
| 4919 | spec->gpio_led = 1 << spec->gpio_led; | 4922 | spec->gpio_led = 1 << spec->gpio_led; |
| 4923 | else | ||
| 4924 | spec->vref_mute_led_nid = spec->gpio_led; | ||
| 4920 | return 1; | 4925 | return 1; |
| 4921 | } | 4926 | } |
| 4922 | if (sscanf(dev->name, "HP_Mute_LED_%d", | 4927 | if (sscanf(dev->name, "HP_Mute_LED_%d", |
| @@ -4924,6 +4929,12 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) | |||
| 4924 | set_hp_led_gpio(codec); | 4929 | set_hp_led_gpio(codec); |
| 4925 | return 1; | 4930 | return 1; |
| 4926 | } | 4931 | } |
| 4932 | /* BIOS bug: unfilled OEM string */ | ||
| 4933 | if (strstr(dev->name, "HP_Mute_LED_P_G")) { | ||
| 4934 | set_hp_led_gpio(codec); | ||
| 4935 | spec->gpio_led_polarity = 1; | ||
| 4936 | return 1; | ||
| 4937 | } | ||
| 4927 | } | 4938 | } |
| 4928 | 4939 | ||
| 4929 | /* | 4940 | /* |
| @@ -5045,15 +5056,12 @@ static int stac92xx_pre_resume(struct hda_codec *codec) | |||
| 5045 | struct sigmatel_spec *spec = codec->spec; | 5056 | struct sigmatel_spec *spec = codec->spec; |
| 5046 | 5057 | ||
| 5047 | /* sync mute LED */ | 5058 | /* sync mute LED */ |
| 5048 | if (spec->gpio_led) { | 5059 | if (spec->vref_mute_led_nid) |
| 5049 | if (spec->gpio_led <= 8) { | 5060 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
| 5050 | stac_gpio_set(codec, spec->gpio_mask, | 5061 | spec->vref_led); |
| 5051 | spec->gpio_dir, spec->gpio_data); | 5062 | else if (spec->gpio_led) |
| 5052 | } else { | 5063 | stac_gpio_set(codec, spec->gpio_mask, |
| 5053 | stac_vrefout_set(codec, | 5064 | spec->gpio_dir, spec->gpio_data); |
| 5054 | spec->gpio_led, spec->vref_led); | ||
| 5055 | } | ||
| 5056 | } | ||
| 5057 | return 0; | 5065 | return 0; |
| 5058 | } | 5066 | } |
| 5059 | 5067 | ||
| @@ -5064,7 +5072,7 @@ static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
| 5064 | struct sigmatel_spec *spec = codec->spec; | 5072 | struct sigmatel_spec *spec = codec->spec; |
| 5065 | 5073 | ||
| 5066 | if (power_state == AC_PWRST_D3) { | 5074 | if (power_state == AC_PWRST_D3) { |
| 5067 | if (spec->gpio_led > 8) { | 5075 | if (spec->vref_mute_led_nid) { |
| 5068 | /* with vref-out pin used for mute led control | 5076 | /* with vref-out pin used for mute led control |
| 5069 | * codec AFG is prevented from D3 state | 5077 | * codec AFG is prevented from D3 state |
| 5070 | */ | 5078 | */ |
| @@ -5117,7 +5125,7 @@ static int stac92xx_update_led_status(struct hda_codec *codec) | |||
| 5117 | } | 5125 | } |
| 5118 | } | 5126 | } |
| 5119 | /*polarity defines *not* muted state level*/ | 5127 | /*polarity defines *not* muted state level*/ |
| 5120 | if (spec->gpio_led <= 8) { | 5128 | if (!spec->vref_mute_led_nid) { |
| 5121 | if (muted) | 5129 | if (muted) |
| 5122 | spec->gpio_data &= ~spec->gpio_led; /* orange */ | 5130 | spec->gpio_data &= ~spec->gpio_led; /* orange */ |
| 5123 | else | 5131 | else |
| @@ -5135,7 +5143,8 @@ static int stac92xx_update_led_status(struct hda_codec *codec) | |||
| 5135 | muted_lvl = spec->gpio_led_polarity ? | 5143 | muted_lvl = spec->gpio_led_polarity ? |
| 5136 | AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ; | 5144 | AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ; |
| 5137 | spec->vref_led = muted ? muted_lvl : notmtd_lvl; | 5145 | spec->vref_led = muted ? muted_lvl : notmtd_lvl; |
| 5138 | stac_vrefout_set(codec, spec->gpio_led, spec->vref_led); | 5146 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
| 5147 | spec->vref_led); | ||
| 5139 | } | 5148 | } |
| 5140 | return 0; | 5149 | return 0; |
| 5141 | } | 5150 | } |
| @@ -5649,7 +5658,7 @@ again: | |||
| 5649 | 5658 | ||
| 5650 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5659 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5651 | if (spec->gpio_led) { | 5660 | if (spec->gpio_led) { |
| 5652 | if (spec->gpio_led <= 8) { | 5661 | if (!spec->vref_mute_led_nid) { |
| 5653 | spec->gpio_mask |= spec->gpio_led; | 5662 | spec->gpio_mask |= spec->gpio_led; |
| 5654 | spec->gpio_dir |= spec->gpio_led; | 5663 | spec->gpio_dir |= spec->gpio_led; |
| 5655 | spec->gpio_data |= spec->gpio_led; | 5664 | spec->gpio_data |= spec->gpio_led; |
| @@ -5962,7 +5971,7 @@ again: | |||
| 5962 | 5971 | ||
| 5963 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5972 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5964 | if (spec->gpio_led) { | 5973 | if (spec->gpio_led) { |
| 5965 | if (spec->gpio_led <= 8) { | 5974 | if (!spec->vref_mute_led_nid) { |
| 5966 | spec->gpio_mask |= spec->gpio_led; | 5975 | spec->gpio_mask |= spec->gpio_led; |
| 5967 | spec->gpio_dir |= spec->gpio_led; | 5976 | spec->gpio_dir |= spec->gpio_led; |
| 5968 | spec->gpio_data |= spec->gpio_led; | 5977 | spec->gpio_data |= spec->gpio_led; |
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index a391e622a192..28dfafb56dd1 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c | |||
| @@ -41,6 +41,7 @@ MODULE_SUPPORTED_DEVICE("{{SiS,SiS7019 Audio Accelerator}}"); | |||
| 41 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 41 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
| 42 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 42 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
| 43 | static int enable = 1; | 43 | static int enable = 1; |
| 44 | static int codecs = 1; | ||
| 44 | 45 | ||
| 45 | module_param(index, int, 0444); | 46 | module_param(index, int, 0444); |
| 46 | MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator."); | 47 | MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator."); |
| @@ -48,6 +49,8 @@ module_param(id, charp, 0444); | |||
| 48 | MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator."); | 49 | MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator."); |
| 49 | module_param(enable, bool, 0444); | 50 | module_param(enable, bool, 0444); |
| 50 | MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator."); | 51 | MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator."); |
| 52 | module_param(codecs, int, 0444); | ||
| 53 | MODULE_PARM_DESC(codecs, "Set bit to indicate that codec number is expected to be present (default 1)"); | ||
| 51 | 54 | ||
| 52 | static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = { | 55 | static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = { |
| 53 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) }, | 56 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) }, |
| @@ -140,6 +143,9 @@ struct sis7019 { | |||
| 140 | dma_addr_t silence_dma_addr; | 143 | dma_addr_t silence_dma_addr; |
| 141 | }; | 144 | }; |
| 142 | 145 | ||
| 146 | /* These values are also used by the module param 'codecs' to indicate | ||
| 147 | * which codecs should be present. | ||
| 148 | */ | ||
| 143 | #define SIS_PRIMARY_CODEC_PRESENT 0x0001 | 149 | #define SIS_PRIMARY_CODEC_PRESENT 0x0001 |
| 144 | #define SIS_SECONDARY_CODEC_PRESENT 0x0002 | 150 | #define SIS_SECONDARY_CODEC_PRESENT 0x0002 |
| 145 | #define SIS_TERTIARY_CODEC_PRESENT 0x0004 | 151 | #define SIS_TERTIARY_CODEC_PRESENT 0x0004 |
| @@ -1078,6 +1084,7 @@ static int sis_chip_init(struct sis7019 *sis) | |||
| 1078 | { | 1084 | { |
| 1079 | unsigned long io = sis->ioport; | 1085 | unsigned long io = sis->ioport; |
| 1080 | void __iomem *ioaddr = sis->ioaddr; | 1086 | void __iomem *ioaddr = sis->ioaddr; |
| 1087 | unsigned long timeout; | ||
| 1081 | u16 status; | 1088 | u16 status; |
| 1082 | int count; | 1089 | int count; |
| 1083 | int i; | 1090 | int i; |
| @@ -1104,21 +1111,45 @@ static int sis_chip_init(struct sis7019 *sis) | |||
| 1104 | while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count) | 1111 | while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count) |
| 1105 | udelay(1); | 1112 | udelay(1); |
| 1106 | 1113 | ||
| 1114 | /* Command complete, we can let go of the semaphore now. | ||
| 1115 | */ | ||
| 1116 | outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA); | ||
| 1117 | if (!count) | ||
| 1118 | return -EIO; | ||
| 1119 | |||
| 1107 | /* Now that we've finished the reset, find out what's attached. | 1120 | /* Now that we've finished the reset, find out what's attached. |
| 1121 | * There are some codec/board combinations that take an extremely | ||
| 1122 | * long time to come up. 350+ ms has been observed in the field, | ||
| 1123 | * so we'll give them up to 500ms. | ||
| 1108 | */ | 1124 | */ |
| 1109 | status = inl(io + SIS_AC97_STATUS); | 1125 | sis->codecs_present = 0; |
| 1110 | if (status & SIS_AC97_STATUS_CODEC_READY) | 1126 | timeout = msecs_to_jiffies(500) + jiffies; |
| 1111 | sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; | 1127 | while (time_before_eq(jiffies, timeout)) { |
| 1112 | if (status & SIS_AC97_STATUS_CODEC2_READY) | 1128 | status = inl(io + SIS_AC97_STATUS); |
| 1113 | sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; | 1129 | if (status & SIS_AC97_STATUS_CODEC_READY) |
| 1114 | if (status & SIS_AC97_STATUS_CODEC3_READY) | 1130 | sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; |
| 1115 | sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; | 1131 | if (status & SIS_AC97_STATUS_CODEC2_READY) |
| 1116 | 1132 | sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; | |
| 1117 | /* All done, let go of the semaphore, and check for errors | 1133 | if (status & SIS_AC97_STATUS_CODEC3_READY) |
| 1134 | sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; | ||
| 1135 | |||
| 1136 | if (sis->codecs_present == codecs) | ||
| 1137 | break; | ||
| 1138 | |||
| 1139 | msleep(1); | ||
| 1140 | } | ||
| 1141 | |||
| 1142 | /* All done, check for errors. | ||
| 1118 | */ | 1143 | */ |
| 1119 | outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA); | 1144 | if (!sis->codecs_present) { |
| 1120 | if (!sis->codecs_present || !count) | 1145 | printk(KERN_ERR "sis7019: could not find any codecs\n"); |
| 1121 | return -EIO; | 1146 | return -EIO; |
| 1147 | } | ||
| 1148 | |||
| 1149 | if (sis->codecs_present != codecs) { | ||
| 1150 | printk(KERN_WARNING "sis7019: missing codecs, found %0x, expected %0x\n", | ||
| 1151 | sis->codecs_present, codecs); | ||
| 1152 | } | ||
| 1122 | 1153 | ||
| 1123 | /* Let the hardware know that the audio driver is alive, | 1154 | /* Let the hardware know that the audio driver is alive, |
| 1124 | * and enable PCM slots on the AC-link for L/R playback (3 & 4) and | 1155 | * and enable PCM slots on the AC-link for L/R playback (3 & 4) and |
| @@ -1390,6 +1421,17 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci, | |||
| 1390 | if (!enable) | 1421 | if (!enable) |
| 1391 | goto error_out; | 1422 | goto error_out; |
| 1392 | 1423 | ||
| 1424 | /* The user can specify which codecs should be present so that we | ||
| 1425 | * can wait for them to show up if they are slow to recover from | ||
| 1426 | * the AC97 cold reset. We default to a single codec, the primary. | ||
| 1427 | * | ||
| 1428 | * We assume that SIS_PRIMARY_*_PRESENT matches bits 0-2. | ||
| 1429 | */ | ||
| 1430 | codecs &= SIS_PRIMARY_CODEC_PRESENT | SIS_SECONDARY_CODEC_PRESENT | | ||
| 1431 | SIS_TERTIARY_CODEC_PRESENT; | ||
| 1432 | if (!codecs) | ||
| 1433 | codecs = SIS_PRIMARY_CODEC_PRESENT; | ||
| 1434 | |||
| 1393 | rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card); | 1435 | rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card); |
| 1394 | if (rc < 0) | 1436 | if (rc < 0) |
| 1395 | goto error_out; | 1437 | goto error_out; |
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 4584514d93d4..fa787d45d74a 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
| @@ -33,7 +33,7 @@ config SND_SOC_ALL_CODECS | |||
| 33 | select SND_SOC_CX20442 | 33 | select SND_SOC_CX20442 |
| 34 | select SND_SOC_DA7210 if I2C | 34 | select SND_SOC_DA7210 if I2C |
| 35 | select SND_SOC_DFBMCS320 | 35 | select SND_SOC_DFBMCS320 |
| 36 | select SND_SOC_JZ4740_CODEC if SOC_JZ4740 | 36 | select SND_SOC_JZ4740_CODEC |
| 37 | select SND_SOC_LM4857 if I2C | 37 | select SND_SOC_LM4857 if I2C |
| 38 | select SND_SOC_MAX98088 if I2C | 38 | select SND_SOC_MAX98088 if I2C |
| 39 | select SND_SOC_MAX98095 if I2C | 39 | select SND_SOC_MAX98095 if I2C |
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index e373f8f06907..3e1f4e172bfb 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
| 18 | #include <linux/io.h> | ||
| 18 | 19 | ||
| 19 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
| 20 | 21 | ||
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index c5ca8cfea60f..0441893e270e 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c | |||
| @@ -863,13 +863,13 @@ static struct i2c_driver uda1380_i2c_driver = { | |||
| 863 | 863 | ||
| 864 | static int __init uda1380_modinit(void) | 864 | static int __init uda1380_modinit(void) |
| 865 | { | 865 | { |
| 866 | int ret; | 866 | int ret = 0; |
| 867 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 867 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
| 868 | ret = i2c_add_driver(&uda1380_i2c_driver); | 868 | ret = i2c_add_driver(&uda1380_i2c_driver); |
| 869 | if (ret != 0) | 869 | if (ret != 0) |
| 870 | pr_err("Failed to register UDA1380 I2C driver: %d\n", ret); | 870 | pr_err("Failed to register UDA1380 I2C driver: %d\n", ret); |
| 871 | #endif | 871 | #endif |
| 872 | return 0; | 872 | return ret; |
| 873 | } | 873 | } |
| 874 | module_init(uda1380_modinit); | 874 | module_init(uda1380_modinit); |
| 875 | 875 | ||
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index 0293763debe5..5a14d5c0e0e1 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c | |||
| @@ -60,6 +60,8 @@ static int wm8958_dsp2_fw(struct snd_soc_codec *codec, const char *name, | |||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | if (memcmp(fw->data, "WMFW", 4) != 0) { | 62 | if (memcmp(fw->data, "WMFW", 4) != 0) { |
| 63 | memcpy(&data32, fw->data, sizeof(data32)); | ||
| 64 | data32 = be32_to_cpu(data32); | ||
| 63 | dev_err(codec->dev, "%s: firmware has bad file magic %08x\n", | 65 | dev_err(codec->dev, "%s: firmware has bad file magic %08x\n", |
| 64 | name, data32); | 66 | name, data32); |
| 65 | goto err; | 67 | goto err; |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 6c2988549003..d0c545b73d78 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
| @@ -1325,15 +1325,15 @@ SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), | |||
| 1325 | }; | 1325 | }; |
| 1326 | 1326 | ||
| 1327 | static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = { | 1327 | static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = { |
| 1328 | SND_SOC_DAPM_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux, | 1328 | SND_SOC_DAPM_VIRT_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux, |
| 1329 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), | 1329 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), |
| 1330 | SND_SOC_DAPM_MUX_E("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux, | 1330 | SND_SOC_DAPM_VIRT_MUX_E("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux, |
| 1331 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), | 1331 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), |
| 1332 | }; | 1332 | }; |
| 1333 | 1333 | ||
| 1334 | static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = { | 1334 | static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = { |
| 1335 | SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), | 1335 | SND_SOC_DAPM_VIRT_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), |
| 1336 | SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), | 1336 | SND_SOC_DAPM_VIRT_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), |
| 1337 | }; | 1337 | }; |
| 1338 | 1338 | ||
| 1339 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { | 1339 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { |
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 645c980d6b80..a33b04d17195 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
| @@ -1968,6 +1968,7 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai, | |||
| 1968 | break; | 1968 | break; |
| 1969 | case 24576000: | 1969 | case 24576000: |
| 1970 | ratediv = WM8996_SYSCLK_DIV; | 1970 | ratediv = WM8996_SYSCLK_DIV; |
| 1971 | wm8996->sysclk /= 2; | ||
| 1971 | case 12288000: | 1972 | case 12288000: |
| 1972 | snd_soc_update_bits(codec, WM8996_AIF_RATE, | 1973 | snd_soc_update_bits(codec, WM8996_AIF_RATE, |
| 1973 | WM8996_SYSCLK_RATE, WM8996_SYSCLK_RATE); | 1974 | WM8996_SYSCLK_RATE, WM8996_SYSCLK_RATE); |
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig index b133bfcc5848..738391757f2c 100644 --- a/sound/soc/imx/Kconfig +++ b/sound/soc/imx/Kconfig | |||
| @@ -28,7 +28,7 @@ config SND_MXC_SOC_WM1133_EV1 | |||
| 28 | 28 | ||
| 29 | config SND_SOC_MX27VIS_AIC32X4 | 29 | config SND_SOC_MX27VIS_AIC32X4 |
| 30 | tristate "SoC audio support for Visstrim M10 boards" | 30 | tristate "SoC audio support for Visstrim M10 boards" |
| 31 | depends on MACH_IMX27_VISSTRIM_M10 | 31 | depends on MACH_IMX27_VISSTRIM_M10 && I2C |
| 32 | select SND_SOC_TLV320AIC32X4 | 32 | select SND_SOC_TLV320AIC32X4 |
| 33 | select SND_MXC_SOC_MX2 | 33 | select SND_MXC_SOC_MX2 |
| 34 | help | 34 | help |
diff --git a/sound/soc/kirkwood/Kconfig b/sound/soc/kirkwood/Kconfig index 8f49e165f4d1..c62d715235e2 100644 --- a/sound/soc/kirkwood/Kconfig +++ b/sound/soc/kirkwood/Kconfig | |||
| @@ -12,6 +12,7 @@ config SND_KIRKWOOD_SOC_I2S | |||
| 12 | config SND_KIRKWOOD_SOC_OPENRD | 12 | config SND_KIRKWOOD_SOC_OPENRD |
| 13 | tristate "SoC Audio support for Kirkwood Openrd Client" | 13 | tristate "SoC Audio support for Kirkwood Openrd Client" |
| 14 | depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE) | 14 | depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE) |
| 15 | depends on I2C | ||
| 15 | select SND_KIRKWOOD_SOC_I2S | 16 | select SND_KIRKWOOD_SOC_I2S |
| 16 | select SND_SOC_CS42L51 | 17 | select SND_SOC_CS42L51 |
| 17 | help | 18 | help |
| @@ -20,7 +21,7 @@ config SND_KIRKWOOD_SOC_OPENRD | |||
| 20 | 21 | ||
| 21 | config SND_KIRKWOOD_SOC_T5325 | 22 | config SND_KIRKWOOD_SOC_T5325 |
| 22 | tristate "SoC Audio support for HP t5325" | 23 | tristate "SoC Audio support for HP t5325" |
| 23 | depends on SND_KIRKWOOD_SOC && MACH_T5325 | 24 | depends on SND_KIRKWOOD_SOC && MACH_T5325 && I2C |
| 24 | select SND_KIRKWOOD_SOC_I2S | 25 | select SND_KIRKWOOD_SOC_I2S |
| 25 | select SND_SOC_ALC5623 | 26 | select SND_SOC_ALC5623 |
| 26 | help | 27 | help |
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c index dea5aa4aa647..f39d7dd9fbcb 100644 --- a/sound/soc/mxs/mxs-pcm.c +++ b/sound/soc/mxs/mxs-pcm.c | |||
| @@ -357,3 +357,6 @@ static void __exit snd_mxs_pcm_exit(void) | |||
| 357 | platform_driver_unregister(&mxs_pcm_driver); | 357 | platform_driver_unregister(&mxs_pcm_driver); |
| 358 | } | 358 | } |
| 359 | module_exit(snd_mxs_pcm_exit); | 359 | module_exit(snd_mxs_pcm_exit); |
| 360 | |||
| 361 | MODULE_LICENSE("GPL"); | ||
| 362 | MODULE_ALIAS("platform:mxs-pcm-audio"); | ||
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c index 7fbeaec06eb4..1c57f6630a48 100644 --- a/sound/soc/mxs/mxs-sgtl5000.c +++ b/sound/soc/mxs/mxs-sgtl5000.c | |||
| @@ -171,3 +171,4 @@ module_exit(mxs_sgtl5000_exit); | |||
| 171 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); | 171 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); |
| 172 | MODULE_DESCRIPTION("MXS ALSA SoC Machine driver"); | 172 | MODULE_DESCRIPTION("MXS ALSA SoC Machine driver"); |
| 173 | MODULE_LICENSE("GPL"); | 173 | MODULE_LICENSE("GPL"); |
| 174 | MODULE_ALIAS("platform:mxs-sgtl5000"); | ||
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index ffd2242e305f..a0f7d3cfa470 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig | |||
| @@ -151,6 +151,7 @@ config SND_SOC_ZYLONITE | |||
| 151 | config SND_SOC_RAUMFELD | 151 | config SND_SOC_RAUMFELD |
| 152 | tristate "SoC Audio support Raumfeld audio adapter" | 152 | tristate "SoC Audio support Raumfeld audio adapter" |
| 153 | depends on SND_PXA2XX_SOC && (MACH_RAUMFELD_SPEAKER || MACH_RAUMFELD_CONNECTOR) | 153 | depends on SND_PXA2XX_SOC && (MACH_RAUMFELD_SPEAKER || MACH_RAUMFELD_CONNECTOR) |
| 154 | depends on I2C && SPI_MASTER | ||
| 154 | select SND_PXA_SOC_SSP | 155 | select SND_PXA_SOC_SSP |
| 155 | select SND_SOC_CS4270 | 156 | select SND_SOC_CS4270 |
| 156 | select SND_SOC_AK4104 | 157 | select SND_SOC_AK4104 |
| @@ -159,7 +160,7 @@ config SND_SOC_RAUMFELD | |||
| 159 | 160 | ||
| 160 | config SND_PXA2XX_SOC_HX4700 | 161 | config SND_PXA2XX_SOC_HX4700 |
| 161 | tristate "SoC Audio support for HP iPAQ hx4700" | 162 | tristate "SoC Audio support for HP iPAQ hx4700" |
| 162 | depends on SND_PXA2XX_SOC && MACH_H4700 | 163 | depends on SND_PXA2XX_SOC && MACH_H4700 && I2C |
| 163 | select SND_PXA2XX_SOC_I2S | 164 | select SND_PXA2XX_SOC_I2S |
| 164 | select SND_SOC_AK4641 | 165 | select SND_SOC_AK4641 |
| 165 | help | 166 | help |
diff --git a/sound/soc/pxa/hx4700.c b/sound/soc/pxa/hx4700.c index 65c124831a00..c664e33fb6d7 100644 --- a/sound/soc/pxa/hx4700.c +++ b/sound/soc/pxa/hx4700.c | |||
| @@ -209,9 +209,10 @@ static int __devinit hx4700_audio_probe(struct platform_device *pdev) | |||
| 209 | snd_soc_card_hx4700.dev = &pdev->dev; | 209 | snd_soc_card_hx4700.dev = &pdev->dev; |
| 210 | ret = snd_soc_register_card(&snd_soc_card_hx4700); | 210 | ret = snd_soc_register_card(&snd_soc_card_hx4700); |
| 211 | if (ret) | 211 | if (ret) |
| 212 | return ret; | 212 | gpio_free_array(hx4700_audio_gpios, |
| 213 | ARRAY_SIZE(hx4700_audio_gpios)); | ||
| 213 | 214 | ||
| 214 | return 0; | 215 | return ret; |
| 215 | } | 216 | } |
| 216 | 217 | ||
| 217 | static int __devexit hx4700_audio_remove(struct platform_device *pdev) | 218 | static int __devexit hx4700_audio_remove(struct platform_device *pdev) |
diff --git a/sound/soc/samsung/jive_wm8750.c b/sound/soc/samsung/jive_wm8750.c index 1826acf20f7c..8e523fd9189e 100644 --- a/sound/soc/samsung/jive_wm8750.c +++ b/sound/soc/samsung/jive_wm8750.c | |||
| @@ -101,7 +101,6 @@ static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd) | |||
| 101 | { | 101 | { |
| 102 | struct snd_soc_codec *codec = rtd->codec; | 102 | struct snd_soc_codec *codec = rtd->codec; |
| 103 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 103 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 104 | int err; | ||
| 105 | 104 | ||
| 106 | /* These endpoints are not being used. */ | 105 | /* These endpoints are not being used. */ |
| 107 | snd_soc_dapm_nc_pin(dapm, "LINPUT2"); | 106 | snd_soc_dapm_nc_pin(dapm, "LINPUT2"); |
| @@ -131,7 +130,7 @@ static struct snd_soc_card snd_soc_machine_jive = { | |||
| 131 | .dai_link = &jive_dai, | 130 | .dai_link = &jive_dai, |
| 132 | .num_links = 1, | 131 | .num_links = 1, |
| 133 | 132 | ||
| 134 | .dapm_widgtets = wm8750_dapm_widgets, | 133 | .dapm_widgets = wm8750_dapm_widgets, |
| 135 | .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets), | 134 | .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets), |
| 136 | .dapm_routes = audio_map, | 135 | .dapm_routes = audio_map, |
| 137 | .num_dapm_routes = ARRAY_SIZE(audio_map), | 136 | .num_dapm_routes = ARRAY_SIZE(audio_map), |
diff --git a/sound/soc/samsung/smdk2443_wm9710.c b/sound/soc/samsung/smdk2443_wm9710.c index 3a0dbfc793f0..8bd1dc5706bf 100644 --- a/sound/soc/samsung/smdk2443_wm9710.c +++ b/sound/soc/samsung/smdk2443_wm9710.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | * | 12 | * |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <linux/module.h> | ||
| 15 | #include <sound/soc.h> | 16 | #include <sound/soc.h> |
| 16 | 17 | ||
| 17 | static struct snd_soc_card smdk2443; | 18 | static struct snd_soc_card smdk2443; |
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index 0c12b98484bd..4220bb0f2730 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c | |||
| @@ -58,7 +58,36 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params) | |||
| 58 | } | 58 | } |
| 59 | EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk); | 59 | EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk); |
| 60 | 60 | ||
| 61 | static struct snd_soc_platform_driver dummy_platform; | 61 | static const struct snd_pcm_hardware dummy_dma_hardware = { |
| 62 | .formats = 0xffffffff, | ||
| 63 | .channels_min = 1, | ||
| 64 | .channels_max = UINT_MAX, | ||
| 65 | |||
| 66 | /* Random values to keep userspace happy when checking constraints */ | ||
| 67 | .info = SNDRV_PCM_INFO_INTERLEAVED | | ||
| 68 | SNDRV_PCM_INFO_BLOCK_TRANSFER, | ||
| 69 | .buffer_bytes_max = 128*1024, | ||
| 70 | .period_bytes_min = PAGE_SIZE, | ||
| 71 | .period_bytes_max = PAGE_SIZE*2, | ||
| 72 | .periods_min = 2, | ||
| 73 | .periods_max = 128, | ||
| 74 | }; | ||
| 75 | |||
| 76 | static int dummy_dma_open(struct snd_pcm_substream *substream) | ||
| 77 | { | ||
| 78 | snd_soc_set_runtime_hwparams(substream, &dummy_dma_hardware); | ||
| 79 | |||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | |||
| 83 | static struct snd_pcm_ops dummy_dma_ops = { | ||
| 84 | .open = dummy_dma_open, | ||
| 85 | .ioctl = snd_pcm_lib_ioctl, | ||
| 86 | }; | ||
| 87 | |||
| 88 | static struct snd_soc_platform_driver dummy_platform = { | ||
| 89 | .ops = &dummy_dma_ops, | ||
| 90 | }; | ||
| 62 | 91 | ||
| 63 | static __devinit int snd_soc_dummy_probe(struct platform_device *pdev) | 92 | static __devinit int snd_soc_dummy_probe(struct platform_device *pdev) |
| 64 | { | 93 | { |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 7d98676808d8..955930e0a5c3 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
| @@ -463,7 +463,8 @@ static int run_perf_stat(int argc __used, const char **argv) | |||
| 463 | 463 | ||
| 464 | list_for_each_entry(counter, &evsel_list->entries, node) { | 464 | list_for_each_entry(counter, &evsel_list->entries, node) { |
| 465 | if (create_perf_stat_counter(counter, first) < 0) { | 465 | if (create_perf_stat_counter(counter, first) < 0) { |
| 466 | if (errno == EINVAL || errno == ENOSYS || errno == ENOENT) { | 466 | if (errno == EINVAL || errno == ENOSYS || |
| 467 | errno == ENOENT || errno == EOPNOTSUPP) { | ||
| 467 | if (verbose) | 468 | if (verbose) |
| 468 | ui__warning("%s event is not supported by the kernel.\n", | 469 | ui__warning("%s event is not supported by the kernel.\n", |
| 469 | event_name(counter)); | 470 | event_name(counter)); |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index e42626422587..d7915d4e77cb 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
| @@ -34,6 +34,16 @@ int __perf_evsel__sample_size(u64 sample_type) | |||
| 34 | return size; | 34 | return size; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static void hists__init(struct hists *hists) | ||
| 38 | { | ||
| 39 | memset(hists, 0, sizeof(*hists)); | ||
| 40 | hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; | ||
| 41 | hists->entries_in = &hists->entries_in_array[0]; | ||
| 42 | hists->entries_collapsed = RB_ROOT; | ||
| 43 | hists->entries = RB_ROOT; | ||
| 44 | pthread_mutex_init(&hists->lock, NULL); | ||
| 45 | } | ||
| 46 | |||
| 37 | void perf_evsel__init(struct perf_evsel *evsel, | 47 | void perf_evsel__init(struct perf_evsel *evsel, |
| 38 | struct perf_event_attr *attr, int idx) | 48 | struct perf_event_attr *attr, int idx) |
| 39 | { | 49 | { |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index bcd05d05b4f0..33c17a2b2a81 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
| @@ -388,7 +388,7 @@ static int write_event_desc(int fd, struct perf_header *h __used, | |||
| 388 | /* | 388 | /* |
| 389 | * write event string as passed on cmdline | 389 | * write event string as passed on cmdline |
| 390 | */ | 390 | */ |
| 391 | ret = do_write_string(fd, attr->name); | 391 | ret = do_write_string(fd, event_name(attr)); |
| 392 | if (ret < 0) | 392 | if (ret < 0) |
| 393 | return ret; | 393 | return ret; |
| 394 | /* | 394 | /* |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index a36a3fa81ffb..abef2703cd24 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
| @@ -1211,13 +1211,3 @@ size_t hists__fprintf_nr_events(struct hists *hists, FILE *fp) | |||
| 1211 | 1211 | ||
| 1212 | return ret; | 1212 | return ret; |
| 1213 | } | 1213 | } |
| 1214 | |||
| 1215 | void hists__init(struct hists *hists) | ||
| 1216 | { | ||
| 1217 | memset(hists, 0, sizeof(*hists)); | ||
| 1218 | hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; | ||
| 1219 | hists->entries_in = &hists->entries_in_array[0]; | ||
| 1220 | hists->entries_collapsed = RB_ROOT; | ||
| 1221 | hists->entries = RB_ROOT; | ||
| 1222 | pthread_mutex_init(&hists->lock, NULL); | ||
| 1223 | } | ||
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index c86c1d27bd1e..89289c8e935e 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
| @@ -63,8 +63,6 @@ struct hists { | |||
| 63 | struct callchain_cursor callchain_cursor; | 63 | struct callchain_cursor callchain_cursor; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | void hists__init(struct hists *hists); | ||
| 67 | |||
| 68 | struct hist_entry *__hists__add_entry(struct hists *self, | 66 | struct hist_entry *__hists__add_entry(struct hists *self, |
| 69 | struct addr_location *al, | 67 | struct addr_location *al, |
| 70 | struct symbol *parent, u64 period); | 68 | struct symbol *parent, u64 period); |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 85c1e6b76f0a..0f4555ce9063 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
| @@ -1333,6 +1333,10 @@ int perf_session__cpu_bitmap(struct perf_session *session, | |||
| 1333 | } | 1333 | } |
| 1334 | 1334 | ||
| 1335 | map = cpu_map__new(cpu_list); | 1335 | map = cpu_map__new(cpu_list); |
| 1336 | if (map == NULL) { | ||
| 1337 | pr_err("Invalid cpu_list\n"); | ||
| 1338 | return -1; | ||
| 1339 | } | ||
| 1336 | 1340 | ||
| 1337 | for (i = 0; i < map->nr; i++) { | 1341 | for (i = 0; i < map->nr; i++) { |
| 1338 | int cpu = map->map[i]; | 1342 | int cpu = map->map[i]; |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 0a7ed5b5e281..6c164dc9ee95 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
| @@ -1537,6 +1537,8 @@ process_flags(struct event *event, struct print_arg *arg, char **tok) | |||
| 1537 | field = malloc_or_die(sizeof(*field)); | 1537 | field = malloc_or_die(sizeof(*field)); |
| 1538 | 1538 | ||
| 1539 | type = process_arg(event, field, &token); | 1539 | type = process_arg(event, field, &token); |
| 1540 | while (type == EVENT_OP) | ||
| 1541 | type = process_op(event, field, &token); | ||
| 1540 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 1542 | if (test_type_token(type, token, EVENT_DELIM, ",")) |
| 1541 | goto out_free; | 1543 | goto out_free; |
| 1542 | 1544 | ||
