diff options
430 files changed, 3777 insertions, 2335 deletions
diff --git a/Documentation/devicetree/bindings/ata/calxeda-sata.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt index 79caa5651f53..8bb8a76d42e8 100644 --- a/Documentation/devicetree/bindings/ata/calxeda-sata.txt +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | * Calxeda SATA Controller | 1 | * AHCI SATA Controller |
| 2 | 2 | ||
| 3 | SATA nodes are defined to describe on-chip Serial ATA controllers. | 3 | SATA nodes are defined to describe on-chip Serial ATA controllers. |
| 4 | Each SATA controller should have its own node. | 4 | Each SATA controller should have its own node. |
| 5 | 5 | ||
| 6 | Required properties: | 6 | Required properties: |
| 7 | - compatible : compatible list, contains "calxeda,hb-ahci" | 7 | - compatible : compatible list, contains "calxeda,hb-ahci" or "snps,spear-ahci" |
| 8 | - interrupts : <interrupt mapping for SATA IRQ> | 8 | - interrupts : <interrupt mapping for SATA IRQ> |
| 9 | - reg : <registers mapping> | 9 | - reg : <registers mapping> |
| 10 | 10 | ||
| @@ -14,4 +14,3 @@ Example: | |||
| 14 | reg = <0xffe08000 0x1000>; | 14 | reg = <0xffe08000 0x1000>; |
| 15 | interrupts = <115>; | 15 | interrupts = <115>; |
| 16 | }; | 16 | }; |
| 17 | |||
diff --git a/Documentation/devicetree/bindings/sound/sgtl5000.txt b/Documentation/devicetree/bindings/sound/sgtl5000.txt index 2c3cd413f042..9cc44449508d 100644 --- a/Documentation/devicetree/bindings/sound/sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/sgtl5000.txt | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible : "fsl,sgtl5000". | 4 | - compatible : "fsl,sgtl5000". |
| 5 | 5 | ||
| 6 | - reg : the I2C address of the device | ||
| 7 | |||
| 6 | Example: | 8 | Example: |
| 7 | 9 | ||
| 8 | codec: sgtl5000@0a { | 10 | codec: sgtl5000@0a { |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 03ca210406ed..e4b57756b9f5 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
| @@ -539,3 +539,13 @@ When: 3.6 | |||
| 539 | Why: setitimer is not returning -EFAULT if user pointer is NULL. This | 539 | Why: setitimer is not returning -EFAULT if user pointer is NULL. This |
| 540 | violates the spec. | 540 | violates the spec. |
| 541 | Who: Sasikantha Babu <sasikanth.v19@gmail.com> | 541 | Who: Sasikantha Babu <sasikanth.v19@gmail.com> |
| 542 | |||
| 543 | ---------------------------- | ||
| 544 | |||
| 545 | What: V4L2_CID_HCENTER, V4L2_CID_VCENTER V4L2 controls | ||
| 546 | When: 3.7 | ||
| 547 | Why: The V4L2_CID_VCENTER, V4L2_CID_HCENTER controls have been deprecated | ||
| 548 | for about 4 years and they are not used by any mainline driver. | ||
| 549 | There are newer controls (V4L2_CID_PAN*, V4L2_CID_TILT*) that provide | ||
| 550 | similar functionality. | ||
| 551 | Who: Sylwester Nawrocki <sylvester.nawrocki@gmail.com> | ||
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index bd80ba5847d2..1619a8c80873 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
| @@ -147,7 +147,7 @@ tcp_adv_win_scale - INTEGER | |||
| 147 | (if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale), | 147 | (if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale), |
| 148 | if it is <= 0. | 148 | if it is <= 0. |
| 149 | Possible values are [-31, 31], inclusive. | 149 | Possible values are [-31, 31], inclusive. |
| 150 | Default: 2 | 150 | Default: 1 |
| 151 | 151 | ||
| 152 | tcp_allowed_congestion_control - STRING | 152 | tcp_allowed_congestion_control - STRING |
| 153 | Show/set the congestion control choices available to non-privileged | 153 | Show/set the congestion control choices available to non-privileged |
| @@ -410,7 +410,7 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max | |||
| 410 | net.core.rmem_max. Calling setsockopt() with SO_RCVBUF disables | 410 | net.core.rmem_max. Calling setsockopt() with SO_RCVBUF disables |
| 411 | automatic tuning of that socket's receive buffer size, in which | 411 | automatic tuning of that socket's receive buffer size, in which |
| 412 | case this value is ignored. | 412 | case this value is ignored. |
| 413 | Default: between 87380B and 4MB, depending on RAM size. | 413 | Default: between 87380B and 6MB, depending on RAM size. |
| 414 | 414 | ||
| 415 | tcp_sack - BOOLEAN | 415 | tcp_sack - BOOLEAN |
| 416 | Enable select acknowledgments (SACKS). | 416 | Enable select acknowledgments (SACKS). |
diff --git a/MAINTAINERS b/MAINTAINERS index bb76fc42fc42..b36270986501 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1968,10 +1968,9 @@ S: Maintained | |||
| 1968 | F: drivers/net/ethernet/ti/cpmac.c | 1968 | F: drivers/net/ethernet/ti/cpmac.c |
| 1969 | 1969 | ||
| 1970 | CPU FREQUENCY DRIVERS | 1970 | CPU FREQUENCY DRIVERS |
| 1971 | M: Dave Jones <davej@redhat.com> | 1971 | M: Rafael J. Wysocki <rjw@sisk.pl> |
| 1972 | L: cpufreq@vger.kernel.org | 1972 | L: cpufreq@vger.kernel.org |
| 1973 | W: http://www.codemonkey.org.uk/projects/cpufreq/ | 1973 | L: linux-pm@vger.kernel.org |
| 1974 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq.git | ||
| 1975 | S: Maintained | 1974 | S: Maintained |
| 1976 | F: drivers/cpufreq/ | 1975 | F: drivers/cpufreq/ |
| 1977 | F: include/linux/cpufreq.h | 1976 | F: include/linux/cpufreq.h |
| @@ -4037,6 +4036,7 @@ F: Documentation/scsi/53c700.txt | |||
| 4037 | F: drivers/scsi/53c700* | 4036 | F: drivers/scsi/53c700* |
| 4038 | 4037 | ||
| 4039 | LED SUBSYSTEM | 4038 | LED SUBSYSTEM |
| 4039 | M: Bryan Wu <bryan.wu@canonical.com> | ||
| 4040 | M: Richard Purdie <rpurdie@rpsys.net> | 4040 | M: Richard Purdie <rpurdie@rpsys.net> |
| 4041 | S: Maintained | 4041 | S: Maintained |
| 4042 | F: drivers/leds/ | 4042 | F: drivers/leds/ |
| @@ -5892,11 +5892,11 @@ F: Documentation/scsi/st.txt | |||
| 5892 | F: drivers/scsi/st* | 5892 | F: drivers/scsi/st* |
| 5893 | 5893 | ||
| 5894 | SCTP PROTOCOL | 5894 | SCTP PROTOCOL |
| 5895 | M: Vlad Yasevich <vladislav.yasevich@hp.com> | 5895 | M: Vlad Yasevich <vyasevich@gmail.com> |
| 5896 | M: Sridhar Samudrala <sri@us.ibm.com> | 5896 | M: Sridhar Samudrala <sri@us.ibm.com> |
| 5897 | L: linux-sctp@vger.kernel.org | 5897 | L: linux-sctp@vger.kernel.org |
| 5898 | W: http://lksctp.sourceforge.net | 5898 | W: http://lksctp.sourceforge.net |
| 5899 | S: Supported | 5899 | S: Maintained |
| 5900 | F: Documentation/networking/sctp.txt | 5900 | F: Documentation/networking/sctp.txt |
| 5901 | F: include/linux/sctp.h | 5901 | F: include/linux/sctp.h |
| 5902 | F: include/net/sctp/ | 5902 | F: include/net/sctp/ |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 3 | 1 | VERSION = 3 |
| 2 | PATCHLEVEL = 4 | 2 | PATCHLEVEL = 4 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = -rc7 |
| 5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 56a4df952fb0..22e58a99f38b 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
| @@ -477,7 +477,7 @@ config ALPHA_BROKEN_IRQ_MASK | |||
| 477 | 477 | ||
| 478 | config VGA_HOSE | 478 | config VGA_HOSE |
| 479 | bool | 479 | bool |
| 480 | depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI | 480 | depends on VGA_CONSOLE && (ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI) |
| 481 | default y | 481 | default y |
| 482 | help | 482 | help |
| 483 | Support VGA on an arbitrary hose; needed for several platforms | 483 | Support VGA on an arbitrary hose; needed for several platforms |
diff --git a/arch/alpha/include/asm/rtc.h b/arch/alpha/include/asm/rtc.h index 1f7fba671ae6..d70408d36677 100644 --- a/arch/alpha/include/asm/rtc.h +++ b/arch/alpha/include/asm/rtc.h | |||
| @@ -1,14 +1,10 @@ | |||
| 1 | #ifndef _ALPHA_RTC_H | 1 | #ifndef _ALPHA_RTC_H |
| 2 | #define _ALPHA_RTC_H | 2 | #define _ALPHA_RTC_H |
| 3 | 3 | ||
| 4 | #if defined(CONFIG_ALPHA_GENERIC) | 4 | #if defined(CONFIG_ALPHA_MARVEL) && defined(CONFIG_SMP) \ |
| 5 | || defined(CONFIG_ALPHA_GENERIC) | ||
| 5 | # define get_rtc_time alpha_mv.rtc_get_time | 6 | # define get_rtc_time alpha_mv.rtc_get_time |
| 6 | # define set_rtc_time alpha_mv.rtc_set_time | 7 | # define set_rtc_time alpha_mv.rtc_set_time |
| 7 | #else | ||
| 8 | # if defined(CONFIG_ALPHA_MARVEL) && defined(CONFIG_SMP) | ||
| 9 | # define get_rtc_time marvel_get_rtc_time | ||
| 10 | # define set_rtc_time marvel_set_rtc_time | ||
| 11 | # endif | ||
| 12 | #endif | 8 | #endif |
| 13 | 9 | ||
| 14 | #include <asm-generic/rtc.h> | 10 | #include <asm-generic/rtc.h> |
diff --git a/arch/alpha/kernel/core_tsunami.c b/arch/alpha/kernel/core_tsunami.c index 5e7c28f92f19..61893d7bdda5 100644 --- a/arch/alpha/kernel/core_tsunami.c +++ b/arch/alpha/kernel/core_tsunami.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <asm/core_tsunami.h> | 11 | #include <asm/core_tsunami.h> |
| 12 | #undef __EXTERN_INLINE | 12 | #undef __EXTERN_INLINE |
| 13 | 13 | ||
| 14 | #include <linux/module.h> | ||
| 14 | #include <linux/types.h> | 15 | #include <linux/types.h> |
| 15 | #include <linux/pci.h> | 16 | #include <linux/pci.h> |
| 16 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c index 14a4b6a7cf59..407accc80877 100644 --- a/arch/alpha/kernel/sys_marvel.c +++ b/arch/alpha/kernel/sys_marvel.c | |||
| @@ -317,7 +317,7 @@ marvel_init_irq(void) | |||
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | static int | 319 | static int |
| 320 | marvel_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 320 | marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
| 321 | { | 321 | { |
| 322 | struct pci_controller *hose = dev->sysdata; | 322 | struct pci_controller *hose = dev->sysdata; |
| 323 | struct io7_port *io7_port = hose->sysdata; | 323 | struct io7_port *io7_port = hose->sysdata; |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index cf006d40342c..36586dba6fa6 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -1186,6 +1186,15 @@ if !MMU | |||
| 1186 | source "arch/arm/Kconfig-nommu" | 1186 | source "arch/arm/Kconfig-nommu" |
| 1187 | endif | 1187 | endif |
| 1188 | 1188 | ||
| 1189 | config ARM_ERRATA_326103 | ||
| 1190 | bool "ARM errata: FSR write bit incorrect on a SWP to read-only memory" | ||
| 1191 | depends on CPU_V6 | ||
| 1192 | help | ||
| 1193 | Executing a SWP instruction to read-only memory does not set bit 11 | ||
| 1194 | of the FSR on the ARM 1136 prior to r1p0. This causes the kernel to | ||
| 1195 | treat the access as a read, preventing a COW from occurring and | ||
| 1196 | causing the faulting task to livelock. | ||
| 1197 | |||
| 1189 | config ARM_ERRATA_411920 | 1198 | config ARM_ERRATA_411920 |
| 1190 | bool "ARM errata: Invalidation of the Instruction Cache operation can fail" | 1199 | bool "ARM errata: Invalidation of the Instruction Cache operation can fail" |
| 1191 | depends on CPU_V6 || CPU_V6K | 1200 | depends on CPU_V6 || CPU_V6K |
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts index 0b32925f2147..e2fe3195c0d1 100644 --- a/arch/arm/boot/dts/versatile-ab.dts +++ b/arch/arm/boot/dts/versatile-ab.dts | |||
| @@ -173,7 +173,7 @@ | |||
| 173 | mmc@5000 { | 173 | mmc@5000 { |
| 174 | compatible = "arm,primecell"; | 174 | compatible = "arm,primecell"; |
| 175 | reg = < 0x5000 0x1000>; | 175 | reg = < 0x5000 0x1000>; |
| 176 | interrupts = <22>; | 176 | interrupts = <22 34>; |
| 177 | }; | 177 | }; |
| 178 | kmi@6000 { | 178 | kmi@6000 { |
| 179 | compatible = "arm,pl050", "arm,primecell"; | 179 | compatible = "arm,pl050", "arm,primecell"; |
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts index 166461073b78..7e8175269064 100644 --- a/arch/arm/boot/dts/versatile-pb.dts +++ b/arch/arm/boot/dts/versatile-pb.dts | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | mmc@b000 { | 41 | mmc@b000 { |
| 42 | compatible = "arm,primecell"; | 42 | compatible = "arm,primecell"; |
| 43 | reg = <0xb000 0x1000>; | 43 | reg = <0xb000 0x1000>; |
| 44 | interrupts = <23>; | 44 | interrupts = <23 34>; |
| 45 | }; | 45 | }; |
| 46 | }; | 46 | }; |
| 47 | }; | 47 | }; |
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index d4c24d412a8d..0f04d84582e1 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
| @@ -118,6 +118,13 @@ extern void iwmmxt_task_switch(struct thread_info *); | |||
| 118 | extern void vfp_sync_hwstate(struct thread_info *); | 118 | extern void vfp_sync_hwstate(struct thread_info *); |
| 119 | extern void vfp_flush_hwstate(struct thread_info *); | 119 | extern void vfp_flush_hwstate(struct thread_info *); |
| 120 | 120 | ||
| 121 | struct user_vfp; | ||
| 122 | struct user_vfp_exc; | ||
| 123 | |||
| 124 | extern int vfp_preserve_user_clear_hwstate(struct user_vfp __user *, | ||
| 125 | struct user_vfp_exc __user *); | ||
| 126 | extern int vfp_restore_user_hwstate(struct user_vfp __user *, | ||
| 127 | struct user_vfp_exc __user *); | ||
| 121 | #endif | 128 | #endif |
| 122 | 129 | ||
| 123 | /* | 130 | /* |
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h index 60843eb0f61c..73409e6c0251 100644 --- a/arch/arm/include/asm/tls.h +++ b/arch/arm/include/asm/tls.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | 7 | ||
| 8 | .macro set_tls_v6k, tp, tmp1, tmp2 | 8 | .macro set_tls_v6k, tp, tmp1, tmp2 |
| 9 | mcr p15, 0, \tp, c13, c0, 3 @ set TLS register | 9 | mcr p15, 0, \tp, c13, c0, 3 @ set TLS register |
| 10 | mov \tmp1, #0 | ||
| 11 | mcr p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register | ||
| 10 | .endm | 12 | .endm |
| 11 | 13 | ||
| 12 | .macro set_tls_v6, tp, tmp1, tmp2 | 14 | .macro set_tls_v6, tp, tmp1, tmp2 |
| @@ -15,6 +17,8 @@ | |||
| 15 | mov \tmp2, #0xffff0fff | 17 | mov \tmp2, #0xffff0fff |
| 16 | tst \tmp1, #HWCAP_TLS @ hardware TLS available? | 18 | tst \tmp1, #HWCAP_TLS @ hardware TLS available? |
| 17 | mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register | 19 | mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register |
| 20 | movne \tmp1, #0 | ||
| 21 | mcrne p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register | ||
| 18 | streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0 | 22 | streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0 |
| 19 | .endm | 23 | .endm |
| 20 | 24 | ||
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 71ccdbfed662..8349d4e97e2b 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
| @@ -155,10 +155,10 @@ static bool migrate_one_irq(struct irq_desc *desc) | |||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | c = irq_data_get_irq_chip(d); | 157 | c = irq_data_get_irq_chip(d); |
| 158 | if (c->irq_set_affinity) | 158 | if (!c->irq_set_affinity) |
| 159 | c->irq_set_affinity(d, affinity, true); | ||
| 160 | else | ||
| 161 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); | 159 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); |
| 160 | else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) | ||
| 161 | cpumask_copy(d->affinity, affinity); | ||
| 162 | 162 | ||
| 163 | return ret; | 163 | return ret; |
| 164 | } | 164 | } |
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 80abafb9bf33..9650c143afc1 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
| @@ -906,27 +906,14 @@ long arch_ptrace(struct task_struct *child, long request, | |||
| 906 | return ret; | 906 | return ret; |
| 907 | } | 907 | } |
| 908 | 908 | ||
| 909 | #ifdef __ARMEB__ | ||
| 910 | #define AUDIT_ARCH_NR AUDIT_ARCH_ARMEB | ||
| 911 | #else | ||
| 912 | #define AUDIT_ARCH_NR AUDIT_ARCH_ARM | ||
| 913 | #endif | ||
| 914 | |||
| 915 | asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) | 909 | asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) |
| 916 | { | 910 | { |
| 917 | unsigned long ip; | 911 | unsigned long ip; |
| 918 | 912 | ||
| 919 | /* | 913 | if (why) |
| 920 | * Save IP. IP is used to denote syscall entry/exit: | ||
| 921 | * IP = 0 -> entry, = 1 -> exit | ||
| 922 | */ | ||
| 923 | ip = regs->ARM_ip; | ||
| 924 | regs->ARM_ip = why; | ||
| 925 | |||
| 926 | if (!ip) | ||
| 927 | audit_syscall_exit(regs); | 914 | audit_syscall_exit(regs); |
| 928 | else | 915 | else |
| 929 | audit_syscall_entry(AUDIT_ARCH_NR, scno, regs->ARM_r0, | 916 | audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, |
| 930 | regs->ARM_r1, regs->ARM_r2, regs->ARM_r3); | 917 | regs->ARM_r1, regs->ARM_r2, regs->ARM_r3); |
| 931 | 918 | ||
| 932 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 919 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) |
| @@ -936,6 +923,13 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) | |||
| 936 | 923 | ||
| 937 | current_thread_info()->syscall = scno; | 924 | current_thread_info()->syscall = scno; |
| 938 | 925 | ||
| 926 | /* | ||
| 927 | * IP is used to denote syscall entry/exit: | ||
| 928 | * IP = 0 -> entry, =1 -> exit | ||
| 929 | */ | ||
| 930 | ip = regs->ARM_ip; | ||
| 931 | regs->ARM_ip = why; | ||
| 932 | |||
| 939 | /* the 0x80 provides a way for the tracing parent to distinguish | 933 | /* the 0x80 provides a way for the tracing parent to distinguish |
| 940 | between a syscall stop and SIGTRAP delivery */ | 934 | between a syscall stop and SIGTRAP delivery */ |
| 941 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | 935 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 7cb532fc8aa4..d68d1b694680 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
| @@ -180,44 +180,23 @@ static int restore_iwmmxt_context(struct iwmmxt_sigframe *frame) | |||
| 180 | 180 | ||
| 181 | static int preserve_vfp_context(struct vfp_sigframe __user *frame) | 181 | static int preserve_vfp_context(struct vfp_sigframe __user *frame) |
| 182 | { | 182 | { |
| 183 | struct thread_info *thread = current_thread_info(); | ||
| 184 | struct vfp_hard_struct *h = &thread->vfpstate.hard; | ||
| 185 | const unsigned long magic = VFP_MAGIC; | 183 | const unsigned long magic = VFP_MAGIC; |
| 186 | const unsigned long size = VFP_STORAGE_SIZE; | 184 | const unsigned long size = VFP_STORAGE_SIZE; |
| 187 | int err = 0; | 185 | int err = 0; |
| 188 | 186 | ||
| 189 | vfp_sync_hwstate(thread); | ||
| 190 | __put_user_error(magic, &frame->magic, err); | 187 | __put_user_error(magic, &frame->magic, err); |
| 191 | __put_user_error(size, &frame->size, err); | 188 | __put_user_error(size, &frame->size, err); |
| 192 | 189 | ||
| 193 | /* | 190 | if (err) |
| 194 | * Copy the floating point registers. There can be unused | 191 | return -EFAULT; |
| 195 | * registers see asm/hwcap.h for details. | ||
| 196 | */ | ||
| 197 | err |= __copy_to_user(&frame->ufp.fpregs, &h->fpregs, | ||
| 198 | sizeof(h->fpregs)); | ||
| 199 | /* | ||
| 200 | * Copy the status and control register. | ||
| 201 | */ | ||
| 202 | __put_user_error(h->fpscr, &frame->ufp.fpscr, err); | ||
| 203 | |||
| 204 | /* | ||
| 205 | * Copy the exception registers. | ||
| 206 | */ | ||
| 207 | __put_user_error(h->fpexc, &frame->ufp_exc.fpexc, err); | ||
| 208 | __put_user_error(h->fpinst, &frame->ufp_exc.fpinst, err); | ||
| 209 | __put_user_error(h->fpinst2, &frame->ufp_exc.fpinst2, err); | ||
| 210 | 192 | ||
| 211 | return err ? -EFAULT : 0; | 193 | return vfp_preserve_user_clear_hwstate(&frame->ufp, &frame->ufp_exc); |
| 212 | } | 194 | } |
| 213 | 195 | ||
| 214 | static int restore_vfp_context(struct vfp_sigframe __user *frame) | 196 | static int restore_vfp_context(struct vfp_sigframe __user *frame) |
| 215 | { | 197 | { |
| 216 | struct thread_info *thread = current_thread_info(); | ||
| 217 | struct vfp_hard_struct *h = &thread->vfpstate.hard; | ||
| 218 | unsigned long magic; | 198 | unsigned long magic; |
| 219 | unsigned long size; | 199 | unsigned long size; |
| 220 | unsigned long fpexc; | ||
| 221 | int err = 0; | 200 | int err = 0; |
| 222 | 201 | ||
| 223 | __get_user_error(magic, &frame->magic, err); | 202 | __get_user_error(magic, &frame->magic, err); |
| @@ -228,33 +207,7 @@ static int restore_vfp_context(struct vfp_sigframe __user *frame) | |||
| 228 | if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) | 207 | if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) |
| 229 | return -EINVAL; | 208 | return -EINVAL; |
| 230 | 209 | ||
| 231 | vfp_flush_hwstate(thread); | 210 | return vfp_restore_user_hwstate(&frame->ufp, &frame->ufp_exc); |
| 232 | |||
| 233 | /* | ||
| 234 | * Copy the floating point registers. There can be unused | ||
| 235 | * registers see asm/hwcap.h for details. | ||
| 236 | */ | ||
| 237 | err |= __copy_from_user(&h->fpregs, &frame->ufp.fpregs, | ||
| 238 | sizeof(h->fpregs)); | ||
| 239 | /* | ||
| 240 | * Copy the status and control register. | ||
| 241 | */ | ||
| 242 | __get_user_error(h->fpscr, &frame->ufp.fpscr, err); | ||
| 243 | |||
| 244 | /* | ||
| 245 | * Sanitise and restore the exception registers. | ||
| 246 | */ | ||
| 247 | __get_user_error(fpexc, &frame->ufp_exc.fpexc, err); | ||
| 248 | /* Ensure the VFP is enabled. */ | ||
| 249 | fpexc |= FPEXC_EN; | ||
| 250 | /* Ensure FPINST2 is invalid and the exception flag is cleared. */ | ||
| 251 | fpexc &= ~(FPEXC_EX | FPEXC_FP2V); | ||
| 252 | h->fpexc = fpexc; | ||
| 253 | |||
| 254 | __get_user_error(h->fpinst, &frame->ufp_exc.fpinst, err); | ||
| 255 | __get_user_error(h->fpinst2, &frame->ufp_exc.fpinst2, err); | ||
| 256 | |||
| 257 | return err ? -EFAULT : 0; | ||
| 258 | } | 211 | } |
| 259 | 212 | ||
| 260 | #endif | 213 | #endif |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index addbbe8028c2..8f4644659777 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
| @@ -251,8 +251,6 @@ asmlinkage void __cpuinit secondary_start_kernel(void) | |||
| 251 | struct mm_struct *mm = &init_mm; | 251 | struct mm_struct *mm = &init_mm; |
| 252 | unsigned int cpu = smp_processor_id(); | 252 | unsigned int cpu = smp_processor_id(); |
| 253 | 253 | ||
| 254 | printk("CPU%u: Booted secondary processor\n", cpu); | ||
| 255 | |||
| 256 | /* | 254 | /* |
| 257 | * All kernel threads share the same mm context; grab a | 255 | * All kernel threads share the same mm context; grab a |
| 258 | * reference and switch to it. | 256 | * reference and switch to it. |
| @@ -264,6 +262,8 @@ asmlinkage void __cpuinit secondary_start_kernel(void) | |||
| 264 | enter_lazy_tlb(mm, current); | 262 | enter_lazy_tlb(mm, current); |
| 265 | local_flush_tlb_all(); | 263 | local_flush_tlb_all(); |
| 266 | 264 | ||
| 265 | printk("CPU%u: Booted secondary processor\n", cpu); | ||
| 266 | |||
| 267 | cpu_init(); | 267 | cpu_init(); |
| 268 | preempt_disable(); | 268 | preempt_disable(); |
| 269 | trace_hardirqs_off(); | 269 | trace_hardirqs_off(); |
| @@ -510,10 +510,6 @@ static void ipi_cpu_stop(unsigned int cpu) | |||
| 510 | local_fiq_disable(); | 510 | local_fiq_disable(); |
| 511 | local_irq_disable(); | 511 | local_irq_disable(); |
| 512 | 512 | ||
| 513 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 514 | platform_cpu_kill(cpu); | ||
| 515 | #endif | ||
| 516 | |||
| 517 | while (1) | 513 | while (1) |
| 518 | cpu_relax(); | 514 | cpu_relax(); |
| 519 | } | 515 | } |
| @@ -576,17 +572,25 @@ void smp_send_reschedule(int cpu) | |||
| 576 | smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); | 572 | smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); |
| 577 | } | 573 | } |
| 578 | 574 | ||
| 575 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 576 | static void smp_kill_cpus(cpumask_t *mask) | ||
| 577 | { | ||
| 578 | unsigned int cpu; | ||
| 579 | for_each_cpu(cpu, mask) | ||
| 580 | platform_cpu_kill(cpu); | ||
| 581 | } | ||
| 582 | #else | ||
| 583 | static void smp_kill_cpus(cpumask_t *mask) { } | ||
| 584 | #endif | ||
| 585 | |||
| 579 | void smp_send_stop(void) | 586 | void smp_send_stop(void) |
| 580 | { | 587 | { |
| 581 | unsigned long timeout; | 588 | unsigned long timeout; |
| 589 | struct cpumask mask; | ||
| 582 | 590 | ||
| 583 | if (num_online_cpus() > 1) { | 591 | cpumask_copy(&mask, cpu_online_mask); |
| 584 | struct cpumask mask; | 592 | cpumask_clear_cpu(smp_processor_id(), &mask); |
| 585 | cpumask_copy(&mask, cpu_online_mask); | 593 | smp_cross_call(&mask, IPI_CPU_STOP); |
| 586 | cpumask_clear_cpu(smp_processor_id(), &mask); | ||
| 587 | |||
| 588 | smp_cross_call(&mask, IPI_CPU_STOP); | ||
| 589 | } | ||
| 590 | 594 | ||
| 591 | /* Wait up to one second for other CPUs to stop */ | 595 | /* Wait up to one second for other CPUs to stop */ |
| 592 | timeout = USEC_PER_SEC; | 596 | timeout = USEC_PER_SEC; |
| @@ -595,6 +599,8 @@ void smp_send_stop(void) | |||
| 595 | 599 | ||
| 596 | if (num_online_cpus() > 1) | 600 | if (num_online_cpus() > 1) |
| 597 | pr_warning("SMP: failed to stop secondary CPUs\n"); | 601 | pr_warning("SMP: failed to stop secondary CPUs\n"); |
| 602 | |||
| 603 | smp_kill_cpus(&mask); | ||
| 598 | } | 604 | } |
| 599 | 605 | ||
| 600 | /* | 606 | /* |
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index d2b177905cdb..76cbb055dd05 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c | |||
| @@ -115,7 +115,7 @@ int kernel_execve(const char *filename, | |||
| 115 | "Ir" (THREAD_START_SP - sizeof(regs)), | 115 | "Ir" (THREAD_START_SP - sizeof(regs)), |
| 116 | "r" (®s), | 116 | "r" (®s), |
| 117 | "Ir" (sizeof(regs)) | 117 | "Ir" (sizeof(regs)) |
| 118 | : "r0", "r1", "r2", "r3", "ip", "lr", "memory"); | 118 | : "r0", "r1", "r2", "r3", "r8", "r9", "ip", "lr", "memory"); |
| 119 | 119 | ||
| 120 | out: | 120 | out: |
| 121 | return ret; | 121 | return ret; |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index e81c35f936b5..b8df521fb68e 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
| @@ -232,6 +232,9 @@ config MACH_ARMLEX4210 | |||
| 232 | config MACH_UNIVERSAL_C210 | 232 | config MACH_UNIVERSAL_C210 |
| 233 | bool "Mobile UNIVERSAL_C210 Board" | 233 | bool "Mobile UNIVERSAL_C210 Board" |
| 234 | select CPU_EXYNOS4210 | 234 | select CPU_EXYNOS4210 |
| 235 | select S5P_HRT | ||
| 236 | select CLKSRC_MMIO | ||
| 237 | select HAVE_SCHED_CLOCK | ||
| 235 | select S5P_GPIO_INT | 238 | select S5P_GPIO_INT |
| 236 | select S5P_DEV_FIMC0 | 239 | select S5P_DEV_FIMC0 |
| 237 | select S5P_DEV_FIMC1 | 240 | select S5P_DEV_FIMC1 |
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c index 5cd7a8b8868c..7ac6ff4c46bd 100644 --- a/arch/arm/mach-exynos/clock-exynos5.c +++ b/arch/arm/mach-exynos/clock-exynos5.c | |||
| @@ -678,7 +678,7 @@ static struct clk exynos5_clk_pdma1 = { | |||
| 678 | .name = "dma", | 678 | .name = "dma", |
| 679 | .devname = "dma-pl330.1", | 679 | .devname = "dma-pl330.1", |
| 680 | .enable = exynos5_clk_ip_fsys_ctrl, | 680 | .enable = exynos5_clk_ip_fsys_ctrl, |
| 681 | .ctrlbit = (1 << 1), | 681 | .ctrlbit = (1 << 2), |
| 682 | }; | 682 | }; |
| 683 | 683 | ||
| 684 | static struct clk exynos5_clk_mdma1 = { | 684 | static struct clk exynos5_clk_mdma1 = { |
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index cb2b027f09a6..a34036eb8ba2 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include <plat/pd.h> | 40 | #include <plat/pd.h> |
| 41 | #include <plat/regs-fb-v4.h> | 41 | #include <plat/regs-fb-v4.h> |
| 42 | #include <plat/fimc-core.h> | 42 | #include <plat/fimc-core.h> |
| 43 | #include <plat/s5p-time.h> | ||
| 43 | #include <plat/camport.h> | 44 | #include <plat/camport.h> |
| 44 | #include <plat/mipi_csis.h> | 45 | #include <plat/mipi_csis.h> |
| 45 | 46 | ||
| @@ -1063,6 +1064,7 @@ static void __init universal_map_io(void) | |||
| 1063 | exynos_init_io(NULL, 0); | 1064 | exynos_init_io(NULL, 0); |
| 1064 | s3c24xx_init_clocks(24000000); | 1065 | s3c24xx_init_clocks(24000000); |
| 1065 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); | 1066 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); |
| 1067 | s5p_set_timer_source(S5P_PWM2, S5P_PWM4); | ||
| 1066 | } | 1068 | } |
| 1067 | 1069 | ||
| 1068 | static void s5p_tv_setup(void) | 1070 | static void s5p_tv_setup(void) |
| @@ -1113,7 +1115,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") | |||
| 1113 | .map_io = universal_map_io, | 1115 | .map_io = universal_map_io, |
| 1114 | .handle_irq = gic_handle_irq, | 1116 | .handle_irq = gic_handle_irq, |
| 1115 | .init_machine = universal_machine_init, | 1117 | .init_machine = universal_machine_init, |
| 1116 | .timer = &exynos4_timer, | 1118 | .timer = &s5p_timer, |
| 1117 | .reserve = &universal_reserve, | 1119 | .reserve = &universal_reserve, |
| 1118 | .restart = exynos4_restart, | 1120 | .restart = exynos4_restart, |
| 1119 | MACHINE_END | 1121 | MACHINE_END |
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index 1c672d9e6656..f7fe1b9f3170 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
| 16 | #include <linux/of_platform.h> | 16 | #include <linux/of_platform.h> |
| 17 | #include <linux/kexec.h> | ||
| 17 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
| 18 | #include <asm/mach/map.h> | 19 | #include <asm/mach/map.h> |
| 19 | #include <mach/bridge-regs.h> | 20 | #include <mach/bridge-regs.h> |
diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c index fcce7ff37630..cfd98b186fcc 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq.c +++ b/arch/arm/mach-omap1/ams-delta-fiq.c | |||
| @@ -48,7 +48,7 @@ static irqreturn_t deferred_fiq(int irq, void *dev_id) | |||
| 48 | struct irq_chip *irq_chip = NULL; | 48 | struct irq_chip *irq_chip = NULL; |
| 49 | int gpio, irq_num, fiq_count; | 49 | int gpio, irq_num, fiq_count; |
| 50 | 50 | ||
| 51 | irq_desc = irq_to_desc(IH_GPIO_BASE); | 51 | irq_desc = irq_to_desc(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK)); |
| 52 | if (irq_desc) | 52 | if (irq_desc) |
| 53 | irq_chip = irq_desc->irq_data.chip; | 53 | irq_chip = irq_desc->irq_data.chip; |
| 54 | 54 | ||
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 930c0d380435..740cee9369ba 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
| @@ -641,7 +641,7 @@ static struct regulator_consumer_supply dummy_supplies[] = { | |||
| 641 | 641 | ||
| 642 | static void __init igep_init(void) | 642 | static void __init igep_init(void) |
| 643 | { | 643 | { |
| 644 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | 644 | regulator_register_fixed(1, dummy_supplies, ARRAY_SIZE(dummy_supplies)); |
| 645 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 645 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
| 646 | 646 | ||
| 647 | /* Get IGEP2 hardware revision */ | 647 | /* Get IGEP2 hardware revision */ |
diff --git a/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h b/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h index 1e2d3322f33e..c88420de1151 100644 --- a/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h +++ b/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h | |||
| @@ -941,10 +941,10 @@ | |||
| 941 | #define OMAP4_DSI2_LANEENABLE_MASK (0x7 << 29) | 941 | #define OMAP4_DSI2_LANEENABLE_MASK (0x7 << 29) |
| 942 | #define OMAP4_DSI1_LANEENABLE_SHIFT 24 | 942 | #define OMAP4_DSI1_LANEENABLE_SHIFT 24 |
| 943 | #define OMAP4_DSI1_LANEENABLE_MASK (0x1f << 24) | 943 | #define OMAP4_DSI1_LANEENABLE_MASK (0x1f << 24) |
| 944 | #define OMAP4_DSI2_PIPD_SHIFT 19 | 944 | #define OMAP4_DSI1_PIPD_SHIFT 19 |
| 945 | #define OMAP4_DSI2_PIPD_MASK (0x1f << 19) | 945 | #define OMAP4_DSI1_PIPD_MASK (0x1f << 19) |
| 946 | #define OMAP4_DSI1_PIPD_SHIFT 14 | 946 | #define OMAP4_DSI2_PIPD_SHIFT 14 |
| 947 | #define OMAP4_DSI1_PIPD_MASK (0x1f << 14) | 947 | #define OMAP4_DSI2_PIPD_MASK (0x1f << 14) |
| 948 | 948 | ||
| 949 | /* CONTROL_MCBSPLP */ | 949 | /* CONTROL_MCBSPLP */ |
| 950 | #define OMAP4_ALBCTRLRX_FSX_SHIFT 31 | 950 | #define OMAP4_ALBCTRLRX_FSX_SHIFT 31 |
diff --git a/arch/arm/mach-orion5x/mpp.h b/arch/arm/mach-orion5x/mpp.h index eac68978a2c2..db70e79a1198 100644 --- a/arch/arm/mach-orion5x/mpp.h +++ b/arch/arm/mach-orion5x/mpp.h | |||
| @@ -65,8 +65,8 @@ | |||
| 65 | #define MPP8_GIGE MPP(8, 0x1, 0, 0, 1, 1, 1) | 65 | #define MPP8_GIGE MPP(8, 0x1, 0, 0, 1, 1, 1) |
| 66 | 66 | ||
| 67 | #define MPP9_UNUSED MPP(9, 0x0, 0, 0, 1, 1, 1) | 67 | #define MPP9_UNUSED MPP(9, 0x0, 0, 0, 1, 1, 1) |
| 68 | #define MPP9_GPIO MPP(9, 0x0, 0, 0, 1, 1, 1) | 68 | #define MPP9_GPIO MPP(9, 0x0, 1, 1, 1, 1, 1) |
| 69 | #define MPP9_GIGE MPP(9, 0x1, 1, 1, 1, 1, 1) | 69 | #define MPP9_GIGE MPP(9, 0x1, 0, 0, 1, 1, 1) |
| 70 | 70 | ||
| 71 | #define MPP10_UNUSED MPP(10, 0x0, 0, 0, 1, 1, 1) | 71 | #define MPP10_UNUSED MPP(10, 0x0, 0, 0, 1, 1, 1) |
| 72 | #define MPP10_GPIO MPP(10, 0x0, 1, 1, 1, 1, 1) | 72 | #define MPP10_GPIO MPP(10, 0x0, 1, 1, 1, 1, 1) |
diff --git a/arch/arm/mach-prima2/irq.c b/arch/arm/mach-prima2/irq.c index 37c2de9b6f26..a7b9415d30f8 100644 --- a/arch/arm/mach-prima2/irq.c +++ b/arch/arm/mach-prima2/irq.c | |||
| @@ -42,7 +42,8 @@ sirfsoc_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num) | |||
| 42 | static __init void sirfsoc_irq_init(void) | 42 | static __init void sirfsoc_irq_init(void) |
| 43 | { | 43 | { |
| 44 | sirfsoc_alloc_gc(sirfsoc_intc_base, 0, 32); | 44 | sirfsoc_alloc_gc(sirfsoc_intc_base, 0, 32); |
| 45 | sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32, SIRFSOC_INTENAL_IRQ_END - 32); | 45 | sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32, |
| 46 | SIRFSOC_INTENAL_IRQ_END + 1 - 32); | ||
| 46 | 47 | ||
| 47 | writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0); | 48 | writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0); |
| 48 | writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1); | 49 | writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1); |
| @@ -68,7 +69,8 @@ void __init sirfsoc_of_irq_init(void) | |||
| 68 | if (!sirfsoc_intc_base) | 69 | if (!sirfsoc_intc_base) |
| 69 | panic("unable to map intc cpu registers\n"); | 70 | panic("unable to map intc cpu registers\n"); |
| 70 | 71 | ||
| 71 | irq_domain_add_legacy(np, 32, 0, 0, &irq_domain_simple_ops, NULL); | 72 | irq_domain_add_legacy(np, SIRFSOC_INTENAL_IRQ_END + 1, 0, 0, |
| 73 | &irq_domain_simple_ops, NULL); | ||
| 72 | 74 | ||
| 73 | of_node_put(np); | 75 | of_node_put(np); |
| 74 | 76 | ||
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index cb224a344af0..0891ec6e27f5 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
| @@ -365,23 +365,13 @@ static struct platform_device mipidsi0_device = { | |||
| 365 | }; | 365 | }; |
| 366 | 366 | ||
| 367 | /* SDHI0 */ | 367 | /* SDHI0 */ |
| 368 | static irqreturn_t ag5evm_sdhi0_gpio_cd(int irq, void *arg) | ||
| 369 | { | ||
| 370 | struct device *dev = arg; | ||
| 371 | struct sh_mobile_sdhi_info *info = dev->platform_data; | ||
| 372 | struct tmio_mmc_data *pdata = info->pdata; | ||
| 373 | |||
| 374 | tmio_mmc_cd_wakeup(pdata); | ||
| 375 | |||
| 376 | return IRQ_HANDLED; | ||
| 377 | } | ||
| 378 | |||
| 379 | static struct sh_mobile_sdhi_info sdhi0_info = { | 368 | static struct sh_mobile_sdhi_info sdhi0_info = { |
| 380 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, | 369 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, |
| 381 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, | 370 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, |
| 382 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, | 371 | .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, |
| 383 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, | 372 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, |
| 384 | .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, | 373 | .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, |
| 374 | .cd_gpio = GPIO_PORT251, | ||
| 385 | }; | 375 | }; |
| 386 | 376 | ||
| 387 | static struct resource sdhi0_resources[] = { | 377 | static struct resource sdhi0_resources[] = { |
| @@ -557,7 +547,6 @@ static void __init ag5evm_init(void) | |||
| 557 | lcd_backlight_reset(); | 547 | lcd_backlight_reset(); |
| 558 | 548 | ||
| 559 | /* enable SDHI0 on CN15 [SD I/F] */ | 549 | /* enable SDHI0 on CN15 [SD I/F] */ |
| 560 | gpio_request(GPIO_FN_SDHICD0, NULL); | ||
| 561 | gpio_request(GPIO_FN_SDHIWP0, NULL); | 550 | gpio_request(GPIO_FN_SDHIWP0, NULL); |
| 562 | gpio_request(GPIO_FN_SDHICMD0, NULL); | 551 | gpio_request(GPIO_FN_SDHICMD0, NULL); |
| 563 | gpio_request(GPIO_FN_SDHICLK0, NULL); | 552 | gpio_request(GPIO_FN_SDHICLK0, NULL); |
| @@ -566,13 +555,6 @@ static void __init ag5evm_init(void) | |||
| 566 | gpio_request(GPIO_FN_SDHID0_1, NULL); | 555 | gpio_request(GPIO_FN_SDHID0_1, NULL); |
| 567 | gpio_request(GPIO_FN_SDHID0_0, NULL); | 556 | gpio_request(GPIO_FN_SDHID0_0, NULL); |
| 568 | 557 | ||
| 569 | if (!request_irq(intcs_evt2irq(0x3c0), ag5evm_sdhi0_gpio_cd, | ||
| 570 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | ||
| 571 | "sdhi0 cd", &sdhi0_device.dev)) | ||
| 572 | sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD; | ||
| 573 | else | ||
| 574 | pr_warn("Unable to setup SDHI0 GPIO IRQ\n"); | ||
| 575 | |||
| 576 | /* enable SDHI1 on CN4 [WLAN I/F] */ | 558 | /* enable SDHI1 on CN4 [WLAN I/F] */ |
| 577 | gpio_request(GPIO_FN_SDHICLK1, NULL); | 559 | gpio_request(GPIO_FN_SDHICLK1, NULL); |
| 578 | gpio_request(GPIO_FN_SDHICMD1_PU, NULL); | 560 | gpio_request(GPIO_FN_SDHICMD1_PU, NULL); |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index f49e28abe0ab..8c6202bb6aeb 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
| @@ -1011,21 +1011,12 @@ static int slot_cn7_get_cd(struct platform_device *pdev) | |||
| 1011 | } | 1011 | } |
| 1012 | 1012 | ||
| 1013 | /* SDHI0 */ | 1013 | /* SDHI0 */ |
| 1014 | static irqreturn_t mackerel_sdhi0_gpio_cd(int irq, void *arg) | ||
| 1015 | { | ||
| 1016 | struct device *dev = arg; | ||
| 1017 | struct sh_mobile_sdhi_info *info = dev->platform_data; | ||
| 1018 | struct tmio_mmc_data *pdata = info->pdata; | ||
| 1019 | |||
| 1020 | tmio_mmc_cd_wakeup(pdata); | ||
| 1021 | |||
| 1022 | return IRQ_HANDLED; | ||
| 1023 | } | ||
| 1024 | |||
| 1025 | static struct sh_mobile_sdhi_info sdhi0_info = { | 1014 | static struct sh_mobile_sdhi_info sdhi0_info = { |
| 1026 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, | 1015 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, |
| 1027 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, | 1016 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, |
| 1017 | .tmio_flags = TMIO_MMC_USE_GPIO_CD, | ||
| 1028 | .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, | 1018 | .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, |
| 1019 | .cd_gpio = GPIO_PORT172, | ||
| 1029 | }; | 1020 | }; |
| 1030 | 1021 | ||
| 1031 | static struct resource sdhi0_resources[] = { | 1022 | static struct resource sdhi0_resources[] = { |
| @@ -1384,7 +1375,6 @@ static void __init mackerel_init(void) | |||
| 1384 | { | 1375 | { |
| 1385 | u32 srcr4; | 1376 | u32 srcr4; |
| 1386 | struct clk *clk; | 1377 | struct clk *clk; |
| 1387 | int ret; | ||
| 1388 | 1378 | ||
| 1389 | /* External clock source */ | 1379 | /* External clock source */ |
| 1390 | clk_set_rate(&sh7372_dv_clki_clk, 27000000); | 1380 | clk_set_rate(&sh7372_dv_clki_clk, 27000000); |
| @@ -1481,7 +1471,6 @@ static void __init mackerel_init(void) | |||
| 1481 | irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH); | 1471 | irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH); |
| 1482 | 1472 | ||
| 1483 | /* enable SDHI0 */ | 1473 | /* enable SDHI0 */ |
| 1484 | gpio_request(GPIO_FN_SDHICD0, NULL); | ||
| 1485 | gpio_request(GPIO_FN_SDHIWP0, NULL); | 1474 | gpio_request(GPIO_FN_SDHIWP0, NULL); |
| 1486 | gpio_request(GPIO_FN_SDHICMD0, NULL); | 1475 | gpio_request(GPIO_FN_SDHICMD0, NULL); |
| 1487 | gpio_request(GPIO_FN_SDHICLK0, NULL); | 1476 | gpio_request(GPIO_FN_SDHICLK0, NULL); |
| @@ -1490,13 +1479,6 @@ static void __init mackerel_init(void) | |||
| 1490 | gpio_request(GPIO_FN_SDHID0_1, NULL); | 1479 | gpio_request(GPIO_FN_SDHID0_1, NULL); |
| 1491 | gpio_request(GPIO_FN_SDHID0_0, NULL); | 1480 | gpio_request(GPIO_FN_SDHID0_0, NULL); |
| 1492 | 1481 | ||
| 1493 | ret = request_irq(evt2irq(0x3340), mackerel_sdhi0_gpio_cd, | ||
| 1494 | IRQF_TRIGGER_FALLING, "sdhi0 cd", &sdhi0_device.dev); | ||
| 1495 | if (!ret) | ||
| 1496 | sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD; | ||
| 1497 | else | ||
| 1498 | pr_err("Cannot get IRQ #%d: %d\n", evt2irq(0x3340), ret); | ||
| 1499 | |||
| 1500 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) | 1482 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) |
| 1501 | /* enable SDHI1 */ | 1483 | /* enable SDHI1 */ |
| 1502 | gpio_request(GPIO_FN_SDHICMD1, NULL); | 1484 | gpio_request(GPIO_FN_SDHICMD1, NULL); |
diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S index 6ac015c89206..b202c1272526 100644 --- a/arch/arm/mach-shmobile/headsmp.S +++ b/arch/arm/mach-shmobile/headsmp.S | |||
| @@ -16,6 +16,59 @@ | |||
| 16 | 16 | ||
| 17 | __CPUINIT | 17 | __CPUINIT |
| 18 | 18 | ||
| 19 | /* Cache invalidation nicked from arch/arm/mach-imx/head-v7.S, thanks! | ||
| 20 | * | ||
| 21 | * The secondary kernel init calls v7_flush_dcache_all before it enables | ||
| 22 | * the L1; however, the L1 comes out of reset in an undefined state, so | ||
| 23 | * the clean + invalidate performed by v7_flush_dcache_all causes a bunch | ||
| 24 | * of cache lines with uninitialized data and uninitialized tags to get | ||
| 25 | * written out to memory, which does really unpleasant things to the main | ||
| 26 | * processor. We fix this by performing an invalidate, rather than a | ||
| 27 | * clean + invalidate, before jumping into the kernel. | ||
| 28 | * | ||
| 29 | * This funciton is cloned from arch/arm/mach-tegra/headsmp.S, and needs | ||
| 30 | * to be called for both secondary cores startup and primary core resume | ||
| 31 | * procedures. Ideally, it should be moved into arch/arm/mm/cache-v7.S. | ||
| 32 | */ | ||
| 33 | ENTRY(v7_invalidate_l1) | ||
| 34 | mov r0, #0 | ||
| 35 | mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache | ||
| 36 | mcr p15, 2, r0, c0, c0, 0 | ||
| 37 | mrc p15, 1, r0, c0, c0, 0 | ||
| 38 | |||
| 39 | ldr r1, =0x7fff | ||
| 40 | and r2, r1, r0, lsr #13 | ||
| 41 | |||
| 42 | ldr r1, =0x3ff | ||
| 43 | |||
| 44 | and r3, r1, r0, lsr #3 @ NumWays - 1 | ||
| 45 | add r2, r2, #1 @ NumSets | ||
| 46 | |||
| 47 | and r0, r0, #0x7 | ||
| 48 | add r0, r0, #4 @ SetShift | ||
| 49 | |||
| 50 | clz r1, r3 @ WayShift | ||
| 51 | add r4, r3, #1 @ NumWays | ||
| 52 | 1: sub r2, r2, #1 @ NumSets-- | ||
| 53 | mov r3, r4 @ Temp = NumWays | ||
| 54 | 2: subs r3, r3, #1 @ Temp-- | ||
| 55 | mov r5, r3, lsl r1 | ||
| 56 | mov r6, r2, lsl r0 | ||
| 57 | orr r5, r5, r6 @ Reg = (Temp<<WayShift)|(NumSets<<SetShift) | ||
| 58 | mcr p15, 0, r5, c7, c6, 2 | ||
| 59 | bgt 2b | ||
| 60 | cmp r2, #0 | ||
| 61 | bgt 1b | ||
| 62 | dsb | ||
| 63 | isb | ||
| 64 | mov pc, lr | ||
| 65 | ENDPROC(v7_invalidate_l1) | ||
| 66 | |||
| 67 | ENTRY(shmobile_invalidate_start) | ||
| 68 | bl v7_invalidate_l1 | ||
| 69 | b secondary_startup | ||
| 70 | ENDPROC(shmobile_invalidate_start) | ||
| 71 | |||
| 19 | /* | 72 | /* |
| 20 | * Reset vector for secondary CPUs. | 73 | * Reset vector for secondary CPUs. |
| 21 | * This will be mapped at address 0 by SBAR register. | 74 | * This will be mapped at address 0 by SBAR register. |
| @@ -24,4 +77,5 @@ | |||
| 24 | .align 12 | 77 | .align 12 |
| 25 | ENTRY(shmobile_secondary_vector) | 78 | ENTRY(shmobile_secondary_vector) |
| 26 | ldr pc, 1f | 79 | ldr pc, 1f |
| 27 | 1: .long secondary_startup - PAGE_OFFSET + PLAT_PHYS_OFFSET | 80 | 1: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET |
| 81 | ENDPROC(shmobile_secondary_vector) | ||
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index 83ad3fe0a75f..c85e6ecda606 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | extern void shmobile_earlytimer_init(void); | 4 | extern void shmobile_earlytimer_init(void); |
| 5 | extern struct sys_timer shmobile_timer; | 5 | extern struct sys_timer shmobile_timer; |
| 6 | struct twd_local_timer; | 6 | struct twd_local_timer; |
| 7 | void shmobile_twd_init(struct twd_local_timer *twd_local_timer); | ||
| 8 | extern void shmobile_setup_console(void); | 7 | extern void shmobile_setup_console(void); |
| 9 | extern void shmobile_secondary_vector(void); | 8 | extern void shmobile_secondary_vector(void); |
| 10 | extern int shmobile_platform_cpu_kill(unsigned int cpu); | 9 | extern int shmobile_platform_cpu_kill(unsigned int cpu); |
| @@ -82,5 +81,6 @@ extern int r8a7779_platform_cpu_kill(unsigned int cpu); | |||
| 82 | extern void r8a7779_secondary_init(unsigned int cpu); | 81 | extern void r8a7779_secondary_init(unsigned int cpu); |
| 83 | extern int r8a7779_boot_secondary(unsigned int cpu); | 82 | extern int r8a7779_boot_secondary(unsigned int cpu); |
| 84 | extern void r8a7779_smp_prepare_cpus(void); | 83 | extern void r8a7779_smp_prepare_cpus(void); |
| 84 | extern void r8a7779_register_twd(void); | ||
| 85 | 85 | ||
| 86 | #endif /* __ARCH_MACH_COMMON_H */ | 86 | #endif /* __ARCH_MACH_COMMON_H */ |
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c index 12c6f529ab89..e98e46f6cf55 100644 --- a/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/arch/arm/mach-shmobile/setup-r8a7779.c | |||
| @@ -262,10 +262,14 @@ void __init r8a7779_add_standard_devices(void) | |||
| 262 | ARRAY_SIZE(r8a7779_late_devices)); | 262 | ARRAY_SIZE(r8a7779_late_devices)); |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ | ||
| 266 | void __init __weak r8a7779_register_twd(void) { } | ||
| 267 | |||
| 265 | static void __init r8a7779_earlytimer_init(void) | 268 | static void __init r8a7779_earlytimer_init(void) |
| 266 | { | 269 | { |
| 267 | r8a7779_clock_init(); | 270 | r8a7779_clock_init(); |
| 268 | shmobile_earlytimer_init(); | 271 | shmobile_earlytimer_init(); |
| 272 | r8a7779_register_twd(); | ||
| 269 | } | 273 | } |
| 270 | 274 | ||
| 271 | void __init r8a7779_add_early_devices(void) | 275 | void __init r8a7779_add_early_devices(void) |
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index 5bebffc10455..04a0dfe75493 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
| @@ -688,10 +688,14 @@ void __init sh73a0_add_standard_devices(void) | |||
| 688 | ARRAY_SIZE(sh73a0_late_devices)); | 688 | ARRAY_SIZE(sh73a0_late_devices)); |
| 689 | } | 689 | } |
| 690 | 690 | ||
| 691 | /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ | ||
| 692 | void __init __weak sh73a0_register_twd(void) { } | ||
| 693 | |||
| 691 | static void __init sh73a0_earlytimer_init(void) | 694 | static void __init sh73a0_earlytimer_init(void) |
| 692 | { | 695 | { |
| 693 | sh73a0_clock_init(); | 696 | sh73a0_clock_init(); |
| 694 | shmobile_earlytimer_init(); | 697 | shmobile_earlytimer_init(); |
| 698 | sh73a0_register_twd(); | ||
| 695 | } | 699 | } |
| 696 | 700 | ||
| 697 | void __init sh73a0_add_early_devices(void) | 701 | void __init sh73a0_add_early_devices(void) |
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c index b62e19d4c9af..6d1d0238cbf7 100644 --- a/arch/arm/mach-shmobile/smp-r8a7779.c +++ b/arch/arm/mach-shmobile/smp-r8a7779.c | |||
| @@ -64,8 +64,15 @@ static void __iomem *scu_base_addr(void) | |||
| 64 | static DEFINE_SPINLOCK(scu_lock); | 64 | static DEFINE_SPINLOCK(scu_lock); |
| 65 | static unsigned long tmp; | 65 | static unsigned long tmp; |
| 66 | 66 | ||
| 67 | #ifdef CONFIG_HAVE_ARM_TWD | ||
| 67 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); | 68 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); |
| 68 | 69 | ||
| 70 | void __init r8a7779_register_twd(void) | ||
| 71 | { | ||
| 72 | twd_local_timer_register(&twd_local_timer); | ||
| 73 | } | ||
| 74 | #endif | ||
| 75 | |||
| 69 | static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) | 76 | static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) |
| 70 | { | 77 | { |
| 71 | void __iomem *scu_base = scu_base_addr(); | 78 | void __iomem *scu_base = scu_base_addr(); |
| @@ -84,7 +91,6 @@ unsigned int __init r8a7779_get_core_count(void) | |||
| 84 | { | 91 | { |
| 85 | void __iomem *scu_base = scu_base_addr(); | 92 | void __iomem *scu_base = scu_base_addr(); |
| 86 | 93 | ||
| 87 | shmobile_twd_init(&twd_local_timer); | ||
| 88 | return scu_get_core_count(scu_base); | 94 | return scu_get_core_count(scu_base); |
| 89 | } | 95 | } |
| 90 | 96 | ||
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c index 14ad8b052f1a..e36c41c4ab40 100644 --- a/arch/arm/mach-shmobile/smp-sh73a0.c +++ b/arch/arm/mach-shmobile/smp-sh73a0.c | |||
| @@ -42,7 +42,13 @@ static void __iomem *scu_base_addr(void) | |||
| 42 | static DEFINE_SPINLOCK(scu_lock); | 42 | static DEFINE_SPINLOCK(scu_lock); |
| 43 | static unsigned long tmp; | 43 | static unsigned long tmp; |
| 44 | 44 | ||
| 45 | #ifdef CONFIG_HAVE_ARM_TWD | ||
| 45 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); | 46 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); |
| 47 | void __init sh73a0_register_twd(void) | ||
| 48 | { | ||
| 49 | twd_local_timer_register(&twd_local_timer); | ||
| 50 | } | ||
| 51 | #endif | ||
| 46 | 52 | ||
| 47 | static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) | 53 | static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) |
| 48 | { | 54 | { |
| @@ -62,7 +68,6 @@ unsigned int __init sh73a0_get_core_count(void) | |||
| 62 | { | 68 | { |
| 63 | void __iomem *scu_base = scu_base_addr(); | 69 | void __iomem *scu_base = scu_base_addr(); |
| 64 | 70 | ||
| 65 | shmobile_twd_init(&twd_local_timer); | ||
| 66 | return scu_get_core_count(scu_base); | 71 | return scu_get_core_count(scu_base); |
| 67 | } | 72 | } |
| 68 | 73 | ||
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c index 2fba5f3d1c8a..8b79e7917a23 100644 --- a/arch/arm/mach-shmobile/timer.c +++ b/arch/arm/mach-shmobile/timer.c | |||
| @@ -46,15 +46,6 @@ static void __init shmobile_timer_init(void) | |||
| 46 | { | 46 | { |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | void __init shmobile_twd_init(struct twd_local_timer *twd_local_timer) | ||
| 50 | { | ||
| 51 | #ifdef CONFIG_HAVE_ARM_TWD | ||
| 52 | int err = twd_local_timer_register(twd_local_timer); | ||
| 53 | if (err) | ||
| 54 | pr_err("twd_local_timer_register failed %d\n", err); | ||
| 55 | #endif | ||
| 56 | } | ||
| 57 | |||
| 58 | struct sys_timer shmobile_timer = { | 49 | struct sys_timer shmobile_timer = { |
| 59 | .init = shmobile_timer_init, | 50 | .init = shmobile_timer_init, |
| 60 | }; | 51 | }; |
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c index fef66a7486ed..f07488e0bd32 100644 --- a/arch/arm/mach-tegra/flowctrl.c +++ b/arch/arm/mach-tegra/flowctrl.c | |||
| @@ -53,10 +53,10 @@ static void flowctrl_update(u8 offset, u32 value) | |||
| 53 | 53 | ||
| 54 | void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) | 54 | void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) |
| 55 | { | 55 | { |
| 56 | return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value); | 56 | return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) | 59 | void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) |
| 60 | { | 60 | { |
| 61 | return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value); | 61 | return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value); |
| 62 | } | 62 | } |
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S index ff1f7cc11f87..80741992a9fc 100644 --- a/arch/arm/mm/abort-ev6.S +++ b/arch/arm/mm/abort-ev6.S | |||
| @@ -26,18 +26,23 @@ ENTRY(v6_early_abort) | |||
| 26 | mrc p15, 0, r1, c5, c0, 0 @ get FSR | 26 | mrc p15, 0, r1, c5, c0, 0 @ get FSR |
| 27 | mrc p15, 0, r0, c6, c0, 0 @ get FAR | 27 | mrc p15, 0, r0, c6, c0, 0 @ get FAR |
| 28 | /* | 28 | /* |
| 29 | * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR (erratum 326103). | 29 | * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR. |
| 30 | * The test below covers all the write situations, including Java bytecodes | ||
| 31 | */ | 30 | */ |
| 32 | bic r1, r1, #1 << 11 @ clear bit 11 of FSR | 31 | #ifdef CONFIG_ARM_ERRATA_326103 |
| 32 | ldr ip, =0x4107b36 | ||
| 33 | mrc p15, 0, r3, c0, c0, 0 @ get processor id | ||
| 34 | teq ip, r3, lsr #4 @ r0 ARM1136? | ||
| 35 | bne do_DataAbort | ||
| 33 | tst r5, #PSR_J_BIT @ Java? | 36 | tst r5, #PSR_J_BIT @ Java? |
| 37 | tsteq r5, #PSR_T_BIT @ Thumb? | ||
| 34 | bne do_DataAbort | 38 | bne do_DataAbort |
| 35 | do_thumb_abort fsr=r1, pc=r4, psr=r5, tmp=r3 | 39 | bic r1, r1, #1 << 11 @ clear bit 11 of FSR |
| 36 | ldreq r3, [r4] @ read aborted ARM instruction | 40 | ldr r3, [r4] @ read aborted ARM instruction |
| 37 | #ifdef CONFIG_CPU_ENDIAN_BE8 | 41 | #ifdef CONFIG_CPU_ENDIAN_BE8 |
| 38 | reveq r3, r3 | 42 | rev r3, r3 |
| 39 | #endif | 43 | #endif |
| 40 | do_ldrd_abort tmp=ip, insn=r3 | 44 | do_ldrd_abort tmp=ip, insn=r3 |
| 41 | tst r3, #1 << 20 @ L = 0 -> write | 45 | tst r3, #1 << 20 @ L = 0 -> write |
| 42 | orreq r1, r1, #1 << 11 @ yes. | 46 | orreq r1, r1, #1 << 11 @ yes. |
| 47 | #endif | ||
| 43 | b do_DataAbort | 48 | b do_DataAbort |
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index a53fd2aaa2f4..2a8e380501e8 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
| @@ -32,6 +32,7 @@ static void __iomem *l2x0_base; | |||
| 32 | static DEFINE_RAW_SPINLOCK(l2x0_lock); | 32 | static DEFINE_RAW_SPINLOCK(l2x0_lock); |
| 33 | static u32 l2x0_way_mask; /* Bitmask of active ways */ | 33 | static u32 l2x0_way_mask; /* Bitmask of active ways */ |
| 34 | static u32 l2x0_size; | 34 | static u32 l2x0_size; |
| 35 | static unsigned long sync_reg_offset = L2X0_CACHE_SYNC; | ||
| 35 | 36 | ||
| 36 | struct l2x0_regs l2x0_saved_regs; | 37 | struct l2x0_regs l2x0_saved_regs; |
| 37 | 38 | ||
| @@ -61,12 +62,7 @@ static inline void cache_sync(void) | |||
| 61 | { | 62 | { |
| 62 | void __iomem *base = l2x0_base; | 63 | void __iomem *base = l2x0_base; |
| 63 | 64 | ||
| 64 | #ifdef CONFIG_PL310_ERRATA_753970 | 65 | writel_relaxed(0, base + sync_reg_offset); |
| 65 | /* write to an unmmapped register */ | ||
| 66 | writel_relaxed(0, base + L2X0_DUMMY_REG); | ||
| 67 | #else | ||
| 68 | writel_relaxed(0, base + L2X0_CACHE_SYNC); | ||
| 69 | #endif | ||
| 70 | cache_wait(base + L2X0_CACHE_SYNC, 1); | 66 | cache_wait(base + L2X0_CACHE_SYNC, 1); |
| 71 | } | 67 | } |
| 72 | 68 | ||
| @@ -85,10 +81,13 @@ static inline void l2x0_inv_line(unsigned long addr) | |||
| 85 | } | 81 | } |
| 86 | 82 | ||
| 87 | #if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915) | 83 | #if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915) |
| 84 | static inline void debug_writel(unsigned long val) | ||
| 85 | { | ||
| 86 | if (outer_cache.set_debug) | ||
| 87 | outer_cache.set_debug(val); | ||
| 88 | } | ||
| 88 | 89 | ||
| 89 | #define debug_writel(val) outer_cache.set_debug(val) | 90 | static void pl310_set_debug(unsigned long val) |
| 90 | |||
| 91 | static void l2x0_set_debug(unsigned long val) | ||
| 92 | { | 91 | { |
| 93 | writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL); | 92 | writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL); |
| 94 | } | 93 | } |
| @@ -98,7 +97,7 @@ static inline void debug_writel(unsigned long val) | |||
| 98 | { | 97 | { |
| 99 | } | 98 | } |
| 100 | 99 | ||
| 101 | #define l2x0_set_debug NULL | 100 | #define pl310_set_debug NULL |
| 102 | #endif | 101 | #endif |
| 103 | 102 | ||
| 104 | #ifdef CONFIG_PL310_ERRATA_588369 | 103 | #ifdef CONFIG_PL310_ERRATA_588369 |
| @@ -331,6 +330,11 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) | |||
| 331 | else | 330 | else |
| 332 | ways = 8; | 331 | ways = 8; |
| 333 | type = "L310"; | 332 | type = "L310"; |
| 333 | #ifdef CONFIG_PL310_ERRATA_753970 | ||
| 334 | /* Unmapped register. */ | ||
| 335 | sync_reg_offset = L2X0_DUMMY_REG; | ||
| 336 | #endif | ||
| 337 | outer_cache.set_debug = pl310_set_debug; | ||
| 334 | break; | 338 | break; |
| 335 | case L2X0_CACHE_ID_PART_L210: | 339 | case L2X0_CACHE_ID_PART_L210: |
| 336 | ways = (aux >> 13) & 0xf; | 340 | ways = (aux >> 13) & 0xf; |
| @@ -379,7 +383,6 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) | |||
| 379 | outer_cache.flush_all = l2x0_flush_all; | 383 | outer_cache.flush_all = l2x0_flush_all; |
| 380 | outer_cache.inv_all = l2x0_inv_all; | 384 | outer_cache.inv_all = l2x0_inv_all; |
| 381 | outer_cache.disable = l2x0_disable; | 385 | outer_cache.disable = l2x0_disable; |
| 382 | outer_cache.set_debug = l2x0_set_debug; | ||
| 383 | 386 | ||
| 384 | printk(KERN_INFO "%s cache controller enabled\n", type); | 387 | printk(KERN_INFO "%s cache controller enabled\n", type); |
| 385 | printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", | 388 | printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index f07467533365..5bb48356d217 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
| @@ -247,7 +247,9 @@ good_area: | |||
| 247 | return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags); | 247 | return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags); |
| 248 | 248 | ||
| 249 | check_stack: | 249 | check_stack: |
| 250 | if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr)) | 250 | /* Don't allow expansion below FIRST_USER_ADDRESS */ |
| 251 | if (vma->vm_flags & VM_GROWSDOWN && | ||
| 252 | addr >= FIRST_USER_ADDRESS && !expand_stack(vma, addr)) | ||
| 251 | goto good_area; | 253 | goto good_area; |
| 252 | out: | 254 | out: |
| 253 | return fault; | 255 | return fault; |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 595079fa9d1d..8f5813bbffb5 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
| @@ -293,11 +293,11 @@ EXPORT_SYMBOL(pfn_valid); | |||
| 293 | #endif | 293 | #endif |
| 294 | 294 | ||
| 295 | #ifndef CONFIG_SPARSEMEM | 295 | #ifndef CONFIG_SPARSEMEM |
| 296 | static void arm_memory_present(void) | 296 | static void __init arm_memory_present(void) |
| 297 | { | 297 | { |
| 298 | } | 298 | } |
| 299 | #else | 299 | #else |
| 300 | static void arm_memory_present(void) | 300 | static void __init arm_memory_present(void) |
| 301 | { | 301 | { |
| 302 | struct memblock_region *reg; | 302 | struct memblock_region *reg; |
| 303 | 303 | ||
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index b86f8933ff91..aa78de8bfdd3 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
| @@ -489,7 +489,8 @@ static void __init build_mem_type_table(void) | |||
| 489 | */ | 489 | */ |
| 490 | for (i = 0; i < ARRAY_SIZE(mem_types); i++) { | 490 | for (i = 0; i < ARRAY_SIZE(mem_types); i++) { |
| 491 | mem_types[i].prot_pte |= PTE_EXT_AF; | 491 | mem_types[i].prot_pte |= PTE_EXT_AF; |
| 492 | mem_types[i].prot_sect |= PMD_SECT_AF; | 492 | if (mem_types[i].prot_sect) |
| 493 | mem_types[i].prot_sect |= PMD_SECT_AF; | ||
| 493 | } | 494 | } |
| 494 | kern_pgprot |= PTE_EXT_AF; | 495 | kern_pgprot |= PTE_EXT_AF; |
| 495 | vecs_pgprot |= PTE_EXT_AF; | 496 | vecs_pgprot |= PTE_EXT_AF; |
| @@ -618,8 +619,8 @@ static void __init alloc_init_section(pud_t *pud, unsigned long addr, | |||
| 618 | } | 619 | } |
| 619 | } | 620 | } |
| 620 | 621 | ||
| 621 | static void alloc_init_pud(pgd_t *pgd, unsigned long addr, unsigned long end, | 622 | static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, |
| 622 | unsigned long phys, const struct mem_type *type) | 623 | unsigned long end, unsigned long phys, const struct mem_type *type) |
| 623 | { | 624 | { |
| 624 | pud_t *pud = pud_offset(pgd, addr); | 625 | pud_t *pud = pud_offset(pgd, addr); |
| 625 | unsigned long next; | 626 | unsigned long next; |
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index ecdb3da0dea9..c58d896cd5c3 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
| @@ -916,6 +916,13 @@ void omap_start_dma(int lch) | |||
| 916 | l |= OMAP_DMA_CCR_BUFFERING_DISABLE; | 916 | l |= OMAP_DMA_CCR_BUFFERING_DISABLE; |
| 917 | l |= OMAP_DMA_CCR_EN; | 917 | l |= OMAP_DMA_CCR_EN; |
| 918 | 918 | ||
| 919 | /* | ||
| 920 | * As dma_write() uses IO accessors which are weakly ordered, there | ||
| 921 | * is no guarantee that data in coherent DMA memory will be visible | ||
| 922 | * to the DMA device. Add a memory barrier here to ensure that any | ||
| 923 | * such data is visible prior to enabling DMA. | ||
| 924 | */ | ||
| 925 | mb(); | ||
| 919 | p->dma_write(l, CCR, lch); | 926 | p->dma_write(l, CCR, lch); |
| 920 | 927 | ||
| 921 | dma_chan[lch].flags |= OMAP_DMA_ACTIVE; | 928 | dma_chan[lch].flags |= OMAP_DMA_ACTIVE; |
| @@ -965,6 +972,13 @@ void omap_stop_dma(int lch) | |||
| 965 | p->dma_write(l, CCR, lch); | 972 | p->dma_write(l, CCR, lch); |
| 966 | } | 973 | } |
| 967 | 974 | ||
| 975 | /* | ||
| 976 | * Ensure that data transferred by DMA is visible to any access | ||
| 977 | * after DMA has been disabled. This is important for coherent | ||
| 978 | * DMA regions. | ||
| 979 | */ | ||
| 980 | mb(); | ||
| 981 | |||
| 968 | if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { | 982 | if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { |
| 969 | int next_lch, cur_lch = lch; | 983 | int next_lch, cur_lch = lch; |
| 970 | char dma_chan_link_map[dma_lch_count]; | 984 | char dma_chan_link_map[dma_lch_count]; |
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 858748eaa144..b0197b2c857d 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c | |||
| @@ -11,12 +11,15 @@ | |||
| 11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
| 12 | #include <linux/cpu.h> | 12 | #include <linux/cpu.h> |
| 13 | #include <linux/cpu_pm.h> | 13 | #include <linux/cpu_pm.h> |
| 14 | #include <linux/hardirq.h> | ||
| 14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 15 | #include <linux/notifier.h> | 16 | #include <linux/notifier.h> |
| 16 | #include <linux/signal.h> | 17 | #include <linux/signal.h> |
| 17 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
| 18 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
| 19 | #include <linux/init.h> | 20 | #include <linux/init.h> |
| 21 | #include <linux/uaccess.h> | ||
| 22 | #include <linux/user.h> | ||
| 20 | 23 | ||
| 21 | #include <asm/cp15.h> | 24 | #include <asm/cp15.h> |
| 22 | #include <asm/cputype.h> | 25 | #include <asm/cputype.h> |
| @@ -430,7 +433,10 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs) | |||
| 430 | 433 | ||
| 431 | static void vfp_enable(void *unused) | 434 | static void vfp_enable(void *unused) |
| 432 | { | 435 | { |
| 433 | u32 access = get_copro_access(); | 436 | u32 access; |
| 437 | |||
| 438 | BUG_ON(preemptible()); | ||
| 439 | access = get_copro_access(); | ||
| 434 | 440 | ||
| 435 | /* | 441 | /* |
| 436 | * Enable full access to VFP (cp10 and cp11) | 442 | * Enable full access to VFP (cp10 and cp11) |
| @@ -529,6 +535,93 @@ void vfp_flush_hwstate(struct thread_info *thread) | |||
| 529 | } | 535 | } |
| 530 | 536 | ||
| 531 | /* | 537 | /* |
| 538 | * Save the current VFP state into the provided structures and prepare | ||
| 539 | * for entry into a new function (signal handler). | ||
| 540 | */ | ||
| 541 | int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp, | ||
| 542 | struct user_vfp_exc __user *ufp_exc) | ||
| 543 | { | ||
| 544 | struct thread_info *thread = current_thread_info(); | ||
| 545 | struct vfp_hard_struct *hwstate = &thread->vfpstate.hard; | ||
| 546 | int err = 0; | ||
| 547 | |||
| 548 | /* Ensure that the saved hwstate is up-to-date. */ | ||
| 549 | vfp_sync_hwstate(thread); | ||
| 550 | |||
| 551 | /* | ||
| 552 | * Copy the floating point registers. There can be unused | ||
| 553 | * registers see asm/hwcap.h for details. | ||
| 554 | */ | ||
| 555 | err |= __copy_to_user(&ufp->fpregs, &hwstate->fpregs, | ||
| 556 | sizeof(hwstate->fpregs)); | ||
| 557 | /* | ||
| 558 | * Copy the status and control register. | ||
| 559 | */ | ||
| 560 | __put_user_error(hwstate->fpscr, &ufp->fpscr, err); | ||
| 561 | |||
| 562 | /* | ||
| 563 | * Copy the exception registers. | ||
| 564 | */ | ||
| 565 | __put_user_error(hwstate->fpexc, &ufp_exc->fpexc, err); | ||
| 566 | __put_user_error(hwstate->fpinst, &ufp_exc->fpinst, err); | ||
| 567 | __put_user_error(hwstate->fpinst2, &ufp_exc->fpinst2, err); | ||
| 568 | |||
| 569 | if (err) | ||
| 570 | return -EFAULT; | ||
| 571 | |||
| 572 | /* Ensure that VFP is disabled. */ | ||
| 573 | vfp_flush_hwstate(thread); | ||
| 574 | |||
| 575 | /* | ||
| 576 | * As per the PCS, clear the length and stride bits for function | ||
| 577 | * entry. | ||
| 578 | */ | ||
| 579 | hwstate->fpscr &= ~(FPSCR_LENGTH_MASK | FPSCR_STRIDE_MASK); | ||
| 580 | return 0; | ||
| 581 | } | ||
| 582 | |||
| 583 | /* Sanitise and restore the current VFP state from the provided structures. */ | ||
| 584 | int vfp_restore_user_hwstate(struct user_vfp __user *ufp, | ||
| 585 | struct user_vfp_exc __user *ufp_exc) | ||
| 586 | { | ||
| 587 | struct thread_info *thread = current_thread_info(); | ||
| 588 | struct vfp_hard_struct *hwstate = &thread->vfpstate.hard; | ||
| 589 | unsigned long fpexc; | ||
| 590 | int err = 0; | ||
| 591 | |||
| 592 | /* Disable VFP to avoid corrupting the new thread state. */ | ||
| 593 | vfp_flush_hwstate(thread); | ||
| 594 | |||
| 595 | /* | ||
| 596 | * Copy the floating point registers. There can be unused | ||
| 597 | * registers see asm/hwcap.h for details. | ||
| 598 | */ | ||
| 599 | err |= __copy_from_user(&hwstate->fpregs, &ufp->fpregs, | ||
| 600 | sizeof(hwstate->fpregs)); | ||
| 601 | /* | ||
| 602 | * Copy the status and control register. | ||
| 603 | */ | ||
| 604 | __get_user_error(hwstate->fpscr, &ufp->fpscr, err); | ||
| 605 | |||
| 606 | /* | ||
| 607 | * Sanitise and restore the exception registers. | ||
| 608 | */ | ||
| 609 | __get_user_error(fpexc, &ufp_exc->fpexc, err); | ||
| 610 | |||
| 611 | /* Ensure the VFP is enabled. */ | ||
| 612 | fpexc |= FPEXC_EN; | ||
| 613 | |||
| 614 | /* Ensure FPINST2 is invalid and the exception flag is cleared. */ | ||
| 615 | fpexc &= ~(FPEXC_EX | FPEXC_FP2V); | ||
| 616 | hwstate->fpexc = fpexc; | ||
| 617 | |||
| 618 | __get_user_error(hwstate->fpinst, &ufp_exc->fpinst, err); | ||
| 619 | __get_user_error(hwstate->fpinst2, &ufp_exc->fpinst2, err); | ||
| 620 | |||
| 621 | return err ? -EFAULT : 0; | ||
| 622 | } | ||
| 623 | |||
| 624 | /* | ||
| 532 | * VFP hardware can lose all context when a CPU goes offline. | 625 | * VFP hardware can lose all context when a CPU goes offline. |
| 533 | * As we will be running in SMP mode with CPU hotplug, we will save the | 626 | * As we will be running in SMP mode with CPU hotplug, we will save the |
| 534 | * hardware state at every thread switch. We clear our held state when | 627 | * hardware state at every thread switch. We clear our held state when |
| @@ -558,7 +651,7 @@ static int __init vfp_init(void) | |||
| 558 | unsigned int cpu_arch = cpu_architecture(); | 651 | unsigned int cpu_arch = cpu_architecture(); |
| 559 | 652 | ||
| 560 | if (cpu_arch >= CPU_ARCH_ARMv6) | 653 | if (cpu_arch >= CPU_ARCH_ARMv6) |
| 561 | vfp_enable(NULL); | 654 | on_each_cpu(vfp_enable, NULL, 1); |
| 562 | 655 | ||
| 563 | /* | 656 | /* |
| 564 | * First check that there is a VFP that we can use. | 657 | * First check that there is a VFP that we can use. |
| @@ -579,8 +672,6 @@ static int __init vfp_init(void) | |||
| 579 | } else { | 672 | } else { |
| 580 | hotcpu_notifier(vfp_hotplug, 0); | 673 | hotcpu_notifier(vfp_hotplug, 0); |
| 581 | 674 | ||
| 582 | smp_call_function(vfp_enable, NULL, 1); | ||
| 583 | |||
| 584 | VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; /* Extract the architecture version */ | 675 | VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; /* Extract the architecture version */ |
| 585 | printk("implementor %02x architecture %d part %02x variant %x rev %x\n", | 676 | printk("implementor %02x architecture %d part %02x variant %x rev %x\n", |
| 586 | (vfpsid & FPSID_IMPLEMENTER_MASK) >> FPSID_IMPLEMENTER_BIT, | 677 | (vfpsid & FPSID_IMPLEMENTER_MASK) >> FPSID_IMPLEMENTER_BIT, |
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h index 81c2e271d620..9b1a92b73f60 100644 --- a/arch/frv/include/asm/processor.h +++ b/arch/frv/include/asm/processor.h | |||
| @@ -135,10 +135,6 @@ unsigned long get_wchan(struct task_struct *p); | |||
| 135 | #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) | 135 | #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) |
| 136 | #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) | 136 | #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) |
| 137 | 137 | ||
| 138 | /* Allocation and freeing of basic task resources. */ | ||
| 139 | extern struct task_struct *alloc_task_struct_node(int node); | ||
| 140 | extern void free_task_struct(struct task_struct *p); | ||
| 141 | |||
| 142 | #define cpu_relax() barrier() | 138 | #define cpu_relax() barrier() |
| 143 | 139 | ||
| 144 | /* data cache prefetch */ | 140 | /* data cache prefetch */ |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index f5104b7c52cd..463fb3bbe11e 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
| @@ -1174,7 +1174,7 @@ out: | |||
| 1174 | 1174 | ||
| 1175 | bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) | 1175 | bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) |
| 1176 | { | 1176 | { |
| 1177 | return irqchip_in_kernel(vcpu->kcm) == (vcpu->arch.apic != NULL); | 1177 | return irqchip_in_kernel(vcpu->kvm) == (vcpu->arch.apic != NULL); |
| 1178 | } | 1178 | } |
| 1179 | 1179 | ||
| 1180 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | 1180 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) |
diff --git a/arch/m68k/platform/520x/config.c b/arch/m68k/platform/520x/config.c index 235947844f27..09df4b89e8be 100644 --- a/arch/m68k/platform/520x/config.c +++ b/arch/m68k/platform/520x/config.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | /***************************************************************************/ | 23 | /***************************************************************************/ |
| 24 | 24 | ||
| 25 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 25 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 26 | 26 | ||
| 27 | static void __init m520x_qspi_init(void) | 27 | static void __init m520x_qspi_init(void) |
| 28 | { | 28 | { |
| @@ -35,7 +35,7 @@ static void __init m520x_qspi_init(void) | |||
| 35 | writew(par, MCF_GPIO_PAR_UART); | 35 | writew(par, MCF_GPIO_PAR_UART); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | #endif /* CONFIG_SPI_COLDFIRE_QSPI */ | 38 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
| 39 | 39 | ||
| 40 | /***************************************************************************/ | 40 | /***************************************************************************/ |
| 41 | 41 | ||
| @@ -79,7 +79,7 @@ void __init config_BSP(char *commandp, int size) | |||
| 79 | mach_sched_init = hw_timer_init; | 79 | mach_sched_init = hw_timer_init; |
| 80 | m520x_uarts_init(); | 80 | m520x_uarts_init(); |
| 81 | m520x_fec_init(); | 81 | m520x_fec_init(); |
| 82 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 82 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 83 | m520x_qspi_init(); | 83 | m520x_qspi_init(); |
| 84 | #endif | 84 | #endif |
| 85 | } | 85 | } |
diff --git a/arch/m68k/platform/523x/config.c b/arch/m68k/platform/523x/config.c index c8b405d5a961..d47dfd8f50a2 100644 --- a/arch/m68k/platform/523x/config.c +++ b/arch/m68k/platform/523x/config.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | /***************************************************************************/ | 23 | /***************************************************************************/ |
| 24 | 24 | ||
| 25 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 25 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 26 | 26 | ||
| 27 | static void __init m523x_qspi_init(void) | 27 | static void __init m523x_qspi_init(void) |
| 28 | { | 28 | { |
| @@ -36,7 +36,7 @@ static void __init m523x_qspi_init(void) | |||
| 36 | writew(par, MCFGPIO_PAR_TIMER); | 36 | writew(par, MCFGPIO_PAR_TIMER); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | #endif /* CONFIG_SPI_COLDFIRE_QSPI */ | 39 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
| 40 | 40 | ||
| 41 | /***************************************************************************/ | 41 | /***************************************************************************/ |
| 42 | 42 | ||
| @@ -58,7 +58,7 @@ void __init config_BSP(char *commandp, int size) | |||
| 58 | { | 58 | { |
| 59 | mach_sched_init = hw_timer_init; | 59 | mach_sched_init = hw_timer_init; |
| 60 | m523x_fec_init(); | 60 | m523x_fec_init(); |
| 61 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 61 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 62 | m523x_qspi_init(); | 62 | m523x_qspi_init(); |
| 63 | #endif | 63 | #endif |
| 64 | } | 64 | } |
diff --git a/arch/m68k/platform/5249/config.c b/arch/m68k/platform/5249/config.c index bbf05135bb98..300e729a58d0 100644 --- a/arch/m68k/platform/5249/config.c +++ b/arch/m68k/platform/5249/config.c | |||
| @@ -51,7 +51,7 @@ static struct platform_device *m5249_devices[] __initdata = { | |||
| 51 | 51 | ||
| 52 | /***************************************************************************/ | 52 | /***************************************************************************/ |
| 53 | 53 | ||
| 54 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 54 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 55 | 55 | ||
| 56 | static void __init m5249_qspi_init(void) | 56 | static void __init m5249_qspi_init(void) |
| 57 | { | 57 | { |
| @@ -61,7 +61,7 @@ static void __init m5249_qspi_init(void) | |||
| 61 | mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); | 61 | mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | #endif /* CONFIG_SPI_COLDFIRE_QSPI */ | 64 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
| 65 | 65 | ||
| 66 | /***************************************************************************/ | 66 | /***************************************************************************/ |
| 67 | 67 | ||
| @@ -90,7 +90,7 @@ void __init config_BSP(char *commandp, int size) | |||
| 90 | #ifdef CONFIG_M5249C3 | 90 | #ifdef CONFIG_M5249C3 |
| 91 | m5249_smc91x_init(); | 91 | m5249_smc91x_init(); |
| 92 | #endif | 92 | #endif |
| 93 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 93 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 94 | m5249_qspi_init(); | 94 | m5249_qspi_init(); |
| 95 | #endif | 95 | #endif |
| 96 | } | 96 | } |
diff --git a/arch/m68k/platform/527x/config.c b/arch/m68k/platform/527x/config.c index f91a53294c35..b3cb378c5e94 100644 --- a/arch/m68k/platform/527x/config.c +++ b/arch/m68k/platform/527x/config.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | /***************************************************************************/ | 24 | /***************************************************************************/ |
| 25 | 25 | ||
| 26 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 26 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 27 | 27 | ||
| 28 | static void __init m527x_qspi_init(void) | 28 | static void __init m527x_qspi_init(void) |
| 29 | { | 29 | { |
| @@ -42,7 +42,7 @@ static void __init m527x_qspi_init(void) | |||
| 42 | #endif | 42 | #endif |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | #endif /* CONFIG_SPI_COLDFIRE_QSPI */ | 45 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
| 46 | 46 | ||
| 47 | /***************************************************************************/ | 47 | /***************************************************************************/ |
| 48 | 48 | ||
| @@ -90,7 +90,7 @@ void __init config_BSP(char *commandp, int size) | |||
| 90 | mach_sched_init = hw_timer_init; | 90 | mach_sched_init = hw_timer_init; |
| 91 | m527x_uarts_init(); | 91 | m527x_uarts_init(); |
| 92 | m527x_fec_init(); | 92 | m527x_fec_init(); |
| 93 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 93 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 94 | m527x_qspi_init(); | 94 | m527x_qspi_init(); |
| 95 | #endif | 95 | #endif |
| 96 | } | 96 | } |
diff --git a/arch/m68k/platform/528x/config.c b/arch/m68k/platform/528x/config.c index d4492926614c..c5f11ba49be5 100644 --- a/arch/m68k/platform/528x/config.c +++ b/arch/m68k/platform/528x/config.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | /***************************************************************************/ | 25 | /***************************************************************************/ |
| 26 | 26 | ||
| 27 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 27 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 28 | 28 | ||
| 29 | static void __init m528x_qspi_init(void) | 29 | static void __init m528x_qspi_init(void) |
| 30 | { | 30 | { |
| @@ -32,7 +32,7 @@ static void __init m528x_qspi_init(void) | |||
| 32 | __raw_writeb(0x07, MCFGPIO_PQSPAR); | 32 | __raw_writeb(0x07, MCFGPIO_PQSPAR); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | #endif /* CONFIG_SPI_COLDFIRE_QSPI */ | 35 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
| 36 | 36 | ||
| 37 | /***************************************************************************/ | 37 | /***************************************************************************/ |
| 38 | 38 | ||
| @@ -98,7 +98,7 @@ void __init config_BSP(char *commandp, int size) | |||
| 98 | mach_sched_init = hw_timer_init; | 98 | mach_sched_init = hw_timer_init; |
| 99 | m528x_uarts_init(); | 99 | m528x_uarts_init(); |
| 100 | m528x_fec_init(); | 100 | m528x_fec_init(); |
| 101 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 101 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 102 | m528x_qspi_init(); | 102 | m528x_qspi_init(); |
| 103 | #endif | 103 | #endif |
| 104 | } | 104 | } |
diff --git a/arch/m68k/platform/532x/config.c b/arch/m68k/platform/532x/config.c index 2bec3477b739..37082d02f2bd 100644 --- a/arch/m68k/platform/532x/config.c +++ b/arch/m68k/platform/532x/config.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | /***************************************************************************/ | 31 | /***************************************************************************/ |
| 32 | 32 | ||
| 33 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 33 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 34 | 34 | ||
| 35 | static void __init m532x_qspi_init(void) | 35 | static void __init m532x_qspi_init(void) |
| 36 | { | 36 | { |
| @@ -38,7 +38,7 @@ static void __init m532x_qspi_init(void) | |||
| 38 | writew(0x01f0, MCF_GPIO_PAR_QSPI); | 38 | writew(0x01f0, MCF_GPIO_PAR_QSPI); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | #endif /* CONFIG_SPI_COLDFIRE_QSPI */ | 41 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
| 42 | 42 | ||
| 43 | /***************************************************************************/ | 43 | /***************************************************************************/ |
| 44 | 44 | ||
| @@ -77,7 +77,7 @@ void __init config_BSP(char *commandp, int size) | |||
| 77 | mach_sched_init = hw_timer_init; | 77 | mach_sched_init = hw_timer_init; |
| 78 | m532x_uarts_init(); | 78 | m532x_uarts_init(); |
| 79 | m532x_fec_init(); | 79 | m532x_fec_init(); |
| 80 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 80 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 81 | m532x_qspi_init(); | 81 | m532x_qspi_init(); |
| 82 | #endif | 82 | #endif |
| 83 | 83 | ||
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c index 7af97362b95c..3aa77ddea89d 100644 --- a/arch/m68k/platform/coldfire/device.c +++ b/arch/m68k/platform/coldfire/device.c | |||
| @@ -121,7 +121,7 @@ static struct platform_device mcf_fec1 = { | |||
| 121 | #endif /* MCFFEC_BASE1 */ | 121 | #endif /* MCFFEC_BASE1 */ |
| 122 | #endif /* CONFIG_FEC */ | 122 | #endif /* CONFIG_FEC */ |
| 123 | 123 | ||
| 124 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 124 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 125 | /* | 125 | /* |
| 126 | * The ColdFire QSPI module is an SPI protocol hardware block used | 126 | * The ColdFire QSPI module is an SPI protocol hardware block used |
| 127 | * on a number of different ColdFire CPUs. | 127 | * on a number of different ColdFire CPUs. |
| @@ -274,7 +274,7 @@ static struct platform_device mcf_qspi = { | |||
| 274 | .resource = mcf_qspi_resources, | 274 | .resource = mcf_qspi_resources, |
| 275 | .dev.platform_data = &mcf_qspi_data, | 275 | .dev.platform_data = &mcf_qspi_data, |
| 276 | }; | 276 | }; |
| 277 | #endif /* CONFIG_SPI_COLDFIRE_QSPI */ | 277 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
| 278 | 278 | ||
| 279 | static struct platform_device *mcf_devices[] __initdata = { | 279 | static struct platform_device *mcf_devices[] __initdata = { |
| 280 | &mcf_uart, | 280 | &mcf_uart, |
| @@ -284,7 +284,7 @@ static struct platform_device *mcf_devices[] __initdata = { | |||
| 284 | &mcf_fec1, | 284 | &mcf_fec1, |
| 285 | #endif | 285 | #endif |
| 286 | #endif | 286 | #endif |
| 287 | #ifdef CONFIG_SPI_COLDFIRE_QSPI | 287 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
| 288 | &mcf_qspi, | 288 | &mcf_qspi, |
| 289 | #endif | 289 | #endif |
| 290 | }; | 290 | }; |
diff --git a/arch/mips/ath79/dev-wmac.c b/arch/mips/ath79/dev-wmac.c index e21507052066..9c717bf98ffe 100644 --- a/arch/mips/ath79/dev-wmac.c +++ b/arch/mips/ath79/dev-wmac.c | |||
| @@ -58,8 +58,8 @@ static void __init ar913x_wmac_setup(void) | |||
| 58 | 58 | ||
| 59 | static int ar933x_wmac_reset(void) | 59 | static int ar933x_wmac_reset(void) |
| 60 | { | 60 | { |
| 61 | ath79_device_reset_clear(AR933X_RESET_WMAC); | ||
| 62 | ath79_device_reset_set(AR933X_RESET_WMAC); | 61 | ath79_device_reset_set(AR933X_RESET_WMAC); |
| 62 | ath79_device_reset_clear(AR933X_RESET_WMAC); | ||
| 63 | 63 | ||
| 64 | return 0; | 64 | return 0; |
| 65 | } | 65 | } |
diff --git a/arch/mips/include/asm/mach-jz4740/irq.h b/arch/mips/include/asm/mach-jz4740/irq.h index a865c983c70a..5ad1a9c113c6 100644 --- a/arch/mips/include/asm/mach-jz4740/irq.h +++ b/arch/mips/include/asm/mach-jz4740/irq.h | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | #define JZ4740_IRQ_LCD JZ4740_IRQ(30) | 45 | #define JZ4740_IRQ_LCD JZ4740_IRQ(30) |
| 46 | 46 | ||
| 47 | /* 2nd-level interrupts */ | 47 | /* 2nd-level interrupts */ |
| 48 | #define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (X)) | 48 | #define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (x)) |
| 49 | 49 | ||
| 50 | #define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x)) | 50 | #define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x)) |
| 51 | #define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x)) | 51 | #define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x)) |
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h index 73c0d45798de..9b02cfba7449 100644 --- a/arch/mips/include/asm/mmu_context.h +++ b/arch/mips/include/asm/mmu_context.h | |||
| @@ -37,12 +37,6 @@ extern void tlbmiss_handler_setup_pgd(unsigned long pgd); | |||
| 37 | write_c0_xcontext((unsigned long) smp_processor_id() << 51); \ | 37 | write_c0_xcontext((unsigned long) smp_processor_id() << 51); \ |
| 38 | } while (0) | 38 | } while (0) |
| 39 | 39 | ||
| 40 | |||
| 41 | static inline unsigned long get_current_pgd(void) | ||
| 42 | { | ||
| 43 | return PHYS_TO_XKSEG_CACHED((read_c0_context() >> 11) & ~0xfffUL); | ||
| 44 | } | ||
| 45 | |||
| 46 | #else /* CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/ | 40 | #else /* CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/ |
| 47 | 41 | ||
| 48 | /* | 42 | /* |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 185ca00c4c84..d5a338a1739c 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
| @@ -257,11 +257,8 @@ asmlinkage int sys_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 257 | return -EFAULT; | 257 | return -EFAULT; |
| 258 | sigdelsetmask(&newset, ~_BLOCKABLE); | 258 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 259 | 259 | ||
| 260 | spin_lock_irq(¤t->sighand->siglock); | ||
| 261 | current->saved_sigmask = current->blocked; | 260 | current->saved_sigmask = current->blocked; |
| 262 | current->blocked = newset; | 261 | set_current_blocked(&newset); |
| 263 | recalc_sigpending(); | ||
| 264 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 265 | 262 | ||
| 266 | current->state = TASK_INTERRUPTIBLE; | 263 | current->state = TASK_INTERRUPTIBLE; |
| 267 | schedule(); | 264 | schedule(); |
| @@ -286,11 +283,8 @@ asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 286 | return -EFAULT; | 283 | return -EFAULT; |
| 287 | sigdelsetmask(&newset, ~_BLOCKABLE); | 284 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 288 | 285 | ||
| 289 | spin_lock_irq(¤t->sighand->siglock); | ||
| 290 | current->saved_sigmask = current->blocked; | 286 | current->saved_sigmask = current->blocked; |
| 291 | current->blocked = newset; | 287 | set_current_blocked(&newset); |
| 292 | recalc_sigpending(); | ||
| 293 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 294 | 288 | ||
| 295 | current->state = TASK_INTERRUPTIBLE; | 289 | current->state = TASK_INTERRUPTIBLE; |
| 296 | schedule(); | 290 | schedule(); |
| @@ -362,10 +356,7 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 362 | goto badframe; | 356 | goto badframe; |
| 363 | 357 | ||
| 364 | sigdelsetmask(&blocked, ~_BLOCKABLE); | 358 | sigdelsetmask(&blocked, ~_BLOCKABLE); |
| 365 | spin_lock_irq(¤t->sighand->siglock); | 359 | set_current_blocked(&blocked); |
| 366 | current->blocked = blocked; | ||
| 367 | recalc_sigpending(); | ||
| 368 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 369 | 360 | ||
| 370 | sig = restore_sigcontext(®s, &frame->sf_sc); | 361 | sig = restore_sigcontext(®s, &frame->sf_sc); |
| 371 | if (sig < 0) | 362 | if (sig < 0) |
| @@ -401,10 +392,7 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 401 | goto badframe; | 392 | goto badframe; |
| 402 | 393 | ||
| 403 | sigdelsetmask(&set, ~_BLOCKABLE); | 394 | sigdelsetmask(&set, ~_BLOCKABLE); |
| 404 | spin_lock_irq(¤t->sighand->siglock); | 395 | set_current_blocked(&set); |
| 405 | current->blocked = set; | ||
| 406 | recalc_sigpending(); | ||
| 407 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 408 | 396 | ||
| 409 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); | 397 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); |
| 410 | if (sig < 0) | 398 | if (sig < 0) |
| @@ -580,12 +568,7 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
| 580 | if (ret) | 568 | if (ret) |
| 581 | return ret; | 569 | return ret; |
| 582 | 570 | ||
| 583 | spin_lock_irq(¤t->sighand->siglock); | 571 | block_sigmask(ka, sig); |
| 584 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); | ||
| 585 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
| 586 | sigaddset(¤t->blocked, sig); | ||
| 587 | recalc_sigpending(); | ||
| 588 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 589 | 572 | ||
| 590 | return ret; | 573 | return ret; |
| 591 | } | 574 | } |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 06b5da392e24..ac3b8d89aae5 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
| @@ -290,11 +290,8 @@ asmlinkage int sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 290 | return -EFAULT; | 290 | return -EFAULT; |
| 291 | sigdelsetmask(&newset, ~_BLOCKABLE); | 291 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 292 | 292 | ||
| 293 | spin_lock_irq(¤t->sighand->siglock); | ||
| 294 | current->saved_sigmask = current->blocked; | 293 | current->saved_sigmask = current->blocked; |
| 295 | current->blocked = newset; | 294 | set_current_blocked(&newset); |
| 296 | recalc_sigpending(); | ||
| 297 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 298 | 295 | ||
| 299 | current->state = TASK_INTERRUPTIBLE; | 296 | current->state = TASK_INTERRUPTIBLE; |
| 300 | schedule(); | 297 | schedule(); |
| @@ -318,11 +315,8 @@ asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 318 | return -EFAULT; | 315 | return -EFAULT; |
| 319 | sigdelsetmask(&newset, ~_BLOCKABLE); | 316 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 320 | 317 | ||
| 321 | spin_lock_irq(¤t->sighand->siglock); | ||
| 322 | current->saved_sigmask = current->blocked; | 318 | current->saved_sigmask = current->blocked; |
| 323 | current->blocked = newset; | 319 | set_current_blocked(&newset); |
| 324 | recalc_sigpending(); | ||
| 325 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 326 | 320 | ||
| 327 | current->state = TASK_INTERRUPTIBLE; | 321 | current->state = TASK_INTERRUPTIBLE; |
| 328 | schedule(); | 322 | schedule(); |
| @@ -488,10 +482,7 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 488 | goto badframe; | 482 | goto badframe; |
| 489 | 483 | ||
| 490 | sigdelsetmask(&blocked, ~_BLOCKABLE); | 484 | sigdelsetmask(&blocked, ~_BLOCKABLE); |
| 491 | spin_lock_irq(¤t->sighand->siglock); | 485 | set_current_blocked(&blocked); |
| 492 | current->blocked = blocked; | ||
| 493 | recalc_sigpending(); | ||
| 494 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 495 | 486 | ||
| 496 | sig = restore_sigcontext32(®s, &frame->sf_sc); | 487 | sig = restore_sigcontext32(®s, &frame->sf_sc); |
| 497 | if (sig < 0) | 488 | if (sig < 0) |
| @@ -529,10 +520,7 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 529 | goto badframe; | 520 | goto badframe; |
| 530 | 521 | ||
| 531 | sigdelsetmask(&set, ~_BLOCKABLE); | 522 | sigdelsetmask(&set, ~_BLOCKABLE); |
| 532 | spin_lock_irq(¤t->sighand->siglock); | 523 | set_current_blocked(&set); |
| 533 | current->blocked = set; | ||
| 534 | recalc_sigpending(); | ||
| 535 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 536 | 524 | ||
| 537 | sig = restore_sigcontext32(®s, &frame->rs_uc.uc_mcontext); | 525 | sig = restore_sigcontext32(®s, &frame->rs_uc.uc_mcontext); |
| 538 | if (sig < 0) | 526 | if (sig < 0) |
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c index ae29e894ab8d..86eb4b04631c 100644 --- a/arch/mips/kernel/signal_n32.c +++ b/arch/mips/kernel/signal_n32.c | |||
| @@ -93,11 +93,8 @@ asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 93 | sigset_from_compat(&newset, &uset); | 93 | sigset_from_compat(&newset, &uset); |
| 94 | sigdelsetmask(&newset, ~_BLOCKABLE); | 94 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 95 | 95 | ||
| 96 | spin_lock_irq(¤t->sighand->siglock); | ||
| 97 | current->saved_sigmask = current->blocked; | 96 | current->saved_sigmask = current->blocked; |
| 98 | current->blocked = newset; | 97 | set_current_blocked(&newset); |
| 99 | recalc_sigpending(); | ||
| 100 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 101 | 98 | ||
| 102 | current->state = TASK_INTERRUPTIBLE; | 99 | current->state = TASK_INTERRUPTIBLE; |
| 103 | schedule(); | 100 | schedule(); |
| @@ -121,10 +118,7 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 121 | goto badframe; | 118 | goto badframe; |
| 122 | 119 | ||
| 123 | sigdelsetmask(&set, ~_BLOCKABLE); | 120 | sigdelsetmask(&set, ~_BLOCKABLE); |
| 124 | spin_lock_irq(¤t->sighand->siglock); | 121 | set_current_blocked(&set); |
| 125 | current->blocked = set; | ||
| 126 | recalc_sigpending(); | ||
| 127 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 128 | 122 | ||
| 129 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); | 123 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); |
| 130 | if (sig < 0) | 124 | if (sig < 0) |
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c index 910dddf65e44..9cd69ad6aa02 100644 --- a/arch/mn10300/kernel/smp.c +++ b/arch/mn10300/kernel/smp.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
| 25 | #include <linux/profile.h> | 25 | #include <linux/profile.h> |
| 26 | #include <linux/smp.h> | 26 | #include <linux/smp.h> |
| 27 | #include <linux/cpu.h> | ||
| 27 | #include <asm/tlbflush.h> | 28 | #include <asm/tlbflush.h> |
| 28 | #include <asm/bitops.h> | 29 | #include <asm/bitops.h> |
| 29 | #include <asm/processor.h> | 30 | #include <asm/processor.h> |
| @@ -38,7 +39,6 @@ | |||
| 38 | #include "internal.h" | 39 | #include "internal.h" |
| 39 | 40 | ||
| 40 | #ifdef CONFIG_HOTPLUG_CPU | 41 | #ifdef CONFIG_HOTPLUG_CPU |
| 41 | #include <linux/cpu.h> | ||
| 42 | #include <asm/cacheflush.h> | 42 | #include <asm/cacheflush.h> |
| 43 | 43 | ||
| 44 | static unsigned long sleep_mode[NR_CPUS]; | 44 | static unsigned long sleep_mode[NR_CPUS]; |
| @@ -874,10 +874,13 @@ static void __init smp_online(void) | |||
| 874 | 874 | ||
| 875 | cpu = smp_processor_id(); | 875 | cpu = smp_processor_id(); |
| 876 | 876 | ||
| 877 | local_irq_enable(); | 877 | notify_cpu_starting(cpu); |
| 878 | 878 | ||
| 879 | ipi_call_lock(); | ||
| 879 | set_cpu_online(cpu, true); | 880 | set_cpu_online(cpu, true); |
| 880 | smp_wmb(); | 881 | ipi_call_unlock(); |
| 882 | |||
| 883 | local_irq_enable(); | ||
| 881 | } | 884 | } |
| 882 | 885 | ||
| 883 | /** | 886 | /** |
diff --git a/arch/parisc/include/asm/hardware.h b/arch/parisc/include/asm/hardware.h index 4e9626836bab..d1d864b81bae 100644 --- a/arch/parisc/include/asm/hardware.h +++ b/arch/parisc/include/asm/hardware.h | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | #define _PARISC_HARDWARE_H | 2 | #define _PARISC_HARDWARE_H |
| 3 | 3 | ||
| 4 | #include <linux/mod_devicetable.h> | 4 | #include <linux/mod_devicetable.h> |
| 5 | #include <asm/pdc.h> | ||
| 6 | 5 | ||
| 7 | #define HWTYPE_ANY_ID PA_HWTYPE_ANY_ID | 6 | #define HWTYPE_ANY_ID PA_HWTYPE_ANY_ID |
| 8 | #define HVERSION_ANY_ID PA_HVERSION_ANY_ID | 7 | #define HVERSION_ANY_ID PA_HVERSION_ANY_ID |
| @@ -95,12 +94,14 @@ struct bc_module { | |||
| 95 | #define HPHW_MC 15 | 94 | #define HPHW_MC 15 |
| 96 | #define HPHW_FAULTY 31 | 95 | #define HPHW_FAULTY 31 |
| 97 | 96 | ||
| 97 | struct parisc_device_id; | ||
| 98 | 98 | ||
| 99 | /* hardware.c: */ | 99 | /* hardware.c: */ |
| 100 | extern const char *parisc_hardware_description(struct parisc_device_id *id); | 100 | extern const char *parisc_hardware_description(struct parisc_device_id *id); |
| 101 | extern enum cpu_type parisc_get_cpu_type(unsigned long hversion); | 101 | extern enum cpu_type parisc_get_cpu_type(unsigned long hversion); |
| 102 | 102 | ||
| 103 | struct pci_dev; | 103 | struct pci_dev; |
| 104 | struct hardware_path; | ||
| 104 | 105 | ||
| 105 | /* drivers.c: */ | 106 | /* drivers.c: */ |
| 106 | extern struct parisc_device *alloc_pa_dev(unsigned long hpa, | 107 | extern struct parisc_device *alloc_pa_dev(unsigned long hpa, |
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h index a84cc1f925f6..4e0e7dbf0f3f 100644 --- a/arch/parisc/include/asm/page.h +++ b/arch/parisc/include/asm/page.h | |||
| @@ -160,5 +160,11 @@ extern int npmem_ranges; | |||
| 160 | 160 | ||
| 161 | #include <asm-generic/memory_model.h> | 161 | #include <asm-generic/memory_model.h> |
| 162 | #include <asm-generic/getorder.h> | 162 | #include <asm-generic/getorder.h> |
| 163 | #include <asm/pdc.h> | ||
| 164 | |||
| 165 | #define PAGE0 ((struct zeropage *)__PAGE_OFFSET) | ||
| 166 | |||
| 167 | /* DEFINITION OF THE ZERO-PAGE (PAG0) */ | ||
| 168 | /* based on work by Jason Eckhardt (jason@equator.com) */ | ||
| 163 | 169 | ||
| 164 | #endif /* _PARISC_PAGE_H */ | 170 | #endif /* _PARISC_PAGE_H */ |
diff --git a/arch/parisc/include/asm/pdc.h b/arch/parisc/include/asm/pdc.h index 4ca510b3c6f8..7f0f2d23059d 100644 --- a/arch/parisc/include/asm/pdc.h +++ b/arch/parisc/include/asm/pdc.h | |||
| @@ -343,8 +343,6 @@ | |||
| 343 | 343 | ||
| 344 | #ifdef __KERNEL__ | 344 | #ifdef __KERNEL__ |
| 345 | 345 | ||
| 346 | #include <asm/page.h> /* for __PAGE_OFFSET */ | ||
| 347 | |||
| 348 | extern int pdc_type; | 346 | extern int pdc_type; |
| 349 | 347 | ||
| 350 | /* Values for pdc_type */ | 348 | /* Values for pdc_type */ |
| @@ -677,11 +675,6 @@ static inline char * os_id_to_string(u16 os_id) { | |||
| 677 | 675 | ||
| 678 | #endif /* __KERNEL__ */ | 676 | #endif /* __KERNEL__ */ |
| 679 | 677 | ||
| 680 | #define PAGE0 ((struct zeropage *)__PAGE_OFFSET) | ||
| 681 | |||
| 682 | /* DEFINITION OF THE ZERO-PAGE (PAG0) */ | ||
| 683 | /* based on work by Jason Eckhardt (jason@equator.com) */ | ||
| 684 | |||
| 685 | /* flags of the device_path */ | 678 | /* flags of the device_path */ |
| 686 | #define PF_AUTOBOOT 0x80 | 679 | #define PF_AUTOBOOT 0x80 |
| 687 | #define PF_AUTOSEARCH 0x40 | 680 | #define PF_AUTOSEARCH 0x40 |
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h index 22dadeb58695..ee99f2339356 100644 --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h | |||
| @@ -44,6 +44,8 @@ struct vm_area_struct; | |||
| 44 | 44 | ||
| 45 | #endif /* !__ASSEMBLY__ */ | 45 | #endif /* !__ASSEMBLY__ */ |
| 46 | 46 | ||
| 47 | #include <asm/page.h> | ||
| 48 | |||
| 47 | #define pte_ERROR(e) \ | 49 | #define pte_ERROR(e) \ |
| 48 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | 50 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) |
| 49 | #define pmd_ERROR(e) \ | 51 | #define pmd_ERROR(e) \ |
diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h index 804aa28ab1d6..3516e0b27044 100644 --- a/arch/parisc/include/asm/spinlock.h +++ b/arch/parisc/include/asm/spinlock.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __ASM_SPINLOCK_H | 1 | #ifndef __ASM_SPINLOCK_H |
| 2 | #define __ASM_SPINLOCK_H | 2 | #define __ASM_SPINLOCK_H |
| 3 | 3 | ||
| 4 | #include <asm/barrier.h> | ||
| 5 | #include <asm/ldcw.h> | ||
| 4 | #include <asm/processor.h> | 6 | #include <asm/processor.h> |
| 5 | #include <asm/spinlock_types.h> | 7 | #include <asm/spinlock_types.h> |
| 6 | 8 | ||
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index 4f004596a6e7..47341aa208f2 100644 --- a/arch/parisc/kernel/pdc_cons.c +++ b/arch/parisc/kernel/pdc_cons.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include <linux/init.h> | 50 | #include <linux/init.h> |
| 51 | #include <linux/major.h> | 51 | #include <linux/major.h> |
| 52 | #include <linux/tty.h> | 52 | #include <linux/tty.h> |
| 53 | #include <asm/page.h> /* for PAGE0 */ | ||
| 53 | #include <asm/pdc.h> /* for iodc_call() proto and friends */ | 54 | #include <asm/pdc.h> /* for iodc_call() proto and friends */ |
| 54 | 55 | ||
| 55 | static DEFINE_SPINLOCK(pdc_console_lock); | 56 | static DEFINE_SPINLOCK(pdc_console_lock); |
| @@ -104,7 +105,7 @@ static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp) | |||
| 104 | 105 | ||
| 105 | static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp) | 106 | static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp) |
| 106 | { | 107 | { |
| 107 | if (!tty->count) { | 108 | if (tty->count == 1) { |
| 108 | del_timer_sync(&pdc_console_timer); | 109 | del_timer_sync(&pdc_console_timer); |
| 109 | tty_port_tty_set(&tty_port, NULL); | 110 | tty_port_tty_set(&tty_port, NULL); |
| 110 | } | 111 | } |
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index 0bb1d63907f8..4dc7b7942b4c 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
| 32 | #include <linux/bitops.h> | 32 | #include <linux/bitops.h> |
| 33 | #include <linux/ftrace.h> | 33 | #include <linux/ftrace.h> |
| 34 | #include <linux/cpu.h> | ||
| 34 | 35 | ||
| 35 | #include <linux/atomic.h> | 36 | #include <linux/atomic.h> |
| 36 | #include <asm/current.h> | 37 | #include <asm/current.h> |
| @@ -295,8 +296,13 @@ smp_cpu_init(int cpunum) | |||
| 295 | 296 | ||
| 296 | printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum); | 297 | printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum); |
| 297 | machine_halt(); | 298 | machine_halt(); |
| 298 | } | 299 | } |
| 300 | |||
| 301 | notify_cpu_starting(cpunum); | ||
| 302 | |||
| 303 | ipi_call_lock(); | ||
| 299 | set_cpu_online(cpunum, true); | 304 | set_cpu_online(cpunum, true); |
| 305 | ipi_call_unlock(); | ||
| 300 | 306 | ||
| 301 | /* Initialise the idle task for this CPU */ | 307 | /* Initialise the idle task for this CPU */ |
| 302 | atomic_inc(&init_mm.mm_count); | 308 | atomic_inc(&init_mm.mm_count); |
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index 7c0774397b89..70e105d62423 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
| 30 | #include <asm/io.h> | 30 | #include <asm/io.h> |
| 31 | #include <asm/irq.h> | 31 | #include <asm/irq.h> |
| 32 | #include <asm/page.h> | ||
| 32 | #include <asm/param.h> | 33 | #include <asm/param.h> |
| 33 | #include <asm/pdc.h> | 34 | #include <asm/pdc.h> |
| 34 | #include <asm/led.h> | 35 | #include <asm/led.h> |
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h index 548da3aa0a30..d58fc4e4149c 100644 --- a/arch/powerpc/include/asm/exception-64s.h +++ b/arch/powerpc/include/asm/exception-64s.h | |||
| @@ -288,13 +288,6 @@ label##_hv: \ | |||
| 288 | /* Exception addition: Hard disable interrupts */ | 288 | /* Exception addition: Hard disable interrupts */ |
| 289 | #define DISABLE_INTS SOFT_DISABLE_INTS(r10,r11) | 289 | #define DISABLE_INTS SOFT_DISABLE_INTS(r10,r11) |
| 290 | 290 | ||
| 291 | /* Exception addition: Keep interrupt state */ | ||
| 292 | #define ENABLE_INTS \ | ||
| 293 | ld r11,PACAKMSR(r13); \ | ||
| 294 | ld r12,_MSR(r1); \ | ||
| 295 | rlwimi r11,r12,0,MSR_EE; \ | ||
| 296 | mtmsrd r11,1 | ||
| 297 | |||
| 298 | #define ADD_NVGPRS \ | 291 | #define ADD_NVGPRS \ |
| 299 | bl .save_nvgprs | 292 | bl .save_nvgprs |
| 300 | 293 | ||
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index e648af92ced1..0e40843a1c6e 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h | |||
| @@ -18,10 +18,6 @@ | |||
| 18 | #include <linux/atomic.h> | 18 | #include <linux/atomic.h> |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | /* Define a way to iterate across irqs. */ | ||
| 22 | #define for_each_irq(i) \ | ||
| 23 | for ((i) = 0; (i) < NR_IRQS; ++(i)) | ||
| 24 | |||
| 25 | extern atomic_t ppc_n_lost_interrupts; | 21 | extern atomic_t ppc_n_lost_interrupts; |
| 26 | 22 | ||
| 27 | /* This number is used when no interrupt has been assigned */ | 23 | /* This number is used when no interrupt has been assigned */ |
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index aa795ccef294..fd07f43d6622 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
| @@ -81,12 +81,13 @@ struct kvmppc_vcpu_book3s { | |||
| 81 | u64 sdr1; | 81 | u64 sdr1; |
| 82 | u64 hior; | 82 | u64 hior; |
| 83 | u64 msr_mask; | 83 | u64 msr_mask; |
| 84 | u64 vsid_next; | ||
| 85 | #ifdef CONFIG_PPC_BOOK3S_32 | 84 | #ifdef CONFIG_PPC_BOOK3S_32 |
| 86 | u32 vsid_pool[VSID_POOL_SIZE]; | 85 | u32 vsid_pool[VSID_POOL_SIZE]; |
| 86 | u32 vsid_next; | ||
| 87 | #else | 87 | #else |
| 88 | u64 vsid_first; | 88 | u64 proto_vsid_first; |
| 89 | u64 vsid_max; | 89 | u64 proto_vsid_max; |
| 90 | u64 proto_vsid_next; | ||
| 90 | #endif | 91 | #endif |
| 91 | int context_id[SID_CONTEXTS]; | 92 | int context_id[SID_CONTEXTS]; |
| 92 | 93 | ||
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index f8a7a1a1a9f4..ef2074c3e906 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
| @@ -588,23 +588,19 @@ _GLOBAL(ret_from_except_lite) | |||
| 588 | fast_exc_return_irq: | 588 | fast_exc_return_irq: |
| 589 | restore: | 589 | restore: |
| 590 | /* | 590 | /* |
| 591 | * This is the main kernel exit path, we first check if we | 591 | * This is the main kernel exit path. First we check if we |
| 592 | * have to change our interrupt state. | 592 | * are about to re-enable interrupts |
| 593 | */ | 593 | */ |
| 594 | ld r5,SOFTE(r1) | 594 | ld r5,SOFTE(r1) |
| 595 | lbz r6,PACASOFTIRQEN(r13) | 595 | lbz r6,PACASOFTIRQEN(r13) |
| 596 | cmpwi cr1,r5,0 | 596 | cmpwi cr0,r5,0 |
| 597 | cmpw cr0,r5,r6 | 597 | beq restore_irq_off |
| 598 | beq cr0,4f | ||
| 599 | 598 | ||
| 600 | /* We do, handle disable first, which is easy */ | 599 | /* We are enabling, were we already enabled ? Yes, just return */ |
| 601 | bne cr1,3f; | 600 | cmpwi cr0,r6,1 |
| 602 | li r0,0 | 601 | beq cr0,do_restore |
| 603 | stb r0,PACASOFTIRQEN(r13); | ||
| 604 | TRACE_DISABLE_INTS | ||
| 605 | b 4f | ||
| 606 | 602 | ||
| 607 | 3: /* | 603 | /* |
| 608 | * We are about to soft-enable interrupts (we are hard disabled | 604 | * We are about to soft-enable interrupts (we are hard disabled |
| 609 | * at this point). We check if there's anything that needs to | 605 | * at this point). We check if there's anything that needs to |
| 610 | * be replayed first. | 606 | * be replayed first. |
| @@ -626,7 +622,7 @@ restore_no_replay: | |||
| 626 | /* | 622 | /* |
| 627 | * Final return path. BookE is handled in a different file | 623 | * Final return path. BookE is handled in a different file |
| 628 | */ | 624 | */ |
| 629 | 4: | 625 | do_restore: |
| 630 | #ifdef CONFIG_PPC_BOOK3E | 626 | #ifdef CONFIG_PPC_BOOK3E |
| 631 | b .exception_return_book3e | 627 | b .exception_return_book3e |
| 632 | #else | 628 | #else |
| @@ -700,6 +696,25 @@ fast_exception_return: | |||
| 700 | #endif /* CONFIG_PPC_BOOK3E */ | 696 | #endif /* CONFIG_PPC_BOOK3E */ |
| 701 | 697 | ||
| 702 | /* | 698 | /* |
| 699 | * We are returning to a context with interrupts soft disabled. | ||
| 700 | * | ||
| 701 | * However, we may also about to hard enable, so we need to | ||
| 702 | * make sure that in this case, we also clear PACA_IRQ_HARD_DIS | ||
| 703 | * or that bit can get out of sync and bad things will happen | ||
| 704 | */ | ||
| 705 | restore_irq_off: | ||
| 706 | ld r3,_MSR(r1) | ||
| 707 | lbz r7,PACAIRQHAPPENED(r13) | ||
| 708 | andi. r0,r3,MSR_EE | ||
| 709 | beq 1f | ||
| 710 | rlwinm r7,r7,0,~PACA_IRQ_HARD_DIS | ||
| 711 | stb r7,PACAIRQHAPPENED(r13) | ||
| 712 | 1: li r0,0 | ||
| 713 | stb r0,PACASOFTIRQEN(r13); | ||
| 714 | TRACE_DISABLE_INTS | ||
| 715 | b do_restore | ||
| 716 | |||
| 717 | /* | ||
| 703 | * Something did happen, check if a re-emit is needed | 718 | * Something did happen, check if a re-emit is needed |
| 704 | * (this also clears paca->irq_happened) | 719 | * (this also clears paca->irq_happened) |
| 705 | */ | 720 | */ |
| @@ -748,6 +763,9 @@ restore_check_irq_replay: | |||
| 748 | #endif /* CONFIG_PPC_BOOK3E */ | 763 | #endif /* CONFIG_PPC_BOOK3E */ |
| 749 | 1: b .ret_from_except /* What else to do here ? */ | 764 | 1: b .ret_from_except /* What else to do here ? */ |
| 750 | 765 | ||
| 766 | |||
| 767 | |||
| 768 | 3: | ||
| 751 | do_work: | 769 | do_work: |
| 752 | #ifdef CONFIG_PREEMPT | 770 | #ifdef CONFIG_PREEMPT |
| 753 | andi. r0,r3,MSR_PR /* Returning to user mode? */ | 771 | andi. r0,r3,MSR_PR /* Returning to user mode? */ |
| @@ -767,16 +785,6 @@ do_work: | |||
| 767 | SOFT_DISABLE_INTS(r3,r4) | 785 | SOFT_DISABLE_INTS(r3,r4) |
| 768 | 1: bl .preempt_schedule_irq | 786 | 1: bl .preempt_schedule_irq |
| 769 | 787 | ||
| 770 | /* Hard-disable interrupts again (and update PACA) */ | ||
| 771 | #ifdef CONFIG_PPC_BOOK3E | ||
| 772 | wrteei 0 | ||
| 773 | #else | ||
| 774 | ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */ | ||
| 775 | mtmsrd r10,1 | ||
| 776 | #endif /* CONFIG_PPC_BOOK3E */ | ||
| 777 | li r0,PACA_IRQ_HARD_DIS | ||
| 778 | stb r0,PACAIRQHAPPENED(r13) | ||
| 779 | |||
| 780 | /* Re-test flags and eventually loop */ | 788 | /* Re-test flags and eventually loop */ |
| 781 | clrrdi r9,r1,THREAD_SHIFT | 789 | clrrdi r9,r1,THREAD_SHIFT |
| 782 | ld r4,TI_FLAGS(r9) | 790 | ld r4,TI_FLAGS(r9) |
| @@ -787,14 +795,6 @@ do_work: | |||
| 787 | user_work: | 795 | user_work: |
| 788 | #endif /* CONFIG_PREEMPT */ | 796 | #endif /* CONFIG_PREEMPT */ |
| 789 | 797 | ||
| 790 | /* Enable interrupts */ | ||
| 791 | #ifdef CONFIG_PPC_BOOK3E | ||
| 792 | wrteei 1 | ||
| 793 | #else | ||
| 794 | ori r10,r10,MSR_EE | ||
| 795 | mtmsrd r10,1 | ||
| 796 | #endif /* CONFIG_PPC_BOOK3E */ | ||
| 797 | |||
| 798 | andi. r0,r4,_TIF_NEED_RESCHED | 798 | andi. r0,r4,_TIF_NEED_RESCHED |
| 799 | beq 1f | 799 | beq 1f |
| 800 | bl .restore_interrupts | 800 | bl .restore_interrupts |
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index cb705fdbb458..8f880bc77c56 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
| @@ -768,8 +768,8 @@ alignment_common: | |||
| 768 | std r3,_DAR(r1) | 768 | std r3,_DAR(r1) |
| 769 | std r4,_DSISR(r1) | 769 | std r4,_DSISR(r1) |
| 770 | bl .save_nvgprs | 770 | bl .save_nvgprs |
| 771 | DISABLE_INTS | ||
| 771 | addi r3,r1,STACK_FRAME_OVERHEAD | 772 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 772 | ENABLE_INTS | ||
| 773 | bl .alignment_exception | 773 | bl .alignment_exception |
| 774 | b .ret_from_except | 774 | b .ret_from_except |
| 775 | 775 | ||
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 5ec1b2354ca6..641da9e868ce 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
| @@ -229,6 +229,19 @@ notrace void arch_local_irq_restore(unsigned long en) | |||
| 229 | */ | 229 | */ |
| 230 | if (unlikely(irq_happened != PACA_IRQ_HARD_DIS)) | 230 | if (unlikely(irq_happened != PACA_IRQ_HARD_DIS)) |
| 231 | __hard_irq_disable(); | 231 | __hard_irq_disable(); |
| 232 | #ifdef CONFIG_TRACE_IRQFLAG | ||
| 233 | else { | ||
| 234 | /* | ||
| 235 | * We should already be hard disabled here. We had bugs | ||
| 236 | * where that wasn't the case so let's dbl check it and | ||
| 237 | * warn if we are wrong. Only do that when IRQ tracing | ||
| 238 | * is enabled as mfmsr() can be costly. | ||
| 239 | */ | ||
| 240 | if (WARN_ON(mfmsr() & MSR_EE)) | ||
| 241 | __hard_irq_disable(); | ||
| 242 | } | ||
| 243 | #endif /* CONFIG_TRACE_IRQFLAG */ | ||
| 244 | |||
| 232 | set_soft_enabled(0); | 245 | set_soft_enabled(0); |
| 233 | 246 | ||
| 234 | /* | 247 | /* |
| @@ -260,11 +273,17 @@ EXPORT_SYMBOL(arch_local_irq_restore); | |||
| 260 | * if they are currently disabled. This is typically called before | 273 | * if they are currently disabled. This is typically called before |
| 261 | * schedule() or do_signal() when returning to userspace. We do it | 274 | * schedule() or do_signal() when returning to userspace. We do it |
| 262 | * in C to avoid the burden of dealing with lockdep etc... | 275 | * in C to avoid the burden of dealing with lockdep etc... |
| 276 | * | ||
| 277 | * NOTE: This is called with interrupts hard disabled but not marked | ||
| 278 | * as such in paca->irq_happened, so we need to resync this. | ||
| 263 | */ | 279 | */ |
| 264 | void restore_interrupts(void) | 280 | void restore_interrupts(void) |
| 265 | { | 281 | { |
| 266 | if (irqs_disabled()) | 282 | if (irqs_disabled()) { |
| 283 | local_paca->irq_happened |= PACA_IRQ_HARD_DIS; | ||
| 267 | local_irq_enable(); | 284 | local_irq_enable(); |
| 285 | } else | ||
| 286 | __hard_irq_enable(); | ||
| 268 | } | 287 | } |
| 269 | 288 | ||
| 270 | #endif /* CONFIG_PPC64 */ | 289 | #endif /* CONFIG_PPC64 */ |
| @@ -330,14 +349,10 @@ void migrate_irqs(void) | |||
| 330 | 349 | ||
| 331 | alloc_cpumask_var(&mask, GFP_KERNEL); | 350 | alloc_cpumask_var(&mask, GFP_KERNEL); |
| 332 | 351 | ||
| 333 | for_each_irq(irq) { | 352 | for_each_irq_desc(irq, desc) { |
| 334 | struct irq_data *data; | 353 | struct irq_data *data; |
| 335 | struct irq_chip *chip; | 354 | struct irq_chip *chip; |
| 336 | 355 | ||
| 337 | desc = irq_to_desc(irq); | ||
| 338 | if (!desc) | ||
| 339 | continue; | ||
| 340 | |||
| 341 | data = irq_desc_get_irq_data(desc); | 356 | data = irq_desc_get_irq_data(desc); |
| 342 | if (irqd_is_per_cpu(data)) | 357 | if (irqd_is_per_cpu(data)) |
| 343 | continue; | 358 | continue; |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index c957b1202bdc..5df777794403 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
| @@ -23,14 +23,11 @@ | |||
| 23 | 23 | ||
| 24 | void machine_kexec_mask_interrupts(void) { | 24 | void machine_kexec_mask_interrupts(void) { |
| 25 | unsigned int i; | 25 | unsigned int i; |
| 26 | struct irq_desc *desc; | ||
| 26 | 27 | ||
| 27 | for_each_irq(i) { | 28 | for_each_irq_desc(i, desc) { |
| 28 | struct irq_desc *desc = irq_to_desc(i); | ||
| 29 | struct irq_chip *chip; | 29 | struct irq_chip *chip; |
| 30 | 30 | ||
| 31 | if (!desc) | ||
| 32 | continue; | ||
| 33 | |||
| 34 | chip = irq_desc_get_chip(desc); | 31 | chip = irq_desc_get_chip(desc); |
| 35 | if (!chip) | 32 | if (!chip) |
| 36 | continue; | 33 | continue; |
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 6aa0c663e247..158972341a2d 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
| @@ -248,7 +248,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) | |||
| 248 | addr, regs->nip, regs->link, code); | 248 | addr, regs->nip, regs->link, code); |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | if (!arch_irq_disabled_regs(regs)) | 251 | if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs)) |
| 252 | local_irq_enable(); | 252 | local_irq_enable(); |
| 253 | 253 | ||
| 254 | memset(&info, 0, sizeof(info)); | 254 | memset(&info, 0, sizeof(info)); |
| @@ -1019,7 +1019,9 @@ void __kprobes program_check_exception(struct pt_regs *regs) | |||
| 1019 | return; | 1019 | return; |
| 1020 | } | 1020 | } |
| 1021 | 1021 | ||
| 1022 | local_irq_enable(); | 1022 | /* We restore the interrupt state now */ |
| 1023 | if (!arch_irq_disabled_regs(regs)) | ||
| 1024 | local_irq_enable(); | ||
| 1023 | 1025 | ||
| 1024 | #ifdef CONFIG_MATH_EMULATION | 1026 | #ifdef CONFIG_MATH_EMULATION |
| 1025 | /* (reason & REASON_ILLEGAL) would be the obvious thing here, | 1027 | /* (reason & REASON_ILLEGAL) would be the obvious thing here, |
| @@ -1069,6 +1071,10 @@ void alignment_exception(struct pt_regs *regs) | |||
| 1069 | { | 1071 | { |
| 1070 | int sig, code, fixed = 0; | 1072 | int sig, code, fixed = 0; |
| 1071 | 1073 | ||
| 1074 | /* We restore the interrupt state now */ | ||
| 1075 | if (!arch_irq_disabled_regs(regs)) | ||
| 1076 | local_irq_enable(); | ||
| 1077 | |||
| 1072 | /* we don't implement logging of alignment exceptions */ | 1078 | /* we don't implement logging of alignment exceptions */ |
| 1073 | if (!(current->thread.align_ctl & PR_UNALIGN_SIGBUS)) | 1079 | if (!(current->thread.align_ctl & PR_UNALIGN_SIGBUS)) |
| 1074 | fixed = fix_alignment(regs); | 1080 | fixed = fix_alignment(regs); |
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c index 6f87f39a1ac2..10fc8ec9d2a8 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_host.c +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c | |||
| @@ -194,14 +194,14 @@ static struct kvmppc_sid_map *create_sid_map(struct kvm_vcpu *vcpu, u64 gvsid) | |||
| 194 | backwards_map = !backwards_map; | 194 | backwards_map = !backwards_map; |
| 195 | 195 | ||
| 196 | /* Uh-oh ... out of mappings. Let's flush! */ | 196 | /* Uh-oh ... out of mappings. Let's flush! */ |
| 197 | if (vcpu_book3s->vsid_next == vcpu_book3s->vsid_max) { | 197 | if (vcpu_book3s->proto_vsid_next == vcpu_book3s->proto_vsid_max) { |
| 198 | vcpu_book3s->vsid_next = vcpu_book3s->vsid_first; | 198 | vcpu_book3s->proto_vsid_next = vcpu_book3s->proto_vsid_first; |
| 199 | memset(vcpu_book3s->sid_map, 0, | 199 | memset(vcpu_book3s->sid_map, 0, |
| 200 | sizeof(struct kvmppc_sid_map) * SID_MAP_NUM); | 200 | sizeof(struct kvmppc_sid_map) * SID_MAP_NUM); |
| 201 | kvmppc_mmu_pte_flush(vcpu, 0, 0); | 201 | kvmppc_mmu_pte_flush(vcpu, 0, 0); |
| 202 | kvmppc_mmu_flush_segments(vcpu); | 202 | kvmppc_mmu_flush_segments(vcpu); |
| 203 | } | 203 | } |
| 204 | map->host_vsid = vcpu_book3s->vsid_next++; | 204 | map->host_vsid = vsid_scramble(vcpu_book3s->proto_vsid_next++, 256M); |
| 205 | 205 | ||
| 206 | map->guest_vsid = gvsid; | 206 | map->guest_vsid = gvsid; |
| 207 | map->valid = true; | 207 | map->valid = true; |
| @@ -319,9 +319,10 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu) | |||
| 319 | return -1; | 319 | return -1; |
| 320 | vcpu3s->context_id[0] = err; | 320 | vcpu3s->context_id[0] = err; |
| 321 | 321 | ||
| 322 | vcpu3s->vsid_max = ((vcpu3s->context_id[0] + 1) << USER_ESID_BITS) - 1; | 322 | vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1) |
| 323 | vcpu3s->vsid_first = vcpu3s->context_id[0] << USER_ESID_BITS; | 323 | << USER_ESID_BITS) - 1; |
| 324 | vcpu3s->vsid_next = vcpu3s->vsid_first; | 324 | vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << USER_ESID_BITS; |
| 325 | vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first; | ||
| 325 | 326 | ||
| 326 | kvmppc_mmu_hpte_init(vcpu); | 327 | kvmppc_mmu_hpte_init(vcpu); |
| 327 | 328 | ||
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index ddc485a529f2..c3beaeef3f60 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c | |||
| @@ -258,6 +258,8 @@ static long kvmppc_get_guest_page(struct kvm *kvm, unsigned long gfn, | |||
| 258 | !(memslot->userspace_addr & (s - 1))) { | 258 | !(memslot->userspace_addr & (s - 1))) { |
| 259 | start &= ~(s - 1); | 259 | start &= ~(s - 1); |
| 260 | pgsize = s; | 260 | pgsize = s; |
| 261 | get_page(hpage); | ||
| 262 | put_page(page); | ||
| 261 | page = hpage; | 263 | page = hpage; |
| 262 | } | 264 | } |
| 263 | } | 265 | } |
| @@ -281,11 +283,8 @@ static long kvmppc_get_guest_page(struct kvm *kvm, unsigned long gfn, | |||
| 281 | err = 0; | 283 | err = 0; |
| 282 | 284 | ||
| 283 | out: | 285 | out: |
| 284 | if (got) { | 286 | if (got) |
| 285 | if (PageHuge(page)) | ||
| 286 | page = compound_head(page); | ||
| 287 | put_page(page); | 287 | put_page(page); |
| 288 | } | ||
| 289 | return err; | 288 | return err; |
| 290 | 289 | ||
| 291 | up_err: | 290 | up_err: |
| @@ -678,8 +677,15 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
| 678 | SetPageDirty(page); | 677 | SetPageDirty(page); |
| 679 | 678 | ||
| 680 | out_put: | 679 | out_put: |
| 681 | if (page) | 680 | if (page) { |
| 682 | put_page(page); | 681 | /* |
| 682 | * We drop pages[0] here, not page because page might | ||
| 683 | * have been set to the head page of a compound, but | ||
| 684 | * we have to drop the reference on the correct tail | ||
| 685 | * page to match the get inside gup() | ||
| 686 | */ | ||
| 687 | put_page(pages[0]); | ||
| 688 | } | ||
| 683 | return ret; | 689 | return ret; |
| 684 | 690 | ||
| 685 | out_unlock: | 691 | out_unlock: |
| @@ -979,6 +985,7 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa, | |||
| 979 | pa = *physp; | 985 | pa = *physp; |
| 980 | } | 986 | } |
| 981 | page = pfn_to_page(pa >> PAGE_SHIFT); | 987 | page = pfn_to_page(pa >> PAGE_SHIFT); |
| 988 | get_page(page); | ||
| 982 | } else { | 989 | } else { |
| 983 | hva = gfn_to_hva_memslot(memslot, gfn); | 990 | hva = gfn_to_hva_memslot(memslot, gfn); |
| 984 | npages = get_user_pages_fast(hva, 1, 1, pages); | 991 | npages = get_user_pages_fast(hva, 1, 1, pages); |
| @@ -991,8 +998,6 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa, | |||
| 991 | page = compound_head(page); | 998 | page = compound_head(page); |
| 992 | psize <<= compound_order(page); | 999 | psize <<= compound_order(page); |
| 993 | } | 1000 | } |
| 994 | if (!kvm->arch.using_mmu_notifiers) | ||
| 995 | get_page(page); | ||
| 996 | offset = gpa & (psize - 1); | 1001 | offset = gpa & (psize - 1); |
| 997 | if (nb_ret) | 1002 | if (nb_ret) |
| 998 | *nb_ret = psize - offset; | 1003 | *nb_ret = psize - offset; |
| @@ -1003,7 +1008,6 @@ void kvmppc_unpin_guest_page(struct kvm *kvm, void *va) | |||
| 1003 | { | 1008 | { |
| 1004 | struct page *page = virt_to_page(va); | 1009 | struct page *page = virt_to_page(va); |
| 1005 | 1010 | ||
| 1006 | page = compound_head(page); | ||
| 1007 | put_page(page); | 1011 | put_page(page); |
| 1008 | } | 1012 | } |
| 1009 | 1013 | ||
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 01294a5099dd..108d1f580177 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
| @@ -1192,8 +1192,6 @@ static void unpin_slot(struct kvm *kvm, int slot_id) | |||
| 1192 | continue; | 1192 | continue; |
| 1193 | pfn = physp[j] >> PAGE_SHIFT; | 1193 | pfn = physp[j] >> PAGE_SHIFT; |
| 1194 | page = pfn_to_page(pfn); | 1194 | page = pfn_to_page(pfn); |
| 1195 | if (PageHuge(page)) | ||
| 1196 | page = compound_head(page); | ||
| 1197 | SetPageDirty(page); | 1195 | SetPageDirty(page); |
| 1198 | put_page(page); | 1196 | put_page(page); |
| 1199 | } | 1197 | } |
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c index def880aea63a..cec4daddbf31 100644 --- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c +++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c | |||
| @@ -463,6 +463,7 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu) | |||
| 463 | /* insert R and C bits from PTE */ | 463 | /* insert R and C bits from PTE */ |
| 464 | rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C); | 464 | rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C); |
| 465 | args[j] |= rcbits << (56 - 5); | 465 | args[j] |= rcbits << (56 - 5); |
| 466 | hp[0] = 0; | ||
| 466 | continue; | 467 | continue; |
| 467 | } | 468 | } |
| 468 | 469 | ||
diff --git a/arch/powerpc/kvm/book3s_segment.S b/arch/powerpc/kvm/book3s_segment.S index 0676ae249b9f..6e6e9cef34a8 100644 --- a/arch/powerpc/kvm/book3s_segment.S +++ b/arch/powerpc/kvm/book3s_segment.S | |||
| @@ -197,7 +197,8 @@ kvmppc_interrupt: | |||
| 197 | /* Save guest PC and MSR */ | 197 | /* Save guest PC and MSR */ |
| 198 | #ifdef CONFIG_PPC64 | 198 | #ifdef CONFIG_PPC64 |
| 199 | BEGIN_FTR_SECTION | 199 | BEGIN_FTR_SECTION |
| 200 | andi. r0,r12,0x2 | 200 | andi. r0, r12, 0x2 |
| 201 | cmpwi cr1, r0, 0 | ||
| 201 | beq 1f | 202 | beq 1f |
| 202 | mfspr r3,SPRN_HSRR0 | 203 | mfspr r3,SPRN_HSRR0 |
| 203 | mfspr r4,SPRN_HSRR1 | 204 | mfspr r4,SPRN_HSRR1 |
| @@ -250,6 +251,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) | |||
| 250 | beq ld_last_prev_inst | 251 | beq ld_last_prev_inst |
| 251 | cmpwi r12, BOOK3S_INTERRUPT_ALIGNMENT | 252 | cmpwi r12, BOOK3S_INTERRUPT_ALIGNMENT |
| 252 | beq- ld_last_inst | 253 | beq- ld_last_inst |
| 254 | #ifdef CONFIG_PPC64 | ||
| 255 | BEGIN_FTR_SECTION | ||
| 256 | cmpwi r12, BOOK3S_INTERRUPT_H_EMUL_ASSIST | ||
| 257 | beq- ld_last_inst | ||
| 258 | END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) | ||
| 259 | #endif | ||
| 253 | 260 | ||
| 254 | b no_ld_last_inst | 261 | b no_ld_last_inst |
| 255 | 262 | ||
| @@ -316,23 +323,17 @@ no_dcbz32_off: | |||
| 316 | * Having set up SRR0/1 with the address where we want | 323 | * Having set up SRR0/1 with the address where we want |
| 317 | * to continue with relocation on (potentially in module | 324 | * to continue with relocation on (potentially in module |
| 318 | * space), we either just go straight there with rfi[d], | 325 | * space), we either just go straight there with rfi[d], |
| 319 | * or we jump to an interrupt handler with bctr if there | 326 | * or we jump to an interrupt handler if there is an |
| 320 | * is an interrupt to be handled first. In the latter | 327 | * interrupt to be handled first. In the latter case, |
| 321 | * case, the rfi[d] at the end of the interrupt handler | 328 | * the rfi[d] at the end of the interrupt handler will |
| 322 | * will get us back to where we want to continue. | 329 | * get us back to where we want to continue. |
| 323 | */ | 330 | */ |
| 324 | 331 | ||
| 325 | cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL | ||
| 326 | beq 1f | ||
| 327 | cmpwi r12, BOOK3S_INTERRUPT_DECREMENTER | ||
| 328 | beq 1f | ||
| 329 | cmpwi r12, BOOK3S_INTERRUPT_PERFMON | ||
| 330 | 1: mtctr r12 | ||
| 331 | |||
| 332 | /* Register usage at this point: | 332 | /* Register usage at this point: |
| 333 | * | 333 | * |
| 334 | * R1 = host R1 | 334 | * R1 = host R1 |
| 335 | * R2 = host R2 | 335 | * R2 = host R2 |
| 336 | * R10 = raw exit handler id | ||
| 336 | * R12 = exit handler id | 337 | * R12 = exit handler id |
| 337 | * R13 = shadow vcpu (32-bit) or PACA (64-bit) | 338 | * R13 = shadow vcpu (32-bit) or PACA (64-bit) |
| 338 | * SVCPU.* = guest * | 339 | * SVCPU.* = guest * |
| @@ -342,12 +343,25 @@ no_dcbz32_off: | |||
| 342 | PPC_LL r6, HSTATE_HOST_MSR(r13) | 343 | PPC_LL r6, HSTATE_HOST_MSR(r13) |
| 343 | PPC_LL r8, HSTATE_VMHANDLER(r13) | 344 | PPC_LL r8, HSTATE_VMHANDLER(r13) |
| 344 | 345 | ||
| 345 | /* Restore host msr -> SRR1 */ | 346 | #ifdef CONFIG_PPC64 |
| 347 | BEGIN_FTR_SECTION | ||
| 348 | beq cr1, 1f | ||
| 349 | mtspr SPRN_HSRR1, r6 | ||
| 350 | mtspr SPRN_HSRR0, r8 | ||
| 351 | END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) | ||
| 352 | #endif | ||
| 353 | 1: /* Restore host msr -> SRR1 */ | ||
| 346 | mtsrr1 r6 | 354 | mtsrr1 r6 |
| 347 | /* Load highmem handler address */ | 355 | /* Load highmem handler address */ |
| 348 | mtsrr0 r8 | 356 | mtsrr0 r8 |
| 349 | 357 | ||
| 350 | /* RFI into the highmem handler, or jump to interrupt handler */ | 358 | /* RFI into the highmem handler, or jump to interrupt handler */ |
| 351 | beqctr | 359 | cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL |
| 360 | beqa BOOK3S_INTERRUPT_EXTERNAL | ||
| 361 | cmpwi r12, BOOK3S_INTERRUPT_DECREMENTER | ||
| 362 | beqa BOOK3S_INTERRUPT_DECREMENTER | ||
| 363 | cmpwi r12, BOOK3S_INTERRUPT_PERFMON | ||
| 364 | beqa BOOK3S_INTERRUPT_PERFMON | ||
| 365 | |||
| 352 | RFI | 366 | RFI |
| 353 | kvmppc_handler_trampoline_exit_end: | 367 | kvmppc_handler_trampoline_exit_end: |
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h index af1ab5e9a691..5c3cf2d04e41 100644 --- a/arch/powerpc/net/bpf_jit.h +++ b/arch/powerpc/net/bpf_jit.h | |||
| @@ -48,7 +48,13 @@ | |||
| 48 | /* | 48 | /* |
| 49 | * Assembly helpers from arch/powerpc/net/bpf_jit.S: | 49 | * Assembly helpers from arch/powerpc/net/bpf_jit.S: |
| 50 | */ | 50 | */ |
| 51 | extern u8 sk_load_word[], sk_load_half[], sk_load_byte[], sk_load_byte_msh[]; | 51 | #define DECLARE_LOAD_FUNC(func) \ |
| 52 | extern u8 func[], func##_negative_offset[], func##_positive_offset[] | ||
| 53 | |||
| 54 | DECLARE_LOAD_FUNC(sk_load_word); | ||
| 55 | DECLARE_LOAD_FUNC(sk_load_half); | ||
| 56 | DECLARE_LOAD_FUNC(sk_load_byte); | ||
| 57 | DECLARE_LOAD_FUNC(sk_load_byte_msh); | ||
| 52 | 58 | ||
| 53 | #define FUNCTION_DESCR_SIZE 24 | 59 | #define FUNCTION_DESCR_SIZE 24 |
| 54 | 60 | ||
diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_64.S index ff4506e85cce..55ba3855a97f 100644 --- a/arch/powerpc/net/bpf_jit_64.S +++ b/arch/powerpc/net/bpf_jit_64.S | |||
| @@ -31,14 +31,13 @@ | |||
| 31 | * then branch directly to slow_path_XXX if required. (In fact, could | 31 | * then branch directly to slow_path_XXX if required. (In fact, could |
| 32 | * load a spare GPR with the address of slow_path_generic and pass size | 32 | * load a spare GPR with the address of slow_path_generic and pass size |
| 33 | * as an argument, making the call site a mtlr, li and bllr.) | 33 | * as an argument, making the call site a mtlr, li and bllr.) |
| 34 | * | ||
| 35 | * Technically, the "is addr < 0" check is unnecessary & slowing down | ||
| 36 | * the ABS path, as it's statically checked on generation. | ||
| 37 | */ | 34 | */ |
| 38 | .globl sk_load_word | 35 | .globl sk_load_word |
| 39 | sk_load_word: | 36 | sk_load_word: |
| 40 | cmpdi r_addr, 0 | 37 | cmpdi r_addr, 0 |
| 41 | blt bpf_error | 38 | blt bpf_slow_path_word_neg |
| 39 | .globl sk_load_word_positive_offset | ||
| 40 | sk_load_word_positive_offset: | ||
| 42 | /* Are we accessing past headlen? */ | 41 | /* Are we accessing past headlen? */ |
| 43 | subi r_scratch1, r_HL, 4 | 42 | subi r_scratch1, r_HL, 4 |
| 44 | cmpd r_scratch1, r_addr | 43 | cmpd r_scratch1, r_addr |
| @@ -51,7 +50,9 @@ sk_load_word: | |||
| 51 | .globl sk_load_half | 50 | .globl sk_load_half |
| 52 | sk_load_half: | 51 | sk_load_half: |
| 53 | cmpdi r_addr, 0 | 52 | cmpdi r_addr, 0 |
| 54 | blt bpf_error | 53 | blt bpf_slow_path_half_neg |
| 54 | .globl sk_load_half_positive_offset | ||
| 55 | sk_load_half_positive_offset: | ||
| 55 | subi r_scratch1, r_HL, 2 | 56 | subi r_scratch1, r_HL, 2 |
| 56 | cmpd r_scratch1, r_addr | 57 | cmpd r_scratch1, r_addr |
| 57 | blt bpf_slow_path_half | 58 | blt bpf_slow_path_half |
| @@ -61,7 +62,9 @@ sk_load_half: | |||
| 61 | .globl sk_load_byte | 62 | .globl sk_load_byte |
| 62 | sk_load_byte: | 63 | sk_load_byte: |
| 63 | cmpdi r_addr, 0 | 64 | cmpdi r_addr, 0 |
| 64 | blt bpf_error | 65 | blt bpf_slow_path_byte_neg |
| 66 | .globl sk_load_byte_positive_offset | ||
| 67 | sk_load_byte_positive_offset: | ||
| 65 | cmpd r_HL, r_addr | 68 | cmpd r_HL, r_addr |
| 66 | ble bpf_slow_path_byte | 69 | ble bpf_slow_path_byte |
| 67 | lbzx r_A, r_D, r_addr | 70 | lbzx r_A, r_D, r_addr |
| @@ -69,22 +72,20 @@ sk_load_byte: | |||
| 69 | 72 | ||
| 70 | /* | 73 | /* |
| 71 | * BPF_S_LDX_B_MSH: ldxb 4*([offset]&0xf) | 74 | * BPF_S_LDX_B_MSH: ldxb 4*([offset]&0xf) |
| 72 | * r_addr is the offset value, already known positive | 75 | * r_addr is the offset value |
| 73 | */ | 76 | */ |
| 74 | .globl sk_load_byte_msh | 77 | .globl sk_load_byte_msh |
| 75 | sk_load_byte_msh: | 78 | sk_load_byte_msh: |
| 79 | cmpdi r_addr, 0 | ||
| 80 | blt bpf_slow_path_byte_msh_neg | ||
| 81 | .globl sk_load_byte_msh_positive_offset | ||
| 82 | sk_load_byte_msh_positive_offset: | ||
| 76 | cmpd r_HL, r_addr | 83 | cmpd r_HL, r_addr |
| 77 | ble bpf_slow_path_byte_msh | 84 | ble bpf_slow_path_byte_msh |
| 78 | lbzx r_X, r_D, r_addr | 85 | lbzx r_X, r_D, r_addr |
| 79 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 | 86 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 |
| 80 | blr | 87 | blr |
| 81 | 88 | ||
| 82 | bpf_error: | ||
| 83 | /* Entered with cr0 = lt */ | ||
| 84 | li r3, 0 | ||
| 85 | /* Generated code will 'blt epilogue', returning 0. */ | ||
| 86 | blr | ||
| 87 | |||
| 88 | /* Call out to skb_copy_bits: | 89 | /* Call out to skb_copy_bits: |
| 89 | * We'll need to back up our volatile regs first; we have | 90 | * We'll need to back up our volatile regs first; we have |
| 90 | * local variable space at r1+(BPF_PPC_STACK_BASIC). | 91 | * local variable space at r1+(BPF_PPC_STACK_BASIC). |
| @@ -136,3 +137,84 @@ bpf_slow_path_byte_msh: | |||
| 136 | lbz r_X, BPF_PPC_STACK_BASIC+(2*8)(r1) | 137 | lbz r_X, BPF_PPC_STACK_BASIC+(2*8)(r1) |
| 137 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 | 138 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 |
| 138 | blr | 139 | blr |
| 140 | |||
| 141 | /* Call out to bpf_internal_load_pointer_neg_helper: | ||
| 142 | * We'll need to back up our volatile regs first; we have | ||
| 143 | * local variable space at r1+(BPF_PPC_STACK_BASIC). | ||
| 144 | * Allocate a new stack frame here to remain ABI-compliant in | ||
| 145 | * stashing LR. | ||
| 146 | */ | ||
| 147 | #define sk_negative_common(SIZE) \ | ||
| 148 | mflr r0; \ | ||
| 149 | std r0, 16(r1); \ | ||
| 150 | /* R3 goes in parameter space of caller's frame */ \ | ||
| 151 | std r_skb, (BPF_PPC_STACKFRAME+48)(r1); \ | ||
| 152 | std r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \ | ||
| 153 | std r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \ | ||
| 154 | stdu r1, -BPF_PPC_SLOWPATH_FRAME(r1); \ | ||
| 155 | /* R3 = r_skb, as passed */ \ | ||
| 156 | mr r4, r_addr; \ | ||
| 157 | li r5, SIZE; \ | ||
| 158 | bl bpf_internal_load_pointer_neg_helper; \ | ||
| 159 | /* R3 != 0 on success */ \ | ||
| 160 | addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ | ||
| 161 | ld r0, 16(r1); \ | ||
| 162 | ld r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \ | ||
| 163 | ld r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \ | ||
| 164 | mtlr r0; \ | ||
| 165 | cmpldi r3, 0; \ | ||
| 166 | beq bpf_error_slow; /* cr0 = EQ */ \ | ||
| 167 | mr r_addr, r3; \ | ||
| 168 | ld r_skb, (BPF_PPC_STACKFRAME+48)(r1); \ | ||
| 169 | /* Great success! */ | ||
| 170 | |||
| 171 | bpf_slow_path_word_neg: | ||
| 172 | lis r_scratch1,-32 /* SKF_LL_OFF */ | ||
| 173 | cmpd r_addr, r_scratch1 /* addr < SKF_* */ | ||
| 174 | blt bpf_error /* cr0 = LT */ | ||
| 175 | .globl sk_load_word_negative_offset | ||
| 176 | sk_load_word_negative_offset: | ||
| 177 | sk_negative_common(4) | ||
| 178 | lwz r_A, 0(r_addr) | ||
| 179 | blr | ||
| 180 | |||
| 181 | bpf_slow_path_half_neg: | ||
| 182 | lis r_scratch1,-32 /* SKF_LL_OFF */ | ||
| 183 | cmpd r_addr, r_scratch1 /* addr < SKF_* */ | ||
| 184 | blt bpf_error /* cr0 = LT */ | ||
| 185 | .globl sk_load_half_negative_offset | ||
| 186 | sk_load_half_negative_offset: | ||
| 187 | sk_negative_common(2) | ||
| 188 | lhz r_A, 0(r_addr) | ||
| 189 | blr | ||
| 190 | |||
| 191 | bpf_slow_path_byte_neg: | ||
| 192 | lis r_scratch1,-32 /* SKF_LL_OFF */ | ||
| 193 | cmpd r_addr, r_scratch1 /* addr < SKF_* */ | ||
| 194 | blt bpf_error /* cr0 = LT */ | ||
| 195 | .globl sk_load_byte_negative_offset | ||
| 196 | sk_load_byte_negative_offset: | ||
| 197 | sk_negative_common(1) | ||
| 198 | lbz r_A, 0(r_addr) | ||
| 199 | blr | ||
| 200 | |||
| 201 | bpf_slow_path_byte_msh_neg: | ||
| 202 | lis r_scratch1,-32 /* SKF_LL_OFF */ | ||
| 203 | cmpd r_addr, r_scratch1 /* addr < SKF_* */ | ||
| 204 | blt bpf_error /* cr0 = LT */ | ||
| 205 | .globl sk_load_byte_msh_negative_offset | ||
| 206 | sk_load_byte_msh_negative_offset: | ||
| 207 | sk_negative_common(1) | ||
| 208 | lbz r_X, 0(r_addr) | ||
| 209 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 | ||
| 210 | blr | ||
| 211 | |||
| 212 | bpf_error_slow: | ||
| 213 | /* fabricate a cr0 = lt */ | ||
| 214 | li r_scratch1, -1 | ||
| 215 | cmpdi r_scratch1, 0 | ||
| 216 | bpf_error: | ||
| 217 | /* Entered with cr0 = lt */ | ||
| 218 | li r3, 0 | ||
| 219 | /* Generated code will 'blt epilogue', returning 0. */ | ||
| 220 | blr | ||
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index 73619d3aeb6c..2dc8b1484845 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c | |||
| @@ -127,6 +127,9 @@ static void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx) | |||
| 127 | PPC_BLR(); | 127 | PPC_BLR(); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | #define CHOOSE_LOAD_FUNC(K, func) \ | ||
| 131 | ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset) | ||
| 132 | |||
| 130 | /* Assemble the body code between the prologue & epilogue. */ | 133 | /* Assemble the body code between the prologue & epilogue. */ |
| 131 | static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | 134 | static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, |
| 132 | struct codegen_context *ctx, | 135 | struct codegen_context *ctx, |
| @@ -391,21 +394,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | |||
| 391 | 394 | ||
| 392 | /*** Absolute loads from packet header/data ***/ | 395 | /*** Absolute loads from packet header/data ***/ |
| 393 | case BPF_S_LD_W_ABS: | 396 | case BPF_S_LD_W_ABS: |
| 394 | func = sk_load_word; | 397 | func = CHOOSE_LOAD_FUNC(K, sk_load_word); |
| 395 | goto common_load; | 398 | goto common_load; |
| 396 | case BPF_S_LD_H_ABS: | 399 | case BPF_S_LD_H_ABS: |
| 397 | func = sk_load_half; | 400 | func = CHOOSE_LOAD_FUNC(K, sk_load_half); |
| 398 | goto common_load; | 401 | goto common_load; |
| 399 | case BPF_S_LD_B_ABS: | 402 | case BPF_S_LD_B_ABS: |
| 400 | func = sk_load_byte; | 403 | func = CHOOSE_LOAD_FUNC(K, sk_load_byte); |
| 401 | common_load: | 404 | common_load: |
| 402 | /* | 405 | /* Load from [K]. */ |
| 403 | * Load from [K]. Reference with the (negative) | ||
| 404 | * SKF_NET_OFF/SKF_LL_OFF offsets is unsupported. | ||
| 405 | */ | ||
| 406 | ctx->seen |= SEEN_DATAREF; | 406 | ctx->seen |= SEEN_DATAREF; |
| 407 | if ((int)K < 0) | ||
| 408 | return -ENOTSUPP; | ||
| 409 | PPC_LI64(r_scratch1, func); | 407 | PPC_LI64(r_scratch1, func); |
| 410 | PPC_MTLR(r_scratch1); | 408 | PPC_MTLR(r_scratch1); |
| 411 | PPC_LI32(r_addr, K); | 409 | PPC_LI32(r_addr, K); |
| @@ -429,7 +427,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | |||
| 429 | common_load_ind: | 427 | common_load_ind: |
| 430 | /* | 428 | /* |
| 431 | * Load from [X + K]. Negative offsets are tested for | 429 | * Load from [X + K]. Negative offsets are tested for |
| 432 | * in the helper functions, and result in a 'ret 0'. | 430 | * in the helper functions. |
| 433 | */ | 431 | */ |
| 434 | ctx->seen |= SEEN_DATAREF | SEEN_XREG; | 432 | ctx->seen |= SEEN_DATAREF | SEEN_XREG; |
| 435 | PPC_LI64(r_scratch1, func); | 433 | PPC_LI64(r_scratch1, func); |
| @@ -443,13 +441,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | |||
| 443 | break; | 441 | break; |
| 444 | 442 | ||
| 445 | case BPF_S_LDX_B_MSH: | 443 | case BPF_S_LDX_B_MSH: |
| 446 | /* | 444 | func = CHOOSE_LOAD_FUNC(K, sk_load_byte_msh); |
| 447 | * x86 version drops packet (RET 0) when K<0, whereas | ||
| 448 | * interpreter does allow K<0 (__load_pointer, special | ||
| 449 | * ancillary data). common_load returns ENOTSUPP if K<0, | ||
| 450 | * so we fall back to interpreter & filter works. | ||
| 451 | */ | ||
| 452 | func = sk_load_byte_msh; | ||
| 453 | goto common_load; | 445 | goto common_load; |
| 454 | break; | 446 | break; |
| 455 | 447 | ||
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index d09f3e8e6867..85825b5401e5 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c | |||
| @@ -114,7 +114,7 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc) | |||
| 114 | pr_devel("axon_msi: woff %x roff %x msi %x\n", | 114 | pr_devel("axon_msi: woff %x roff %x msi %x\n", |
| 115 | write_offset, msic->read_offset, msi); | 115 | write_offset, msic->read_offset, msi); |
| 116 | 116 | ||
| 117 | if (msi < NR_IRQS && irq_get_chip_data(msi) == msic) { | 117 | if (msi < nr_irqs && irq_get_chip_data(msi) == msic) { |
| 118 | generic_handle_irq(msi); | 118 | generic_handle_irq(msi); |
| 119 | msic->fifo_virt[idx] = cpu_to_le32(0xffffffff); | 119 | msic->fifo_virt[idx] = cpu_to_le32(0xffffffff); |
| 120 | } else { | 120 | } else { |
| @@ -276,9 +276,6 @@ static int axon_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | |||
| 276 | if (rc) | 276 | if (rc) |
| 277 | return rc; | 277 | return rc; |
| 278 | 278 | ||
| 279 | /* We rely on being able to stash a virq in a u16 */ | ||
| 280 | BUILD_BUG_ON(NR_IRQS > 65536); | ||
| 281 | |||
| 282 | list_for_each_entry(entry, &dev->msi_list, list) { | 279 | list_for_each_entry(entry, &dev->msi_list, list) { |
| 283 | virq = irq_create_direct_mapping(msic->irq_domain); | 280 | virq = irq_create_direct_mapping(msic->irq_domain); |
| 284 | if (virq == NO_IRQ) { | 281 | if (virq == NO_IRQ) { |
| @@ -392,7 +389,8 @@ static int axon_msi_probe(struct platform_device *device) | |||
| 392 | } | 389 | } |
| 393 | memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); | 390 | memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); |
| 394 | 391 | ||
| 395 | msic->irq_domain = irq_domain_add_nomap(dn, 0, &msic_host_ops, msic); | 392 | /* We rely on being able to stash a virq in a u16, so limit irqs to < 65536 */ |
| 393 | msic->irq_domain = irq_domain_add_nomap(dn, 65536, &msic_host_ops, msic); | ||
| 396 | if (!msic->irq_domain) { | 394 | if (!msic->irq_domain) { |
| 397 | printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n", | 395 | printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n", |
| 398 | dn->full_name); | 396 | dn->full_name); |
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c index f9a48af335cb..8c6dc42ecf65 100644 --- a/arch/powerpc/platforms/cell/beat_interrupt.c +++ b/arch/powerpc/platforms/cell/beat_interrupt.c | |||
| @@ -248,6 +248,6 @@ void beatic_deinit_IRQ(void) | |||
| 248 | { | 248 | { |
| 249 | int i; | 249 | int i; |
| 250 | 250 | ||
| 251 | for (i = 1; i < NR_IRQS; i++) | 251 | for (i = 1; i < nr_irqs; i++) |
| 252 | beat_destruct_irq_plug(i); | 252 | beat_destruct_irq_plug(i); |
| 253 | } | 253 | } |
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index 66ad93de1d55..c4e630576ff2 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c | |||
| @@ -57,9 +57,9 @@ static int max_real_irqs; | |||
| 57 | 57 | ||
| 58 | static DEFINE_RAW_SPINLOCK(pmac_pic_lock); | 58 | static DEFINE_RAW_SPINLOCK(pmac_pic_lock); |
| 59 | 59 | ||
| 60 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 60 | /* The max irq number this driver deals with is 128; see max_irqs */ |
| 61 | static unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; | 61 | static DECLARE_BITMAP(ppc_lost_interrupts, 128); |
| 62 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | 62 | static DECLARE_BITMAP(ppc_cached_irq_mask, 128); |
| 63 | static int pmac_irq_cascade = -1; | 63 | static int pmac_irq_cascade = -1; |
| 64 | static struct irq_domain *pmac_pic_host; | 64 | static struct irq_domain *pmac_pic_host; |
| 65 | 65 | ||
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index aadbe4f6d537..178a5f300bc9 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig | |||
| @@ -30,9 +30,9 @@ config PPC_SPLPAR | |||
| 30 | two or more partitions. | 30 | two or more partitions. |
| 31 | 31 | ||
| 32 | config EEH | 32 | config EEH |
| 33 | bool "PCI Extended Error Handling (EEH)" if EXPERT | 33 | bool |
| 34 | depends on PPC_PSERIES && PCI | 34 | depends on PPC_PSERIES && PCI |
| 35 | default y if !EXPERT | 35 | default y |
| 36 | 36 | ||
| 37 | config PSERIES_MSI | 37 | config PSERIES_MSI |
| 38 | bool | 38 | bool |
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c index d3be961e2ae7..10386b676d87 100644 --- a/arch/powerpc/sysdev/cpm2_pic.c +++ b/arch/powerpc/sysdev/cpm2_pic.c | |||
| @@ -51,8 +51,7 @@ | |||
| 51 | static intctl_cpm2_t __iomem *cpm2_intctl; | 51 | static intctl_cpm2_t __iomem *cpm2_intctl; |
| 52 | 52 | ||
| 53 | static struct irq_domain *cpm2_pic_host; | 53 | static struct irq_domain *cpm2_pic_host; |
| 54 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 54 | static unsigned long ppc_cached_irq_mask[2]; /* 2 32-bit registers */ |
| 55 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | ||
| 56 | 55 | ||
| 57 | static const u_char irq_to_siureg[] = { | 56 | static const u_char irq_to_siureg[] = { |
| 58 | 1, 1, 1, 1, 1, 1, 1, 1, | 57 | 1, 1, 1, 1, 1, 1, 1, 1, |
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c index d5f5416be310..b724622c3a0b 100644 --- a/arch/powerpc/sysdev/mpc8xx_pic.c +++ b/arch/powerpc/sysdev/mpc8xx_pic.c | |||
| @@ -18,69 +18,45 @@ | |||
| 18 | extern int cpm_get_irq(struct pt_regs *regs); | 18 | extern int cpm_get_irq(struct pt_regs *regs); |
| 19 | 19 | ||
| 20 | static struct irq_domain *mpc8xx_pic_host; | 20 | static struct irq_domain *mpc8xx_pic_host; |
| 21 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 21 | static unsigned long mpc8xx_cached_irq_mask; |
| 22 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | ||
| 23 | static sysconf8xx_t __iomem *siu_reg; | 22 | static sysconf8xx_t __iomem *siu_reg; |
| 24 | 23 | ||
| 25 | int cpm_get_irq(struct pt_regs *regs); | 24 | static inline unsigned long mpc8xx_irqd_to_bit(struct irq_data *d) |
| 25 | { | ||
| 26 | return 0x80000000 >> irqd_to_hwirq(d); | ||
| 27 | } | ||
| 26 | 28 | ||
| 27 | static void mpc8xx_unmask_irq(struct irq_data *d) | 29 | static void mpc8xx_unmask_irq(struct irq_data *d) |
| 28 | { | 30 | { |
| 29 | int bit, word; | 31 | mpc8xx_cached_irq_mask |= mpc8xx_irqd_to_bit(d); |
| 30 | unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); | 32 | out_be32(&siu_reg->sc_simask, mpc8xx_cached_irq_mask); |
| 31 | |||
| 32 | bit = irq_nr & 0x1f; | ||
| 33 | word = irq_nr >> 5; | ||
| 34 | |||
| 35 | ppc_cached_irq_mask[word] |= (1 << (31-bit)); | ||
| 36 | out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]); | ||
| 37 | } | 33 | } |
| 38 | 34 | ||
| 39 | static void mpc8xx_mask_irq(struct irq_data *d) | 35 | static void mpc8xx_mask_irq(struct irq_data *d) |
| 40 | { | 36 | { |
| 41 | int bit, word; | 37 | mpc8xx_cached_irq_mask &= ~mpc8xx_irqd_to_bit(d); |
| 42 | unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); | 38 | out_be32(&siu_reg->sc_simask, mpc8xx_cached_irq_mask); |
| 43 | |||
| 44 | bit = irq_nr & 0x1f; | ||
| 45 | word = irq_nr >> 5; | ||
| 46 | |||
| 47 | ppc_cached_irq_mask[word] &= ~(1 << (31-bit)); | ||
| 48 | out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]); | ||
| 49 | } | 39 | } |
| 50 | 40 | ||
| 51 | static void mpc8xx_ack(struct irq_data *d) | 41 | static void mpc8xx_ack(struct irq_data *d) |
| 52 | { | 42 | { |
| 53 | int bit; | 43 | out_be32(&siu_reg->sc_sipend, mpc8xx_irqd_to_bit(d)); |
| 54 | unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); | ||
| 55 | |||
| 56 | bit = irq_nr & 0x1f; | ||
| 57 | out_be32(&siu_reg->sc_sipend, 1 << (31-bit)); | ||
| 58 | } | 44 | } |
| 59 | 45 | ||
| 60 | static void mpc8xx_end_irq(struct irq_data *d) | 46 | static void mpc8xx_end_irq(struct irq_data *d) |
| 61 | { | 47 | { |
| 62 | int bit, word; | 48 | mpc8xx_cached_irq_mask |= mpc8xx_irqd_to_bit(d); |
| 63 | unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); | 49 | out_be32(&siu_reg->sc_simask, mpc8xx_cached_irq_mask); |
| 64 | |||
| 65 | bit = irq_nr & 0x1f; | ||
| 66 | word = irq_nr >> 5; | ||
| 67 | |||
| 68 | ppc_cached_irq_mask[word] |= (1 << (31-bit)); | ||
| 69 | out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]); | ||
| 70 | } | 50 | } |
| 71 | 51 | ||
| 72 | static int mpc8xx_set_irq_type(struct irq_data *d, unsigned int flow_type) | 52 | static int mpc8xx_set_irq_type(struct irq_data *d, unsigned int flow_type) |
| 73 | { | 53 | { |
| 74 | if (flow_type & IRQ_TYPE_EDGE_FALLING) { | 54 | /* only external IRQ senses are programmable */ |
| 75 | irq_hw_number_t hw = (unsigned int)irqd_to_hwirq(d); | 55 | if ((flow_type & IRQ_TYPE_EDGE_FALLING) && !(irqd_to_hwirq(d) & 1)) { |
| 76 | unsigned int siel = in_be32(&siu_reg->sc_siel); | 56 | unsigned int siel = in_be32(&siu_reg->sc_siel); |
| 77 | 57 | siel |= mpc8xx_irqd_to_bit(d); | |
| 78 | /* only external IRQ senses are programmable */ | 58 | out_be32(&siu_reg->sc_siel, siel); |
| 79 | if ((hw & 1) == 0) { | 59 | __irq_set_handler_locked(d->irq, handle_edge_irq); |
| 80 | siel |= (0x80000000 >> hw); | ||
| 81 | out_be32(&siu_reg->sc_siel, siel); | ||
| 82 | __irq_set_handler_locked(d->irq, handle_edge_irq); | ||
| 83 | } | ||
| 84 | } | 60 | } |
| 85 | return 0; | 61 | return 0; |
| 86 | } | 62 | } |
| @@ -132,6 +108,9 @@ static int mpc8xx_pic_host_xlate(struct irq_domain *h, struct device_node *ct, | |||
| 132 | IRQ_TYPE_EDGE_FALLING, | 108 | IRQ_TYPE_EDGE_FALLING, |
| 133 | }; | 109 | }; |
| 134 | 110 | ||
| 111 | if (intspec[0] > 0x1f) | ||
| 112 | return 0; | ||
| 113 | |||
| 135 | *out_hwirq = intspec[0]; | 114 | *out_hwirq = intspec[0]; |
| 136 | if (intsize > 1 && intspec[1] < 4) | 115 | if (intsize > 1 && intspec[1] < 4) |
| 137 | *out_flags = map_pic_senses[intspec[1]]; | 116 | *out_flags = map_pic_senses[intspec[1]]; |
diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c index ea5e204e3450..cd1d18db92c6 100644 --- a/arch/powerpc/sysdev/xics/xics-common.c +++ b/arch/powerpc/sysdev/xics/xics-common.c | |||
| @@ -188,6 +188,7 @@ void xics_migrate_irqs_away(void) | |||
| 188 | { | 188 | { |
| 189 | int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id(); | 189 | int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id(); |
| 190 | unsigned int irq, virq; | 190 | unsigned int irq, virq; |
| 191 | struct irq_desc *desc; | ||
| 191 | 192 | ||
| 192 | /* If we used to be the default server, move to the new "boot_cpuid" */ | 193 | /* If we used to be the default server, move to the new "boot_cpuid" */ |
| 193 | if (hw_cpu == xics_default_server) | 194 | if (hw_cpu == xics_default_server) |
| @@ -202,8 +203,7 @@ void xics_migrate_irqs_away(void) | |||
| 202 | /* Allow IPIs again... */ | 203 | /* Allow IPIs again... */ |
| 203 | icp_ops->set_priority(DEFAULT_PRIORITY); | 204 | icp_ops->set_priority(DEFAULT_PRIORITY); |
| 204 | 205 | ||
| 205 | for_each_irq(virq) { | 206 | for_each_irq_desc(virq, desc) { |
| 206 | struct irq_desc *desc; | ||
| 207 | struct irq_chip *chip; | 207 | struct irq_chip *chip; |
| 208 | long server; | 208 | long server; |
| 209 | unsigned long flags; | 209 | unsigned long flags; |
| @@ -212,9 +212,8 @@ void xics_migrate_irqs_away(void) | |||
| 212 | /* We can't set affinity on ISA interrupts */ | 212 | /* We can't set affinity on ISA interrupts */ |
| 213 | if (virq < NUM_ISA_INTERRUPTS) | 213 | if (virq < NUM_ISA_INTERRUPTS) |
| 214 | continue; | 214 | continue; |
| 215 | desc = irq_to_desc(virq); | ||
| 216 | /* We only need to migrate enabled IRQS */ | 215 | /* We only need to migrate enabled IRQS */ |
| 217 | if (!desc || !desc->action) | 216 | if (!desc->action) |
| 218 | continue; | 217 | continue; |
| 219 | if (desc->irq_data.domain != xics_host) | 218 | if (desc->irq_data.domain != xics_host) |
| 220 | continue; | 219 | continue; |
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c index 38d48a59879c..9708851a8b9f 100644 --- a/arch/sparc/kernel/central.c +++ b/arch/sparc/kernel/central.c | |||
| @@ -269,4 +269,4 @@ static int __init sunfire_init(void) | |||
| 269 | return 0; | 269 | return 0; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | subsys_initcall(sunfire_init); | 272 | fs_initcall(sunfire_init); |
diff --git a/arch/sparc/mm/ultra.S b/arch/sparc/mm/ultra.S index b57a5942ba64..874162a11ceb 100644 --- a/arch/sparc/mm/ultra.S +++ b/arch/sparc/mm/ultra.S | |||
| @@ -495,11 +495,11 @@ xcall_fetch_glob_regs: | |||
| 495 | stx %o7, [%g1 + GR_SNAP_O7] | 495 | stx %o7, [%g1 + GR_SNAP_O7] |
| 496 | stx %i7, [%g1 + GR_SNAP_I7] | 496 | stx %i7, [%g1 + GR_SNAP_I7] |
| 497 | /* Don't try this at home kids... */ | 497 | /* Don't try this at home kids... */ |
| 498 | rdpr %cwp, %g2 | 498 | rdpr %cwp, %g3 |
| 499 | sub %g2, 1, %g7 | 499 | sub %g3, 1, %g7 |
| 500 | wrpr %g7, %cwp | 500 | wrpr %g7, %cwp |
| 501 | mov %i7, %g7 | 501 | mov %i7, %g7 |
| 502 | wrpr %g2, %cwp | 502 | wrpr %g3, %cwp |
| 503 | stx %g7, [%g1 + GR_SNAP_RPC] | 503 | stx %g7, [%g1 + GR_SNAP_RPC] |
| 504 | sethi %hi(trap_block), %g7 | 504 | sethi %hi(trap_block), %g7 |
| 505 | or %g7, %lo(trap_block), %g7 | 505 | or %g7, %lo(trap_block), %g7 |
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index 96033e2d6845..74239dd77e06 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
| @@ -11,6 +11,7 @@ config TILE | |||
| 11 | select GENERIC_IRQ_PROBE | 11 | select GENERIC_IRQ_PROBE |
| 12 | select GENERIC_PENDING_IRQ if SMP | 12 | select GENERIC_PENDING_IRQ if SMP |
| 13 | select GENERIC_IRQ_SHOW | 13 | select GENERIC_IRQ_SHOW |
| 14 | select HAVE_SYSCALL_WRAPPERS if TILEGX | ||
| 14 | select SYS_HYPERVISOR | 15 | select SYS_HYPERVISOR |
| 15 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 16 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
| 16 | 17 | ||
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h index bc4f562bd459..7594764d8a69 100644 --- a/arch/tile/include/asm/thread_info.h +++ b/arch/tile/include/asm/thread_info.h | |||
| @@ -100,9 +100,14 @@ extern void cpu_idle_on_new_stack(struct thread_info *old_ti, | |||
| 100 | 100 | ||
| 101 | #else /* __ASSEMBLY__ */ | 101 | #else /* __ASSEMBLY__ */ |
| 102 | 102 | ||
| 103 | /* how to get the thread information struct from ASM */ | 103 | /* |
| 104 | * How to get the thread information struct from assembly. | ||
| 105 | * Note that we use different macros since different architectures | ||
| 106 | * have different semantics in their "mm" instruction and we would | ||
| 107 | * like to guarantee that the macro expands to exactly one instruction. | ||
| 108 | */ | ||
| 104 | #ifdef __tilegx__ | 109 | #ifdef __tilegx__ |
| 105 | #define GET_THREAD_INFO(reg) move reg, sp; mm reg, zero, LOG2_THREAD_SIZE, 63 | 110 | #define EXTRACT_THREAD_INFO(reg) mm reg, zero, LOG2_THREAD_SIZE, 63 |
| 106 | #else | 111 | #else |
| 107 | #define GET_THREAD_INFO(reg) mm reg, sp, zero, LOG2_THREAD_SIZE, 31 | 112 | #define GET_THREAD_INFO(reg) mm reg, sp, zero, LOG2_THREAD_SIZE, 31 |
| 108 | #endif | 113 | #endif |
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index 77763ccd5a7d..cdef6e5ec022 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c | |||
| @@ -403,19 +403,17 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
| 403 | * Set up registers for signal handler. | 403 | * Set up registers for signal handler. |
| 404 | * Registers that we don't modify keep the value they had from | 404 | * Registers that we don't modify keep the value they had from |
| 405 | * user-space at the time we took the signal. | 405 | * user-space at the time we took the signal. |
| 406 | * We always pass siginfo and mcontext, regardless of SA_SIGINFO, | ||
| 407 | * since some things rely on this (e.g. glibc's debug/segfault.c). | ||
| 406 | */ | 408 | */ |
| 407 | regs->pc = ptr_to_compat_reg(ka->sa.sa_handler); | 409 | regs->pc = ptr_to_compat_reg(ka->sa.sa_handler); |
| 408 | regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */ | 410 | regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */ |
| 409 | regs->sp = ptr_to_compat_reg(frame); | 411 | regs->sp = ptr_to_compat_reg(frame); |
| 410 | regs->lr = restorer; | 412 | regs->lr = restorer; |
| 411 | regs->regs[0] = (unsigned long) usig; | 413 | regs->regs[0] = (unsigned long) usig; |
| 412 | 414 | regs->regs[1] = ptr_to_compat_reg(&frame->info); | |
| 413 | if (ka->sa.sa_flags & SA_SIGINFO) { | 415 | regs->regs[2] = ptr_to_compat_reg(&frame->uc); |
| 414 | /* Need extra arguments, so mark to restore caller-saves. */ | 416 | regs->flags |= PT_FLAGS_CALLER_SAVES; |
| 415 | regs->regs[1] = ptr_to_compat_reg(&frame->info); | ||
| 416 | regs->regs[2] = ptr_to_compat_reg(&frame->uc); | ||
| 417 | regs->flags |= PT_FLAGS_CALLER_SAVES; | ||
| 418 | } | ||
| 419 | 417 | ||
| 420 | /* | 418 | /* |
| 421 | * Notify any tracer that was single-stepping it. | 419 | * Notify any tracer that was single-stepping it. |
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S index 5d56a1ef5ba5..6943515100f8 100644 --- a/arch/tile/kernel/intvec_32.S +++ b/arch/tile/kernel/intvec_32.S | |||
| @@ -839,6 +839,18 @@ STD_ENTRY(interrupt_return) | |||
| 839 | FEEDBACK_REENTER(interrupt_return) | 839 | FEEDBACK_REENTER(interrupt_return) |
| 840 | 840 | ||
| 841 | /* | 841 | /* |
| 842 | * Use r33 to hold whether we have already loaded the callee-saves | ||
| 843 | * into ptregs. We don't want to do it twice in this loop, since | ||
| 844 | * then we'd clobber whatever changes are made by ptrace, etc. | ||
| 845 | * Get base of stack in r32. | ||
| 846 | */ | ||
| 847 | { | ||
| 848 | GET_THREAD_INFO(r32) | ||
| 849 | movei r33, 0 | ||
| 850 | } | ||
| 851 | |||
| 852 | .Lretry_work_pending: | ||
| 853 | /* | ||
| 842 | * Disable interrupts so as to make sure we don't | 854 | * Disable interrupts so as to make sure we don't |
| 843 | * miss an interrupt that sets any of the thread flags (like | 855 | * miss an interrupt that sets any of the thread flags (like |
| 844 | * need_resched or sigpending) between sampling and the iret. | 856 | * need_resched or sigpending) between sampling and the iret. |
| @@ -848,9 +860,6 @@ STD_ENTRY(interrupt_return) | |||
| 848 | IRQ_DISABLE(r20, r21) | 860 | IRQ_DISABLE(r20, r21) |
| 849 | TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */ | 861 | TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */ |
| 850 | 862 | ||
| 851 | /* Get base of stack in r32; note r30/31 are used as arguments here. */ | ||
| 852 | GET_THREAD_INFO(r32) | ||
| 853 | |||
| 854 | 863 | ||
| 855 | /* Check to see if there is any work to do before returning to user. */ | 864 | /* Check to see if there is any work to do before returning to user. */ |
| 856 | { | 865 | { |
| @@ -866,16 +875,18 @@ STD_ENTRY(interrupt_return) | |||
| 866 | 875 | ||
| 867 | /* | 876 | /* |
| 868 | * Make sure we have all the registers saved for signal | 877 | * Make sure we have all the registers saved for signal |
| 869 | * handling or single-step. Call out to C code to figure out | 878 | * handling, notify-resume, or single-step. Call out to C |
| 870 | * exactly what we need to do for each flag bit, then if | 879 | * code to figure out exactly what we need to do for each flag bit, |
| 871 | * necessary, reload the flags and recheck. | 880 | * then if necessary, reload the flags and recheck. |
| 872 | */ | 881 | */ |
| 873 | push_extra_callee_saves r0 | ||
| 874 | { | 882 | { |
| 875 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | 883 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) |
| 876 | jal do_work_pending | 884 | bnz r33, 1f |
| 877 | } | 885 | } |
| 878 | bnz r0, .Lresume_userspace | 886 | push_extra_callee_saves r0 |
| 887 | movei r33, 1 | ||
| 888 | 1: jal do_work_pending | ||
| 889 | bnz r0, .Lretry_work_pending | ||
| 879 | 890 | ||
| 880 | /* | 891 | /* |
| 881 | * In the NMI case we | 892 | * In the NMI case we |
| @@ -1180,10 +1191,12 @@ handle_syscall: | |||
| 1180 | add r20, r20, tp | 1191 | add r20, r20, tp |
| 1181 | lw r21, r20 | 1192 | lw r21, r20 |
| 1182 | addi r21, r21, 1 | 1193 | addi r21, r21, 1 |
| 1183 | sw r20, r21 | 1194 | { |
| 1195 | sw r20, r21 | ||
| 1196 | GET_THREAD_INFO(r31) | ||
| 1197 | } | ||
| 1184 | 1198 | ||
| 1185 | /* Trace syscalls, if requested. */ | 1199 | /* Trace syscalls, if requested. */ |
| 1186 | GET_THREAD_INFO(r31) | ||
| 1187 | addi r31, r31, THREAD_INFO_FLAGS_OFFSET | 1200 | addi r31, r31, THREAD_INFO_FLAGS_OFFSET |
| 1188 | lw r30, r31 | 1201 | lw r30, r31 |
| 1189 | andi r30, r30, _TIF_SYSCALL_TRACE | 1202 | andi r30, r30, _TIF_SYSCALL_TRACE |
| @@ -1362,7 +1375,10 @@ handle_ill: | |||
| 1362 | 3: | 1375 | 3: |
| 1363 | /* set PC and continue */ | 1376 | /* set PC and continue */ |
| 1364 | lw r26, r24 | 1377 | lw r26, r24 |
| 1365 | sw r28, r26 | 1378 | { |
| 1379 | sw r28, r26 | ||
| 1380 | GET_THREAD_INFO(r0) | ||
| 1381 | } | ||
| 1366 | 1382 | ||
| 1367 | /* | 1383 | /* |
| 1368 | * Clear TIF_SINGLESTEP to prevent recursion if we execute an ill. | 1384 | * Clear TIF_SINGLESTEP to prevent recursion if we execute an ill. |
| @@ -1370,7 +1386,6 @@ handle_ill: | |||
| 1370 | * need to clear it here and can't really impose on all other arches. | 1386 | * need to clear it here and can't really impose on all other arches. |
| 1371 | * So what's another write between friends? | 1387 | * So what's another write between friends? |
| 1372 | */ | 1388 | */ |
| 1373 | GET_THREAD_INFO(r0) | ||
| 1374 | 1389 | ||
| 1375 | addi r1, r0, THREAD_INFO_FLAGS_OFFSET | 1390 | addi r1, r0, THREAD_INFO_FLAGS_OFFSET |
| 1376 | { | 1391 | { |
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S index 49d9d6621682..30ae76e50c44 100644 --- a/arch/tile/kernel/intvec_64.S +++ b/arch/tile/kernel/intvec_64.S | |||
| @@ -647,6 +647,20 @@ STD_ENTRY(interrupt_return) | |||
| 647 | FEEDBACK_REENTER(interrupt_return) | 647 | FEEDBACK_REENTER(interrupt_return) |
| 648 | 648 | ||
| 649 | /* | 649 | /* |
| 650 | * Use r33 to hold whether we have already loaded the callee-saves | ||
| 651 | * into ptregs. We don't want to do it twice in this loop, since | ||
| 652 | * then we'd clobber whatever changes are made by ptrace, etc. | ||
| 653 | */ | ||
| 654 | { | ||
| 655 | movei r33, 0 | ||
| 656 | move r32, sp | ||
| 657 | } | ||
| 658 | |||
| 659 | /* Get base of stack in r32. */ | ||
| 660 | EXTRACT_THREAD_INFO(r32) | ||
| 661 | |||
| 662 | .Lretry_work_pending: | ||
| 663 | /* | ||
| 650 | * Disable interrupts so as to make sure we don't | 664 | * Disable interrupts so as to make sure we don't |
| 651 | * miss an interrupt that sets any of the thread flags (like | 665 | * miss an interrupt that sets any of the thread flags (like |
| 652 | * need_resched or sigpending) between sampling and the iret. | 666 | * need_resched or sigpending) between sampling and the iret. |
| @@ -656,9 +670,6 @@ STD_ENTRY(interrupt_return) | |||
| 656 | IRQ_DISABLE(r20, r21) | 670 | IRQ_DISABLE(r20, r21) |
| 657 | TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */ | 671 | TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */ |
| 658 | 672 | ||
| 659 | /* Get base of stack in r32; note r30/31 are used as arguments here. */ | ||
| 660 | GET_THREAD_INFO(r32) | ||
| 661 | |||
| 662 | 673 | ||
| 663 | /* Check to see if there is any work to do before returning to user. */ | 674 | /* Check to see if there is any work to do before returning to user. */ |
| 664 | { | 675 | { |
| @@ -674,16 +685,18 @@ STD_ENTRY(interrupt_return) | |||
| 674 | 685 | ||
| 675 | /* | 686 | /* |
| 676 | * Make sure we have all the registers saved for signal | 687 | * Make sure we have all the registers saved for signal |
| 677 | * handling or single-step. Call out to C code to figure out | 688 | * handling or notify-resume. Call out to C code to figure out |
| 678 | * exactly what we need to do for each flag bit, then if | 689 | * exactly what we need to do for each flag bit, then if |
| 679 | * necessary, reload the flags and recheck. | 690 | * necessary, reload the flags and recheck. |
| 680 | */ | 691 | */ |
| 681 | push_extra_callee_saves r0 | ||
| 682 | { | 692 | { |
| 683 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) | 693 | PTREGS_PTR(r0, PTREGS_OFFSET_BASE) |
| 684 | jal do_work_pending | 694 | bnez r33, 1f |
| 685 | } | 695 | } |
| 686 | bnez r0, .Lresume_userspace | 696 | push_extra_callee_saves r0 |
| 697 | movei r33, 1 | ||
| 698 | 1: jal do_work_pending | ||
| 699 | bnez r0, .Lretry_work_pending | ||
| 687 | 700 | ||
| 688 | /* | 701 | /* |
| 689 | * In the NMI case we | 702 | * In the NMI case we |
| @@ -968,11 +981,16 @@ handle_syscall: | |||
| 968 | shl16insli r20, r20, hw0(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET) | 981 | shl16insli r20, r20, hw0(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET) |
| 969 | add r20, r20, tp | 982 | add r20, r20, tp |
| 970 | ld4s r21, r20 | 983 | ld4s r21, r20 |
| 971 | addi r21, r21, 1 | 984 | { |
| 972 | st4 r20, r21 | 985 | addi r21, r21, 1 |
| 986 | move r31, sp | ||
| 987 | } | ||
| 988 | { | ||
| 989 | st4 r20, r21 | ||
| 990 | EXTRACT_THREAD_INFO(r31) | ||
| 991 | } | ||
| 973 | 992 | ||
| 974 | /* Trace syscalls, if requested. */ | 993 | /* Trace syscalls, if requested. */ |
| 975 | GET_THREAD_INFO(r31) | ||
| 976 | addi r31, r31, THREAD_INFO_FLAGS_OFFSET | 994 | addi r31, r31, THREAD_INFO_FLAGS_OFFSET |
| 977 | ld r30, r31 | 995 | ld r30, r31 |
| 978 | andi r30, r30, _TIF_SYSCALL_TRACE | 996 | andi r30, r30, _TIF_SYSCALL_TRACE |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index 2d5ef617bb39..54e6c64b85cc 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
| @@ -567,6 +567,10 @@ struct task_struct *__sched _switch_to(struct task_struct *prev, | |||
| 567 | */ | 567 | */ |
| 568 | int do_work_pending(struct pt_regs *regs, u32 thread_info_flags) | 568 | int do_work_pending(struct pt_regs *regs, u32 thread_info_flags) |
| 569 | { | 569 | { |
| 570 | /* If we enter in kernel mode, do nothing and exit the caller loop. */ | ||
| 571 | if (!user_mode(regs)) | ||
| 572 | return 0; | ||
| 573 | |||
| 570 | if (thread_info_flags & _TIF_NEED_RESCHED) { | 574 | if (thread_info_flags & _TIF_NEED_RESCHED) { |
| 571 | schedule(); | 575 | schedule(); |
| 572 | return 1; | 576 | return 1; |
| @@ -589,8 +593,7 @@ int do_work_pending(struct pt_regs *regs, u32 thread_info_flags) | |||
| 589 | return 1; | 593 | return 1; |
| 590 | } | 594 | } |
| 591 | if (thread_info_flags & _TIF_SINGLESTEP) { | 595 | if (thread_info_flags & _TIF_SINGLESTEP) { |
| 592 | if ((regs->ex1 & SPR_EX_CONTEXT_1_1__PL_MASK) == 0) | 596 | single_step_once(regs); |
| 593 | single_step_once(regs); | ||
| 594 | return 0; | 597 | return 0; |
| 595 | } | 598 | } |
| 596 | panic("work_pending: bad flags %#x\n", thread_info_flags); | 599 | panic("work_pending: bad flags %#x\n", thread_info_flags); |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1d14cc6b79ad..c9866b0b77d8 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -81,7 +81,7 @@ config X86 | |||
| 81 | select CLKEVT_I8253 | 81 | select CLKEVT_I8253 |
| 82 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 82 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
| 83 | select GENERIC_IOMAP | 83 | select GENERIC_IOMAP |
| 84 | select DCACHE_WORD_ACCESS if !DEBUG_PAGEALLOC | 84 | select DCACHE_WORD_ACCESS |
| 85 | 85 | ||
| 86 | config INSTRUCTION_DECODER | 86 | config INSTRUCTION_DECODER |
| 87 | def_bool (KPROBES || PERF_EVENTS) | 87 | def_bool (KPROBES || PERF_EVENTS) |
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c index d3c0b0277666..fb7117a4ade1 100644 --- a/arch/x86/boot/compressed/relocs.c +++ b/arch/x86/boot/compressed/relocs.c | |||
| @@ -403,13 +403,11 @@ static void print_absolute_symbols(void) | |||
| 403 | for (i = 0; i < ehdr.e_shnum; i++) { | 403 | for (i = 0; i < ehdr.e_shnum; i++) { |
| 404 | struct section *sec = &secs[i]; | 404 | struct section *sec = &secs[i]; |
| 405 | char *sym_strtab; | 405 | char *sym_strtab; |
| 406 | Elf32_Sym *sh_symtab; | ||
| 407 | int j; | 406 | int j; |
| 408 | 407 | ||
| 409 | if (sec->shdr.sh_type != SHT_SYMTAB) { | 408 | if (sec->shdr.sh_type != SHT_SYMTAB) { |
| 410 | continue; | 409 | continue; |
| 411 | } | 410 | } |
| 412 | sh_symtab = sec->symtab; | ||
| 413 | sym_strtab = sec->link->strtab; | 411 | sym_strtab = sec->link->strtab; |
| 414 | for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) { | 412 | for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) { |
| 415 | Elf32_Sym *sym; | 413 | Elf32_Sym *sym; |
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index 4824fb45560f..07b3a68d2d29 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
| @@ -294,8 +294,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 294 | 294 | ||
| 295 | /* OK, This is the point of no return */ | 295 | /* OK, This is the point of no return */ |
| 296 | set_personality(PER_LINUX); | 296 | set_personality(PER_LINUX); |
| 297 | set_thread_flag(TIF_IA32); | 297 | set_personality_ia32(false); |
| 298 | current->mm->context.ia32_compat = 1; | ||
| 299 | 298 | ||
| 300 | setup_new_exec(bprm); | 299 | setup_new_exec(bprm); |
| 301 | 300 | ||
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h index 734c3767cfac..183922e13de1 100644 --- a/arch/x86/include/asm/kvm_para.h +++ b/arch/x86/include/asm/kvm_para.h | |||
| @@ -170,6 +170,9 @@ static inline int kvm_para_available(void) | |||
| 170 | unsigned int eax, ebx, ecx, edx; | 170 | unsigned int eax, ebx, ecx, edx; |
| 171 | char signature[13]; | 171 | char signature[13]; |
| 172 | 172 | ||
| 173 | if (boot_cpu_data.cpuid_level < 0) | ||
| 174 | return 0; /* So we don't blow up on old processors */ | ||
| 175 | |||
| 173 | cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx); | 176 | cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx); |
| 174 | memcpy(signature + 0, &ebx, 4); | 177 | memcpy(signature + 0, &ebx, 4); |
| 175 | memcpy(signature + 4, &ecx, 4); | 178 | memcpy(signature + 4, &ecx, 4); |
diff --git a/arch/x86/include/asm/word-at-a-time.h b/arch/x86/include/asm/word-at-a-time.h index 6fe6767b7124..e58f03b206c3 100644 --- a/arch/x86/include/asm/word-at-a-time.h +++ b/arch/x86/include/asm/word-at-a-time.h | |||
| @@ -43,4 +43,37 @@ static inline unsigned long has_zero(unsigned long a) | |||
| 43 | return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80); | 43 | return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | /* | ||
| 47 | * Load an unaligned word from kernel space. | ||
| 48 | * | ||
| 49 | * In the (very unlikely) case of the word being a page-crosser | ||
| 50 | * and the next page not being mapped, take the exception and | ||
| 51 | * return zeroes in the non-existing part. | ||
| 52 | */ | ||
| 53 | static inline unsigned long load_unaligned_zeropad(const void *addr) | ||
| 54 | { | ||
| 55 | unsigned long ret, dummy; | ||
| 56 | |||
| 57 | asm( | ||
| 58 | "1:\tmov %2,%0\n" | ||
| 59 | "2:\n" | ||
| 60 | ".section .fixup,\"ax\"\n" | ||
| 61 | "3:\t" | ||
| 62 | "lea %2,%1\n\t" | ||
| 63 | "and %3,%1\n\t" | ||
| 64 | "mov (%1),%0\n\t" | ||
| 65 | "leal %2,%%ecx\n\t" | ||
| 66 | "andl %4,%%ecx\n\t" | ||
| 67 | "shll $3,%%ecx\n\t" | ||
| 68 | "shr %%cl,%0\n\t" | ||
| 69 | "jmp 2b\n" | ||
| 70 | ".previous\n" | ||
| 71 | _ASM_EXTABLE(1b, 3b) | ||
| 72 | :"=&r" (ret),"=&c" (dummy) | ||
| 73 | :"m" (*(unsigned long *)addr), | ||
| 74 | "i" (-sizeof(unsigned long)), | ||
| 75 | "i" (sizeof(unsigned long)-1)); | ||
| 76 | return ret; | ||
| 77 | } | ||
| 78 | |||
| 46 | #endif /* _ASM_WORD_AT_A_TIME_H */ | 79 | #endif /* _ASM_WORD_AT_A_TIME_H */ |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index a415b1f44365..7c439fe4941b 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
| @@ -593,7 +593,7 @@ void __init acpi_set_irq_model_ioapic(void) | |||
| 593 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | 593 | #ifdef CONFIG_ACPI_HOTPLUG_CPU |
| 594 | #include <acpi/processor.h> | 594 | #include <acpi/processor.h> |
| 595 | 595 | ||
| 596 | static void __cpuinitdata acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) | 596 | static void __cpuinit acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) |
| 597 | { | 597 | { |
| 598 | #ifdef CONFIG_ACPI_NUMA | 598 | #ifdef CONFIG_ACPI_NUMA |
| 599 | int nid; | 599 | int nid; |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 1c67ca100e4c..146bb6218eec 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
| @@ -580,6 +580,24 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
| 580 | } | 580 | } |
| 581 | } | 581 | } |
| 582 | 582 | ||
| 583 | /* re-enable TopologyExtensions if switched off by BIOS */ | ||
| 584 | if ((c->x86 == 0x15) && | ||
| 585 | (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) && | ||
| 586 | !cpu_has(c, X86_FEATURE_TOPOEXT)) { | ||
| 587 | u64 val; | ||
| 588 | |||
| 589 | if (!rdmsrl_amd_safe(0xc0011005, &val)) { | ||
| 590 | val |= 1ULL << 54; | ||
| 591 | wrmsrl_amd_safe(0xc0011005, val); | ||
| 592 | rdmsrl(0xc0011005, val); | ||
| 593 | if (val & (1ULL << 54)) { | ||
| 594 | set_cpu_cap(c, X86_FEATURE_TOPOEXT); | ||
| 595 | printk(KERN_INFO FW_INFO "CPU: Re-enabling " | ||
| 596 | "disabled Topology Extensions Support\n"); | ||
| 597 | } | ||
| 598 | } | ||
| 599 | } | ||
| 600 | |||
| 583 | cpu_detect_cache_sizes(c); | 601 | cpu_detect_cache_sizes(c); |
| 584 | 602 | ||
| 585 | /* Multi core CPU? */ | 603 | /* Multi core CPU? */ |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index d086a09c087d..11c9166c3337 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
| @@ -945,9 +945,10 @@ struct mce_info { | |||
| 945 | atomic_t inuse; | 945 | atomic_t inuse; |
| 946 | struct task_struct *t; | 946 | struct task_struct *t; |
| 947 | __u64 paddr; | 947 | __u64 paddr; |
| 948 | int restartable; | ||
| 948 | } mce_info[MCE_INFO_MAX]; | 949 | } mce_info[MCE_INFO_MAX]; |
| 949 | 950 | ||
| 950 | static void mce_save_info(__u64 addr) | 951 | static void mce_save_info(__u64 addr, int c) |
| 951 | { | 952 | { |
| 952 | struct mce_info *mi; | 953 | struct mce_info *mi; |
| 953 | 954 | ||
| @@ -955,6 +956,7 @@ static void mce_save_info(__u64 addr) | |||
| 955 | if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) { | 956 | if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) { |
| 956 | mi->t = current; | 957 | mi->t = current; |
| 957 | mi->paddr = addr; | 958 | mi->paddr = addr; |
| 959 | mi->restartable = c; | ||
| 958 | return; | 960 | return; |
| 959 | } | 961 | } |
| 960 | } | 962 | } |
| @@ -1130,7 +1132,7 @@ void do_machine_check(struct pt_regs *regs, long error_code) | |||
| 1130 | mce_panic("Fatal machine check on current CPU", &m, msg); | 1132 | mce_panic("Fatal machine check on current CPU", &m, msg); |
| 1131 | if (worst == MCE_AR_SEVERITY) { | 1133 | if (worst == MCE_AR_SEVERITY) { |
| 1132 | /* schedule action before return to userland */ | 1134 | /* schedule action before return to userland */ |
| 1133 | mce_save_info(m.addr); | 1135 | mce_save_info(m.addr, m.mcgstatus & MCG_STATUS_RIPV); |
| 1134 | set_thread_flag(TIF_MCE_NOTIFY); | 1136 | set_thread_flag(TIF_MCE_NOTIFY); |
| 1135 | } else if (kill_it) { | 1137 | } else if (kill_it) { |
| 1136 | force_sig(SIGBUS, current); | 1138 | force_sig(SIGBUS, current); |
| @@ -1179,7 +1181,13 @@ void mce_notify_process(void) | |||
| 1179 | 1181 | ||
| 1180 | pr_err("Uncorrected hardware memory error in user-access at %llx", | 1182 | pr_err("Uncorrected hardware memory error in user-access at %llx", |
| 1181 | mi->paddr); | 1183 | mi->paddr); |
| 1182 | if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0) { | 1184 | /* |
| 1185 | * We must call memory_failure() here even if the current process is | ||
| 1186 | * doomed. We still need to mark the page as poisoned and alert any | ||
| 1187 | * other users of the page. | ||
| 1188 | */ | ||
| 1189 | if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0 || | ||
| 1190 | mi->restartable == 0) { | ||
| 1183 | pr_err("Memory error not recovered"); | 1191 | pr_err("Memory error not recovered"); |
| 1184 | force_sig(SIGBUS, current); | 1192 | force_sig(SIGBUS, current); |
| 1185 | } | 1193 | } |
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index b8ba6e4a27e4..e554e5ad2fe8 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
| @@ -79,7 +79,6 @@ struct kvm_task_sleep_node { | |||
| 79 | u32 token; | 79 | u32 token; |
| 80 | int cpu; | 80 | int cpu; |
| 81 | bool halted; | 81 | bool halted; |
| 82 | struct mm_struct *mm; | ||
| 83 | }; | 82 | }; |
| 84 | 83 | ||
| 85 | static struct kvm_task_sleep_head { | 84 | static struct kvm_task_sleep_head { |
| @@ -126,9 +125,7 @@ void kvm_async_pf_task_wait(u32 token) | |||
| 126 | 125 | ||
| 127 | n.token = token; | 126 | n.token = token; |
| 128 | n.cpu = smp_processor_id(); | 127 | n.cpu = smp_processor_id(); |
| 129 | n.mm = current->active_mm; | ||
| 130 | n.halted = idle || preempt_count() > 1; | 128 | n.halted = idle || preempt_count() > 1; |
| 131 | atomic_inc(&n.mm->mm_count); | ||
| 132 | init_waitqueue_head(&n.wq); | 129 | init_waitqueue_head(&n.wq); |
| 133 | hlist_add_head(&n.link, &b->list); | 130 | hlist_add_head(&n.link, &b->list); |
| 134 | spin_unlock(&b->lock); | 131 | spin_unlock(&b->lock); |
| @@ -161,9 +158,6 @@ EXPORT_SYMBOL_GPL(kvm_async_pf_task_wait); | |||
| 161 | static void apf_task_wake_one(struct kvm_task_sleep_node *n) | 158 | static void apf_task_wake_one(struct kvm_task_sleep_node *n) |
| 162 | { | 159 | { |
| 163 | hlist_del_init(&n->link); | 160 | hlist_del_init(&n->link); |
| 164 | if (!n->mm) | ||
| 165 | return; | ||
| 166 | mmdrop(n->mm); | ||
| 167 | if (n->halted) | 161 | if (n->halted) |
| 168 | smp_send_reschedule(n->cpu); | 162 | smp_send_reschedule(n->cpu); |
| 169 | else if (waitqueue_active(&n->wq)) | 163 | else if (waitqueue_active(&n->wq)) |
| @@ -207,7 +201,7 @@ again: | |||
| 207 | * async PF was not yet handled. | 201 | * async PF was not yet handled. |
| 208 | * Add dummy entry for the token. | 202 | * Add dummy entry for the token. |
| 209 | */ | 203 | */ |
| 210 | n = kmalloc(sizeof(*n), GFP_ATOMIC); | 204 | n = kzalloc(sizeof(*n), GFP_ATOMIC); |
| 211 | if (!n) { | 205 | if (!n) { |
| 212 | /* | 206 | /* |
| 213 | * Allocation failed! Busy wait while other cpu | 207 | * Allocation failed! Busy wait while other cpu |
| @@ -219,7 +213,6 @@ again: | |||
| 219 | } | 213 | } |
| 220 | n->token = token; | 214 | n->token = token; |
| 221 | n->cpu = smp_processor_id(); | 215 | n->cpu = smp_processor_id(); |
| 222 | n->mm = NULL; | ||
| 223 | init_waitqueue_head(&n->wq); | 216 | init_waitqueue_head(&n->wq); |
| 224 | hlist_add_head(&n->link, &b->list); | 217 | hlist_add_head(&n->link, &b->list); |
| 225 | } else | 218 | } else |
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c index 3ca42d0e43a2..0327e2b3c408 100644 --- a/arch/x86/kernel/microcode_intel.c +++ b/arch/x86/kernel/microcode_intel.c | |||
| @@ -147,12 +147,6 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig) | |||
| 147 | 147 | ||
| 148 | memset(csig, 0, sizeof(*csig)); | 148 | memset(csig, 0, sizeof(*csig)); |
| 149 | 149 | ||
| 150 | if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || | ||
| 151 | cpu_has(c, X86_FEATURE_IA64)) { | ||
| 152 | pr_err("CPU%d not a capable Intel processor\n", cpu_num); | ||
| 153 | return -1; | ||
| 154 | } | ||
| 155 | |||
| 156 | csig->sig = cpuid_eax(0x00000001); | 150 | csig->sig = cpuid_eax(0x00000001); |
| 157 | 151 | ||
| 158 | if ((c->x86_model >= 5) || (c->x86 > 6)) { | 152 | if ((c->x86_model >= 5) || (c->x86 > 6)) { |
| @@ -463,6 +457,14 @@ static struct microcode_ops microcode_intel_ops = { | |||
| 463 | 457 | ||
| 464 | struct microcode_ops * __init init_intel_microcode(void) | 458 | struct microcode_ops * __init init_intel_microcode(void) |
| 465 | { | 459 | { |
| 460 | struct cpuinfo_x86 *c = &cpu_data(0); | ||
| 461 | |||
| 462 | if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || | ||
| 463 | cpu_has(c, X86_FEATURE_IA64)) { | ||
| 464 | pr_err("Intel CPU family 0x%x not supported\n", c->x86); | ||
| 465 | return NULL; | ||
| 466 | } | ||
| 467 | |||
| 466 | return µcode_intel_ops; | 468 | return µcode_intel_ops; |
| 467 | } | 469 | } |
| 468 | 470 | ||
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 733ca39f367e..43d8b48b23e6 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
| @@ -423,6 +423,7 @@ void set_personality_ia32(bool x32) | |||
| 423 | current_thread_info()->status |= TS_COMPAT; | 423 | current_thread_info()->status |= TS_COMPAT; |
| 424 | } | 424 | } |
| 425 | } | 425 | } |
| 426 | EXPORT_SYMBOL_GPL(set_personality_ia32); | ||
| 426 | 427 | ||
| 427 | unsigned long get_wchan(struct task_struct *p) | 428 | unsigned long get_wchan(struct task_struct *p) |
| 428 | { | 429 | { |
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index 71f4727da373..5a98aa272184 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
| @@ -185,10 +185,22 @@ void __init setup_per_cpu_areas(void) | |||
| 185 | #endif | 185 | #endif |
| 186 | rc = -EINVAL; | 186 | rc = -EINVAL; |
| 187 | if (pcpu_chosen_fc != PCPU_FC_PAGE) { | 187 | if (pcpu_chosen_fc != PCPU_FC_PAGE) { |
| 188 | const size_t atom_size = cpu_has_pse ? PMD_SIZE : PAGE_SIZE; | ||
| 189 | const size_t dyn_size = PERCPU_MODULE_RESERVE + | 188 | const size_t dyn_size = PERCPU_MODULE_RESERVE + |
| 190 | PERCPU_DYNAMIC_RESERVE - PERCPU_FIRST_CHUNK_RESERVE; | 189 | PERCPU_DYNAMIC_RESERVE - PERCPU_FIRST_CHUNK_RESERVE; |
| 190 | size_t atom_size; | ||
| 191 | 191 | ||
| 192 | /* | ||
| 193 | * On 64bit, use PMD_SIZE for atom_size so that embedded | ||
| 194 | * percpu areas are aligned to PMD. This, in the future, | ||
| 195 | * can also allow using PMD mappings in vmalloc area. Use | ||
| 196 | * PAGE_SIZE on 32bit as vmalloc space is highly contended | ||
| 197 | * and large vmalloc area allocs can easily fail. | ||
| 198 | */ | ||
| 199 | #ifdef CONFIG_X86_64 | ||
| 200 | atom_size = PMD_SIZE; | ||
| 201 | #else | ||
| 202 | atom_size = PAGE_SIZE; | ||
| 203 | #endif | ||
| 192 | rc = pcpu_embed_first_chunk(PERCPU_FIRST_CHUNK_RESERVE, | 204 | rc = pcpu_embed_first_chunk(PERCPU_FIRST_CHUNK_RESERVE, |
| 193 | dyn_size, atom_size, | 205 | dyn_size, atom_size, |
| 194 | pcpu_cpu_distance, | 206 | pcpu_cpu_distance, |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 91a5e989abcf..185a2b823a2d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -6581,6 +6581,7 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu, | |||
| 6581 | kvm_inject_page_fault(vcpu, &fault); | 6581 | kvm_inject_page_fault(vcpu, &fault); |
| 6582 | } | 6582 | } |
| 6583 | vcpu->arch.apf.halted = false; | 6583 | vcpu->arch.apf.halted = false; |
| 6584 | vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; | ||
| 6584 | } | 6585 | } |
| 6585 | 6586 | ||
| 6586 | bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu) | 6587 | bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/platform/geode/net5501.c b/arch/x86/platform/geode/net5501.c index 66d377e334f7..646e3b5b4bb6 100644 --- a/arch/x86/platform/geode/net5501.c +++ b/arch/x86/platform/geode/net5501.c | |||
| @@ -63,7 +63,7 @@ static struct gpio_led net5501_leds[] = { | |||
| 63 | .name = "net5501:1", | 63 | .name = "net5501:1", |
| 64 | .gpio = 6, | 64 | .gpio = 6, |
| 65 | .default_trigger = "default-on", | 65 | .default_trigger = "default-on", |
| 66 | .active_low = 1, | 66 | .active_low = 0, |
| 67 | }, | 67 | }, |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index a8f8844b8d32..95dccce8e979 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
| @@ -63,6 +63,7 @@ | |||
| 63 | #include <asm/stackprotector.h> | 63 | #include <asm/stackprotector.h> |
| 64 | #include <asm/hypervisor.h> | 64 | #include <asm/hypervisor.h> |
| 65 | #include <asm/mwait.h> | 65 | #include <asm/mwait.h> |
| 66 | #include <asm/pci_x86.h> | ||
| 66 | 67 | ||
| 67 | #ifdef CONFIG_ACPI | 68 | #ifdef CONFIG_ACPI |
| 68 | #include <linux/acpi.h> | 69 | #include <linux/acpi.h> |
| @@ -809,9 +810,40 @@ static void xen_io_delay(void) | |||
| 809 | } | 810 | } |
| 810 | 811 | ||
| 811 | #ifdef CONFIG_X86_LOCAL_APIC | 812 | #ifdef CONFIG_X86_LOCAL_APIC |
| 813 | static unsigned long xen_set_apic_id(unsigned int x) | ||
| 814 | { | ||
| 815 | WARN_ON(1); | ||
| 816 | return x; | ||
| 817 | } | ||
| 818 | static unsigned int xen_get_apic_id(unsigned long x) | ||
| 819 | { | ||
| 820 | return ((x)>>24) & 0xFFu; | ||
| 821 | } | ||
| 812 | static u32 xen_apic_read(u32 reg) | 822 | static u32 xen_apic_read(u32 reg) |
| 813 | { | 823 | { |
| 814 | return 0; | 824 | struct xen_platform_op op = { |
| 825 | .cmd = XENPF_get_cpuinfo, | ||
| 826 | .interface_version = XENPF_INTERFACE_VERSION, | ||
| 827 | .u.pcpu_info.xen_cpuid = 0, | ||
| 828 | }; | ||
| 829 | int ret = 0; | ||
| 830 | |||
| 831 | /* Shouldn't need this as APIC is turned off for PV, and we only | ||
| 832 | * get called on the bootup processor. But just in case. */ | ||
| 833 | if (!xen_initial_domain() || smp_processor_id()) | ||
| 834 | return 0; | ||
| 835 | |||
| 836 | if (reg == APIC_LVR) | ||
| 837 | return 0x10; | ||
| 838 | |||
| 839 | if (reg != APIC_ID) | ||
| 840 | return 0; | ||
| 841 | |||
| 842 | ret = HYPERVISOR_dom0_op(&op); | ||
| 843 | if (ret) | ||
| 844 | return 0; | ||
| 845 | |||
| 846 | return op.u.pcpu_info.apic_id << 24; | ||
| 815 | } | 847 | } |
| 816 | 848 | ||
| 817 | static void xen_apic_write(u32 reg, u32 val) | 849 | static void xen_apic_write(u32 reg, u32 val) |
| @@ -849,6 +881,8 @@ static void set_xen_basic_apic_ops(void) | |||
| 849 | apic->icr_write = xen_apic_icr_write; | 881 | apic->icr_write = xen_apic_icr_write; |
| 850 | apic->wait_icr_idle = xen_apic_wait_icr_idle; | 882 | apic->wait_icr_idle = xen_apic_wait_icr_idle; |
| 851 | apic->safe_wait_icr_idle = xen_safe_apic_wait_icr_idle; | 883 | apic->safe_wait_icr_idle = xen_safe_apic_wait_icr_idle; |
| 884 | apic->set_apic_id = xen_set_apic_id; | ||
| 885 | apic->get_apic_id = xen_get_apic_id; | ||
| 852 | } | 886 | } |
| 853 | 887 | ||
| 854 | #endif | 888 | #endif |
| @@ -1365,8 +1399,10 @@ asmlinkage void __init xen_start_kernel(void) | |||
| 1365 | /* Make sure ACS will be enabled */ | 1399 | /* Make sure ACS will be enabled */ |
| 1366 | pci_request_acs(); | 1400 | pci_request_acs(); |
| 1367 | } | 1401 | } |
| 1368 | 1402 | #ifdef CONFIG_PCI | |
| 1369 | 1403 | /* PCI BIOS service won't work from a PV guest. */ | |
| 1404 | pci_probe &= ~PCI_PROBE_BIOS; | ||
| 1405 | #endif | ||
| 1370 | xen_raw_console_write("about to get started...\n"); | 1406 | xen_raw_console_write("about to get started...\n"); |
| 1371 | 1407 | ||
| 1372 | xen_setup_runstate_info(0); | 1408 | xen_setup_runstate_info(0); |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index b8e279479a6b..69f5857660ac 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
| @@ -353,8 +353,13 @@ static pteval_t pte_mfn_to_pfn(pteval_t val) | |||
| 353 | { | 353 | { |
| 354 | if (val & _PAGE_PRESENT) { | 354 | if (val & _PAGE_PRESENT) { |
| 355 | unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; | 355 | unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; |
| 356 | unsigned long pfn = mfn_to_pfn(mfn); | ||
| 357 | |||
| 356 | pteval_t flags = val & PTE_FLAGS_MASK; | 358 | pteval_t flags = val & PTE_FLAGS_MASK; |
| 357 | val = ((pteval_t)mfn_to_pfn(mfn) << PAGE_SHIFT) | flags; | 359 | if (unlikely(pfn == ~0)) |
| 360 | val = flags & ~_PAGE_PRESENT; | ||
| 361 | else | ||
| 362 | val = ((pteval_t)pfn << PAGE_SHIFT) | flags; | ||
| 358 | } | 363 | } |
| 359 | 364 | ||
| 360 | return val; | 365 | return val; |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 3263b68cdfa3..3188da3df8da 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
| @@ -250,6 +250,10 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state) | |||
| 250 | return -ENODEV; | 250 | return -ENODEV; |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | /* For D3cold we should execute _PS3, not _PS4. */ | ||
| 254 | if (state == ACPI_STATE_D3_COLD) | ||
| 255 | object_name[3] = '3'; | ||
| 256 | |||
| 253 | /* | 257 | /* |
| 254 | * Transition Power | 258 | * Transition Power |
| 255 | * ---------------- | 259 | * ---------------- |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 7049a7d27c4f..0500f719f63e 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
| @@ -631,7 +631,7 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state) | |||
| 631 | * We know a device's inferred power state when all the resources | 631 | * We know a device's inferred power state when all the resources |
| 632 | * required for a given D-state are 'on'. | 632 | * required for a given D-state are 'on'. |
| 633 | */ | 633 | */ |
| 634 | for (i = ACPI_STATE_D0; i < ACPI_STATE_D3; i++) { | 634 | for (i = ACPI_STATE_D0; i < ACPI_STATE_D3_HOT; i++) { |
| 635 | list = &device->power.states[i].resources; | 635 | list = &device->power.states[i].resources; |
| 636 | if (list->count < 1) | 636 | if (list->count < 1) |
| 637 | continue; | 637 | continue; |
| @@ -660,7 +660,7 @@ int acpi_power_on_resources(struct acpi_device *device, int state) | |||
| 660 | 660 | ||
| 661 | int acpi_power_transition(struct acpi_device *device, int state) | 661 | int acpi_power_transition(struct acpi_device *device, int state) |
| 662 | { | 662 | { |
| 663 | int result; | 663 | int result = 0; |
| 664 | 664 | ||
| 665 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) | 665 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) |
| 666 | return -EINVAL; | 666 | return -EINVAL; |
| @@ -679,8 +679,11 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
| 679 | * (e.g. so the device doesn't lose power while transitioning). Then, | 679 | * (e.g. so the device doesn't lose power while transitioning). Then, |
| 680 | * we dereference all power resources used in the current list. | 680 | * we dereference all power resources used in the current list. |
| 681 | */ | 681 | */ |
| 682 | result = acpi_power_on_list(&device->power.states[state].resources); | 682 | if (state < ACPI_STATE_D3_COLD) |
| 683 | if (!result) | 683 | result = acpi_power_on_list( |
| 684 | &device->power.states[state].resources); | ||
| 685 | |||
| 686 | if (!result && device->power.state < ACPI_STATE_D3_COLD) | ||
| 684 | acpi_power_off_list( | 687 | acpi_power_off_list( |
| 685 | &device->power.states[device->power.state].resources); | 688 | &device->power.states[device->power.state].resources); |
| 686 | 689 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 767e2dcb9616..85cbfdccc97c 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -869,7 +869,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
| 869 | /* | 869 | /* |
| 870 | * Enumerate supported power management states | 870 | * Enumerate supported power management states |
| 871 | */ | 871 | */ |
| 872 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3; i++) { | 872 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { |
| 873 | struct acpi_device_power_state *ps = &device->power.states[i]; | 873 | struct acpi_device_power_state *ps = &device->power.states[i]; |
| 874 | char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; | 874 | char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; |
| 875 | 875 | ||
| @@ -884,21 +884,18 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
| 884 | acpi_bus_add_power_resource(ps->resources.handles[j]); | 884 | acpi_bus_add_power_resource(ps->resources.handles[j]); |
| 885 | } | 885 | } |
| 886 | 886 | ||
| 887 | /* The exist of _PR3 indicates D3Cold support */ | ||
| 888 | if (i == ACPI_STATE_D3) { | ||
| 889 | status = acpi_get_handle(device->handle, object_name, &handle); | ||
| 890 | if (ACPI_SUCCESS(status)) | ||
| 891 | device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1; | ||
| 892 | } | ||
| 893 | |||
| 894 | /* Evaluate "_PSx" to see if we can do explicit sets */ | 887 | /* Evaluate "_PSx" to see if we can do explicit sets */ |
| 895 | object_name[2] = 'S'; | 888 | object_name[2] = 'S'; |
| 896 | status = acpi_get_handle(device->handle, object_name, &handle); | 889 | status = acpi_get_handle(device->handle, object_name, &handle); |
| 897 | if (ACPI_SUCCESS(status)) | 890 | if (ACPI_SUCCESS(status)) |
| 898 | ps->flags.explicit_set = 1; | 891 | ps->flags.explicit_set = 1; |
| 899 | 892 | ||
| 900 | /* State is valid if we have some power control */ | 893 | /* |
| 901 | if (ps->resources.count || ps->flags.explicit_set) | 894 | * State is valid if there are means to put the device into it. |
| 895 | * D3hot is only valid if _PR3 present. | ||
| 896 | */ | ||
| 897 | if (ps->resources.count || | ||
| 898 | (ps->flags.explicit_set && i < ACPI_STATE_D3_HOT)) | ||
| 902 | ps->flags.valid = 1; | 899 | ps->flags.valid = 1; |
| 903 | 900 | ||
| 904 | ps->power = -1; /* Unknown - driver assigned */ | 901 | ps->power = -1; /* Unknown - driver assigned */ |
| @@ -911,6 +908,10 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
| 911 | device->power.states[ACPI_STATE_D3].flags.valid = 1; | 908 | device->power.states[ACPI_STATE_D3].flags.valid = 1; |
| 912 | device->power.states[ACPI_STATE_D3].power = 0; | 909 | device->power.states[ACPI_STATE_D3].power = 0; |
| 913 | 910 | ||
| 911 | /* Set D3cold's explicit_set flag if _PS3 exists. */ | ||
| 912 | if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set) | ||
| 913 | device->power.states[ACPI_STATE_D3_COLD].flags.explicit_set = 1; | ||
| 914 | |||
| 914 | acpi_bus_init_power(device); | 915 | acpi_bus_init_power(device); |
| 915 | 916 | ||
| 916 | return 0; | 917 | return 0; |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 79a1e9dd56d9..ebaf67e4b2bc 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -394,6 +394,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 394 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ | 394 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ |
| 395 | { PCI_DEVICE(0x1b4b, 0x9125), | 395 | { PCI_DEVICE(0x1b4b, 0x9125), |
| 396 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ | 396 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ |
| 397 | { PCI_DEVICE(0x1b4b, 0x917a), | ||
| 398 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | ||
| 397 | { PCI_DEVICE(0x1b4b, 0x91a3), | 399 | { PCI_DEVICE(0x1b4b, 0x91a3), |
| 398 | .driver_data = board_ahci_yes_fbs }, | 400 | .driver_data = board_ahci_yes_fbs }, |
| 399 | 401 | ||
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 0c86c77764bc..9e419e1c2006 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
| @@ -280,6 +280,7 @@ static struct dev_pm_ops ahci_pm_ops = { | |||
| 280 | 280 | ||
| 281 | static const struct of_device_id ahci_of_match[] = { | 281 | static const struct of_device_id ahci_of_match[] = { |
| 282 | { .compatible = "calxeda,hb-ahci", }, | 282 | { .compatible = "calxeda,hb-ahci", }, |
| 283 | { .compatible = "snps,spear-ahci", }, | ||
| 283 | {}, | 284 | {}, |
| 284 | }; | 285 | }; |
| 285 | MODULE_DEVICE_TABLE(of, ahci_of_match); | 286 | MODULE_DEVICE_TABLE(of, ahci_of_match); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 28db50b57b91..23763a1ec570 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -95,7 +95,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev); | |||
| 95 | static void ata_dev_xfermask(struct ata_device *dev); | 95 | static void ata_dev_xfermask(struct ata_device *dev); |
| 96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); | 96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); |
| 97 | 97 | ||
| 98 | atomic_t ata_print_id = ATOMIC_INIT(1); | 98 | atomic_t ata_print_id = ATOMIC_INIT(0); |
| 99 | 99 | ||
| 100 | struct ata_force_param { | 100 | struct ata_force_param { |
| 101 | const char *name; | 101 | const char *name; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c61316e9d2f7..d1fbd59ead16 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -3501,7 +3501,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg | |||
| 3501 | u64 now = get_jiffies_64(); | 3501 | u64 now = get_jiffies_64(); |
| 3502 | int *trials = void_arg; | 3502 | int *trials = void_arg; |
| 3503 | 3503 | ||
| 3504 | if (ent->timestamp < now - min(now, interval)) | 3504 | if ((ent->eflags & ATA_EFLAG_OLD_ER) || |
| 3505 | (ent->timestamp < now - min(now, interval))) | ||
| 3505 | return -1; | 3506 | return -1; |
| 3506 | 3507 | ||
| 3507 | (*trials)++; | 3508 | (*trials)++; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 93dabdcd2cbe..22226350cd0c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -3399,7 +3399,8 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) | |||
| 3399 | */ | 3399 | */ |
| 3400 | shost->max_host_blocked = 1; | 3400 | shost->max_host_blocked = 1; |
| 3401 | 3401 | ||
| 3402 | rc = scsi_add_host(ap->scsi_host, &ap->tdev); | 3402 | rc = scsi_add_host_with_dma(ap->scsi_host, |
| 3403 | &ap->tdev, ap->host->dev); | ||
| 3403 | if (rc) | 3404 | if (rc) |
| 3404 | goto err_add; | 3405 | goto err_add; |
| 3405 | } | 3406 | } |
| @@ -3838,18 +3839,25 @@ void ata_sas_port_stop(struct ata_port *ap) | |||
| 3838 | } | 3839 | } |
| 3839 | EXPORT_SYMBOL_GPL(ata_sas_port_stop); | 3840 | EXPORT_SYMBOL_GPL(ata_sas_port_stop); |
| 3840 | 3841 | ||
| 3841 | int ata_sas_async_port_init(struct ata_port *ap) | 3842 | /** |
| 3843 | * ata_sas_async_probe - simply schedule probing and return | ||
| 3844 | * @ap: Port to probe | ||
| 3845 | * | ||
| 3846 | * For batch scheduling of probe for sas attached ata devices, assumes | ||
| 3847 | * the port has already been through ata_sas_port_init() | ||
| 3848 | */ | ||
| 3849 | void ata_sas_async_probe(struct ata_port *ap) | ||
| 3842 | { | 3850 | { |
| 3843 | int rc = ap->ops->port_start(ap); | 3851 | __ata_port_probe(ap); |
| 3844 | 3852 | } | |
| 3845 | if (!rc) { | 3853 | EXPORT_SYMBOL_GPL(ata_sas_async_probe); |
| 3846 | ap->print_id = atomic_inc_return(&ata_print_id); | ||
| 3847 | __ata_port_probe(ap); | ||
| 3848 | } | ||
| 3849 | 3854 | ||
| 3850 | return rc; | 3855 | int ata_sas_sync_probe(struct ata_port *ap) |
| 3856 | { | ||
| 3857 | return ata_port_probe(ap); | ||
| 3851 | } | 3858 | } |
| 3852 | EXPORT_SYMBOL_GPL(ata_sas_async_port_init); | 3859 | EXPORT_SYMBOL_GPL(ata_sas_sync_probe); |
| 3860 | |||
| 3853 | 3861 | ||
| 3854 | /** | 3862 | /** |
| 3855 | * ata_sas_port_init - Initialize a SATA device | 3863 | * ata_sas_port_init - Initialize a SATA device |
| @@ -3866,12 +3874,10 @@ int ata_sas_port_init(struct ata_port *ap) | |||
| 3866 | { | 3874 | { |
| 3867 | int rc = ap->ops->port_start(ap); | 3875 | int rc = ap->ops->port_start(ap); |
| 3868 | 3876 | ||
| 3869 | if (!rc) { | 3877 | if (rc) |
| 3870 | ap->print_id = atomic_inc_return(&ata_print_id); | 3878 | return rc; |
| 3871 | rc = ata_port_probe(ap); | 3879 | ap->print_id = atomic_inc_return(&ata_print_id); |
| 3872 | } | 3880 | return 0; |
| 3873 | |||
| 3874 | return rc; | ||
| 3875 | } | 3881 | } |
| 3876 | EXPORT_SYMBOL_GPL(ata_sas_port_init); | 3882 | EXPORT_SYMBOL_GPL(ata_sas_port_init); |
| 3877 | 3883 | ||
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index fc2db2a89a6b..3239517f4d90 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
| @@ -943,9 +943,9 @@ static int arasan_cf_resume(struct device *dev) | |||
| 943 | 943 | ||
| 944 | return 0; | 944 | return 0; |
| 945 | } | 945 | } |
| 946 | #endif | ||
| 946 | 947 | ||
| 947 | static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume); | 948 | static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume); |
| 948 | #endif | ||
| 949 | 949 | ||
| 950 | static struct platform_driver arasan_cf_driver = { | 950 | static struct platform_driver arasan_cf_driver = { |
| 951 | .probe = arasan_cf_probe, | 951 | .probe = arasan_cf_probe, |
| @@ -953,9 +953,7 @@ static struct platform_driver arasan_cf_driver = { | |||
| 953 | .driver = { | 953 | .driver = { |
| 954 | .name = DRIVER_NAME, | 954 | .name = DRIVER_NAME, |
| 955 | .owner = THIS_MODULE, | 955 | .owner = THIS_MODULE, |
| 956 | #ifdef CONFIG_PM | ||
| 957 | .pm = &arasan_cf_pm_ops, | 956 | .pm = &arasan_cf_pm_ops, |
| 958 | #endif | ||
| 959 | }, | 957 | }, |
| 960 | }; | 958 | }; |
| 961 | 959 | ||
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 7a3f535e481c..bb80853ff27a 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
| @@ -775,9 +775,11 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, | |||
| 775 | map->format.parse_val(val + i); | 775 | map->format.parse_val(val + i); |
| 776 | } else { | 776 | } else { |
| 777 | for (i = 0; i < val_count; i++) { | 777 | for (i = 0; i < val_count; i++) { |
| 778 | ret = regmap_read(map, reg + i, val + (i * val_bytes)); | 778 | unsigned int ival; |
| 779 | ret = regmap_read(map, reg + i, &ival); | ||
| 779 | if (ret != 0) | 780 | if (ret != 0) |
| 780 | return ret; | 781 | return ret; |
| 782 | memcpy(val + (i * val_bytes), &ival, val_bytes); | ||
| 781 | } | 783 | } |
| 782 | } | 784 | } |
| 783 | 785 | ||
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index abfaacaaf346..946166e13953 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
| @@ -2297,7 +2297,7 @@ static void drbd_connector_callback(struct cn_msg *req, struct netlink_skb_parms | |||
| 2297 | return; | 2297 | return; |
| 2298 | } | 2298 | } |
| 2299 | 2299 | ||
| 2300 | if (!cap_raised(current_cap(), CAP_SYS_ADMIN)) { | 2300 | if (!capable(CAP_SYS_ADMIN)) { |
| 2301 | retcode = ERR_PERM; | 2301 | retcode = ERR_PERM; |
| 2302 | goto fail; | 2302 | goto fail; |
| 2303 | } | 2303 | } |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index ae9edca7b56d..57fd867553d7 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
| @@ -75,6 +75,8 @@ static struct usb_device_id ath3k_table[] = { | |||
| 75 | { USB_DEVICE(0x0CF3, 0x311D) }, | 75 | { USB_DEVICE(0x0CF3, 0x311D) }, |
| 76 | { USB_DEVICE(0x13d3, 0x3375) }, | 76 | { USB_DEVICE(0x13d3, 0x3375) }, |
| 77 | { USB_DEVICE(0x04CA, 0x3005) }, | 77 | { USB_DEVICE(0x04CA, 0x3005) }, |
| 78 | { USB_DEVICE(0x13d3, 0x3362) }, | ||
| 79 | { USB_DEVICE(0x0CF3, 0xE004) }, | ||
| 78 | 80 | ||
| 79 | /* Atheros AR5BBU12 with sflash firmware */ | 81 | /* Atheros AR5BBU12 with sflash firmware */ |
| 80 | { USB_DEVICE(0x0489, 0xE02C) }, | 82 | { USB_DEVICE(0x0489, 0xE02C) }, |
| @@ -94,6 +96,8 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
| 94 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 96 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
| 95 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 97 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| 96 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 98 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 99 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | ||
| 100 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | ||
| 97 | 101 | ||
| 98 | { } /* Terminating entry */ | 102 | { } /* Terminating entry */ |
| 99 | }; | 103 | }; |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 3311b812a0c6..9217121362e1 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -101,12 +101,16 @@ static struct usb_device_id btusb_table[] = { | |||
| 101 | { USB_DEVICE(0x0c10, 0x0000) }, | 101 | { USB_DEVICE(0x0c10, 0x0000) }, |
| 102 | 102 | ||
| 103 | /* Broadcom BCM20702A0 */ | 103 | /* Broadcom BCM20702A0 */ |
| 104 | { USB_DEVICE(0x0489, 0xe042) }, | ||
| 104 | { USB_DEVICE(0x0a5c, 0x21e3) }, | 105 | { USB_DEVICE(0x0a5c, 0x21e3) }, |
| 105 | { USB_DEVICE(0x0a5c, 0x21e6) }, | 106 | { USB_DEVICE(0x0a5c, 0x21e6) }, |
| 106 | { USB_DEVICE(0x0a5c, 0x21e8) }, | 107 | { USB_DEVICE(0x0a5c, 0x21e8) }, |
| 107 | { USB_DEVICE(0x0a5c, 0x21f3) }, | 108 | { USB_DEVICE(0x0a5c, 0x21f3) }, |
| 108 | { USB_DEVICE(0x413c, 0x8197) }, | 109 | { USB_DEVICE(0x413c, 0x8197) }, |
| 109 | 110 | ||
| 111 | /* Foxconn - Hon Hai */ | ||
| 112 | { USB_DEVICE(0x0489, 0xe033) }, | ||
| 113 | |||
| 110 | { } /* Terminating entry */ | 114 | { } /* Terminating entry */ |
| 111 | }; | 115 | }; |
| 112 | 116 | ||
| @@ -133,6 +137,8 @@ static struct usb_device_id blacklist_table[] = { | |||
| 133 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 137 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
| 134 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 138 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| 135 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 139 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 140 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | ||
| 141 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | ||
| 136 | 142 | ||
| 137 | /* Atheros AR5BBU12 with sflash firmware */ | 143 | /* Atheros AR5BBU12 with sflash firmware */ |
| 138 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 144 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index ddf86b6500b7..cdf2f5451c76 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -1895,6 +1895,13 @@ static int virtcons_restore(struct virtio_device *vdev) | |||
| 1895 | 1895 | ||
| 1896 | /* Get port open/close status on the host */ | 1896 | /* Get port open/close status on the host */ |
| 1897 | send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1); | 1897 | send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1); |
| 1898 | |||
| 1899 | /* | ||
| 1900 | * If a port was open at the time of suspending, we | ||
| 1901 | * have to let the host know that it's still open. | ||
| 1902 | */ | ||
| 1903 | if (port->guest_connected) | ||
| 1904 | send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 1); | ||
| 1898 | } | 1905 | } |
| 1899 | return 0; | 1906 | return 0; |
| 1900 | } | 1907 | } |
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index ab9abb46d01a..dd414d9350ef 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig | |||
| @@ -164,6 +164,7 @@ config CRYPTO_DEV_MV_CESA | |||
| 164 | select CRYPTO_ALGAPI | 164 | select CRYPTO_ALGAPI |
| 165 | select CRYPTO_AES | 165 | select CRYPTO_AES |
| 166 | select CRYPTO_BLKCIPHER2 | 166 | select CRYPTO_BLKCIPHER2 |
| 167 | select CRYPTO_HASH | ||
| 167 | help | 168 | help |
| 168 | This driver allows you to utilize the Cryptographic Engines and | 169 | This driver allows you to utilize the Cryptographic Engines and |
| 169 | Security Accelerator (CESA) which can be found on the Marvell Orion | 170 | Security Accelerator (CESA) which can be found on the Marvell Orion |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 445fdf811695..bf0d7e4e345b 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
| @@ -245,7 +245,9 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc) | |||
| 245 | dev_vdbg(chan2dev(&atchan->chan_common), | 245 | dev_vdbg(chan2dev(&atchan->chan_common), |
| 246 | "descriptor %u complete\n", txd->cookie); | 246 | "descriptor %u complete\n", txd->cookie); |
| 247 | 247 | ||
| 248 | dma_cookie_complete(txd); | 248 | /* mark the descriptor as complete for non cyclic cases only */ |
| 249 | if (!atc_chan_is_cyclic(atchan)) | ||
| 250 | dma_cookie_complete(txd); | ||
| 249 | 251 | ||
| 250 | /* move children to free_list */ | 252 | /* move children to free_list */ |
| 251 | list_splice_init(&desc->tx_list, &atchan->free_list); | 253 | list_splice_init(&desc->tx_list, &atchan->free_list); |
diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index e6f133b78dc2..f6e9b572b998 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c | |||
| @@ -703,7 +703,9 @@ static void ep93xx_dma_tasklet(unsigned long data) | |||
| 703 | desc = ep93xx_dma_get_active(edmac); | 703 | desc = ep93xx_dma_get_active(edmac); |
| 704 | if (desc) { | 704 | if (desc) { |
| 705 | if (desc->complete) { | 705 | if (desc->complete) { |
| 706 | dma_cookie_complete(&desc->txd); | 706 | /* mark descriptor complete for non cyclic case only */ |
| 707 | if (!test_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags)) | ||
| 708 | dma_cookie_complete(&desc->txd); | ||
| 707 | list_splice_init(&edmac->active, &list); | 709 | list_splice_init(&edmac->active, &list); |
| 708 | } | 710 | } |
| 709 | callback = desc->txd.callback; | 711 | callback = desc->txd.callback; |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 2ee6e23930ad..fa3fb21e60be 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
| @@ -2322,7 +2322,8 @@ static void pl330_tasklet(unsigned long data) | |||
| 2322 | /* Pick up ripe tomatoes */ | 2322 | /* Pick up ripe tomatoes */ |
| 2323 | list_for_each_entry_safe(desc, _dt, &pch->work_list, node) | 2323 | list_for_each_entry_safe(desc, _dt, &pch->work_list, node) |
| 2324 | if (desc->status == DONE) { | 2324 | if (desc->status == DONE) { |
| 2325 | dma_cookie_complete(&desc->txd); | 2325 | if (pch->cyclic) |
| 2326 | dma_cookie_complete(&desc->txd); | ||
| 2326 | list_move_tail(&desc->node, &list); | 2327 | list_move_tail(&desc->node, &list); |
| 2327 | } | 2328 | } |
| 2328 | 2329 | ||
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index d25599f2a3f8..47408e802ab6 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
| @@ -191,6 +191,190 @@ utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len) | |||
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static bool | ||
| 195 | validate_device_path(struct efi_variable *var, int match, u8 *buffer, | ||
| 196 | unsigned long len) | ||
| 197 | { | ||
| 198 | struct efi_generic_dev_path *node; | ||
| 199 | int offset = 0; | ||
| 200 | |||
| 201 | node = (struct efi_generic_dev_path *)buffer; | ||
| 202 | |||
| 203 | if (len < sizeof(*node)) | ||
| 204 | return false; | ||
| 205 | |||
| 206 | while (offset <= len - sizeof(*node) && | ||
| 207 | node->length >= sizeof(*node) && | ||
| 208 | node->length <= len - offset) { | ||
| 209 | offset += node->length; | ||
| 210 | |||
| 211 | if ((node->type == EFI_DEV_END_PATH || | ||
| 212 | node->type == EFI_DEV_END_PATH2) && | ||
| 213 | node->sub_type == EFI_DEV_END_ENTIRE) | ||
| 214 | return true; | ||
| 215 | |||
| 216 | node = (struct efi_generic_dev_path *)(buffer + offset); | ||
| 217 | } | ||
| 218 | |||
| 219 | /* | ||
| 220 | * If we're here then either node->length pointed past the end | ||
| 221 | * of the buffer or we reached the end of the buffer without | ||
| 222 | * finding a device path end node. | ||
| 223 | */ | ||
| 224 | return false; | ||
| 225 | } | ||
| 226 | |||
| 227 | static bool | ||
| 228 | validate_boot_order(struct efi_variable *var, int match, u8 *buffer, | ||
| 229 | unsigned long len) | ||
| 230 | { | ||
| 231 | /* An array of 16-bit integers */ | ||
| 232 | if ((len % 2) != 0) | ||
| 233 | return false; | ||
| 234 | |||
| 235 | return true; | ||
| 236 | } | ||
| 237 | |||
| 238 | static bool | ||
| 239 | validate_load_option(struct efi_variable *var, int match, u8 *buffer, | ||
| 240 | unsigned long len) | ||
| 241 | { | ||
| 242 | u16 filepathlength; | ||
| 243 | int i, desclength = 0, namelen; | ||
| 244 | |||
| 245 | namelen = utf16_strnlen(var->VariableName, sizeof(var->VariableName)); | ||
| 246 | |||
| 247 | /* Either "Boot" or "Driver" followed by four digits of hex */ | ||
| 248 | for (i = match; i < match+4; i++) { | ||
| 249 | if (var->VariableName[i] > 127 || | ||
| 250 | hex_to_bin(var->VariableName[i] & 0xff) < 0) | ||
| 251 | return true; | ||
| 252 | } | ||
| 253 | |||
| 254 | /* Reject it if there's 4 digits of hex and then further content */ | ||
| 255 | if (namelen > match + 4) | ||
| 256 | return false; | ||
| 257 | |||
| 258 | /* A valid entry must be at least 8 bytes */ | ||
| 259 | if (len < 8) | ||
| 260 | return false; | ||
| 261 | |||
| 262 | filepathlength = buffer[4] | buffer[5] << 8; | ||
| 263 | |||
| 264 | /* | ||
| 265 | * There's no stored length for the description, so it has to be | ||
| 266 | * found by hand | ||
| 267 | */ | ||
| 268 | desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2; | ||
| 269 | |||
| 270 | /* Each boot entry must have a descriptor */ | ||
| 271 | if (!desclength) | ||
| 272 | return false; | ||
| 273 | |||
| 274 | /* | ||
| 275 | * If the sum of the length of the description, the claimed filepath | ||
| 276 | * length and the original header are greater than the length of the | ||
| 277 | * variable, it's malformed | ||
| 278 | */ | ||
| 279 | if ((desclength + filepathlength + 6) > len) | ||
| 280 | return false; | ||
| 281 | |||
| 282 | /* | ||
| 283 | * And, finally, check the filepath | ||
| 284 | */ | ||
| 285 | return validate_device_path(var, match, buffer + desclength + 6, | ||
| 286 | filepathlength); | ||
| 287 | } | ||
| 288 | |||
| 289 | static bool | ||
| 290 | validate_uint16(struct efi_variable *var, int match, u8 *buffer, | ||
| 291 | unsigned long len) | ||
| 292 | { | ||
| 293 | /* A single 16-bit integer */ | ||
| 294 | if (len != 2) | ||
| 295 | return false; | ||
| 296 | |||
| 297 | return true; | ||
| 298 | } | ||
| 299 | |||
| 300 | static bool | ||
| 301 | validate_ascii_string(struct efi_variable *var, int match, u8 *buffer, | ||
| 302 | unsigned long len) | ||
| 303 | { | ||
| 304 | int i; | ||
| 305 | |||
| 306 | for (i = 0; i < len; i++) { | ||
| 307 | if (buffer[i] > 127) | ||
| 308 | return false; | ||
| 309 | |||
| 310 | if (buffer[i] == 0) | ||
| 311 | return true; | ||
| 312 | } | ||
| 313 | |||
| 314 | return false; | ||
| 315 | } | ||
| 316 | |||
| 317 | struct variable_validate { | ||
| 318 | char *name; | ||
| 319 | bool (*validate)(struct efi_variable *var, int match, u8 *data, | ||
| 320 | unsigned long len); | ||
| 321 | }; | ||
| 322 | |||
| 323 | static const struct variable_validate variable_validate[] = { | ||
| 324 | { "BootNext", validate_uint16 }, | ||
| 325 | { "BootOrder", validate_boot_order }, | ||
| 326 | { "DriverOrder", validate_boot_order }, | ||
| 327 | { "Boot*", validate_load_option }, | ||
| 328 | { "Driver*", validate_load_option }, | ||
| 329 | { "ConIn", validate_device_path }, | ||
| 330 | { "ConInDev", validate_device_path }, | ||
| 331 | { "ConOut", validate_device_path }, | ||
| 332 | { "ConOutDev", validate_device_path }, | ||
| 333 | { "ErrOut", validate_device_path }, | ||
| 334 | { "ErrOutDev", validate_device_path }, | ||
| 335 | { "Timeout", validate_uint16 }, | ||
| 336 | { "Lang", validate_ascii_string }, | ||
| 337 | { "PlatformLang", validate_ascii_string }, | ||
| 338 | { "", NULL }, | ||
| 339 | }; | ||
| 340 | |||
| 341 | static bool | ||
| 342 | validate_var(struct efi_variable *var, u8 *data, unsigned long len) | ||
| 343 | { | ||
| 344 | int i; | ||
| 345 | u16 *unicode_name = var->VariableName; | ||
| 346 | |||
| 347 | for (i = 0; variable_validate[i].validate != NULL; i++) { | ||
| 348 | const char *name = variable_validate[i].name; | ||
| 349 | int match; | ||
| 350 | |||
| 351 | for (match = 0; ; match++) { | ||
| 352 | char c = name[match]; | ||
| 353 | u16 u = unicode_name[match]; | ||
| 354 | |||
| 355 | /* All special variables are plain ascii */ | ||
| 356 | if (u > 127) | ||
| 357 | return true; | ||
| 358 | |||
| 359 | /* Wildcard in the matching name means we've matched */ | ||
| 360 | if (c == '*') | ||
| 361 | return variable_validate[i].validate(var, | ||
| 362 | match, data, len); | ||
| 363 | |||
| 364 | /* Case sensitive match */ | ||
| 365 | if (c != u) | ||
| 366 | break; | ||
| 367 | |||
| 368 | /* Reached the end of the string while matching */ | ||
| 369 | if (!c) | ||
| 370 | return variable_validate[i].validate(var, | ||
| 371 | match, data, len); | ||
| 372 | } | ||
| 373 | } | ||
| 374 | |||
| 375 | return true; | ||
| 376 | } | ||
| 377 | |||
| 194 | static efi_status_t | 378 | static efi_status_t |
| 195 | get_var_data_locked(struct efivars *efivars, struct efi_variable *var) | 379 | get_var_data_locked(struct efivars *efivars, struct efi_variable *var) |
| 196 | { | 380 | { |
| @@ -324,6 +508,12 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) | |||
| 324 | return -EINVAL; | 508 | return -EINVAL; |
| 325 | } | 509 | } |
| 326 | 510 | ||
| 511 | if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || | ||
| 512 | validate_var(new_var, new_var->Data, new_var->DataSize) == false) { | ||
| 513 | printk(KERN_ERR "efivars: Malformed variable content\n"); | ||
| 514 | return -EINVAL; | ||
| 515 | } | ||
| 516 | |||
| 327 | spin_lock(&efivars->lock); | 517 | spin_lock(&efivars->lock); |
| 328 | status = efivars->ops->set_variable(new_var->VariableName, | 518 | status = efivars->ops->set_variable(new_var->VariableName, |
| 329 | &new_var->VendorGuid, | 519 | &new_var->VendorGuid, |
| @@ -626,6 +816,12 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | |||
| 626 | if (!capable(CAP_SYS_ADMIN)) | 816 | if (!capable(CAP_SYS_ADMIN)) |
| 627 | return -EACCES; | 817 | return -EACCES; |
| 628 | 818 | ||
| 819 | if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || | ||
| 820 | validate_var(new_var, new_var->Data, new_var->DataSize) == false) { | ||
| 821 | printk(KERN_ERR "efivars: Malformed variable content\n"); | ||
| 822 | return -EINVAL; | ||
| 823 | } | ||
| 824 | |||
| 629 | spin_lock(&efivars->lock); | 825 | spin_lock(&efivars->lock); |
| 630 | 826 | ||
| 631 | /* | 827 | /* |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 1adc2ec1e383..4461540653a8 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
| @@ -965,18 +965,15 @@ static void omap_gpio_mod_init(struct gpio_bank *bank) | |||
| 965 | } | 965 | } |
| 966 | 966 | ||
| 967 | _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->irqenable_inv); | 967 | _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->irqenable_inv); |
| 968 | _gpio_rmw(base, bank->regs->irqstatus, l, | 968 | _gpio_rmw(base, bank->regs->irqstatus, l, !bank->regs->irqenable_inv); |
| 969 | bank->regs->irqenable_inv == false); | ||
| 970 | _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->debounce_en != 0); | ||
| 971 | _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->ctrl != 0); | ||
| 972 | if (bank->regs->debounce_en) | 969 | if (bank->regs->debounce_en) |
| 973 | _gpio_rmw(base, bank->regs->debounce_en, 0, 1); | 970 | __raw_writel(0, base + bank->regs->debounce_en); |
| 974 | 971 | ||
| 975 | /* Save OE default value (0xffffffff) in the context */ | 972 | /* Save OE default value (0xffffffff) in the context */ |
| 976 | bank->context.oe = __raw_readl(bank->base + bank->regs->direction); | 973 | bank->context.oe = __raw_readl(bank->base + bank->regs->direction); |
| 977 | /* Initialize interface clk ungated, module enabled */ | 974 | /* Initialize interface clk ungated, module enabled */ |
| 978 | if (bank->regs->ctrl) | 975 | if (bank->regs->ctrl) |
| 979 | _gpio_rmw(base, bank->regs->ctrl, 0, 1); | 976 | __raw_writel(0, base + bank->regs->ctrl); |
| 980 | } | 977 | } |
| 981 | 978 | ||
| 982 | static __devinit void | 979 | static __devinit void |
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index e8729cc2ba2b..2cd958e0b822 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c | |||
| @@ -230,16 +230,12 @@ static void pch_gpio_setup(struct pch_gpio *chip) | |||
| 230 | 230 | ||
| 231 | static int pch_irq_type(struct irq_data *d, unsigned int type) | 231 | static int pch_irq_type(struct irq_data *d, unsigned int type) |
| 232 | { | 232 | { |
| 233 | u32 im; | ||
| 234 | u32 __iomem *im_reg; | ||
| 235 | u32 ien; | ||
| 236 | u32 im_pos; | ||
| 237 | int ch; | ||
| 238 | unsigned long flags; | ||
| 239 | u32 val; | ||
| 240 | int irq = d->irq; | ||
| 241 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 233 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
| 242 | struct pch_gpio *chip = gc->private; | 234 | struct pch_gpio *chip = gc->private; |
| 235 | u32 im, im_pos, val; | ||
| 236 | u32 __iomem *im_reg; | ||
| 237 | unsigned long flags; | ||
| 238 | int ch, irq = d->irq; | ||
| 243 | 239 | ||
| 244 | ch = irq - chip->irq_base; | 240 | ch = irq - chip->irq_base; |
| 245 | if (irq <= chip->irq_base + 7) { | 241 | if (irq <= chip->irq_base + 7) { |
| @@ -270,30 +266,22 @@ static int pch_irq_type(struct irq_data *d, unsigned int type) | |||
| 270 | case IRQ_TYPE_LEVEL_LOW: | 266 | case IRQ_TYPE_LEVEL_LOW: |
| 271 | val = PCH_LEVEL_L; | 267 | val = PCH_LEVEL_L; |
| 272 | break; | 268 | break; |
| 273 | case IRQ_TYPE_PROBE: | ||
| 274 | goto end; | ||
| 275 | default: | 269 | default: |
| 276 | dev_warn(chip->dev, "%s: unknown type(%dd)", | 270 | goto unlock; |
| 277 | __func__, type); | ||
| 278 | goto end; | ||
| 279 | } | 271 | } |
| 280 | 272 | ||
| 281 | /* Set interrupt mode */ | 273 | /* Set interrupt mode */ |
| 282 | im = ioread32(im_reg) & ~(PCH_IM_MASK << (im_pos * 4)); | 274 | im = ioread32(im_reg) & ~(PCH_IM_MASK << (im_pos * 4)); |
| 283 | iowrite32(im | (val << (im_pos * 4)), im_reg); | 275 | iowrite32(im | (val << (im_pos * 4)), im_reg); |
| 284 | 276 | ||
| 285 | /* iclr */ | 277 | /* And the handler */ |
| 286 | iowrite32(BIT(ch), &chip->reg->iclr); | 278 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) |
| 279 | __irq_set_handler_locked(d->irq, handle_level_irq); | ||
| 280 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | ||
| 281 | __irq_set_handler_locked(d->irq, handle_edge_irq); | ||
| 287 | 282 | ||
| 288 | /* IMASKCLR */ | 283 | unlock: |
| 289 | iowrite32(BIT(ch), &chip->reg->imaskclr); | ||
| 290 | |||
| 291 | /* Enable interrupt */ | ||
| 292 | ien = ioread32(&chip->reg->ien); | ||
| 293 | iowrite32(ien | BIT(ch), &chip->reg->ien); | ||
| 294 | end: | ||
| 295 | spin_unlock_irqrestore(&chip->spinlock, flags); | 284 | spin_unlock_irqrestore(&chip->spinlock, flags); |
| 296 | |||
| 297 | return 0; | 285 | return 0; |
| 298 | } | 286 | } |
| 299 | 287 | ||
| @@ -313,18 +301,24 @@ static void pch_irq_mask(struct irq_data *d) | |||
| 313 | iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->imask); | 301 | iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->imask); |
| 314 | } | 302 | } |
| 315 | 303 | ||
| 304 | static void pch_irq_ack(struct irq_data *d) | ||
| 305 | { | ||
| 306 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
| 307 | struct pch_gpio *chip = gc->private; | ||
| 308 | |||
| 309 | iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->iclr); | ||
| 310 | } | ||
| 311 | |||
| 316 | static irqreturn_t pch_gpio_handler(int irq, void *dev_id) | 312 | static irqreturn_t pch_gpio_handler(int irq, void *dev_id) |
| 317 | { | 313 | { |
| 318 | struct pch_gpio *chip = dev_id; | 314 | struct pch_gpio *chip = dev_id; |
| 319 | u32 reg_val = ioread32(&chip->reg->istatus); | 315 | u32 reg_val = ioread32(&chip->reg->istatus); |
| 320 | int i; | 316 | int i, ret = IRQ_NONE; |
| 321 | int ret = IRQ_NONE; | ||
| 322 | 317 | ||
| 323 | for (i = 0; i < gpio_pins[chip->ioh]; i++) { | 318 | for (i = 0; i < gpio_pins[chip->ioh]; i++) { |
| 324 | if (reg_val & BIT(i)) { | 319 | if (reg_val & BIT(i)) { |
| 325 | dev_dbg(chip->dev, "%s:[%d]:irq=%d status=0x%x\n", | 320 | dev_dbg(chip->dev, "%s:[%d]:irq=%d status=0x%x\n", |
| 326 | __func__, i, irq, reg_val); | 321 | __func__, i, irq, reg_val); |
| 327 | iowrite32(BIT(i), &chip->reg->iclr); | ||
| 328 | generic_handle_irq(chip->irq_base + i); | 322 | generic_handle_irq(chip->irq_base + i); |
| 329 | ret = IRQ_HANDLED; | 323 | ret = IRQ_HANDLED; |
| 330 | } | 324 | } |
| @@ -343,6 +337,7 @@ static __devinit void pch_gpio_alloc_generic_chip(struct pch_gpio *chip, | |||
| 343 | gc->private = chip; | 337 | gc->private = chip; |
| 344 | ct = gc->chip_types; | 338 | ct = gc->chip_types; |
| 345 | 339 | ||
| 340 | ct->chip.irq_ack = pch_irq_ack; | ||
| 346 | ct->chip.irq_mask = pch_irq_mask; | 341 | ct->chip.irq_mask = pch_irq_mask; |
| 347 | ct->chip.irq_unmask = pch_irq_unmask; | 342 | ct->chip.irq_unmask = pch_irq_unmask; |
| 348 | ct->chip.irq_set_type = pch_irq_type; | 343 | ct->chip.irq_set_type = pch_irq_type; |
| @@ -357,6 +352,7 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev, | |||
| 357 | s32 ret; | 352 | s32 ret; |
| 358 | struct pch_gpio *chip; | 353 | struct pch_gpio *chip; |
| 359 | int irq_base; | 354 | int irq_base; |
| 355 | u32 msk; | ||
| 360 | 356 | ||
| 361 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 357 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
| 362 | if (chip == NULL) | 358 | if (chip == NULL) |
| @@ -408,8 +404,13 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev, | |||
| 408 | } | 404 | } |
| 409 | chip->irq_base = irq_base; | 405 | chip->irq_base = irq_base; |
| 410 | 406 | ||
| 407 | /* Mask all interrupts, but enable them */ | ||
| 408 | msk = (1 << gpio_pins[chip->ioh]) - 1; | ||
| 409 | iowrite32(msk, &chip->reg->imask); | ||
| 410 | iowrite32(msk, &chip->reg->ien); | ||
| 411 | |||
| 411 | ret = request_irq(pdev->irq, pch_gpio_handler, | 412 | ret = request_irq(pdev->irq, pch_gpio_handler, |
| 412 | IRQF_SHARED, KBUILD_MODNAME, chip); | 413 | IRQF_SHARED, KBUILD_MODNAME, chip); |
| 413 | if (ret != 0) { | 414 | if (ret != 0) { |
| 414 | dev_err(&pdev->dev, | 415 | dev_err(&pdev->dev, |
| 415 | "%s request_irq failed\n", __func__); | 416 | "%s request_irq failed\n", __func__); |
| @@ -418,8 +419,6 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev, | |||
| 418 | 419 | ||
| 419 | pch_gpio_alloc_generic_chip(chip, irq_base, gpio_pins[chip->ioh]); | 420 | pch_gpio_alloc_generic_chip(chip, irq_base, gpio_pins[chip->ioh]); |
| 420 | 421 | ||
| 421 | /* Initialize interrupt ien register */ | ||
| 422 | iowrite32(0, &chip->reg->ien); | ||
| 423 | end: | 422 | end: |
| 424 | return 0; | 423 | return 0; |
| 425 | 424 | ||
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 19d6fc0229c3..e991d9171961 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
| @@ -452,12 +452,14 @@ static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = { | |||
| 452 | }; | 452 | }; |
| 453 | #endif | 453 | #endif |
| 454 | 454 | ||
| 455 | #if defined(CONFIG_ARCH_EXYNOS4) || defined(CONFIG_ARCH_EXYNOS5) | ||
| 455 | static struct samsung_gpio_cfg exynos_gpio_cfg = { | 456 | static struct samsung_gpio_cfg exynos_gpio_cfg = { |
| 456 | .set_pull = exynos_gpio_setpull, | 457 | .set_pull = exynos_gpio_setpull, |
| 457 | .get_pull = exynos_gpio_getpull, | 458 | .get_pull = exynos_gpio_getpull, |
| 458 | .set_config = samsung_gpio_setcfg_4bit, | 459 | .set_config = samsung_gpio_setcfg_4bit, |
| 459 | .get_config = samsung_gpio_getcfg_4bit, | 460 | .get_config = samsung_gpio_getcfg_4bit, |
| 460 | }; | 461 | }; |
| 462 | #endif | ||
| 461 | 463 | ||
| 462 | #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) | 464 | #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) |
| 463 | static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { | 465 | static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { |
| @@ -2123,8 +2125,8 @@ static struct samsung_gpio_chip s5pv210_gpios_4bit[] = { | |||
| 2123 | * uses the above macro and depends on the banks being listed in order here. | 2125 | * uses the above macro and depends on the banks being listed in order here. |
| 2124 | */ | 2126 | */ |
| 2125 | 2127 | ||
| 2126 | static struct samsung_gpio_chip exynos4_gpios_1[] = { | ||
| 2127 | #ifdef CONFIG_ARCH_EXYNOS4 | 2128 | #ifdef CONFIG_ARCH_EXYNOS4 |
| 2129 | static struct samsung_gpio_chip exynos4_gpios_1[] = { | ||
| 2128 | { | 2130 | { |
| 2129 | .chip = { | 2131 | .chip = { |
| 2130 | .base = EXYNOS4_GPA0(0), | 2132 | .base = EXYNOS4_GPA0(0), |
| @@ -2222,11 +2224,11 @@ static struct samsung_gpio_chip exynos4_gpios_1[] = { | |||
| 2222 | .label = "GPF3", | 2224 | .label = "GPF3", |
| 2223 | }, | 2225 | }, |
| 2224 | }, | 2226 | }, |
| 2225 | #endif | ||
| 2226 | }; | 2227 | }; |
| 2228 | #endif | ||
| 2227 | 2229 | ||
| 2228 | static struct samsung_gpio_chip exynos4_gpios_2[] = { | ||
| 2229 | #ifdef CONFIG_ARCH_EXYNOS4 | 2230 | #ifdef CONFIG_ARCH_EXYNOS4 |
| 2231 | static struct samsung_gpio_chip exynos4_gpios_2[] = { | ||
| 2230 | { | 2232 | { |
| 2231 | .chip = { | 2233 | .chip = { |
| 2232 | .base = EXYNOS4_GPJ0(0), | 2234 | .base = EXYNOS4_GPJ0(0), |
| @@ -2367,11 +2369,11 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = { | |||
| 2367 | .to_irq = samsung_gpiolib_to_irq, | 2369 | .to_irq = samsung_gpiolib_to_irq, |
| 2368 | }, | 2370 | }, |
| 2369 | }, | 2371 | }, |
| 2370 | #endif | ||
| 2371 | }; | 2372 | }; |
| 2373 | #endif | ||
| 2372 | 2374 | ||
| 2373 | static struct samsung_gpio_chip exynos4_gpios_3[] = { | ||
| 2374 | #ifdef CONFIG_ARCH_EXYNOS4 | 2375 | #ifdef CONFIG_ARCH_EXYNOS4 |
| 2376 | static struct samsung_gpio_chip exynos4_gpios_3[] = { | ||
| 2375 | { | 2377 | { |
| 2376 | .chip = { | 2378 | .chip = { |
| 2377 | .base = EXYNOS4_GPZ(0), | 2379 | .base = EXYNOS4_GPZ(0), |
| @@ -2379,8 +2381,8 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { | |||
| 2379 | .label = "GPZ", | 2381 | .label = "GPZ", |
| 2380 | }, | 2382 | }, |
| 2381 | }, | 2383 | }, |
| 2382 | #endif | ||
| 2383 | }; | 2384 | }; |
| 2385 | #endif | ||
| 2384 | 2386 | ||
| 2385 | #ifdef CONFIG_ARCH_EXYNOS5 | 2387 | #ifdef CONFIG_ARCH_EXYNOS5 |
| 2386 | static struct samsung_gpio_chip exynos5_gpios_1[] = { | 2388 | static struct samsung_gpio_chip exynos5_gpios_1[] = { |
| @@ -2719,7 +2721,9 @@ static __init int samsung_gpiolib_init(void) | |||
| 2719 | { | 2721 | { |
| 2720 | struct samsung_gpio_chip *chip; | 2722 | struct samsung_gpio_chip *chip; |
| 2721 | int i, nr_chips; | 2723 | int i, nr_chips; |
| 2724 | #if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250) | ||
| 2722 | void __iomem *gpio_base1, *gpio_base2, *gpio_base3, *gpio_base4; | 2725 | void __iomem *gpio_base1, *gpio_base2, *gpio_base3, *gpio_base4; |
| 2726 | #endif | ||
| 2723 | int group = 0; | 2727 | int group = 0; |
| 2724 | 2728 | ||
| 2725 | samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs)); | 2729 | samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs)); |
| @@ -2971,6 +2975,7 @@ static __init int samsung_gpiolib_init(void) | |||
| 2971 | 2975 | ||
| 2972 | return 0; | 2976 | return 0; |
| 2973 | 2977 | ||
| 2978 | #if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250) | ||
| 2974 | err_ioremap4: | 2979 | err_ioremap4: |
| 2975 | iounmap(gpio_base3); | 2980 | iounmap(gpio_base3); |
| 2976 | err_ioremap3: | 2981 | err_ioremap3: |
| @@ -2979,6 +2984,7 @@ err_ioremap2: | |||
| 2979 | iounmap(gpio_base1); | 2984 | iounmap(gpio_base1); |
| 2980 | err_ioremap1: | 2985 | err_ioremap1: |
| 2981 | return -ENOMEM; | 2986 | return -ENOMEM; |
| 2987 | #endif | ||
| 2982 | } | 2988 | } |
| 2983 | core_initcall(samsung_gpiolib_init); | 2989 | core_initcall(samsung_gpiolib_init); |
| 2984 | 2990 | ||
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index b505b70dba05..e6162a1681f0 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
| @@ -1224,6 +1224,9 @@ static int i915_emon_status(struct seq_file *m, void *unused) | |||
| 1224 | unsigned long temp, chipset, gfx; | 1224 | unsigned long temp, chipset, gfx; |
| 1225 | int ret; | 1225 | int ret; |
| 1226 | 1226 | ||
| 1227 | if (!IS_GEN5(dev)) | ||
| 1228 | return -ENODEV; | ||
| 1229 | |||
| 1227 | ret = mutex_lock_interruptible(&dev->struct_mutex); | 1230 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
| 1228 | if (ret) | 1231 | if (ret) |
| 1229 | return ret; | 1232 | return ret; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 785f67f963ef..ba60f3c8f911 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
| @@ -1701,6 +1701,9 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv) | |||
| 1701 | unsigned long diffms; | 1701 | unsigned long diffms; |
| 1702 | u32 count; | 1702 | u32 count; |
| 1703 | 1703 | ||
| 1704 | if (dev_priv->info->gen != 5) | ||
| 1705 | return; | ||
| 1706 | |||
| 1704 | getrawmonotonic(&now); | 1707 | getrawmonotonic(&now); |
| 1705 | diff1 = timespec_sub(now, dev_priv->last_time2); | 1708 | diff1 = timespec_sub(now, dev_priv->last_time2); |
| 1706 | 1709 | ||
| @@ -2121,12 +2124,14 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
| 2121 | setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, | 2124 | setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, |
| 2122 | (unsigned long) dev); | 2125 | (unsigned long) dev); |
| 2123 | 2126 | ||
| 2124 | spin_lock(&mchdev_lock); | 2127 | if (IS_GEN5(dev)) { |
| 2125 | i915_mch_dev = dev_priv; | 2128 | spin_lock(&mchdev_lock); |
| 2126 | dev_priv->mchdev_lock = &mchdev_lock; | 2129 | i915_mch_dev = dev_priv; |
| 2127 | spin_unlock(&mchdev_lock); | 2130 | dev_priv->mchdev_lock = &mchdev_lock; |
| 2131 | spin_unlock(&mchdev_lock); | ||
| 2128 | 2132 | ||
| 2129 | ips_ping_for_i915_load(); | 2133 | ips_ping_for_i915_load(); |
| 2134 | } | ||
| 2130 | 2135 | ||
| 2131 | return 0; | 2136 | return 0; |
| 2132 | 2137 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5908cd563400..1b1cf3b3ff51 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -7072,9 +7072,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
| 7072 | struct drm_device *dev = crtc->dev; | 7072 | struct drm_device *dev = crtc->dev; |
| 7073 | drm_i915_private_t *dev_priv = dev->dev_private; | 7073 | drm_i915_private_t *dev_priv = dev->dev_private; |
| 7074 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 7074 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 7075 | int pipe = intel_crtc->pipe; | ||
| 7076 | int dpll_reg = DPLL(pipe); | ||
| 7077 | int dpll = I915_READ(dpll_reg); | ||
| 7078 | 7075 | ||
| 7079 | if (HAS_PCH_SPLIT(dev)) | 7076 | if (HAS_PCH_SPLIT(dev)) |
| 7080 | return; | 7077 | return; |
| @@ -7087,10 +7084,15 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
| 7087 | * the manual case. | 7084 | * the manual case. |
| 7088 | */ | 7085 | */ |
| 7089 | if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) { | 7086 | if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) { |
| 7087 | int pipe = intel_crtc->pipe; | ||
| 7088 | int dpll_reg = DPLL(pipe); | ||
| 7089 | u32 dpll; | ||
| 7090 | |||
| 7090 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); | 7091 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); |
| 7091 | 7092 | ||
| 7092 | assert_panel_unlocked(dev_priv, pipe); | 7093 | assert_panel_unlocked(dev_priv, pipe); |
| 7093 | 7094 | ||
| 7095 | dpll = I915_READ(dpll_reg); | ||
| 7094 | dpll |= DISPLAY_RATE_SELECT_FPA1; | 7096 | dpll |= DISPLAY_RATE_SELECT_FPA1; |
| 7095 | I915_WRITE(dpll_reg, dpll); | 7097 | I915_WRITE(dpll_reg, dpll); |
| 7096 | intel_wait_for_vblank(dev, pipe); | 7098 | intel_wait_for_vblank(dev, pipe); |
| @@ -7098,7 +7100,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
| 7098 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) | 7100 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) |
| 7099 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); | 7101 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); |
| 7100 | } | 7102 | } |
| 7101 | |||
| 7102 | } | 7103 | } |
| 7103 | 7104 | ||
| 7104 | /** | 7105 | /** |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index cae3e5f17a49..2d7f47b56b6a 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
| @@ -136,7 +136,7 @@ static void i9xx_write_infoframe(struct drm_encoder *encoder, | |||
| 136 | 136 | ||
| 137 | val &= ~VIDEO_DIP_SELECT_MASK; | 137 | val &= ~VIDEO_DIP_SELECT_MASK; |
| 138 | 138 | ||
| 139 | I915_WRITE(VIDEO_DIP_CTL, val | port | flags); | 139 | I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); |
| 140 | 140 | ||
| 141 | for (i = 0; i < len; i += 4) { | 141 | for (i = 0; i < len; i += 4) { |
| 142 | I915_WRITE(VIDEO_DIP_DATA, *data); | 142 | I915_WRITE(VIDEO_DIP_DATA, *data); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 30e2c82101de..9c71183629c2 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
| @@ -750,7 +750,7 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
| 750 | .ident = "Hewlett-Packard t5745", | 750 | .ident = "Hewlett-Packard t5745", |
| 751 | .matches = { | 751 | .matches = { |
| 752 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 752 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
| 753 | DMI_MATCH(DMI_BOARD_NAME, "hp t5745"), | 753 | DMI_MATCH(DMI_PRODUCT_NAME, "hp t5745"), |
| 754 | }, | 754 | }, |
| 755 | }, | 755 | }, |
| 756 | { | 756 | { |
| @@ -758,7 +758,7 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
| 758 | .ident = "Hewlett-Packard st5747", | 758 | .ident = "Hewlett-Packard st5747", |
| 759 | .matches = { | 759 | .matches = { |
| 760 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 760 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
| 761 | DMI_MATCH(DMI_BOARD_NAME, "hp st5747"), | 761 | DMI_MATCH(DMI_PRODUCT_NAME, "hp st5747"), |
| 762 | }, | 762 | }, |
| 763 | }, | 763 | }, |
| 764 | { | 764 | { |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 80fce51e2f43..62892a826ede 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
| @@ -398,10 +398,8 @@ static int init_render_ring(struct intel_ring_buffer *ring) | |||
| 398 | return ret; | 398 | return ret; |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | if (INTEL_INFO(dev)->gen >= 6) { | ||
| 402 | I915_WRITE(INSTPM, | ||
| 403 | INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING); | ||
| 404 | 401 | ||
| 402 | if (IS_GEN6(dev)) { | ||
| 405 | /* From the Sandybridge PRM, volume 1 part 3, page 24: | 403 | /* From the Sandybridge PRM, volume 1 part 3, page 24: |
| 406 | * "If this bit is set, STCunit will have LRA as replacement | 404 | * "If this bit is set, STCunit will have LRA as replacement |
| 407 | * policy. [...] This bit must be reset. LRA replacement | 405 | * policy. [...] This bit must be reset. LRA replacement |
| @@ -411,6 +409,11 @@ static int init_render_ring(struct intel_ring_buffer *ring) | |||
| 411 | CM0_STC_EVICT_DISABLE_LRA_SNB << CM0_MASK_SHIFT); | 409 | CM0_STC_EVICT_DISABLE_LRA_SNB << CM0_MASK_SHIFT); |
| 412 | } | 410 | } |
| 413 | 411 | ||
| 412 | if (INTEL_INFO(dev)->gen >= 6) { | ||
| 413 | I915_WRITE(INSTPM, | ||
| 414 | INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING); | ||
| 415 | } | ||
| 416 | |||
| 414 | return ret; | 417 | return ret; |
| 415 | } | 418 | } |
| 416 | 419 | ||
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 232d77d07d8b..ae5e748f39bb 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
| @@ -1220,8 +1220,14 @@ static bool intel_sdvo_get_capabilities(struct intel_sdvo *intel_sdvo, struct in | |||
| 1220 | 1220 | ||
| 1221 | static int intel_sdvo_supports_hotplug(struct intel_sdvo *intel_sdvo) | 1221 | static int intel_sdvo_supports_hotplug(struct intel_sdvo *intel_sdvo) |
| 1222 | { | 1222 | { |
| 1223 | struct drm_device *dev = intel_sdvo->base.base.dev; | ||
| 1223 | u8 response[2]; | 1224 | u8 response[2]; |
| 1224 | 1225 | ||
| 1226 | /* HW Erratum: SDVO Hotplug is broken on all i945G chips, there's noise | ||
| 1227 | * on the line. */ | ||
| 1228 | if (IS_I945G(dev) || IS_I945GM(dev)) | ||
| 1229 | return false; | ||
| 1230 | |||
| 1225 | return intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT, | 1231 | return intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT, |
| 1226 | &response, 2) && response[0]; | 1232 | &response, 2) && response[0]; |
| 1227 | } | 1233 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 7814a760c164..284bd25d5d21 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
| @@ -270,7 +270,7 @@ static bool nouveau_dsm_detect(void) | |||
| 270 | struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name}; | 270 | struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name}; |
| 271 | struct pci_dev *pdev = NULL; | 271 | struct pci_dev *pdev = NULL; |
| 272 | int has_dsm = 0; | 272 | int has_dsm = 0; |
| 273 | int has_optimus; | 273 | int has_optimus = 0; |
| 274 | int vga_count = 0; | 274 | int vga_count = 0; |
| 275 | bool guid_valid; | 275 | bool guid_valid; |
| 276 | int retval; | 276 | int retval; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 80963d05b54a..0be4a815e706 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
| @@ -6156,10 +6156,14 @@ dcb_fake_connectors(struct nvbios *bios) | |||
| 6156 | 6156 | ||
| 6157 | /* heuristic: if we ever get a non-zero connector field, assume | 6157 | /* heuristic: if we ever get a non-zero connector field, assume |
| 6158 | * that all the indices are valid and we don't need fake them. | 6158 | * that all the indices are valid and we don't need fake them. |
| 6159 | * | ||
| 6160 | * and, as usual, a blacklist of boards with bad bios data.. | ||
| 6159 | */ | 6161 | */ |
| 6160 | for (i = 0; i < dcbt->entries; i++) { | 6162 | if (!nv_match_device(bios->dev, 0x0392, 0x107d, 0x20a2)) { |
| 6161 | if (dcbt->entry[i].connector) | 6163 | for (i = 0; i < dcbt->entries; i++) { |
| 6162 | return; | 6164 | if (dcbt->entry[i].connector) |
| 6165 | return; | ||
| 6166 | } | ||
| 6163 | } | 6167 | } |
| 6164 | 6168 | ||
| 6165 | /* no useful connector info available, we need to make it up | 6169 | /* no useful connector info available, we need to make it up |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hdmi.c b/drivers/gpu/drm/nouveau/nouveau_hdmi.c index 59ea1c14eca0..c3de36384522 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hdmi.c +++ b/drivers/gpu/drm/nouveau/nouveau_hdmi.c | |||
| @@ -32,7 +32,9 @@ static bool | |||
| 32 | hdmi_sor(struct drm_encoder *encoder) | 32 | hdmi_sor(struct drm_encoder *encoder) |
| 33 | { | 33 | { |
| 34 | struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; | 34 | struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; |
| 35 | if (dev_priv->chipset < 0xa3) | 35 | if (dev_priv->chipset < 0xa3 || |
| 36 | dev_priv->chipset == 0xaa || | ||
| 37 | dev_priv->chipset == 0xac) | ||
| 36 | return false; | 38 | return false; |
| 37 | return true; | 39 | return true; |
| 38 | } | 40 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_i2c.c b/drivers/gpu/drm/nouveau/nouveau_i2c.c index e2be95af2e52..77e564667b5c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_i2c.c +++ b/drivers/gpu/drm/nouveau/nouveau_i2c.c | |||
| @@ -29,10 +29,6 @@ | |||
| 29 | #include "nouveau_i2c.h" | 29 | #include "nouveau_i2c.h" |
| 30 | #include "nouveau_hw.h" | 30 | #include "nouveau_hw.h" |
| 31 | 31 | ||
| 32 | #define T_TIMEOUT 2200000 | ||
| 33 | #define T_RISEFALL 1000 | ||
| 34 | #define T_HOLD 5000 | ||
| 35 | |||
| 36 | static void | 32 | static void |
| 37 | i2c_drive_scl(void *data, int state) | 33 | i2c_drive_scl(void *data, int state) |
| 38 | { | 34 | { |
| @@ -113,175 +109,6 @@ i2c_sense_sda(void *data) | |||
| 113 | return 0; | 109 | return 0; |
| 114 | } | 110 | } |
| 115 | 111 | ||
| 116 | static void | ||
| 117 | i2c_delay(struct nouveau_i2c_chan *port, u32 nsec) | ||
| 118 | { | ||
| 119 | udelay((nsec + 500) / 1000); | ||
| 120 | } | ||
| 121 | |||
| 122 | static bool | ||
| 123 | i2c_raise_scl(struct nouveau_i2c_chan *port) | ||
| 124 | { | ||
| 125 | u32 timeout = T_TIMEOUT / T_RISEFALL; | ||
| 126 | |||
| 127 | i2c_drive_scl(port, 1); | ||
| 128 | do { | ||
| 129 | i2c_delay(port, T_RISEFALL); | ||
| 130 | } while (!i2c_sense_scl(port) && --timeout); | ||
| 131 | |||
| 132 | return timeout != 0; | ||
| 133 | } | ||
| 134 | |||
| 135 | static int | ||
| 136 | i2c_start(struct nouveau_i2c_chan *port) | ||
| 137 | { | ||
| 138 | int ret = 0; | ||
| 139 | |||
| 140 | port->state = i2c_sense_scl(port); | ||
| 141 | port->state |= i2c_sense_sda(port) << 1; | ||
| 142 | if (port->state != 3) { | ||
| 143 | i2c_drive_scl(port, 0); | ||
| 144 | i2c_drive_sda(port, 1); | ||
| 145 | if (!i2c_raise_scl(port)) | ||
| 146 | ret = -EBUSY; | ||
| 147 | } | ||
| 148 | |||
| 149 | i2c_drive_sda(port, 0); | ||
| 150 | i2c_delay(port, T_HOLD); | ||
| 151 | i2c_drive_scl(port, 0); | ||
| 152 | i2c_delay(port, T_HOLD); | ||
| 153 | return ret; | ||
| 154 | } | ||
| 155 | |||
| 156 | static void | ||
| 157 | i2c_stop(struct nouveau_i2c_chan *port) | ||
| 158 | { | ||
| 159 | i2c_drive_scl(port, 0); | ||
| 160 | i2c_drive_sda(port, 0); | ||
| 161 | i2c_delay(port, T_RISEFALL); | ||
| 162 | |||
| 163 | i2c_drive_scl(port, 1); | ||
| 164 | i2c_delay(port, T_HOLD); | ||
| 165 | i2c_drive_sda(port, 1); | ||
| 166 | i2c_delay(port, T_HOLD); | ||
| 167 | } | ||
| 168 | |||
| 169 | static int | ||
| 170 | i2c_bitw(struct nouveau_i2c_chan *port, int sda) | ||
| 171 | { | ||
| 172 | i2c_drive_sda(port, sda); | ||
| 173 | i2c_delay(port, T_RISEFALL); | ||
| 174 | |||
| 175 | if (!i2c_raise_scl(port)) | ||
| 176 | return -ETIMEDOUT; | ||
| 177 | i2c_delay(port, T_HOLD); | ||
| 178 | |||
| 179 | i2c_drive_scl(port, 0); | ||
| 180 | i2c_delay(port, T_HOLD); | ||
| 181 | return 0; | ||
| 182 | } | ||
| 183 | |||
| 184 | static int | ||
| 185 | i2c_bitr(struct nouveau_i2c_chan *port) | ||
| 186 | { | ||
| 187 | int sda; | ||
| 188 | |||
| 189 | i2c_drive_sda(port, 1); | ||
| 190 | i2c_delay(port, T_RISEFALL); | ||
| 191 | |||
| 192 | if (!i2c_raise_scl(port)) | ||
| 193 | return -ETIMEDOUT; | ||
| 194 | i2c_delay(port, T_HOLD); | ||
| 195 | |||
| 196 | sda = i2c_sense_sda(port); | ||
| 197 | |||
| 198 | i2c_drive_scl(port, 0); | ||
| 199 | i2c_delay(port, T_HOLD); | ||
| 200 | return sda; | ||
| 201 | } | ||
| 202 | |||
| 203 | static int | ||
| 204 | i2c_get_byte(struct nouveau_i2c_chan *port, u8 *byte, bool last) | ||
| 205 | { | ||
| 206 | int i, bit; | ||
| 207 | |||
| 208 | *byte = 0; | ||
| 209 | for (i = 7; i >= 0; i--) { | ||
| 210 | bit = i2c_bitr(port); | ||
| 211 | if (bit < 0) | ||
| 212 | return bit; | ||
| 213 | *byte |= bit << i; | ||
| 214 | } | ||
| 215 | |||
| 216 | return i2c_bitw(port, last ? 1 : 0); | ||
| 217 | } | ||
| 218 | |||
| 219 | static int | ||
| 220 | i2c_put_byte(struct nouveau_i2c_chan *port, u8 byte) | ||
| 221 | { | ||
| 222 | int i, ret; | ||
| 223 | for (i = 7; i >= 0; i--) { | ||
| 224 | ret = i2c_bitw(port, !!(byte & (1 << i))); | ||
| 225 | if (ret < 0) | ||
| 226 | return ret; | ||
| 227 | } | ||
| 228 | |||
| 229 | ret = i2c_bitr(port); | ||
| 230 | if (ret == 1) /* nack */ | ||
| 231 | ret = -EIO; | ||
| 232 | return ret; | ||
| 233 | } | ||
| 234 | |||
| 235 | static int | ||
| 236 | i2c_addr(struct nouveau_i2c_chan *port, struct i2c_msg *msg) | ||
| 237 | { | ||
| 238 | u32 addr = msg->addr << 1; | ||
| 239 | if (msg->flags & I2C_M_RD) | ||
| 240 | addr |= 1; | ||
| 241 | return i2c_put_byte(port, addr); | ||
| 242 | } | ||
| 243 | |||
| 244 | static int | ||
| 245 | i2c_bit_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | ||
| 246 | { | ||
| 247 | struct nouveau_i2c_chan *port = (struct nouveau_i2c_chan *)adap; | ||
| 248 | struct i2c_msg *msg = msgs; | ||
| 249 | int ret = 0, mcnt = num; | ||
| 250 | |||
| 251 | while (!ret && mcnt--) { | ||
| 252 | u8 remaining = msg->len; | ||
| 253 | u8 *ptr = msg->buf; | ||
| 254 | |||
| 255 | ret = i2c_start(port); | ||
| 256 | if (ret == 0) | ||
| 257 | ret = i2c_addr(port, msg); | ||
| 258 | |||
| 259 | if (msg->flags & I2C_M_RD) { | ||
| 260 | while (!ret && remaining--) | ||
| 261 | ret = i2c_get_byte(port, ptr++, !remaining); | ||
| 262 | } else { | ||
| 263 | while (!ret && remaining--) | ||
| 264 | ret = i2c_put_byte(port, *ptr++); | ||
| 265 | } | ||
| 266 | |||
| 267 | msg++; | ||
| 268 | } | ||
| 269 | |||
| 270 | i2c_stop(port); | ||
| 271 | return (ret < 0) ? ret : num; | ||
| 272 | } | ||
| 273 | |||
| 274 | static u32 | ||
| 275 | i2c_bit_func(struct i2c_adapter *adap) | ||
| 276 | { | ||
| 277 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | ||
| 278 | } | ||
| 279 | |||
| 280 | const struct i2c_algorithm nouveau_i2c_bit_algo = { | ||
| 281 | .master_xfer = i2c_bit_xfer, | ||
| 282 | .functionality = i2c_bit_func | ||
| 283 | }; | ||
| 284 | |||
| 285 | static const uint32_t nv50_i2c_port[] = { | 112 | static const uint32_t nv50_i2c_port[] = { |
| 286 | 0x00e138, 0x00e150, 0x00e168, 0x00e180, | 113 | 0x00e138, 0x00e150, 0x00e168, 0x00e180, |
| 287 | 0x00e254, 0x00e274, 0x00e764, 0x00e780, | 114 | 0x00e254, 0x00e274, 0x00e764, 0x00e780, |
| @@ -384,12 +211,10 @@ nouveau_i2c_init(struct drm_device *dev) | |||
| 384 | case 0: /* NV04:NV50 */ | 211 | case 0: /* NV04:NV50 */ |
| 385 | port->drive = entry[0]; | 212 | port->drive = entry[0]; |
| 386 | port->sense = entry[1]; | 213 | port->sense = entry[1]; |
| 387 | port->adapter.algo = &nouveau_i2c_bit_algo; | ||
| 388 | break; | 214 | break; |
| 389 | case 4: /* NV4E */ | 215 | case 4: /* NV4E */ |
| 390 | port->drive = 0x600800 + entry[1]; | 216 | port->drive = 0x600800 + entry[1]; |
| 391 | port->sense = port->drive; | 217 | port->sense = port->drive; |
| 392 | port->adapter.algo = &nouveau_i2c_bit_algo; | ||
| 393 | break; | 218 | break; |
| 394 | case 5: /* NV50- */ | 219 | case 5: /* NV50- */ |
| 395 | port->drive = entry[0] & 0x0f; | 220 | port->drive = entry[0] & 0x0f; |
| @@ -402,7 +227,6 @@ nouveau_i2c_init(struct drm_device *dev) | |||
| 402 | port->drive = 0x00d014 + (port->drive * 0x20); | 227 | port->drive = 0x00d014 + (port->drive * 0x20); |
| 403 | port->sense = port->drive; | 228 | port->sense = port->drive; |
| 404 | } | 229 | } |
| 405 | port->adapter.algo = &nouveau_i2c_bit_algo; | ||
| 406 | break; | 230 | break; |
| 407 | case 6: /* NV50- DP AUX */ | 231 | case 6: /* NV50- DP AUX */ |
| 408 | port->drive = entry[0]; | 232 | port->drive = entry[0]; |
| @@ -413,7 +237,7 @@ nouveau_i2c_init(struct drm_device *dev) | |||
| 413 | break; | 237 | break; |
| 414 | } | 238 | } |
| 415 | 239 | ||
| 416 | if (!port->adapter.algo) { | 240 | if (!port->adapter.algo && !port->drive) { |
| 417 | NV_ERROR(dev, "I2C%d: type %d index %x/%x unknown\n", | 241 | NV_ERROR(dev, "I2C%d: type %d index %x/%x unknown\n", |
| 418 | i, port->type, port->drive, port->sense); | 242 | i, port->type, port->drive, port->sense); |
| 419 | kfree(port); | 243 | kfree(port); |
| @@ -429,7 +253,26 @@ nouveau_i2c_init(struct drm_device *dev) | |||
| 429 | port->dcb = ROM32(entry[0]); | 253 | port->dcb = ROM32(entry[0]); |
| 430 | i2c_set_adapdata(&port->adapter, i2c); | 254 | i2c_set_adapdata(&port->adapter, i2c); |
| 431 | 255 | ||
| 432 | ret = i2c_add_adapter(&port->adapter); | 256 | if (port->adapter.algo != &nouveau_dp_i2c_algo) { |
| 257 | port->adapter.algo_data = &port->bit; | ||
| 258 | port->bit.udelay = 10; | ||
| 259 | port->bit.timeout = usecs_to_jiffies(2200); | ||
| 260 | port->bit.data = port; | ||
| 261 | port->bit.setsda = i2c_drive_sda; | ||
| 262 | port->bit.setscl = i2c_drive_scl; | ||
| 263 | port->bit.getsda = i2c_sense_sda; | ||
| 264 | port->bit.getscl = i2c_sense_scl; | ||
| 265 | |||
| 266 | i2c_drive_scl(port, 0); | ||
| 267 | i2c_drive_sda(port, 1); | ||
| 268 | i2c_drive_scl(port, 1); | ||
| 269 | |||
| 270 | ret = i2c_bit_add_bus(&port->adapter); | ||
| 271 | } else { | ||
| 272 | port->adapter.algo = &nouveau_dp_i2c_algo; | ||
| 273 | ret = i2c_add_adapter(&port->adapter); | ||
| 274 | } | ||
| 275 | |||
| 433 | if (ret) { | 276 | if (ret) { |
| 434 | NV_ERROR(dev, "I2C%d: failed register: %d\n", i, ret); | 277 | NV_ERROR(dev, "I2C%d: failed register: %d\n", i, ret); |
| 435 | kfree(port); | 278 | kfree(port); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_i2c.h b/drivers/gpu/drm/nouveau/nouveau_i2c.h index 4d2e4e9031be..1d083893a4d7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_i2c.h +++ b/drivers/gpu/drm/nouveau/nouveau_i2c.h | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | struct nouveau_i2c_chan { | 34 | struct nouveau_i2c_chan { |
| 35 | struct i2c_adapter adapter; | 35 | struct i2c_adapter adapter; |
| 36 | struct drm_device *dev; | 36 | struct drm_device *dev; |
| 37 | struct i2c_algo_bit_data bit; | ||
| 37 | struct list_head head; | 38 | struct list_head head; |
| 38 | u8 index; | 39 | u8 index; |
| 39 | u8 type; | 40 | u8 type; |
diff --git a/drivers/gpu/drm/nouveau/nv10_gpio.c b/drivers/gpu/drm/nouveau/nv10_gpio.c index 550ad3fcf0af..9d79180069df 100644 --- a/drivers/gpu/drm/nouveau/nv10_gpio.c +++ b/drivers/gpu/drm/nouveau/nv10_gpio.c | |||
| @@ -65,7 +65,7 @@ nv10_gpio_drive(struct drm_device *dev, int line, int dir, int out) | |||
| 65 | if (line < 10) { | 65 | if (line < 10) { |
| 66 | line = (line - 2) * 4; | 66 | line = (line - 2) * 4; |
| 67 | reg = NV_PCRTC_GPIO_EXT; | 67 | reg = NV_PCRTC_GPIO_EXT; |
| 68 | mask = 0x00000003 << ((line - 2) * 4); | 68 | mask = 0x00000003; |
| 69 | data = (dir << 1) | out; | 69 | data = (dir << 1) | out; |
| 70 | } else | 70 | } else |
| 71 | if (line < 14) { | 71 | if (line < 14) { |
diff --git a/drivers/gpu/drm/nouveau/nvc0_fb.c b/drivers/gpu/drm/nouveau/nvc0_fb.c index 5bf55038fd92..f704e942372e 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fb.c +++ b/drivers/gpu/drm/nouveau/nvc0_fb.c | |||
| @@ -54,6 +54,11 @@ nvc0_mfb_isr(struct drm_device *dev) | |||
| 54 | nvc0_mfb_subp_isr(dev, unit, subp); | 54 | nvc0_mfb_subp_isr(dev, unit, subp); |
| 55 | units &= ~(1 << unit); | 55 | units &= ~(1 << unit); |
| 56 | } | 56 | } |
| 57 | |||
| 58 | /* we do something horribly wrong and upset PMFB a lot, so mask off | ||
| 59 | * interrupts from it after the first one until it's fixed | ||
| 60 | */ | ||
| 61 | nv_mask(dev, 0x000640, 0x02000000, 0x00000000); | ||
| 57 | } | 62 | } |
| 58 | 63 | ||
| 59 | static void | 64 | static void |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index ea7df16e2f84..5992502a3448 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
| @@ -241,8 +241,8 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
| 241 | rdev->wb.use_event = true; | 241 | rdev->wb.use_event = true; |
| 242 | } | 242 | } |
| 243 | } | 243 | } |
| 244 | /* always use writeback/events on NI */ | 244 | /* always use writeback/events on NI, APUs */ |
| 245 | if (ASIC_IS_DCE5(rdev)) { | 245 | if (rdev->family >= CHIP_PALM) { |
| 246 | rdev->wb.enabled = true; | 246 | rdev->wb.enabled = true; |
| 247 | rdev->wb.use_event = true; | 247 | rdev->wb.use_event = true; |
| 248 | } | 248 | } |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0d3141fbbc20..b9d512331ed4 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -52,7 +52,7 @@ module_param_named(tjmax, force_tjmax, int, 0444); | |||
| 52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); | 52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); |
| 53 | 53 | ||
| 54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ | 54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ |
| 55 | #define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ | 55 | #define NUM_REAL_CORES 32 /* Number of Real cores per cpu */ |
| 56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ | 56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ |
| 57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ | 57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ |
| 58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) | 58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) |
| @@ -709,6 +709,10 @@ static void __cpuinit put_core_offline(unsigned int cpu) | |||
| 709 | 709 | ||
| 710 | indx = TO_ATTR_NO(cpu); | 710 | indx = TO_ATTR_NO(cpu); |
| 711 | 711 | ||
| 712 | /* The core id is too big, just return */ | ||
| 713 | if (indx > MAX_CORE_DATA - 1) | ||
| 714 | return; | ||
| 715 | |||
| 712 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) | 716 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) |
| 713 | coretemp_remove_core(pdata, &pdev->dev, indx); | 717 | coretemp_remove_core(pdata, &pdev->dev, indx); |
| 714 | 718 | ||
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index f086131cb1c7..c811289b61e2 100644 --- a/drivers/i2c/busses/i2c-eg20t.c +++ b/drivers/i2c/busses/i2c-eg20t.c | |||
| @@ -324,7 +324,7 @@ static s32 pch_i2c_wait_for_xfer_complete(struct i2c_algo_pch_data *adap) | |||
| 324 | { | 324 | { |
| 325 | long ret; | 325 | long ret; |
| 326 | ret = wait_event_timeout(pch_event, | 326 | ret = wait_event_timeout(pch_event, |
| 327 | (adap->pch_event_flag != 0), msecs_to_jiffies(50)); | 327 | (adap->pch_event_flag != 0), msecs_to_jiffies(1000)); |
| 328 | 328 | ||
| 329 | if (ret == 0) { | 329 | if (ret == 0) { |
| 330 | pch_err(adap, "timeout: %x\n", adap->pch_event_flag); | 330 | pch_err(adap, "timeout: %x\n", adap->pch_event_flag); |
| @@ -1063,6 +1063,6 @@ module_exit(pch_pci_exit); | |||
| 1063 | 1063 | ||
| 1064 | MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semico ML7213/ML7223/ML7831 IOH I2C"); | 1064 | MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semico ML7213/ML7223/ML7831 IOH I2C"); |
| 1065 | MODULE_LICENSE("GPL"); | 1065 | MODULE_LICENSE("GPL"); |
| 1066 | MODULE_AUTHOR("Tomoya MORINAGA. <tomoya-linux@dsn.lapis-semi.com>"); | 1066 | MODULE_AUTHOR("Tomoya MORINAGA. <tomoya.rohm@gmail.com>"); |
| 1067 | module_param(pch_i2c_speed, int, (S_IRUSR | S_IWUSR)); | 1067 | module_param(pch_i2c_speed, int, (S_IRUSR | S_IWUSR)); |
| 1068 | module_param(pch_clk, int, (S_IRUSR | S_IWUSR)); | 1068 | module_param(pch_clk, int, (S_IRUSR | S_IWUSR)); |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 3d471d56bf15..76b8af44f634 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
| @@ -227,6 +227,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
| 227 | return -EINVAL; | 227 | return -EINVAL; |
| 228 | 228 | ||
| 229 | init_completion(&i2c->cmd_complete); | 229 | init_completion(&i2c->cmd_complete); |
| 230 | i2c->cmd_err = 0; | ||
| 230 | 231 | ||
| 231 | flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0; | 232 | flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0; |
| 232 | 233 | ||
| @@ -252,6 +253,9 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
| 252 | 253 | ||
| 253 | if (i2c->cmd_err == -ENXIO) | 254 | if (i2c->cmd_err == -ENXIO) |
| 254 | mxs_i2c_reset(i2c); | 255 | mxs_i2c_reset(i2c); |
| 256 | else | ||
| 257 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
| 258 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
| 255 | 259 | ||
| 256 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); | 260 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); |
| 257 | 261 | ||
| @@ -299,8 +303,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) | |||
| 299 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | MXS_I2C_CTRL1_SLAVE_IRQ)) | 303 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | MXS_I2C_CTRL1_SLAVE_IRQ)) |
| 300 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ | 304 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ |
| 301 | i2c->cmd_err = -EIO; | 305 | i2c->cmd_err = -EIO; |
| 302 | else | ||
| 303 | i2c->cmd_err = 0; | ||
| 304 | 306 | ||
| 305 | is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) & | 307 | is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) & |
| 306 | MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0; | 308 | MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0; |
| @@ -384,8 +386,6 @@ static int __devexit mxs_i2c_remove(struct platform_device *pdev) | |||
| 384 | if (ret) | 386 | if (ret) |
| 385 | return -EBUSY; | 387 | return -EBUSY; |
| 386 | 388 | ||
| 387 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
| 388 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
| 389 | writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET); | 389 | writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET); |
| 390 | 390 | ||
| 391 | platform_set_drvdata(pdev, NULL); | 391 | platform_set_drvdata(pdev, NULL); |
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 04be9f82e14b..eb8ad538c79f 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c | |||
| @@ -546,8 +546,7 @@ static int i2c_pnx_controller_suspend(struct platform_device *pdev, | |||
| 546 | { | 546 | { |
| 547 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); | 547 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); |
| 548 | 548 | ||
| 549 | /* FIXME: shouldn't this be clk_disable? */ | 549 | clk_disable(alg_data->clk); |
| 550 | clk_enable(alg_data->clk); | ||
| 551 | 550 | ||
| 552 | return 0; | 551 | return 0; |
| 553 | } | 552 | } |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index e978635e60f0..55e5ea62ccee 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
| @@ -516,6 +516,14 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, | |||
| 516 | if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) | 516 | if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) |
| 517 | return 0; | 517 | return 0; |
| 518 | 518 | ||
| 519 | /* | ||
| 520 | * NACK interrupt is generated before the I2C controller generates the | ||
| 521 | * STOP condition on the bus. So wait for 2 clock periods before resetting | ||
| 522 | * the controller so that STOP condition has been delivered properly. | ||
| 523 | */ | ||
| 524 | if (i2c_dev->msg_err == I2C_ERR_NO_ACK) | ||
| 525 | udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); | ||
| 526 | |||
| 519 | tegra_i2c_init(i2c_dev); | 527 | tegra_i2c_init(i2c_dev); |
| 520 | if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { | 528 | if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { |
| 521 | if (msg->flags & I2C_M_IGNORE_NAK) | 529 | if (msg->flags & I2C_M_IGNORE_NAK) |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 8081a0a5d602..a4b14a41cbf4 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -274,7 +274,8 @@ static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse) | |||
| 274 | static unsigned char param = 0xc8; | 274 | static unsigned char param = 0xc8; |
| 275 | struct synaptics_data *priv = psmouse->private; | 275 | struct synaptics_data *priv = psmouse->private; |
| 276 | 276 | ||
| 277 | if (!SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) | 277 | if (!(SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || |
| 278 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c))) | ||
| 278 | return 0; | 279 | return 0; |
| 279 | 280 | ||
| 280 | if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL)) | 281 | if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL)) |
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c index d8433f2d53bc..73973fdbd8be 100644 --- a/drivers/leds/leds-netxbig.c +++ b/drivers/leds/leds-netxbig.c | |||
| @@ -112,7 +112,7 @@ err_free_addr: | |||
| 112 | return err; | 112 | return err; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | static void __devexit gpio_ext_free(struct netxbig_gpio_ext *gpio_ext) | 115 | static void gpio_ext_free(struct netxbig_gpio_ext *gpio_ext) |
| 116 | { | 116 | { |
| 117 | int i; | 117 | int i; |
| 118 | 118 | ||
| @@ -294,7 +294,7 @@ static ssize_t netxbig_led_sata_show(struct device *dev, | |||
| 294 | 294 | ||
| 295 | static DEVICE_ATTR(sata, 0644, netxbig_led_sata_show, netxbig_led_sata_store); | 295 | static DEVICE_ATTR(sata, 0644, netxbig_led_sata_show, netxbig_led_sata_store); |
| 296 | 296 | ||
| 297 | static void __devexit delete_netxbig_led(struct netxbig_led_data *led_dat) | 297 | static void delete_netxbig_led(struct netxbig_led_data *led_dat) |
| 298 | { | 298 | { |
| 299 | if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) | 299 | if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) |
| 300 | device_remove_file(led_dat->cdev.dev, &dev_attr_sata); | 300 | device_remove_file(led_dat->cdev.dev, &dev_attr_sata); |
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 2f0a14421a73..01cf89ec6944 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c | |||
| @@ -255,7 +255,7 @@ err_free_cmd: | |||
| 255 | return ret; | 255 | return ret; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | static void __devexit delete_ns2_led(struct ns2_led_data *led_dat) | 258 | static void delete_ns2_led(struct ns2_led_data *led_dat) |
| 259 | { | 259 | { |
| 260 | device_remove_file(led_dat->cdev.dev, &dev_attr_sata); | 260 | device_remove_file(led_dat->cdev.dev, &dev_attr_sata); |
| 261 | led_classdev_unregister(&led_dat->cdev); | 261 | led_classdev_unregister(&led_dat->cdev); |
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c index 1f23e048f077..08d9a207259a 100644 --- a/drivers/md/dm-log-userspace-transfer.c +++ b/drivers/md/dm-log-userspace-transfer.c | |||
| @@ -134,7 +134,7 @@ static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) | |||
| 134 | { | 134 | { |
| 135 | struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1); | 135 | struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1); |
| 136 | 136 | ||
| 137 | if (!cap_raised(current_cap(), CAP_SYS_ADMIN)) | 137 | if (!capable(CAP_SYS_ADMIN)) |
| 138 | return; | 138 | return; |
| 139 | 139 | ||
| 140 | spin_lock(&receiving_list_lock); | 140 | spin_lock(&receiving_list_lock); |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 922a3385eead..754f38f8a692 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
| @@ -718,8 +718,8 @@ static int parse_hw_handler(struct dm_arg_set *as, struct multipath *m) | |||
| 718 | return 0; | 718 | return 0; |
| 719 | 719 | ||
| 720 | m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL); | 720 | m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL); |
| 721 | request_module("scsi_dh_%s", m->hw_handler_name); | 721 | if (!try_then_request_module(scsi_dh_handler_exist(m->hw_handler_name), |
| 722 | if (scsi_dh_handler_exist(m->hw_handler_name) == 0) { | 722 | "scsi_dh_%s", m->hw_handler_name)) { |
| 723 | ti->error = "unknown hardware handler type"; | 723 | ti->error = "unknown hardware handler type"; |
| 724 | ret = -EINVAL; | 724 | ret = -EINVAL; |
| 725 | goto fail; | 725 | goto fail; |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 213ae32a0fc4..2fd87b544a93 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -279,8 +279,10 @@ static void __cell_release(struct cell *cell, struct bio_list *inmates) | |||
| 279 | 279 | ||
| 280 | hlist_del(&cell->list); | 280 | hlist_del(&cell->list); |
| 281 | 281 | ||
| 282 | bio_list_add(inmates, cell->holder); | 282 | if (inmates) { |
| 283 | bio_list_merge(inmates, &cell->bios); | 283 | bio_list_add(inmates, cell->holder); |
| 284 | bio_list_merge(inmates, &cell->bios); | ||
| 285 | } | ||
| 284 | 286 | ||
| 285 | mempool_free(cell, prison->cell_pool); | 287 | mempool_free(cell, prison->cell_pool); |
| 286 | } | 288 | } |
| @@ -303,9 +305,10 @@ static void cell_release(struct cell *cell, struct bio_list *bios) | |||
| 303 | */ | 305 | */ |
| 304 | static void __cell_release_singleton(struct cell *cell, struct bio *bio) | 306 | static void __cell_release_singleton(struct cell *cell, struct bio *bio) |
| 305 | { | 307 | { |
| 306 | hlist_del(&cell->list); | ||
| 307 | BUG_ON(cell->holder != bio); | 308 | BUG_ON(cell->holder != bio); |
| 308 | BUG_ON(!bio_list_empty(&cell->bios)); | 309 | BUG_ON(!bio_list_empty(&cell->bios)); |
| 310 | |||
| 311 | __cell_release(cell, NULL); | ||
| 309 | } | 312 | } |
| 310 | 313 | ||
| 311 | static void cell_release_singleton(struct cell *cell, struct bio *bio) | 314 | static void cell_release_singleton(struct cell *cell, struct bio *bio) |
| @@ -1177,6 +1180,7 @@ static void no_space(struct cell *cell) | |||
| 1177 | static void process_discard(struct thin_c *tc, struct bio *bio) | 1180 | static void process_discard(struct thin_c *tc, struct bio *bio) |
| 1178 | { | 1181 | { |
| 1179 | int r; | 1182 | int r; |
| 1183 | unsigned long flags; | ||
| 1180 | struct pool *pool = tc->pool; | 1184 | struct pool *pool = tc->pool; |
| 1181 | struct cell *cell, *cell2; | 1185 | struct cell *cell, *cell2; |
| 1182 | struct cell_key key, key2; | 1186 | struct cell_key key, key2; |
| @@ -1218,7 +1222,9 @@ static void process_discard(struct thin_c *tc, struct bio *bio) | |||
| 1218 | m->bio = bio; | 1222 | m->bio = bio; |
| 1219 | 1223 | ||
| 1220 | if (!ds_add_work(&pool->all_io_ds, &m->list)) { | 1224 | if (!ds_add_work(&pool->all_io_ds, &m->list)) { |
| 1225 | spin_lock_irqsave(&pool->lock, flags); | ||
| 1221 | list_add(&m->list, &pool->prepared_discards); | 1226 | list_add(&m->list, &pool->prepared_discards); |
| 1227 | spin_unlock_irqrestore(&pool->lock, flags); | ||
| 1222 | wake_worker(pool); | 1228 | wake_worker(pool); |
| 1223 | } | 1229 | } |
| 1224 | } else { | 1230 | } else { |
| @@ -2626,8 +2632,10 @@ static int thin_endio(struct dm_target *ti, | |||
| 2626 | if (h->all_io_entry) { | 2632 | if (h->all_io_entry) { |
| 2627 | INIT_LIST_HEAD(&work); | 2633 | INIT_LIST_HEAD(&work); |
| 2628 | ds_dec(h->all_io_entry, &work); | 2634 | ds_dec(h->all_io_entry, &work); |
| 2635 | spin_lock_irqsave(&pool->lock, flags); | ||
| 2629 | list_for_each_entry_safe(m, tmp, &work, list) | 2636 | list_for_each_entry_safe(m, tmp, &work, list) |
| 2630 | list_add(&m->list, &pool->prepared_discards); | 2637 | list_add(&m->list, &pool->prepared_discards); |
| 2638 | spin_unlock_irqrestore(&pool->lock, flags); | ||
| 2631 | } | 2639 | } |
| 2632 | 2640 | ||
| 2633 | mempool_free(h, pool->endio_hook_pool); | 2641 | mempool_free(h, pool->endio_hook_pool); |
| @@ -2759,6 +2767,6 @@ static void dm_thin_exit(void) | |||
| 2759 | module_init(dm_thin_init); | 2767 | module_init(dm_thin_init); |
| 2760 | module_exit(dm_thin_exit); | 2768 | module_exit(dm_thin_exit); |
| 2761 | 2769 | ||
| 2762 | MODULE_DESCRIPTION(DM_NAME "device-mapper thin provisioning target"); | 2770 | MODULE_DESCRIPTION(DM_NAME " thin provisioning target"); |
| 2763 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); | 2771 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); |
| 2764 | MODULE_LICENSE("GPL"); | 2772 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 0f64d7182657..cb888d835a89 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
| @@ -1921,6 +1921,10 @@ static int dtv_set_frontend(struct dvb_frontend *fe) | |||
| 1921 | } else { | 1921 | } else { |
| 1922 | /* default values */ | 1922 | /* default values */ |
| 1923 | switch (c->delivery_system) { | 1923 | switch (c->delivery_system) { |
| 1924 | case SYS_DVBS: | ||
| 1925 | case SYS_DVBS2: | ||
| 1926 | case SYS_ISDBS: | ||
| 1927 | case SYS_TURBO: | ||
| 1924 | case SYS_DVBC_ANNEX_A: | 1928 | case SYS_DVBC_ANNEX_A: |
| 1925 | case SYS_DVBC_ANNEX_C: | 1929 | case SYS_DVBC_ANNEX_C: |
| 1926 | fepriv->min_delay = HZ / 20; | 1930 | fepriv->min_delay = HZ / 20; |
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index 860c112e0fd2..bef5296173c9 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c | |||
| @@ -1018,22 +1018,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
| 1018 | 1018 | ||
| 1019 | spin_lock_init(&dev->hw_lock); | 1019 | spin_lock_init(&dev->hw_lock); |
| 1020 | 1020 | ||
| 1021 | /* claim the resources */ | ||
| 1022 | error = -EBUSY; | ||
| 1023 | dev->hw_io = pnp_port_start(pnp_dev, 0); | ||
| 1024 | if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) { | ||
| 1025 | dev->hw_io = -1; | ||
| 1026 | dev->irq = -1; | ||
| 1027 | goto error; | ||
| 1028 | } | ||
| 1029 | |||
| 1030 | dev->irq = pnp_irq(pnp_dev, 0); | ||
| 1031 | if (request_irq(dev->irq, ene_isr, | ||
| 1032 | IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) { | ||
| 1033 | dev->irq = -1; | ||
| 1034 | goto error; | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | pnp_set_drvdata(pnp_dev, dev); | 1021 | pnp_set_drvdata(pnp_dev, dev); |
| 1038 | dev->pnp_dev = pnp_dev; | 1022 | dev->pnp_dev = pnp_dev; |
| 1039 | 1023 | ||
| @@ -1086,6 +1070,22 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | |||
| 1086 | device_set_wakeup_capable(&pnp_dev->dev, true); | 1070 | device_set_wakeup_capable(&pnp_dev->dev, true); |
| 1087 | device_set_wakeup_enable(&pnp_dev->dev, true); | 1071 | device_set_wakeup_enable(&pnp_dev->dev, true); |
| 1088 | 1072 | ||
| 1073 | /* claim the resources */ | ||
| 1074 | error = -EBUSY; | ||
| 1075 | dev->hw_io = pnp_port_start(pnp_dev, 0); | ||
| 1076 | if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) { | ||
| 1077 | dev->hw_io = -1; | ||
| 1078 | dev->irq = -1; | ||
| 1079 | goto error; | ||
| 1080 | } | ||
| 1081 | |||
| 1082 | dev->irq = pnp_irq(pnp_dev, 0); | ||
| 1083 | if (request_irq(dev->irq, ene_isr, | ||
| 1084 | IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) { | ||
| 1085 | dev->irq = -1; | ||
| 1086 | goto error; | ||
| 1087 | } | ||
| 1088 | |||
| 1089 | error = rc_register_device(rdev); | 1089 | error = rc_register_device(rdev); |
| 1090 | if (error < 0) | 1090 | if (error < 0) |
| 1091 | goto error; | 1091 | goto error; |
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c index 392d4be91f8f..4a3a238bcfbc 100644 --- a/drivers/media/rc/fintek-cir.c +++ b/drivers/media/rc/fintek-cir.c | |||
| @@ -197,7 +197,7 @@ static int fintek_hw_detect(struct fintek_dev *fintek) | |||
| 197 | /* | 197 | /* |
| 198 | * Newer reviews of this chipset uses port 8 instead of 5 | 198 | * Newer reviews of this chipset uses port 8 instead of 5 |
| 199 | */ | 199 | */ |
| 200 | if ((chip != 0x0408) || (chip != 0x0804)) | 200 | if ((chip != 0x0408) && (chip != 0x0804)) |
| 201 | fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV2; | 201 | fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV2; |
| 202 | else | 202 | else |
| 203 | fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV1; | 203 | fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV1; |
| @@ -514,16 +514,6 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id | |||
| 514 | 514 | ||
| 515 | spin_lock_init(&fintek->fintek_lock); | 515 | spin_lock_init(&fintek->fintek_lock); |
| 516 | 516 | ||
| 517 | ret = -EBUSY; | ||
| 518 | /* now claim resources */ | ||
| 519 | if (!request_region(fintek->cir_addr, | ||
| 520 | fintek->cir_port_len, FINTEK_DRIVER_NAME)) | ||
| 521 | goto failure; | ||
| 522 | |||
| 523 | if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED, | ||
| 524 | FINTEK_DRIVER_NAME, (void *)fintek)) | ||
| 525 | goto failure; | ||
| 526 | |||
| 527 | pnp_set_drvdata(pdev, fintek); | 517 | pnp_set_drvdata(pdev, fintek); |
| 528 | fintek->pdev = pdev; | 518 | fintek->pdev = pdev; |
| 529 | 519 | ||
| @@ -558,6 +548,16 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id | |||
| 558 | /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */ | 548 | /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */ |
| 559 | rdev->rx_resolution = US_TO_NS(CIR_SAMPLE_PERIOD); | 549 | rdev->rx_resolution = US_TO_NS(CIR_SAMPLE_PERIOD); |
| 560 | 550 | ||
| 551 | ret = -EBUSY; | ||
| 552 | /* now claim resources */ | ||
| 553 | if (!request_region(fintek->cir_addr, | ||
| 554 | fintek->cir_port_len, FINTEK_DRIVER_NAME)) | ||
| 555 | goto failure; | ||
| 556 | |||
| 557 | if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED, | ||
| 558 | FINTEK_DRIVER_NAME, (void *)fintek)) | ||
| 559 | goto failure; | ||
| 560 | |||
| 561 | ret = rc_register_device(rdev); | 561 | ret = rc_register_device(rdev); |
| 562 | if (ret) | 562 | if (ret) |
| 563 | goto failure; | 563 | goto failure; |
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index 682009d76cdf..0e49c99abf68 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c | |||
| @@ -1515,16 +1515,6 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id | |||
| 1515 | /* initialize raw event */ | 1515 | /* initialize raw event */ |
| 1516 | init_ir_raw_event(&itdev->rawir); | 1516 | init_ir_raw_event(&itdev->rawir); |
| 1517 | 1517 | ||
| 1518 | ret = -EBUSY; | ||
| 1519 | /* now claim resources */ | ||
| 1520 | if (!request_region(itdev->cir_addr, | ||
| 1521 | dev_desc->io_region_size, ITE_DRIVER_NAME)) | ||
| 1522 | goto failure; | ||
| 1523 | |||
| 1524 | if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED, | ||
| 1525 | ITE_DRIVER_NAME, (void *)itdev)) | ||
| 1526 | goto failure; | ||
| 1527 | |||
| 1528 | /* set driver data into the pnp device */ | 1518 | /* set driver data into the pnp device */ |
| 1529 | pnp_set_drvdata(pdev, itdev); | 1519 | pnp_set_drvdata(pdev, itdev); |
| 1530 | itdev->pdev = pdev; | 1520 | itdev->pdev = pdev; |
| @@ -1600,6 +1590,16 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id | |||
| 1600 | rdev->driver_name = ITE_DRIVER_NAME; | 1590 | rdev->driver_name = ITE_DRIVER_NAME; |
| 1601 | rdev->map_name = RC_MAP_RC6_MCE; | 1591 | rdev->map_name = RC_MAP_RC6_MCE; |
| 1602 | 1592 | ||
| 1593 | ret = -EBUSY; | ||
| 1594 | /* now claim resources */ | ||
| 1595 | if (!request_region(itdev->cir_addr, | ||
| 1596 | dev_desc->io_region_size, ITE_DRIVER_NAME)) | ||
| 1597 | goto failure; | ||
| 1598 | |||
| 1599 | if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED, | ||
| 1600 | ITE_DRIVER_NAME, (void *)itdev)) | ||
| 1601 | goto failure; | ||
| 1602 | |||
| 1603 | ret = rc_register_device(rdev); | 1603 | ret = rc_register_device(rdev); |
| 1604 | if (ret) | 1604 | if (ret) |
| 1605 | goto failure; | 1605 | goto failure; |
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 144f3f55d765..8b2c071ac0ab 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c | |||
| @@ -1021,24 +1021,6 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | |||
| 1021 | spin_lock_init(&nvt->nvt_lock); | 1021 | spin_lock_init(&nvt->nvt_lock); |
| 1022 | spin_lock_init(&nvt->tx.lock); | 1022 | spin_lock_init(&nvt->tx.lock); |
| 1023 | 1023 | ||
| 1024 | ret = -EBUSY; | ||
| 1025 | /* now claim resources */ | ||
| 1026 | if (!request_region(nvt->cir_addr, | ||
| 1027 | CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) | ||
| 1028 | goto failure; | ||
| 1029 | |||
| 1030 | if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED, | ||
| 1031 | NVT_DRIVER_NAME, (void *)nvt)) | ||
| 1032 | goto failure; | ||
| 1033 | |||
| 1034 | if (!request_region(nvt->cir_wake_addr, | ||
| 1035 | CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) | ||
| 1036 | goto failure; | ||
| 1037 | |||
| 1038 | if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED, | ||
| 1039 | NVT_DRIVER_NAME, (void *)nvt)) | ||
| 1040 | goto failure; | ||
| 1041 | |||
| 1042 | pnp_set_drvdata(pdev, nvt); | 1024 | pnp_set_drvdata(pdev, nvt); |
| 1043 | nvt->pdev = pdev; | 1025 | nvt->pdev = pdev; |
| 1044 | 1026 | ||
| @@ -1085,6 +1067,24 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | |||
| 1085 | rdev->tx_resolution = XYZ; | 1067 | rdev->tx_resolution = XYZ; |
| 1086 | #endif | 1068 | #endif |
| 1087 | 1069 | ||
| 1070 | ret = -EBUSY; | ||
| 1071 | /* now claim resources */ | ||
| 1072 | if (!request_region(nvt->cir_addr, | ||
| 1073 | CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) | ||
| 1074 | goto failure; | ||
| 1075 | |||
| 1076 | if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED, | ||
| 1077 | NVT_DRIVER_NAME, (void *)nvt)) | ||
| 1078 | goto failure; | ||
| 1079 | |||
| 1080 | if (!request_region(nvt->cir_wake_addr, | ||
| 1081 | CIR_IOREG_LENGTH, NVT_DRIVER_NAME)) | ||
| 1082 | goto failure; | ||
| 1083 | |||
| 1084 | if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED, | ||
| 1085 | NVT_DRIVER_NAME, (void *)nvt)) | ||
| 1086 | goto failure; | ||
| 1087 | |||
| 1088 | ret = rc_register_device(rdev); | 1088 | ret = rc_register_device(rdev); |
| 1089 | if (ret) | 1089 | if (ret) |
| 1090 | goto failure; | 1090 | goto failure; |
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index af526586fa26..342c2c8c1ddf 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c | |||
| @@ -991,39 +991,10 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
| 991 | "(w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n", | 991 | "(w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n", |
| 992 | data->wbase, data->ebase, data->sbase, data->irq); | 992 | data->wbase, data->ebase, data->sbase, data->irq); |
| 993 | 993 | ||
| 994 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { | ||
| 995 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | ||
| 996 | data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1); | ||
| 997 | err = -EBUSY; | ||
| 998 | goto exit_free_data; | ||
| 999 | } | ||
| 1000 | |||
| 1001 | if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) { | ||
| 1002 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | ||
| 1003 | data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1); | ||
| 1004 | err = -EBUSY; | ||
| 1005 | goto exit_release_wbase; | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) { | ||
| 1009 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | ||
| 1010 | data->sbase, data->sbase + SP_IOMEM_LEN - 1); | ||
| 1011 | err = -EBUSY; | ||
| 1012 | goto exit_release_ebase; | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | err = request_irq(data->irq, wbcir_irq_handler, | ||
| 1016 | IRQF_DISABLED, DRVNAME, device); | ||
| 1017 | if (err) { | ||
| 1018 | dev_err(dev, "Failed to claim IRQ %u\n", data->irq); | ||
| 1019 | err = -EBUSY; | ||
| 1020 | goto exit_release_sbase; | ||
| 1021 | } | ||
| 1022 | |||
| 1023 | led_trigger_register_simple("cir-tx", &data->txtrigger); | 994 | led_trigger_register_simple("cir-tx", &data->txtrigger); |
| 1024 | if (!data->txtrigger) { | 995 | if (!data->txtrigger) { |
| 1025 | err = -ENOMEM; | 996 | err = -ENOMEM; |
| 1026 | goto exit_free_irq; | 997 | goto exit_free_data; |
| 1027 | } | 998 | } |
| 1028 | 999 | ||
| 1029 | led_trigger_register_simple("cir-rx", &data->rxtrigger); | 1000 | led_trigger_register_simple("cir-rx", &data->rxtrigger); |
| @@ -1062,9 +1033,38 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
| 1062 | data->dev->priv = data; | 1033 | data->dev->priv = data; |
| 1063 | data->dev->dev.parent = &device->dev; | 1034 | data->dev->dev.parent = &device->dev; |
| 1064 | 1035 | ||
| 1036 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { | ||
| 1037 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | ||
| 1038 | data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1); | ||
| 1039 | err = -EBUSY; | ||
| 1040 | goto exit_free_rc; | ||
| 1041 | } | ||
| 1042 | |||
| 1043 | if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) { | ||
| 1044 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | ||
| 1045 | data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1); | ||
| 1046 | err = -EBUSY; | ||
| 1047 | goto exit_release_wbase; | ||
| 1048 | } | ||
| 1049 | |||
| 1050 | if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) { | ||
| 1051 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | ||
| 1052 | data->sbase, data->sbase + SP_IOMEM_LEN - 1); | ||
| 1053 | err = -EBUSY; | ||
| 1054 | goto exit_release_ebase; | ||
| 1055 | } | ||
| 1056 | |||
| 1057 | err = request_irq(data->irq, wbcir_irq_handler, | ||
| 1058 | IRQF_DISABLED, DRVNAME, device); | ||
| 1059 | if (err) { | ||
| 1060 | dev_err(dev, "Failed to claim IRQ %u\n", data->irq); | ||
| 1061 | err = -EBUSY; | ||
| 1062 | goto exit_release_sbase; | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | err = rc_register_device(data->dev); | 1065 | err = rc_register_device(data->dev); |
| 1066 | if (err) | 1066 | if (err) |
| 1067 | goto exit_free_rc; | 1067 | goto exit_free_irq; |
| 1068 | 1068 | ||
| 1069 | device_init_wakeup(&device->dev, 1); | 1069 | device_init_wakeup(&device->dev, 1); |
| 1070 | 1070 | ||
| @@ -1072,14 +1072,6 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
| 1072 | 1072 | ||
| 1073 | return 0; | 1073 | return 0; |
| 1074 | 1074 | ||
| 1075 | exit_free_rc: | ||
| 1076 | rc_free_device(data->dev); | ||
| 1077 | exit_unregister_led: | ||
| 1078 | led_classdev_unregister(&data->led); | ||
| 1079 | exit_unregister_rxtrigger: | ||
| 1080 | led_trigger_unregister_simple(data->rxtrigger); | ||
| 1081 | exit_unregister_txtrigger: | ||
| 1082 | led_trigger_unregister_simple(data->txtrigger); | ||
| 1083 | exit_free_irq: | 1075 | exit_free_irq: |
| 1084 | free_irq(data->irq, device); | 1076 | free_irq(data->irq, device); |
| 1085 | exit_release_sbase: | 1077 | exit_release_sbase: |
| @@ -1088,6 +1080,14 @@ exit_release_ebase: | |||
| 1088 | release_region(data->ebase, EHFUNC_IOMEM_LEN); | 1080 | release_region(data->ebase, EHFUNC_IOMEM_LEN); |
| 1089 | exit_release_wbase: | 1081 | exit_release_wbase: |
| 1090 | release_region(data->wbase, WAKEUP_IOMEM_LEN); | 1082 | release_region(data->wbase, WAKEUP_IOMEM_LEN); |
| 1083 | exit_free_rc: | ||
| 1084 | rc_free_device(data->dev); | ||
| 1085 | exit_unregister_led: | ||
| 1086 | led_classdev_unregister(&data->led); | ||
| 1087 | exit_unregister_rxtrigger: | ||
| 1088 | led_trigger_unregister_simple(data->rxtrigger); | ||
| 1089 | exit_unregister_txtrigger: | ||
| 1090 | led_trigger_unregister_simple(data->txtrigger); | ||
| 1091 | exit_free_data: | 1091 | exit_free_data: |
| 1092 | kfree(data); | 1092 | kfree(data); |
| 1093 | pnp_set_drvdata(device, NULL); | 1093 | pnp_set_drvdata(device, NULL); |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index db8e5084df06..863c755dd2b7 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
| @@ -2923,6 +2923,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 2923 | * not the JPEG end of frame ('ff d9'). | 2923 | * not the JPEG end of frame ('ff d9'). |
| 2924 | */ | 2924 | */ |
| 2925 | 2925 | ||
| 2926 | /* count the packets and their size */ | ||
| 2927 | sd->npkt++; | ||
| 2928 | sd->pktsz += len; | ||
| 2929 | |||
| 2926 | /*fixme: assumption about the following code: | 2930 | /*fixme: assumption about the following code: |
| 2927 | * - there can be only one marker in a packet | 2931 | * - there can be only one marker in a packet |
| 2928 | */ | 2932 | */ |
| @@ -2945,10 +2949,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
| 2945 | data += i; | 2949 | data += i; |
| 2946 | } | 2950 | } |
| 2947 | 2951 | ||
| 2948 | /* count the packets and their size */ | ||
| 2949 | sd->npkt++; | ||
| 2950 | sd->pktsz += len; | ||
| 2951 | |||
| 2952 | /* search backwards if there is a marker in the packet */ | 2952 | /* search backwards if there is a marker in the packet */ |
| 2953 | for (i = len - 1; --i >= 0; ) { | 2953 | for (i = len - 1; --i >= 0; ) { |
| 2954 | if (data[i] != 0xff) { | 2954 | if (data[i] != 0xff) { |
diff --git a/drivers/media/video/marvell-ccic/mmp-driver.c b/drivers/media/video/marvell-ccic/mmp-driver.c index d23552323f45..c4c17fe76c0d 100644 --- a/drivers/media/video/marvell-ccic/mmp-driver.c +++ b/drivers/media/video/marvell-ccic/mmp-driver.c | |||
| @@ -181,7 +181,6 @@ static int mmpcam_probe(struct platform_device *pdev) | |||
| 181 | INIT_LIST_HEAD(&cam->devlist); | 181 | INIT_LIST_HEAD(&cam->devlist); |
| 182 | 182 | ||
| 183 | mcam = &cam->mcam; | 183 | mcam = &cam->mcam; |
| 184 | mcam->platform = MHP_Armada610; | ||
| 185 | mcam->plat_power_up = mmpcam_power_up; | 184 | mcam->plat_power_up = mmpcam_power_up; |
| 186 | mcam->plat_power_down = mmpcam_power_down; | 185 | mcam->plat_power_down = mmpcam_power_down; |
| 187 | mcam->dev = &pdev->dev; | 186 | mcam->dev = &pdev->dev; |
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index b06efd208328..7e9b2c612b03 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
| @@ -246,28 +246,37 @@ int fimc_capture_resume(struct fimc_dev *fimc) | |||
| 246 | 246 | ||
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | static unsigned int get_plane_size(struct fimc_frame *fr, unsigned int plane) | 249 | static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, |
| 250 | { | ||
| 251 | if (!fr || plane >= fr->fmt->memplanes) | ||
| 252 | return 0; | ||
| 253 | return fr->f_width * fr->f_height * fr->fmt->depth[plane] / 8; | ||
| 254 | } | ||
| 255 | |||
| 256 | static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, | ||
| 257 | unsigned int *num_buffers, unsigned int *num_planes, | 250 | unsigned int *num_buffers, unsigned int *num_planes, |
| 258 | unsigned int sizes[], void *allocators[]) | 251 | unsigned int sizes[], void *allocators[]) |
| 259 | { | 252 | { |
| 253 | const struct v4l2_pix_format_mplane *pixm = NULL; | ||
| 260 | struct fimc_ctx *ctx = vq->drv_priv; | 254 | struct fimc_ctx *ctx = vq->drv_priv; |
| 261 | struct fimc_fmt *fmt = ctx->d_frame.fmt; | 255 | struct fimc_frame *frame = &ctx->d_frame; |
| 256 | struct fimc_fmt *fmt = frame->fmt; | ||
| 257 | unsigned long wh; | ||
| 262 | int i; | 258 | int i; |
| 263 | 259 | ||
| 264 | if (!fmt) | 260 | if (pfmt) { |
| 261 | pixm = &pfmt->fmt.pix_mp; | ||
| 262 | fmt = fimc_find_format(&pixm->pixelformat, NULL, | ||
| 263 | FMT_FLAGS_CAM | FMT_FLAGS_M2M, -1); | ||
| 264 | wh = pixm->width * pixm->height; | ||
| 265 | } else { | ||
| 266 | wh = frame->f_width * frame->f_height; | ||
| 267 | } | ||
| 268 | |||
| 269 | if (fmt == NULL) | ||
| 265 | return -EINVAL; | 270 | return -EINVAL; |
| 266 | 271 | ||
| 267 | *num_planes = fmt->memplanes; | 272 | *num_planes = fmt->memplanes; |
| 268 | 273 | ||
| 269 | for (i = 0; i < fmt->memplanes; i++) { | 274 | for (i = 0; i < fmt->memplanes; i++) { |
| 270 | sizes[i] = get_plane_size(&ctx->d_frame, i); | 275 | unsigned int size = (wh * fmt->depth[i]) / 8; |
| 276 | if (pixm) | ||
| 277 | sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); | ||
| 278 | else | ||
| 279 | sizes[i] = size; | ||
| 271 | allocators[i] = ctx->fimc_dev->alloc_ctx; | 280 | allocators[i] = ctx->fimc_dev->alloc_ctx; |
| 272 | } | 281 | } |
| 273 | 282 | ||
| @@ -1383,7 +1392,7 @@ static int fimc_subdev_set_crop(struct v4l2_subdev *sd, | |||
| 1383 | fimc_capture_try_crop(ctx, r, crop->pad); | 1392 | fimc_capture_try_crop(ctx, r, crop->pad); |
| 1384 | 1393 | ||
| 1385 | if (crop->which == V4L2_SUBDEV_FORMAT_TRY) { | 1394 | if (crop->which == V4L2_SUBDEV_FORMAT_TRY) { |
| 1386 | mutex_lock(&fimc->lock); | 1395 | mutex_unlock(&fimc->lock); |
| 1387 | *v4l2_subdev_get_try_crop(fh, crop->pad) = *r; | 1396 | *v4l2_subdev_get_try_crop(fh, crop->pad) = *r; |
| 1388 | return 0; | 1397 | return 0; |
| 1389 | } | 1398 | } |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index e184e650022a..e09ba7b0076e 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
| @@ -1048,14 +1048,14 @@ static int fimc_m2m_g_fmt_mplane(struct file *file, void *fh, | |||
| 1048 | * @mask: the color flags to match | 1048 | * @mask: the color flags to match |
| 1049 | * @index: offset in the fimc_formats array, ignored if negative | 1049 | * @index: offset in the fimc_formats array, ignored if negative |
| 1050 | */ | 1050 | */ |
| 1051 | struct fimc_fmt *fimc_find_format(u32 *pixelformat, u32 *mbus_code, | 1051 | struct fimc_fmt *fimc_find_format(const u32 *pixelformat, const u32 *mbus_code, |
| 1052 | unsigned int mask, int index) | 1052 | unsigned int mask, int index) |
| 1053 | { | 1053 | { |
| 1054 | struct fimc_fmt *fmt, *def_fmt = NULL; | 1054 | struct fimc_fmt *fmt, *def_fmt = NULL; |
| 1055 | unsigned int i; | 1055 | unsigned int i; |
| 1056 | int id = 0; | 1056 | int id = 0; |
| 1057 | 1057 | ||
| 1058 | if (index >= ARRAY_SIZE(fimc_formats)) | 1058 | if (index >= (int)ARRAY_SIZE(fimc_formats)) |
| 1059 | return NULL; | 1059 | return NULL; |
| 1060 | 1060 | ||
| 1061 | for (i = 0; i < ARRAY_SIZE(fimc_formats); ++i) { | 1061 | for (i = 0; i < ARRAY_SIZE(fimc_formats); ++i) { |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h index a18291e648e2..84fd83550bd7 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.h +++ b/drivers/media/video/s5p-fimc/fimc-core.h | |||
| @@ -718,7 +718,7 @@ void fimc_alpha_ctrl_update(struct fimc_ctx *ctx); | |||
| 718 | int fimc_fill_format(struct fimc_frame *frame, struct v4l2_format *f); | 718 | int fimc_fill_format(struct fimc_frame *frame, struct v4l2_format *f); |
| 719 | void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, | 719 | void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, |
| 720 | struct v4l2_pix_format_mplane *pix); | 720 | struct v4l2_pix_format_mplane *pix); |
| 721 | struct fimc_fmt *fimc_find_format(u32 *pixelformat, u32 *mbus_code, | 721 | struct fimc_fmt *fimc_find_format(const u32 *pixelformat, const u32 *mbus_code, |
| 722 | unsigned int mask, int index); | 722 | unsigned int mask, int index); |
| 723 | 723 | ||
| 724 | int fimc_check_scaler_ratio(struct fimc_ctx *ctx, int sw, int sh, | 724 | int fimc_check_scaler_ratio(struct fimc_ctx *ctx, int sw, int sh, |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index eb25756a07af..aedb970d13f6 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
| @@ -530,7 +530,10 @@ static int soc_camera_open(struct file *file) | |||
| 530 | if (icl->reset) | 530 | if (icl->reset) |
| 531 | icl->reset(icd->pdev); | 531 | icl->reset(icd->pdev); |
| 532 | 532 | ||
| 533 | /* Don't mess with the host during probe */ | ||
| 534 | mutex_lock(&ici->host_lock); | ||
| 533 | ret = ici->ops->add(icd); | 535 | ret = ici->ops->add(icd); |
| 536 | mutex_unlock(&ici->host_lock); | ||
| 534 | if (ret < 0) { | 537 | if (ret < 0) { |
| 535 | dev_err(icd->pdev, "Couldn't activate the camera: %d\n", ret); | 538 | dev_err(icd->pdev, "Couldn't activate the camera: %d\n", ret); |
| 536 | goto eiciadd; | 539 | goto eiciadd; |
| @@ -956,7 +959,7 @@ static void scan_add_host(struct soc_camera_host *ici) | |||
| 956 | { | 959 | { |
| 957 | struct soc_camera_device *icd; | 960 | struct soc_camera_device *icd; |
| 958 | 961 | ||
| 959 | mutex_lock(&list_lock); | 962 | mutex_lock(&ici->host_lock); |
| 960 | 963 | ||
| 961 | list_for_each_entry(icd, &devices, list) { | 964 | list_for_each_entry(icd, &devices, list) { |
| 962 | if (icd->iface == ici->nr) { | 965 | if (icd->iface == ici->nr) { |
| @@ -967,7 +970,7 @@ static void scan_add_host(struct soc_camera_host *ici) | |||
| 967 | } | 970 | } |
| 968 | } | 971 | } |
| 969 | 972 | ||
| 970 | mutex_unlock(&list_lock); | 973 | mutex_unlock(&ici->host_lock); |
| 971 | } | 974 | } |
| 972 | 975 | ||
| 973 | #ifdef CONFIG_I2C_BOARDINFO | 976 | #ifdef CONFIG_I2C_BOARDINFO |
| @@ -1313,6 +1316,7 @@ int soc_camera_host_register(struct soc_camera_host *ici) | |||
| 1313 | list_add_tail(&ici->list, &hosts); | 1316 | list_add_tail(&ici->list, &hosts); |
| 1314 | mutex_unlock(&list_lock); | 1317 | mutex_unlock(&list_lock); |
| 1315 | 1318 | ||
| 1319 | mutex_init(&ici->host_lock); | ||
| 1316 | scan_add_host(ici); | 1320 | scan_add_host(ici); |
| 1317 | 1321 | ||
| 1318 | return 0; | 1322 | return 0; |
diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index f17ad98fcc5f..4b7132660a93 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
| 16 | 16 | ||
| 17 | #include <media/videobuf2-core.h> | 17 | #include <media/videobuf2-core.h> |
| 18 | #include <media/videobuf2-dma-contig.h> | ||
| 18 | #include <media/videobuf2-memops.h> | 19 | #include <media/videobuf2-memops.h> |
| 19 | 20 | ||
| 20 | struct vb2_dc_conf { | 21 | struct vb2_dc_conf { |
| @@ -85,7 +86,7 @@ static void *vb2_dma_contig_vaddr(void *buf_priv) | |||
| 85 | { | 86 | { |
| 86 | struct vb2_dc_buf *buf = buf_priv; | 87 | struct vb2_dc_buf *buf = buf_priv; |
| 87 | if (!buf) | 88 | if (!buf) |
| 88 | return 0; | 89 | return NULL; |
| 89 | 90 | ||
| 90 | return buf->vaddr; | 91 | return buf->vaddr; |
| 91 | } | 92 | } |
diff --git a/drivers/media/video/videobuf2-memops.c b/drivers/media/video/videobuf2-memops.c index c41cb60245d6..504cd4cbe29e 100644 --- a/drivers/media/video/videobuf2-memops.c +++ b/drivers/media/video/videobuf2-memops.c | |||
| @@ -55,6 +55,7 @@ struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma) | |||
| 55 | 55 | ||
| 56 | return vma_copy; | 56 | return vma_copy; |
| 57 | } | 57 | } |
| 58 | EXPORT_SYMBOL_GPL(vb2_get_vma); | ||
| 58 | 59 | ||
| 59 | /** | 60 | /** |
| 60 | * vb2_put_userptr() - release a userspace virtual memory area | 61 | * vb2_put_userptr() - release a userspace virtual memory area |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index c8aae6640e64..7e96bb229724 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
| 26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
| 27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
| 28 | #include <plat/cpu.h> | ||
| 28 | #include <plat/usb.h> | 29 | #include <plat/usb.h> |
| 29 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
| 30 | 31 | ||
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 58fc65f5c817..f2f482bec573 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
| @@ -376,7 +376,7 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode) | |||
| 376 | * Make a fake call to mtd_read_fact_prot_reg() to check if OTP | 376 | * Make a fake call to mtd_read_fact_prot_reg() to check if OTP |
| 377 | * operations are supported. | 377 | * operations are supported. |
| 378 | */ | 378 | */ |
| 379 | if (mtd_read_fact_prot_reg(mtd, -1, -1, &retlen, NULL) == -EOPNOTSUPP) | 379 | if (mtd_read_fact_prot_reg(mtd, -1, 0, &retlen, NULL) == -EOPNOTSUPP) |
| 380 | return -EOPNOTSUPP; | 380 | return -EOPNOTSUPP; |
| 381 | 381 | ||
| 382 | switch (mode) { | 382 | switch (mode) { |
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c index 73416951f4c1..861ca8f7e47d 100644 --- a/drivers/mtd/nand/ams-delta.c +++ b/drivers/mtd/nand/ams-delta.c | |||
| @@ -212,18 +212,17 @@ static int __devinit ams_delta_init(struct platform_device *pdev) | |||
| 212 | /* Link the private data with the MTD structure */ | 212 | /* Link the private data with the MTD structure */ |
| 213 | ams_delta_mtd->priv = this; | 213 | ams_delta_mtd->priv = this; |
| 214 | 214 | ||
| 215 | if (!request_mem_region(res->start, resource_size(res), | 215 | /* |
| 216 | dev_name(&pdev->dev))) { | 216 | * Don't try to request the memory region from here, |
| 217 | dev_err(&pdev->dev, "request_mem_region failed\n"); | 217 | * it should have been already requested from the |
| 218 | err = -EBUSY; | 218 | * gpio-omap driver and requesting it again would fail. |
| 219 | goto out_free; | 219 | */ |
| 220 | } | ||
| 221 | 220 | ||
| 222 | io_base = ioremap(res->start, resource_size(res)); | 221 | io_base = ioremap(res->start, resource_size(res)); |
| 223 | if (io_base == NULL) { | 222 | if (io_base == NULL) { |
| 224 | dev_err(&pdev->dev, "ioremap failed\n"); | 223 | dev_err(&pdev->dev, "ioremap failed\n"); |
| 225 | err = -EIO; | 224 | err = -EIO; |
| 226 | goto out_release_io; | 225 | goto out_free; |
| 227 | } | 226 | } |
| 228 | 227 | ||
| 229 | this->priv = io_base; | 228 | this->priv = io_base; |
| @@ -271,8 +270,6 @@ out_gpio: | |||
| 271 | platform_set_drvdata(pdev, NULL); | 270 | platform_set_drvdata(pdev, NULL); |
| 272 | gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); | 271 | gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); |
| 273 | iounmap(io_base); | 272 | iounmap(io_base); |
| 274 | out_release_io: | ||
| 275 | release_mem_region(res->start, resource_size(res)); | ||
| 276 | out_free: | 273 | out_free: |
| 277 | kfree(ams_delta_mtd); | 274 | kfree(ams_delta_mtd); |
| 278 | out: | 275 | out: |
| @@ -285,7 +282,6 @@ out_free: | |||
| 285 | static int __devexit ams_delta_cleanup(struct platform_device *pdev) | 282 | static int __devexit ams_delta_cleanup(struct platform_device *pdev) |
| 286 | { | 283 | { |
| 287 | void __iomem *io_base = platform_get_drvdata(pdev); | 284 | void __iomem *io_base = platform_get_drvdata(pdev); |
| 288 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 289 | 285 | ||
| 290 | /* Release resources, unregister device */ | 286 | /* Release resources, unregister device */ |
| 291 | nand_release(ams_delta_mtd); | 287 | nand_release(ams_delta_mtd); |
| @@ -293,7 +289,6 @@ static int __devexit ams_delta_cleanup(struct platform_device *pdev) | |||
| 293 | gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); | 289 | gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); |
| 294 | gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); | 290 | gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); |
| 295 | iounmap(io_base); | 291 | iounmap(io_base); |
| 296 | release_mem_region(res->start, resource_size(res)); | ||
| 297 | 292 | ||
| 298 | /* Free the MTD device structure */ | 293 | /* Free the MTD device structure */ |
| 299 | kfree(ams_delta_mtd); | 294 | kfree(ams_delta_mtd); |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 793b00138275..3463b469e657 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
| @@ -2173,9 +2173,10 @@ re_arm: | |||
| 2173 | * received frames (loopback). Since only the payload is given to this | 2173 | * received frames (loopback). Since only the payload is given to this |
| 2174 | * function, it check for loopback. | 2174 | * function, it check for loopback. |
| 2175 | */ | 2175 | */ |
| 2176 | static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 length) | 2176 | static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 length) |
| 2177 | { | 2177 | { |
| 2178 | struct port *port; | 2178 | struct port *port; |
| 2179 | int ret = RX_HANDLER_ANOTHER; | ||
| 2179 | 2180 | ||
| 2180 | if (length >= sizeof(struct lacpdu)) { | 2181 | if (length >= sizeof(struct lacpdu)) { |
| 2181 | 2182 | ||
| @@ -2184,11 +2185,12 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u | |||
| 2184 | if (!port->slave) { | 2185 | if (!port->slave) { |
| 2185 | pr_warning("%s: Warning: port of slave %s is uninitialized\n", | 2186 | pr_warning("%s: Warning: port of slave %s is uninitialized\n", |
| 2186 | slave->dev->name, slave->dev->master->name); | 2187 | slave->dev->name, slave->dev->master->name); |
| 2187 | return; | 2188 | return ret; |
| 2188 | } | 2189 | } |
| 2189 | 2190 | ||
| 2190 | switch (lacpdu->subtype) { | 2191 | switch (lacpdu->subtype) { |
| 2191 | case AD_TYPE_LACPDU: | 2192 | case AD_TYPE_LACPDU: |
| 2193 | ret = RX_HANDLER_CONSUMED; | ||
| 2192 | pr_debug("Received LACPDU on port %d\n", | 2194 | pr_debug("Received LACPDU on port %d\n", |
| 2193 | port->actor_port_number); | 2195 | port->actor_port_number); |
| 2194 | /* Protect against concurrent state machines */ | 2196 | /* Protect against concurrent state machines */ |
| @@ -2198,6 +2200,7 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u | |||
| 2198 | break; | 2200 | break; |
| 2199 | 2201 | ||
| 2200 | case AD_TYPE_MARKER: | 2202 | case AD_TYPE_MARKER: |
| 2203 | ret = RX_HANDLER_CONSUMED; | ||
| 2201 | // No need to convert fields to Little Endian since we don't use the marker's fields. | 2204 | // No need to convert fields to Little Endian since we don't use the marker's fields. |
| 2202 | 2205 | ||
| 2203 | switch (((struct bond_marker *)lacpdu)->tlv_type) { | 2206 | switch (((struct bond_marker *)lacpdu)->tlv_type) { |
| @@ -2219,6 +2222,7 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u | |||
| 2219 | } | 2222 | } |
| 2220 | } | 2223 | } |
| 2221 | } | 2224 | } |
| 2225 | return ret; | ||
| 2222 | } | 2226 | } |
| 2223 | 2227 | ||
| 2224 | /** | 2228 | /** |
| @@ -2456,18 +2460,20 @@ out: | |||
| 2456 | return NETDEV_TX_OK; | 2460 | return NETDEV_TX_OK; |
| 2457 | } | 2461 | } |
| 2458 | 2462 | ||
| 2459 | void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, | 2463 | int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, |
| 2460 | struct slave *slave) | 2464 | struct slave *slave) |
| 2461 | { | 2465 | { |
| 2466 | int ret = RX_HANDLER_ANOTHER; | ||
| 2462 | if (skb->protocol != PKT_TYPE_LACPDU) | 2467 | if (skb->protocol != PKT_TYPE_LACPDU) |
| 2463 | return; | 2468 | return ret; |
| 2464 | 2469 | ||
| 2465 | if (!pskb_may_pull(skb, sizeof(struct lacpdu))) | 2470 | if (!pskb_may_pull(skb, sizeof(struct lacpdu))) |
| 2466 | return; | 2471 | return ret; |
| 2467 | 2472 | ||
| 2468 | read_lock(&bond->lock); | 2473 | read_lock(&bond->lock); |
| 2469 | bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len); | 2474 | ret = bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len); |
| 2470 | read_unlock(&bond->lock); | 2475 | read_unlock(&bond->lock); |
| 2476 | return ret; | ||
| 2471 | } | 2477 | } |
| 2472 | 2478 | ||
| 2473 | /* | 2479 | /* |
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h index 235b2cc58b28..5ee7e3c45db7 100644 --- a/drivers/net/bonding/bond_3ad.h +++ b/drivers/net/bonding/bond_3ad.h | |||
| @@ -274,7 +274,7 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave); | |||
| 274 | void bond_3ad_handle_link_change(struct slave *slave, char link); | 274 | void bond_3ad_handle_link_change(struct slave *slave, char link); |
| 275 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); | 275 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); |
| 276 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); | 276 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); |
| 277 | void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, | 277 | int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, |
| 278 | struct slave *slave); | 278 | struct slave *slave); |
| 279 | int bond_3ad_set_carrier(struct bonding *bond); | 279 | int bond_3ad_set_carrier(struct bonding *bond); |
| 280 | void bond_3ad_update_lacp_rate(struct bonding *bond); | 280 | void bond_3ad_update_lacp_rate(struct bonding *bond); |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 9abfde479316..2e1f8066f1a8 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
| @@ -342,26 +342,26 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp) | |||
| 342 | _unlock_rx_hashtbl_bh(bond); | 342 | _unlock_rx_hashtbl_bh(bond); |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond, | 345 | static int rlb_arp_recv(struct sk_buff *skb, struct bonding *bond, |
| 346 | struct slave *slave) | 346 | struct slave *slave) |
| 347 | { | 347 | { |
| 348 | struct arp_pkt *arp; | 348 | struct arp_pkt *arp; |
| 349 | 349 | ||
| 350 | if (skb->protocol != cpu_to_be16(ETH_P_ARP)) | 350 | if (skb->protocol != cpu_to_be16(ETH_P_ARP)) |
| 351 | return; | 351 | goto out; |
| 352 | 352 | ||
| 353 | arp = (struct arp_pkt *) skb->data; | 353 | arp = (struct arp_pkt *) skb->data; |
| 354 | if (!arp) { | 354 | if (!arp) { |
| 355 | pr_debug("Packet has no ARP data\n"); | 355 | pr_debug("Packet has no ARP data\n"); |
| 356 | return; | 356 | goto out; |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | if (!pskb_may_pull(skb, arp_hdr_len(bond->dev))) | 359 | if (!pskb_may_pull(skb, arp_hdr_len(bond->dev))) |
| 360 | return; | 360 | goto out; |
| 361 | 361 | ||
| 362 | if (skb->len < sizeof(struct arp_pkt)) { | 362 | if (skb->len < sizeof(struct arp_pkt)) { |
| 363 | pr_debug("Packet is too small to be an ARP\n"); | 363 | pr_debug("Packet is too small to be an ARP\n"); |
| 364 | return; | 364 | goto out; |
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | if (arp->op_code == htons(ARPOP_REPLY)) { | 367 | if (arp->op_code == htons(ARPOP_REPLY)) { |
| @@ -369,6 +369,8 @@ static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond, | |||
| 369 | rlb_update_entry_from_arp(bond, arp); | 369 | rlb_update_entry_from_arp(bond, arp); |
| 370 | pr_debug("Server received an ARP Reply from client\n"); | 370 | pr_debug("Server received an ARP Reply from client\n"); |
| 371 | } | 371 | } |
| 372 | out: | ||
| 373 | return RX_HANDLER_ANOTHER; | ||
| 372 | } | 374 | } |
| 373 | 375 | ||
| 374 | /* Caller must hold bond lock for read */ | 376 | /* Caller must hold bond lock for read */ |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 62d2409bb293..bc13b3d77432 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -1444,8 +1444,9 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) | |||
| 1444 | struct sk_buff *skb = *pskb; | 1444 | struct sk_buff *skb = *pskb; |
| 1445 | struct slave *slave; | 1445 | struct slave *slave; |
| 1446 | struct bonding *bond; | 1446 | struct bonding *bond; |
| 1447 | void (*recv_probe)(struct sk_buff *, struct bonding *, | 1447 | int (*recv_probe)(struct sk_buff *, struct bonding *, |
| 1448 | struct slave *); | 1448 | struct slave *); |
| 1449 | int ret = RX_HANDLER_ANOTHER; | ||
| 1449 | 1450 | ||
| 1450 | skb = skb_share_check(skb, GFP_ATOMIC); | 1451 | skb = skb_share_check(skb, GFP_ATOMIC); |
| 1451 | if (unlikely(!skb)) | 1452 | if (unlikely(!skb)) |
| @@ -1464,8 +1465,12 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) | |||
| 1464 | struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); | 1465 | struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); |
| 1465 | 1466 | ||
| 1466 | if (likely(nskb)) { | 1467 | if (likely(nskb)) { |
| 1467 | recv_probe(nskb, bond, slave); | 1468 | ret = recv_probe(nskb, bond, slave); |
| 1468 | dev_kfree_skb(nskb); | 1469 | dev_kfree_skb(nskb); |
| 1470 | if (ret == RX_HANDLER_CONSUMED) { | ||
| 1471 | consume_skb(skb); | ||
| 1472 | return ret; | ||
| 1473 | } | ||
| 1469 | } | 1474 | } |
| 1470 | } | 1475 | } |
| 1471 | 1476 | ||
| @@ -1487,7 +1492,7 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) | |||
| 1487 | memcpy(eth_hdr(skb)->h_dest, bond->dev->dev_addr, ETH_ALEN); | 1492 | memcpy(eth_hdr(skb)->h_dest, bond->dev->dev_addr, ETH_ALEN); |
| 1488 | } | 1493 | } |
| 1489 | 1494 | ||
| 1490 | return RX_HANDLER_ANOTHER; | 1495 | return ret; |
| 1491 | } | 1496 | } |
| 1492 | 1497 | ||
| 1493 | /* enslave device <slave> to bond device <master> */ | 1498 | /* enslave device <slave> to bond device <master> */ |
| @@ -2723,7 +2728,7 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 | |||
| 2723 | } | 2728 | } |
| 2724 | } | 2729 | } |
| 2725 | 2730 | ||
| 2726 | static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond, | 2731 | static int bond_arp_rcv(struct sk_buff *skb, struct bonding *bond, |
| 2727 | struct slave *slave) | 2732 | struct slave *slave) |
| 2728 | { | 2733 | { |
| 2729 | struct arphdr *arp; | 2734 | struct arphdr *arp; |
| @@ -2731,7 +2736,7 @@ static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond, | |||
| 2731 | __be32 sip, tip; | 2736 | __be32 sip, tip; |
| 2732 | 2737 | ||
| 2733 | if (skb->protocol != __cpu_to_be16(ETH_P_ARP)) | 2738 | if (skb->protocol != __cpu_to_be16(ETH_P_ARP)) |
| 2734 | return; | 2739 | return RX_HANDLER_ANOTHER; |
| 2735 | 2740 | ||
| 2736 | read_lock(&bond->lock); | 2741 | read_lock(&bond->lock); |
| 2737 | 2742 | ||
| @@ -2776,6 +2781,7 @@ static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond, | |||
| 2776 | 2781 | ||
| 2777 | out_unlock: | 2782 | out_unlock: |
| 2778 | read_unlock(&bond->lock); | 2783 | read_unlock(&bond->lock); |
| 2784 | return RX_HANDLER_ANOTHER; | ||
| 2779 | } | 2785 | } |
| 2780 | 2786 | ||
| 2781 | /* | 2787 | /* |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 9f2bae6616d3..4581aa5ccaba 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
| @@ -218,7 +218,7 @@ struct bonding { | |||
| 218 | struct slave *primary_slave; | 218 | struct slave *primary_slave; |
| 219 | bool force_primary; | 219 | bool force_primary; |
| 220 | s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ | 220 | s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ |
| 221 | void (*recv_probe)(struct sk_buff *, struct bonding *, | 221 | int (*recv_probe)(struct sk_buff *, struct bonding *, |
| 222 | struct slave *); | 222 | struct slave *); |
| 223 | rwlock_t lock; | 223 | rwlock_t lock; |
| 224 | rwlock_t curr_slave_lock; | 224 | rwlock_t curr_slave_lock; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index e077d2508727..6af310195bae 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
| @@ -9122,13 +9122,34 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) | |||
| 9122 | return bnx2x_prev_mcp_done(bp); | 9122 | return bnx2x_prev_mcp_done(bp); |
| 9123 | } | 9123 | } |
| 9124 | 9124 | ||
| 9125 | /* previous driver DMAE transaction may have occurred when pre-boot stage ended | ||
| 9126 | * and boot began, or when kdump kernel was loaded. Either case would invalidate | ||
| 9127 | * the addresses of the transaction, resulting in was-error bit set in the pci | ||
| 9128 | * causing all hw-to-host pcie transactions to timeout. If this happened we want | ||
| 9129 | * to clear the interrupt which detected this from the pglueb and the was done | ||
| 9130 | * bit | ||
| 9131 | */ | ||
| 9132 | static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp) | ||
| 9133 | { | ||
| 9134 | u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS); | ||
| 9135 | if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) { | ||
| 9136 | BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing"); | ||
| 9137 | REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR, 1 << BP_FUNC(bp)); | ||
| 9138 | } | ||
| 9139 | } | ||
| 9140 | |||
| 9125 | static int __devinit bnx2x_prev_unload(struct bnx2x *bp) | 9141 | static int __devinit bnx2x_prev_unload(struct bnx2x *bp) |
| 9126 | { | 9142 | { |
| 9127 | int time_counter = 10; | 9143 | int time_counter = 10; |
| 9128 | u32 rc, fw, hw_lock_reg, hw_lock_val; | 9144 | u32 rc, fw, hw_lock_reg, hw_lock_val; |
| 9129 | BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); | 9145 | BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); |
| 9130 | 9146 | ||
| 9131 | /* Release previously held locks */ | 9147 | /* clear hw from errors which may have resulted from an interrupted |
| 9148 | * dmae transaction. | ||
| 9149 | */ | ||
| 9150 | bnx2x_prev_interrupted_dmae(bp); | ||
| 9151 | |||
| 9152 | /* Release previously held locks */ | ||
| 9132 | hw_lock_reg = (BP_FUNC(bp) <= 5) ? | 9153 | hw_lock_reg = (BP_FUNC(bp) <= 5) ? |
| 9133 | (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) : | 9154 | (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) : |
| 9134 | (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8); | 9155 | (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 062ac333fde6..ceeab8e852ef 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -879,8 +879,13 @@ static inline unsigned int tg3_has_work(struct tg3_napi *tnapi) | |||
| 879 | if (sblk->status & SD_STATUS_LINK_CHG) | 879 | if (sblk->status & SD_STATUS_LINK_CHG) |
| 880 | work_exists = 1; | 880 | work_exists = 1; |
| 881 | } | 881 | } |
| 882 | /* check for RX/TX work to do */ | 882 | |
| 883 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons || | 883 | /* check for TX work to do */ |
| 884 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons) | ||
| 885 | work_exists = 1; | ||
| 886 | |||
| 887 | /* check for RX work to do */ | ||
| 888 | if (tnapi->rx_rcb_prod_idx && | ||
| 884 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) | 889 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) |
| 885 | work_exists = 1; | 890 | work_exists = 1; |
| 886 | 891 | ||
| @@ -6124,6 +6129,9 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget) | |||
| 6124 | return work_done; | 6129 | return work_done; |
| 6125 | } | 6130 | } |
| 6126 | 6131 | ||
| 6132 | if (!tnapi->rx_rcb_prod_idx) | ||
| 6133 | return work_done; | ||
| 6134 | |||
| 6127 | /* run RX thread, within the bounds set by NAPI. | 6135 | /* run RX thread, within the bounds set by NAPI. |
| 6128 | * All RX "locking" is done by ensuring outside | 6136 | * All RX "locking" is done by ensuring outside |
| 6129 | * code synchronizes with tg3->napi.poll() | 6137 | * code synchronizes with tg3->napi.poll() |
| @@ -7567,6 +7575,12 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
| 7567 | */ | 7575 | */ |
| 7568 | switch (i) { | 7576 | switch (i) { |
| 7569 | default: | 7577 | default: |
| 7578 | if (tg3_flag(tp, ENABLE_RSS)) { | ||
| 7579 | tnapi->rx_rcb_prod_idx = NULL; | ||
| 7580 | break; | ||
| 7581 | } | ||
| 7582 | /* Fall through */ | ||
| 7583 | case 1: | ||
| 7570 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; | 7584 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; |
| 7571 | break; | 7585 | break; |
| 7572 | case 2: | 7586 | case 2: |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 63bfdd10bd6d..abb6ce7c1b7e 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | |||
| @@ -1150,6 +1150,48 @@ release_tpsram: | |||
| 1150 | } | 1150 | } |
| 1151 | 1151 | ||
| 1152 | /** | 1152 | /** |
| 1153 | * t3_synchronize_rx - wait for current Rx processing on a port to complete | ||
| 1154 | * @adap: the adapter | ||
| 1155 | * @p: the port | ||
| 1156 | * | ||
| 1157 | * Ensures that current Rx processing on any of the queues associated with | ||
| 1158 | * the given port completes before returning. We do this by acquiring and | ||
| 1159 | * releasing the locks of the response queues associated with the port. | ||
| 1160 | */ | ||
| 1161 | static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | ||
| 1162 | { | ||
| 1163 | int i; | ||
| 1164 | |||
| 1165 | for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | ||
| 1166 | struct sge_rspq *q = &adap->sge.qs[i].rspq; | ||
| 1167 | |||
| 1168 | spin_lock_irq(&q->lock); | ||
| 1169 | spin_unlock_irq(&q->lock); | ||
| 1170 | } | ||
| 1171 | } | ||
| 1172 | |||
| 1173 | static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | ||
| 1174 | { | ||
| 1175 | struct port_info *pi = netdev_priv(dev); | ||
| 1176 | struct adapter *adapter = pi->adapter; | ||
| 1177 | |||
| 1178 | if (adapter->params.rev > 0) { | ||
| 1179 | t3_set_vlan_accel(adapter, 1 << pi->port_id, | ||
| 1180 | features & NETIF_F_HW_VLAN_RX); | ||
| 1181 | } else { | ||
| 1182 | /* single control for all ports */ | ||
| 1183 | unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | ||
| 1184 | |||
| 1185 | for_each_port(adapter, i) | ||
| 1186 | have_vlans |= | ||
| 1187 | adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | ||
| 1188 | |||
| 1189 | t3_set_vlan_accel(adapter, 1, have_vlans); | ||
| 1190 | } | ||
| 1191 | t3_synchronize_rx(adapter, pi); | ||
| 1192 | } | ||
| 1193 | |||
| 1194 | /** | ||
| 1153 | * cxgb_up - enable the adapter | 1195 | * cxgb_up - enable the adapter |
| 1154 | * @adapter: adapter being enabled | 1196 | * @adapter: adapter being enabled |
| 1155 | * | 1197 | * |
| @@ -1161,7 +1203,7 @@ release_tpsram: | |||
| 1161 | */ | 1203 | */ |
| 1162 | static int cxgb_up(struct adapter *adap) | 1204 | static int cxgb_up(struct adapter *adap) |
| 1163 | { | 1205 | { |
| 1164 | int err; | 1206 | int i, err; |
| 1165 | 1207 | ||
| 1166 | if (!(adap->flags & FULL_INIT_DONE)) { | 1208 | if (!(adap->flags & FULL_INIT_DONE)) { |
| 1167 | err = t3_check_fw_version(adap); | 1209 | err = t3_check_fw_version(adap); |
| @@ -1198,6 +1240,9 @@ static int cxgb_up(struct adapter *adap) | |||
| 1198 | if (err) | 1240 | if (err) |
| 1199 | goto out; | 1241 | goto out; |
| 1200 | 1242 | ||
| 1243 | for_each_port(adap, i) | ||
| 1244 | cxgb_vlan_mode(adap->port[i], adap->port[i]->features); | ||
| 1245 | |||
| 1201 | setup_rss(adap); | 1246 | setup_rss(adap); |
| 1202 | if (!(adap->flags & NAPI_INIT)) | 1247 | if (!(adap->flags & NAPI_INIT)) |
| 1203 | init_napi(adap); | 1248 | init_napi(adap); |
| @@ -2508,48 +2553,6 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) | |||
| 2508 | return 0; | 2553 | return 0; |
| 2509 | } | 2554 | } |
| 2510 | 2555 | ||
| 2511 | /** | ||
| 2512 | * t3_synchronize_rx - wait for current Rx processing on a port to complete | ||
| 2513 | * @adap: the adapter | ||
| 2514 | * @p: the port | ||
| 2515 | * | ||
| 2516 | * Ensures that current Rx processing on any of the queues associated with | ||
| 2517 | * the given port completes before returning. We do this by acquiring and | ||
| 2518 | * releasing the locks of the response queues associated with the port. | ||
| 2519 | */ | ||
| 2520 | static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | ||
| 2521 | { | ||
| 2522 | int i; | ||
| 2523 | |||
| 2524 | for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | ||
| 2525 | struct sge_rspq *q = &adap->sge.qs[i].rspq; | ||
| 2526 | |||
| 2527 | spin_lock_irq(&q->lock); | ||
| 2528 | spin_unlock_irq(&q->lock); | ||
| 2529 | } | ||
| 2530 | } | ||
| 2531 | |||
| 2532 | static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | ||
| 2533 | { | ||
| 2534 | struct port_info *pi = netdev_priv(dev); | ||
| 2535 | struct adapter *adapter = pi->adapter; | ||
| 2536 | |||
| 2537 | if (adapter->params.rev > 0) { | ||
| 2538 | t3_set_vlan_accel(adapter, 1 << pi->port_id, | ||
| 2539 | features & NETIF_F_HW_VLAN_RX); | ||
| 2540 | } else { | ||
| 2541 | /* single control for all ports */ | ||
| 2542 | unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | ||
| 2543 | |||
| 2544 | for_each_port(adapter, i) | ||
| 2545 | have_vlans |= | ||
| 2546 | adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | ||
| 2547 | |||
| 2548 | t3_set_vlan_accel(adapter, 1, have_vlans); | ||
| 2549 | } | ||
| 2550 | t3_synchronize_rx(adapter, pi); | ||
| 2551 | } | ||
| 2552 | |||
| 2553 | static netdev_features_t cxgb_fix_features(struct net_device *dev, | 2556 | static netdev_features_t cxgb_fix_features(struct net_device *dev, |
| 2554 | netdev_features_t features) | 2557 | netdev_features_t features) |
| 2555 | { | 2558 | { |
| @@ -3353,9 +3356,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
| 3353 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, | 3356 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, |
| 3354 | &cxgb3_attr_group); | 3357 | &cxgb3_attr_group); |
| 3355 | 3358 | ||
| 3356 | for_each_port(adapter, i) | ||
| 3357 | cxgb_vlan_mode(adapter->port[i], adapter->port[i]->features); | ||
| 3358 | |||
| 3359 | print_port_info(adapter, ai); | 3359 | print_port_info(adapter, ai); |
| 3360 | return 0; | 3360 | return 0; |
| 3361 | 3361 | ||
diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c index b2dc2c81a147..2e09edb9cdf8 100644 --- a/drivers/net/ethernet/dlink/dl2k.c +++ b/drivers/net/ethernet/dlink/dl2k.c | |||
| @@ -1259,55 +1259,21 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
| 1259 | { | 1259 | { |
| 1260 | int phy_addr; | 1260 | int phy_addr; |
| 1261 | struct netdev_private *np = netdev_priv(dev); | 1261 | struct netdev_private *np = netdev_priv(dev); |
| 1262 | struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; | 1262 | struct mii_ioctl_data *miidata = if_mii(rq); |
| 1263 | |||
| 1264 | struct netdev_desc *desc; | ||
| 1265 | int i; | ||
| 1266 | 1263 | ||
| 1267 | phy_addr = np->phy_addr; | 1264 | phy_addr = np->phy_addr; |
| 1268 | switch (cmd) { | 1265 | switch (cmd) { |
| 1269 | case SIOCDEVPRIVATE: | 1266 | case SIOCGMIIPHY: |
| 1270 | break; | 1267 | miidata->phy_id = phy_addr; |
| 1271 | |||
| 1272 | case SIOCDEVPRIVATE + 1: | ||
| 1273 | miidata->out_value = mii_read (dev, phy_addr, miidata->reg_num); | ||
| 1274 | break; | 1268 | break; |
| 1275 | case SIOCDEVPRIVATE + 2: | 1269 | case SIOCGMIIREG: |
| 1276 | mii_write (dev, phy_addr, miidata->reg_num, miidata->in_value); | 1270 | miidata->val_out = mii_read (dev, phy_addr, miidata->reg_num); |
| 1277 | break; | 1271 | break; |
| 1278 | case SIOCDEVPRIVATE + 3: | 1272 | case SIOCSMIIREG: |
| 1279 | break; | 1273 | if (!capable(CAP_NET_ADMIN)) |
| 1280 | case SIOCDEVPRIVATE + 4: | 1274 | return -EPERM; |
| 1281 | break; | 1275 | mii_write (dev, phy_addr, miidata->reg_num, miidata->val_in); |
| 1282 | case SIOCDEVPRIVATE + 5: | ||
| 1283 | netif_stop_queue (dev); | ||
| 1284 | break; | 1276 | break; |
| 1285 | case SIOCDEVPRIVATE + 6: | ||
| 1286 | netif_wake_queue (dev); | ||
| 1287 | break; | ||
| 1288 | case SIOCDEVPRIVATE + 7: | ||
| 1289 | printk | ||
| 1290 | ("tx_full=%x cur_tx=%lx old_tx=%lx cur_rx=%lx old_rx=%lx\n", | ||
| 1291 | netif_queue_stopped(dev), np->cur_tx, np->old_tx, np->cur_rx, | ||
| 1292 | np->old_rx); | ||
| 1293 | break; | ||
| 1294 | case SIOCDEVPRIVATE + 8: | ||
| 1295 | printk("TX ring:\n"); | ||
| 1296 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
| 1297 | desc = &np->tx_ring[i]; | ||
| 1298 | printk | ||
| 1299 | ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", | ||
| 1300 | i, | ||
| 1301 | (u32) (np->tx_ring_dma + i * sizeof (*desc)), | ||
| 1302 | (u32)le64_to_cpu(desc->next_desc), | ||
| 1303 | (u32)le64_to_cpu(desc->status), | ||
| 1304 | (u32)(le64_to_cpu(desc->fraginfo) >> 32), | ||
| 1305 | (u32)le64_to_cpu(desc->fraginfo)); | ||
| 1306 | printk ("\n"); | ||
| 1307 | } | ||
| 1308 | printk ("\n"); | ||
| 1309 | break; | ||
| 1310 | |||
| 1311 | default: | 1277 | default: |
| 1312 | return -EOPNOTSUPP; | 1278 | return -EOPNOTSUPP; |
| 1313 | } | 1279 | } |
diff --git a/drivers/net/ethernet/dlink/dl2k.h b/drivers/net/ethernet/dlink/dl2k.h index ba0adcafa55a..30c2da3de548 100644 --- a/drivers/net/ethernet/dlink/dl2k.h +++ b/drivers/net/ethernet/dlink/dl2k.h | |||
| @@ -365,13 +365,6 @@ struct ioctl_data { | |||
| 365 | char *data; | 365 | char *data; |
| 366 | }; | 366 | }; |
| 367 | 367 | ||
| 368 | struct mii_data { | ||
| 369 | __u16 reserved; | ||
| 370 | __u16 reg_num; | ||
| 371 | __u16 in_value; | ||
| 372 | __u16 out_value; | ||
| 373 | }; | ||
| 374 | |||
| 375 | /* The Rx and Tx buffer descriptors. */ | 368 | /* The Rx and Tx buffer descriptors. */ |
| 376 | struct netdev_desc { | 369 | struct netdev_desc { |
| 377 | __le64 next_desc; | 370 | __le64 next_desc; |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 17a46e76123f..9ac14f804851 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
| @@ -116,10 +116,10 @@ static struct ucc_geth_info ugeth_primary_info = { | |||
| 116 | .maxGroupAddrInHash = 4, | 116 | .maxGroupAddrInHash = 4, |
| 117 | .maxIndAddrInHash = 4, | 117 | .maxIndAddrInHash = 4, |
| 118 | .prel = 7, | 118 | .prel = 7, |
| 119 | .maxFrameLength = 1518, | 119 | .maxFrameLength = 1518+16, /* Add extra bytes for VLANs etc. */ |
| 120 | .minFrameLength = 64, | 120 | .minFrameLength = 64, |
| 121 | .maxD1Length = 1520, | 121 | .maxD1Length = 1520+16, /* Add extra bytes for VLANs etc. */ |
| 122 | .maxD2Length = 1520, | 122 | .maxD2Length = 1520+16, /* Add extra bytes for VLANs etc. */ |
| 123 | .vlantype = 0x8100, | 123 | .vlantype = 0x8100, |
| 124 | .ecamptr = ((uint32_t) NULL), | 124 | .ecamptr = ((uint32_t) NULL), |
| 125 | .eventRegMask = UCCE_OTHER, | 125 | .eventRegMask = UCCE_OTHER, |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h index 2e395a2566b8..f71b3e7b12de 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.h +++ b/drivers/net/ethernet/freescale/ucc_geth.h | |||
| @@ -877,7 +877,7 @@ struct ucc_geth_hardware_statistics { | |||
| 877 | 877 | ||
| 878 | /* Driver definitions */ | 878 | /* Driver definitions */ |
| 879 | #define TX_BD_RING_LEN 0x10 | 879 | #define TX_BD_RING_LEN 0x10 |
| 880 | #define RX_BD_RING_LEN 0x10 | 880 | #define RX_BD_RING_LEN 0x20 |
| 881 | 881 | ||
| 882 | #define TX_RING_MOD_MASK(size) (size-1) | 882 | #define TX_RING_MOD_MASK(size) (size-1) |
| 883 | #define RX_RING_MOD_MASK(size) (size-1) | 883 | #define RX_RING_MOD_MASK(size) (size-1) |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 3516e17a399d..f4d2da0db1b1 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
| @@ -290,16 +290,18 @@ static void ehea_update_bcmc_registrations(void) | |||
| 290 | 290 | ||
| 291 | arr[i].adh = adapter->handle; | 291 | arr[i].adh = adapter->handle; |
| 292 | arr[i].port_id = port->logical_port_id; | 292 | arr[i].port_id = port->logical_port_id; |
| 293 | arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | | 293 | arr[i].reg_type = EHEA_BCMC_MULTICAST | |
| 294 | EHEA_BCMC_MULTICAST | | ||
| 295 | EHEA_BCMC_UNTAGGED; | 294 | EHEA_BCMC_UNTAGGED; |
| 295 | if (mc_entry->macaddr == 0) | ||
| 296 | arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
| 296 | arr[i++].macaddr = mc_entry->macaddr; | 297 | arr[i++].macaddr = mc_entry->macaddr; |
| 297 | 298 | ||
| 298 | arr[i].adh = adapter->handle; | 299 | arr[i].adh = adapter->handle; |
| 299 | arr[i].port_id = port->logical_port_id; | 300 | arr[i].port_id = port->logical_port_id; |
| 300 | arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | | 301 | arr[i].reg_type = EHEA_BCMC_MULTICAST | |
| 301 | EHEA_BCMC_MULTICAST | | ||
| 302 | EHEA_BCMC_VLANID_ALL; | 302 | EHEA_BCMC_VLANID_ALL; |
| 303 | if (mc_entry->macaddr == 0) | ||
| 304 | arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
| 303 | arr[i++].macaddr = mc_entry->macaddr; | 305 | arr[i++].macaddr = mc_entry->macaddr; |
| 304 | num_registrations -= 2; | 306 | num_registrations -= 2; |
| 305 | } | 307 | } |
| @@ -1838,8 +1840,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr, | |||
| 1838 | u64 hret; | 1840 | u64 hret; |
| 1839 | u8 reg_type; | 1841 | u8 reg_type; |
| 1840 | 1842 | ||
| 1841 | reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST | 1843 | reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_UNTAGGED; |
| 1842 | | EHEA_BCMC_UNTAGGED; | 1844 | if (mc_mac_addr == 0) |
| 1845 | reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
| 1843 | 1846 | ||
| 1844 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, | 1847 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, |
| 1845 | port->logical_port_id, | 1848 | port->logical_port_id, |
| @@ -1847,8 +1850,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr, | |||
| 1847 | if (hret) | 1850 | if (hret) |
| 1848 | goto out; | 1851 | goto out; |
| 1849 | 1852 | ||
| 1850 | reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST | 1853 | reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_VLANID_ALL; |
| 1851 | | EHEA_BCMC_VLANID_ALL; | 1854 | if (mc_mac_addr == 0) |
| 1855 | reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
| 1852 | 1856 | ||
| 1853 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, | 1857 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, |
| 1854 | port->logical_port_id, | 1858 | port->logical_port_id, |
| @@ -1898,7 +1902,7 @@ static void ehea_allmulti(struct net_device *dev, int enable) | |||
| 1898 | netdev_err(dev, | 1902 | netdev_err(dev, |
| 1899 | "failed enabling IFF_ALLMULTI\n"); | 1903 | "failed enabling IFF_ALLMULTI\n"); |
| 1900 | } | 1904 | } |
| 1901 | } else | 1905 | } else { |
| 1902 | if (!enable) { | 1906 | if (!enable) { |
| 1903 | /* Disable ALLMULTI */ | 1907 | /* Disable ALLMULTI */ |
| 1904 | hret = ehea_multicast_reg_helper(port, 0, H_DEREG_BCMC); | 1908 | hret = ehea_multicast_reg_helper(port, 0, H_DEREG_BCMC); |
| @@ -1908,6 +1912,7 @@ static void ehea_allmulti(struct net_device *dev, int enable) | |||
| 1908 | netdev_err(dev, | 1912 | netdev_err(dev, |
| 1909 | "failed disabling IFF_ALLMULTI\n"); | 1913 | "failed disabling IFF_ALLMULTI\n"); |
| 1910 | } | 1914 | } |
| 1915 | } | ||
| 1911 | } | 1916 | } |
| 1912 | 1917 | ||
| 1913 | static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr) | 1918 | static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr) |
| @@ -1941,11 +1946,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
| 1941 | struct netdev_hw_addr *ha; | 1946 | struct netdev_hw_addr *ha; |
| 1942 | int ret; | 1947 | int ret; |
| 1943 | 1948 | ||
| 1944 | if (port->promisc) { | 1949 | ehea_promiscuous(dev, !!(dev->flags & IFF_PROMISC)); |
| 1945 | ehea_promiscuous(dev, 1); | ||
| 1946 | return; | ||
| 1947 | } | ||
| 1948 | ehea_promiscuous(dev, 0); | ||
| 1949 | 1950 | ||
| 1950 | if (dev->flags & IFF_ALLMULTI) { | 1951 | if (dev->flags & IFF_ALLMULTI) { |
| 1951 | ehea_allmulti(dev, 1); | 1952 | ehea_allmulti(dev, 1); |
| @@ -2463,6 +2464,7 @@ static int ehea_down(struct net_device *dev) | |||
| 2463 | return 0; | 2464 | return 0; |
| 2464 | 2465 | ||
| 2465 | ehea_drop_multicast_list(dev); | 2466 | ehea_drop_multicast_list(dev); |
| 2467 | ehea_allmulti(dev, 0); | ||
| 2466 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | 2468 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); |
| 2467 | 2469 | ||
| 2468 | ehea_free_interrupts(dev); | 2470 | ehea_free_interrupts(dev); |
| @@ -3261,6 +3263,7 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, | |||
| 3261 | struct ehea_adapter *adapter; | 3263 | struct ehea_adapter *adapter; |
| 3262 | const u64 *adapter_handle; | 3264 | const u64 *adapter_handle; |
| 3263 | int ret; | 3265 | int ret; |
| 3266 | int i; | ||
| 3264 | 3267 | ||
| 3265 | if (!dev || !dev->dev.of_node) { | 3268 | if (!dev || !dev->dev.of_node) { |
| 3266 | pr_err("Invalid ibmebus device probed\n"); | 3269 | pr_err("Invalid ibmebus device probed\n"); |
| @@ -3314,17 +3317,9 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, | |||
| 3314 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, | 3317 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, |
| 3315 | (unsigned long)adapter); | 3318 | (unsigned long)adapter); |
| 3316 | 3319 | ||
| 3317 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, | ||
| 3318 | ehea_interrupt_neq, IRQF_DISABLED, | ||
| 3319 | "ehea_neq", adapter); | ||
| 3320 | if (ret) { | ||
| 3321 | dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); | ||
| 3322 | goto out_kill_eq; | ||
| 3323 | } | ||
| 3324 | |||
| 3325 | ret = ehea_create_device_sysfs(dev); | 3320 | ret = ehea_create_device_sysfs(dev); |
| 3326 | if (ret) | 3321 | if (ret) |
| 3327 | goto out_free_irq; | 3322 | goto out_kill_eq; |
| 3328 | 3323 | ||
| 3329 | ret = ehea_setup_ports(adapter); | 3324 | ret = ehea_setup_ports(adapter); |
| 3330 | if (ret) { | 3325 | if (ret) { |
| @@ -3332,15 +3327,30 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, | |||
| 3332 | goto out_rem_dev_sysfs; | 3327 | goto out_rem_dev_sysfs; |
| 3333 | } | 3328 | } |
| 3334 | 3329 | ||
| 3330 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, | ||
| 3331 | ehea_interrupt_neq, IRQF_DISABLED, | ||
| 3332 | "ehea_neq", adapter); | ||
| 3333 | if (ret) { | ||
| 3334 | dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); | ||
| 3335 | goto out_shutdown_ports; | ||
| 3336 | } | ||
| 3337 | |||
| 3338 | /* Handle any events that might be pending. */ | ||
| 3339 | tasklet_hi_schedule(&adapter->neq_tasklet); | ||
| 3340 | |||
| 3335 | ret = 0; | 3341 | ret = 0; |
| 3336 | goto out; | 3342 | goto out; |
| 3337 | 3343 | ||
| 3344 | out_shutdown_ports: | ||
| 3345 | for (i = 0; i < EHEA_MAX_PORTS; i++) | ||
| 3346 | if (adapter->port[i]) { | ||
| 3347 | ehea_shutdown_single_port(adapter->port[i]); | ||
| 3348 | adapter->port[i] = NULL; | ||
| 3349 | } | ||
| 3350 | |||
| 3338 | out_rem_dev_sysfs: | 3351 | out_rem_dev_sysfs: |
| 3339 | ehea_remove_device_sysfs(dev); | 3352 | ehea_remove_device_sysfs(dev); |
| 3340 | 3353 | ||
| 3341 | out_free_irq: | ||
| 3342 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); | ||
| 3343 | |||
| 3344 | out_kill_eq: | 3354 | out_kill_eq: |
| 3345 | ehea_destroy_eq(adapter->neq); | 3355 | ehea_destroy_eq(adapter->neq); |
| 3346 | 3356 | ||
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_phyp.h b/drivers/net/ethernet/ibm/ehea/ehea_phyp.h index 52c456ec4d6c..8364815c32ff 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_phyp.h +++ b/drivers/net/ethernet/ibm/ehea/ehea_phyp.h | |||
| @@ -450,7 +450,7 @@ u64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num, | |||
| 450 | void *cb_addr); | 450 | void *cb_addr); |
| 451 | 451 | ||
| 452 | #define H_REGBCMC_PN EHEA_BMASK_IBM(48, 63) | 452 | #define H_REGBCMC_PN EHEA_BMASK_IBM(48, 63) |
| 453 | #define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(61, 63) | 453 | #define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(60, 63) |
| 454 | #define H_REGBCMC_MACADDR EHEA_BMASK_IBM(16, 63) | 454 | #define H_REGBCMC_MACADDR EHEA_BMASK_IBM(16, 63) |
| 455 | #define H_REGBCMC_VLANID EHEA_BMASK_IBM(52, 63) | 455 | #define H_REGBCMC_VLANID EHEA_BMASK_IBM(52, 63) |
| 456 | 456 | ||
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 4348b6fd44fa..8d8908d2a9b1 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
| @@ -493,7 +493,11 @@ out: | |||
| 493 | static void e1000_down_and_stop(struct e1000_adapter *adapter) | 493 | static void e1000_down_and_stop(struct e1000_adapter *adapter) |
| 494 | { | 494 | { |
| 495 | set_bit(__E1000_DOWN, &adapter->flags); | 495 | set_bit(__E1000_DOWN, &adapter->flags); |
| 496 | cancel_work_sync(&adapter->reset_task); | 496 | |
| 497 | /* Only kill reset task if adapter is not resetting */ | ||
| 498 | if (!test_bit(__E1000_RESETTING, &adapter->flags)) | ||
| 499 | cancel_work_sync(&adapter->reset_task); | ||
| 500 | |||
| 497 | cancel_delayed_work_sync(&adapter->watchdog_task); | 501 | cancel_delayed_work_sync(&adapter->watchdog_task); |
| 498 | cancel_delayed_work_sync(&adapter->phy_info_task); | 502 | cancel_delayed_work_sync(&adapter->phy_info_task); |
| 499 | cancel_delayed_work_sync(&adapter->fifo_stall_task); | 503 | cancel_delayed_work_sync(&adapter->fifo_stall_task); |
| @@ -3380,7 +3384,7 @@ static void e1000_dump(struct e1000_adapter *adapter) | |||
| 3380 | for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { | 3384 | for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { |
| 3381 | struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i); | 3385 | struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i); |
| 3382 | struct e1000_buffer *buffer_info = &tx_ring->buffer_info[i]; | 3386 | struct e1000_buffer *buffer_info = &tx_ring->buffer_info[i]; |
| 3383 | struct my_u { u64 a; u64 b; }; | 3387 | struct my_u { __le64 a; __le64 b; }; |
| 3384 | struct my_u *u = (struct my_u *)tx_desc; | 3388 | struct my_u *u = (struct my_u *)tx_desc; |
| 3385 | const char *type; | 3389 | const char *type; |
| 3386 | 3390 | ||
| @@ -3424,7 +3428,7 @@ rx_ring_summary: | |||
| 3424 | for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { | 3428 | for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { |
| 3425 | struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i); | 3429 | struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i); |
| 3426 | struct e1000_buffer *buffer_info = &rx_ring->buffer_info[i]; | 3430 | struct e1000_buffer *buffer_info = &rx_ring->buffer_info[i]; |
| 3427 | struct my_u { u64 a; u64 b; }; | 3431 | struct my_u { __le64 a; __le64 b; }; |
| 3428 | struct my_u *u = (struct my_u *)rx_desc; | 3432 | struct my_u *u = (struct my_u *)rx_desc; |
| 3429 | const char *type; | 3433 | const char *type; |
| 3430 | 3434 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 19ab2154802c..9520a6ac1f30 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
| @@ -3799,7 +3799,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) | |||
| 3799 | /* fire an unusual interrupt on the test handler */ | 3799 | /* fire an unusual interrupt on the test handler */ |
| 3800 | ew32(ICS, E1000_ICS_RXSEQ); | 3800 | ew32(ICS, E1000_ICS_RXSEQ); |
| 3801 | e1e_flush(); | 3801 | e1e_flush(); |
| 3802 | msleep(50); | 3802 | msleep(100); |
| 3803 | 3803 | ||
| 3804 | e1000_irq_disable(adapter); | 3804 | e1000_irq_disable(adapter); |
| 3805 | 3805 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/param.c b/drivers/net/ethernet/intel/e1000e/param.c index ff796e42c3eb..16adeb9418a8 100644 --- a/drivers/net/ethernet/intel/e1000e/param.c +++ b/drivers/net/ethernet/intel/e1000e/param.c | |||
| @@ -106,7 +106,7 @@ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); | |||
| 106 | /* | 106 | /* |
| 107 | * Interrupt Throttle Rate (interrupts/sec) | 107 | * Interrupt Throttle Rate (interrupts/sec) |
| 108 | * | 108 | * |
| 109 | * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative) | 109 | * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative |
| 110 | */ | 110 | */ |
| 111 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); | 111 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); |
| 112 | #define DEFAULT_ITR 3 | 112 | #define DEFAULT_ITR 3 |
| @@ -344,53 +344,60 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
| 344 | 344 | ||
| 345 | if (num_InterruptThrottleRate > bd) { | 345 | if (num_InterruptThrottleRate > bd) { |
| 346 | adapter->itr = InterruptThrottleRate[bd]; | 346 | adapter->itr = InterruptThrottleRate[bd]; |
| 347 | switch (adapter->itr) { | 347 | |
| 348 | case 0: | 348 | /* |
| 349 | e_info("%s turned off\n", opt.name); | 349 | * Make sure a message is printed for non-special |
| 350 | break; | 350 | * values. And in case of an invalid option, display |
| 351 | case 1: | 351 | * warning, use default and got through itr/itr_setting |
| 352 | e_info("%s set to dynamic mode\n", opt.name); | 352 | * adjustment logic below |
| 353 | adapter->itr_setting = adapter->itr; | 353 | */ |
| 354 | adapter->itr = 20000; | 354 | if ((adapter->itr > 4) && |
| 355 | break; | 355 | e1000_validate_option(&adapter->itr, &opt, adapter)) |
| 356 | case 3: | 356 | adapter->itr = opt.def; |
| 357 | e_info("%s set to dynamic conservative mode\n", | ||
| 358 | opt.name); | ||
| 359 | adapter->itr_setting = adapter->itr; | ||
| 360 | adapter->itr = 20000; | ||
| 361 | break; | ||
| 362 | case 4: | ||
| 363 | e_info("%s set to simplified (2000-8000 ints) " | ||
| 364 | "mode\n", opt.name); | ||
| 365 | adapter->itr_setting = 4; | ||
| 366 | break; | ||
| 367 | default: | ||
| 368 | /* | ||
| 369 | * Save the setting, because the dynamic bits | ||
| 370 | * change itr. | ||
| 371 | */ | ||
| 372 | if (e1000_validate_option(&adapter->itr, &opt, | ||
| 373 | adapter) && | ||
| 374 | (adapter->itr == 3)) { | ||
| 375 | /* | ||
| 376 | * In case of invalid user value, | ||
| 377 | * default to conservative mode. | ||
| 378 | */ | ||
| 379 | adapter->itr_setting = adapter->itr; | ||
| 380 | adapter->itr = 20000; | ||
| 381 | } else { | ||
| 382 | /* | ||
| 383 | * Clear the lower two bits because | ||
| 384 | * they are used as control. | ||
| 385 | */ | ||
| 386 | adapter->itr_setting = | ||
| 387 | adapter->itr & ~3; | ||
| 388 | } | ||
| 389 | break; | ||
| 390 | } | ||
| 391 | } else { | 357 | } else { |
| 392 | adapter->itr_setting = opt.def; | 358 | /* |
| 359 | * If no option specified, use default value and go | ||
| 360 | * through the logic below to adjust itr/itr_setting | ||
| 361 | */ | ||
| 362 | adapter->itr = opt.def; | ||
| 363 | |||
| 364 | /* | ||
| 365 | * Make sure a message is printed for non-special | ||
| 366 | * default values | ||
| 367 | */ | ||
| 368 | if (adapter->itr > 40) | ||
| 369 | e_info("%s set to default %d\n", opt.name, | ||
| 370 | adapter->itr); | ||
| 371 | } | ||
| 372 | |||
| 373 | adapter->itr_setting = adapter->itr; | ||
| 374 | switch (adapter->itr) { | ||
| 375 | case 0: | ||
| 376 | e_info("%s turned off\n", opt.name); | ||
| 377 | break; | ||
| 378 | case 1: | ||
| 379 | e_info("%s set to dynamic mode\n", opt.name); | ||
| 380 | adapter->itr = 20000; | ||
| 381 | break; | ||
| 382 | case 3: | ||
| 383 | e_info("%s set to dynamic conservative mode\n", | ||
| 384 | opt.name); | ||
| 393 | adapter->itr = 20000; | 385 | adapter->itr = 20000; |
| 386 | break; | ||
| 387 | case 4: | ||
| 388 | e_info("%s set to simplified (2000-8000 ints) mode\n", | ||
| 389 | opt.name); | ||
| 390 | break; | ||
| 391 | default: | ||
| 392 | /* | ||
| 393 | * Save the setting, because the dynamic bits | ||
| 394 | * change itr. | ||
| 395 | * | ||
| 396 | * Clear the lower two bits because | ||
| 397 | * they are used as control. | ||
| 398 | */ | ||
| 399 | adapter->itr_setting &= ~3; | ||
| 400 | break; | ||
| 394 | } | 401 | } |
| 395 | } | 402 | } |
| 396 | { /* Interrupt Mode */ | 403 | { /* Interrupt Mode */ |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 5ec31598ee47..8683ca4748c8 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
| @@ -1111,9 +1111,12 @@ msi_only: | |||
| 1111 | adapter->flags |= IGB_FLAG_HAS_MSI; | 1111 | adapter->flags |= IGB_FLAG_HAS_MSI; |
| 1112 | out: | 1112 | out: |
| 1113 | /* Notify the stack of the (possibly) reduced queue counts. */ | 1113 | /* Notify the stack of the (possibly) reduced queue counts. */ |
| 1114 | rtnl_lock(); | ||
| 1114 | netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues); | 1115 | netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues); |
| 1115 | return netif_set_real_num_rx_queues(adapter->netdev, | 1116 | err = netif_set_real_num_rx_queues(adapter->netdev, |
| 1116 | adapter->num_rx_queues); | 1117 | adapter->num_rx_queues); |
| 1118 | rtnl_unlock(); | ||
| 1119 | return err; | ||
| 1117 | } | 1120 | } |
| 1118 | 1121 | ||
| 1119 | /** | 1122 | /** |
| @@ -2771,8 +2774,6 @@ void igb_configure_tx_ring(struct igb_adapter *adapter, | |||
| 2771 | 2774 | ||
| 2772 | txdctl |= E1000_TXDCTL_QUEUE_ENABLE; | 2775 | txdctl |= E1000_TXDCTL_QUEUE_ENABLE; |
| 2773 | wr32(E1000_TXDCTL(reg_idx), txdctl); | 2776 | wr32(E1000_TXDCTL(reg_idx), txdctl); |
| 2774 | |||
| 2775 | netdev_tx_reset_queue(txring_txq(ring)); | ||
| 2776 | } | 2777 | } |
| 2777 | 2778 | ||
| 2778 | /** | 2779 | /** |
| @@ -3282,6 +3283,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring) | |||
| 3282 | igb_unmap_and_free_tx_resource(tx_ring, buffer_info); | 3283 | igb_unmap_and_free_tx_resource(tx_ring, buffer_info); |
| 3283 | } | 3284 | } |
| 3284 | 3285 | ||
| 3286 | netdev_tx_reset_queue(txring_txq(tx_ring)); | ||
| 3287 | |||
| 3285 | size = sizeof(struct igb_tx_buffer) * tx_ring->count; | 3288 | size = sizeof(struct igb_tx_buffer) * tx_ring->count; |
| 3286 | memset(tx_ring->tx_buffer_info, 0, size); | 3289 | memset(tx_ring->tx_buffer_info, 0, size); |
| 3287 | 3290 | ||
| @@ -6796,18 +6799,7 @@ static int igb_resume(struct device *dev) | |||
| 6796 | pci_enable_wake(pdev, PCI_D3hot, 0); | 6799 | pci_enable_wake(pdev, PCI_D3hot, 0); |
| 6797 | pci_enable_wake(pdev, PCI_D3cold, 0); | 6800 | pci_enable_wake(pdev, PCI_D3cold, 0); |
| 6798 | 6801 | ||
| 6799 | if (!rtnl_is_locked()) { | 6802 | if (igb_init_interrupt_scheme(adapter)) { |
| 6800 | /* | ||
| 6801 | * shut up ASSERT_RTNL() warning in | ||
| 6802 | * netif_set_real_num_tx/rx_queues. | ||
| 6803 | */ | ||
| 6804 | rtnl_lock(); | ||
| 6805 | err = igb_init_interrupt_scheme(adapter); | ||
| 6806 | rtnl_unlock(); | ||
| 6807 | } else { | ||
| 6808 | err = igb_init_interrupt_scheme(adapter); | ||
| 6809 | } | ||
| 6810 | if (err) { | ||
| 6811 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); | 6803 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); |
| 6812 | return -ENOMEM; | 6804 | return -ENOMEM; |
| 6813 | } | 6805 | } |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index d61ca2a732f0..8ec74b07f940 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
| @@ -2731,14 +2731,14 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
| 2731 | netdev->addr_len); | 2731 | netdev->addr_len); |
| 2732 | } | 2732 | } |
| 2733 | 2733 | ||
| 2734 | if (!is_valid_ether_addr(netdev->perm_addr)) { | 2734 | if (!is_valid_ether_addr(netdev->dev_addr)) { |
| 2735 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", | 2735 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", |
| 2736 | netdev->dev_addr); | 2736 | netdev->dev_addr); |
| 2737 | err = -EIO; | 2737 | err = -EIO; |
| 2738 | goto err_hw_init; | 2738 | goto err_hw_init; |
| 2739 | } | 2739 | } |
| 2740 | 2740 | ||
| 2741 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | 2741 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); |
| 2742 | 2742 | ||
| 2743 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, | 2743 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, |
| 2744 | (unsigned long) adapter); | 2744 | (unsigned long) adapter); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 74e192107f9a..81b155589532 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
| @@ -574,9 +574,6 @@ extern struct ixgbe_info ixgbe_82599_info; | |||
| 574 | extern struct ixgbe_info ixgbe_X540_info; | 574 | extern struct ixgbe_info ixgbe_X540_info; |
| 575 | #ifdef CONFIG_IXGBE_DCB | 575 | #ifdef CONFIG_IXGBE_DCB |
| 576 | extern const struct dcbnl_rtnl_ops dcbnl_ops; | 576 | extern const struct dcbnl_rtnl_ops dcbnl_ops; |
| 577 | extern int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, | ||
| 578 | struct ixgbe_dcb_config *dst_dcb_cfg, | ||
| 579 | int tc_max); | ||
| 580 | #endif | 577 | #endif |
| 581 | 578 | ||
| 582 | extern char ixgbe_driver_name[]; | 579 | extern char ixgbe_driver_name[]; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c index 652e4b09546d..32e5c02ff6d0 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | |||
| @@ -44,18 +44,26 @@ | |||
| 44 | #define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ | 44 | #define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ |
| 45 | #define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ | 45 | #define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ |
| 46 | 46 | ||
| 47 | int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *scfg, | 47 | static int ixgbe_copy_dcb_cfg(struct ixgbe_adapter *adapter, int tc_max) |
| 48 | struct ixgbe_dcb_config *dcfg, int tc_max) | ||
| 49 | { | 48 | { |
| 49 | struct ixgbe_dcb_config *scfg = &adapter->temp_dcb_cfg; | ||
| 50 | struct ixgbe_dcb_config *dcfg = &adapter->dcb_cfg; | ||
| 50 | struct tc_configuration *src = NULL; | 51 | struct tc_configuration *src = NULL; |
| 51 | struct tc_configuration *dst = NULL; | 52 | struct tc_configuration *dst = NULL; |
| 52 | int i, j; | 53 | int i, j; |
| 53 | int tx = DCB_TX_CONFIG; | 54 | int tx = DCB_TX_CONFIG; |
| 54 | int rx = DCB_RX_CONFIG; | 55 | int rx = DCB_RX_CONFIG; |
| 55 | int changes = 0; | 56 | int changes = 0; |
| 57 | #ifdef IXGBE_FCOE | ||
| 58 | struct dcb_app app = { | ||
| 59 | .selector = DCB_APP_IDTYPE_ETHTYPE, | ||
| 60 | .protocol = ETH_P_FCOE, | ||
| 61 | }; | ||
| 62 | u8 up = dcb_getapp(adapter->netdev, &app); | ||
| 56 | 63 | ||
| 57 | if (!scfg || !dcfg) | 64 | if (up && !(up & (1 << adapter->fcoe.up))) |
| 58 | return changes; | 65 | changes |= BIT_APP_UPCHG; |
| 66 | #endif | ||
| 59 | 67 | ||
| 60 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { | 68 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { |
| 61 | src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0]; | 69 | src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
| @@ -332,28 +340,12 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
| 332 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 340 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| 333 | int ret = DCB_NO_HW_CHG; | 341 | int ret = DCB_NO_HW_CHG; |
| 334 | int i; | 342 | int i; |
| 335 | #ifdef IXGBE_FCOE | ||
| 336 | struct dcb_app app = { | ||
| 337 | .selector = DCB_APP_IDTYPE_ETHTYPE, | ||
| 338 | .protocol = ETH_P_FCOE, | ||
| 339 | }; | ||
| 340 | u8 up; | ||
| 341 | |||
| 342 | /* In IEEE mode, use the IEEE Ethertype selector value */ | ||
| 343 | if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) { | ||
| 344 | app.selector = IEEE_8021QAZ_APP_SEL_ETHERTYPE; | ||
| 345 | up = dcb_ieee_getapp_mask(netdev, &app); | ||
| 346 | } else { | ||
| 347 | up = dcb_getapp(netdev, &app); | ||
| 348 | } | ||
| 349 | #endif | ||
| 350 | 343 | ||
| 351 | /* Fail command if not in CEE mode */ | 344 | /* Fail command if not in CEE mode */ |
| 352 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 345 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
| 353 | return ret; | 346 | return ret; |
| 354 | 347 | ||
| 355 | adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, | 348 | adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(adapter, |
| 356 | &adapter->dcb_cfg, | ||
| 357 | MAX_TRAFFIC_CLASS); | 349 | MAX_TRAFFIC_CLASS); |
| 358 | if (!adapter->dcb_set_bitmap) | 350 | if (!adapter->dcb_set_bitmap) |
| 359 | return ret; | 351 | return ret; |
| @@ -440,8 +432,13 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
| 440 | * FCoE is using changes. This happens if the APP info | 432 | * FCoE is using changes. This happens if the APP info |
| 441 | * changes or the up2tc mapping is updated. | 433 | * changes or the up2tc mapping is updated. |
| 442 | */ | 434 | */ |
| 443 | if ((up && !(up & (1 << adapter->fcoe.up))) || | 435 | if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) { |
| 444 | (adapter->dcb_set_bitmap & BIT_APP_UPCHG)) { | 436 | struct dcb_app app = { |
| 437 | .selector = DCB_APP_IDTYPE_ETHTYPE, | ||
| 438 | .protocol = ETH_P_FCOE, | ||
| 439 | }; | ||
| 440 | u8 up = dcb_getapp(netdev, &app); | ||
| 441 | |||
| 445 | adapter->fcoe.up = ffs(up) - 1; | 442 | adapter->fcoe.up = ffs(up) - 1; |
| 446 | ixgbe_dcbnl_devreset(netdev); | 443 | ixgbe_dcbnl_devreset(netdev); |
| 447 | ret = DCB_HW_CHG_RST; | 444 | ret = DCB_HW_CHG_RST; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 31a2bf76a346..cfe7d269590c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
| @@ -1780,6 +1780,8 @@ static u16 ixgbe_clean_test_rings(struct ixgbe_ring *rx_ring, | |||
| 1780 | rx_desc = IXGBE_RX_DESC(rx_ring, rx_ntc); | 1780 | rx_desc = IXGBE_RX_DESC(rx_ring, rx_ntc); |
| 1781 | } | 1781 | } |
| 1782 | 1782 | ||
| 1783 | netdev_tx_reset_queue(txring_txq(tx_ring)); | ||
| 1784 | |||
| 1783 | /* re-map buffers to ring, store next to clean values */ | 1785 | /* re-map buffers to ring, store next to clean values */ |
| 1784 | ixgbe_alloc_rx_buffers(rx_ring, count); | 1786 | ixgbe_alloc_rx_buffers(rx_ring, count); |
| 1785 | rx_ring->next_to_clean = rx_ntc; | 1787 | rx_ring->next_to_clean = rx_ntc; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 77ea4b716535..bc07933d67da 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | |||
| @@ -437,6 +437,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, | |||
| 437 | */ | 437 | */ |
| 438 | if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && | 438 | if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && |
| 439 | (fctl & FC_FC_END_SEQ)) { | 439 | (fctl & FC_FC_END_SEQ)) { |
| 440 | skb_linearize(skb); | ||
| 440 | crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); | 441 | crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); |
| 441 | crc->fcoe_eof = FC_EOF_T; | 442 | crc->fcoe_eof = FC_EOF_T; |
| 442 | } | 443 | } |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index a7f3cd872caf..467948e9ecd9 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
| @@ -2671,8 +2671,6 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter, | |||
| 2671 | /* enable queue */ | 2671 | /* enable queue */ |
| 2672 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), txdctl); | 2672 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), txdctl); |
| 2673 | 2673 | ||
| 2674 | netdev_tx_reset_queue(txring_txq(ring)); | ||
| 2675 | |||
| 2676 | /* TXDCTL.EN will return 0 on 82598 if link is down, so skip it */ | 2674 | /* TXDCTL.EN will return 0 on 82598 if link is down, so skip it */ |
| 2677 | if (hw->mac.type == ixgbe_mac_82598EB && | 2675 | if (hw->mac.type == ixgbe_mac_82598EB && |
| 2678 | !(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP)) | 2676 | !(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP)) |
| @@ -4167,6 +4165,8 @@ static void ixgbe_clean_tx_ring(struct ixgbe_ring *tx_ring) | |||
| 4167 | ixgbe_unmap_and_free_tx_resource(tx_ring, tx_buffer_info); | 4165 | ixgbe_unmap_and_free_tx_resource(tx_ring, tx_buffer_info); |
| 4168 | } | 4166 | } |
| 4169 | 4167 | ||
| 4168 | netdev_tx_reset_queue(txring_txq(tx_ring)); | ||
| 4169 | |||
| 4170 | size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; | 4170 | size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; |
| 4171 | memset(tx_ring->tx_buffer_info, 0, size); | 4171 | memset(tx_ring->tx_buffer_info, 0, size); |
| 4172 | 4172 | ||
| @@ -4418,8 +4418,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
| 4418 | adapter->dcb_cfg.pfc_mode_enable = false; | 4418 | adapter->dcb_cfg.pfc_mode_enable = false; |
| 4419 | adapter->dcb_set_bitmap = 0x00; | 4419 | adapter->dcb_set_bitmap = 0x00; |
| 4420 | adapter->dcbx_cap = DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_CEE; | 4420 | adapter->dcbx_cap = DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_CEE; |
| 4421 | ixgbe_copy_dcb_cfg(&adapter->dcb_cfg, &adapter->temp_dcb_cfg, | 4421 | memcpy(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, |
| 4422 | MAX_TRAFFIC_CLASS); | 4422 | sizeof(adapter->temp_dcb_cfg)); |
| 4423 | 4423 | ||
| 4424 | #endif | 4424 | #endif |
| 4425 | 4425 | ||
| @@ -4866,17 +4866,15 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
| 4866 | netif_device_detach(netdev); | 4866 | netif_device_detach(netdev); |
| 4867 | 4867 | ||
| 4868 | if (netif_running(netdev)) { | 4868 | if (netif_running(netdev)) { |
| 4869 | rtnl_lock(); | ||
| 4869 | ixgbe_down(adapter); | 4870 | ixgbe_down(adapter); |
| 4870 | ixgbe_free_irq(adapter); | 4871 | ixgbe_free_irq(adapter); |
| 4871 | ixgbe_free_all_tx_resources(adapter); | 4872 | ixgbe_free_all_tx_resources(adapter); |
| 4872 | ixgbe_free_all_rx_resources(adapter); | 4873 | ixgbe_free_all_rx_resources(adapter); |
| 4874 | rtnl_unlock(); | ||
| 4873 | } | 4875 | } |
| 4874 | 4876 | ||
| 4875 | ixgbe_clear_interrupt_scheme(adapter); | 4877 | ixgbe_clear_interrupt_scheme(adapter); |
| 4876 | #ifdef CONFIG_DCB | ||
| 4877 | kfree(adapter->ixgbe_ieee_pfc); | ||
| 4878 | kfree(adapter->ixgbe_ieee_ets); | ||
| 4879 | #endif | ||
| 4880 | 4878 | ||
| 4881 | #ifdef CONFIG_PM | 4879 | #ifdef CONFIG_PM |
| 4882 | retval = pci_save_state(pdev); | 4880 | retval = pci_save_state(pdev); |
| @@ -7224,6 +7222,11 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
| 7224 | 7222 | ||
| 7225 | ixgbe_release_hw_control(adapter); | 7223 | ixgbe_release_hw_control(adapter); |
| 7226 | 7224 | ||
| 7225 | #ifdef CONFIG_DCB | ||
| 7226 | kfree(adapter->ixgbe_ieee_pfc); | ||
| 7227 | kfree(adapter->ixgbe_ieee_ets); | ||
| 7228 | |||
| 7229 | #endif | ||
| 7227 | iounmap(adapter->hw.hw_addr); | 7230 | iounmap(adapter->hw.hw_addr); |
| 7228 | pci_release_selected_regions(pdev, pci_select_bars(pdev, | 7231 | pci_release_selected_regions(pdev, pci_select_bars(pdev, |
| 7229 | IORESOURCE_MEM)); | 7232 | IORESOURCE_MEM)); |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index c9b504e2dfc3..487a6c8bd4ec 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
| @@ -2494,8 +2494,13 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2, | |||
| 2494 | skb_copy_from_linear_data(re->skb, skb->data, length); | 2494 | skb_copy_from_linear_data(re->skb, skb->data, length); |
| 2495 | skb->ip_summed = re->skb->ip_summed; | 2495 | skb->ip_summed = re->skb->ip_summed; |
| 2496 | skb->csum = re->skb->csum; | 2496 | skb->csum = re->skb->csum; |
| 2497 | skb->rxhash = re->skb->rxhash; | ||
| 2498 | skb->vlan_tci = re->skb->vlan_tci; | ||
| 2499 | |||
| 2497 | pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, | 2500 | pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, |
| 2498 | length, PCI_DMA_FROMDEVICE); | 2501 | length, PCI_DMA_FROMDEVICE); |
| 2502 | re->skb->vlan_tci = 0; | ||
| 2503 | re->skb->rxhash = 0; | ||
| 2499 | re->skb->ip_summed = CHECKSUM_NONE; | 2504 | re->skb->ip_summed = CHECKSUM_NONE; |
| 2500 | skb_put(skb, length); | 2505 | skb_put(skb, length); |
| 2501 | } | 2506 | } |
| @@ -2580,9 +2585,6 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
| 2580 | struct sk_buff *skb = NULL; | 2585 | struct sk_buff *skb = NULL; |
| 2581 | u16 count = (status & GMR_FS_LEN) >> 16; | 2586 | u16 count = (status & GMR_FS_LEN) >> 16; |
| 2582 | 2587 | ||
| 2583 | if (status & GMR_FS_VLAN) | ||
| 2584 | count -= VLAN_HLEN; /* Account for vlan tag */ | ||
| 2585 | |||
| 2586 | netif_printk(sky2, rx_status, KERN_DEBUG, dev, | 2588 | netif_printk(sky2, rx_status, KERN_DEBUG, dev, |
| 2587 | "rx slot %u status 0x%x len %d\n", | 2589 | "rx slot %u status 0x%x len %d\n", |
| 2588 | sky2->rx_next, status, length); | 2590 | sky2->rx_next, status, length); |
| @@ -2590,6 +2592,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
| 2590 | sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; | 2592 | sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; |
| 2591 | prefetch(sky2->rx_ring + sky2->rx_next); | 2593 | prefetch(sky2->rx_ring + sky2->rx_next); |
| 2592 | 2594 | ||
| 2595 | if (vlan_tx_tag_present(re->skb)) | ||
| 2596 | count -= VLAN_HLEN; /* Account for vlan tag */ | ||
| 2597 | |||
| 2593 | /* This chip has hardware problems that generates bogus status. | 2598 | /* This chip has hardware problems that generates bogus status. |
| 2594 | * So do only marginal checking and expect higher level protocols | 2599 | * So do only marginal checking and expect higher level protocols |
| 2595 | * to handle crap frames. | 2600 | * to handle crap frames. |
| @@ -2647,11 +2652,8 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) | |||
| 2647 | } | 2652 | } |
| 2648 | 2653 | ||
| 2649 | static inline void sky2_skb_rx(const struct sky2_port *sky2, | 2654 | static inline void sky2_skb_rx(const struct sky2_port *sky2, |
| 2650 | u32 status, struct sk_buff *skb) | 2655 | struct sk_buff *skb) |
| 2651 | { | 2656 | { |
| 2652 | if (status & GMR_FS_VLAN) | ||
| 2653 | __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag)); | ||
| 2654 | |||
| 2655 | if (skb->ip_summed == CHECKSUM_NONE) | 2657 | if (skb->ip_summed == CHECKSUM_NONE) |
| 2656 | netif_receive_skb(skb); | 2658 | netif_receive_skb(skb); |
| 2657 | else | 2659 | else |
| @@ -2705,6 +2707,14 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status) | |||
| 2705 | } | 2707 | } |
| 2706 | } | 2708 | } |
| 2707 | 2709 | ||
| 2710 | static void sky2_rx_tag(struct sky2_port *sky2, u16 length) | ||
| 2711 | { | ||
| 2712 | struct sk_buff *skb; | ||
| 2713 | |||
| 2714 | skb = sky2->rx_ring[sky2->rx_next].skb; | ||
| 2715 | __vlan_hwaccel_put_tag(skb, be16_to_cpu(length)); | ||
| 2716 | } | ||
| 2717 | |||
| 2708 | static void sky2_rx_hash(struct sky2_port *sky2, u32 status) | 2718 | static void sky2_rx_hash(struct sky2_port *sky2, u32 status) |
| 2709 | { | 2719 | { |
| 2710 | struct sk_buff *skb; | 2720 | struct sk_buff *skb; |
| @@ -2763,8 +2773,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
| 2763 | } | 2773 | } |
| 2764 | 2774 | ||
| 2765 | skb->protocol = eth_type_trans(skb, dev); | 2775 | skb->protocol = eth_type_trans(skb, dev); |
| 2766 | 2776 | sky2_skb_rx(sky2, skb); | |
| 2767 | sky2_skb_rx(sky2, status, skb); | ||
| 2768 | 2777 | ||
| 2769 | /* Stop after net poll weight */ | 2778 | /* Stop after net poll weight */ |
| 2770 | if (++work_done >= to_do) | 2779 | if (++work_done >= to_do) |
| @@ -2772,11 +2781,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
| 2772 | break; | 2781 | break; |
| 2773 | 2782 | ||
| 2774 | case OP_RXVLAN: | 2783 | case OP_RXVLAN: |
| 2775 | sky2->rx_tag = length; | 2784 | sky2_rx_tag(sky2, length); |
| 2776 | break; | 2785 | break; |
| 2777 | 2786 | ||
| 2778 | case OP_RXCHKSVLAN: | 2787 | case OP_RXCHKSVLAN: |
| 2779 | sky2->rx_tag = length; | 2788 | sky2_rx_tag(sky2, length); |
| 2780 | /* fall through */ | 2789 | /* fall through */ |
| 2781 | case OP_RXCHKS: | 2790 | case OP_RXCHKS: |
| 2782 | if (likely(dev->features & NETIF_F_RXCSUM)) | 2791 | if (likely(dev->features & NETIF_F_RXCSUM)) |
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h index ff6f58bf822a..3c896ce80b71 100644 --- a/drivers/net/ethernet/marvell/sky2.h +++ b/drivers/net/ethernet/marvell/sky2.h | |||
| @@ -2241,7 +2241,6 @@ struct sky2_port { | |||
| 2241 | u16 rx_pending; | 2241 | u16 rx_pending; |
| 2242 | u16 rx_data_size; | 2242 | u16 rx_data_size; |
| 2243 | u16 rx_nfrags; | 2243 | u16 rx_nfrags; |
| 2244 | u16 rx_tag; | ||
| 2245 | 2244 | ||
| 2246 | struct { | 2245 | struct { |
| 2247 | unsigned long last; | 2246 | unsigned long last; |
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index f8dda009d3c0..5e313e9a252f 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
| @@ -618,10 +618,8 @@ static void ks8851_irq_work(struct work_struct *work) | |||
| 618 | netif_dbg(ks, intr, ks->netdev, | 618 | netif_dbg(ks, intr, ks->netdev, |
| 619 | "%s: status 0x%04x\n", __func__, status); | 619 | "%s: status 0x%04x\n", __func__, status); |
| 620 | 620 | ||
| 621 | if (status & IRQ_LCI) { | 621 | if (status & IRQ_LCI) |
| 622 | /* should do something about checking link status */ | ||
| 623 | handled |= IRQ_LCI; | 622 | handled |= IRQ_LCI; |
| 624 | } | ||
| 625 | 623 | ||
| 626 | if (status & IRQ_LDI) { | 624 | if (status & IRQ_LDI) { |
| 627 | u16 pmecr = ks8851_rdreg16(ks, KS_PMECR); | 625 | u16 pmecr = ks8851_rdreg16(ks, KS_PMECR); |
| @@ -684,6 +682,9 @@ static void ks8851_irq_work(struct work_struct *work) | |||
| 684 | 682 | ||
| 685 | mutex_unlock(&ks->lock); | 683 | mutex_unlock(&ks->lock); |
| 686 | 684 | ||
| 685 | if (status & IRQ_LCI) | ||
| 686 | mii_check_link(&ks->mii); | ||
| 687 | |||
| 687 | if (status & IRQ_TXI) | 688 | if (status & IRQ_TXI) |
| 688 | netif_wake_queue(ks->netdev); | 689 | netif_wake_queue(ks->netdev); |
| 689 | 690 | ||
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h index dd14915f54bb..ba781747d174 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h | |||
| @@ -584,7 +584,6 @@ struct pch_gbe_hw_stats { | |||
| 584 | /** | 584 | /** |
| 585 | * struct pch_gbe_adapter - board specific private data structure | 585 | * struct pch_gbe_adapter - board specific private data structure |
| 586 | * @stats_lock: Spinlock structure for status | 586 | * @stats_lock: Spinlock structure for status |
| 587 | * @tx_queue_lock: Spinlock structure for transmit | ||
| 588 | * @ethtool_lock: Spinlock structure for ethtool | 587 | * @ethtool_lock: Spinlock structure for ethtool |
| 589 | * @irq_sem: Semaphore for interrupt | 588 | * @irq_sem: Semaphore for interrupt |
| 590 | * @netdev: Pointer of network device structure | 589 | * @netdev: Pointer of network device structure |
| @@ -609,7 +608,6 @@ struct pch_gbe_hw_stats { | |||
| 609 | 608 | ||
| 610 | struct pch_gbe_adapter { | 609 | struct pch_gbe_adapter { |
| 611 | spinlock_t stats_lock; | 610 | spinlock_t stats_lock; |
| 612 | spinlock_t tx_queue_lock; | ||
| 613 | spinlock_t ethtool_lock; | 611 | spinlock_t ethtool_lock; |
| 614 | atomic_t irq_sem; | 612 | atomic_t irq_sem; |
| 615 | struct net_device *netdev; | 613 | struct net_device *netdev; |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index 8035e5ff6e06..1e38d502a062 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
| @@ -640,14 +640,11 @@ static void pch_gbe_mac_set_pause_packet(struct pch_gbe_hw *hw) | |||
| 640 | */ | 640 | */ |
| 641 | static int pch_gbe_alloc_queues(struct pch_gbe_adapter *adapter) | 641 | static int pch_gbe_alloc_queues(struct pch_gbe_adapter *adapter) |
| 642 | { | 642 | { |
| 643 | int size; | 643 | adapter->tx_ring = kzalloc(sizeof(*adapter->tx_ring), GFP_KERNEL); |
| 644 | |||
| 645 | size = (int)sizeof(struct pch_gbe_tx_ring); | ||
| 646 | adapter->tx_ring = kzalloc(size, GFP_KERNEL); | ||
| 647 | if (!adapter->tx_ring) | 644 | if (!adapter->tx_ring) |
| 648 | return -ENOMEM; | 645 | return -ENOMEM; |
| 649 | size = (int)sizeof(struct pch_gbe_rx_ring); | 646 | |
| 650 | adapter->rx_ring = kzalloc(size, GFP_KERNEL); | 647 | adapter->rx_ring = kzalloc(sizeof(*adapter->rx_ring), GFP_KERNEL); |
| 651 | if (!adapter->rx_ring) { | 648 | if (!adapter->rx_ring) { |
| 652 | kfree(adapter->tx_ring); | 649 | kfree(adapter->tx_ring); |
| 653 | return -ENOMEM; | 650 | return -ENOMEM; |
| @@ -1162,7 +1159,6 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter, | |||
| 1162 | struct sk_buff *tmp_skb; | 1159 | struct sk_buff *tmp_skb; |
| 1163 | unsigned int frame_ctrl; | 1160 | unsigned int frame_ctrl; |
| 1164 | unsigned int ring_num; | 1161 | unsigned int ring_num; |
| 1165 | unsigned long flags; | ||
| 1166 | 1162 | ||
| 1167 | /*-- Set frame control --*/ | 1163 | /*-- Set frame control --*/ |
| 1168 | frame_ctrl = 0; | 1164 | frame_ctrl = 0; |
| @@ -1211,14 +1207,14 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter, | |||
| 1211 | } | 1207 | } |
| 1212 | } | 1208 | } |
| 1213 | } | 1209 | } |
| 1214 | spin_lock_irqsave(&tx_ring->tx_lock, flags); | 1210 | |
| 1215 | ring_num = tx_ring->next_to_use; | 1211 | ring_num = tx_ring->next_to_use; |
| 1216 | if (unlikely((ring_num + 1) == tx_ring->count)) | 1212 | if (unlikely((ring_num + 1) == tx_ring->count)) |
| 1217 | tx_ring->next_to_use = 0; | 1213 | tx_ring->next_to_use = 0; |
| 1218 | else | 1214 | else |
| 1219 | tx_ring->next_to_use = ring_num + 1; | 1215 | tx_ring->next_to_use = ring_num + 1; |
| 1220 | 1216 | ||
| 1221 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); | 1217 | |
| 1222 | buffer_info = &tx_ring->buffer_info[ring_num]; | 1218 | buffer_info = &tx_ring->buffer_info[ring_num]; |
| 1223 | tmp_skb = buffer_info->skb; | 1219 | tmp_skb = buffer_info->skb; |
| 1224 | 1220 | ||
| @@ -1518,7 +1514,7 @@ pch_gbe_alloc_rx_buffers_pool(struct pch_gbe_adapter *adapter, | |||
| 1518 | &rx_ring->rx_buff_pool_logic, | 1514 | &rx_ring->rx_buff_pool_logic, |
| 1519 | GFP_KERNEL); | 1515 | GFP_KERNEL); |
| 1520 | if (!rx_ring->rx_buff_pool) { | 1516 | if (!rx_ring->rx_buff_pool) { |
| 1521 | pr_err("Unable to allocate memory for the receive poll buffer\n"); | 1517 | pr_err("Unable to allocate memory for the receive pool buffer\n"); |
| 1522 | return -ENOMEM; | 1518 | return -ENOMEM; |
| 1523 | } | 1519 | } |
| 1524 | memset(rx_ring->rx_buff_pool, 0, size); | 1520 | memset(rx_ring->rx_buff_pool, 0, size); |
| @@ -1637,15 +1633,17 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter, | |||
| 1637 | pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n", | 1633 | pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n", |
| 1638 | cleaned_count); | 1634 | cleaned_count); |
| 1639 | /* Recover from running out of Tx resources in xmit_frame */ | 1635 | /* Recover from running out of Tx resources in xmit_frame */ |
| 1636 | spin_lock(&tx_ring->tx_lock); | ||
| 1640 | if (unlikely(cleaned && (netif_queue_stopped(adapter->netdev)))) { | 1637 | if (unlikely(cleaned && (netif_queue_stopped(adapter->netdev)))) { |
| 1641 | netif_wake_queue(adapter->netdev); | 1638 | netif_wake_queue(adapter->netdev); |
| 1642 | adapter->stats.tx_restart_count++; | 1639 | adapter->stats.tx_restart_count++; |
| 1643 | pr_debug("Tx wake queue\n"); | 1640 | pr_debug("Tx wake queue\n"); |
| 1644 | } | 1641 | } |
| 1645 | spin_lock(&adapter->tx_queue_lock); | 1642 | |
| 1646 | tx_ring->next_to_clean = i; | 1643 | tx_ring->next_to_clean = i; |
| 1647 | spin_unlock(&adapter->tx_queue_lock); | 1644 | |
| 1648 | pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean); | 1645 | pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean); |
| 1646 | spin_unlock(&tx_ring->tx_lock); | ||
| 1649 | return cleaned; | 1647 | return cleaned; |
| 1650 | } | 1648 | } |
| 1651 | 1649 | ||
| @@ -2037,7 +2035,6 @@ static int pch_gbe_sw_init(struct pch_gbe_adapter *adapter) | |||
| 2037 | return -ENOMEM; | 2035 | return -ENOMEM; |
| 2038 | } | 2036 | } |
| 2039 | spin_lock_init(&adapter->hw.miim_lock); | 2037 | spin_lock_init(&adapter->hw.miim_lock); |
| 2040 | spin_lock_init(&adapter->tx_queue_lock); | ||
| 2041 | spin_lock_init(&adapter->stats_lock); | 2038 | spin_lock_init(&adapter->stats_lock); |
| 2042 | spin_lock_init(&adapter->ethtool_lock); | 2039 | spin_lock_init(&adapter->ethtool_lock); |
| 2043 | atomic_set(&adapter->irq_sem, 0); | 2040 | atomic_set(&adapter->irq_sem, 0); |
| @@ -2142,10 +2139,10 @@ static int pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 2142 | tx_ring->next_to_use, tx_ring->next_to_clean); | 2139 | tx_ring->next_to_use, tx_ring->next_to_clean); |
| 2143 | return NETDEV_TX_BUSY; | 2140 | return NETDEV_TX_BUSY; |
| 2144 | } | 2141 | } |
| 2145 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); | ||
| 2146 | 2142 | ||
| 2147 | /* CRC,ITAG no support */ | 2143 | /* CRC,ITAG no support */ |
| 2148 | pch_gbe_tx_queue(adapter, tx_ring, skb); | 2144 | pch_gbe_tx_queue(adapter, tx_ring, skb); |
| 2145 | spin_unlock_irqrestore(&tx_ring->tx_lock, flags); | ||
| 2149 | return NETDEV_TX_OK; | 2146 | return NETDEV_TX_OK; |
| 2150 | } | 2147 | } |
| 2151 | 2148 | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index f54509377efa..ce6b44d1f252 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -61,8 +61,12 @@ | |||
| 61 | #define R8169_MSG_DEFAULT \ | 61 | #define R8169_MSG_DEFAULT \ |
| 62 | (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN) | 62 | (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN) |
| 63 | 63 | ||
| 64 | #define TX_BUFFS_AVAIL(tp) \ | 64 | #define TX_SLOTS_AVAIL(tp) \ |
| 65 | (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1) | 65 | (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx) |
| 66 | |||
| 67 | /* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */ | ||
| 68 | #define TX_FRAGS_READY_FOR(tp,nr_frags) \ | ||
| 69 | (TX_SLOTS_AVAIL(tp) >= (nr_frags + 1)) | ||
| 66 | 70 | ||
| 67 | /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). | 71 | /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). |
| 68 | The RTL chips use a 64 element hash table based on the Ethernet CRC. */ | 72 | The RTL chips use a 64 element hash table based on the Ethernet CRC. */ |
| @@ -5115,7 +5119,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
| 5115 | u32 opts[2]; | 5119 | u32 opts[2]; |
| 5116 | int frags; | 5120 | int frags; |
| 5117 | 5121 | ||
| 5118 | if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) { | 5122 | if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) { |
| 5119 | netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n"); | 5123 | netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n"); |
| 5120 | goto err_stop_0; | 5124 | goto err_stop_0; |
| 5121 | } | 5125 | } |
| @@ -5169,7 +5173,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
| 5169 | 5173 | ||
| 5170 | mmiowb(); | 5174 | mmiowb(); |
| 5171 | 5175 | ||
| 5172 | if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) { | 5176 | if (!TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) { |
| 5173 | /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must | 5177 | /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must |
| 5174 | * not miss a ring update when it notices a stopped queue. | 5178 | * not miss a ring update when it notices a stopped queue. |
| 5175 | */ | 5179 | */ |
| @@ -5183,7 +5187,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
| 5183 | * can't. | 5187 | * can't. |
| 5184 | */ | 5188 | */ |
| 5185 | smp_mb(); | 5189 | smp_mb(); |
| 5186 | if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS) | 5190 | if (TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) |
| 5187 | netif_wake_queue(dev); | 5191 | netif_wake_queue(dev); |
| 5188 | } | 5192 | } |
| 5189 | 5193 | ||
| @@ -5306,7 +5310,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) | |||
| 5306 | */ | 5310 | */ |
| 5307 | smp_mb(); | 5311 | smp_mb(); |
| 5308 | if (netif_queue_stopped(dev) && | 5312 | if (netif_queue_stopped(dev) && |
| 5309 | (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) { | 5313 | TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) { |
| 5310 | netif_wake_queue(dev); | 5314 | netif_wake_queue(dev); |
| 5311 | } | 5315 | } |
| 5312 | /* | 5316 | /* |
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 3cbfbffe3f00..4a0005342e65 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
| @@ -1349,7 +1349,7 @@ static int efx_probe_interrupts(struct efx_nic *efx) | |||
| 1349 | } | 1349 | } |
| 1350 | 1350 | ||
| 1351 | /* RSS might be usable on VFs even if it is disabled on the PF */ | 1351 | /* RSS might be usable on VFs even if it is disabled on the PF */ |
| 1352 | efx->rss_spread = (efx->n_rx_channels > 1 ? | 1352 | efx->rss_spread = ((efx->n_rx_channels > 1 || !efx_sriov_wanted(efx)) ? |
| 1353 | efx->n_rx_channels : efx_vf_size(efx)); | 1353 | efx->n_rx_channels : efx_vf_size(efx)); |
| 1354 | 1354 | ||
| 1355 | return 0; | 1355 | return 0; |
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index 558409ff4058..4ba969096717 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c | |||
| @@ -2339,7 +2339,7 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 2339 | netif_device_detach(dev); | 2339 | netif_device_detach(dev); |
| 2340 | 2340 | ||
| 2341 | /* Switch off chip, remember WOL setting */ | 2341 | /* Switch off chip, remember WOL setting */ |
| 2342 | gp->asleep_wol = gp->wake_on_lan; | 2342 | gp->asleep_wol = !!gp->wake_on_lan; |
| 2343 | gem_do_stop(dev, gp->asleep_wol); | 2343 | gem_do_stop(dev, gp->asleep_wol); |
| 2344 | 2344 | ||
| 2345 | /* Unlock the network stack */ | 2345 | /* Unlock the network stack */ |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 174a3348f676..08aff1a2087c 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
| @@ -1511,7 +1511,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) | |||
| 1511 | 1511 | ||
| 1512 | static int match_first_device(struct device *dev, void *data) | 1512 | static int match_first_device(struct device *dev, void *data) |
| 1513 | { | 1513 | { |
| 1514 | return 1; | 1514 | return !strncmp(dev_name(dev), "davinci_mdio", 12); |
| 1515 | } | 1515 | } |
| 1516 | 1516 | ||
| 1517 | /** | 1517 | /** |
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c index 817ad3bc4957..efd36691ce54 100644 --- a/drivers/net/ethernet/ti/tlan.c +++ b/drivers/net/ethernet/ti/tlan.c | |||
| @@ -228,7 +228,7 @@ tlan_get_skb(const struct tlan_list *tag) | |||
| 228 | unsigned long addr; | 228 | unsigned long addr; |
| 229 | 229 | ||
| 230 | addr = tag->buffer[9].address; | 230 | addr = tag->buffer[9].address; |
| 231 | addr |= (tag->buffer[8].address << 16) << 16; | 231 | addr |= ((unsigned long) tag->buffer[8].address << 16) << 16; |
| 232 | return (struct sk_buff *) addr; | 232 | return (struct sk_buff *) addr; |
| 233 | } | 233 | } |
| 234 | 234 | ||
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index f975afdc315c..025367a94add 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
| @@ -259,7 +259,7 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 259 | 259 | ||
| 260 | xmit_world: | 260 | xmit_world: |
| 261 | skb->ip_summed = ip_summed; | 261 | skb->ip_summed = ip_summed; |
| 262 | skb_set_dev(skb, vlan->lowerdev); | 262 | skb->dev = vlan->lowerdev; |
| 263 | return dev_queue_xmit(skb); | 263 | return dev_queue_xmit(skb); |
| 264 | } | 264 | } |
| 265 | 265 | ||
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 0427c6561c84..cb8fd5069dbe 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include <linux/etherdevice.h> | 1 | #include <linux/etherdevice.h> |
| 2 | #include <linux/if_macvlan.h> | 2 | #include <linux/if_macvlan.h> |
| 3 | #include <linux/if_vlan.h> | ||
| 3 | #include <linux/interrupt.h> | 4 | #include <linux/interrupt.h> |
| 4 | #include <linux/nsproxy.h> | 5 | #include <linux/nsproxy.h> |
| 5 | #include <linux/compat.h> | 6 | #include <linux/compat.h> |
| @@ -759,6 +760,8 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
| 759 | struct macvlan_dev *vlan; | 760 | struct macvlan_dev *vlan; |
| 760 | int ret; | 761 | int ret; |
| 761 | int vnet_hdr_len = 0; | 762 | int vnet_hdr_len = 0; |
| 763 | int vlan_offset = 0; | ||
| 764 | int copied; | ||
| 762 | 765 | ||
| 763 | if (q->flags & IFF_VNET_HDR) { | 766 | if (q->flags & IFF_VNET_HDR) { |
| 764 | struct virtio_net_hdr vnet_hdr; | 767 | struct virtio_net_hdr vnet_hdr; |
| @@ -773,18 +776,48 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
| 773 | if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr))) | 776 | if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr))) |
| 774 | return -EFAULT; | 777 | return -EFAULT; |
| 775 | } | 778 | } |
| 779 | copied = vnet_hdr_len; | ||
| 780 | |||
| 781 | if (!vlan_tx_tag_present(skb)) | ||
| 782 | len = min_t(int, skb->len, len); | ||
| 783 | else { | ||
| 784 | int copy; | ||
| 785 | struct { | ||
| 786 | __be16 h_vlan_proto; | ||
| 787 | __be16 h_vlan_TCI; | ||
| 788 | } veth; | ||
| 789 | veth.h_vlan_proto = htons(ETH_P_8021Q); | ||
| 790 | veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); | ||
| 791 | |||
| 792 | vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); | ||
| 793 | len = min_t(int, skb->len + VLAN_HLEN, len); | ||
| 794 | |||
| 795 | copy = min_t(int, vlan_offset, len); | ||
| 796 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); | ||
| 797 | len -= copy; | ||
| 798 | copied += copy; | ||
| 799 | if (ret || !len) | ||
| 800 | goto done; | ||
| 801 | |||
| 802 | copy = min_t(int, sizeof(veth), len); | ||
| 803 | ret = memcpy_toiovecend(iv, (void *)&veth, copied, copy); | ||
| 804 | len -= copy; | ||
| 805 | copied += copy; | ||
| 806 | if (ret || !len) | ||
| 807 | goto done; | ||
| 808 | } | ||
| 776 | 809 | ||
| 777 | len = min_t(int, skb->len, len); | 810 | ret = skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len); |
| 778 | 811 | copied += len; | |
| 779 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, vnet_hdr_len, len); | ||
| 780 | 812 | ||
| 813 | done: | ||
| 781 | rcu_read_lock_bh(); | 814 | rcu_read_lock_bh(); |
| 782 | vlan = rcu_dereference_bh(q->vlan); | 815 | vlan = rcu_dereference_bh(q->vlan); |
| 783 | if (vlan) | 816 | if (vlan) |
| 784 | macvlan_count_rx(vlan, len, ret == 0, 0); | 817 | macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); |
| 785 | rcu_read_unlock_bh(); | 818 | rcu_read_unlock_bh(); |
| 786 | 819 | ||
| 787 | return ret ? ret : (len + vnet_hdr_len); | 820 | return ret ? ret : copied; |
| 788 | } | 821 | } |
| 789 | 822 | ||
| 790 | static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb, | 823 | static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb, |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 5ee032cafade..42b5151aa78a 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
| @@ -355,7 +355,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
| 355 | u32 packet_len; | 355 | u32 packet_len; |
| 356 | u32 padbytes = 0xffff0000; | 356 | u32 padbytes = 0xffff0000; |
| 357 | 357 | ||
| 358 | padlen = ((skb->len + 4) % 512) ? 0 : 4; | 358 | padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4; |
| 359 | 359 | ||
| 360 | if ((!skb_cloned(skb)) && | 360 | if ((!skb_cloned(skb)) && |
| 361 | ((headroom + tailroom) >= (4 + padlen))) { | 361 | ((headroom + tailroom) >= (4 + padlen))) { |
| @@ -377,7 +377,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
| 377 | cpu_to_le32s(&packet_len); | 377 | cpu_to_le32s(&packet_len); |
| 378 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); | 378 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); |
| 379 | 379 | ||
| 380 | if ((skb->len % 512) == 0) { | 380 | if (padlen) { |
| 381 | cpu_to_le32s(&padbytes); | 381 | cpu_to_le32s(&padbytes); |
| 382 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); | 382 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); |
| 383 | skb_put(skb, sizeof(padbytes)); | 383 | skb_put(skb, sizeof(padbytes)); |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 90a30026a931..425e201f597c 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
| @@ -83,6 +83,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 83 | struct cdc_state *info = (void *) &dev->data; | 83 | struct cdc_state *info = (void *) &dev->data; |
| 84 | int status; | 84 | int status; |
| 85 | int rndis; | 85 | int rndis; |
| 86 | bool android_rndis_quirk = false; | ||
| 86 | struct usb_driver *driver = driver_of(intf); | 87 | struct usb_driver *driver = driver_of(intf); |
| 87 | struct usb_cdc_mdlm_desc *desc = NULL; | 88 | struct usb_cdc_mdlm_desc *desc = NULL; |
| 88 | struct usb_cdc_mdlm_detail_desc *detail = NULL; | 89 | struct usb_cdc_mdlm_detail_desc *detail = NULL; |
| @@ -195,6 +196,11 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 195 | info->control, | 196 | info->control, |
| 196 | info->u->bSlaveInterface0, | 197 | info->u->bSlaveInterface0, |
| 197 | info->data); | 198 | info->data); |
| 199 | /* fall back to hard-wiring for RNDIS */ | ||
| 200 | if (rndis) { | ||
| 201 | android_rndis_quirk = true; | ||
| 202 | goto next_desc; | ||
| 203 | } | ||
| 198 | goto bad_desc; | 204 | goto bad_desc; |
| 199 | } | 205 | } |
| 200 | if (info->control != intf) { | 206 | if (info->control != intf) { |
| @@ -271,11 +277,15 @@ next_desc: | |||
| 271 | /* Microsoft ActiveSync based and some regular RNDIS devices lack the | 277 | /* Microsoft ActiveSync based and some regular RNDIS devices lack the |
| 272 | * CDC descriptors, so we'll hard-wire the interfaces and not check | 278 | * CDC descriptors, so we'll hard-wire the interfaces and not check |
| 273 | * for descriptors. | 279 | * for descriptors. |
| 280 | * | ||
| 281 | * Some Android RNDIS devices have a CDC Union descriptor pointing | ||
| 282 | * to non-existing interfaces. Ignore that and attempt the same | ||
| 283 | * hard-wired 0 and 1 interfaces. | ||
| 274 | */ | 284 | */ |
| 275 | if (rndis && !info->u) { | 285 | if (rndis && (!info->u || android_rndis_quirk)) { |
| 276 | info->control = usb_ifnum_to_if(dev->udev, 0); | 286 | info->control = usb_ifnum_to_if(dev->udev, 0); |
| 277 | info->data = usb_ifnum_to_if(dev->udev, 1); | 287 | info->data = usb_ifnum_to_if(dev->udev, 1); |
| 278 | if (!info->control || !info->data) { | 288 | if (!info->control || !info->data || info->control != intf) { |
| 279 | dev_dbg(&intf->dev, | 289 | dev_dbg(&intf->dev, |
| 280 | "rndis: master #0/%p slave #1/%p\n", | 290 | "rndis: master #0/%p slave #1/%p\n", |
| 281 | info->control, | 291 | info->control, |
| @@ -475,6 +485,7 @@ static const struct driver_info wwan_info = { | |||
| 475 | /*-------------------------------------------------------------------------*/ | 485 | /*-------------------------------------------------------------------------*/ |
| 476 | 486 | ||
| 477 | #define HUAWEI_VENDOR_ID 0x12D1 | 487 | #define HUAWEI_VENDOR_ID 0x12D1 |
| 488 | #define NOVATEL_VENDOR_ID 0x1410 | ||
| 478 | 489 | ||
| 479 | static const struct usb_device_id products [] = { | 490 | static const struct usb_device_id products [] = { |
| 480 | /* | 491 | /* |
| @@ -592,6 +603,21 @@ static const struct usb_device_id products [] = { | |||
| 592 | * because of bugs/quirks in a given product (like Zaurus, above). | 603 | * because of bugs/quirks in a given product (like Zaurus, above). |
| 593 | */ | 604 | */ |
| 594 | { | 605 | { |
| 606 | /* Novatel USB551L */ | ||
| 607 | /* This match must come *before* the generic CDC-ETHER match so that | ||
| 608 | * we get FLAG_WWAN set on the device, since it's descriptors are | ||
| 609 | * generic CDC-ETHER. | ||
| 610 | */ | ||
| 611 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | ||
| 612 | | USB_DEVICE_ID_MATCH_PRODUCT | ||
| 613 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
| 614 | .idVendor = NOVATEL_VENDOR_ID, | ||
| 615 | .idProduct = 0xB001, | ||
| 616 | .bInterfaceClass = USB_CLASS_COMM, | ||
| 617 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
| 618 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
| 619 | .driver_info = (unsigned long)&wwan_info, | ||
| 620 | }, { | ||
| 595 | USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, | 621 | USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET, |
| 596 | USB_CDC_PROTO_NONE), | 622 | USB_CDC_PROTO_NONE), |
| 597 | .driver_info = (unsigned long) &cdc_info, | 623 | .driver_info = (unsigned long) &cdc_info, |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index a2349483cd2a..00103a8c5e04 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
| @@ -98,7 +98,7 @@ static int __must_check smsc75xx_read_reg(struct usbnet *dev, u32 index, | |||
| 98 | 98 | ||
| 99 | if (unlikely(ret < 0)) | 99 | if (unlikely(ret < 0)) |
| 100 | netdev_warn(dev->net, | 100 | netdev_warn(dev->net, |
| 101 | "Failed to read register index 0x%08x", index); | 101 | "Failed to read reg index 0x%08x: %d", index, ret); |
| 102 | 102 | ||
| 103 | le32_to_cpus(buf); | 103 | le32_to_cpus(buf); |
| 104 | *data = *buf; | 104 | *data = *buf; |
| @@ -128,7 +128,7 @@ static int __must_check smsc75xx_write_reg(struct usbnet *dev, u32 index, | |||
| 128 | 128 | ||
| 129 | if (unlikely(ret < 0)) | 129 | if (unlikely(ret < 0)) |
| 130 | netdev_warn(dev->net, | 130 | netdev_warn(dev->net, |
| 131 | "Failed to write register index 0x%08x", index); | 131 | "Failed to write reg index 0x%08x: %d", index, ret); |
| 132 | 132 | ||
| 133 | kfree(buf); | 133 | kfree(buf); |
| 134 | 134 | ||
| @@ -171,7 +171,7 @@ static int smsc75xx_mdio_read(struct net_device *netdev, int phy_id, int idx) | |||
| 171 | idx &= dev->mii.reg_num_mask; | 171 | idx &= dev->mii.reg_num_mask; |
| 172 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) | 172 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
| 173 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) | 173 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
| 174 | | MII_ACCESS_READ; | 174 | | MII_ACCESS_READ | MII_ACCESS_BUSY; |
| 175 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); | 175 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
| 176 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); | 176 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
| 177 | 177 | ||
| @@ -210,7 +210,7 @@ static void smsc75xx_mdio_write(struct net_device *netdev, int phy_id, int idx, | |||
| 210 | idx &= dev->mii.reg_num_mask; | 210 | idx &= dev->mii.reg_num_mask; |
| 211 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) | 211 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
| 212 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) | 212 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
| 213 | | MII_ACCESS_WRITE; | 213 | | MII_ACCESS_WRITE | MII_ACCESS_BUSY; |
| 214 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); | 214 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
| 215 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); | 215 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
| 216 | 216 | ||
| @@ -508,9 +508,10 @@ static int smsc75xx_link_reset(struct usbnet *dev) | |||
| 508 | u16 lcladv, rmtadv; | 508 | u16 lcladv, rmtadv; |
| 509 | int ret; | 509 | int ret; |
| 510 | 510 | ||
| 511 | /* clear interrupt status */ | 511 | /* read and write to clear phy interrupt status */ |
| 512 | ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); | 512 | ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); |
| 513 | check_warn_return(ret, "Error reading PHY_INT_SRC"); | 513 | check_warn_return(ret, "Error reading PHY_INT_SRC"); |
| 514 | smsc75xx_mdio_write(dev->net, mii->phy_id, PHY_INT_SRC, 0xffff); | ||
| 514 | 515 | ||
| 515 | ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); | 516 | ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); |
| 516 | check_warn_return(ret, "Error writing INT_STS"); | 517 | check_warn_return(ret, "Error writing INT_STS"); |
| @@ -643,7 +644,7 @@ static int smsc75xx_set_mac_address(struct usbnet *dev) | |||
| 643 | 644 | ||
| 644 | static int smsc75xx_phy_initialize(struct usbnet *dev) | 645 | static int smsc75xx_phy_initialize(struct usbnet *dev) |
| 645 | { | 646 | { |
| 646 | int bmcr, timeout = 0; | 647 | int bmcr, ret, timeout = 0; |
| 647 | 648 | ||
| 648 | /* Initialize MII structure */ | 649 | /* Initialize MII structure */ |
| 649 | dev->mii.dev = dev->net; | 650 | dev->mii.dev = dev->net; |
| @@ -651,6 +652,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
| 651 | dev->mii.mdio_write = smsc75xx_mdio_write; | 652 | dev->mii.mdio_write = smsc75xx_mdio_write; |
| 652 | dev->mii.phy_id_mask = 0x1f; | 653 | dev->mii.phy_id_mask = 0x1f; |
| 653 | dev->mii.reg_num_mask = 0x1f; | 654 | dev->mii.reg_num_mask = 0x1f; |
| 655 | dev->mii.supports_gmii = 1; | ||
| 654 | dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; | 656 | dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; |
| 655 | 657 | ||
| 656 | /* reset phy and wait for reset to complete */ | 658 | /* reset phy and wait for reset to complete */ |
| @@ -661,7 +663,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
| 661 | bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); | 663 | bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); |
| 662 | check_warn_return(bmcr, "Error reading MII_BMCR"); | 664 | check_warn_return(bmcr, "Error reading MII_BMCR"); |
| 663 | timeout++; | 665 | timeout++; |
| 664 | } while ((bmcr & MII_BMCR) && (timeout < 100)); | 666 | } while ((bmcr & BMCR_RESET) && (timeout < 100)); |
| 665 | 667 | ||
| 666 | if (timeout >= 100) { | 668 | if (timeout >= 100) { |
| 667 | netdev_warn(dev->net, "timeout on PHY Reset"); | 669 | netdev_warn(dev->net, "timeout on PHY Reset"); |
| @@ -671,10 +673,13 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
| 671 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, | 673 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, |
| 672 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | | 674 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | |
| 673 | ADVERTISE_PAUSE_ASYM); | 675 | ADVERTISE_PAUSE_ASYM); |
| 676 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_CTRL1000, | ||
| 677 | ADVERTISE_1000FULL); | ||
| 674 | 678 | ||
| 675 | /* read to clear */ | 679 | /* read and write to clear phy interrupt status */ |
| 676 | smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); | 680 | ret = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); |
| 677 | check_warn_return(bmcr, "Error reading PHY_INT_SRC"); | 681 | check_warn_return(ret, "Error reading PHY_INT_SRC"); |
| 682 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_SRC, 0xffff); | ||
| 678 | 683 | ||
| 679 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, | 684 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, |
| 680 | PHY_INT_MASK_DEFAULT); | 685 | PHY_INT_MASK_DEFAULT); |
| @@ -946,6 +951,14 @@ static int smsc75xx_reset(struct usbnet *dev) | |||
| 946 | ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); | 951 | ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); |
| 947 | check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); | 952 | check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); |
| 948 | 953 | ||
| 954 | /* allow mac to detect speed and duplex from phy */ | ||
| 955 | ret = smsc75xx_read_reg(dev, MAC_CR, &buf); | ||
| 956 | check_warn_return(ret, "Failed to read MAC_CR: %d", ret); | ||
| 957 | |||
| 958 | buf |= (MAC_CR_ADD | MAC_CR_ASD); | ||
| 959 | ret = smsc75xx_write_reg(dev, MAC_CR, buf); | ||
| 960 | check_warn_return(ret, "Failed to write MAC_CR: %d", ret); | ||
| 961 | |||
| 949 | ret = smsc75xx_read_reg(dev, MAC_TX, &buf); | 962 | ret = smsc75xx_read_reg(dev, MAC_TX, &buf); |
| 950 | check_warn_return(ret, "Failed to read MAC_TX: %d", ret); | 963 | check_warn_return(ret, "Failed to read MAC_TX: %d", ret); |
| 951 | 964 | ||
| @@ -1212,7 +1225,7 @@ static const struct driver_info smsc75xx_info = { | |||
| 1212 | .rx_fixup = smsc75xx_rx_fixup, | 1225 | .rx_fixup = smsc75xx_rx_fixup, |
| 1213 | .tx_fixup = smsc75xx_tx_fixup, | 1226 | .tx_fixup = smsc75xx_tx_fixup, |
| 1214 | .status = smsc75xx_status, | 1227 | .status = smsc75xx_status, |
| 1215 | .flags = FLAG_ETHER | FLAG_SEND_ZLP, | 1228 | .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, |
| 1216 | }; | 1229 | }; |
| 1217 | 1230 | ||
| 1218 | static const struct usb_device_id products[] = { | 1231 | static const struct usb_device_id products[] = { |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 5f19f84d3494..94ae66999f59 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
| @@ -1017,6 +1017,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 1017 | dev->net->ethtool_ops = &smsc95xx_ethtool_ops; | 1017 | dev->net->ethtool_ops = &smsc95xx_ethtool_ops; |
| 1018 | dev->net->flags |= IFF_MULTICAST; | 1018 | dev->net->flags |= IFF_MULTICAST; |
| 1019 | dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; | 1019 | dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; |
| 1020 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
| 1020 | return 0; | 1021 | return 0; |
| 1021 | } | 1022 | } |
| 1022 | 1023 | ||
| @@ -1191,7 +1192,7 @@ static const struct driver_info smsc95xx_info = { | |||
| 1191 | .rx_fixup = smsc95xx_rx_fixup, | 1192 | .rx_fixup = smsc95xx_rx_fixup, |
| 1192 | .tx_fixup = smsc95xx_tx_fixup, | 1193 | .tx_fixup = smsc95xx_tx_fixup, |
| 1193 | .status = smsc95xx_status, | 1194 | .status = smsc95xx_status, |
| 1194 | .flags = FLAG_ETHER | FLAG_SEND_ZLP, | 1195 | .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, |
| 1195 | }; | 1196 | }; |
| 1196 | 1197 | ||
| 1197 | static const struct usb_device_id products[] = { | 1198 | static const struct usb_device_id products[] = { |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index b7b3f5b0d406..b38db48b1ce0 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
| @@ -210,6 +210,7 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf) | |||
| 210 | } else { | 210 | } else { |
| 211 | usb_fill_int_urb(dev->interrupt, dev->udev, pipe, | 211 | usb_fill_int_urb(dev->interrupt, dev->udev, pipe, |
| 212 | buf, maxp, intr_complete, dev, period); | 212 | buf, maxp, intr_complete, dev, period); |
| 213 | dev->interrupt->transfer_flags |= URB_FREE_BUFFER; | ||
| 213 | dev_dbg(&intf->dev, | 214 | dev_dbg(&intf->dev, |
| 214 | "status ep%din, %d bytes period %d\n", | 215 | "status ep%din, %d bytes period %d\n", |
| 215 | usb_pipeendpoint(pipe), maxp, period); | 216 | usb_pipeendpoint(pipe), maxp, period); |
| @@ -281,17 +282,32 @@ int usbnet_change_mtu (struct net_device *net, int new_mtu) | |||
| 281 | } | 282 | } |
| 282 | EXPORT_SYMBOL_GPL(usbnet_change_mtu); | 283 | EXPORT_SYMBOL_GPL(usbnet_change_mtu); |
| 283 | 284 | ||
| 285 | /* The caller must hold list->lock */ | ||
| 286 | static void __usbnet_queue_skb(struct sk_buff_head *list, | ||
| 287 | struct sk_buff *newsk, enum skb_state state) | ||
| 288 | { | ||
| 289 | struct skb_data *entry = (struct skb_data *) newsk->cb; | ||
| 290 | |||
| 291 | __skb_queue_tail(list, newsk); | ||
| 292 | entry->state = state; | ||
| 293 | } | ||
| 294 | |||
| 284 | /*-------------------------------------------------------------------------*/ | 295 | /*-------------------------------------------------------------------------*/ |
| 285 | 296 | ||
| 286 | /* some LK 2.4 HCDs oopsed if we freed or resubmitted urbs from | 297 | /* some LK 2.4 HCDs oopsed if we freed or resubmitted urbs from |
| 287 | * completion callbacks. 2.5 should have fixed those bugs... | 298 | * completion callbacks. 2.5 should have fixed those bugs... |
| 288 | */ | 299 | */ |
| 289 | 300 | ||
| 290 | static void defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_head *list) | 301 | static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb, |
| 302 | struct sk_buff_head *list, enum skb_state state) | ||
| 291 | { | 303 | { |
| 292 | unsigned long flags; | 304 | unsigned long flags; |
| 305 | enum skb_state old_state; | ||
| 306 | struct skb_data *entry = (struct skb_data *) skb->cb; | ||
| 293 | 307 | ||
| 294 | spin_lock_irqsave(&list->lock, flags); | 308 | spin_lock_irqsave(&list->lock, flags); |
| 309 | old_state = entry->state; | ||
| 310 | entry->state = state; | ||
| 295 | __skb_unlink(skb, list); | 311 | __skb_unlink(skb, list); |
| 296 | spin_unlock(&list->lock); | 312 | spin_unlock(&list->lock); |
| 297 | spin_lock(&dev->done.lock); | 313 | spin_lock(&dev->done.lock); |
| @@ -299,6 +315,7 @@ static void defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_hea | |||
| 299 | if (dev->done.qlen == 1) | 315 | if (dev->done.qlen == 1) |
| 300 | tasklet_schedule(&dev->bh); | 316 | tasklet_schedule(&dev->bh); |
| 301 | spin_unlock_irqrestore(&dev->done.lock, flags); | 317 | spin_unlock_irqrestore(&dev->done.lock, flags); |
| 318 | return old_state; | ||
| 302 | } | 319 | } |
| 303 | 320 | ||
| 304 | /* some work can't be done in tasklets, so we use keventd | 321 | /* some work can't be done in tasklets, so we use keventd |
| @@ -339,7 +356,6 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) | |||
| 339 | entry = (struct skb_data *) skb->cb; | 356 | entry = (struct skb_data *) skb->cb; |
| 340 | entry->urb = urb; | 357 | entry->urb = urb; |
| 341 | entry->dev = dev; | 358 | entry->dev = dev; |
| 342 | entry->state = rx_start; | ||
| 343 | entry->length = 0; | 359 | entry->length = 0; |
| 344 | 360 | ||
| 345 | usb_fill_bulk_urb (urb, dev->udev, dev->in, | 361 | usb_fill_bulk_urb (urb, dev->udev, dev->in, |
| @@ -371,7 +387,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) | |||
| 371 | tasklet_schedule (&dev->bh); | 387 | tasklet_schedule (&dev->bh); |
| 372 | break; | 388 | break; |
| 373 | case 0: | 389 | case 0: |
| 374 | __skb_queue_tail (&dev->rxq, skb); | 390 | __usbnet_queue_skb(&dev->rxq, skb, rx_start); |
| 375 | } | 391 | } |
| 376 | } else { | 392 | } else { |
| 377 | netif_dbg(dev, ifdown, dev->net, "rx: stopped\n"); | 393 | netif_dbg(dev, ifdown, dev->net, "rx: stopped\n"); |
| @@ -422,16 +438,17 @@ static void rx_complete (struct urb *urb) | |||
| 422 | struct skb_data *entry = (struct skb_data *) skb->cb; | 438 | struct skb_data *entry = (struct skb_data *) skb->cb; |
| 423 | struct usbnet *dev = entry->dev; | 439 | struct usbnet *dev = entry->dev; |
| 424 | int urb_status = urb->status; | 440 | int urb_status = urb->status; |
| 441 | enum skb_state state; | ||
| 425 | 442 | ||
| 426 | skb_put (skb, urb->actual_length); | 443 | skb_put (skb, urb->actual_length); |
| 427 | entry->state = rx_done; | 444 | state = rx_done; |
| 428 | entry->urb = NULL; | 445 | entry->urb = NULL; |
| 429 | 446 | ||
| 430 | switch (urb_status) { | 447 | switch (urb_status) { |
| 431 | /* success */ | 448 | /* success */ |
| 432 | case 0: | 449 | case 0: |
| 433 | if (skb->len < dev->net->hard_header_len) { | 450 | if (skb->len < dev->net->hard_header_len) { |
| 434 | entry->state = rx_cleanup; | 451 | state = rx_cleanup; |
| 435 | dev->net->stats.rx_errors++; | 452 | dev->net->stats.rx_errors++; |
| 436 | dev->net->stats.rx_length_errors++; | 453 | dev->net->stats.rx_length_errors++; |
| 437 | netif_dbg(dev, rx_err, dev->net, | 454 | netif_dbg(dev, rx_err, dev->net, |
| @@ -470,7 +487,7 @@ static void rx_complete (struct urb *urb) | |||
| 470 | "rx throttle %d\n", urb_status); | 487 | "rx throttle %d\n", urb_status); |
| 471 | } | 488 | } |
| 472 | block: | 489 | block: |
| 473 | entry->state = rx_cleanup; | 490 | state = rx_cleanup; |
| 474 | entry->urb = urb; | 491 | entry->urb = urb; |
| 475 | urb = NULL; | 492 | urb = NULL; |
| 476 | break; | 493 | break; |
| @@ -481,17 +498,18 @@ block: | |||
| 481 | // FALLTHROUGH | 498 | // FALLTHROUGH |
| 482 | 499 | ||
| 483 | default: | 500 | default: |
| 484 | entry->state = rx_cleanup; | 501 | state = rx_cleanup; |
| 485 | dev->net->stats.rx_errors++; | 502 | dev->net->stats.rx_errors++; |
| 486 | netif_dbg(dev, rx_err, dev->net, "rx status %d\n", urb_status); | 503 | netif_dbg(dev, rx_err, dev->net, "rx status %d\n", urb_status); |
| 487 | break; | 504 | break; |
| 488 | } | 505 | } |
| 489 | 506 | ||
| 490 | defer_bh(dev, skb, &dev->rxq); | 507 | state = defer_bh(dev, skb, &dev->rxq, state); |
| 491 | 508 | ||
| 492 | if (urb) { | 509 | if (urb) { |
| 493 | if (netif_running (dev->net) && | 510 | if (netif_running (dev->net) && |
| 494 | !test_bit (EVENT_RX_HALT, &dev->flags)) { | 511 | !test_bit (EVENT_RX_HALT, &dev->flags) && |
| 512 | state != unlink_start) { | ||
| 495 | rx_submit (dev, urb, GFP_ATOMIC); | 513 | rx_submit (dev, urb, GFP_ATOMIC); |
| 496 | usb_mark_last_busy(dev->udev); | 514 | usb_mark_last_busy(dev->udev); |
| 497 | return; | 515 | return; |
| @@ -578,16 +596,23 @@ EXPORT_SYMBOL_GPL(usbnet_purge_paused_rxq); | |||
| 578 | static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) | 596 | static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) |
| 579 | { | 597 | { |
| 580 | unsigned long flags; | 598 | unsigned long flags; |
| 581 | struct sk_buff *skb, *skbnext; | 599 | struct sk_buff *skb; |
| 582 | int count = 0; | 600 | int count = 0; |
| 583 | 601 | ||
| 584 | spin_lock_irqsave (&q->lock, flags); | 602 | spin_lock_irqsave (&q->lock, flags); |
| 585 | skb_queue_walk_safe(q, skb, skbnext) { | 603 | while (!skb_queue_empty(q)) { |
| 586 | struct skb_data *entry; | 604 | struct skb_data *entry; |
| 587 | struct urb *urb; | 605 | struct urb *urb; |
| 588 | int retval; | 606 | int retval; |
| 589 | 607 | ||
| 590 | entry = (struct skb_data *) skb->cb; | 608 | skb_queue_walk(q, skb) { |
| 609 | entry = (struct skb_data *) skb->cb; | ||
| 610 | if (entry->state != unlink_start) | ||
| 611 | goto found; | ||
| 612 | } | ||
| 613 | break; | ||
| 614 | found: | ||
| 615 | entry->state = unlink_start; | ||
| 591 | urb = entry->urb; | 616 | urb = entry->urb; |
| 592 | 617 | ||
| 593 | /* | 618 | /* |
| @@ -1038,8 +1063,7 @@ static void tx_complete (struct urb *urb) | |||
| 1038 | } | 1063 | } |
| 1039 | 1064 | ||
| 1040 | usb_autopm_put_interface_async(dev->intf); | 1065 | usb_autopm_put_interface_async(dev->intf); |
| 1041 | entry->state = tx_done; | 1066 | (void) defer_bh(dev, skb, &dev->txq, tx_done); |
| 1042 | defer_bh(dev, skb, &dev->txq); | ||
| 1043 | } | 1067 | } |
| 1044 | 1068 | ||
| 1045 | /*-------------------------------------------------------------------------*/ | 1069 | /*-------------------------------------------------------------------------*/ |
| @@ -1095,7 +1119,6 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, | |||
| 1095 | entry = (struct skb_data *) skb->cb; | 1119 | entry = (struct skb_data *) skb->cb; |
| 1096 | entry->urb = urb; | 1120 | entry->urb = urb; |
| 1097 | entry->dev = dev; | 1121 | entry->dev = dev; |
| 1098 | entry->state = tx_start; | ||
| 1099 | entry->length = length; | 1122 | entry->length = length; |
| 1100 | 1123 | ||
| 1101 | usb_fill_bulk_urb (urb, dev->udev, dev->out, | 1124 | usb_fill_bulk_urb (urb, dev->udev, dev->out, |
| @@ -1154,7 +1177,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, | |||
| 1154 | break; | 1177 | break; |
| 1155 | case 0: | 1178 | case 0: |
| 1156 | net->trans_start = jiffies; | 1179 | net->trans_start = jiffies; |
| 1157 | __skb_queue_tail (&dev->txq, skb); | 1180 | __usbnet_queue_skb(&dev->txq, skb, tx_start); |
| 1158 | if (dev->txq.qlen >= TX_QLEN (dev)) | 1181 | if (dev->txq.qlen >= TX_QLEN (dev)) |
| 1159 | netif_stop_queue (net); | 1182 | netif_stop_queue (net); |
| 1160 | } | 1183 | } |
| @@ -1443,7 +1466,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
| 1443 | 1466 | ||
| 1444 | status = register_netdev (net); | 1467 | status = register_netdev (net); |
| 1445 | if (status) | 1468 | if (status) |
| 1446 | goto out3; | 1469 | goto out4; |
| 1447 | netif_info(dev, probe, dev->net, | 1470 | netif_info(dev, probe, dev->net, |
| 1448 | "register '%s' at usb-%s-%s, %s, %pM\n", | 1471 | "register '%s' at usb-%s-%s, %s, %pM\n", |
| 1449 | udev->dev.driver->name, | 1472 | udev->dev.driver->name, |
| @@ -1461,6 +1484,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
| 1461 | 1484 | ||
| 1462 | return 0; | 1485 | return 0; |
| 1463 | 1486 | ||
| 1487 | out4: | ||
| 1488 | usb_free_urb(dev->interrupt); | ||
| 1464 | out3: | 1489 | out3: |
| 1465 | if (info->unbind) | 1490 | if (info->unbind) |
| 1466 | info->unbind (dev, udev); | 1491 | info->unbind (dev, udev); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index af8acc85f4bb..cbefe671bcc6 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -492,7 +492,9 @@ static void virtnet_napi_enable(struct virtnet_info *vi) | |||
| 492 | * We synchronize against interrupts via NAPI_STATE_SCHED */ | 492 | * We synchronize against interrupts via NAPI_STATE_SCHED */ |
| 493 | if (napi_schedule_prep(&vi->napi)) { | 493 | if (napi_schedule_prep(&vi->napi)) { |
| 494 | virtqueue_disable_cb(vi->rvq); | 494 | virtqueue_disable_cb(vi->rvq); |
| 495 | local_bh_disable(); | ||
| 495 | __napi_schedule(&vi->napi); | 496 | __napi_schedule(&vi->napi); |
| 497 | local_bh_enable(); | ||
| 496 | } | 498 | } |
| 497 | } | 499 | } |
| 498 | 500 | ||
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c index 8c50d9d19d78..aec33cc207fd 100644 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ b/drivers/net/wireless/ath/ath5k/ahb.c | |||
| @@ -220,6 +220,7 @@ static int ath_ahb_remove(struct platform_device *pdev) | |||
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | ath5k_deinit_ah(ah); | 222 | ath5k_deinit_ah(ah); |
| 223 | iounmap(ah->iobase); | ||
| 223 | platform_set_drvdata(pdev, NULL); | 224 | platform_set_drvdata(pdev, NULL); |
| 224 | ieee80211_free_hw(hw); | 225 | ieee80211_free_hw(hw); |
| 225 | 226 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index d7d8e9199140..aba088005b22 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
| @@ -869,7 +869,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, | |||
| 869 | ar5008_hw_set_channel_regs(ah, chan); | 869 | ar5008_hw_set_channel_regs(ah, chan); |
| 870 | ar5008_hw_init_chain_masks(ah); | 870 | ar5008_hw_init_chain_masks(ah); |
| 871 | ath9k_olc_init(ah); | 871 | ath9k_olc_init(ah); |
| 872 | ath9k_hw_apply_txpower(ah, chan); | 872 | ath9k_hw_apply_txpower(ah, chan, false); |
| 873 | 873 | ||
| 874 | /* Write analog registers */ | 874 | /* Write analog registers */ |
| 875 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { | 875 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c index 59647a3ceb7f..3d400e8d6535 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c | |||
| @@ -54,7 +54,7 @@ void ar9003_paprd_enable(struct ath_hw *ah, bool val) | |||
| 54 | 54 | ||
| 55 | if (val) { | 55 | if (val) { |
| 56 | ah->paprd_table_write_done = true; | 56 | ah->paprd_table_write_done = true; |
| 57 | ath9k_hw_apply_txpower(ah, chan); | 57 | ath9k_hw_apply_txpower(ah, chan, false); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, | 60 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index bc992b237ae5..600aca9fe6b1 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
| @@ -373,7 +373,7 @@ static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah, | |||
| 373 | else | 373 | else |
| 374 | spur_subchannel_sd = 0; | 374 | spur_subchannel_sd = 0; |
| 375 | 375 | ||
| 376 | spur_freq_sd = (freq_offset << 9) / 11; | 376 | spur_freq_sd = ((freq_offset + 10) << 9) / 11; |
| 377 | 377 | ||
| 378 | } else { | 378 | } else { |
| 379 | if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, | 379 | if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, |
| @@ -382,7 +382,7 @@ static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah, | |||
| 382 | else | 382 | else |
| 383 | spur_subchannel_sd = 1; | 383 | spur_subchannel_sd = 1; |
| 384 | 384 | ||
| 385 | spur_freq_sd = (freq_offset << 9) / 11; | 385 | spur_freq_sd = ((freq_offset - 10) << 9) / 11; |
| 386 | 386 | ||
| 387 | } | 387 | } |
| 388 | 388 | ||
| @@ -694,7 +694,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, | |||
| 694 | ar9003_hw_override_ini(ah); | 694 | ar9003_hw_override_ini(ah); |
| 695 | ar9003_hw_set_channel_regs(ah, chan); | 695 | ar9003_hw_set_channel_regs(ah, chan); |
| 696 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | 696 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); |
| 697 | ath9k_hw_apply_txpower(ah, chan); | 697 | ath9k_hw_apply_txpower(ah, chan, false); |
| 698 | 698 | ||
| 699 | if (AR_SREV_9462(ah)) { | 699 | if (AR_SREV_9462(ah)) { |
| 700 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, | 700 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index f272236d8053..b34e8b2990b1 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
| @@ -824,6 +824,8 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah, | |||
| 824 | regulatory->max_power_level = ratesArray[i]; | 824 | regulatory->max_power_level = ratesArray[i]; |
| 825 | } | 825 | } |
| 826 | 826 | ||
| 827 | ath9k_hw_update_regulatory_maxpower(ah); | ||
| 828 | |||
| 827 | if (test) | 829 | if (test) |
| 828 | return; | 830 | return; |
| 829 | 831 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 6c69e4e8b1cb..fa84e37bf091 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
| @@ -1454,7 +1454,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
| 1454 | return false; | 1454 | return false; |
| 1455 | } | 1455 | } |
| 1456 | ath9k_hw_set_clockrate(ah); | 1456 | ath9k_hw_set_clockrate(ah); |
| 1457 | ath9k_hw_apply_txpower(ah, chan); | 1457 | ath9k_hw_apply_txpower(ah, chan, false); |
| 1458 | ath9k_hw_rfbus_done(ah); | 1458 | ath9k_hw_rfbus_done(ah); |
| 1459 | 1459 | ||
| 1460 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) | 1460 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) |
| @@ -2652,7 +2652,8 @@ static int get_antenna_gain(struct ath_hw *ah, struct ath9k_channel *chan) | |||
| 2652 | return ah->eep_ops->get_eeprom(ah, gain_param); | 2652 | return ah->eep_ops->get_eeprom(ah, gain_param); |
| 2653 | } | 2653 | } |
| 2654 | 2654 | ||
| 2655 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | 2655 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
| 2656 | bool test) | ||
| 2656 | { | 2657 | { |
| 2657 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); | 2658 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); |
| 2658 | struct ieee80211_channel *channel; | 2659 | struct ieee80211_channel *channel; |
| @@ -2673,7 +2674,7 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | |||
| 2673 | 2674 | ||
| 2674 | ah->eep_ops->set_txpower(ah, chan, | 2675 | ah->eep_ops->set_txpower(ah, chan, |
| 2675 | ath9k_regd_get_ctl(reg, chan), | 2676 | ath9k_regd_get_ctl(reg, chan), |
| 2676 | ant_reduction, new_pwr, false); | 2677 | ant_reduction, new_pwr, test); |
| 2677 | } | 2678 | } |
| 2678 | 2679 | ||
| 2679 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | 2680 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) |
| @@ -2686,7 +2687,7 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | |||
| 2686 | if (test) | 2687 | if (test) |
| 2687 | channel->max_power = MAX_RATE_POWER / 2; | 2688 | channel->max_power = MAX_RATE_POWER / 2; |
| 2688 | 2689 | ||
| 2689 | ath9k_hw_apply_txpower(ah, chan); | 2690 | ath9k_hw_apply_txpower(ah, chan, test); |
| 2690 | 2691 | ||
| 2691 | if (test) | 2692 | if (test) |
| 2692 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); | 2693 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index aa1680a0c7fd..e88f182ff45c 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
| @@ -985,7 +985,8 @@ void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); | |||
| 985 | /* PHY */ | 985 | /* PHY */ |
| 986 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, | 986 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, |
| 987 | u32 *coef_mantissa, u32 *coef_exponent); | 987 | u32 *coef_mantissa, u32 *coef_exponent); |
| 988 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan); | 988 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
| 989 | bool test); | ||
| 989 | 990 | ||
| 990 | /* | 991 | /* |
| 991 | * Code Specific to AR5008, AR9001 or AR9002, | 992 | * Code Specific to AR5008, AR9001 or AR9002, |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index c79e6638c88d..e4d6dc2e37d1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -4827,8 +4827,14 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
| 4827 | out_mutex_unlock: | 4827 | out_mutex_unlock: |
| 4828 | mutex_unlock(&wl->mutex); | 4828 | mutex_unlock(&wl->mutex); |
| 4829 | 4829 | ||
| 4830 | /* reload configuration */ | 4830 | /* |
| 4831 | b43_op_config(hw, ~0); | 4831 | * Configuration may have been overwritten during initialization. |
| 4832 | * Reload the configuration, but only if initialization was | ||
| 4833 | * successful. Reloading the configuration after a failed init | ||
| 4834 | * may hang the system. | ||
| 4835 | */ | ||
| 4836 | if (!err) | ||
| 4837 | b43_op_config(hw, ~0); | ||
| 4832 | 4838 | ||
| 4833 | return err; | 4839 | return err; |
| 4834 | } | 4840 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index 4688904908ec..758c115b556e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
| @@ -108,9 +108,15 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, | |||
| 108 | sdio_release_host(sdfunc); | 108 | sdio_release_host(sdfunc); |
| 109 | } | 109 | } |
| 110 | } else if (regaddr == SDIO_CCCR_ABORT) { | 110 | } else if (regaddr == SDIO_CCCR_ABORT) { |
| 111 | sdfunc = kmemdup(sdiodev->func[0], sizeof(struct sdio_func), | ||
| 112 | GFP_KERNEL); | ||
| 113 | if (!sdfunc) | ||
| 114 | return -ENOMEM; | ||
| 115 | sdfunc->num = 0; | ||
| 111 | sdio_claim_host(sdfunc); | 116 | sdio_claim_host(sdfunc); |
| 112 | sdio_writeb(sdfunc, *byte, regaddr, &err_ret); | 117 | sdio_writeb(sdfunc, *byte, regaddr, &err_ret); |
| 113 | sdio_release_host(sdfunc); | 118 | sdio_release_host(sdfunc); |
| 119 | kfree(sdfunc); | ||
| 114 | } else if (regaddr < 0xF0) { | 120 | } else if (regaddr < 0xF0) { |
| 115 | brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); | 121 | brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); |
| 116 | err_ret = -EPERM; | 122 | err_ret = -EPERM; |
| @@ -486,7 +492,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, | |||
| 486 | kfree(bus_if); | 492 | kfree(bus_if); |
| 487 | return -ENOMEM; | 493 | return -ENOMEM; |
| 488 | } | 494 | } |
| 489 | sdiodev->func[0] = func->card->sdio_func[0]; | 495 | sdiodev->func[0] = func; |
| 490 | sdiodev->func[1] = func; | 496 | sdiodev->func[1] = func; |
| 491 | sdiodev->bus_if = bus_if; | 497 | sdiodev->bus_if = bus_if; |
| 492 | bus_if->bus_priv.sdio = sdiodev; | 498 | bus_if->bus_priv.sdio = sdiodev; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 2bf5dda29291..e2b34e1563f4 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
| @@ -574,6 +574,8 @@ struct brcmf_sdio { | |||
| 574 | 574 | ||
| 575 | struct task_struct *dpc_tsk; | 575 | struct task_struct *dpc_tsk; |
| 576 | struct completion dpc_wait; | 576 | struct completion dpc_wait; |
| 577 | struct list_head dpc_tsklst; | ||
| 578 | spinlock_t dpc_tl_lock; | ||
| 577 | 579 | ||
| 578 | struct semaphore sdsem; | 580 | struct semaphore sdsem; |
| 579 | 581 | ||
| @@ -2594,29 +2596,59 @@ clkwait: | |||
| 2594 | return resched; | 2596 | return resched; |
| 2595 | } | 2597 | } |
| 2596 | 2598 | ||
| 2599 | static inline void brcmf_sdbrcm_adddpctsk(struct brcmf_sdio *bus) | ||
| 2600 | { | ||
| 2601 | struct list_head *new_hd; | ||
| 2602 | unsigned long flags; | ||
| 2603 | |||
| 2604 | if (in_interrupt()) | ||
| 2605 | new_hd = kzalloc(sizeof(struct list_head), GFP_ATOMIC); | ||
| 2606 | else | ||
| 2607 | new_hd = kzalloc(sizeof(struct list_head), GFP_KERNEL); | ||
| 2608 | if (new_hd == NULL) | ||
| 2609 | return; | ||
| 2610 | |||
| 2611 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
| 2612 | list_add_tail(new_hd, &bus->dpc_tsklst); | ||
| 2613 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
| 2614 | } | ||
| 2615 | |||
| 2597 | static int brcmf_sdbrcm_dpc_thread(void *data) | 2616 | static int brcmf_sdbrcm_dpc_thread(void *data) |
| 2598 | { | 2617 | { |
| 2599 | struct brcmf_sdio *bus = (struct brcmf_sdio *) data; | 2618 | struct brcmf_sdio *bus = (struct brcmf_sdio *) data; |
| 2619 | struct list_head *cur_hd, *tmp_hd; | ||
| 2620 | unsigned long flags; | ||
| 2600 | 2621 | ||
| 2601 | allow_signal(SIGTERM); | 2622 | allow_signal(SIGTERM); |
| 2602 | /* Run until signal received */ | 2623 | /* Run until signal received */ |
| 2603 | while (1) { | 2624 | while (1) { |
| 2604 | if (kthread_should_stop()) | 2625 | if (kthread_should_stop()) |
| 2605 | break; | 2626 | break; |
| 2606 | if (!wait_for_completion_interruptible(&bus->dpc_wait)) { | 2627 | |
| 2607 | /* Call bus dpc unless it indicated down | 2628 | if (list_empty(&bus->dpc_tsklst)) |
| 2608 | (then clean stop) */ | 2629 | if (wait_for_completion_interruptible(&bus->dpc_wait)) |
| 2609 | if (bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN) { | 2630 | break; |
| 2610 | if (brcmf_sdbrcm_dpc(bus)) | 2631 | |
| 2611 | complete(&bus->dpc_wait); | 2632 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); |
| 2612 | } else { | 2633 | list_for_each_safe(cur_hd, tmp_hd, &bus->dpc_tsklst) { |
| 2634 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
| 2635 | |||
| 2636 | if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) { | ||
| 2613 | /* after stopping the bus, exit thread */ | 2637 | /* after stopping the bus, exit thread */ |
| 2614 | brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); | 2638 | brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); |
| 2615 | bus->dpc_tsk = NULL; | 2639 | bus->dpc_tsk = NULL; |
| 2640 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
| 2616 | break; | 2641 | break; |
| 2617 | } | 2642 | } |
| 2618 | } else | 2643 | |
| 2619 | break; | 2644 | if (brcmf_sdbrcm_dpc(bus)) |
| 2645 | brcmf_sdbrcm_adddpctsk(bus); | ||
| 2646 | |||
| 2647 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
| 2648 | list_del(cur_hd); | ||
| 2649 | kfree(cur_hd); | ||
| 2650 | } | ||
| 2651 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
| 2620 | } | 2652 | } |
| 2621 | return 0; | 2653 | return 0; |
| 2622 | } | 2654 | } |
| @@ -2669,8 +2701,10 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) | |||
| 2669 | /* Schedule DPC if needed to send queued packet(s) */ | 2701 | /* Schedule DPC if needed to send queued packet(s) */ |
| 2670 | if (!bus->dpc_sched) { | 2702 | if (!bus->dpc_sched) { |
| 2671 | bus->dpc_sched = true; | 2703 | bus->dpc_sched = true; |
| 2672 | if (bus->dpc_tsk) | 2704 | if (bus->dpc_tsk) { |
| 2705 | brcmf_sdbrcm_adddpctsk(bus); | ||
| 2673 | complete(&bus->dpc_wait); | 2706 | complete(&bus->dpc_wait); |
| 2707 | } | ||
| 2674 | } | 2708 | } |
| 2675 | 2709 | ||
| 2676 | return ret; | 2710 | return ret; |
| @@ -3514,8 +3548,10 @@ void brcmf_sdbrcm_isr(void *arg) | |||
| 3514 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); | 3548 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); |
| 3515 | 3549 | ||
| 3516 | bus->dpc_sched = true; | 3550 | bus->dpc_sched = true; |
| 3517 | if (bus->dpc_tsk) | 3551 | if (bus->dpc_tsk) { |
| 3552 | brcmf_sdbrcm_adddpctsk(bus); | ||
| 3518 | complete(&bus->dpc_wait); | 3553 | complete(&bus->dpc_wait); |
| 3554 | } | ||
| 3519 | } | 3555 | } |
| 3520 | 3556 | ||
| 3521 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | 3557 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) |
| @@ -3559,8 +3595,10 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | |||
| 3559 | bus->ipend = true; | 3595 | bus->ipend = true; |
| 3560 | 3596 | ||
| 3561 | bus->dpc_sched = true; | 3597 | bus->dpc_sched = true; |
| 3562 | if (bus->dpc_tsk) | 3598 | if (bus->dpc_tsk) { |
| 3599 | brcmf_sdbrcm_adddpctsk(bus); | ||
| 3563 | complete(&bus->dpc_wait); | 3600 | complete(&bus->dpc_wait); |
| 3601 | } | ||
| 3564 | } | 3602 | } |
| 3565 | } | 3603 | } |
| 3566 | 3604 | ||
| @@ -3897,6 +3935,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
| 3897 | } | 3935 | } |
| 3898 | /* Initialize DPC thread */ | 3936 | /* Initialize DPC thread */ |
| 3899 | init_completion(&bus->dpc_wait); | 3937 | init_completion(&bus->dpc_wait); |
| 3938 | INIT_LIST_HEAD(&bus->dpc_tsklst); | ||
| 3939 | spin_lock_init(&bus->dpc_tl_lock); | ||
| 3900 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, | 3940 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, |
| 3901 | bus, "brcmf_dpc"); | 3941 | bus, "brcmf_dpc"); |
| 3902 | if (IS_ERR(bus->dpc_tsk)) { | 3942 | if (IS_ERR(bus->dpc_tsk)) { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 7083db75b00c..b4d92792c502 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
| @@ -847,8 +847,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
| 847 | */ | 847 | */ |
| 848 | if (!(txs->status & TX_STATUS_AMPDU) | 848 | if (!(txs->status & TX_STATUS_AMPDU) |
| 849 | && (txs->status & TX_STATUS_INTERMEDIATE)) { | 849 | && (txs->status & TX_STATUS_INTERMEDIATE)) { |
| 850 | wiphy_err(wlc->wiphy, "%s: INTERMEDIATE but not AMPDU\n", | 850 | BCMMSG(wlc->wiphy, "INTERMEDIATE but not AMPDU\n"); |
| 851 | __func__); | ||
| 852 | return false; | 851 | return false; |
| 853 | } | 852 | } |
| 854 | 853 | ||
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 2b022571a859..1779db3aa2b0 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
| @@ -2191,6 +2191,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
| 2191 | { | 2191 | { |
| 2192 | int rc = 0; | 2192 | int rc = 0; |
| 2193 | unsigned long flags; | 2193 | unsigned long flags; |
| 2194 | unsigned long now, end; | ||
| 2194 | 2195 | ||
| 2195 | spin_lock_irqsave(&priv->lock, flags); | 2196 | spin_lock_irqsave(&priv->lock, flags); |
| 2196 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2197 | if (priv->status & STATUS_HCMD_ACTIVE) { |
| @@ -2232,10 +2233,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
| 2232 | } | 2233 | } |
| 2233 | spin_unlock_irqrestore(&priv->lock, flags); | 2234 | spin_unlock_irqrestore(&priv->lock, flags); |
| 2234 | 2235 | ||
| 2236 | now = jiffies; | ||
| 2237 | end = now + HOST_COMPLETE_TIMEOUT; | ||
| 2238 | again: | ||
| 2235 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, | 2239 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, |
| 2236 | !(priv-> | 2240 | !(priv-> |
| 2237 | status & STATUS_HCMD_ACTIVE), | 2241 | status & STATUS_HCMD_ACTIVE), |
| 2238 | HOST_COMPLETE_TIMEOUT); | 2242 | end - now); |
| 2243 | if (rc < 0) { | ||
| 2244 | now = jiffies; | ||
| 2245 | if (time_before(now, end)) | ||
| 2246 | goto again; | ||
| 2247 | rc = 0; | ||
| 2248 | } | ||
| 2249 | |||
| 2239 | if (rc == 0) { | 2250 | if (rc == 0) { |
| 2240 | spin_lock_irqsave(&priv->lock, flags); | 2251 | spin_lock_irqsave(&priv->lock, flags); |
| 2241 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2252 | if (priv->status & STATUS_HCMD_ACTIVE) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 5b0d888f746b..8d80e233bc7a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
| @@ -46,8 +46,8 @@ | |||
| 46 | #include "iwl-prph.h" | 46 | #include "iwl-prph.h" |
| 47 | 47 | ||
| 48 | /* Highest firmware API version supported */ | 48 | /* Highest firmware API version supported */ |
| 49 | #define IWL1000_UCODE_API_MAX 6 | 49 | #define IWL1000_UCODE_API_MAX 5 |
| 50 | #define IWL100_UCODE_API_MAX 6 | 50 | #define IWL100_UCODE_API_MAX 5 |
| 51 | 51 | ||
| 52 | /* Oldest version we won't warn about */ | 52 | /* Oldest version we won't warn about */ |
| 53 | #define IWL1000_UCODE_API_OK 5 | 53 | #define IWL1000_UCODE_API_OK 5 |
| @@ -226,5 +226,5 @@ const struct iwl_cfg iwl100_bg_cfg = { | |||
| 226 | IWL_DEVICE_100, | 226 | IWL_DEVICE_100, |
| 227 | }; | 227 | }; |
| 228 | 228 | ||
| 229 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | 229 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK)); |
| 230 | MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX)); | 230 | MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 5635b9e2c69e..ea108622e0bd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
| @@ -51,10 +51,10 @@ | |||
| 51 | #define IWL135_UCODE_API_MAX 6 | 51 | #define IWL135_UCODE_API_MAX 6 |
| 52 | 52 | ||
| 53 | /* Oldest version we won't warn about */ | 53 | /* Oldest version we won't warn about */ |
| 54 | #define IWL2030_UCODE_API_OK 5 | 54 | #define IWL2030_UCODE_API_OK 6 |
| 55 | #define IWL2000_UCODE_API_OK 5 | 55 | #define IWL2000_UCODE_API_OK 6 |
| 56 | #define IWL105_UCODE_API_OK 5 | 56 | #define IWL105_UCODE_API_OK 6 |
| 57 | #define IWL135_UCODE_API_OK 5 | 57 | #define IWL135_UCODE_API_OK 6 |
| 58 | 58 | ||
| 59 | /* Lowest firmware API version supported */ | 59 | /* Lowest firmware API version supported */ |
| 60 | #define IWL2030_UCODE_API_MIN 5 | 60 | #define IWL2030_UCODE_API_MIN 5 |
| @@ -328,7 +328,7 @@ const struct iwl_cfg iwl135_bgn_cfg = { | |||
| 328 | .ht_params = &iwl2000_ht_params, | 328 | .ht_params = &iwl2000_ht_params, |
| 329 | }; | 329 | }; |
| 330 | 330 | ||
| 331 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX)); | 331 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK)); |
| 332 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX)); | 332 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK)); |
| 333 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX)); | 333 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK)); |
| 334 | MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX)); | 334 | MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index a805e97b89af..de0920c74cdd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
| @@ -51,6 +51,10 @@ | |||
| 51 | #define IWL5000_UCODE_API_MAX 5 | 51 | #define IWL5000_UCODE_API_MAX 5 |
| 52 | #define IWL5150_UCODE_API_MAX 2 | 52 | #define IWL5150_UCODE_API_MAX 2 |
| 53 | 53 | ||
| 54 | /* Oldest version we won't warn about */ | ||
| 55 | #define IWL5000_UCODE_API_OK 5 | ||
| 56 | #define IWL5150_UCODE_API_OK 2 | ||
| 57 | |||
| 54 | /* Lowest firmware API version supported */ | 58 | /* Lowest firmware API version supported */ |
| 55 | #define IWL5000_UCODE_API_MIN 1 | 59 | #define IWL5000_UCODE_API_MIN 1 |
| 56 | #define IWL5150_UCODE_API_MIN 1 | 60 | #define IWL5150_UCODE_API_MIN 1 |
| @@ -326,6 +330,7 @@ static const struct iwl_ht_params iwl5000_ht_params = { | |||
| 326 | #define IWL_DEVICE_5000 \ | 330 | #define IWL_DEVICE_5000 \ |
| 327 | .fw_name_pre = IWL5000_FW_PRE, \ | 331 | .fw_name_pre = IWL5000_FW_PRE, \ |
| 328 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ | 332 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ |
| 333 | .ucode_api_ok = IWL5000_UCODE_API_OK, \ | ||
| 329 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ | 334 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ |
| 330 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 335 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
| 331 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ | 336 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
| @@ -371,6 +376,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
| 371 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", | 376 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", |
| 372 | .fw_name_pre = IWL5000_FW_PRE, | 377 | .fw_name_pre = IWL5000_FW_PRE, |
| 373 | .ucode_api_max = IWL5000_UCODE_API_MAX, | 378 | .ucode_api_max = IWL5000_UCODE_API_MAX, |
| 379 | .ucode_api_ok = IWL5000_UCODE_API_OK, | ||
| 374 | .ucode_api_min = IWL5000_UCODE_API_MIN, | 380 | .ucode_api_min = IWL5000_UCODE_API_MIN, |
| 375 | .max_inst_size = IWLAGN_RTC_INST_SIZE, | 381 | .max_inst_size = IWLAGN_RTC_INST_SIZE, |
| 376 | .max_data_size = IWLAGN_RTC_DATA_SIZE, | 382 | .max_data_size = IWLAGN_RTC_DATA_SIZE, |
| @@ -386,6 +392,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
| 386 | #define IWL_DEVICE_5150 \ | 392 | #define IWL_DEVICE_5150 \ |
| 387 | .fw_name_pre = IWL5150_FW_PRE, \ | 393 | .fw_name_pre = IWL5150_FW_PRE, \ |
| 388 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ | 394 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ |
| 395 | .ucode_api_ok = IWL5150_UCODE_API_OK, \ | ||
| 389 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ | 396 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ |
| 390 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 397 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
| 391 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ | 398 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
| @@ -409,5 +416,5 @@ const struct iwl_cfg iwl5150_abg_cfg = { | |||
| 409 | IWL_DEVICE_5150, | 416 | IWL_DEVICE_5150, |
| 410 | }; | 417 | }; |
| 411 | 418 | ||
| 412 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | 419 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK)); |
| 413 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); | 420 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 64060cd738b5..f0c91505a7f7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
| @@ -53,6 +53,8 @@ | |||
| 53 | /* Oldest version we won't warn about */ | 53 | /* Oldest version we won't warn about */ |
| 54 | #define IWL6000_UCODE_API_OK 4 | 54 | #define IWL6000_UCODE_API_OK 4 |
| 55 | #define IWL6000G2_UCODE_API_OK 5 | 55 | #define IWL6000G2_UCODE_API_OK 5 |
| 56 | #define IWL6050_UCODE_API_OK 5 | ||
| 57 | #define IWL6000G2B_UCODE_API_OK 6 | ||
| 56 | 58 | ||
| 57 | /* Lowest firmware API version supported */ | 59 | /* Lowest firmware API version supported */ |
| 58 | #define IWL6000_UCODE_API_MIN 4 | 60 | #define IWL6000_UCODE_API_MIN 4 |
| @@ -388,7 +390,7 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = { | |||
| 388 | #define IWL_DEVICE_6030 \ | 390 | #define IWL_DEVICE_6030 \ |
| 389 | .fw_name_pre = IWL6030_FW_PRE, \ | 391 | .fw_name_pre = IWL6030_FW_PRE, \ |
| 390 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ | 392 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ |
| 391 | .ucode_api_ok = IWL6000G2_UCODE_API_OK, \ | 393 | .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \ |
| 392 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ | 394 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ |
| 393 | .max_inst_size = IWL60_RTC_INST_SIZE, \ | 395 | .max_inst_size = IWL60_RTC_INST_SIZE, \ |
| 394 | .max_data_size = IWL60_RTC_DATA_SIZE, \ | 396 | .max_data_size = IWL60_RTC_DATA_SIZE, \ |
| @@ -557,6 +559,6 @@ const struct iwl_cfg iwl6000_3agn_cfg = { | |||
| 557 | }; | 559 | }; |
| 558 | 560 | ||
| 559 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); | 561 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); |
| 560 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); | 562 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK)); |
| 561 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 563 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK)); |
| 562 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 564 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c index f4b84d1596e3..22474608a70b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c | |||
| @@ -773,8 +773,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
| 773 | struct sk_buff *skb; | 773 | struct sk_buff *skb; |
| 774 | __le16 fc = hdr->frame_control; | 774 | __le16 fc = hdr->frame_control; |
| 775 | struct iwl_rxon_context *ctx; | 775 | struct iwl_rxon_context *ctx; |
| 776 | struct page *p; | 776 | unsigned int hdrlen, fraglen; |
| 777 | int offset; | ||
| 778 | 777 | ||
| 779 | /* We only process data packets if the interface is open */ | 778 | /* We only process data packets if the interface is open */ |
| 780 | if (unlikely(!priv->is_open)) { | 779 | if (unlikely(!priv->is_open)) { |
| @@ -788,16 +787,24 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
| 788 | iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) | 787 | iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) |
| 789 | return; | 788 | return; |
| 790 | 789 | ||
| 791 | skb = dev_alloc_skb(128); | 790 | /* Dont use dev_alloc_skb(), we'll have enough headroom once |
| 791 | * ieee80211_hdr pulled. | ||
| 792 | */ | ||
| 793 | skb = alloc_skb(128, GFP_ATOMIC); | ||
| 792 | if (!skb) { | 794 | if (!skb) { |
| 793 | IWL_ERR(priv, "dev_alloc_skb failed\n"); | 795 | IWL_ERR(priv, "alloc_skb failed\n"); |
| 794 | return; | 796 | return; |
| 795 | } | 797 | } |
| 798 | hdrlen = min_t(unsigned int, len, skb_tailroom(skb)); | ||
| 799 | memcpy(skb_put(skb, hdrlen), hdr, hdrlen); | ||
| 800 | fraglen = len - hdrlen; | ||
| 796 | 801 | ||
| 797 | offset = (void *)hdr - rxb_addr(rxb); | 802 | if (fraglen) { |
| 798 | p = rxb_steal_page(rxb); | 803 | int offset = (void *)hdr + hdrlen - rxb_addr(rxb); |
| 799 | skb_add_rx_frag(skb, 0, p, offset, len, len); | ||
| 800 | 804 | ||
| 805 | skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset, | ||
| 806 | fraglen, rxb->truesize); | ||
| 807 | } | ||
| 801 | iwl_update_stats(priv, false, fc, len); | 808 | iwl_update_stats(priv, false, fc, len); |
| 802 | 809 | ||
| 803 | /* | 810 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index f1226dbf789d..2a9a16f901c3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
| @@ -863,7 +863,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) | |||
| 863 | 863 | ||
| 864 | void iwlagn_prepare_restart(struct iwl_priv *priv) | 864 | void iwlagn_prepare_restart(struct iwl_priv *priv) |
| 865 | { | 865 | { |
| 866 | struct iwl_rxon_context *ctx; | ||
| 867 | bool bt_full_concurrent; | 866 | bool bt_full_concurrent; |
| 868 | u8 bt_ci_compliance; | 867 | u8 bt_ci_compliance; |
| 869 | u8 bt_load; | 868 | u8 bt_load; |
| @@ -872,8 +871,6 @@ void iwlagn_prepare_restart(struct iwl_priv *priv) | |||
| 872 | 871 | ||
| 873 | lockdep_assert_held(&priv->mutex); | 872 | lockdep_assert_held(&priv->mutex); |
| 874 | 873 | ||
| 875 | for_each_context(priv, ctx) | ||
| 876 | ctx->vif = NULL; | ||
| 877 | priv->is_open = 0; | 874 | priv->is_open = 0; |
| 878 | 875 | ||
| 879 | /* | 876 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index 90208094b8eb..74bce97a8600 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | |||
| @@ -104,15 +104,29 @@ | |||
| 104 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 | 104 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 |
| 105 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte | 105 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte |
| 106 | * aligned (address bits 0-7 must be 0). | 106 | * aligned (address bits 0-7 must be 0). |
| 107 | * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers | ||
| 108 | * for them are in different places. | ||
| 107 | * | 109 | * |
| 108 | * Bit fields in each pointer register: | 110 | * Bit fields in each pointer register: |
| 109 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned | 111 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned |
| 110 | */ | 112 | */ |
| 111 | #define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) | 113 | #define FH_MEM_CBBC_0_15_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) |
| 112 | #define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) | 114 | #define FH_MEM_CBBC_0_15_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) |
| 113 | 115 | #define FH_MEM_CBBC_16_19_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBF0) | |
| 114 | /* Find TFD CB base pointer for given queue (range 0-15). */ | 116 | #define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) |
| 115 | #define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4) | 117 | #define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20) |
| 118 | #define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) | ||
| 119 | |||
| 120 | /* Find TFD CB base pointer for given queue */ | ||
| 121 | static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | ||
| 122 | { | ||
| 123 | if (chnl < 16) | ||
| 124 | return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl; | ||
| 125 | if (chnl < 20) | ||
| 126 | return FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16); | ||
| 127 | WARN_ON_ONCE(chnl >= 32); | ||
| 128 | return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20); | ||
| 129 | } | ||
| 116 | 130 | ||
| 117 | 131 | ||
| 118 | /** | 132 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c index b6805f8e9a01..c24a7134a6f9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c | |||
| @@ -1244,6 +1244,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
| 1244 | struct iwl_rxon_context *tmp, *ctx = NULL; | 1244 | struct iwl_rxon_context *tmp, *ctx = NULL; |
| 1245 | int err; | 1245 | int err; |
| 1246 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); | 1246 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); |
| 1247 | bool reset = false; | ||
| 1247 | 1248 | ||
| 1248 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", | 1249 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", |
| 1249 | viftype, vif->addr); | 1250 | viftype, vif->addr); |
| @@ -1265,6 +1266,13 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
| 1265 | tmp->interface_modes | tmp->exclusive_interface_modes; | 1266 | tmp->interface_modes | tmp->exclusive_interface_modes; |
| 1266 | 1267 | ||
| 1267 | if (tmp->vif) { | 1268 | if (tmp->vif) { |
| 1269 | /* On reset we need to add the same interface again */ | ||
| 1270 | if (tmp->vif == vif) { | ||
| 1271 | reset = true; | ||
| 1272 | ctx = tmp; | ||
| 1273 | break; | ||
| 1274 | } | ||
| 1275 | |||
| 1268 | /* check if this busy context is exclusive */ | 1276 | /* check if this busy context is exclusive */ |
| 1269 | if (tmp->exclusive_interface_modes & | 1277 | if (tmp->exclusive_interface_modes & |
| 1270 | BIT(tmp->vif->type)) { | 1278 | BIT(tmp->vif->type)) { |
| @@ -1291,7 +1299,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
| 1291 | ctx->vif = vif; | 1299 | ctx->vif = vif; |
| 1292 | 1300 | ||
| 1293 | err = iwl_setup_interface(priv, ctx); | 1301 | err = iwl_setup_interface(priv, ctx); |
| 1294 | if (!err) | 1302 | if (!err || reset) |
| 1295 | goto out; | 1303 | goto out; |
| 1296 | 1304 | ||
| 1297 | ctx->vif = NULL; | 1305 | ctx->vif = NULL; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index 75dc20bd965b..3b1069290fa9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
| @@ -223,12 +223,33 @@ | |||
| 223 | #define SCD_AIT (SCD_BASE + 0x0c) | 223 | #define SCD_AIT (SCD_BASE + 0x0c) |
| 224 | #define SCD_TXFACT (SCD_BASE + 0x10) | 224 | #define SCD_TXFACT (SCD_BASE + 0x10) |
| 225 | #define SCD_ACTIVE (SCD_BASE + 0x14) | 225 | #define SCD_ACTIVE (SCD_BASE + 0x14) |
| 226 | #define SCD_QUEUE_WRPTR(x) (SCD_BASE + 0x18 + (x) * 4) | ||
| 227 | #define SCD_QUEUE_RDPTR(x) (SCD_BASE + 0x68 + (x) * 4) | ||
| 228 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) | 226 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) |
| 229 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) | 227 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) |
| 230 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) | 228 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) |
| 231 | #define SCD_QUEUE_STATUS_BITS(x) (SCD_BASE + 0x10c + (x) * 4) | 229 | |
| 230 | static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl) | ||
| 231 | { | ||
| 232 | if (chnl < 20) | ||
| 233 | return SCD_BASE + 0x18 + chnl * 4; | ||
| 234 | WARN_ON_ONCE(chnl >= 32); | ||
| 235 | return SCD_BASE + 0x284 + (chnl - 20) * 4; | ||
| 236 | } | ||
| 237 | |||
| 238 | static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl) | ||
| 239 | { | ||
| 240 | if (chnl < 20) | ||
| 241 | return SCD_BASE + 0x68 + chnl * 4; | ||
| 242 | WARN_ON_ONCE(chnl >= 32); | ||
| 243 | return SCD_BASE + 0x2B4 + (chnl - 20) * 4; | ||
| 244 | } | ||
| 245 | |||
| 246 | static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl) | ||
| 247 | { | ||
| 248 | if (chnl < 20) | ||
| 249 | return SCD_BASE + 0x10c + chnl * 4; | ||
| 250 | WARN_ON_ONCE(chnl >= 32); | ||
| 251 | return SCD_BASE + 0x384 + (chnl - 20) * 4; | ||
| 252 | } | ||
| 232 | 253 | ||
| 233 | /*********************** END TX SCHEDULER *************************************/ | 254 | /*********************** END TX SCHEDULER *************************************/ |
| 234 | 255 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c index 8b1a7988e176..aa7aea168138 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | |||
| @@ -374,8 +374,9 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans, | |||
| 374 | if (WARN_ON(!rxb)) | 374 | if (WARN_ON(!rxb)) |
| 375 | return; | 375 | return; |
| 376 | 376 | ||
| 377 | rxcb.truesize = PAGE_SIZE << hw_params(trans).rx_page_order; | ||
| 377 | dma_unmap_page(trans->dev, rxb->page_dma, | 378 | dma_unmap_page(trans->dev, rxb->page_dma, |
| 378 | PAGE_SIZE << hw_params(trans).rx_page_order, | 379 | rxcb.truesize, |
| 379 | DMA_FROM_DEVICE); | 380 | DMA_FROM_DEVICE); |
| 380 | 381 | ||
| 381 | rxcb._page = rxb->page; | 382 | rxcb._page = rxb->page; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 0c81cbaa8088..fdf97886a5e4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
| @@ -260,6 +260,7 @@ static inline void iwl_free_resp(struct iwl_host_cmd *cmd) | |||
| 260 | 260 | ||
| 261 | struct iwl_rx_cmd_buffer { | 261 | struct iwl_rx_cmd_buffer { |
| 262 | struct page *_page; | 262 | struct page *_page; |
| 263 | unsigned int truesize; | ||
| 263 | }; | 264 | }; |
| 264 | 265 | ||
| 265 | static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r) | 266 | static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r) |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 288b035a3579..67f9430ee197 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
| @@ -1851,14 +1851,6 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev, | |||
| 1851 | /*like read eeprom and so on */ | 1851 | /*like read eeprom and so on */ |
| 1852 | rtlpriv->cfg->ops->read_eeprom_info(hw); | 1852 | rtlpriv->cfg->ops->read_eeprom_info(hw); |
| 1853 | 1853 | ||
| 1854 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
| 1855 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
| 1856 | err = -ENODEV; | ||
| 1857 | goto fail3; | ||
| 1858 | } | ||
| 1859 | |||
| 1860 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
| 1861 | |||
| 1862 | /*aspm */ | 1854 | /*aspm */ |
| 1863 | rtl_pci_init_aspm(hw); | 1855 | rtl_pci_init_aspm(hw); |
| 1864 | 1856 | ||
| @@ -1877,6 +1869,14 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev, | |||
| 1877 | goto fail3; | 1869 | goto fail3; |
| 1878 | } | 1870 | } |
| 1879 | 1871 | ||
| 1872 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
| 1873 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
| 1874 | err = -ENODEV; | ||
| 1875 | goto fail3; | ||
| 1876 | } | ||
| 1877 | |||
| 1878 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
| 1879 | |||
| 1880 | err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group); | 1880 | err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group); |
| 1881 | if (err) { | 1881 | if (err) { |
| 1882 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 1882 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
| @@ -1941,6 +1941,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev) | |||
| 1941 | rtl_deinit_deferred_work(hw); | 1941 | rtl_deinit_deferred_work(hw); |
| 1942 | rtlpriv->intf_ops->adapter_stop(hw); | 1942 | rtlpriv->intf_ops->adapter_stop(hw); |
| 1943 | } | 1943 | } |
| 1944 | rtlpriv->cfg->ops->disable_interrupt(hw); | ||
| 1944 | 1945 | ||
| 1945 | /*deinit rfkill */ | 1946 | /*deinit rfkill */ |
| 1946 | rtl_deinit_rfkill(hw); | 1947 | rtl_deinit_rfkill(hw); |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index d04dbda13f5a..a6049d7d51b3 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
| @@ -971,11 +971,6 @@ int __devinit rtl_usb_probe(struct usb_interface *intf, | |||
| 971 | rtlpriv->cfg->ops->read_chip_version(hw); | 971 | rtlpriv->cfg->ops->read_chip_version(hw); |
| 972 | /*like read eeprom and so on */ | 972 | /*like read eeprom and so on */ |
| 973 | rtlpriv->cfg->ops->read_eeprom_info(hw); | 973 | rtlpriv->cfg->ops->read_eeprom_info(hw); |
| 974 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
| 975 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
| 976 | goto error_out; | ||
| 977 | } | ||
| 978 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
| 979 | err = _rtl_usb_init(hw); | 974 | err = _rtl_usb_init(hw); |
| 980 | if (err) | 975 | if (err) |
| 981 | goto error_out; | 976 | goto error_out; |
| @@ -987,6 +982,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf, | |||
| 987 | "Can't allocate sw for mac80211\n"); | 982 | "Can't allocate sw for mac80211\n"); |
| 988 | goto error_out; | 983 | goto error_out; |
| 989 | } | 984 | } |
| 985 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
| 986 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
| 987 | goto error_out; | ||
| 988 | } | ||
| 989 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
| 990 | 990 | ||
| 991 | return 0; | 991 | return 0; |
| 992 | error_out: | 992 | error_out: |
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c index 41302c7b1ad0..d1afb8e3b2ef 100644 --- a/drivers/net/wireless/wl1251/main.c +++ b/drivers/net/wireless/wl1251/main.c | |||
| @@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw) | |||
| 479 | cancel_work_sync(&wl->irq_work); | 479 | cancel_work_sync(&wl->irq_work); |
| 480 | cancel_work_sync(&wl->tx_work); | 480 | cancel_work_sync(&wl->tx_work); |
| 481 | cancel_work_sync(&wl->filter_work); | 481 | cancel_work_sync(&wl->filter_work); |
| 482 | cancel_delayed_work_sync(&wl->elp_work); | ||
| 482 | 483 | ||
| 483 | mutex_lock(&wl->mutex); | 484 | mutex_lock(&wl->mutex); |
| 484 | 485 | ||
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c index f78694295c39..1b851f650e07 100644 --- a/drivers/net/wireless/wl1251/sdio.c +++ b/drivers/net/wireless/wl1251/sdio.c | |||
| @@ -315,8 +315,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func) | |||
| 315 | 315 | ||
| 316 | if (wl->irq) | 316 | if (wl->irq) |
| 317 | free_irq(wl->irq, wl); | 317 | free_irq(wl->irq, wl); |
| 318 | kfree(wl_sdio); | ||
| 319 | wl1251_free_hw(wl); | 318 | wl1251_free_hw(wl); |
| 319 | kfree(wl_sdio); | ||
| 320 | 320 | ||
| 321 | sdio_claim_host(func); | 321 | sdio_claim_host(func); |
| 322 | sdio_release_irq(func); | 322 | sdio_release_irq(func); |
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 8644d5372e7f..42cfcd9eb9aa 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #include <asm/ropes.h> | 44 | #include <asm/ropes.h> |
| 45 | #include <asm/mckinley.h> /* for proc_mckinley_root */ | 45 | #include <asm/mckinley.h> /* for proc_mckinley_root */ |
| 46 | #include <asm/runway.h> /* for proc_runway_root */ | 46 | #include <asm/runway.h> /* for proc_runway_root */ |
| 47 | #include <asm/page.h> /* for PAGE0 */ | ||
| 47 | #include <asm/pdc.h> /* for PDC_MODEL_* */ | 48 | #include <asm/pdc.h> /* for PDC_MODEL_* */ |
| 48 | #include <asm/pdcpat.h> /* for is_pdc_pat() */ | 49 | #include <asm/pdcpat.h> /* for is_pdc_pat() */ |
| 49 | #include <asm/parisc-device.h> | 50 | #include <asm/parisc-device.h> |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 0f150f271c2a..61e2fefeedab 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
| @@ -200,7 +200,7 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) | |||
| 200 | return PCI_D1; | 200 | return PCI_D1; |
| 201 | case ACPI_STATE_D2: | 201 | case ACPI_STATE_D2: |
| 202 | return PCI_D2; | 202 | return PCI_D2; |
| 203 | case ACPI_STATE_D3: | 203 | case ACPI_STATE_D3_HOT: |
| 204 | return PCI_D3hot; | 204 | return PCI_D3hot; |
| 205 | case ACPI_STATE_D3_COLD: | 205 | case ACPI_STATE_D3_COLD: |
| 206 | return PCI_D3cold; | 206 | return PCI_D3cold; |
diff --git a/drivers/platform/x86/intel_mid_powerbtn.c b/drivers/platform/x86/intel_mid_powerbtn.c index 0a3594c7e912..bcbad8452a6f 100644 --- a/drivers/platform/x86/intel_mid_powerbtn.c +++ b/drivers/platform/x86/intel_mid_powerbtn.c | |||
| @@ -78,7 +78,7 @@ static int __devinit mfld_pb_probe(struct platform_device *pdev) | |||
| 78 | 78 | ||
| 79 | input_set_capability(input, EV_KEY, KEY_POWER); | 79 | input_set_capability(input, EV_KEY, KEY_POWER); |
| 80 | 80 | ||
| 81 | error = request_threaded_irq(irq, NULL, mfld_pb_isr, 0, | 81 | error = request_threaded_irq(irq, NULL, mfld_pb_isr, IRQF_NO_SUSPEND, |
| 82 | DRIVER_NAME, input); | 82 | DRIVER_NAME, input); |
| 83 | if (error) { | 83 | if (error) { |
| 84 | dev_err(&pdev->dev, "Unable to request irq %d for mfld power" | 84 | dev_err(&pdev->dev, "Unable to request irq %d for mfld power" |
diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c index 375eb04c16ea..6fff68020488 100644 --- a/drivers/ptp/ptp_pch.c +++ b/drivers/ptp/ptp_pch.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
| 31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| 32 | #include <linux/ptp_clock_kernel.h> | 32 | #include <linux/ptp_clock_kernel.h> |
| 33 | #include <linux/slab.h> | ||
| 33 | 34 | ||
| 34 | #define STATION_ADDR_LEN 20 | 35 | #define STATION_ADDR_LEN 20 |
| 35 | #define PCI_DEVICE_ID_PCH_1588 0x8819 | 36 | #define PCI_DEVICE_ID_PCH_1588 0x8819 |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e70dd382a009..046fb1bd8619 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
| @@ -1431,7 +1431,10 @@ void devm_regulator_put(struct regulator *regulator) | |||
| 1431 | 1431 | ||
| 1432 | rc = devres_destroy(regulator->dev, devm_regulator_release, | 1432 | rc = devres_destroy(regulator->dev, devm_regulator_release, |
| 1433 | devm_regulator_match, regulator); | 1433 | devm_regulator_match, regulator); |
| 1434 | WARN_ON(rc); | 1434 | if (rc == 0) |
| 1435 | regulator_put(regulator); | ||
| 1436 | else | ||
| 1437 | WARN_ON(rc); | ||
| 1435 | } | 1438 | } |
| 1436 | EXPORT_SYMBOL_GPL(devm_regulator_put); | 1439 | EXPORT_SYMBOL_GPL(devm_regulator_put); |
| 1437 | 1440 | ||
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 96579296f04d..17a58c56eebf 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
| @@ -684,7 +684,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev, | |||
| 684 | } | 684 | } |
| 685 | 685 | ||
| 686 | new_val++; | 686 | new_val++; |
| 687 | } while (desc->min + desc->step + new_val <= desc->max); | 687 | } while (desc->min + desc->step * new_val <= desc->max); |
| 688 | 688 | ||
| 689 | new_idx = tmp_idx; | 689 | new_idx = tmp_idx; |
| 690 | new_val = tmp_val; | 690 | new_val = tmp_val; |
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index ee15c68fb519..e756a0df3664 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c | |||
| @@ -354,7 +354,7 @@ static void __rproc_free_vrings(struct rproc_vdev *rvdev, int i) | |||
| 354 | { | 354 | { |
| 355 | struct rproc *rproc = rvdev->rproc; | 355 | struct rproc *rproc = rvdev->rproc; |
| 356 | 356 | ||
| 357 | for (i--; i > 0; i--) { | 357 | for (i--; i >= 0; i--) { |
| 358 | struct rproc_vring *rvring = &rvdev->vring[i]; | 358 | struct rproc_vring *rvring = &rvdev->vring[i]; |
| 359 | int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); | 359 | int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); |
| 360 | 360 | ||
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index 42f5f829b3ee..029e421baaed 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c | |||
| @@ -360,12 +360,11 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op) | |||
| 360 | &mpc5200_rtc_ops, THIS_MODULE); | 360 | &mpc5200_rtc_ops, THIS_MODULE); |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | rtc->rtc->uie_unsupported = 1; | ||
| 364 | |||
| 365 | if (IS_ERR(rtc->rtc)) { | 363 | if (IS_ERR(rtc->rtc)) { |
| 366 | err = PTR_ERR(rtc->rtc); | 364 | err = PTR_ERR(rtc->rtc); |
| 367 | goto out_free_irq; | 365 | goto out_free_irq; |
| 368 | } | 366 | } |
| 367 | rtc->rtc->uie_unsupported = 1; | ||
| 369 | 368 | ||
| 370 | return 0; | 369 | return 0; |
| 371 | 370 | ||
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 684ef4bbfce4..f027c063fb20 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
| @@ -312,6 +312,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
| 312 | int ret; | 312 | int ret; |
| 313 | struct pl031_local *ldata; | 313 | struct pl031_local *ldata; |
| 314 | struct rtc_class_ops *ops = id->data; | 314 | struct rtc_class_ops *ops = id->data; |
| 315 | unsigned long time; | ||
| 315 | 316 | ||
| 316 | ret = amba_request_regions(adev, NULL); | 317 | ret = amba_request_regions(adev, NULL); |
| 317 | if (ret) | 318 | if (ret) |
| @@ -343,6 +344,23 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
| 343 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, | 344 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, |
| 344 | ldata->base + RTC_CR); | 345 | ldata->base + RTC_CR); |
| 345 | 346 | ||
| 347 | /* | ||
| 348 | * On ST PL031 variants, the RTC reset value does not provide correct | ||
| 349 | * weekday for 2000-01-01. Correct the erroneous sunday to saturday. | ||
| 350 | */ | ||
| 351 | if (ldata->hw_designer == AMBA_VENDOR_ST) { | ||
| 352 | if (readl(ldata->base + RTC_YDR) == 0x2000) { | ||
| 353 | time = readl(ldata->base + RTC_DR); | ||
| 354 | if ((time & | ||
| 355 | (RTC_MON_MASK | RTC_MDAY_MASK | RTC_WDAY_MASK)) | ||
| 356 | == 0x02120000) { | ||
| 357 | time = time | (0x7 << RTC_WDAY_SHIFT); | ||
| 358 | writel(0x2000, ldata->base + RTC_YLR); | ||
| 359 | writel(time, ldata->base + RTC_LR); | ||
| 360 | } | ||
| 361 | } | ||
| 362 | } | ||
| 363 | |||
| 346 | ldata->rtc = rtc_device_register("pl031", &adev->dev, ops, | 364 | ldata->rtc = rtc_device_register("pl031", &adev->dev, ops, |
| 347 | THIS_MODULE); | 365 | THIS_MODULE); |
| 348 | if (IS_ERR(ldata->rtc)) { | 366 | if (IS_ERR(ldata->rtc)) { |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 120955c66410..8334dadc681d 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
| @@ -1672,7 +1672,8 @@ static void qeth_configure_blkt_default(struct qeth_card *card, char *prcd) | |||
| 1672 | { | 1672 | { |
| 1673 | QETH_DBF_TEXT(SETUP, 2, "cfgblkt"); | 1673 | QETH_DBF_TEXT(SETUP, 2, "cfgblkt"); |
| 1674 | 1674 | ||
| 1675 | if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && prcd[76] == 0xF5) { | 1675 | if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && |
| 1676 | (prcd[76] == 0xF5 || prcd[76] == 0xF6)) { | ||
| 1676 | card->info.blkt.time_total = 250; | 1677 | card->info.blkt.time_total = 250; |
| 1677 | card->info.blkt.inter_packet = 5; | 1678 | card->info.blkt.inter_packet = 5; |
| 1678 | card->info.blkt.inter_packet_jumbo = 15; | 1679 | card->info.blkt.inter_packet_jumbo = 15; |
| @@ -4540,7 +4541,8 @@ static void qeth_determine_capabilities(struct qeth_card *card) | |||
| 4540 | goto out_offline; | 4541 | goto out_offline; |
| 4541 | } | 4542 | } |
| 4542 | qeth_configure_unitaddr(card, prcd); | 4543 | qeth_configure_unitaddr(card, prcd); |
| 4543 | qeth_configure_blkt_default(card, prcd); | 4544 | if (ddev_offline) |
| 4545 | qeth_configure_blkt_default(card, prcd); | ||
| 4544 | kfree(prcd); | 4546 | kfree(prcd); |
| 4545 | 4547 | ||
| 4546 | rc = qdio_get_ssqd_desc(ddev, &card->ssqd); | 4548 | rc = qdio_get_ssqd_desc(ddev, &card->ssqd); |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 351dc0b86fab..a3a056a9db67 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
| @@ -218,6 +218,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, | |||
| 218 | 218 | ||
| 219 | if (!shost->shost_gendev.parent) | 219 | if (!shost->shost_gendev.parent) |
| 220 | shost->shost_gendev.parent = dev ? dev : &platform_bus; | 220 | shost->shost_gendev.parent = dev ? dev : &platform_bus; |
| 221 | if (!dma_dev) | ||
| 222 | dma_dev = shost->shost_gendev.parent; | ||
| 223 | |||
| 221 | shost->dma_dev = dma_dev; | 224 | shost->dma_dev = dma_dev; |
| 222 | 225 | ||
| 223 | error = device_add(&shost->shost_gendev); | 226 | error = device_add(&shost->shost_gendev); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index e002cd466e9a..467dc38246f9 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
| @@ -4549,8 +4549,12 @@ static int ipr_ata_slave_alloc(struct scsi_device *sdev) | |||
| 4549 | ENTER; | 4549 | ENTER; |
| 4550 | if (sdev->sdev_target) | 4550 | if (sdev->sdev_target) |
| 4551 | sata_port = sdev->sdev_target->hostdata; | 4551 | sata_port = sdev->sdev_target->hostdata; |
| 4552 | if (sata_port) | 4552 | if (sata_port) { |
| 4553 | rc = ata_sas_port_init(sata_port->ap); | 4553 | rc = ata_sas_port_init(sata_port->ap); |
| 4554 | if (rc == 0) | ||
| 4555 | rc = ata_sas_sync_probe(sata_port->ap); | ||
| 4556 | } | ||
| 4557 | |||
| 4554 | if (rc) | 4558 | if (rc) |
| 4555 | ipr_slave_destroy(sdev); | 4559 | ipr_slave_destroy(sdev); |
| 4556 | 4560 | ||
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index ef9560dff295..cc83b66d45b7 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
| @@ -1742,17 +1742,19 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
| 1742 | 1742 | ||
| 1743 | mfs = ntohs(flp->fl_csp.sp_bb_data) & | 1743 | mfs = ntohs(flp->fl_csp.sp_bb_data) & |
| 1744 | FC_SP_BB_DATA_MASK; | 1744 | FC_SP_BB_DATA_MASK; |
| 1745 | if (mfs >= FC_SP_MIN_MAX_PAYLOAD && | 1745 | |
| 1746 | mfs <= lport->mfs) { | 1746 | if (mfs < FC_SP_MIN_MAX_PAYLOAD || mfs > FC_SP_MAX_MAX_PAYLOAD) { |
| 1747 | lport->mfs = mfs; | ||
| 1748 | fc_host_maxframe_size(lport->host) = mfs; | ||
| 1749 | } else { | ||
| 1750 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " | 1747 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " |
| 1751 | "lport->mfs:%hu\n", mfs, lport->mfs); | 1748 | "lport->mfs:%hu\n", mfs, lport->mfs); |
| 1752 | fc_lport_error(lport, fp); | 1749 | fc_lport_error(lport, fp); |
| 1753 | goto err; | 1750 | goto err; |
| 1754 | } | 1751 | } |
| 1755 | 1752 | ||
| 1753 | if (mfs <= lport->mfs) { | ||
| 1754 | lport->mfs = mfs; | ||
| 1755 | fc_host_maxframe_size(lport->host) = mfs; | ||
| 1756 | } | ||
| 1757 | |||
| 1756 | csp_flags = ntohs(flp->fl_csp.sp_features); | 1758 | csp_flags = ntohs(flp->fl_csp.sp_features); |
| 1757 | r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); | 1759 | r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); |
| 1758 | e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); | 1760 | e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index bc0cecc6ad62..441d88ad99a7 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
| @@ -546,11 +546,12 @@ static struct ata_port_info sata_port_info = { | |||
| 546 | .port_ops = &sas_sata_ops | 546 | .port_ops = &sas_sata_ops |
| 547 | }; | 547 | }; |
| 548 | 548 | ||
| 549 | int sas_ata_init_host_and_port(struct domain_device *found_dev) | 549 | int sas_ata_init(struct domain_device *found_dev) |
| 550 | { | 550 | { |
| 551 | struct sas_ha_struct *ha = found_dev->port->ha; | 551 | struct sas_ha_struct *ha = found_dev->port->ha; |
| 552 | struct Scsi_Host *shost = ha->core.shost; | 552 | struct Scsi_Host *shost = ha->core.shost; |
| 553 | struct ata_port *ap; | 553 | struct ata_port *ap; |
| 554 | int rc; | ||
| 554 | 555 | ||
| 555 | ata_host_init(&found_dev->sata_dev.ata_host, | 556 | ata_host_init(&found_dev->sata_dev.ata_host, |
| 556 | ha->dev, | 557 | ha->dev, |
| @@ -567,8 +568,11 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev) | |||
| 567 | ap->private_data = found_dev; | 568 | ap->private_data = found_dev; |
| 568 | ap->cbl = ATA_CBL_SATA; | 569 | ap->cbl = ATA_CBL_SATA; |
| 569 | ap->scsi_host = shost; | 570 | ap->scsi_host = shost; |
| 570 | /* publish initialized ata port */ | 571 | rc = ata_sas_port_init(ap); |
| 571 | smp_wmb(); | 572 | if (rc) { |
| 573 | ata_sas_port_destroy(ap); | ||
| 574 | return rc; | ||
| 575 | } | ||
| 572 | found_dev->sata_dev.ap = ap; | 576 | found_dev->sata_dev.ap = ap; |
| 573 | 577 | ||
| 574 | return 0; | 578 | return 0; |
| @@ -648,18 +652,13 @@ static void sas_get_ata_command_set(struct domain_device *dev) | |||
| 648 | void sas_probe_sata(struct asd_sas_port *port) | 652 | void sas_probe_sata(struct asd_sas_port *port) |
| 649 | { | 653 | { |
| 650 | struct domain_device *dev, *n; | 654 | struct domain_device *dev, *n; |
| 651 | int err; | ||
| 652 | 655 | ||
| 653 | mutex_lock(&port->ha->disco_mutex); | 656 | mutex_lock(&port->ha->disco_mutex); |
| 654 | list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node) { | 657 | list_for_each_entry(dev, &port->disco_list, disco_list_node) { |
| 655 | if (!dev_is_sata(dev)) | 658 | if (!dev_is_sata(dev)) |
| 656 | continue; | 659 | continue; |
| 657 | 660 | ||
| 658 | err = sas_ata_init_host_and_port(dev); | 661 | ata_sas_async_probe(dev->sata_dev.ap); |
| 659 | if (err) | ||
| 660 | sas_fail_probe(dev, __func__, err); | ||
| 661 | else | ||
| 662 | ata_sas_async_port_init(dev->sata_dev.ap); | ||
| 663 | } | 662 | } |
| 664 | mutex_unlock(&port->ha->disco_mutex); | 663 | mutex_unlock(&port->ha->disco_mutex); |
| 665 | 664 | ||
| @@ -718,18 +717,6 @@ static void async_sas_ata_eh(void *data, async_cookie_t cookie) | |||
| 718 | sas_put_device(dev); | 717 | sas_put_device(dev); |
| 719 | } | 718 | } |
| 720 | 719 | ||
| 721 | static bool sas_ata_dev_eh_valid(struct domain_device *dev) | ||
| 722 | { | ||
| 723 | struct ata_port *ap; | ||
| 724 | |||
| 725 | if (!dev_is_sata(dev)) | ||
| 726 | return false; | ||
| 727 | ap = dev->sata_dev.ap; | ||
| 728 | /* consume fully initialized ata ports */ | ||
| 729 | smp_rmb(); | ||
| 730 | return !!ap; | ||
| 731 | } | ||
| 732 | |||
| 733 | void sas_ata_strategy_handler(struct Scsi_Host *shost) | 720 | void sas_ata_strategy_handler(struct Scsi_Host *shost) |
| 734 | { | 721 | { |
| 735 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | 722 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); |
| @@ -753,7 +740,7 @@ void sas_ata_strategy_handler(struct Scsi_Host *shost) | |||
| 753 | 740 | ||
| 754 | spin_lock(&port->dev_list_lock); | 741 | spin_lock(&port->dev_list_lock); |
| 755 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { | 742 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { |
| 756 | if (!sas_ata_dev_eh_valid(dev)) | 743 | if (!dev_is_sata(dev)) |
| 757 | continue; | 744 | continue; |
| 758 | async_schedule_domain(async_sas_ata_eh, dev, &async); | 745 | async_schedule_domain(async_sas_ata_eh, dev, &async); |
| 759 | } | 746 | } |
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index 364679675602..629a0865b130 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c | |||
| @@ -72,6 +72,7 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 72 | struct asd_sas_phy *phy; | 72 | struct asd_sas_phy *phy; |
| 73 | struct sas_rphy *rphy; | 73 | struct sas_rphy *rphy; |
| 74 | struct domain_device *dev; | 74 | struct domain_device *dev; |
| 75 | int rc = -ENODEV; | ||
| 75 | 76 | ||
| 76 | dev = sas_alloc_device(); | 77 | dev = sas_alloc_device(); |
| 77 | if (!dev) | 78 | if (!dev) |
| @@ -110,9 +111,16 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 110 | 111 | ||
| 111 | sas_init_dev(dev); | 112 | sas_init_dev(dev); |
| 112 | 113 | ||
| 114 | dev->port = port; | ||
| 113 | switch (dev->dev_type) { | 115 | switch (dev->dev_type) { |
| 114 | case SAS_END_DEV: | ||
| 115 | case SATA_DEV: | 116 | case SATA_DEV: |
| 117 | rc = sas_ata_init(dev); | ||
| 118 | if (rc) { | ||
| 119 | rphy = NULL; | ||
| 120 | break; | ||
| 121 | } | ||
| 122 | /* fall through */ | ||
| 123 | case SAS_END_DEV: | ||
| 116 | rphy = sas_end_device_alloc(port->port); | 124 | rphy = sas_end_device_alloc(port->port); |
| 117 | break; | 125 | break; |
| 118 | case EDGE_DEV: | 126 | case EDGE_DEV: |
| @@ -131,19 +139,14 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 131 | 139 | ||
| 132 | if (!rphy) { | 140 | if (!rphy) { |
| 133 | sas_put_device(dev); | 141 | sas_put_device(dev); |
| 134 | return -ENODEV; | 142 | return rc; |
| 135 | } | 143 | } |
| 136 | 144 | ||
| 137 | spin_lock_irq(&port->phy_list_lock); | ||
| 138 | list_for_each_entry(phy, &port->phy_list, port_phy_el) | ||
| 139 | sas_phy_set_target(phy, dev); | ||
| 140 | spin_unlock_irq(&port->phy_list_lock); | ||
| 141 | rphy->identify.phy_identifier = phy->phy->identify.phy_identifier; | 145 | rphy->identify.phy_identifier = phy->phy->identify.phy_identifier; |
| 142 | memcpy(dev->sas_addr, port->attached_sas_addr, SAS_ADDR_SIZE); | 146 | memcpy(dev->sas_addr, port->attached_sas_addr, SAS_ADDR_SIZE); |
| 143 | sas_fill_in_rphy(dev, rphy); | 147 | sas_fill_in_rphy(dev, rphy); |
| 144 | sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr); | 148 | sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr); |
| 145 | port->port_dev = dev; | 149 | port->port_dev = dev; |
| 146 | dev->port = port; | ||
| 147 | dev->linkrate = port->linkrate; | 150 | dev->linkrate = port->linkrate; |
| 148 | dev->min_linkrate = port->linkrate; | 151 | dev->min_linkrate = port->linkrate; |
| 149 | dev->max_linkrate = port->linkrate; | 152 | dev->max_linkrate = port->linkrate; |
| @@ -155,6 +158,7 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 155 | sas_device_set_phy(dev, port->port); | 158 | sas_device_set_phy(dev, port->port); |
| 156 | 159 | ||
| 157 | dev->rphy = rphy; | 160 | dev->rphy = rphy; |
| 161 | get_device(&dev->rphy->dev); | ||
| 158 | 162 | ||
| 159 | if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) | 163 | if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) |
| 160 | list_add_tail(&dev->disco_list_node, &port->disco_list); | 164 | list_add_tail(&dev->disco_list_node, &port->disco_list); |
| @@ -164,6 +168,11 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 164 | spin_unlock_irq(&port->dev_list_lock); | 168 | spin_unlock_irq(&port->dev_list_lock); |
| 165 | } | 169 | } |
| 166 | 170 | ||
| 171 | spin_lock_irq(&port->phy_list_lock); | ||
| 172 | list_for_each_entry(phy, &port->phy_list, port_phy_el) | ||
| 173 | sas_phy_set_target(phy, dev); | ||
| 174 | spin_unlock_irq(&port->phy_list_lock); | ||
| 175 | |||
| 167 | return 0; | 176 | return 0; |
| 168 | } | 177 | } |
| 169 | 178 | ||
| @@ -205,8 +214,7 @@ void sas_notify_lldd_dev_gone(struct domain_device *dev) | |||
| 205 | static void sas_probe_devices(struct work_struct *work) | 214 | static void sas_probe_devices(struct work_struct *work) |
| 206 | { | 215 | { |
| 207 | struct domain_device *dev, *n; | 216 | struct domain_device *dev, *n; |
| 208 | struct sas_discovery_event *ev = | 217 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
| 209 | container_of(work, struct sas_discovery_event, work); | ||
| 210 | struct asd_sas_port *port = ev->port; | 218 | struct asd_sas_port *port = ev->port; |
| 211 | 219 | ||
| 212 | clear_bit(DISCE_PROBE, &port->disc.pending); | 220 | clear_bit(DISCE_PROBE, &port->disc.pending); |
| @@ -255,6 +263,9 @@ void sas_free_device(struct kref *kref) | |||
| 255 | { | 263 | { |
| 256 | struct domain_device *dev = container_of(kref, typeof(*dev), kref); | 264 | struct domain_device *dev = container_of(kref, typeof(*dev), kref); |
| 257 | 265 | ||
| 266 | put_device(&dev->rphy->dev); | ||
| 267 | dev->rphy = NULL; | ||
| 268 | |||
| 258 | if (dev->parent) | 269 | if (dev->parent) |
| 259 | sas_put_device(dev->parent); | 270 | sas_put_device(dev->parent); |
| 260 | 271 | ||
| @@ -291,8 +302,7 @@ static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_d | |||
| 291 | static void sas_destruct_devices(struct work_struct *work) | 302 | static void sas_destruct_devices(struct work_struct *work) |
| 292 | { | 303 | { |
| 293 | struct domain_device *dev, *n; | 304 | struct domain_device *dev, *n; |
| 294 | struct sas_discovery_event *ev = | 305 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
| 295 | container_of(work, struct sas_discovery_event, work); | ||
| 296 | struct asd_sas_port *port = ev->port; | 306 | struct asd_sas_port *port = ev->port; |
| 297 | 307 | ||
| 298 | clear_bit(DISCE_DESTRUCT, &port->disc.pending); | 308 | clear_bit(DISCE_DESTRUCT, &port->disc.pending); |
| @@ -302,7 +312,6 @@ static void sas_destruct_devices(struct work_struct *work) | |||
| 302 | 312 | ||
| 303 | sas_remove_children(&dev->rphy->dev); | 313 | sas_remove_children(&dev->rphy->dev); |
| 304 | sas_rphy_delete(dev->rphy); | 314 | sas_rphy_delete(dev->rphy); |
| 305 | dev->rphy = NULL; | ||
| 306 | sas_unregister_common_dev(port, dev); | 315 | sas_unregister_common_dev(port, dev); |
| 307 | } | 316 | } |
| 308 | } | 317 | } |
| @@ -314,11 +323,11 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev) | |||
| 314 | /* this rphy never saw sas_rphy_add */ | 323 | /* this rphy never saw sas_rphy_add */ |
| 315 | list_del_init(&dev->disco_list_node); | 324 | list_del_init(&dev->disco_list_node); |
| 316 | sas_rphy_free(dev->rphy); | 325 | sas_rphy_free(dev->rphy); |
| 317 | dev->rphy = NULL; | ||
| 318 | sas_unregister_common_dev(port, dev); | 326 | sas_unregister_common_dev(port, dev); |
| 327 | return; | ||
| 319 | } | 328 | } |
| 320 | 329 | ||
| 321 | if (dev->rphy && !test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) { | 330 | if (!test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) { |
| 322 | sas_rphy_unlink(dev->rphy); | 331 | sas_rphy_unlink(dev->rphy); |
| 323 | list_move_tail(&dev->disco_list_node, &port->destroy_list); | 332 | list_move_tail(&dev->disco_list_node, &port->destroy_list); |
| 324 | sas_discover_event(dev->port, DISCE_DESTRUCT); | 333 | sas_discover_event(dev->port, DISCE_DESTRUCT); |
| @@ -377,8 +386,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
| 377 | { | 386 | { |
| 378 | struct domain_device *dev; | 387 | struct domain_device *dev; |
| 379 | int error = 0; | 388 | int error = 0; |
| 380 | struct sas_discovery_event *ev = | 389 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
| 381 | container_of(work, struct sas_discovery_event, work); | ||
| 382 | struct asd_sas_port *port = ev->port; | 390 | struct asd_sas_port *port = ev->port; |
| 383 | 391 | ||
| 384 | clear_bit(DISCE_DISCOVER_DOMAIN, &port->disc.pending); | 392 | clear_bit(DISCE_DISCOVER_DOMAIN, &port->disc.pending); |
| @@ -419,8 +427,6 @@ static void sas_discover_domain(struct work_struct *work) | |||
| 419 | 427 | ||
| 420 | if (error) { | 428 | if (error) { |
| 421 | sas_rphy_free(dev->rphy); | 429 | sas_rphy_free(dev->rphy); |
| 422 | dev->rphy = NULL; | ||
| 423 | |||
| 424 | list_del_init(&dev->disco_list_node); | 430 | list_del_init(&dev->disco_list_node); |
| 425 | spin_lock_irq(&port->dev_list_lock); | 431 | spin_lock_irq(&port->dev_list_lock); |
| 426 | list_del_init(&dev->dev_list_node); | 432 | list_del_init(&dev->dev_list_node); |
| @@ -437,8 +443,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
| 437 | static void sas_revalidate_domain(struct work_struct *work) | 443 | static void sas_revalidate_domain(struct work_struct *work) |
| 438 | { | 444 | { |
| 439 | int res = 0; | 445 | int res = 0; |
| 440 | struct sas_discovery_event *ev = | 446 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
| 441 | container_of(work, struct sas_discovery_event, work); | ||
| 442 | struct asd_sas_port *port = ev->port; | 447 | struct asd_sas_port *port = ev->port; |
| 443 | struct sas_ha_struct *ha = port->ha; | 448 | struct sas_ha_struct *ha = port->ha; |
| 444 | 449 | ||
| @@ -466,21 +471,25 @@ static void sas_revalidate_domain(struct work_struct *work) | |||
| 466 | 471 | ||
| 467 | /* ---------- Events ---------- */ | 472 | /* ---------- Events ---------- */ |
| 468 | 473 | ||
| 469 | static void sas_chain_work(struct sas_ha_struct *ha, struct work_struct *work) | 474 | static void sas_chain_work(struct sas_ha_struct *ha, struct sas_work *sw) |
| 470 | { | 475 | { |
| 471 | /* chained work is not subject to SA_HA_DRAINING or SAS_HA_REGISTERED */ | 476 | /* chained work is not subject to SA_HA_DRAINING or |
| 472 | scsi_queue_work(ha->core.shost, work); | 477 | * SAS_HA_REGISTERED, because it is either submitted in the |
| 478 | * workqueue, or known to be submitted from a context that is | ||
| 479 | * not racing against draining | ||
| 480 | */ | ||
| 481 | scsi_queue_work(ha->core.shost, &sw->work); | ||
| 473 | } | 482 | } |
| 474 | 483 | ||
| 475 | static void sas_chain_event(int event, unsigned long *pending, | 484 | static void sas_chain_event(int event, unsigned long *pending, |
| 476 | struct work_struct *work, | 485 | struct sas_work *sw, |
| 477 | struct sas_ha_struct *ha) | 486 | struct sas_ha_struct *ha) |
| 478 | { | 487 | { |
| 479 | if (!test_and_set_bit(event, pending)) { | 488 | if (!test_and_set_bit(event, pending)) { |
| 480 | unsigned long flags; | 489 | unsigned long flags; |
| 481 | 490 | ||
| 482 | spin_lock_irqsave(&ha->state_lock, flags); | 491 | spin_lock_irqsave(&ha->state_lock, flags); |
| 483 | sas_chain_work(ha, work); | 492 | sas_chain_work(ha, sw); |
| 484 | spin_unlock_irqrestore(&ha->state_lock, flags); | 493 | spin_unlock_irqrestore(&ha->state_lock, flags); |
| 485 | } | 494 | } |
| 486 | } | 495 | } |
| @@ -519,7 +528,7 @@ void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *port) | |||
| 519 | 528 | ||
| 520 | disc->pending = 0; | 529 | disc->pending = 0; |
| 521 | for (i = 0; i < DISC_NUM_EVENTS; i++) { | 530 | for (i = 0; i < DISC_NUM_EVENTS; i++) { |
| 522 | INIT_WORK(&disc->disc_work[i].work, sas_event_fns[i]); | 531 | INIT_SAS_WORK(&disc->disc_work[i].work, sas_event_fns[i]); |
| 523 | disc->disc_work[i].port = port; | 532 | disc->disc_work[i].port = port; |
| 524 | } | 533 | } |
| 525 | } | 534 | } |
diff --git a/drivers/scsi/libsas/sas_event.c b/drivers/scsi/libsas/sas_event.c index 16639bbae629..4e4292d210c1 100644 --- a/drivers/scsi/libsas/sas_event.c +++ b/drivers/scsi/libsas/sas_event.c | |||
| @@ -27,19 +27,21 @@ | |||
| 27 | #include "sas_internal.h" | 27 | #include "sas_internal.h" |
| 28 | #include "sas_dump.h" | 28 | #include "sas_dump.h" |
| 29 | 29 | ||
| 30 | void sas_queue_work(struct sas_ha_struct *ha, struct work_struct *work) | 30 | void sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw) |
| 31 | { | 31 | { |
| 32 | if (!test_bit(SAS_HA_REGISTERED, &ha->state)) | 32 | if (!test_bit(SAS_HA_REGISTERED, &ha->state)) |
| 33 | return; | 33 | return; |
| 34 | 34 | ||
| 35 | if (test_bit(SAS_HA_DRAINING, &ha->state)) | 35 | if (test_bit(SAS_HA_DRAINING, &ha->state)) { |
| 36 | list_add(&work->entry, &ha->defer_q); | 36 | /* add it to the defer list, if not already pending */ |
| 37 | else | 37 | if (list_empty(&sw->drain_node)) |
| 38 | scsi_queue_work(ha->core.shost, work); | 38 | list_add(&sw->drain_node, &ha->defer_q); |
| 39 | } else | ||
| 40 | scsi_queue_work(ha->core.shost, &sw->work); | ||
| 39 | } | 41 | } |
| 40 | 42 | ||
| 41 | static void sas_queue_event(int event, unsigned long *pending, | 43 | static void sas_queue_event(int event, unsigned long *pending, |
| 42 | struct work_struct *work, | 44 | struct sas_work *work, |
| 43 | struct sas_ha_struct *ha) | 45 | struct sas_ha_struct *ha) |
| 44 | { | 46 | { |
| 45 | if (!test_and_set_bit(event, pending)) { | 47 | if (!test_and_set_bit(event, pending)) { |
| @@ -55,7 +57,7 @@ static void sas_queue_event(int event, unsigned long *pending, | |||
| 55 | void __sas_drain_work(struct sas_ha_struct *ha) | 57 | void __sas_drain_work(struct sas_ha_struct *ha) |
| 56 | { | 58 | { |
| 57 | struct workqueue_struct *wq = ha->core.shost->work_q; | 59 | struct workqueue_struct *wq = ha->core.shost->work_q; |
| 58 | struct work_struct *w, *_w; | 60 | struct sas_work *sw, *_sw; |
| 59 | 61 | ||
| 60 | set_bit(SAS_HA_DRAINING, &ha->state); | 62 | set_bit(SAS_HA_DRAINING, &ha->state); |
| 61 | /* flush submitters */ | 63 | /* flush submitters */ |
| @@ -66,9 +68,9 @@ void __sas_drain_work(struct sas_ha_struct *ha) | |||
| 66 | 68 | ||
| 67 | spin_lock_irq(&ha->state_lock); | 69 | spin_lock_irq(&ha->state_lock); |
| 68 | clear_bit(SAS_HA_DRAINING, &ha->state); | 70 | clear_bit(SAS_HA_DRAINING, &ha->state); |
| 69 | list_for_each_entry_safe(w, _w, &ha->defer_q, entry) { | 71 | list_for_each_entry_safe(sw, _sw, &ha->defer_q, drain_node) { |
| 70 | list_del_init(&w->entry); | 72 | list_del_init(&sw->drain_node); |
| 71 | sas_queue_work(ha, w); | 73 | sas_queue_work(ha, sw); |
| 72 | } | 74 | } |
| 73 | spin_unlock_irq(&ha->state_lock); | 75 | spin_unlock_irq(&ha->state_lock); |
| 74 | } | 76 | } |
| @@ -151,7 +153,7 @@ int sas_init_events(struct sas_ha_struct *sas_ha) | |||
| 151 | int i; | 153 | int i; |
| 152 | 154 | ||
| 153 | for (i = 0; i < HA_NUM_EVENTS; i++) { | 155 | for (i = 0; i < HA_NUM_EVENTS; i++) { |
| 154 | INIT_WORK(&sas_ha->ha_events[i].work, sas_ha_event_fns[i]); | 156 | INIT_SAS_WORK(&sas_ha->ha_events[i].work, sas_ha_event_fns[i]); |
| 155 | sas_ha->ha_events[i].ha = sas_ha; | 157 | sas_ha->ha_events[i].ha = sas_ha; |
| 156 | } | 158 | } |
| 157 | 159 | ||
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 05acd9e35fc4..caa0525d2523 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
| @@ -202,6 +202,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 202 | u8 sas_addr[SAS_ADDR_SIZE]; | 202 | u8 sas_addr[SAS_ADDR_SIZE]; |
| 203 | struct smp_resp *resp = rsp; | 203 | struct smp_resp *resp = rsp; |
| 204 | struct discover_resp *dr = &resp->disc; | 204 | struct discover_resp *dr = &resp->disc; |
| 205 | struct sas_ha_struct *ha = dev->port->ha; | ||
| 205 | struct expander_device *ex = &dev->ex_dev; | 206 | struct expander_device *ex = &dev->ex_dev; |
| 206 | struct ex_phy *phy = &ex->ex_phy[phy_id]; | 207 | struct ex_phy *phy = &ex->ex_phy[phy_id]; |
| 207 | struct sas_rphy *rphy = dev->rphy; | 208 | struct sas_rphy *rphy = dev->rphy; |
| @@ -209,6 +210,8 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 209 | char *type; | 210 | char *type; |
| 210 | 211 | ||
| 211 | if (new_phy) { | 212 | if (new_phy) { |
| 213 | if (WARN_ON_ONCE(test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state))) | ||
| 214 | return; | ||
| 212 | phy->phy = sas_phy_alloc(&rphy->dev, phy_id); | 215 | phy->phy = sas_phy_alloc(&rphy->dev, phy_id); |
| 213 | 216 | ||
| 214 | /* FIXME: error_handling */ | 217 | /* FIXME: error_handling */ |
| @@ -233,6 +236,8 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 233 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); | 236 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); |
| 234 | 237 | ||
| 235 | phy->attached_dev_type = to_dev_type(dr); | 238 | phy->attached_dev_type = to_dev_type(dr); |
| 239 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) | ||
| 240 | goto out; | ||
| 236 | phy->phy_id = phy_id; | 241 | phy->phy_id = phy_id; |
| 237 | phy->linkrate = dr->linkrate; | 242 | phy->linkrate = dr->linkrate; |
| 238 | phy->attached_sata_host = dr->attached_sata_host; | 243 | phy->attached_sata_host = dr->attached_sata_host; |
| @@ -240,7 +245,14 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 240 | phy->attached_sata_ps = dr->attached_sata_ps; | 245 | phy->attached_sata_ps = dr->attached_sata_ps; |
| 241 | phy->attached_iproto = dr->iproto << 1; | 246 | phy->attached_iproto = dr->iproto << 1; |
| 242 | phy->attached_tproto = dr->tproto << 1; | 247 | phy->attached_tproto = dr->tproto << 1; |
| 243 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | 248 | /* help some expanders that fail to zero sas_address in the 'no |
| 249 | * device' case | ||
| 250 | */ | ||
| 251 | if (phy->attached_dev_type == NO_DEVICE || | ||
| 252 | phy->linkrate < SAS_LINK_RATE_1_5_GBPS) | ||
| 253 | memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | ||
| 254 | else | ||
| 255 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | ||
| 244 | phy->attached_phy_id = dr->attached_phy_id; | 256 | phy->attached_phy_id = dr->attached_phy_id; |
| 245 | phy->phy_change_count = dr->change_count; | 257 | phy->phy_change_count = dr->change_count; |
| 246 | phy->routing_attr = dr->routing_attr; | 258 | phy->routing_attr = dr->routing_attr; |
| @@ -266,6 +278,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 266 | return; | 278 | return; |
| 267 | } | 279 | } |
| 268 | 280 | ||
| 281 | out: | ||
| 269 | switch (phy->attached_dev_type) { | 282 | switch (phy->attached_dev_type) { |
| 270 | case SATA_PENDING: | 283 | case SATA_PENDING: |
| 271 | type = "stp pending"; | 284 | type = "stp pending"; |
| @@ -304,7 +317,15 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 304 | else | 317 | else |
| 305 | return; | 318 | return; |
| 306 | 319 | ||
| 307 | SAS_DPRINTK("ex %016llx phy%02d:%c:%X attached: %016llx (%s)\n", | 320 | /* if the attached device type changed and ata_eh is active, |
| 321 | * make sure we run revalidation when eh completes (see: | ||
| 322 | * sas_enable_revalidation) | ||
| 323 | */ | ||
| 324 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) | ||
| 325 | set_bit(DISCE_REVALIDATE_DOMAIN, &dev->port->disc.pending); | ||
| 326 | |||
| 327 | SAS_DPRINTK("%sex %016llx phy%02d:%c:%X attached: %016llx (%s)\n", | ||
| 328 | test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state) ? "ata: " : "", | ||
| 308 | SAS_ADDR(dev->sas_addr), phy->phy_id, | 329 | SAS_ADDR(dev->sas_addr), phy->phy_id, |
| 309 | sas_route_char(dev, phy), phy->linkrate, | 330 | sas_route_char(dev, phy), phy->linkrate, |
| 310 | SAS_ADDR(phy->attached_sas_addr), type); | 331 | SAS_ADDR(phy->attached_sas_addr), type); |
| @@ -776,13 +797,16 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
| 776 | if (res) | 797 | if (res) |
| 777 | goto out_free; | 798 | goto out_free; |
| 778 | 799 | ||
| 800 | sas_init_dev(child); | ||
| 801 | res = sas_ata_init(child); | ||
| 802 | if (res) | ||
| 803 | goto out_free; | ||
| 779 | rphy = sas_end_device_alloc(phy->port); | 804 | rphy = sas_end_device_alloc(phy->port); |
| 780 | if (unlikely(!rphy)) | 805 | if (!rphy) |
| 781 | goto out_free; | 806 | goto out_free; |
| 782 | 807 | ||
| 783 | sas_init_dev(child); | ||
| 784 | |||
| 785 | child->rphy = rphy; | 808 | child->rphy = rphy; |
| 809 | get_device(&rphy->dev); | ||
| 786 | 810 | ||
| 787 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 811 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
| 788 | 812 | ||
| @@ -806,6 +830,7 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
| 806 | sas_init_dev(child); | 830 | sas_init_dev(child); |
| 807 | 831 | ||
| 808 | child->rphy = rphy; | 832 | child->rphy = rphy; |
| 833 | get_device(&rphy->dev); | ||
| 809 | sas_fill_in_rphy(child, rphy); | 834 | sas_fill_in_rphy(child, rphy); |
| 810 | 835 | ||
| 811 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 836 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
| @@ -830,8 +855,6 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
| 830 | 855 | ||
| 831 | out_list_del: | 856 | out_list_del: |
| 832 | sas_rphy_free(child->rphy); | 857 | sas_rphy_free(child->rphy); |
| 833 | child->rphy = NULL; | ||
| 834 | |||
| 835 | list_del(&child->disco_list_node); | 858 | list_del(&child->disco_list_node); |
| 836 | spin_lock_irq(&parent->port->dev_list_lock); | 859 | spin_lock_irq(&parent->port->dev_list_lock); |
| 837 | list_del(&child->dev_list_node); | 860 | list_del(&child->dev_list_node); |
| @@ -911,6 +934,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
| 911 | } | 934 | } |
| 912 | port = parent->port; | 935 | port = parent->port; |
| 913 | child->rphy = rphy; | 936 | child->rphy = rphy; |
| 937 | get_device(&rphy->dev); | ||
| 914 | edev = rphy_to_expander_device(rphy); | 938 | edev = rphy_to_expander_device(rphy); |
| 915 | child->dev_type = phy->attached_dev_type; | 939 | child->dev_type = phy->attached_dev_type; |
| 916 | kref_get(&parent->kref); | 940 | kref_get(&parent->kref); |
| @@ -934,6 +958,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
| 934 | 958 | ||
| 935 | res = sas_discover_expander(child); | 959 | res = sas_discover_expander(child); |
| 936 | if (res) { | 960 | if (res) { |
| 961 | sas_rphy_delete(rphy); | ||
| 937 | spin_lock_irq(&parent->port->dev_list_lock); | 962 | spin_lock_irq(&parent->port->dev_list_lock); |
| 938 | list_del(&child->dev_list_node); | 963 | list_del(&child->dev_list_node); |
| 939 | spin_unlock_irq(&parent->port->dev_list_lock); | 964 | spin_unlock_irq(&parent->port->dev_list_lock); |
| @@ -1718,9 +1743,17 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | |||
| 1718 | int phy_change_count = 0; | 1743 | int phy_change_count = 0; |
| 1719 | 1744 | ||
| 1720 | res = sas_get_phy_change_count(dev, i, &phy_change_count); | 1745 | res = sas_get_phy_change_count(dev, i, &phy_change_count); |
| 1721 | if (res) | 1746 | switch (res) { |
| 1722 | goto out; | 1747 | case SMP_RESP_PHY_VACANT: |
| 1723 | else if (phy_change_count != ex->ex_phy[i].phy_change_count) { | 1748 | case SMP_RESP_NO_PHY: |
| 1749 | continue; | ||
| 1750 | case SMP_RESP_FUNC_ACC: | ||
| 1751 | break; | ||
| 1752 | default: | ||
| 1753 | return res; | ||
| 1754 | } | ||
| 1755 | |||
| 1756 | if (phy_change_count != ex->ex_phy[i].phy_change_count) { | ||
| 1724 | if (update) | 1757 | if (update) |
| 1725 | ex->ex_phy[i].phy_change_count = | 1758 | ex->ex_phy[i].phy_change_count = |
| 1726 | phy_change_count; | 1759 | phy_change_count; |
| @@ -1728,8 +1761,7 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | |||
| 1728 | return 0; | 1761 | return 0; |
| 1729 | } | 1762 | } |
| 1730 | } | 1763 | } |
| 1731 | out: | 1764 | return 0; |
| 1732 | return res; | ||
| 1733 | } | 1765 | } |
| 1734 | 1766 | ||
| 1735 | static int sas_get_ex_change_count(struct domain_device *dev, int *ecc) | 1767 | static int sas_get_ex_change_count(struct domain_device *dev, int *ecc) |
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index 120bff64be30..10cb5ae30977 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c | |||
| @@ -94,8 +94,7 @@ void sas_hash_addr(u8 *hashed, const u8 *sas_addr) | |||
| 94 | 94 | ||
| 95 | void sas_hae_reset(struct work_struct *work) | 95 | void sas_hae_reset(struct work_struct *work) |
| 96 | { | 96 | { |
| 97 | struct sas_ha_event *ev = | 97 | struct sas_ha_event *ev = to_sas_ha_event(work); |
| 98 | container_of(work, struct sas_ha_event, work); | ||
| 99 | struct sas_ha_struct *ha = ev->ha; | 98 | struct sas_ha_struct *ha = ev->ha; |
| 100 | 99 | ||
| 101 | clear_bit(HAE_RESET, &ha->pending); | 100 | clear_bit(HAE_RESET, &ha->pending); |
| @@ -369,14 +368,14 @@ static void sas_phy_release(struct sas_phy *phy) | |||
| 369 | 368 | ||
| 370 | static void phy_reset_work(struct work_struct *work) | 369 | static void phy_reset_work(struct work_struct *work) |
| 371 | { | 370 | { |
| 372 | struct sas_phy_data *d = container_of(work, typeof(*d), reset_work); | 371 | struct sas_phy_data *d = container_of(work, typeof(*d), reset_work.work); |
| 373 | 372 | ||
| 374 | d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset); | 373 | d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset); |
| 375 | } | 374 | } |
| 376 | 375 | ||
| 377 | static void phy_enable_work(struct work_struct *work) | 376 | static void phy_enable_work(struct work_struct *work) |
| 378 | { | 377 | { |
| 379 | struct sas_phy_data *d = container_of(work, typeof(*d), enable_work); | 378 | struct sas_phy_data *d = container_of(work, typeof(*d), enable_work.work); |
| 380 | 379 | ||
| 381 | d->enable_result = sas_phy_enable(d->phy, d->enable); | 380 | d->enable_result = sas_phy_enable(d->phy, d->enable); |
| 382 | } | 381 | } |
| @@ -389,8 +388,8 @@ static int sas_phy_setup(struct sas_phy *phy) | |||
| 389 | return -ENOMEM; | 388 | return -ENOMEM; |
| 390 | 389 | ||
| 391 | mutex_init(&d->event_lock); | 390 | mutex_init(&d->event_lock); |
| 392 | INIT_WORK(&d->reset_work, phy_reset_work); | 391 | INIT_SAS_WORK(&d->reset_work, phy_reset_work); |
| 393 | INIT_WORK(&d->enable_work, phy_enable_work); | 392 | INIT_SAS_WORK(&d->enable_work, phy_enable_work); |
| 394 | d->phy = phy; | 393 | d->phy = phy; |
| 395 | phy->hostdata = d; | 394 | phy->hostdata = d; |
| 396 | 395 | ||
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h index f05c63879949..507e4cf12e56 100644 --- a/drivers/scsi/libsas/sas_internal.h +++ b/drivers/scsi/libsas/sas_internal.h | |||
| @@ -45,10 +45,10 @@ struct sas_phy_data { | |||
| 45 | struct mutex event_lock; | 45 | struct mutex event_lock; |
| 46 | int hard_reset; | 46 | int hard_reset; |
| 47 | int reset_result; | 47 | int reset_result; |
| 48 | struct work_struct reset_work; | 48 | struct sas_work reset_work; |
| 49 | int enable; | 49 | int enable; |
| 50 | int enable_result; | 50 | int enable_result; |
| 51 | struct work_struct enable_work; | 51 | struct sas_work enable_work; |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | void sas_scsi_recover_host(struct Scsi_Host *shost); | 54 | void sas_scsi_recover_host(struct Scsi_Host *shost); |
| @@ -80,7 +80,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work); | |||
| 80 | void sas_porte_link_reset_err(struct work_struct *work); | 80 | void sas_porte_link_reset_err(struct work_struct *work); |
| 81 | void sas_porte_timer_event(struct work_struct *work); | 81 | void sas_porte_timer_event(struct work_struct *work); |
| 82 | void sas_porte_hard_reset(struct work_struct *work); | 82 | void sas_porte_hard_reset(struct work_struct *work); |
| 83 | void sas_queue_work(struct sas_ha_struct *ha, struct work_struct *work); | 83 | void sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw); |
| 84 | 84 | ||
| 85 | int sas_notify_lldd_dev_found(struct domain_device *); | 85 | int sas_notify_lldd_dev_found(struct domain_device *); |
| 86 | void sas_notify_lldd_dev_gone(struct domain_device *); | 86 | void sas_notify_lldd_dev_gone(struct domain_device *); |
diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c index dcfd4a9105c5..521422e857ab 100644 --- a/drivers/scsi/libsas/sas_phy.c +++ b/drivers/scsi/libsas/sas_phy.c | |||
| @@ -32,8 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | static void sas_phye_loss_of_signal(struct work_struct *work) | 33 | static void sas_phye_loss_of_signal(struct work_struct *work) |
| 34 | { | 34 | { |
| 35 | struct asd_sas_event *ev = | 35 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 36 | container_of(work, struct asd_sas_event, work); | ||
| 37 | struct asd_sas_phy *phy = ev->phy; | 36 | struct asd_sas_phy *phy = ev->phy; |
| 38 | 37 | ||
| 39 | clear_bit(PHYE_LOSS_OF_SIGNAL, &phy->phy_events_pending); | 38 | clear_bit(PHYE_LOSS_OF_SIGNAL, &phy->phy_events_pending); |
| @@ -43,8 +42,7 @@ static void sas_phye_loss_of_signal(struct work_struct *work) | |||
| 43 | 42 | ||
| 44 | static void sas_phye_oob_done(struct work_struct *work) | 43 | static void sas_phye_oob_done(struct work_struct *work) |
| 45 | { | 44 | { |
| 46 | struct asd_sas_event *ev = | 45 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 47 | container_of(work, struct asd_sas_event, work); | ||
| 48 | struct asd_sas_phy *phy = ev->phy; | 46 | struct asd_sas_phy *phy = ev->phy; |
| 49 | 47 | ||
| 50 | clear_bit(PHYE_OOB_DONE, &phy->phy_events_pending); | 48 | clear_bit(PHYE_OOB_DONE, &phy->phy_events_pending); |
| @@ -53,8 +51,7 @@ static void sas_phye_oob_done(struct work_struct *work) | |||
| 53 | 51 | ||
| 54 | static void sas_phye_oob_error(struct work_struct *work) | 52 | static void sas_phye_oob_error(struct work_struct *work) |
| 55 | { | 53 | { |
| 56 | struct asd_sas_event *ev = | 54 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 57 | container_of(work, struct asd_sas_event, work); | ||
| 58 | struct asd_sas_phy *phy = ev->phy; | 55 | struct asd_sas_phy *phy = ev->phy; |
| 59 | struct sas_ha_struct *sas_ha = phy->ha; | 56 | struct sas_ha_struct *sas_ha = phy->ha; |
| 60 | struct asd_sas_port *port = phy->port; | 57 | struct asd_sas_port *port = phy->port; |
| @@ -85,8 +82,7 @@ static void sas_phye_oob_error(struct work_struct *work) | |||
| 85 | 82 | ||
| 86 | static void sas_phye_spinup_hold(struct work_struct *work) | 83 | static void sas_phye_spinup_hold(struct work_struct *work) |
| 87 | { | 84 | { |
| 88 | struct asd_sas_event *ev = | 85 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 89 | container_of(work, struct asd_sas_event, work); | ||
| 90 | struct asd_sas_phy *phy = ev->phy; | 86 | struct asd_sas_phy *phy = ev->phy; |
| 91 | struct sas_ha_struct *sas_ha = phy->ha; | 87 | struct sas_ha_struct *sas_ha = phy->ha; |
| 92 | struct sas_internal *i = | 88 | struct sas_internal *i = |
| @@ -127,14 +123,12 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
| 127 | phy->error = 0; | 123 | phy->error = 0; |
| 128 | INIT_LIST_HEAD(&phy->port_phy_el); | 124 | INIT_LIST_HEAD(&phy->port_phy_el); |
| 129 | for (k = 0; k < PORT_NUM_EVENTS; k++) { | 125 | for (k = 0; k < PORT_NUM_EVENTS; k++) { |
| 130 | INIT_WORK(&phy->port_events[k].work, | 126 | INIT_SAS_WORK(&phy->port_events[k].work, sas_port_event_fns[k]); |
| 131 | sas_port_event_fns[k]); | ||
| 132 | phy->port_events[k].phy = phy; | 127 | phy->port_events[k].phy = phy; |
| 133 | } | 128 | } |
| 134 | 129 | ||
| 135 | for (k = 0; k < PHY_NUM_EVENTS; k++) { | 130 | for (k = 0; k < PHY_NUM_EVENTS; k++) { |
| 136 | INIT_WORK(&phy->phy_events[k].work, | 131 | INIT_SAS_WORK(&phy->phy_events[k].work, sas_phy_event_fns[k]); |
| 137 | sas_phy_event_fns[k]); | ||
| 138 | phy->phy_events[k].phy = phy; | 132 | phy->phy_events[k].phy = phy; |
| 139 | } | 133 | } |
| 140 | 134 | ||
| @@ -144,8 +138,7 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
| 144 | spin_lock_init(&phy->sas_prim_lock); | 138 | spin_lock_init(&phy->sas_prim_lock); |
| 145 | phy->frame_rcvd_size = 0; | 139 | phy->frame_rcvd_size = 0; |
| 146 | 140 | ||
| 147 | phy->phy = sas_phy_alloc(&sas_ha->core.shost->shost_gendev, | 141 | phy->phy = sas_phy_alloc(&sas_ha->core.shost->shost_gendev, i); |
| 148 | i); | ||
| 149 | if (!phy->phy) | 142 | if (!phy->phy) |
| 150 | return -ENOMEM; | 143 | return -ENOMEM; |
| 151 | 144 | ||
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index eb19c016d500..e884a8c58a0c 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c | |||
| @@ -123,7 +123,7 @@ static void sas_form_port(struct asd_sas_phy *phy) | |||
| 123 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); | 123 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); |
| 124 | 124 | ||
| 125 | if (!port->port) { | 125 | if (!port->port) { |
| 126 | port->port = sas_port_alloc(phy->phy->dev.parent, phy->id); | 126 | port->port = sas_port_alloc(phy->phy->dev.parent, port->id); |
| 127 | BUG_ON(!port->port); | 127 | BUG_ON(!port->port); |
| 128 | sas_port_add(port->port); | 128 | sas_port_add(port->port); |
| 129 | } | 129 | } |
| @@ -208,8 +208,7 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) | |||
| 208 | 208 | ||
| 209 | void sas_porte_bytes_dmaed(struct work_struct *work) | 209 | void sas_porte_bytes_dmaed(struct work_struct *work) |
| 210 | { | 210 | { |
| 211 | struct asd_sas_event *ev = | 211 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 212 | container_of(work, struct asd_sas_event, work); | ||
| 213 | struct asd_sas_phy *phy = ev->phy; | 212 | struct asd_sas_phy *phy = ev->phy; |
| 214 | 213 | ||
| 215 | clear_bit(PORTE_BYTES_DMAED, &phy->port_events_pending); | 214 | clear_bit(PORTE_BYTES_DMAED, &phy->port_events_pending); |
| @@ -219,8 +218,7 @@ void sas_porte_bytes_dmaed(struct work_struct *work) | |||
| 219 | 218 | ||
| 220 | void sas_porte_broadcast_rcvd(struct work_struct *work) | 219 | void sas_porte_broadcast_rcvd(struct work_struct *work) |
| 221 | { | 220 | { |
| 222 | struct asd_sas_event *ev = | 221 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 223 | container_of(work, struct asd_sas_event, work); | ||
| 224 | struct asd_sas_phy *phy = ev->phy; | 222 | struct asd_sas_phy *phy = ev->phy; |
| 225 | unsigned long flags; | 223 | unsigned long flags; |
| 226 | u32 prim; | 224 | u32 prim; |
| @@ -237,8 +235,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work) | |||
| 237 | 235 | ||
| 238 | void sas_porte_link_reset_err(struct work_struct *work) | 236 | void sas_porte_link_reset_err(struct work_struct *work) |
| 239 | { | 237 | { |
| 240 | struct asd_sas_event *ev = | 238 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 241 | container_of(work, struct asd_sas_event, work); | ||
| 242 | struct asd_sas_phy *phy = ev->phy; | 239 | struct asd_sas_phy *phy = ev->phy; |
| 243 | 240 | ||
| 244 | clear_bit(PORTE_LINK_RESET_ERR, &phy->port_events_pending); | 241 | clear_bit(PORTE_LINK_RESET_ERR, &phy->port_events_pending); |
| @@ -248,8 +245,7 @@ void sas_porte_link_reset_err(struct work_struct *work) | |||
| 248 | 245 | ||
| 249 | void sas_porte_timer_event(struct work_struct *work) | 246 | void sas_porte_timer_event(struct work_struct *work) |
| 250 | { | 247 | { |
| 251 | struct asd_sas_event *ev = | 248 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 252 | container_of(work, struct asd_sas_event, work); | ||
| 253 | struct asd_sas_phy *phy = ev->phy; | 249 | struct asd_sas_phy *phy = ev->phy; |
| 254 | 250 | ||
| 255 | clear_bit(PORTE_TIMER_EVENT, &phy->port_events_pending); | 251 | clear_bit(PORTE_TIMER_EVENT, &phy->port_events_pending); |
| @@ -259,8 +255,7 @@ void sas_porte_timer_event(struct work_struct *work) | |||
| 259 | 255 | ||
| 260 | void sas_porte_hard_reset(struct work_struct *work) | 256 | void sas_porte_hard_reset(struct work_struct *work) |
| 261 | { | 257 | { |
| 262 | struct asd_sas_event *ev = | 258 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 263 | container_of(work, struct asd_sas_event, work); | ||
| 264 | struct asd_sas_phy *phy = ev->phy; | 259 | struct asd_sas_phy *phy = ev->phy; |
| 265 | 260 | ||
| 266 | clear_bit(PORTE_HARD_RESET, &phy->port_events_pending); | 261 | clear_bit(PORTE_HARD_RESET, &phy->port_events_pending); |
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index f74cc0602f3b..bc3cc6d91117 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c | |||
| @@ -1367,6 +1367,9 @@ qla2x00_read_optrom(struct fc_bsg_job *bsg_job) | |||
| 1367 | struct qla_hw_data *ha = vha->hw; | 1367 | struct qla_hw_data *ha = vha->hw; |
| 1368 | int rval = 0; | 1368 | int rval = 0; |
| 1369 | 1369 | ||
| 1370 | if (ha->flags.isp82xx_reset_hdlr_active) | ||
| 1371 | return -EBUSY; | ||
| 1372 | |||
| 1370 | rval = qla2x00_optrom_setup(bsg_job, vha, 0); | 1373 | rval = qla2x00_optrom_setup(bsg_job, vha, 0); |
| 1371 | if (rval) | 1374 | if (rval) |
| 1372 | return rval; | 1375 | return rval; |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 897731b93df2..62324a1d5573 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | * | Mailbox commands | 0x113e | 0x112c-0x112e | | 15 | * | Mailbox commands | 0x113e | 0x112c-0x112e | |
| 16 | * | | | 0x113a | | 16 | * | | | 0x113a | |
| 17 | * | Device Discovery | 0x2086 | 0x2020-0x2022 | | 17 | * | Device Discovery | 0x2086 | 0x2020-0x2022 | |
| 18 | * | Queue Command and IO tracing | 0x302f | 0x3006,0x3008 | | 18 | * | Queue Command and IO tracing | 0x3030 | 0x3006,0x3008 | |
| 19 | * | | | 0x302d-0x302e | | 19 | * | | | 0x302d-0x302e | |
| 20 | * | DPC Thread | 0x401c | | | 20 | * | DPC Thread | 0x401c | | |
| 21 | * | Async Events | 0x505d | 0x502b-0x502f | | 21 | * | Async Events | 0x505d | 0x502b-0x502f | |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index f79844ce7122..ce42288049b5 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
| @@ -1715,13 +1715,24 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) | |||
| 1715 | res = DID_ERROR << 16; | 1715 | res = DID_ERROR << 16; |
| 1716 | break; | 1716 | break; |
| 1717 | } | 1717 | } |
| 1718 | } else { | 1718 | } else if (lscsi_status != SAM_STAT_TASK_SET_FULL && |
| 1719 | lscsi_status != SAM_STAT_BUSY) { | ||
| 1720 | /* | ||
| 1721 | * scsi status of task set and busy are considered to be | ||
| 1722 | * task not completed. | ||
| 1723 | */ | ||
| 1724 | |||
| 1719 | ql_dbg(ql_dbg_io, fcport->vha, 0x301f, | 1725 | ql_dbg(ql_dbg_io, fcport->vha, 0x301f, |
| 1720 | "Dropped frame(s) detected (0x%x " | 1726 | "Dropped frame(s) detected (0x%x " |
| 1721 | "of 0x%x bytes).\n", resid, scsi_bufflen(cp)); | 1727 | "of 0x%x bytes).\n", resid, |
| 1728 | scsi_bufflen(cp)); | ||
| 1722 | 1729 | ||
| 1723 | res = DID_ERROR << 16 | lscsi_status; | 1730 | res = DID_ERROR << 16 | lscsi_status; |
| 1724 | goto check_scsi_status; | 1731 | goto check_scsi_status; |
| 1732 | } else { | ||
| 1733 | ql_dbg(ql_dbg_io, fcport->vha, 0x3030, | ||
| 1734 | "scsi_status: 0x%x, lscsi_status: 0x%x\n", | ||
| 1735 | scsi_status, lscsi_status); | ||
| 1725 | } | 1736 | } |
| 1726 | 1737 | ||
| 1727 | res = DID_OK << 16 | lscsi_status; | 1738 | res = DID_OK << 16 | lscsi_status; |
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index f0528539bbbc..de722a933438 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c | |||
| @@ -3125,6 +3125,7 @@ qla82xx_need_reset_handler(scsi_qla_host_t *vha) | |||
| 3125 | ql_log(ql_log_info, vha, 0x00b7, | 3125 | ql_log(ql_log_info, vha, 0x00b7, |
| 3126 | "HW State: COLD/RE-INIT.\n"); | 3126 | "HW State: COLD/RE-INIT.\n"); |
| 3127 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_COLD); | 3127 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_COLD); |
| 3128 | qla82xx_set_rst_ready(ha); | ||
| 3128 | if (ql2xmdenable) { | 3129 | if (ql2xmdenable) { |
| 3129 | if (qla82xx_md_collect(vha)) | 3130 | if (qla82xx_md_collect(vha)) |
| 3130 | ql_log(ql_log_warn, vha, 0xb02c, | 3131 | ql_log(ql_log_warn, vha, 0xb02c, |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index a2f999273a5f..7db803377c64 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
| @@ -3577,9 +3577,25 @@ void qla2x00_relogin(struct scsi_qla_host *vha) | |||
| 3577 | continue; | 3577 | continue; |
| 3578 | /* Attempt a retry. */ | 3578 | /* Attempt a retry. */ |
| 3579 | status = 1; | 3579 | status = 1; |
| 3580 | } else | 3580 | } else { |
| 3581 | status = qla2x00_fabric_login(vha, | 3581 | status = qla2x00_fabric_login(vha, |
| 3582 | fcport, &next_loopid); | 3582 | fcport, &next_loopid); |
| 3583 | if (status == QLA_SUCCESS) { | ||
| 3584 | int status2; | ||
| 3585 | uint8_t opts; | ||
| 3586 | |||
| 3587 | opts = 0; | ||
| 3588 | if (fcport->flags & | ||
| 3589 | FCF_FCP2_DEVICE) | ||
| 3590 | opts |= BIT_1; | ||
| 3591 | status2 = | ||
| 3592 | qla2x00_get_port_database( | ||
| 3593 | vha, fcport, | ||
| 3594 | opts); | ||
| 3595 | if (status2 != QLA_SUCCESS) | ||
| 3596 | status = 1; | ||
| 3597 | } | ||
| 3598 | } | ||
| 3583 | } else | 3599 | } else |
| 3584 | status = qla2x00_local_device_login(vha, | 3600 | status = qla2x00_local_device_login(vha, |
| 3585 | fcport); | 3601 | fcport); |
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index 3c13c0a6be63..a683e766d1ae 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c | |||
| @@ -1017,6 +1017,9 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha) | |||
| 1017 | !IS_CNA_CAPABLE(ha) && !IS_QLA2031(ha)) | 1017 | !IS_CNA_CAPABLE(ha) && !IS_QLA2031(ha)) |
| 1018 | return; | 1018 | return; |
| 1019 | 1019 | ||
| 1020 | if (ha->flags.isp82xx_reset_hdlr_active) | ||
| 1021 | return; | ||
| 1022 | |||
| 1020 | ha->isp_ops->read_optrom(vha, (uint8_t *)&hdr, | 1023 | ha->isp_ops->read_optrom(vha, (uint8_t *)&hdr, |
| 1021 | ha->flt_region_npiv_conf << 2, sizeof(struct qla_npiv_header)); | 1024 | ha->flt_region_npiv_conf << 2, sizeof(struct qla_npiv_header)); |
| 1022 | if (hdr.version == __constant_cpu_to_le16(0xffff)) | 1025 | if (hdr.version == __constant_cpu_to_le16(0xffff)) |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index 29d780c38040..f5fdb16bec9b 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
| @@ -7,9 +7,9 @@ | |||
| 7 | /* | 7 | /* |
| 8 | * Driver version | 8 | * Driver version |
| 9 | */ | 9 | */ |
| 10 | #define QLA2XXX_VERSION "8.03.07.13-k" | 10 | #define QLA2XXX_VERSION "8.04.00.03-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 4 |
| 14 | #define QLA_DRIVER_PATCH_VER 7 | 14 | #define QLA_DRIVER_PATCH_VER 0 |
| 15 | #define QLA_DRIVER_BETA_VER 3 | 15 | #define QLA_DRIVER_BETA_VER 3 |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ead6405f3e51..5dfd7495d1a1 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -1638,7 +1638,7 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, | |||
| 1638 | request_fn_proc *request_fn) | 1638 | request_fn_proc *request_fn) |
| 1639 | { | 1639 | { |
| 1640 | struct request_queue *q; | 1640 | struct request_queue *q; |
| 1641 | struct device *dev = shost->shost_gendev.parent; | 1641 | struct device *dev = shost->dma_dev; |
| 1642 | 1642 | ||
| 1643 | q = blk_init_queue(request_fn, NULL); | 1643 | q = blk_init_queue(request_fn, NULL); |
| 1644 | if (!q) | 1644 | if (!q) |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index efccd72c4a3e..1b3843117268 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
| @@ -175,7 +175,8 @@ static void virtscsi_complete_free(void *buf) | |||
| 175 | 175 | ||
| 176 | if (cmd->comp) | 176 | if (cmd->comp) |
| 177 | complete_all(cmd->comp); | 177 | complete_all(cmd->comp); |
| 178 | mempool_free(cmd, virtscsi_cmd_pool); | 178 | else |
| 179 | mempool_free(cmd, virtscsi_cmd_pool); | ||
| 179 | } | 180 | } |
| 180 | 181 | ||
| 181 | static void virtscsi_ctrl_done(struct virtqueue *vq) | 182 | static void virtscsi_ctrl_done(struct virtqueue *vq) |
| @@ -311,21 +312,22 @@ out: | |||
| 311 | static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd) | 312 | static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd) |
| 312 | { | 313 | { |
| 313 | DECLARE_COMPLETION_ONSTACK(comp); | 314 | DECLARE_COMPLETION_ONSTACK(comp); |
| 314 | int ret; | 315 | int ret = FAILED; |
| 315 | 316 | ||
| 316 | cmd->comp = ∁ | 317 | cmd->comp = ∁ |
| 317 | ret = virtscsi_kick_cmd(vscsi, vscsi->ctrl_vq, cmd, | 318 | if (virtscsi_kick_cmd(vscsi, vscsi->ctrl_vq, cmd, |
| 318 | sizeof cmd->req.tmf, sizeof cmd->resp.tmf, | 319 | sizeof cmd->req.tmf, sizeof cmd->resp.tmf, |
| 319 | GFP_NOIO); | 320 | GFP_NOIO) < 0) |
| 320 | if (ret < 0) | 321 | goto out; |
| 321 | return FAILED; | ||
| 322 | 322 | ||
| 323 | wait_for_completion(&comp); | 323 | wait_for_completion(&comp); |
| 324 | if (cmd->resp.tmf.response != VIRTIO_SCSI_S_OK && | 324 | if (cmd->resp.tmf.response == VIRTIO_SCSI_S_OK || |
| 325 | cmd->resp.tmf.response != VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) | 325 | cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) |
| 326 | return FAILED; | 326 | ret = SUCCESS; |
| 327 | 327 | ||
| 328 | return SUCCESS; | 328 | out: |
| 329 | mempool_free(cmd, virtscsi_cmd_pool); | ||
| 330 | return ret; | ||
| 329 | } | 331 | } |
| 330 | 332 | ||
| 331 | static int virtscsi_device_reset(struct scsi_cmnd *sc) | 333 | static int virtscsi_device_reset(struct scsi_cmnd *sc) |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 7ed58e2df791..f286955331a2 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
| @@ -169,6 +169,7 @@ static struct se_device *fd_create_virtdevice( | |||
| 169 | inode = file->f_mapping->host; | 169 | inode = file->f_mapping->host; |
| 170 | if (S_ISBLK(inode->i_mode)) { | 170 | if (S_ISBLK(inode->i_mode)) { |
| 171 | struct request_queue *q; | 171 | struct request_queue *q; |
| 172 | unsigned long long dev_size; | ||
| 172 | /* | 173 | /* |
| 173 | * Setup the local scope queue_limits from struct request_queue->limits | 174 | * Setup the local scope queue_limits from struct request_queue->limits |
| 174 | * to pass into transport_add_device_to_core_hba() as struct se_dev_limits. | 175 | * to pass into transport_add_device_to_core_hba() as struct se_dev_limits. |
| @@ -183,13 +184,12 @@ static struct se_device *fd_create_virtdevice( | |||
| 183 | * one (1) logical sector from underlying struct block_device | 184 | * one (1) logical sector from underlying struct block_device |
| 184 | */ | 185 | */ |
| 185 | fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev); | 186 | fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev); |
| 186 | fd_dev->fd_dev_size = (i_size_read(file->f_mapping->host) - | 187 | dev_size = (i_size_read(file->f_mapping->host) - |
| 187 | fd_dev->fd_block_size); | 188 | fd_dev->fd_block_size); |
| 188 | 189 | ||
| 189 | pr_debug("FILEIO: Using size: %llu bytes from struct" | 190 | pr_debug("FILEIO: Using size: %llu bytes from struct" |
| 190 | " block_device blocks: %llu logical_block_size: %d\n", | 191 | " block_device blocks: %llu logical_block_size: %d\n", |
| 191 | fd_dev->fd_dev_size, | 192 | dev_size, div_u64(dev_size, fd_dev->fd_block_size), |
| 192 | div_u64(fd_dev->fd_dev_size, fd_dev->fd_block_size), | ||
| 193 | fd_dev->fd_block_size); | 193 | fd_dev->fd_block_size); |
| 194 | } else { | 194 | } else { |
| 195 | if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) { | 195 | if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) { |
| @@ -605,10 +605,20 @@ static u32 fd_get_device_type(struct se_device *dev) | |||
| 605 | static sector_t fd_get_blocks(struct se_device *dev) | 605 | static sector_t fd_get_blocks(struct se_device *dev) |
| 606 | { | 606 | { |
| 607 | struct fd_dev *fd_dev = dev->dev_ptr; | 607 | struct fd_dev *fd_dev = dev->dev_ptr; |
| 608 | unsigned long long blocks_long = div_u64(fd_dev->fd_dev_size, | 608 | struct file *f = fd_dev->fd_file; |
| 609 | dev->se_sub_dev->se_dev_attrib.block_size); | 609 | struct inode *i = f->f_mapping->host; |
| 610 | unsigned long long dev_size; | ||
| 611 | /* | ||
| 612 | * When using a file that references an underlying struct block_device, | ||
| 613 | * ensure dev_size is always based on the current inode size in order | ||
| 614 | * to handle underlying block_device resize operations. | ||
| 615 | */ | ||
| 616 | if (S_ISBLK(i->i_mode)) | ||
| 617 | dev_size = (i_size_read(i) - fd_dev->fd_block_size); | ||
| 618 | else | ||
| 619 | dev_size = fd_dev->fd_dev_size; | ||
| 610 | 620 | ||
| 611 | return blocks_long; | 621 | return div_u64(dev_size, dev->se_sub_dev->se_dev_attrib.block_size); |
| 612 | } | 622 | } |
| 613 | 623 | ||
| 614 | static struct se_subsystem_api fileio_template = { | 624 | static struct se_subsystem_api fileio_template = { |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 86f0c3b5d500..c3148b10b4b3 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
| @@ -220,6 +220,9 @@ int target_scsi2_reservation_release(struct se_task *task) | |||
| 220 | if (dev->dev_reserved_node_acl != sess->se_node_acl) | 220 | if (dev->dev_reserved_node_acl != sess->se_node_acl) |
| 221 | goto out_unlock; | 221 | goto out_unlock; |
| 222 | 222 | ||
| 223 | if (dev->dev_res_bin_isid != sess->sess_bin_isid) | ||
| 224 | goto out_unlock; | ||
| 225 | |||
| 223 | dev->dev_reserved_node_acl = NULL; | 226 | dev->dev_reserved_node_acl = NULL; |
| 224 | dev->dev_flags &= ~DF_SPC2_RESERVATIONS; | 227 | dev->dev_flags &= ~DF_SPC2_RESERVATIONS; |
| 225 | if (dev->dev_flags & DF_SPC2_RESERVATIONS_WITH_ISID) { | 228 | if (dev->dev_flags & DF_SPC2_RESERVATIONS_WITH_ISID) { |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 70c3ffb981e7..e320ec24aa1b 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
| @@ -60,7 +60,6 @@ static void core_clear_initiator_node_from_tpg( | |||
| 60 | int i; | 60 | int i; |
| 61 | struct se_dev_entry *deve; | 61 | struct se_dev_entry *deve; |
| 62 | struct se_lun *lun; | 62 | struct se_lun *lun; |
| 63 | struct se_lun_acl *acl, *acl_tmp; | ||
| 64 | 63 | ||
| 65 | spin_lock_irq(&nacl->device_list_lock); | 64 | spin_lock_irq(&nacl->device_list_lock); |
| 66 | for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { | 65 | for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { |
| @@ -81,28 +80,7 @@ static void core_clear_initiator_node_from_tpg( | |||
| 81 | core_update_device_list_for_node(lun, NULL, deve->mapped_lun, | 80 | core_update_device_list_for_node(lun, NULL, deve->mapped_lun, |
| 82 | TRANSPORT_LUNFLAGS_NO_ACCESS, nacl, tpg, 0); | 81 | TRANSPORT_LUNFLAGS_NO_ACCESS, nacl, tpg, 0); |
| 83 | 82 | ||
| 84 | spin_lock(&lun->lun_acl_lock); | ||
| 85 | list_for_each_entry_safe(acl, acl_tmp, | ||
| 86 | &lun->lun_acl_list, lacl_list) { | ||
| 87 | if (!strcmp(acl->initiatorname, nacl->initiatorname) && | ||
| 88 | (acl->mapped_lun == deve->mapped_lun)) | ||
| 89 | break; | ||
| 90 | } | ||
| 91 | |||
| 92 | if (!acl) { | ||
| 93 | pr_err("Unable to locate struct se_lun_acl for %s," | ||
| 94 | " mapped_lun: %u\n", nacl->initiatorname, | ||
| 95 | deve->mapped_lun); | ||
| 96 | spin_unlock(&lun->lun_acl_lock); | ||
| 97 | spin_lock_irq(&nacl->device_list_lock); | ||
| 98 | continue; | ||
| 99 | } | ||
| 100 | |||
| 101 | list_del(&acl->lacl_list); | ||
| 102 | spin_unlock(&lun->lun_acl_lock); | ||
| 103 | |||
| 104 | spin_lock_irq(&nacl->device_list_lock); | 83 | spin_lock_irq(&nacl->device_list_lock); |
| 105 | kfree(acl); | ||
| 106 | } | 84 | } |
| 107 | spin_unlock_irq(&nacl->device_list_lock); | 85 | spin_unlock_irq(&nacl->device_list_lock); |
| 108 | } | 86 | } |
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 08ebe901bb59..654755a990df 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c | |||
| @@ -469,7 +469,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
| 469 | tty = NULL; | 469 | tty = NULL; |
| 470 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { | 470 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { |
| 471 | if (!ZS_IS_OPEN(uap_a)) { | 471 | if (!ZS_IS_OPEN(uap_a)) { |
| 472 | pmz_debug("ChanA interrupt while open !\n"); | 472 | pmz_debug("ChanA interrupt while not open !\n"); |
| 473 | goto skip_a; | 473 | goto skip_a; |
| 474 | } | 474 | } |
| 475 | write_zsreg(uap_a, R0, RES_H_IUS); | 475 | write_zsreg(uap_a, R0, RES_H_IUS); |
| @@ -493,8 +493,8 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
| 493 | spin_lock(&uap_b->port.lock); | 493 | spin_lock(&uap_b->port.lock); |
| 494 | tty = NULL; | 494 | tty = NULL; |
| 495 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { | 495 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { |
| 496 | if (!ZS_IS_OPEN(uap_a)) { | 496 | if (!ZS_IS_OPEN(uap_b)) { |
| 497 | pmz_debug("ChanB interrupt while open !\n"); | 497 | pmz_debug("ChanB interrupt while not open !\n"); |
| 498 | goto skip_b; | 498 | goto skip_b; |
| 499 | } | 499 | } |
| 500 | write_zsreg(uap_b, R0, RES_H_IUS); | 500 | write_zsreg(uap_b, R0, RES_H_IUS); |
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index 86dd1e302bb3..3b0c4e32ed7b 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c | |||
| @@ -1085,15 +1085,21 @@ void vt_set_led_state(int console, int leds) | |||
| 1085 | * | 1085 | * |
| 1086 | * Handle console start. This is a wrapper for the VT layer | 1086 | * Handle console start. This is a wrapper for the VT layer |
| 1087 | * so that we can keep kbd knowledge internal | 1087 | * so that we can keep kbd knowledge internal |
| 1088 | * | ||
| 1089 | * FIXME: We eventually need to hold the kbd lock here to protect | ||
| 1090 | * the LED updating. We can't do it yet because fn_hold calls stop_tty | ||
| 1091 | * and start_tty under the kbd_event_lock, while normal tty paths | ||
| 1092 | * don't hold the lock. We probably need to split out an LED lock | ||
| 1093 | * but not during an -rc release! | ||
| 1088 | */ | 1094 | */ |
| 1089 | void vt_kbd_con_start(int console) | 1095 | void vt_kbd_con_start(int console) |
| 1090 | { | 1096 | { |
| 1091 | struct kbd_struct * kbd = kbd_table + console; | 1097 | struct kbd_struct * kbd = kbd_table + console; |
| 1092 | unsigned long flags; | 1098 | /* unsigned long flags; */ |
| 1093 | spin_lock_irqsave(&kbd_event_lock, flags); | 1099 | /* spin_lock_irqsave(&kbd_event_lock, flags); */ |
| 1094 | clr_vc_kbd_led(kbd, VC_SCROLLOCK); | 1100 | clr_vc_kbd_led(kbd, VC_SCROLLOCK); |
| 1095 | set_leds(); | 1101 | set_leds(); |
| 1096 | spin_unlock_irqrestore(&kbd_event_lock, flags); | 1102 | /* spin_unlock_irqrestore(&kbd_event_lock, flags); */ |
| 1097 | } | 1103 | } |
| 1098 | 1104 | ||
| 1099 | /** | 1105 | /** |
| @@ -1102,22 +1108,28 @@ void vt_kbd_con_start(int console) | |||
| 1102 | * | 1108 | * |
| 1103 | * Handle console stop. This is a wrapper for the VT layer | 1109 | * Handle console stop. This is a wrapper for the VT layer |
| 1104 | * so that we can keep kbd knowledge internal | 1110 | * so that we can keep kbd knowledge internal |
| 1111 | * | ||
| 1112 | * FIXME: We eventually need to hold the kbd lock here to protect | ||
| 1113 | * the LED updating. We can't do it yet because fn_hold calls stop_tty | ||
| 1114 | * and start_tty under the kbd_event_lock, while normal tty paths | ||
| 1115 | * don't hold the lock. We probably need to split out an LED lock | ||
| 1116 | * but not during an -rc release! | ||
| 1105 | */ | 1117 | */ |
| 1106 | void vt_kbd_con_stop(int console) | 1118 | void vt_kbd_con_stop(int console) |
| 1107 | { | 1119 | { |
| 1108 | struct kbd_struct * kbd = kbd_table + console; | 1120 | struct kbd_struct * kbd = kbd_table + console; |
| 1109 | unsigned long flags; | 1121 | /* unsigned long flags; */ |
| 1110 | spin_lock_irqsave(&kbd_event_lock, flags); | 1122 | /* spin_lock_irqsave(&kbd_event_lock, flags); */ |
| 1111 | set_vc_kbd_led(kbd, VC_SCROLLOCK); | 1123 | set_vc_kbd_led(kbd, VC_SCROLLOCK); |
| 1112 | set_leds(); | 1124 | set_leds(); |
| 1113 | spin_unlock_irqrestore(&kbd_event_lock, flags); | 1125 | /* spin_unlock_irqrestore(&kbd_event_lock, flags); */ |
| 1114 | } | 1126 | } |
| 1115 | 1127 | ||
| 1116 | /* | 1128 | /* |
| 1117 | * This is the tasklet that updates LED state on all keyboards | 1129 | * This is the tasklet that updates LED state on all keyboards |
| 1118 | * attached to the box. The reason we use tasklet is that we | 1130 | * attached to the box. The reason we use tasklet is that we |
| 1119 | * need to handle the scenario when keyboard handler is not | 1131 | * need to handle the scenario when keyboard handler is not |
| 1120 | * registered yet but we already getting updates form VT to | 1132 | * registered yet but we already getting updates from the VT to |
| 1121 | * update led state. | 1133 | * update led state. |
| 1122 | */ | 1134 | */ |
| 1123 | static void kbd_bh(unsigned long dummy) | 1135 | static void kbd_bh(unsigned long dummy) |
| @@ -2032,7 +2044,7 @@ int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm) | |||
| 2032 | kbd->default_ledflagstate = ((arg >> 4) & 7); | 2044 | kbd->default_ledflagstate = ((arg >> 4) & 7); |
| 2033 | set_leds(); | 2045 | set_leds(); |
| 2034 | spin_unlock_irqrestore(&kbd_event_lock, flags); | 2046 | spin_unlock_irqrestore(&kbd_event_lock, flags); |
| 2035 | break; | 2047 | return 0; |
| 2036 | 2048 | ||
| 2037 | /* the ioctls below only set the lights, not the functions */ | 2049 | /* the ioctls below only set the lights, not the functions */ |
| 2038 | /* for those, see KDGKBLED and KDSKBLED above */ | 2050 | /* for those, see KDGKBLED and KDSKBLED above */ |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 86183366647f..f214a80cdee2 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
| 25 | #include <linux/of.h> | 25 | #include <linux/of.h> |
| 26 | #include <linux/of_gpio.h> | 26 | #include <linux/of_gpio.h> |
| 27 | #include <linux/pm_runtime.h> | ||
| 27 | 28 | ||
| 28 | #include <mach/usb_phy.h> | 29 | #include <mach/usb_phy.h> |
| 29 | #include <mach/iomap.h> | 30 | #include <mach/iomap.h> |
| @@ -37,9 +38,7 @@ struct tegra_ehci_hcd { | |||
| 37 | struct clk *emc_clk; | 38 | struct clk *emc_clk; |
| 38 | struct usb_phy *transceiver; | 39 | struct usb_phy *transceiver; |
| 39 | int host_resumed; | 40 | int host_resumed; |
| 40 | int bus_suspended; | ||
| 41 | int port_resuming; | 41 | int port_resuming; |
| 42 | int power_down_on_bus_suspend; | ||
| 43 | enum tegra_usb_phy_port_speed port_speed; | 42 | enum tegra_usb_phy_port_speed port_speed; |
| 44 | }; | 43 | }; |
| 45 | 44 | ||
| @@ -273,120 +272,6 @@ static void tegra_ehci_restart(struct usb_hcd *hcd) | |||
| 273 | up_write(&ehci_cf_port_reset_rwsem); | 272 | up_write(&ehci_cf_port_reset_rwsem); |
| 274 | } | 273 | } |
| 275 | 274 | ||
| 276 | static int tegra_usb_suspend(struct usb_hcd *hcd) | ||
| 277 | { | ||
| 278 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
| 279 | struct ehci_regs __iomem *hw = tegra->ehci->regs; | ||
| 280 | unsigned long flags; | ||
| 281 | |||
| 282 | spin_lock_irqsave(&tegra->ehci->lock, flags); | ||
| 283 | |||
| 284 | tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3; | ||
| 285 | ehci_halt(tegra->ehci); | ||
| 286 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
| 287 | |||
| 288 | spin_unlock_irqrestore(&tegra->ehci->lock, flags); | ||
| 289 | |||
| 290 | tegra_ehci_power_down(hcd); | ||
| 291 | return 0; | ||
| 292 | } | ||
| 293 | |||
| 294 | static int tegra_usb_resume(struct usb_hcd *hcd) | ||
| 295 | { | ||
| 296 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
| 297 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
| 298 | struct ehci_regs __iomem *hw = ehci->regs; | ||
| 299 | unsigned long val; | ||
| 300 | |||
| 301 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
| 302 | tegra_ehci_power_up(hcd); | ||
| 303 | |||
| 304 | if (tegra->port_speed > TEGRA_USB_PHY_PORT_SPEED_HIGH) { | ||
| 305 | /* Wait for the phy to detect new devices | ||
| 306 | * before we restart the controller */ | ||
| 307 | msleep(10); | ||
| 308 | goto restart; | ||
| 309 | } | ||
| 310 | |||
| 311 | /* Force the phy to keep data lines in suspend state */ | ||
| 312 | tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed); | ||
| 313 | |||
| 314 | /* Enable host mode */ | ||
| 315 | tdi_reset(ehci); | ||
| 316 | |||
| 317 | /* Enable Port Power */ | ||
| 318 | val = readl(&hw->port_status[0]); | ||
| 319 | val |= PORT_POWER; | ||
| 320 | writel(val, &hw->port_status[0]); | ||
| 321 | udelay(10); | ||
| 322 | |||
| 323 | /* Check if the phy resume from LP0. When the phy resume from LP0 | ||
| 324 | * USB register will be reset. */ | ||
| 325 | if (!readl(&hw->async_next)) { | ||
| 326 | /* Program the field PTC based on the saved speed mode */ | ||
| 327 | val = readl(&hw->port_status[0]); | ||
| 328 | val &= ~PORT_TEST(~0); | ||
| 329 | if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
| 330 | val |= PORT_TEST_FORCE; | ||
| 331 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_FULL) | ||
| 332 | val |= PORT_TEST(6); | ||
| 333 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) | ||
| 334 | val |= PORT_TEST(7); | ||
| 335 | writel(val, &hw->port_status[0]); | ||
| 336 | udelay(10); | ||
| 337 | |||
| 338 | /* Disable test mode by setting PTC field to NORMAL_OP */ | ||
| 339 | val = readl(&hw->port_status[0]); | ||
| 340 | val &= ~PORT_TEST(~0); | ||
| 341 | writel(val, &hw->port_status[0]); | ||
| 342 | udelay(10); | ||
| 343 | } | ||
| 344 | |||
| 345 | /* Poll until CCS is enabled */ | ||
| 346 | if (handshake(ehci, &hw->port_status[0], PORT_CONNECT, | ||
| 347 | PORT_CONNECT, 2000)) { | ||
| 348 | pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__); | ||
| 349 | goto restart; | ||
| 350 | } | ||
| 351 | |||
| 352 | /* Poll until PE is enabled */ | ||
| 353 | if (handshake(ehci, &hw->port_status[0], PORT_PE, | ||
| 354 | PORT_PE, 2000)) { | ||
| 355 | pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__); | ||
| 356 | goto restart; | ||
| 357 | } | ||
| 358 | |||
| 359 | /* Clear the PCI status, to avoid an interrupt taken upon resume */ | ||
| 360 | val = readl(&hw->status); | ||
| 361 | val |= STS_PCD; | ||
| 362 | writel(val, &hw->status); | ||
| 363 | |||
| 364 | /* Put controller in suspend mode by writing 1 to SUSP bit of PORTSC */ | ||
| 365 | val = readl(&hw->port_status[0]); | ||
| 366 | if ((val & PORT_POWER) && (val & PORT_PE)) { | ||
| 367 | val |= PORT_SUSPEND; | ||
| 368 | writel(val, &hw->port_status[0]); | ||
| 369 | |||
| 370 | /* Wait until port suspend completes */ | ||
| 371 | if (handshake(ehci, &hw->port_status[0], PORT_SUSPEND, | ||
| 372 | PORT_SUSPEND, 1000)) { | ||
| 373 | pr_err("%s: timeout waiting for PORT_SUSPEND\n", | ||
| 374 | __func__); | ||
| 375 | goto restart; | ||
| 376 | } | ||
| 377 | } | ||
| 378 | |||
| 379 | tegra_ehci_phy_restore_end(tegra->phy); | ||
| 380 | return 0; | ||
| 381 | |||
| 382 | restart: | ||
| 383 | if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
| 384 | tegra_ehci_phy_restore_end(tegra->phy); | ||
| 385 | |||
| 386 | tegra_ehci_restart(hcd); | ||
| 387 | return 0; | ||
| 388 | } | ||
| 389 | |||
| 390 | static void tegra_ehci_shutdown(struct usb_hcd *hcd) | 275 | static void tegra_ehci_shutdown(struct usb_hcd *hcd) |
| 391 | { | 276 | { |
| 392 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | 277 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); |
| @@ -434,36 +319,6 @@ static int tegra_ehci_setup(struct usb_hcd *hcd) | |||
| 434 | return retval; | 319 | return retval; |
| 435 | } | 320 | } |
| 436 | 321 | ||
| 437 | #ifdef CONFIG_PM | ||
| 438 | static int tegra_ehci_bus_suspend(struct usb_hcd *hcd) | ||
| 439 | { | ||
| 440 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
| 441 | int error_status = 0; | ||
| 442 | |||
| 443 | error_status = ehci_bus_suspend(hcd); | ||
| 444 | if (!error_status && tegra->power_down_on_bus_suspend) { | ||
| 445 | tegra_usb_suspend(hcd); | ||
| 446 | tegra->bus_suspended = 1; | ||
| 447 | } | ||
| 448 | |||
| 449 | return error_status; | ||
| 450 | } | ||
| 451 | |||
| 452 | static int tegra_ehci_bus_resume(struct usb_hcd *hcd) | ||
| 453 | { | ||
| 454 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
| 455 | |||
| 456 | if (tegra->bus_suspended && tegra->power_down_on_bus_suspend) { | ||
| 457 | tegra_usb_resume(hcd); | ||
| 458 | tegra->bus_suspended = 0; | ||
| 459 | } | ||
| 460 | |||
| 461 | tegra_usb_phy_preresume(tegra->phy); | ||
| 462 | tegra->port_resuming = 1; | ||
| 463 | return ehci_bus_resume(hcd); | ||
| 464 | } | ||
| 465 | #endif | ||
| 466 | |||
| 467 | struct temp_buffer { | 322 | struct temp_buffer { |
| 468 | void *kmalloc_ptr; | 323 | void *kmalloc_ptr; |
| 469 | void *old_xfer_buffer; | 324 | void *old_xfer_buffer; |
| @@ -574,8 +429,8 @@ static const struct hc_driver tegra_ehci_hc_driver = { | |||
| 574 | .hub_control = tegra_ehci_hub_control, | 429 | .hub_control = tegra_ehci_hub_control, |
| 575 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 430 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
| 576 | #ifdef CONFIG_PM | 431 | #ifdef CONFIG_PM |
| 577 | .bus_suspend = tegra_ehci_bus_suspend, | 432 | .bus_suspend = ehci_bus_suspend, |
| 578 | .bus_resume = tegra_ehci_bus_resume, | 433 | .bus_resume = ehci_bus_resume, |
| 579 | #endif | 434 | #endif |
| 580 | .relinquish_port = ehci_relinquish_port, | 435 | .relinquish_port = ehci_relinquish_port, |
| 581 | .port_handed_over = ehci_port_handed_over, | 436 | .port_handed_over = ehci_port_handed_over, |
| @@ -603,11 +458,187 @@ static int setup_vbus_gpio(struct platform_device *pdev) | |||
| 603 | dev_err(&pdev->dev, "can't enable vbus\n"); | 458 | dev_err(&pdev->dev, "can't enable vbus\n"); |
| 604 | return err; | 459 | return err; |
| 605 | } | 460 | } |
| 606 | gpio_set_value(gpio, 1); | ||
| 607 | 461 | ||
| 608 | return err; | 462 | return err; |
| 609 | } | 463 | } |
| 610 | 464 | ||
| 465 | #ifdef CONFIG_PM | ||
| 466 | |||
| 467 | static int controller_suspend(struct device *dev) | ||
| 468 | { | ||
| 469 | struct tegra_ehci_hcd *tegra = | ||
| 470 | platform_get_drvdata(to_platform_device(dev)); | ||
| 471 | struct ehci_hcd *ehci = tegra->ehci; | ||
| 472 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | ||
| 473 | struct ehci_regs __iomem *hw = ehci->regs; | ||
| 474 | unsigned long flags; | ||
| 475 | |||
| 476 | if (time_before(jiffies, ehci->next_statechange)) | ||
| 477 | msleep(10); | ||
| 478 | |||
| 479 | spin_lock_irqsave(&ehci->lock, flags); | ||
| 480 | |||
| 481 | tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3; | ||
| 482 | ehci_halt(ehci); | ||
| 483 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
| 484 | |||
| 485 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
| 486 | |||
| 487 | tegra_ehci_power_down(hcd); | ||
| 488 | return 0; | ||
| 489 | } | ||
| 490 | |||
| 491 | static int controller_resume(struct device *dev) | ||
| 492 | { | ||
| 493 | struct tegra_ehci_hcd *tegra = | ||
| 494 | platform_get_drvdata(to_platform_device(dev)); | ||
| 495 | struct ehci_hcd *ehci = tegra->ehci; | ||
| 496 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | ||
| 497 | struct ehci_regs __iomem *hw = ehci->regs; | ||
| 498 | unsigned long val; | ||
| 499 | |||
| 500 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
| 501 | tegra_ehci_power_up(hcd); | ||
| 502 | |||
| 503 | if (tegra->port_speed > TEGRA_USB_PHY_PORT_SPEED_HIGH) { | ||
| 504 | /* Wait for the phy to detect new devices | ||
| 505 | * before we restart the controller */ | ||
| 506 | msleep(10); | ||
| 507 | goto restart; | ||
| 508 | } | ||
| 509 | |||
| 510 | /* Force the phy to keep data lines in suspend state */ | ||
| 511 | tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed); | ||
| 512 | |||
| 513 | /* Enable host mode */ | ||
| 514 | tdi_reset(ehci); | ||
| 515 | |||
| 516 | /* Enable Port Power */ | ||
| 517 | val = readl(&hw->port_status[0]); | ||
| 518 | val |= PORT_POWER; | ||
| 519 | writel(val, &hw->port_status[0]); | ||
| 520 | udelay(10); | ||
| 521 | |||
| 522 | /* Check if the phy resume from LP0. When the phy resume from LP0 | ||
| 523 | * USB register will be reset. */ | ||
| 524 | if (!readl(&hw->async_next)) { | ||
| 525 | /* Program the field PTC based on the saved speed mode */ | ||
| 526 | val = readl(&hw->port_status[0]); | ||
| 527 | val &= ~PORT_TEST(~0); | ||
| 528 | if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
| 529 | val |= PORT_TEST_FORCE; | ||
| 530 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_FULL) | ||
| 531 | val |= PORT_TEST(6); | ||
| 532 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) | ||
| 533 | val |= PORT_TEST(7); | ||
| 534 | writel(val, &hw->port_status[0]); | ||
| 535 | udelay(10); | ||
| 536 | |||
| 537 | /* Disable test mode by setting PTC field to NORMAL_OP */ | ||
| 538 | val = readl(&hw->port_status[0]); | ||
| 539 | val &= ~PORT_TEST(~0); | ||
| 540 | writel(val, &hw->port_status[0]); | ||
| 541 | udelay(10); | ||
| 542 | } | ||
| 543 | |||
| 544 | /* Poll until CCS is enabled */ | ||
| 545 | if (handshake(ehci, &hw->port_status[0], PORT_CONNECT, | ||
| 546 | PORT_CONNECT, 2000)) { | ||
| 547 | pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__); | ||
| 548 | goto restart; | ||
| 549 | } | ||
| 550 | |||
| 551 | /* Poll until PE is enabled */ | ||
| 552 | if (handshake(ehci, &hw->port_status[0], PORT_PE, | ||
| 553 | PORT_PE, 2000)) { | ||
| 554 | pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__); | ||
| 555 | goto restart; | ||
| 556 | } | ||
| 557 | |||
| 558 | /* Clear the PCI status, to avoid an interrupt taken upon resume */ | ||
| 559 | val = readl(&hw->status); | ||
| 560 | val |= STS_PCD; | ||
| 561 | writel(val, &hw->status); | ||
| 562 | |||
| 563 | /* Put controller in suspend mode by writing 1 to SUSP bit of PORTSC */ | ||
| 564 | val = readl(&hw->port_status[0]); | ||
| 565 | if ((val & PORT_POWER) && (val & PORT_PE)) { | ||
| 566 | val |= PORT_SUSPEND; | ||
| 567 | writel(val, &hw->port_status[0]); | ||
| 568 | |||
| 569 | /* Wait until port suspend completes */ | ||
| 570 | if (handshake(ehci, &hw->port_status[0], PORT_SUSPEND, | ||
| 571 | PORT_SUSPEND, 1000)) { | ||
| 572 | pr_err("%s: timeout waiting for PORT_SUSPEND\n", | ||
| 573 | __func__); | ||
| 574 | goto restart; | ||
| 575 | } | ||
| 576 | } | ||
| 577 | |||
| 578 | tegra_ehci_phy_restore_end(tegra->phy); | ||
| 579 | goto done; | ||
| 580 | |||
| 581 | restart: | ||
| 582 | if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
| 583 | tegra_ehci_phy_restore_end(tegra->phy); | ||
| 584 | |||
| 585 | tegra_ehci_restart(hcd); | ||
| 586 | |||
| 587 | done: | ||
| 588 | tegra_usb_phy_preresume(tegra->phy); | ||
| 589 | tegra->port_resuming = 1; | ||
| 590 | return 0; | ||
| 591 | } | ||
| 592 | |||
| 593 | static int tegra_ehci_suspend(struct device *dev) | ||
| 594 | { | ||
| 595 | struct tegra_ehci_hcd *tegra = | ||
| 596 | platform_get_drvdata(to_platform_device(dev)); | ||
| 597 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
| 598 | int rc = 0; | ||
| 599 | |||
| 600 | /* | ||
| 601 | * When system sleep is supported and USB controller wakeup is | ||
| 602 | * implemented: If the controller is runtime-suspended and the | ||
| 603 | * wakeup setting needs to be changed, call pm_runtime_resume(). | ||
| 604 | */ | ||
| 605 | if (HCD_HW_ACCESSIBLE(hcd)) | ||
| 606 | rc = controller_suspend(dev); | ||
| 607 | return rc; | ||
| 608 | } | ||
| 609 | |||
| 610 | static int tegra_ehci_resume(struct device *dev) | ||
| 611 | { | ||
| 612 | int rc; | ||
| 613 | |||
| 614 | rc = controller_resume(dev); | ||
| 615 | if (rc == 0) { | ||
| 616 | pm_runtime_disable(dev); | ||
| 617 | pm_runtime_set_active(dev); | ||
| 618 | pm_runtime_enable(dev); | ||
| 619 | } | ||
| 620 | return rc; | ||
| 621 | } | ||
| 622 | |||
| 623 | static int tegra_ehci_runtime_suspend(struct device *dev) | ||
| 624 | { | ||
| 625 | return controller_suspend(dev); | ||
| 626 | } | ||
| 627 | |||
| 628 | static int tegra_ehci_runtime_resume(struct device *dev) | ||
| 629 | { | ||
| 630 | return controller_resume(dev); | ||
| 631 | } | ||
| 632 | |||
| 633 | static const struct dev_pm_ops tegra_ehci_pm_ops = { | ||
| 634 | .suspend = tegra_ehci_suspend, | ||
| 635 | .resume = tegra_ehci_resume, | ||
| 636 | .runtime_suspend = tegra_ehci_runtime_suspend, | ||
| 637 | .runtime_resume = tegra_ehci_runtime_resume, | ||
| 638 | }; | ||
| 639 | |||
| 640 | #endif | ||
| 641 | |||
| 611 | static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); | 642 | static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); |
| 612 | 643 | ||
| 613 | static int tegra_ehci_probe(struct platform_device *pdev) | 644 | static int tegra_ehci_probe(struct platform_device *pdev) |
| @@ -722,7 +753,6 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
| 722 | } | 753 | } |
| 723 | 754 | ||
| 724 | tegra->host_resumed = 1; | 755 | tegra->host_resumed = 1; |
| 725 | tegra->power_down_on_bus_suspend = pdata->power_down_on_bus_suspend; | ||
| 726 | tegra->ehci = hcd_to_ehci(hcd); | 756 | tegra->ehci = hcd_to_ehci(hcd); |
| 727 | 757 | ||
| 728 | irq = platform_get_irq(pdev, 0); | 758 | irq = platform_get_irq(pdev, 0); |
| @@ -746,6 +776,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
| 746 | goto fail; | 776 | goto fail; |
| 747 | } | 777 | } |
| 748 | 778 | ||
| 779 | pm_runtime_set_active(&pdev->dev); | ||
| 780 | pm_runtime_get_noresume(&pdev->dev); | ||
| 781 | |||
| 782 | /* Don't skip the pm_runtime_forbid call if wakeup isn't working */ | ||
| 783 | /* if (!pdata->power_down_on_bus_suspend) */ | ||
| 784 | pm_runtime_forbid(&pdev->dev); | ||
| 785 | pm_runtime_enable(&pdev->dev); | ||
| 786 | pm_runtime_put_sync(&pdev->dev); | ||
| 749 | return err; | 787 | return err; |
| 750 | 788 | ||
| 751 | fail: | 789 | fail: |
| @@ -772,33 +810,6 @@ fail_hcd: | |||
| 772 | return err; | 810 | return err; |
| 773 | } | 811 | } |
| 774 | 812 | ||
| 775 | #ifdef CONFIG_PM | ||
| 776 | static int tegra_ehci_resume(struct platform_device *pdev) | ||
| 777 | { | ||
| 778 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
| 779 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
| 780 | |||
| 781 | if (tegra->bus_suspended) | ||
| 782 | return 0; | ||
| 783 | |||
| 784 | return tegra_usb_resume(hcd); | ||
| 785 | } | ||
| 786 | |||
| 787 | static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state) | ||
| 788 | { | ||
| 789 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
| 790 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
| 791 | |||
| 792 | if (tegra->bus_suspended) | ||
| 793 | return 0; | ||
| 794 | |||
| 795 | if (time_before(jiffies, tegra->ehci->next_statechange)) | ||
| 796 | msleep(10); | ||
| 797 | |||
| 798 | return tegra_usb_suspend(hcd); | ||
| 799 | } | ||
| 800 | #endif | ||
| 801 | |||
| 802 | static int tegra_ehci_remove(struct platform_device *pdev) | 813 | static int tegra_ehci_remove(struct platform_device *pdev) |
| 803 | { | 814 | { |
| 804 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | 815 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); |
| @@ -807,6 +818,10 @@ static int tegra_ehci_remove(struct platform_device *pdev) | |||
| 807 | if (tegra == NULL || hcd == NULL) | 818 | if (tegra == NULL || hcd == NULL) |
| 808 | return -EINVAL; | 819 | return -EINVAL; |
| 809 | 820 | ||
| 821 | pm_runtime_get_sync(&pdev->dev); | ||
| 822 | pm_runtime_disable(&pdev->dev); | ||
| 823 | pm_runtime_put_noidle(&pdev->dev); | ||
| 824 | |||
| 810 | #ifdef CONFIG_USB_OTG_UTILS | 825 | #ifdef CONFIG_USB_OTG_UTILS |
| 811 | if (tegra->transceiver) { | 826 | if (tegra->transceiver) { |
| 812 | otg_set_host(tegra->transceiver->otg, NULL); | 827 | otg_set_host(tegra->transceiver->otg, NULL); |
| @@ -847,13 +862,12 @@ static struct of_device_id tegra_ehci_of_match[] __devinitdata = { | |||
| 847 | static struct platform_driver tegra_ehci_driver = { | 862 | static struct platform_driver tegra_ehci_driver = { |
| 848 | .probe = tegra_ehci_probe, | 863 | .probe = tegra_ehci_probe, |
| 849 | .remove = tegra_ehci_remove, | 864 | .remove = tegra_ehci_remove, |
| 850 | #ifdef CONFIG_PM | ||
| 851 | .suspend = tegra_ehci_suspend, | ||
| 852 | .resume = tegra_ehci_resume, | ||
| 853 | #endif | ||
| 854 | .shutdown = tegra_ehci_hcd_shutdown, | 865 | .shutdown = tegra_ehci_hcd_shutdown, |
| 855 | .driver = { | 866 | .driver = { |
| 856 | .name = "tegra-ehci", | 867 | .name = "tegra-ehci", |
| 857 | .of_match_table = tegra_ehci_of_match, | 868 | .of_match_table = tegra_ehci_of_match, |
| 869 | #ifdef CONFIG_PM | ||
| 870 | .pm = &tegra_ehci_pm_ops, | ||
| 871 | #endif | ||
| 858 | } | 872 | } |
| 859 | }; | 873 | }; |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 1f21d2a1e528..5c170100de9c 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/if_arp.h> | 24 | #include <linux/if_arp.h> |
| 25 | #include <linux/if_tun.h> | 25 | #include <linux/if_tun.h> |
| 26 | #include <linux/if_macvlan.h> | 26 | #include <linux/if_macvlan.h> |
| 27 | #include <linux/if_vlan.h> | ||
| 27 | 28 | ||
| 28 | #include <net/sock.h> | 29 | #include <net/sock.h> |
| 29 | 30 | ||
| @@ -283,8 +284,12 @@ static int peek_head_len(struct sock *sk) | |||
| 283 | 284 | ||
| 284 | spin_lock_irqsave(&sk->sk_receive_queue.lock, flags); | 285 | spin_lock_irqsave(&sk->sk_receive_queue.lock, flags); |
| 285 | head = skb_peek(&sk->sk_receive_queue); | 286 | head = skb_peek(&sk->sk_receive_queue); |
| 286 | if (likely(head)) | 287 | if (likely(head)) { |
| 287 | len = head->len; | 288 | len = head->len; |
| 289 | if (vlan_tx_tag_present(head)) | ||
| 290 | len += VLAN_HLEN; | ||
| 291 | } | ||
| 292 | |||
| 288 | spin_unlock_irqrestore(&sk->sk_receive_queue.lock, flags); | 293 | spin_unlock_irqrestore(&sk->sk_receive_queue.lock, flags); |
| 289 | return len; | 294 | return len; |
| 290 | } | 295 | } |
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c index 6468a297e341..39571f9e0162 100644 --- a/drivers/video/console/sticore.c +++ b/drivers/video/console/sticore.c | |||
| @@ -22,7 +22,9 @@ | |||
| 22 | #include <linux/font.h> | 22 | #include <linux/font.h> |
| 23 | 23 | ||
| 24 | #include <asm/hardware.h> | 24 | #include <asm/hardware.h> |
| 25 | #include <asm/page.h> | ||
| 25 | #include <asm/parisc-device.h> | 26 | #include <asm/parisc-device.h> |
| 27 | #include <asm/pdc.h> | ||
| 26 | #include <asm/cacheflush.h> | 28 | #include <asm/cacheflush.h> |
| 27 | #include <asm/grfioctl.h> | 29 | #include <asm/grfioctl.h> |
| 28 | 30 | ||
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 26e83d7fdd6f..b0e2a4261afe 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
| @@ -73,7 +73,7 @@ static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *ns | |||
| 73 | struct uvesafb_task *utask; | 73 | struct uvesafb_task *utask; |
| 74 | struct uvesafb_ktask *task; | 74 | struct uvesafb_ktask *task; |
| 75 | 75 | ||
| 76 | if (!cap_raised(current_cap(), CAP_SYS_ADMIN)) | 76 | if (!capable(CAP_SYS_ADMIN)) |
| 77 | return; | 77 | return; |
| 78 | 78 | ||
| 79 | if (msg->seq >= UVESAFB_TASKS_MAX) | 79 | if (msg->seq >= UVESAFB_TASKS_MAX) |
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index cb4529c40d74..b7f5173ff9e9 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c | |||
| @@ -365,7 +365,7 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, | |||
| 365 | struct fb_info *fb_info; | 365 | struct fb_info *fb_info; |
| 366 | int fb_size; | 366 | int fb_size; |
| 367 | int val; | 367 | int val; |
| 368 | int ret; | 368 | int ret = 0; |
| 369 | 369 | ||
| 370 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 370 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
| 371 | if (info == NULL) { | 371 | if (info == NULL) { |
| @@ -458,26 +458,31 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, | |||
| 458 | xenfb_init_shared_page(info, fb_info); | 458 | xenfb_init_shared_page(info, fb_info); |
| 459 | 459 | ||
| 460 | ret = xenfb_connect_backend(dev, info); | 460 | ret = xenfb_connect_backend(dev, info); |
| 461 | if (ret < 0) | 461 | if (ret < 0) { |
| 462 | goto error; | 462 | xenbus_dev_fatal(dev, ret, "xenfb_connect_backend"); |
| 463 | goto error_fb; | ||
| 464 | } | ||
| 463 | 465 | ||
| 464 | ret = register_framebuffer(fb_info); | 466 | ret = register_framebuffer(fb_info); |
| 465 | if (ret) { | 467 | if (ret) { |
| 466 | fb_deferred_io_cleanup(fb_info); | ||
| 467 | fb_dealloc_cmap(&fb_info->cmap); | ||
| 468 | framebuffer_release(fb_info); | ||
| 469 | xenbus_dev_fatal(dev, ret, "register_framebuffer"); | 468 | xenbus_dev_fatal(dev, ret, "register_framebuffer"); |
| 470 | goto error; | 469 | goto error_fb; |
| 471 | } | 470 | } |
| 472 | info->fb_info = fb_info; | 471 | info->fb_info = fb_info; |
| 473 | 472 | ||
| 474 | xenfb_make_preferred_console(); | 473 | xenfb_make_preferred_console(); |
| 475 | return 0; | 474 | return 0; |
| 476 | 475 | ||
| 477 | error_nomem: | 476 | error_fb: |
| 478 | ret = -ENOMEM; | 477 | fb_deferred_io_cleanup(fb_info); |
| 479 | xenbus_dev_fatal(dev, ret, "allocating device memory"); | 478 | fb_dealloc_cmap(&fb_info->cmap); |
| 480 | error: | 479 | framebuffer_release(fb_info); |
| 480 | error_nomem: | ||
| 481 | if (!ret) { | ||
| 482 | ret = -ENOMEM; | ||
| 483 | xenbus_dev_fatal(dev, ret, "allocating device memory"); | ||
| 484 | } | ||
| 485 | error: | ||
| 481 | xenfb_remove(dev); | 486 | xenfb_remove(dev); |
| 482 | return ret; | 487 | return ret; |
| 483 | } | 488 | } |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index c2d05a8279fd..8807fe501d20 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
| @@ -390,6 +390,7 @@ static void __devexit virtballoon_remove(struct virtio_device *vdev) | |||
| 390 | /* There might be pages left in the balloon: free them. */ | 390 | /* There might be pages left in the balloon: free them. */ |
| 391 | while (vb->num_pages) | 391 | while (vb->num_pages) |
| 392 | leak_balloon(vb, vb->num_pages); | 392 | leak_balloon(vb, vb->num_pages); |
| 393 | update_balloon_size(vb); | ||
| 393 | 394 | ||
| 394 | /* Now we reset the device so we can clean up the queues. */ | 395 | /* Now we reset the device so we can clean up the queues. */ |
| 395 | vdev->config->reset(vdev); | 396 | vdev->config->reset(vdev); |
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 94243136f6bf..ea20c51d24c7 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
| @@ -183,15 +183,17 @@ config XEN_ACPI_PROCESSOR | |||
| 183 | depends on XEN && X86 && ACPI_PROCESSOR && CPU_FREQ | 183 | depends on XEN && X86 && ACPI_PROCESSOR && CPU_FREQ |
| 184 | default m | 184 | default m |
| 185 | help | 185 | help |
| 186 | This ACPI processor uploads Power Management information to the Xen hypervisor. | 186 | This ACPI processor uploads Power Management information to the Xen |
| 187 | 187 | hypervisor. | |
| 188 | To do that the driver parses the Power Management data and uploads said | 188 | |
| 189 | information to the Xen hypervisor. Then the Xen hypervisor can select the | 189 | To do that the driver parses the Power Management data and uploads |
| 190 | proper Cx and Pxx states. It also registers itslef as the SMM so that | 190 | said information to the Xen hypervisor. Then the Xen hypervisor can |
| 191 | other drivers (such as ACPI cpufreq scaling driver) will not load. | 191 | select the proper Cx and Pxx states. It also registers itslef as the |
| 192 | 192 | SMM so that other drivers (such as ACPI cpufreq scaling driver) will | |
| 193 | To compile this driver as a module, choose M here: the | 193 | not load. |
| 194 | module will be called xen_acpi_processor If you do not know what to choose, | 194 | |
| 195 | select M here. If the CPUFREQ drivers are built in, select Y here. | 195 | To compile this driver as a module, choose M here: the module will be |
| 196 | called xen_acpi_processor If you do not know what to choose, select | ||
| 197 | M here. If the CPUFREQ drivers are built in, select Y here. | ||
| 196 | 198 | ||
| 197 | endmenu | 199 | endmenu |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index e801f226d7e0..4106264fbc65 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
| @@ -220,10 +220,12 @@ struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root) | |||
| 220 | */ | 220 | */ |
| 221 | static void add_root_to_dirty_list(struct btrfs_root *root) | 221 | static void add_root_to_dirty_list(struct btrfs_root *root) |
| 222 | { | 222 | { |
| 223 | spin_lock(&root->fs_info->trans_lock); | ||
| 223 | if (root->track_dirty && list_empty(&root->dirty_list)) { | 224 | if (root->track_dirty && list_empty(&root->dirty_list)) { |
| 224 | list_add(&root->dirty_list, | 225 | list_add(&root->dirty_list, |
| 225 | &root->fs_info->dirty_cowonly_roots); | 226 | &root->fs_info->dirty_cowonly_roots); |
| 226 | } | 227 | } |
| 228 | spin_unlock(&root->fs_info->trans_lock); | ||
| 227 | } | 229 | } |
| 228 | 230 | ||
| 229 | /* | 231 | /* |
| @@ -723,7 +725,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
| 723 | 725 | ||
| 724 | cur = btrfs_find_tree_block(root, blocknr, blocksize); | 726 | cur = btrfs_find_tree_block(root, blocknr, blocksize); |
| 725 | if (cur) | 727 | if (cur) |
| 726 | uptodate = btrfs_buffer_uptodate(cur, gen); | 728 | uptodate = btrfs_buffer_uptodate(cur, gen, 0); |
| 727 | else | 729 | else |
| 728 | uptodate = 0; | 730 | uptodate = 0; |
| 729 | if (!cur || !uptodate) { | 731 | if (!cur || !uptodate) { |
| @@ -1358,7 +1360,12 @@ static noinline int reada_for_balance(struct btrfs_root *root, | |||
| 1358 | block1 = btrfs_node_blockptr(parent, slot - 1); | 1360 | block1 = btrfs_node_blockptr(parent, slot - 1); |
| 1359 | gen = btrfs_node_ptr_generation(parent, slot - 1); | 1361 | gen = btrfs_node_ptr_generation(parent, slot - 1); |
| 1360 | eb = btrfs_find_tree_block(root, block1, blocksize); | 1362 | eb = btrfs_find_tree_block(root, block1, blocksize); |
| 1361 | if (eb && btrfs_buffer_uptodate(eb, gen)) | 1363 | /* |
| 1364 | * if we get -eagain from btrfs_buffer_uptodate, we | ||
| 1365 | * don't want to return eagain here. That will loop | ||
| 1366 | * forever | ||
| 1367 | */ | ||
| 1368 | if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) | ||
| 1362 | block1 = 0; | 1369 | block1 = 0; |
| 1363 | free_extent_buffer(eb); | 1370 | free_extent_buffer(eb); |
| 1364 | } | 1371 | } |
| @@ -1366,7 +1373,7 @@ static noinline int reada_for_balance(struct btrfs_root *root, | |||
| 1366 | block2 = btrfs_node_blockptr(parent, slot + 1); | 1373 | block2 = btrfs_node_blockptr(parent, slot + 1); |
| 1367 | gen = btrfs_node_ptr_generation(parent, slot + 1); | 1374 | gen = btrfs_node_ptr_generation(parent, slot + 1); |
| 1368 | eb = btrfs_find_tree_block(root, block2, blocksize); | 1375 | eb = btrfs_find_tree_block(root, block2, blocksize); |
| 1369 | if (eb && btrfs_buffer_uptodate(eb, gen)) | 1376 | if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) |
| 1370 | block2 = 0; | 1377 | block2 = 0; |
| 1371 | free_extent_buffer(eb); | 1378 | free_extent_buffer(eb); |
| 1372 | } | 1379 | } |
| @@ -1504,8 +1511,9 @@ read_block_for_search(struct btrfs_trans_handle *trans, | |||
| 1504 | 1511 | ||
| 1505 | tmp = btrfs_find_tree_block(root, blocknr, blocksize); | 1512 | tmp = btrfs_find_tree_block(root, blocknr, blocksize); |
| 1506 | if (tmp) { | 1513 | if (tmp) { |
| 1507 | if (btrfs_buffer_uptodate(tmp, 0)) { | 1514 | /* first we do an atomic uptodate check */ |
| 1508 | if (btrfs_buffer_uptodate(tmp, gen)) { | 1515 | if (btrfs_buffer_uptodate(tmp, 0, 1) > 0) { |
| 1516 | if (btrfs_buffer_uptodate(tmp, gen, 1) > 0) { | ||
| 1509 | /* | 1517 | /* |
| 1510 | * we found an up to date block without | 1518 | * we found an up to date block without |
| 1511 | * sleeping, return | 1519 | * sleeping, return |
| @@ -1523,8 +1531,9 @@ read_block_for_search(struct btrfs_trans_handle *trans, | |||
| 1523 | free_extent_buffer(tmp); | 1531 | free_extent_buffer(tmp); |
| 1524 | btrfs_set_path_blocking(p); | 1532 | btrfs_set_path_blocking(p); |
| 1525 | 1533 | ||
| 1534 | /* now we're allowed to do a blocking uptodate check */ | ||
| 1526 | tmp = read_tree_block(root, blocknr, blocksize, gen); | 1535 | tmp = read_tree_block(root, blocknr, blocksize, gen); |
| 1527 | if (tmp && btrfs_buffer_uptodate(tmp, gen)) { | 1536 | if (tmp && btrfs_buffer_uptodate(tmp, gen, 0) > 0) { |
| 1528 | *eb_ret = tmp; | 1537 | *eb_ret = tmp; |
| 1529 | return 0; | 1538 | return 0; |
| 1530 | } | 1539 | } |
| @@ -1559,7 +1568,7 @@ read_block_for_search(struct btrfs_trans_handle *trans, | |||
| 1559 | * and give up so that our caller doesn't loop forever | 1568 | * and give up so that our caller doesn't loop forever |
| 1560 | * on our EAGAINs. | 1569 | * on our EAGAINs. |
| 1561 | */ | 1570 | */ |
| 1562 | if (!btrfs_buffer_uptodate(tmp, 0)) | 1571 | if (!btrfs_buffer_uptodate(tmp, 0, 0)) |
| 1563 | ret = -EIO; | 1572 | ret = -EIO; |
| 1564 | free_extent_buffer(tmp); | 1573 | free_extent_buffer(tmp); |
| 1565 | } | 1574 | } |
| @@ -4043,7 +4052,7 @@ again: | |||
| 4043 | tmp = btrfs_find_tree_block(root, blockptr, | 4052 | tmp = btrfs_find_tree_block(root, blockptr, |
| 4044 | btrfs_level_size(root, level - 1)); | 4053 | btrfs_level_size(root, level - 1)); |
| 4045 | 4054 | ||
| 4046 | if (tmp && btrfs_buffer_uptodate(tmp, gen)) { | 4055 | if (tmp && btrfs_buffer_uptodate(tmp, gen, 1) > 0) { |
| 4047 | free_extent_buffer(tmp); | 4056 | free_extent_buffer(tmp); |
| 4048 | break; | 4057 | break; |
| 4049 | } | 4058 | } |
| @@ -4166,7 +4175,8 @@ next: | |||
| 4166 | struct extent_buffer *cur; | 4175 | struct extent_buffer *cur; |
| 4167 | cur = btrfs_find_tree_block(root, blockptr, | 4176 | cur = btrfs_find_tree_block(root, blockptr, |
| 4168 | btrfs_level_size(root, level - 1)); | 4177 | btrfs_level_size(root, level - 1)); |
| 4169 | if (!cur || !btrfs_buffer_uptodate(cur, gen)) { | 4178 | if (!cur || |
| 4179 | btrfs_buffer_uptodate(cur, gen, 1) <= 0) { | ||
| 4170 | slot++; | 4180 | slot++; |
| 4171 | if (cur) | 4181 | if (cur) |
| 4172 | free_extent_buffer(cur); | 4182 | free_extent_buffer(cur); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index d0c969beaad4..a7ffc88a7dbe 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -323,7 +323,8 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf, | |||
| 323 | * in the wrong place. | 323 | * in the wrong place. |
| 324 | */ | 324 | */ |
| 325 | static int verify_parent_transid(struct extent_io_tree *io_tree, | 325 | static int verify_parent_transid(struct extent_io_tree *io_tree, |
| 326 | struct extent_buffer *eb, u64 parent_transid) | 326 | struct extent_buffer *eb, u64 parent_transid, |
| 327 | int atomic) | ||
| 327 | { | 328 | { |
| 328 | struct extent_state *cached_state = NULL; | 329 | struct extent_state *cached_state = NULL; |
| 329 | int ret; | 330 | int ret; |
| @@ -331,6 +332,9 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, | |||
| 331 | if (!parent_transid || btrfs_header_generation(eb) == parent_transid) | 332 | if (!parent_transid || btrfs_header_generation(eb) == parent_transid) |
| 332 | return 0; | 333 | return 0; |
| 333 | 334 | ||
| 335 | if (atomic) | ||
| 336 | return -EAGAIN; | ||
| 337 | |||
| 334 | lock_extent_bits(io_tree, eb->start, eb->start + eb->len - 1, | 338 | lock_extent_bits(io_tree, eb->start, eb->start + eb->len - 1, |
| 335 | 0, &cached_state); | 339 | 0, &cached_state); |
| 336 | if (extent_buffer_uptodate(eb) && | 340 | if (extent_buffer_uptodate(eb) && |
| @@ -372,7 +376,8 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, | |||
| 372 | ret = read_extent_buffer_pages(io_tree, eb, start, | 376 | ret = read_extent_buffer_pages(io_tree, eb, start, |
| 373 | WAIT_COMPLETE, | 377 | WAIT_COMPLETE, |
| 374 | btree_get_extent, mirror_num); | 378 | btree_get_extent, mirror_num); |
| 375 | if (!ret && !verify_parent_transid(io_tree, eb, parent_transid)) | 379 | if (!ret && !verify_parent_transid(io_tree, eb, |
| 380 | parent_transid, 0)) | ||
| 376 | break; | 381 | break; |
| 377 | 382 | ||
| 378 | /* | 383 | /* |
| @@ -1202,7 +1207,7 @@ static int __must_check find_and_setup_root(struct btrfs_root *tree_root, | |||
| 1202 | root->commit_root = NULL; | 1207 | root->commit_root = NULL; |
| 1203 | root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item), | 1208 | root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item), |
| 1204 | blocksize, generation); | 1209 | blocksize, generation); |
| 1205 | if (!root->node || !btrfs_buffer_uptodate(root->node, generation)) { | 1210 | if (!root->node || !btrfs_buffer_uptodate(root->node, generation, 0)) { |
| 1206 | free_extent_buffer(root->node); | 1211 | free_extent_buffer(root->node); |
| 1207 | root->node = NULL; | 1212 | root->node = NULL; |
| 1208 | return -EIO; | 1213 | return -EIO; |
| @@ -3143,7 +3148,8 @@ int close_ctree(struct btrfs_root *root) | |||
| 3143 | return 0; | 3148 | return 0; |
| 3144 | } | 3149 | } |
| 3145 | 3150 | ||
| 3146 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid) | 3151 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, |
| 3152 | int atomic) | ||
| 3147 | { | 3153 | { |
| 3148 | int ret; | 3154 | int ret; |
| 3149 | struct inode *btree_inode = buf->pages[0]->mapping->host; | 3155 | struct inode *btree_inode = buf->pages[0]->mapping->host; |
| @@ -3153,7 +3159,9 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid) | |||
| 3153 | return ret; | 3159 | return ret; |
| 3154 | 3160 | ||
| 3155 | ret = verify_parent_transid(&BTRFS_I(btree_inode)->io_tree, buf, | 3161 | ret = verify_parent_transid(&BTRFS_I(btree_inode)->io_tree, buf, |
| 3156 | parent_transid); | 3162 | parent_transid, atomic); |
| 3163 | if (ret == -EAGAIN) | ||
| 3164 | return ret; | ||
| 3157 | return !ret; | 3165 | return !ret; |
| 3158 | } | 3166 | } |
| 3159 | 3167 | ||
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index a7ace1a2dd12..ab1830aaf0ed 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
| @@ -66,7 +66,8 @@ void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr); | |||
| 66 | void __btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr); | 66 | void __btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr); |
| 67 | void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root); | 67 | void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root); |
| 68 | void btrfs_mark_buffer_dirty(struct extent_buffer *buf); | 68 | void btrfs_mark_buffer_dirty(struct extent_buffer *buf); |
| 69 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid); | 69 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, |
| 70 | int atomic); | ||
| 70 | int btrfs_set_buffer_uptodate(struct extent_buffer *buf); | 71 | int btrfs_set_buffer_uptodate(struct extent_buffer *buf); |
| 71 | int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); | 72 | int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); |
| 72 | u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len); | 73 | u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 6fc2e6f5aab8..49fd7b66d57b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -6568,7 +6568,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, | |||
| 6568 | goto skip; | 6568 | goto skip; |
| 6569 | } | 6569 | } |
| 6570 | 6570 | ||
| 6571 | if (!btrfs_buffer_uptodate(next, generation)) { | 6571 | if (!btrfs_buffer_uptodate(next, generation, 0)) { |
| 6572 | btrfs_tree_unlock(next); | 6572 | btrfs_tree_unlock(next); |
| 6573 | free_extent_buffer(next); | 6573 | free_extent_buffer(next); |
| 6574 | next = NULL; | 6574 | next = NULL; |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 198c2ba2fa40..c9018a05036e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -4120,6 +4120,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, | |||
| 4120 | if (atomic_inc_not_zero(&exists->refs)) { | 4120 | if (atomic_inc_not_zero(&exists->refs)) { |
| 4121 | spin_unlock(&mapping->private_lock); | 4121 | spin_unlock(&mapping->private_lock); |
| 4122 | unlock_page(p); | 4122 | unlock_page(p); |
| 4123 | page_cache_release(p); | ||
| 4123 | mark_extent_buffer_accessed(exists); | 4124 | mark_extent_buffer_accessed(exists); |
| 4124 | goto free_eb; | 4125 | goto free_eb; |
| 4125 | } | 4126 | } |
| @@ -4199,8 +4200,7 @@ free_eb: | |||
| 4199 | unlock_page(eb->pages[i]); | 4200 | unlock_page(eb->pages[i]); |
| 4200 | } | 4201 | } |
| 4201 | 4202 | ||
| 4202 | if (!atomic_dec_and_test(&eb->refs)) | 4203 | WARN_ON(!atomic_dec_and_test(&eb->refs)); |
| 4203 | return exists; | ||
| 4204 | btrfs_release_extent_buffer(eb); | 4204 | btrfs_release_extent_buffer(eb); |
| 4205 | return exists; | 4205 | return exists; |
| 4206 | } | 4206 | } |
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h index 4f69028a68c4..086e6bdae1c4 100644 --- a/fs/btrfs/ioctl.h +++ b/fs/btrfs/ioctl.h | |||
| @@ -252,7 +252,7 @@ struct btrfs_data_container { | |||
| 252 | 252 | ||
| 253 | struct btrfs_ioctl_ino_path_args { | 253 | struct btrfs_ioctl_ino_path_args { |
| 254 | __u64 inum; /* in */ | 254 | __u64 inum; /* in */ |
| 255 | __u32 size; /* in */ | 255 | __u64 size; /* in */ |
| 256 | __u64 reserved[4]; | 256 | __u64 reserved[4]; |
| 257 | /* struct btrfs_data_container *fspath; out */ | 257 | /* struct btrfs_data_container *fspath; out */ |
| 258 | __u64 fspath; /* out */ | 258 | __u64 fspath; /* out */ |
| @@ -260,7 +260,7 @@ struct btrfs_ioctl_ino_path_args { | |||
| 260 | 260 | ||
| 261 | struct btrfs_ioctl_logical_ino_args { | 261 | struct btrfs_ioctl_logical_ino_args { |
| 262 | __u64 logical; /* in */ | 262 | __u64 logical; /* in */ |
| 263 | __u32 size; /* in */ | 263 | __u64 size; /* in */ |
| 264 | __u64 reserved[4]; | 264 | __u64 reserved[4]; |
| 265 | /* struct btrfs_data_container *inodes; out */ | 265 | /* struct btrfs_data_container *inodes; out */ |
| 266 | __u64 inodes; | 266 | __u64 inodes; |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 4f76fc3f8e89..2f3d6f917fb3 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
| @@ -998,6 +998,7 @@ static int scrub_setup_recheck_block(struct scrub_dev *sdev, | |||
| 998 | page = sblock->pagev + page_index; | 998 | page = sblock->pagev + page_index; |
| 999 | page->logical = logical; | 999 | page->logical = logical; |
| 1000 | page->physical = bbio->stripes[mirror_index].physical; | 1000 | page->physical = bbio->stripes[mirror_index].physical; |
| 1001 | /* for missing devices, bdev is NULL */ | ||
| 1001 | page->bdev = bbio->stripes[mirror_index].dev->bdev; | 1002 | page->bdev = bbio->stripes[mirror_index].dev->bdev; |
| 1002 | page->mirror_num = mirror_index + 1; | 1003 | page->mirror_num = mirror_index + 1; |
| 1003 | page->page = alloc_page(GFP_NOFS); | 1004 | page->page = alloc_page(GFP_NOFS); |
| @@ -1042,6 +1043,12 @@ static int scrub_recheck_block(struct btrfs_fs_info *fs_info, | |||
| 1042 | struct scrub_page *page = sblock->pagev + page_num; | 1043 | struct scrub_page *page = sblock->pagev + page_num; |
| 1043 | DECLARE_COMPLETION_ONSTACK(complete); | 1044 | DECLARE_COMPLETION_ONSTACK(complete); |
| 1044 | 1045 | ||
| 1046 | if (page->bdev == NULL) { | ||
| 1047 | page->io_error = 1; | ||
| 1048 | sblock->no_io_error_seen = 0; | ||
| 1049 | continue; | ||
| 1050 | } | ||
| 1051 | |||
| 1045 | BUG_ON(!page->page); | 1052 | BUG_ON(!page->page); |
| 1046 | bio = bio_alloc(GFP_NOFS, 1); | 1053 | bio = bio_alloc(GFP_NOFS, 1); |
| 1047 | if (!bio) | 1054 | if (!bio) |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index d017283ae6f5..eb1ae908582c 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
| @@ -279,7 +279,7 @@ static int process_one_buffer(struct btrfs_root *log, | |||
| 279 | log->fs_info->extent_root, | 279 | log->fs_info->extent_root, |
| 280 | eb->start, eb->len); | 280 | eb->start, eb->len); |
| 281 | 281 | ||
| 282 | if (btrfs_buffer_uptodate(eb, gen)) { | 282 | if (btrfs_buffer_uptodate(eb, gen, 0)) { |
| 283 | if (wc->write) | 283 | if (wc->write) |
| 284 | btrfs_write_tree_block(eb); | 284 | btrfs_write_tree_block(eb); |
| 285 | if (wc->wait) | 285 | if (wc->wait) |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 811245b1ff2e..541ef81f6ae8 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -442,7 +442,7 @@ cifs_show_options(struct seq_file *s, struct dentry *root) | |||
| 442 | seq_printf(s, ",rsize=%u", cifs_sb->rsize); | 442 | seq_printf(s, ",rsize=%u", cifs_sb->rsize); |
| 443 | seq_printf(s, ",wsize=%u", cifs_sb->wsize); | 443 | seq_printf(s, ",wsize=%u", cifs_sb->wsize); |
| 444 | /* convert actimeo and display it in seconds */ | 444 | /* convert actimeo and display it in seconds */ |
| 445 | seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ); | 445 | seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ); |
| 446 | 446 | ||
| 447 | return 0; | 447 | return 0; |
| 448 | } | 448 | } |
| @@ -699,7 +699,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) | |||
| 699 | * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate | 699 | * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate |
| 700 | * the cached file length | 700 | * the cached file length |
| 701 | */ | 701 | */ |
| 702 | if (origin != SEEK_SET || origin != SEEK_CUR) { | 702 | if (origin != SEEK_SET && origin != SEEK_CUR) { |
| 703 | int rc; | 703 | int rc; |
| 704 | struct inode *inode = file->f_path.dentry->d_inode; | 704 | struct inode *inode = file->f_path.dentry->d_inode; |
| 705 | 705 | ||
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index d1389bb33ceb..65365358c976 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
| @@ -125,5 +125,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
| 125 | extern const struct export_operations cifs_export_ops; | 125 | extern const struct export_operations cifs_export_ops; |
| 126 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ | 126 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ |
| 127 | 127 | ||
| 128 | #define CIFS_VERSION "1.77" | 128 | #define CIFS_VERSION "1.78" |
| 129 | #endif /* _CIFSFS_H */ | 129 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index f52c5ab78f9d..da2f5446fa7a 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
| @@ -4844,8 +4844,12 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr, | |||
| 4844 | max_len = data_end - temp; | 4844 | max_len = data_end - temp; |
| 4845 | node->node_name = cifs_strndup_from_utf16(temp, max_len, | 4845 | node->node_name = cifs_strndup_from_utf16(temp, max_len, |
| 4846 | is_unicode, nls_codepage); | 4846 | is_unicode, nls_codepage); |
| 4847 | if (!node->node_name) | 4847 | if (!node->node_name) { |
| 4848 | rc = -ENOMEM; | 4848 | rc = -ENOMEM; |
| 4849 | goto parse_DFS_referrals_exit; | ||
| 4850 | } | ||
| 4851 | |||
| 4852 | ref++; | ||
| 4849 | } | 4853 | } |
| 4850 | 4854 | ||
| 4851 | parse_DFS_referrals_exit: | 4855 | parse_DFS_referrals_exit: |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index f4d381e331ce..e0b56d7a19c5 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -164,7 +164,8 @@ static const match_table_t cifs_mount_option_tokens = { | |||
| 164 | { Opt_sign, "sign" }, | 164 | { Opt_sign, "sign" }, |
| 165 | { Opt_seal, "seal" }, | 165 | { Opt_seal, "seal" }, |
| 166 | { Opt_direct, "direct" }, | 166 | { Opt_direct, "direct" }, |
| 167 | { Opt_direct, "forceddirectio" }, | 167 | { Opt_direct, "directio" }, |
| 168 | { Opt_direct, "forcedirectio" }, | ||
| 168 | { Opt_strictcache, "strictcache" }, | 169 | { Opt_strictcache, "strictcache" }, |
| 169 | { Opt_noac, "noac" }, | 170 | { Opt_noac, "noac" }, |
| 170 | { Opt_fsc, "fsc" }, | 171 | { Opt_fsc, "fsc" }, |
| @@ -215,6 +216,8 @@ static const match_table_t cifs_mount_option_tokens = { | |||
| 215 | 216 | ||
| 216 | { Opt_ignore, "cred" }, | 217 | { Opt_ignore, "cred" }, |
| 217 | { Opt_ignore, "credentials" }, | 218 | { Opt_ignore, "credentials" }, |
| 219 | { Opt_ignore, "cred=%s" }, | ||
| 220 | { Opt_ignore, "credentials=%s" }, | ||
| 218 | { Opt_ignore, "guest" }, | 221 | { Opt_ignore, "guest" }, |
| 219 | { Opt_ignore, "rw" }, | 222 | { Opt_ignore, "rw" }, |
| 220 | { Opt_ignore, "ro" }, | 223 | { Opt_ignore, "ro" }, |
| @@ -2183,6 +2186,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) | |||
| 2183 | tcp_ses->session_estab = false; | 2186 | tcp_ses->session_estab = false; |
| 2184 | tcp_ses->sequence_number = 0; | 2187 | tcp_ses->sequence_number = 0; |
| 2185 | tcp_ses->lstrp = jiffies; | 2188 | tcp_ses->lstrp = jiffies; |
| 2189 | spin_lock_init(&tcp_ses->req_lock); | ||
| 2186 | INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); | 2190 | INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); |
| 2187 | INIT_LIST_HEAD(&tcp_ses->smb_ses_list); | 2191 | INIT_LIST_HEAD(&tcp_ses->smb_ses_list); |
| 2188 | INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request); | 2192 | INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request); |
| @@ -3614,22 +3618,6 @@ cifs_get_volume_info(char *mount_data, const char *devname) | |||
| 3614 | return volume_info; | 3618 | return volume_info; |
| 3615 | } | 3619 | } |
| 3616 | 3620 | ||
| 3617 | /* make sure ra_pages is a multiple of rsize */ | ||
| 3618 | static inline unsigned int | ||
| 3619 | cifs_ra_pages(struct cifs_sb_info *cifs_sb) | ||
| 3620 | { | ||
| 3621 | unsigned int reads; | ||
| 3622 | unsigned int rsize_pages = cifs_sb->rsize / PAGE_CACHE_SIZE; | ||
| 3623 | |||
| 3624 | if (rsize_pages >= default_backing_dev_info.ra_pages) | ||
| 3625 | return default_backing_dev_info.ra_pages; | ||
| 3626 | else if (rsize_pages == 0) | ||
| 3627 | return rsize_pages; | ||
| 3628 | |||
| 3629 | reads = default_backing_dev_info.ra_pages / rsize_pages; | ||
| 3630 | return reads * rsize_pages; | ||
| 3631 | } | ||
| 3632 | |||
| 3633 | int | 3621 | int |
| 3634 | cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) | 3622 | cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) |
| 3635 | { | 3623 | { |
| @@ -3717,7 +3705,7 @@ try_mount_again: | |||
| 3717 | cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info); | 3705 | cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info); |
| 3718 | 3706 | ||
| 3719 | /* tune readahead according to rsize */ | 3707 | /* tune readahead according to rsize */ |
| 3720 | cifs_sb->bdi.ra_pages = cifs_ra_pages(cifs_sb); | 3708 | cifs_sb->bdi.ra_pages = cifs_sb->rsize / PAGE_CACHE_SIZE; |
| 3721 | 3709 | ||
| 3722 | remote_path_check: | 3710 | remote_path_check: |
| 3723 | #ifdef CONFIG_CIFS_DFS_UPCALL | 3711 | #ifdef CONFIG_CIFS_DFS_UPCALL |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index d172c8ed9017..ec4e9a2a12f8 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
| @@ -668,12 +668,19 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) | |||
| 668 | return 0; | 668 | return 0; |
| 669 | else { | 669 | else { |
| 670 | /* | 670 | /* |
| 671 | * Forcibly invalidate automounting directory inodes | 671 | * If the inode wasn't known to be a dfs entry when |
| 672 | * (remote DFS directories) so to have them | 672 | * the dentry was instantiated, such as when created |
| 673 | * instantiated again for automount | 673 | * via ->readdir(), it needs to be set now since the |
| 674 | * attributes will have been updated by | ||
| 675 | * cifs_revalidate_dentry(). | ||
| 674 | */ | 676 | */ |
| 675 | if (IS_AUTOMOUNT(direntry->d_inode)) | 677 | if (IS_AUTOMOUNT(direntry->d_inode) && |
| 676 | return 0; | 678 | !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) { |
| 679 | spin_lock(&direntry->d_lock); | ||
| 680 | direntry->d_flags |= DCACHE_NEED_AUTOMOUNT; | ||
| 681 | spin_unlock(&direntry->d_lock); | ||
| 682 | } | ||
| 683 | |||
| 677 | return 1; | 684 | return 1; |
| 678 | } | 685 | } |
| 679 | } | 686 | } |
diff --git a/fs/dcache.c b/fs/dcache.c index b60ddc41d783..b80531c91779 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -141,18 +141,29 @@ int proc_nr_dentry(ctl_table *table, int write, void __user *buffer, | |||
| 141 | * Compare 2 name strings, return 0 if they match, otherwise non-zero. | 141 | * Compare 2 name strings, return 0 if they match, otherwise non-zero. |
| 142 | * The strings are both count bytes long, and count is non-zero. | 142 | * The strings are both count bytes long, and count is non-zero. |
| 143 | */ | 143 | */ |
| 144 | #ifdef CONFIG_DCACHE_WORD_ACCESS | ||
| 145 | |||
| 146 | #include <asm/word-at-a-time.h> | ||
| 147 | /* | ||
| 148 | * NOTE! 'cs' and 'scount' come from a dentry, so it has a | ||
| 149 | * aligned allocation for this particular component. We don't | ||
| 150 | * strictly need the load_unaligned_zeropad() safety, but it | ||
| 151 | * doesn't hurt either. | ||
| 152 | * | ||
| 153 | * In contrast, 'ct' and 'tcount' can be from a pathname, and do | ||
| 154 | * need the careful unaligned handling. | ||
| 155 | */ | ||
| 144 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, | 156 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, |
| 145 | const unsigned char *ct, size_t tcount) | 157 | const unsigned char *ct, size_t tcount) |
| 146 | { | 158 | { |
| 147 | #ifdef CONFIG_DCACHE_WORD_ACCESS | ||
| 148 | unsigned long a,b,mask; | 159 | unsigned long a,b,mask; |
| 149 | 160 | ||
| 150 | if (unlikely(scount != tcount)) | 161 | if (unlikely(scount != tcount)) |
| 151 | return 1; | 162 | return 1; |
| 152 | 163 | ||
| 153 | for (;;) { | 164 | for (;;) { |
| 154 | a = *(unsigned long *)cs; | 165 | a = load_unaligned_zeropad(cs); |
| 155 | b = *(unsigned long *)ct; | 166 | b = load_unaligned_zeropad(ct); |
| 156 | if (tcount < sizeof(unsigned long)) | 167 | if (tcount < sizeof(unsigned long)) |
| 157 | break; | 168 | break; |
| 158 | if (unlikely(a != b)) | 169 | if (unlikely(a != b)) |
| @@ -165,7 +176,13 @@ static inline int dentry_cmp(const unsigned char *cs, size_t scount, | |||
| 165 | } | 176 | } |
| 166 | mask = ~(~0ul << tcount*8); | 177 | mask = ~(~0ul << tcount*8); |
| 167 | return unlikely(!!((a ^ b) & mask)); | 178 | return unlikely(!!((a ^ b) & mask)); |
| 179 | } | ||
| 180 | |||
| 168 | #else | 181 | #else |
| 182 | |||
| 183 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, | ||
| 184 | const unsigned char *ct, size_t tcount) | ||
| 185 | { | ||
| 169 | if (scount != tcount) | 186 | if (scount != tcount) |
| 170 | return 1; | 187 | return 1; |
| 171 | 188 | ||
| @@ -177,9 +194,10 @@ static inline int dentry_cmp(const unsigned char *cs, size_t scount, | |||
| 177 | tcount--; | 194 | tcount--; |
| 178 | } while (tcount); | 195 | } while (tcount); |
| 179 | return 0; | 196 | return 0; |
| 180 | #endif | ||
| 181 | } | 197 | } |
| 182 | 198 | ||
| 199 | #endif | ||
| 200 | |||
| 183 | static void __d_free(struct rcu_head *head) | 201 | static void __d_free(struct rcu_head *head) |
| 184 | { | 202 | { |
| 185 | struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); | 203 | struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); |
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index 4dfbfec357e8..ec2a9c23f0c9 100644 --- a/fs/hfsplus/catalog.c +++ b/fs/hfsplus/catalog.c | |||
| @@ -366,6 +366,10 @@ int hfsplus_rename_cat(u32 cnid, | |||
| 366 | err = hfs_brec_find(&src_fd); | 366 | err = hfs_brec_find(&src_fd); |
| 367 | if (err) | 367 | if (err) |
| 368 | goto out; | 368 | goto out; |
| 369 | if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) { | ||
| 370 | err = -EIO; | ||
| 371 | goto out; | ||
| 372 | } | ||
| 369 | 373 | ||
| 370 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, | 374 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, |
| 371 | src_fd.entrylength); | 375 | src_fd.entrylength); |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 88e155f895c6..26b53fb09f68 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
| @@ -150,6 +150,11 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 150 | filp->f_pos++; | 150 | filp->f_pos++; |
| 151 | /* fall through */ | 151 | /* fall through */ |
| 152 | case 1: | 152 | case 1: |
| 153 | if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { | ||
| 154 | err = -EIO; | ||
| 155 | goto out; | ||
| 156 | } | ||
| 157 | |||
| 153 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, | 158 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, |
| 154 | fd.entrylength); | 159 | fd.entrylength); |
| 155 | if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { | 160 | if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { |
| @@ -181,6 +186,12 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 181 | err = -EIO; | 186 | err = -EIO; |
| 182 | goto out; | 187 | goto out; |
| 183 | } | 188 | } |
| 189 | |||
| 190 | if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { | ||
| 191 | err = -EIO; | ||
| 192 | goto out; | ||
| 193 | } | ||
| 194 | |||
| 184 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, | 195 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, |
| 185 | fd.entrylength); | 196 | fd.entrylength); |
| 186 | type = be16_to_cpu(entry.type); | 197 | type = be16_to_cpu(entry.type); |
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c index ad271c70aa25..5a2dec2b064c 100644 --- a/fs/jffs2/gc.c +++ b/fs/jffs2/gc.c | |||
| @@ -234,8 +234,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
| 234 | return 0; | 234 | return 0; |
| 235 | 235 | ||
| 236 | jffs2_dbg(1, "No progress from erasing block; doing GC anyway\n"); | 236 | jffs2_dbg(1, "No progress from erasing block; doing GC anyway\n"); |
| 237 | spin_lock(&c->erase_completion_lock); | ||
| 238 | mutex_lock(&c->alloc_sem); | 237 | mutex_lock(&c->alloc_sem); |
| 238 | spin_lock(&c->erase_completion_lock); | ||
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | /* First, work out which block we're garbage-collecting */ | 241 | /* First, work out which block we're garbage-collecting */ |
diff --git a/fs/namei.c b/fs/namei.c index 0062dd17eb55..c42791914f82 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -1429,7 +1429,7 @@ unsigned int full_name_hash(const unsigned char *name, unsigned int len) | |||
| 1429 | unsigned long hash = 0; | 1429 | unsigned long hash = 0; |
| 1430 | 1430 | ||
| 1431 | for (;;) { | 1431 | for (;;) { |
| 1432 | a = *(unsigned long *)name; | 1432 | a = load_unaligned_zeropad(name); |
| 1433 | if (len < sizeof(unsigned long)) | 1433 | if (len < sizeof(unsigned long)) |
| 1434 | break; | 1434 | break; |
| 1435 | hash += a; | 1435 | hash += a; |
| @@ -1459,7 +1459,7 @@ static inline unsigned long hash_name(const char *name, unsigned int *hashp) | |||
| 1459 | do { | 1459 | do { |
| 1460 | hash = (hash + a) * 9; | 1460 | hash = (hash + a) * 9; |
| 1461 | len += sizeof(unsigned long); | 1461 | len += sizeof(unsigned long); |
| 1462 | a = *(unsigned long *)(name+len); | 1462 | a = load_unaligned_zeropad(name+len); |
| 1463 | /* Do we have any NUL or '/' bytes in this word? */ | 1463 | /* Do we have any NUL or '/' bytes in this word? */ |
| 1464 | mask = has_zero(a) | has_zero(a ^ REPEAT_BYTE('/')); | 1464 | mask = has_zero(a) | has_zero(a ^ REPEAT_BYTE('/')); |
| 1465 | } while (!mask); | 1465 | } while (!mask); |
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 9c94297bb70e..7f6a23f0244e 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
| @@ -38,6 +38,8 @@ | |||
| 38 | #include <linux/buffer_head.h> /* various write calls */ | 38 | #include <linux/buffer_head.h> /* various write calls */ |
| 39 | #include <linux/prefetch.h> | 39 | #include <linux/prefetch.h> |
| 40 | 40 | ||
| 41 | #include "../pnfs.h" | ||
| 42 | #include "../internal.h" | ||
| 41 | #include "blocklayout.h" | 43 | #include "blocklayout.h" |
| 42 | 44 | ||
| 43 | #define NFSDBG_FACILITY NFSDBG_PNFS_LD | 45 | #define NFSDBG_FACILITY NFSDBG_PNFS_LD |
| @@ -868,7 +870,7 @@ nfs4_blk_get_deviceinfo(struct nfs_server *server, const struct nfs_fh *fh, | |||
| 868 | * GETDEVICEINFO's maxcount | 870 | * GETDEVICEINFO's maxcount |
| 869 | */ | 871 | */ |
| 870 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; | 872 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; |
| 871 | max_pages = max_resp_sz >> PAGE_SHIFT; | 873 | max_pages = nfs_page_array_len(0, max_resp_sz); |
| 872 | dprintk("%s max_resp_sz %u max_pages %d\n", | 874 | dprintk("%s max_resp_sz %u max_pages %d\n", |
| 873 | __func__, max_resp_sz, max_pages); | 875 | __func__, max_resp_sz, max_pages); |
| 874 | 876 | ||
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index da7b5e4ff9ec..60f7e4ec842c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
| @@ -1729,7 +1729,8 @@ error: | |||
| 1729 | */ | 1729 | */ |
| 1730 | struct nfs_server *nfs_clone_server(struct nfs_server *source, | 1730 | struct nfs_server *nfs_clone_server(struct nfs_server *source, |
| 1731 | struct nfs_fh *fh, | 1731 | struct nfs_fh *fh, |
| 1732 | struct nfs_fattr *fattr) | 1732 | struct nfs_fattr *fattr, |
| 1733 | rpc_authflavor_t flavor) | ||
| 1733 | { | 1734 | { |
| 1734 | struct nfs_server *server; | 1735 | struct nfs_server *server; |
| 1735 | struct nfs_fattr *fattr_fsinfo; | 1736 | struct nfs_fattr *fattr_fsinfo; |
| @@ -1758,7 +1759,7 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, | |||
| 1758 | 1759 | ||
| 1759 | error = nfs_init_server_rpcclient(server, | 1760 | error = nfs_init_server_rpcclient(server, |
| 1760 | source->client->cl_timeout, | 1761 | source->client->cl_timeout, |
| 1761 | source->client->cl_auth->au_flavor); | 1762 | flavor); |
| 1762 | if (error < 0) | 1763 | if (error < 0) |
| 1763 | goto out_free_server; | 1764 | goto out_free_server; |
| 1764 | if (!IS_ERR(source->client_acl)) | 1765 | if (!IS_ERR(source->client_acl)) |
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index b7f348bb618b..ba3019f5934c 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
| @@ -554,12 +554,16 @@ static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event, | |||
| 554 | struct nfs_client *clp; | 554 | struct nfs_client *clp; |
| 555 | int error = 0; | 555 | int error = 0; |
| 556 | 556 | ||
| 557 | if (!try_module_get(THIS_MODULE)) | ||
| 558 | return 0; | ||
| 559 | |||
| 557 | while ((clp = nfs_get_client_for_event(sb->s_fs_info, event))) { | 560 | while ((clp = nfs_get_client_for_event(sb->s_fs_info, event))) { |
| 558 | error = __rpc_pipefs_event(clp, event, sb); | 561 | error = __rpc_pipefs_event(clp, event, sb); |
| 559 | nfs_put_client(clp); | 562 | nfs_put_client(clp); |
| 560 | if (error) | 563 | if (error) |
| 561 | break; | 564 | break; |
| 562 | } | 565 | } |
| 566 | module_put(THIS_MODULE); | ||
| 563 | return error; | 567 | return error; |
| 564 | } | 568 | } |
| 565 | 569 | ||
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 2476dc69365f..b777bdaba4c5 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
| @@ -165,7 +165,8 @@ extern struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *, | |||
| 165 | extern void nfs_free_server(struct nfs_server *server); | 165 | extern void nfs_free_server(struct nfs_server *server); |
| 166 | extern struct nfs_server *nfs_clone_server(struct nfs_server *, | 166 | extern struct nfs_server *nfs_clone_server(struct nfs_server *, |
| 167 | struct nfs_fh *, | 167 | struct nfs_fh *, |
| 168 | struct nfs_fattr *); | 168 | struct nfs_fattr *, |
| 169 | rpc_authflavor_t); | ||
| 169 | extern void nfs_mark_client_ready(struct nfs_client *clp, int state); | 170 | extern void nfs_mark_client_ready(struct nfs_client *clp, int state); |
| 170 | extern int nfs4_check_client_ready(struct nfs_client *clp); | 171 | extern int nfs4_check_client_ready(struct nfs_client *clp); |
| 171 | extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, | 172 | extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, |
| @@ -186,10 +187,10 @@ static inline void nfs_fs_proc_exit(void) | |||
| 186 | 187 | ||
| 187 | /* nfs4namespace.c */ | 188 | /* nfs4namespace.c */ |
| 188 | #ifdef CONFIG_NFS_V4 | 189 | #ifdef CONFIG_NFS_V4 |
| 189 | extern struct vfsmount *nfs_do_refmount(struct dentry *dentry); | 190 | extern struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *dentry); |
| 190 | #else | 191 | #else |
| 191 | static inline | 192 | static inline |
| 192 | struct vfsmount *nfs_do_refmount(struct dentry *dentry) | 193 | struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *dentry) |
| 193 | { | 194 | { |
| 194 | return ERR_PTR(-ENOENT); | 195 | return ERR_PTR(-ENOENT); |
| 195 | } | 196 | } |
| @@ -234,7 +235,6 @@ extern const u32 nfs41_maxwrite_overhead; | |||
| 234 | /* nfs4proc.c */ | 235 | /* nfs4proc.c */ |
| 235 | #ifdef CONFIG_NFS_V4 | 236 | #ifdef CONFIG_NFS_V4 |
| 236 | extern struct rpc_procinfo nfs4_procedures[]; | 237 | extern struct rpc_procinfo nfs4_procedures[]; |
| 237 | void nfs_fixup_secinfo_attributes(struct nfs_fattr *, struct nfs_fh *); | ||
| 238 | #endif | 238 | #endif |
| 239 | 239 | ||
| 240 | extern int nfs4_init_ds_session(struct nfs_client *clp); | 240 | extern int nfs4_init_ds_session(struct nfs_client *clp); |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 1807866bb3ab..d51868e5683c 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
| @@ -148,66 +148,31 @@ rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *flavors) | |||
| 148 | return pseudoflavor; | 148 | return pseudoflavor; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | static int nfs_negotiate_security(const struct dentry *parent, | 151 | static struct rpc_clnt *nfs_lookup_mountpoint(struct inode *dir, |
| 152 | const struct dentry *dentry, | 152 | struct qstr *name, |
| 153 | rpc_authflavor_t *flavor) | 153 | struct nfs_fh *fh, |
| 154 | struct nfs_fattr *fattr) | ||
| 154 | { | 155 | { |
| 155 | struct page *page; | ||
| 156 | struct nfs4_secinfo_flavors *flavors; | ||
| 157 | int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); | ||
| 158 | int ret = -EPERM; | ||
| 159 | |||
| 160 | secinfo = NFS_PROTO(parent->d_inode)->secinfo; | ||
| 161 | if (secinfo != NULL) { | ||
| 162 | page = alloc_page(GFP_KERNEL); | ||
| 163 | if (!page) { | ||
| 164 | ret = -ENOMEM; | ||
| 165 | goto out; | ||
| 166 | } | ||
| 167 | flavors = page_address(page); | ||
| 168 | ret = secinfo(parent->d_inode, &dentry->d_name, flavors); | ||
| 169 | *flavor = nfs_find_best_sec(flavors); | ||
| 170 | put_page(page); | ||
| 171 | } | ||
| 172 | |||
| 173 | out: | ||
| 174 | return ret; | ||
| 175 | } | ||
| 176 | |||
| 177 | static int nfs_lookup_with_sec(struct nfs_server *server, struct dentry *parent, | ||
| 178 | struct dentry *dentry, struct path *path, | ||
| 179 | struct nfs_fh *fh, struct nfs_fattr *fattr, | ||
| 180 | rpc_authflavor_t *flavor) | ||
| 181 | { | ||
| 182 | struct rpc_clnt *clone; | ||
| 183 | struct rpc_auth *auth; | ||
| 184 | int err; | 156 | int err; |
| 185 | 157 | ||
| 186 | err = nfs_negotiate_security(parent, path->dentry, flavor); | 158 | if (NFS_PROTO(dir)->version == 4) |
| 187 | if (err < 0) | 159 | return nfs4_proc_lookup_mountpoint(dir, name, fh, fattr); |
| 188 | goto out; | 160 | |
| 189 | clone = rpc_clone_client(server->client); | 161 | err = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, name, fh, fattr); |
| 190 | auth = rpcauth_create(*flavor, clone); | 162 | if (err) |
| 191 | if (!auth) { | 163 | return ERR_PTR(err); |
| 192 | err = -EIO; | 164 | return rpc_clone_client(NFS_SERVER(dir)->client); |
| 193 | goto out_shutdown; | ||
| 194 | } | ||
| 195 | err = server->nfs_client->rpc_ops->lookup(clone, parent->d_inode, | ||
| 196 | &path->dentry->d_name, | ||
| 197 | fh, fattr); | ||
| 198 | out_shutdown: | ||
| 199 | rpc_shutdown_client(clone); | ||
| 200 | out: | ||
| 201 | return err; | ||
| 202 | } | 165 | } |
| 203 | #else /* CONFIG_NFS_V4 */ | 166 | #else /* CONFIG_NFS_V4 */ |
| 204 | static inline int nfs_lookup_with_sec(struct nfs_server *server, | 167 | static inline struct rpc_clnt *nfs_lookup_mountpoint(struct inode *dir, |
| 205 | struct dentry *parent, struct dentry *dentry, | 168 | struct qstr *name, |
| 206 | struct path *path, struct nfs_fh *fh, | 169 | struct nfs_fh *fh, |
| 207 | struct nfs_fattr *fattr, | 170 | struct nfs_fattr *fattr) |
| 208 | rpc_authflavor_t *flavor) | ||
| 209 | { | 171 | { |
| 210 | return -EPERM; | 172 | int err = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, name, fh, fattr); |
| 173 | if (err) | ||
| 174 | return ERR_PTR(err); | ||
| 175 | return rpc_clone_client(NFS_SERVER(dir)->client); | ||
| 211 | } | 176 | } |
| 212 | #endif /* CONFIG_NFS_V4 */ | 177 | #endif /* CONFIG_NFS_V4 */ |
| 213 | 178 | ||
| @@ -226,12 +191,10 @@ static inline int nfs_lookup_with_sec(struct nfs_server *server, | |||
| 226 | struct vfsmount *nfs_d_automount(struct path *path) | 191 | struct vfsmount *nfs_d_automount(struct path *path) |
| 227 | { | 192 | { |
| 228 | struct vfsmount *mnt; | 193 | struct vfsmount *mnt; |
| 229 | struct nfs_server *server = NFS_SERVER(path->dentry->d_inode); | ||
| 230 | struct dentry *parent; | 194 | struct dentry *parent; |
| 231 | struct nfs_fh *fh = NULL; | 195 | struct nfs_fh *fh = NULL; |
| 232 | struct nfs_fattr *fattr = NULL; | 196 | struct nfs_fattr *fattr = NULL; |
| 233 | int err; | 197 | struct rpc_clnt *client; |
| 234 | rpc_authflavor_t flavor = RPC_AUTH_UNIX; | ||
| 235 | 198 | ||
| 236 | dprintk("--> nfs_d_automount()\n"); | 199 | dprintk("--> nfs_d_automount()\n"); |
| 237 | 200 | ||
| @@ -249,21 +212,19 @@ struct vfsmount *nfs_d_automount(struct path *path) | |||
| 249 | 212 | ||
| 250 | /* Look it up again to get its attributes */ | 213 | /* Look it up again to get its attributes */ |
| 251 | parent = dget_parent(path->dentry); | 214 | parent = dget_parent(path->dentry); |
| 252 | err = server->nfs_client->rpc_ops->lookup(server->client, parent->d_inode, | 215 | client = nfs_lookup_mountpoint(parent->d_inode, &path->dentry->d_name, fh, fattr); |
| 253 | &path->dentry->d_name, | ||
| 254 | fh, fattr); | ||
| 255 | if (err == -EPERM && NFS_PROTO(parent->d_inode)->secinfo != NULL) | ||
| 256 | err = nfs_lookup_with_sec(server, parent, path->dentry, path, fh, fattr, &flavor); | ||
| 257 | dput(parent); | 216 | dput(parent); |
| 258 | if (err != 0) { | 217 | if (IS_ERR(client)) { |
| 259 | mnt = ERR_PTR(err); | 218 | mnt = ERR_CAST(client); |
| 260 | goto out; | 219 | goto out; |
| 261 | } | 220 | } |
| 262 | 221 | ||
| 263 | if (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) | 222 | if (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) |
| 264 | mnt = nfs_do_refmount(path->dentry); | 223 | mnt = nfs_do_refmount(client, path->dentry); |
| 265 | else | 224 | else |
| 266 | mnt = nfs_do_submount(path->dentry, fh, fattr, flavor); | 225 | mnt = nfs_do_submount(path->dentry, fh, fattr, client->cl_auth->au_flavor); |
| 226 | rpc_shutdown_client(client); | ||
| 227 | |||
| 267 | if (IS_ERR(mnt)) | 228 | if (IS_ERR(mnt)) |
| 268 | goto out; | 229 | goto out; |
| 269 | 230 | ||
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index b6db9e33fb7b..8d75021020b3 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
| @@ -205,6 +205,9 @@ struct nfs4_state_maintenance_ops { | |||
| 205 | extern const struct dentry_operations nfs4_dentry_operations; | 205 | extern const struct dentry_operations nfs4_dentry_operations; |
| 206 | extern const struct inode_operations nfs4_dir_inode_operations; | 206 | extern const struct inode_operations nfs4_dir_inode_operations; |
| 207 | 207 | ||
| 208 | /* nfs4namespace.c */ | ||
| 209 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *, struct inode *, struct qstr *); | ||
| 210 | |||
| 208 | /* nfs4proc.c */ | 211 | /* nfs4proc.c */ |
| 209 | extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); | 212 | extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); |
| 210 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); | 213 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); |
| @@ -213,8 +216,11 @@ extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *); | |||
| 213 | extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); | 216 | extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); |
| 214 | extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc); | 217 | extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc); |
| 215 | extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); | 218 | extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); |
| 216 | extern int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | 219 | extern int nfs4_proc_fs_locations(struct rpc_clnt *, struct inode *, const struct qstr *, |
| 217 | struct nfs4_fs_locations *fs_locations, struct page *page); | 220 | struct nfs4_fs_locations *, struct page *); |
| 221 | extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, struct qstr *, | ||
| 222 | struct nfs_fh *, struct nfs_fattr *); | ||
| 223 | extern int nfs4_proc_secinfo(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); | ||
| 218 | extern int nfs4_release_lockowner(struct nfs4_lock_state *); | 224 | extern int nfs4_release_lockowner(struct nfs4_lock_state *); |
| 219 | extern const struct xattr_handler *nfs4_xattr_handlers[]; | 225 | extern const struct xattr_handler *nfs4_xattr_handlers[]; |
| 220 | 226 | ||
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index a866bbd2890a..c9cff9adb2d3 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
| @@ -699,7 +699,7 @@ get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_fla | |||
| 699 | * GETDEVICEINFO's maxcount | 699 | * GETDEVICEINFO's maxcount |
| 700 | */ | 700 | */ |
| 701 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; | 701 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; |
| 702 | max_pages = max_resp_sz >> PAGE_SHIFT; | 702 | max_pages = nfs_page_array_len(0, max_resp_sz); |
| 703 | dprintk("%s inode %p max_resp_sz %u max_pages %d\n", | 703 | dprintk("%s inode %p max_resp_sz %u max_pages %d\n", |
| 704 | __func__, inode, max_resp_sz, max_pages); | 704 | __func__, inode, max_resp_sz, max_pages); |
| 705 | 705 | ||
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 9c8eca315f43..a7f3dedc4ec7 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
| @@ -52,6 +52,30 @@ Elong: | |||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | /* | 54 | /* |
| 55 | * return the path component of "<server>:<path>" | ||
| 56 | * nfspath - the "<server>:<path>" string | ||
| 57 | * end - one past the last char that could contain "<server>:" | ||
| 58 | * returns NULL on failure | ||
| 59 | */ | ||
| 60 | static char *nfs_path_component(const char *nfspath, const char *end) | ||
| 61 | { | ||
| 62 | char *p; | ||
| 63 | |||
| 64 | if (*nfspath == '[') { | ||
| 65 | /* parse [] escaped IPv6 addrs */ | ||
| 66 | p = strchr(nfspath, ']'); | ||
| 67 | if (p != NULL && ++p < end && *p == ':') | ||
| 68 | return p + 1; | ||
| 69 | } else { | ||
| 70 | /* otherwise split on first colon */ | ||
| 71 | p = strchr(nfspath, ':'); | ||
| 72 | if (p != NULL && p < end) | ||
| 73 | return p + 1; | ||
| 74 | } | ||
| 75 | return NULL; | ||
| 76 | } | ||
| 77 | |||
| 78 | /* | ||
| 55 | * Determine the mount path as a string | 79 | * Determine the mount path as a string |
| 56 | */ | 80 | */ |
| 57 | static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) | 81 | static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) |
| @@ -59,9 +83,9 @@ static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) | |||
| 59 | char *limit; | 83 | char *limit; |
| 60 | char *path = nfs_path(&limit, dentry, buffer, buflen); | 84 | char *path = nfs_path(&limit, dentry, buffer, buflen); |
| 61 | if (!IS_ERR(path)) { | 85 | if (!IS_ERR(path)) { |
| 62 | char *colon = strchr(path, ':'); | 86 | char *path_component = nfs_path_component(path, limit); |
| 63 | if (colon && colon < limit) | 87 | if (path_component) |
| 64 | path = colon + 1; | 88 | return path_component; |
| 65 | } | 89 | } |
| 66 | return path; | 90 | return path; |
| 67 | } | 91 | } |
| @@ -108,6 +132,58 @@ static size_t nfs_parse_server_name(char *string, size_t len, | |||
| 108 | return ret; | 132 | return ret; |
| 109 | } | 133 | } |
| 110 | 134 | ||
| 135 | static rpc_authflavor_t nfs4_negotiate_security(struct inode *inode, struct qstr *name) | ||
| 136 | { | ||
| 137 | struct page *page; | ||
| 138 | struct nfs4_secinfo_flavors *flavors; | ||
| 139 | rpc_authflavor_t flavor; | ||
| 140 | int err; | ||
| 141 | |||
| 142 | page = alloc_page(GFP_KERNEL); | ||
| 143 | if (!page) | ||
| 144 | return -ENOMEM; | ||
| 145 | flavors = page_address(page); | ||
| 146 | |||
| 147 | err = nfs4_proc_secinfo(inode, name, flavors); | ||
| 148 | if (err < 0) { | ||
| 149 | flavor = err; | ||
| 150 | goto out; | ||
| 151 | } | ||
| 152 | |||
| 153 | flavor = nfs_find_best_sec(flavors); | ||
| 154 | |||
| 155 | out: | ||
| 156 | put_page(page); | ||
| 157 | return flavor; | ||
| 158 | } | ||
| 159 | |||
| 160 | /* | ||
| 161 | * Please call rpc_shutdown_client() when you are done with this client. | ||
| 162 | */ | ||
| 163 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *clnt, struct inode *inode, | ||
| 164 | struct qstr *name) | ||
| 165 | { | ||
| 166 | struct rpc_clnt *clone; | ||
| 167 | struct rpc_auth *auth; | ||
| 168 | rpc_authflavor_t flavor; | ||
| 169 | |||
| 170 | flavor = nfs4_negotiate_security(inode, name); | ||
| 171 | if (flavor < 0) | ||
| 172 | return ERR_PTR(flavor); | ||
| 173 | |||
| 174 | clone = rpc_clone_client(clnt); | ||
| 175 | if (IS_ERR(clone)) | ||
| 176 | return clone; | ||
| 177 | |||
| 178 | auth = rpcauth_create(flavor, clone); | ||
| 179 | if (!auth) { | ||
| 180 | rpc_shutdown_client(clone); | ||
| 181 | clone = ERR_PTR(-EIO); | ||
| 182 | } | ||
| 183 | |||
| 184 | return clone; | ||
| 185 | } | ||
| 186 | |||
| 111 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, | 187 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, |
| 112 | char *page, char *page2, | 188 | char *page, char *page2, |
| 113 | const struct nfs4_fs_location *location) | 189 | const struct nfs4_fs_location *location) |
| @@ -224,7 +300,7 @@ out: | |||
| 224 | * @dentry - dentry of referral | 300 | * @dentry - dentry of referral |
| 225 | * | 301 | * |
| 226 | */ | 302 | */ |
| 227 | struct vfsmount *nfs_do_refmount(struct dentry *dentry) | 303 | struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *dentry) |
| 228 | { | 304 | { |
| 229 | struct vfsmount *mnt = ERR_PTR(-ENOMEM); | 305 | struct vfsmount *mnt = ERR_PTR(-ENOMEM); |
| 230 | struct dentry *parent; | 306 | struct dentry *parent; |
| @@ -250,7 +326,7 @@ struct vfsmount *nfs_do_refmount(struct dentry *dentry) | |||
| 250 | dprintk("%s: getting locations for %s/%s\n", | 326 | dprintk("%s: getting locations for %s/%s\n", |
| 251 | __func__, parent->d_name.name, dentry->d_name.name); | 327 | __func__, parent->d_name.name, dentry->d_name.name); |
| 252 | 328 | ||
| 253 | err = nfs4_proc_fs_locations(parent->d_inode, &dentry->d_name, fs_locations, page); | 329 | err = nfs4_proc_fs_locations(client, parent->d_inode, &dentry->d_name, fs_locations, page); |
| 254 | dput(parent); | 330 | dput(parent); |
| 255 | if (err != 0 || | 331 | if (err != 0 || |
| 256 | fs_locations->nlocations <= 0 || | 332 | fs_locations->nlocations <= 0 || |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 60d5f4c26dda..99650aaf8937 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -2377,8 +2377,9 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 2377 | * Note that we'll actually follow the referral later when | 2377 | * Note that we'll actually follow the referral later when |
| 2378 | * we detect fsid mismatch in inode revalidation | 2378 | * we detect fsid mismatch in inode revalidation |
| 2379 | */ | 2379 | */ |
| 2380 | static int nfs4_get_referral(struct inode *dir, const struct qstr *name, | 2380 | static int nfs4_get_referral(struct rpc_clnt *client, struct inode *dir, |
| 2381 | struct nfs_fattr *fattr, struct nfs_fh *fhandle) | 2381 | const struct qstr *name, struct nfs_fattr *fattr, |
| 2382 | struct nfs_fh *fhandle) | ||
| 2382 | { | 2383 | { |
| 2383 | int status = -ENOMEM; | 2384 | int status = -ENOMEM; |
| 2384 | struct page *page = NULL; | 2385 | struct page *page = NULL; |
| @@ -2391,7 +2392,7 @@ static int nfs4_get_referral(struct inode *dir, const struct qstr *name, | |||
| 2391 | if (locations == NULL) | 2392 | if (locations == NULL) |
| 2392 | goto out; | 2393 | goto out; |
| 2393 | 2394 | ||
| 2394 | status = nfs4_proc_fs_locations(dir, name, locations, page); | 2395 | status = nfs4_proc_fs_locations(client, dir, name, locations, page); |
| 2395 | if (status != 0) | 2396 | if (status != 0) |
| 2396 | goto out; | 2397 | goto out; |
| 2397 | /* Make sure server returned a different fsid for the referral */ | 2398 | /* Make sure server returned a different fsid for the referral */ |
| @@ -2528,39 +2529,84 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, | |||
| 2528 | return status; | 2529 | return status; |
| 2529 | } | 2530 | } |
| 2530 | 2531 | ||
| 2531 | void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr, struct nfs_fh *fh) | 2532 | static void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr) |
| 2532 | { | 2533 | { |
| 2533 | memset(fh, 0, sizeof(struct nfs_fh)); | ||
| 2534 | fattr->fsid.major = 1; | ||
| 2535 | fattr->valid |= NFS_ATTR_FATTR_TYPE | NFS_ATTR_FATTR_MODE | | 2534 | fattr->valid |= NFS_ATTR_FATTR_TYPE | NFS_ATTR_FATTR_MODE | |
| 2536 | NFS_ATTR_FATTR_NLINK | NFS_ATTR_FATTR_FSID | NFS_ATTR_FATTR_MOUNTPOINT; | 2535 | NFS_ATTR_FATTR_NLINK | NFS_ATTR_FATTR_MOUNTPOINT; |
| 2537 | fattr->mode = S_IFDIR | S_IRUGO | S_IXUGO; | 2536 | fattr->mode = S_IFDIR | S_IRUGO | S_IXUGO; |
| 2538 | fattr->nlink = 2; | 2537 | fattr->nlink = 2; |
| 2539 | } | 2538 | } |
| 2540 | 2539 | ||
| 2541 | static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name, | 2540 | static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, |
| 2542 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | 2541 | struct qstr *name, struct nfs_fh *fhandle, |
| 2542 | struct nfs_fattr *fattr) | ||
| 2543 | { | 2543 | { |
| 2544 | struct nfs4_exception exception = { }; | 2544 | struct nfs4_exception exception = { }; |
| 2545 | struct rpc_clnt *client = *clnt; | ||
| 2545 | int err; | 2546 | int err; |
| 2546 | do { | 2547 | do { |
| 2547 | int status; | 2548 | err = _nfs4_proc_lookup(client, dir, name, fhandle, fattr); |
| 2548 | 2549 | switch (err) { | |
| 2549 | status = _nfs4_proc_lookup(clnt, dir, name, fhandle, fattr); | ||
| 2550 | switch (status) { | ||
| 2551 | case -NFS4ERR_BADNAME: | 2550 | case -NFS4ERR_BADNAME: |
| 2552 | return -ENOENT; | 2551 | err = -ENOENT; |
| 2552 | goto out; | ||
| 2553 | case -NFS4ERR_MOVED: | 2553 | case -NFS4ERR_MOVED: |
| 2554 | return nfs4_get_referral(dir, name, fattr, fhandle); | 2554 | err = nfs4_get_referral(client, dir, name, fattr, fhandle); |
| 2555 | goto out; | ||
| 2555 | case -NFS4ERR_WRONGSEC: | 2556 | case -NFS4ERR_WRONGSEC: |
| 2556 | nfs_fixup_secinfo_attributes(fattr, fhandle); | 2557 | err = -EPERM; |
| 2558 | if (client != *clnt) | ||
| 2559 | goto out; | ||
| 2560 | |||
| 2561 | client = nfs4_create_sec_client(client, dir, name); | ||
| 2562 | if (IS_ERR(client)) | ||
| 2563 | return PTR_ERR(client); | ||
| 2564 | |||
| 2565 | exception.retry = 1; | ||
| 2566 | break; | ||
| 2567 | default: | ||
| 2568 | err = nfs4_handle_exception(NFS_SERVER(dir), err, &exception); | ||
| 2557 | } | 2569 | } |
| 2558 | err = nfs4_handle_exception(NFS_SERVER(dir), | ||
| 2559 | status, &exception); | ||
| 2560 | } while (exception.retry); | 2570 | } while (exception.retry); |
| 2571 | |||
| 2572 | out: | ||
| 2573 | if (err == 0) | ||
| 2574 | *clnt = client; | ||
| 2575 | else if (client != *clnt) | ||
| 2576 | rpc_shutdown_client(client); | ||
| 2577 | |||
| 2561 | return err; | 2578 | return err; |
| 2562 | } | 2579 | } |
| 2563 | 2580 | ||
| 2581 | static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name, | ||
| 2582 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | ||
| 2583 | { | ||
| 2584 | int status; | ||
| 2585 | struct rpc_clnt *client = NFS_CLIENT(dir); | ||
| 2586 | |||
| 2587 | status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr); | ||
| 2588 | if (client != NFS_CLIENT(dir)) { | ||
| 2589 | rpc_shutdown_client(client); | ||
| 2590 | nfs_fixup_secinfo_attributes(fattr); | ||
| 2591 | } | ||
| 2592 | return status; | ||
| 2593 | } | ||
| 2594 | |||
| 2595 | struct rpc_clnt * | ||
| 2596 | nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name, | ||
| 2597 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | ||
| 2598 | { | ||
| 2599 | int status; | ||
| 2600 | struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir)); | ||
| 2601 | |||
| 2602 | status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr); | ||
| 2603 | if (status < 0) { | ||
| 2604 | rpc_shutdown_client(client); | ||
| 2605 | return ERR_PTR(status); | ||
| 2606 | } | ||
| 2607 | return client; | ||
| 2608 | } | ||
| 2609 | |||
| 2564 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) | 2610 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) |
| 2565 | { | 2611 | { |
| 2566 | struct nfs_server *server = NFS_SERVER(inode); | 2612 | struct nfs_server *server = NFS_SERVER(inode); |
| @@ -3628,16 +3674,16 @@ out: | |||
| 3628 | return ret; | 3674 | return ret; |
| 3629 | } | 3675 | } |
| 3630 | 3676 | ||
| 3631 | static void nfs4_write_cached_acl(struct inode *inode, const char *buf, size_t acl_len) | 3677 | static void nfs4_write_cached_acl(struct inode *inode, struct page **pages, size_t pgbase, size_t acl_len) |
| 3632 | { | 3678 | { |
| 3633 | struct nfs4_cached_acl *acl; | 3679 | struct nfs4_cached_acl *acl; |
| 3634 | 3680 | ||
| 3635 | if (buf && acl_len <= PAGE_SIZE) { | 3681 | if (pages && acl_len <= PAGE_SIZE) { |
| 3636 | acl = kmalloc(sizeof(*acl) + acl_len, GFP_KERNEL); | 3682 | acl = kmalloc(sizeof(*acl) + acl_len, GFP_KERNEL); |
| 3637 | if (acl == NULL) | 3683 | if (acl == NULL) |
| 3638 | goto out; | 3684 | goto out; |
| 3639 | acl->cached = 1; | 3685 | acl->cached = 1; |
| 3640 | memcpy(acl->data, buf, acl_len); | 3686 | _copy_from_pages(acl->data, pages, pgbase, acl_len); |
| 3641 | } else { | 3687 | } else { |
| 3642 | acl = kmalloc(sizeof(*acl), GFP_KERNEL); | 3688 | acl = kmalloc(sizeof(*acl), GFP_KERNEL); |
| 3643 | if (acl == NULL) | 3689 | if (acl == NULL) |
| @@ -3670,7 +3716,6 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
| 3670 | struct nfs_getaclres res = { | 3716 | struct nfs_getaclres res = { |
| 3671 | .acl_len = buflen, | 3717 | .acl_len = buflen, |
| 3672 | }; | 3718 | }; |
| 3673 | void *resp_buf; | ||
| 3674 | struct rpc_message msg = { | 3719 | struct rpc_message msg = { |
| 3675 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL], | 3720 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL], |
| 3676 | .rpc_argp = &args, | 3721 | .rpc_argp = &args, |
| @@ -3684,24 +3729,27 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
| 3684 | if (npages == 0) | 3729 | if (npages == 0) |
| 3685 | npages = 1; | 3730 | npages = 1; |
| 3686 | 3731 | ||
| 3732 | /* Add an extra page to handle the bitmap returned */ | ||
| 3733 | npages++; | ||
| 3734 | |||
| 3687 | for (i = 0; i < npages; i++) { | 3735 | for (i = 0; i < npages; i++) { |
| 3688 | pages[i] = alloc_page(GFP_KERNEL); | 3736 | pages[i] = alloc_page(GFP_KERNEL); |
| 3689 | if (!pages[i]) | 3737 | if (!pages[i]) |
| 3690 | goto out_free; | 3738 | goto out_free; |
| 3691 | } | 3739 | } |
| 3692 | if (npages > 1) { | 3740 | |
| 3693 | /* for decoding across pages */ | 3741 | /* for decoding across pages */ |
| 3694 | res.acl_scratch = alloc_page(GFP_KERNEL); | 3742 | res.acl_scratch = alloc_page(GFP_KERNEL); |
| 3695 | if (!res.acl_scratch) | 3743 | if (!res.acl_scratch) |
| 3696 | goto out_free; | 3744 | goto out_free; |
| 3697 | } | 3745 | |
| 3698 | args.acl_len = npages * PAGE_SIZE; | 3746 | args.acl_len = npages * PAGE_SIZE; |
| 3699 | args.acl_pgbase = 0; | 3747 | args.acl_pgbase = 0; |
| 3748 | |||
| 3700 | /* Let decode_getfacl know not to fail if the ACL data is larger than | 3749 | /* Let decode_getfacl know not to fail if the ACL data is larger than |
| 3701 | * the page we send as a guess */ | 3750 | * the page we send as a guess */ |
| 3702 | if (buf == NULL) | 3751 | if (buf == NULL) |
| 3703 | res.acl_flags |= NFS4_ACL_LEN_REQUEST; | 3752 | res.acl_flags |= NFS4_ACL_LEN_REQUEST; |
| 3704 | resp_buf = page_address(pages[0]); | ||
| 3705 | 3753 | ||
| 3706 | dprintk("%s buf %p buflen %zu npages %d args.acl_len %zu\n", | 3754 | dprintk("%s buf %p buflen %zu npages %d args.acl_len %zu\n", |
| 3707 | __func__, buf, buflen, npages, args.acl_len); | 3755 | __func__, buf, buflen, npages, args.acl_len); |
| @@ -3712,9 +3760,9 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
| 3712 | 3760 | ||
| 3713 | acl_len = res.acl_len - res.acl_data_offset; | 3761 | acl_len = res.acl_len - res.acl_data_offset; |
| 3714 | if (acl_len > args.acl_len) | 3762 | if (acl_len > args.acl_len) |
| 3715 | nfs4_write_cached_acl(inode, NULL, acl_len); | 3763 | nfs4_write_cached_acl(inode, NULL, 0, acl_len); |
| 3716 | else | 3764 | else |
| 3717 | nfs4_write_cached_acl(inode, resp_buf + res.acl_data_offset, | 3765 | nfs4_write_cached_acl(inode, pages, res.acl_data_offset, |
| 3718 | acl_len); | 3766 | acl_len); |
| 3719 | if (buf) { | 3767 | if (buf) { |
| 3720 | ret = -ERANGE; | 3768 | ret = -ERANGE; |
| @@ -4919,8 +4967,10 @@ static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr) | |||
| 4919 | fattr->nlink = 2; | 4967 | fattr->nlink = 2; |
| 4920 | } | 4968 | } |
| 4921 | 4969 | ||
| 4922 | int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | 4970 | static int _nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir, |
| 4923 | struct nfs4_fs_locations *fs_locations, struct page *page) | 4971 | const struct qstr *name, |
| 4972 | struct nfs4_fs_locations *fs_locations, | ||
| 4973 | struct page *page) | ||
| 4924 | { | 4974 | { |
| 4925 | struct nfs_server *server = NFS_SERVER(dir); | 4975 | struct nfs_server *server = NFS_SERVER(dir); |
| 4926 | u32 bitmask[2] = { | 4976 | u32 bitmask[2] = { |
| @@ -4954,11 +5004,26 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | |||
| 4954 | nfs_fattr_init(&fs_locations->fattr); | 5004 | nfs_fattr_init(&fs_locations->fattr); |
| 4955 | fs_locations->server = server; | 5005 | fs_locations->server = server; |
| 4956 | fs_locations->nlocations = 0; | 5006 | fs_locations->nlocations = 0; |
| 4957 | status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); | 5007 | status = nfs4_call_sync(client, server, &msg, &args.seq_args, &res.seq_res, 0); |
| 4958 | dprintk("%s: returned status = %d\n", __func__, status); | 5008 | dprintk("%s: returned status = %d\n", __func__, status); |
| 4959 | return status; | 5009 | return status; |
| 4960 | } | 5010 | } |
| 4961 | 5011 | ||
| 5012 | int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir, | ||
| 5013 | const struct qstr *name, | ||
| 5014 | struct nfs4_fs_locations *fs_locations, | ||
| 5015 | struct page *page) | ||
| 5016 | { | ||
| 5017 | struct nfs4_exception exception = { }; | ||
| 5018 | int err; | ||
| 5019 | do { | ||
| 5020 | err = nfs4_handle_exception(NFS_SERVER(dir), | ||
| 5021 | _nfs4_proc_fs_locations(client, dir, name, fs_locations, page), | ||
| 5022 | &exception); | ||
| 5023 | } while (exception.retry); | ||
| 5024 | return err; | ||
| 5025 | } | ||
| 5026 | |||
| 4962 | static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct nfs4_secinfo_flavors *flavors) | 5027 | static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct nfs4_secinfo_flavors *flavors) |
| 4963 | { | 5028 | { |
| 4964 | int status; | 5029 | int status; |
| @@ -4981,8 +5046,8 @@ static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct | |||
| 4981 | return status; | 5046 | return status; |
| 4982 | } | 5047 | } |
| 4983 | 5048 | ||
| 4984 | static int nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, | 5049 | int nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, |
| 4985 | struct nfs4_secinfo_flavors *flavors) | 5050 | struct nfs4_secinfo_flavors *flavors) |
| 4986 | { | 5051 | { |
| 4987 | struct nfs4_exception exception = { }; | 5052 | struct nfs4_exception exception = { }; |
| 4988 | int err; | 5053 | int err; |
| @@ -5057,10 +5122,9 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) | |||
| 5057 | nfs4_construct_boot_verifier(clp, &verifier); | 5122 | nfs4_construct_boot_verifier(clp, &verifier); |
| 5058 | 5123 | ||
| 5059 | args.id_len = scnprintf(args.id, sizeof(args.id), | 5124 | args.id_len = scnprintf(args.id, sizeof(args.id), |
| 5060 | "%s/%s.%s/%u", | 5125 | "%s/%s/%u", |
| 5061 | clp->cl_ipaddr, | 5126 | clp->cl_ipaddr, |
| 5062 | init_utsname()->nodename, | 5127 | clp->cl_rpcclient->cl_nodename, |
| 5063 | init_utsname()->domainname, | ||
| 5064 | clp->cl_rpcclient->cl_auth->au_flavor); | 5128 | clp->cl_rpcclient->cl_auth->au_flavor); |
| 5065 | 5129 | ||
| 5066 | res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL); | 5130 | res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL); |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 77fc5f959c4e..c54aae364bee 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
| @@ -4258,8 +4258,6 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | |||
| 4258 | status = decode_attr_error(xdr, bitmap, &err); | 4258 | status = decode_attr_error(xdr, bitmap, &err); |
| 4259 | if (status < 0) | 4259 | if (status < 0) |
| 4260 | goto xdr_error; | 4260 | goto xdr_error; |
| 4261 | if (err == -NFS4ERR_WRONGSEC) | ||
| 4262 | nfs_fixup_secinfo_attributes(fattr, fh); | ||
| 4263 | 4261 | ||
| 4264 | status = decode_attr_filehandle(xdr, bitmap, fh); | 4262 | status = decode_attr_filehandle(xdr, bitmap, fh); |
| 4265 | if (status < 0) | 4263 | if (status < 0) |
| @@ -4902,11 +4900,19 @@ static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req, | |||
| 4902 | bitmap[3] = {0}; | 4900 | bitmap[3] = {0}; |
| 4903 | struct kvec *iov = req->rq_rcv_buf.head; | 4901 | struct kvec *iov = req->rq_rcv_buf.head; |
| 4904 | int status; | 4902 | int status; |
| 4903 | size_t page_len = xdr->buf->page_len; | ||
| 4905 | 4904 | ||
| 4906 | res->acl_len = 0; | 4905 | res->acl_len = 0; |
| 4907 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) | 4906 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) |
| 4908 | goto out; | 4907 | goto out; |
| 4908 | |||
| 4909 | bm_p = xdr->p; | 4909 | bm_p = xdr->p; |
| 4910 | res->acl_data_offset = be32_to_cpup(bm_p) + 2; | ||
| 4911 | res->acl_data_offset <<= 2; | ||
| 4912 | /* Check if the acl data starts beyond the allocated buffer */ | ||
| 4913 | if (res->acl_data_offset > page_len) | ||
| 4914 | return -ERANGE; | ||
| 4915 | |||
| 4910 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) | 4916 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) |
| 4911 | goto out; | 4917 | goto out; |
| 4912 | if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0) | 4918 | if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0) |
| @@ -4916,28 +4922,24 @@ static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req, | |||
| 4916 | return -EIO; | 4922 | return -EIO; |
| 4917 | if (likely(bitmap[0] & FATTR4_WORD0_ACL)) { | 4923 | if (likely(bitmap[0] & FATTR4_WORD0_ACL)) { |
| 4918 | size_t hdrlen; | 4924 | size_t hdrlen; |
| 4919 | u32 recvd; | ||
| 4920 | 4925 | ||
| 4921 | /* The bitmap (xdr len + bitmaps) and the attr xdr len words | 4926 | /* The bitmap (xdr len + bitmaps) and the attr xdr len words |
| 4922 | * are stored with the acl data to handle the problem of | 4927 | * are stored with the acl data to handle the problem of |
| 4923 | * variable length bitmaps.*/ | 4928 | * variable length bitmaps.*/ |
| 4924 | xdr->p = bm_p; | 4929 | xdr->p = bm_p; |
| 4925 | res->acl_data_offset = be32_to_cpup(bm_p) + 2; | ||
| 4926 | res->acl_data_offset <<= 2; | ||
| 4927 | 4930 | ||
| 4928 | /* We ignore &savep and don't do consistency checks on | 4931 | /* We ignore &savep and don't do consistency checks on |
| 4929 | * the attr length. Let userspace figure it out.... */ | 4932 | * the attr length. Let userspace figure it out.... */ |
| 4930 | hdrlen = (u8 *)xdr->p - (u8 *)iov->iov_base; | 4933 | hdrlen = (u8 *)xdr->p - (u8 *)iov->iov_base; |
| 4931 | attrlen += res->acl_data_offset; | 4934 | attrlen += res->acl_data_offset; |
| 4932 | recvd = req->rq_rcv_buf.len - hdrlen; | 4935 | if (attrlen > page_len) { |
| 4933 | if (attrlen > recvd) { | ||
| 4934 | if (res->acl_flags & NFS4_ACL_LEN_REQUEST) { | 4936 | if (res->acl_flags & NFS4_ACL_LEN_REQUEST) { |
| 4935 | /* getxattr interface called with a NULL buf */ | 4937 | /* getxattr interface called with a NULL buf */ |
| 4936 | res->acl_len = attrlen; | 4938 | res->acl_len = attrlen; |
| 4937 | goto out; | 4939 | goto out; |
| 4938 | } | 4940 | } |
| 4939 | dprintk("NFS: acl reply: attrlen %u > recvd %u\n", | 4941 | dprintk("NFS: acl reply: attrlen %u > page_len %zu\n", |
| 4940 | attrlen, recvd); | 4942 | attrlen, page_len); |
| 4941 | return -EINVAL; | 4943 | return -EINVAL; |
| 4942 | } | 4944 | } |
| 4943 | xdr_read_pages(xdr, attrlen); | 4945 | xdr_read_pages(xdr, attrlen); |
| @@ -5090,16 +5092,13 @@ out_err: | |||
| 5090 | return -EINVAL; | 5092 | return -EINVAL; |
| 5091 | } | 5093 | } |
| 5092 | 5094 | ||
| 5093 | static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | 5095 | static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) |
| 5094 | { | 5096 | { |
| 5095 | struct nfs4_secinfo_flavor *sec_flavor; | 5097 | struct nfs4_secinfo_flavor *sec_flavor; |
| 5096 | int status; | 5098 | int status; |
| 5097 | __be32 *p; | 5099 | __be32 *p; |
| 5098 | int i, num_flavors; | 5100 | int i, num_flavors; |
| 5099 | 5101 | ||
| 5100 | status = decode_op_hdr(xdr, OP_SECINFO); | ||
| 5101 | if (status) | ||
| 5102 | goto out; | ||
| 5103 | p = xdr_inline_decode(xdr, 4); | 5102 | p = xdr_inline_decode(xdr, 4); |
| 5104 | if (unlikely(!p)) | 5103 | if (unlikely(!p)) |
| 5105 | goto out_overflow; | 5104 | goto out_overflow; |
| @@ -5125,6 +5124,7 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | |||
| 5125 | res->flavors->num_flavors++; | 5124 | res->flavors->num_flavors++; |
| 5126 | } | 5125 | } |
| 5127 | 5126 | ||
| 5127 | status = 0; | ||
| 5128 | out: | 5128 | out: |
| 5129 | return status; | 5129 | return status; |
| 5130 | out_overflow: | 5130 | out_overflow: |
| @@ -5132,7 +5132,23 @@ out_overflow: | |||
| 5132 | return -EIO; | 5132 | return -EIO; |
| 5133 | } | 5133 | } |
| 5134 | 5134 | ||
| 5135 | static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | ||
| 5136 | { | ||
| 5137 | int status = decode_op_hdr(xdr, OP_SECINFO); | ||
| 5138 | if (status) | ||
| 5139 | return status; | ||
| 5140 | return decode_secinfo_common(xdr, res); | ||
| 5141 | } | ||
| 5142 | |||
| 5135 | #if defined(CONFIG_NFS_V4_1) | 5143 | #if defined(CONFIG_NFS_V4_1) |
| 5144 | static int decode_secinfo_no_name(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | ||
| 5145 | { | ||
| 5146 | int status = decode_op_hdr(xdr, OP_SECINFO_NO_NAME); | ||
| 5147 | if (status) | ||
| 5148 | return status; | ||
| 5149 | return decode_secinfo_common(xdr, res); | ||
| 5150 | } | ||
| 5151 | |||
| 5136 | static int decode_exchange_id(struct xdr_stream *xdr, | 5152 | static int decode_exchange_id(struct xdr_stream *xdr, |
| 5137 | struct nfs41_exchange_id_res *res) | 5153 | struct nfs41_exchange_id_res *res) |
| 5138 | { | 5154 | { |
| @@ -6817,7 +6833,7 @@ static int nfs4_xdr_dec_secinfo_no_name(struct rpc_rqst *rqstp, | |||
| 6817 | status = decode_putrootfh(xdr); | 6833 | status = decode_putrootfh(xdr); |
| 6818 | if (status) | 6834 | if (status) |
| 6819 | goto out; | 6835 | goto out; |
| 6820 | status = decode_secinfo(xdr, res); | 6836 | status = decode_secinfo_no_name(xdr, res); |
| 6821 | out: | 6837 | out: |
| 6822 | return status; | 6838 | return status; |
| 6823 | } | 6839 | } |
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c index 8d45f1c318ce..595c5fc21a19 100644 --- a/fs/nfs/objlayout/objlayout.c +++ b/fs/nfs/objlayout/objlayout.c | |||
| @@ -604,7 +604,6 @@ int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay, | |||
| 604 | { | 604 | { |
| 605 | struct objlayout_deviceinfo *odi; | 605 | struct objlayout_deviceinfo *odi; |
| 606 | struct pnfs_device pd; | 606 | struct pnfs_device pd; |
| 607 | struct super_block *sb; | ||
| 608 | struct page *page, **pages; | 607 | struct page *page, **pages; |
| 609 | u32 *p; | 608 | u32 *p; |
| 610 | int err; | 609 | int err; |
| @@ -623,7 +622,6 @@ int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay, | |||
| 623 | pd.pglen = PAGE_SIZE; | 622 | pd.pglen = PAGE_SIZE; |
| 624 | pd.mincount = 0; | 623 | pd.mincount = 0; |
| 625 | 624 | ||
| 626 | sb = pnfslay->plh_inode->i_sb; | ||
| 627 | err = nfs4_proc_getdeviceinfo(NFS_SERVER(pnfslay->plh_inode), &pd); | 625 | err = nfs4_proc_getdeviceinfo(NFS_SERVER(pnfslay->plh_inode), &pd); |
| 628 | dprintk("%s nfs_getdeviceinfo returned %d\n", __func__, err); | 626 | dprintk("%s nfs_getdeviceinfo returned %d\n", __func__, err); |
| 629 | if (err) | 627 | if (err) |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index b5d451586943..38512bcd2e98 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
| @@ -587,7 +587,7 @@ send_layoutget(struct pnfs_layout_hdr *lo, | |||
| 587 | 587 | ||
| 588 | /* allocate pages for xdr post processing */ | 588 | /* allocate pages for xdr post processing */ |
| 589 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; | 589 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; |
| 590 | max_pages = max_resp_sz >> PAGE_SHIFT; | 590 | max_pages = nfs_page_array_len(0, max_resp_sz); |
| 591 | 591 | ||
| 592 | pages = kcalloc(max_pages, sizeof(struct page *), gfp_flags); | 592 | pages = kcalloc(max_pages, sizeof(struct page *), gfp_flags); |
| 593 | if (!pages) | 593 | if (!pages) |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 1e6715f0616c..4ac7fca7e4bf 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -2428,7 +2428,7 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags, | |||
| 2428 | dprintk("--> nfs_xdev_mount()\n"); | 2428 | dprintk("--> nfs_xdev_mount()\n"); |
| 2429 | 2429 | ||
| 2430 | /* create a new volume representation */ | 2430 | /* create a new volume representation */ |
| 2431 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); | 2431 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor); |
| 2432 | if (IS_ERR(server)) { | 2432 | if (IS_ERR(server)) { |
| 2433 | error = PTR_ERR(server); | 2433 | error = PTR_ERR(server); |
| 2434 | goto out_err_noserver; | 2434 | goto out_err_noserver; |
| @@ -2955,7 +2955,7 @@ nfs4_xdev_mount(struct file_system_type *fs_type, int flags, | |||
| 2955 | dprintk("--> nfs4_xdev_mount()\n"); | 2955 | dprintk("--> nfs4_xdev_mount()\n"); |
| 2956 | 2956 | ||
| 2957 | /* create a new volume representation */ | 2957 | /* create a new volume representation */ |
| 2958 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); | 2958 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor); |
| 2959 | if (IS_ERR(server)) { | 2959 | if (IS_ERR(server)) { |
| 2960 | error = PTR_ERR(server); | 2960 | error = PTR_ERR(server); |
| 2961 | goto out_err_noserver; | 2961 | goto out_err_noserver; |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 4767429264a2..ed3f9206a0ee 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
| @@ -577,7 +577,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
| 577 | struct cld_net *cn = nn->cld_net; | 577 | struct cld_net *cn = nn->cld_net; |
| 578 | 578 | ||
| 579 | if (mlen != sizeof(*cmsg)) { | 579 | if (mlen != sizeof(*cmsg)) { |
| 580 | dprintk("%s: got %lu bytes, expected %lu\n", __func__, mlen, | 580 | dprintk("%s: got %zu bytes, expected %zu\n", __func__, mlen, |
| 581 | sizeof(*cmsg)); | 581 | sizeof(*cmsg)); |
| 582 | return -EINVAL; | 582 | return -EINVAL; |
| 583 | } | 583 | } |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 1c8b280146d7..57b8159f26f3 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
| @@ -1799,10 +1799,15 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
| 1799 | if (task) { | 1799 | if (task) { |
| 1800 | files = get_files_struct(task); | 1800 | files = get_files_struct(task); |
| 1801 | if (files) { | 1801 | if (files) { |
| 1802 | struct file *file; | ||
| 1802 | rcu_read_lock(); | 1803 | rcu_read_lock(); |
| 1803 | if (fcheck_files(files, fd)) { | 1804 | file = fcheck_files(files, fd); |
| 1805 | if (file) { | ||
| 1806 | unsigned i_mode, f_mode = file->f_mode; | ||
| 1807 | |||
| 1804 | rcu_read_unlock(); | 1808 | rcu_read_unlock(); |
| 1805 | put_files_struct(files); | 1809 | put_files_struct(files); |
| 1810 | |||
| 1806 | if (task_dumpable(task)) { | 1811 | if (task_dumpable(task)) { |
| 1807 | rcu_read_lock(); | 1812 | rcu_read_lock(); |
| 1808 | cred = __task_cred(task); | 1813 | cred = __task_cred(task); |
| @@ -1813,7 +1818,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
| 1813 | inode->i_uid = 0; | 1818 | inode->i_uid = 0; |
| 1814 | inode->i_gid = 0; | 1819 | inode->i_gid = 0; |
| 1815 | } | 1820 | } |
| 1816 | inode->i_mode &= ~(S_ISUID | S_ISGID); | 1821 | |
| 1822 | i_mode = S_IFLNK; | ||
| 1823 | if (f_mode & FMODE_READ) | ||
| 1824 | i_mode |= S_IRUSR | S_IXUSR; | ||
| 1825 | if (f_mode & FMODE_WRITE) | ||
| 1826 | i_mode |= S_IWUSR | S_IXUSR; | ||
| 1827 | inode->i_mode = i_mode; | ||
| 1828 | |||
| 1817 | security_task_to_inode(task, inode); | 1829 | security_task_to_inode(task, inode); |
| 1818 | put_task_struct(task); | 1830 | put_task_struct(task); |
| 1819 | return 1; | 1831 | return 1; |
| @@ -1837,8 +1849,6 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, | |||
| 1837 | struct dentry *dentry, struct task_struct *task, const void *ptr) | 1849 | struct dentry *dentry, struct task_struct *task, const void *ptr) |
| 1838 | { | 1850 | { |
| 1839 | unsigned fd = *(const unsigned *)ptr; | 1851 | unsigned fd = *(const unsigned *)ptr; |
| 1840 | struct file *file; | ||
| 1841 | struct files_struct *files; | ||
| 1842 | struct inode *inode; | 1852 | struct inode *inode; |
| 1843 | struct proc_inode *ei; | 1853 | struct proc_inode *ei; |
| 1844 | struct dentry *error = ERR_PTR(-ENOENT); | 1854 | struct dentry *error = ERR_PTR(-ENOENT); |
| @@ -1848,25 +1858,6 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, | |||
| 1848 | goto out; | 1858 | goto out; |
| 1849 | ei = PROC_I(inode); | 1859 | ei = PROC_I(inode); |
| 1850 | ei->fd = fd; | 1860 | ei->fd = fd; |
| 1851 | files = get_files_struct(task); | ||
| 1852 | if (!files) | ||
| 1853 | goto out_iput; | ||
| 1854 | inode->i_mode = S_IFLNK; | ||
| 1855 | |||
| 1856 | /* | ||
| 1857 | * We are not taking a ref to the file structure, so we must | ||
| 1858 | * hold ->file_lock. | ||
| 1859 | */ | ||
| 1860 | spin_lock(&files->file_lock); | ||
| 1861 | file = fcheck_files(files, fd); | ||
| 1862 | if (!file) | ||
| 1863 | goto out_unlock; | ||
| 1864 | if (file->f_mode & FMODE_READ) | ||
| 1865 | inode->i_mode |= S_IRUSR | S_IXUSR; | ||
| 1866 | if (file->f_mode & FMODE_WRITE) | ||
| 1867 | inode->i_mode |= S_IWUSR | S_IXUSR; | ||
| 1868 | spin_unlock(&files->file_lock); | ||
| 1869 | put_files_struct(files); | ||
| 1870 | 1861 | ||
| 1871 | inode->i_op = &proc_pid_link_inode_operations; | 1862 | inode->i_op = &proc_pid_link_inode_operations; |
| 1872 | inode->i_size = 64; | 1863 | inode->i_size = 64; |
| @@ -1879,12 +1870,6 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, | |||
| 1879 | 1870 | ||
| 1880 | out: | 1871 | out: |
| 1881 | return error; | 1872 | return error; |
| 1882 | out_unlock: | ||
| 1883 | spin_unlock(&files->file_lock); | ||
| 1884 | put_files_struct(files); | ||
| 1885 | out_iput: | ||
| 1886 | iput(inode); | ||
| 1887 | goto out; | ||
| 1888 | } | 1873 | } |
| 1889 | 1874 | ||
| 1890 | static struct dentry *proc_lookupfd_common(struct inode *dir, | 1875 | static struct dentry *proc_lookupfd_common(struct inode *dir, |
| @@ -2177,16 +2162,16 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, | |||
| 2177 | goto out; | 2162 | goto out; |
| 2178 | 2163 | ||
| 2179 | result = ERR_PTR(-EACCES); | 2164 | result = ERR_PTR(-EACCES); |
| 2180 | if (lock_trace(task)) | 2165 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
| 2181 | goto out_put_task; | 2166 | goto out_put_task; |
| 2182 | 2167 | ||
| 2183 | result = ERR_PTR(-ENOENT); | 2168 | result = ERR_PTR(-ENOENT); |
| 2184 | if (dname_to_vma_addr(dentry, &vm_start, &vm_end)) | 2169 | if (dname_to_vma_addr(dentry, &vm_start, &vm_end)) |
| 2185 | goto out_unlock; | 2170 | goto out_put_task; |
| 2186 | 2171 | ||
| 2187 | mm = get_task_mm(task); | 2172 | mm = get_task_mm(task); |
| 2188 | if (!mm) | 2173 | if (!mm) |
| 2189 | goto out_unlock; | 2174 | goto out_put_task; |
| 2190 | 2175 | ||
| 2191 | down_read(&mm->mmap_sem); | 2176 | down_read(&mm->mmap_sem); |
| 2192 | vma = find_exact_vma(mm, vm_start, vm_end); | 2177 | vma = find_exact_vma(mm, vm_start, vm_end); |
| @@ -2198,8 +2183,6 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, | |||
| 2198 | out_no_vma: | 2183 | out_no_vma: |
| 2199 | up_read(&mm->mmap_sem); | 2184 | up_read(&mm->mmap_sem); |
| 2200 | mmput(mm); | 2185 | mmput(mm); |
| 2201 | out_unlock: | ||
| 2202 | unlock_trace(task); | ||
| 2203 | out_put_task: | 2186 | out_put_task: |
| 2204 | put_task_struct(task); | 2187 | put_task_struct(task); |
| 2205 | out: | 2188 | out: |
| @@ -2233,7 +2216,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 2233 | goto out; | 2216 | goto out; |
| 2234 | 2217 | ||
| 2235 | ret = -EACCES; | 2218 | ret = -EACCES; |
| 2236 | if (lock_trace(task)) | 2219 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
| 2237 | goto out_put_task; | 2220 | goto out_put_task; |
| 2238 | 2221 | ||
| 2239 | ret = 0; | 2222 | ret = 0; |
| @@ -2241,12 +2224,12 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 2241 | case 0: | 2224 | case 0: |
| 2242 | ino = inode->i_ino; | 2225 | ino = inode->i_ino; |
| 2243 | if (filldir(dirent, ".", 1, 0, ino, DT_DIR) < 0) | 2226 | if (filldir(dirent, ".", 1, 0, ino, DT_DIR) < 0) |
| 2244 | goto out_unlock; | 2227 | goto out_put_task; |
| 2245 | filp->f_pos++; | 2228 | filp->f_pos++; |
| 2246 | case 1: | 2229 | case 1: |
| 2247 | ino = parent_ino(dentry); | 2230 | ino = parent_ino(dentry); |
| 2248 | if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0) | 2231 | if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0) |
| 2249 | goto out_unlock; | 2232 | goto out_put_task; |
| 2250 | filp->f_pos++; | 2233 | filp->f_pos++; |
| 2251 | default: | 2234 | default: |
| 2252 | { | 2235 | { |
| @@ -2257,7 +2240,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 2257 | 2240 | ||
| 2258 | mm = get_task_mm(task); | 2241 | mm = get_task_mm(task); |
| 2259 | if (!mm) | 2242 | if (!mm) |
| 2260 | goto out_unlock; | 2243 | goto out_put_task; |
| 2261 | down_read(&mm->mmap_sem); | 2244 | down_read(&mm->mmap_sem); |
| 2262 | 2245 | ||
| 2263 | nr_files = 0; | 2246 | nr_files = 0; |
| @@ -2287,7 +2270,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 2287 | flex_array_free(fa); | 2270 | flex_array_free(fa); |
| 2288 | up_read(&mm->mmap_sem); | 2271 | up_read(&mm->mmap_sem); |
| 2289 | mmput(mm); | 2272 | mmput(mm); |
| 2290 | goto out_unlock; | 2273 | goto out_put_task; |
| 2291 | } | 2274 | } |
| 2292 | for (i = 0, vma = mm->mmap, pos = 2; vma; | 2275 | for (i = 0, vma = mm->mmap, pos = 2; vma; |
| 2293 | vma = vma->vm_next) { | 2276 | vma = vma->vm_next) { |
| @@ -2332,8 +2315,6 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 2332 | } | 2315 | } |
| 2333 | } | 2316 | } |
| 2334 | 2317 | ||
| 2335 | out_unlock: | ||
| 2336 | unlock_trace(task); | ||
| 2337 | out_put_task: | 2318 | out_put_task: |
| 2338 | put_task_struct(task); | 2319 | put_task_struct(task); |
| 2339 | out: | 2320 | out: |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 2d60492d6df8..1030a716d155 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
| @@ -747,6 +747,8 @@ static void pte_to_pagemap_entry(pagemap_entry_t *pme, pte_t pte) | |||
| 747 | else if (pte_present(pte)) | 747 | else if (pte_present(pte)) |
| 748 | *pme = make_pme(PM_PFRAME(pte_pfn(pte)) | 748 | *pme = make_pme(PM_PFRAME(pte_pfn(pte)) |
| 749 | | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT); | 749 | | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT); |
| 750 | else | ||
| 751 | *pme = make_pme(PM_NOT_PRESENT); | ||
| 750 | } | 752 | } |
| 751 | 753 | ||
| 752 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 754 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| @@ -761,6 +763,8 @@ static void thp_pmd_to_pagemap_entry(pagemap_entry_t *pme, | |||
| 761 | if (pmd_present(pmd)) | 763 | if (pmd_present(pmd)) |
| 762 | *pme = make_pme(PM_PFRAME(pmd_pfn(pmd) + offset) | 764 | *pme = make_pme(PM_PFRAME(pmd_pfn(pmd) + offset) |
| 763 | | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT); | 765 | | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT); |
| 766 | else | ||
| 767 | *pme = make_pme(PM_NOT_PRESENT); | ||
| 764 | } | 768 | } |
| 765 | #else | 769 | #else |
| 766 | static inline void thp_pmd_to_pagemap_entry(pagemap_entry_t *pme, | 770 | static inline void thp_pmd_to_pagemap_entry(pagemap_entry_t *pme, |
| @@ -801,8 +805,10 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | |||
| 801 | 805 | ||
| 802 | /* check to see if we've left 'vma' behind | 806 | /* check to see if we've left 'vma' behind |
| 803 | * and need a new, higher one */ | 807 | * and need a new, higher one */ |
| 804 | if (vma && (addr >= vma->vm_end)) | 808 | if (vma && (addr >= vma->vm_end)) { |
| 805 | vma = find_vma(walk->mm, addr); | 809 | vma = find_vma(walk->mm, addr); |
| 810 | pme = make_pme(PM_NOT_PRESENT); | ||
| 811 | } | ||
| 806 | 812 | ||
| 807 | /* check that 'vma' actually covers this address, | 813 | /* check that 'vma' actually covers this address, |
| 808 | * and that it isn't a huge page vma */ | 814 | * and that it isn't a huge page vma */ |
| @@ -830,6 +836,8 @@ static void huge_pte_to_pagemap_entry(pagemap_entry_t *pme, | |||
| 830 | if (pte_present(pte)) | 836 | if (pte_present(pte)) |
| 831 | *pme = make_pme(PM_PFRAME(pte_pfn(pte) + offset) | 837 | *pme = make_pme(PM_PFRAME(pte_pfn(pte) + offset) |
| 832 | | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT); | 838 | | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT); |
| 839 | else | ||
| 840 | *pme = make_pme(PM_NOT_PRESENT); | ||
| 833 | } | 841 | } |
| 834 | 842 | ||
| 835 | /* This function walks within one hugetlb entry in the single call */ | 843 | /* This function walks within one hugetlb entry in the single call */ |
| @@ -839,7 +847,7 @@ static int pagemap_hugetlb_range(pte_t *pte, unsigned long hmask, | |||
| 839 | { | 847 | { |
| 840 | struct pagemapread *pm = walk->private; | 848 | struct pagemapread *pm = walk->private; |
| 841 | int err = 0; | 849 | int err = 0; |
| 842 | pagemap_entry_t pme = make_pme(PM_NOT_PRESENT); | 850 | pagemap_entry_t pme; |
| 843 | 851 | ||
| 844 | for (; addr != end; addr += PAGE_SIZE) { | 852 | for (; addr != end; addr += PAGE_SIZE) { |
| 845 | int offset = (addr & ~hmask) >> PAGE_SHIFT; | 853 | int offset = (addr & ~hmask) >> PAGE_SHIFT; |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index eba66043cf1b..e8bcc4742e0e 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
| @@ -499,9 +499,10 @@ typedef u64 acpi_integer; | |||
| 499 | #define ACPI_STATE_D0 (u8) 0 | 499 | #define ACPI_STATE_D0 (u8) 0 |
| 500 | #define ACPI_STATE_D1 (u8) 1 | 500 | #define ACPI_STATE_D1 (u8) 1 |
| 501 | #define ACPI_STATE_D2 (u8) 2 | 501 | #define ACPI_STATE_D2 (u8) 2 |
| 502 | #define ACPI_STATE_D3 (u8) 3 | 502 | #define ACPI_STATE_D3_HOT (u8) 3 |
| 503 | #define ACPI_STATE_D3_COLD (u8) 4 | 503 | #define ACPI_STATE_D3 (u8) 4 |
| 504 | #define ACPI_D_STATES_MAX ACPI_STATE_D3_COLD | 504 | #define ACPI_STATE_D3_COLD ACPI_STATE_D3 |
| 505 | #define ACPI_D_STATES_MAX ACPI_STATE_D3 | ||
| 505 | #define ACPI_D_STATE_COUNT 5 | 506 | #define ACPI_D_STATE_COUNT 5 |
| 506 | 507 | ||
| 507 | #define ACPI_STATE_C0 (u8) 0 | 508 | #define ACPI_STATE_C0 (u8) 0 |
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h index 0fd28e028de1..c749af9c0983 100644 --- a/include/asm-generic/statfs.h +++ b/include/asm-generic/statfs.h | |||
| @@ -15,7 +15,7 @@ typedef __kernel_fsid_t fsid_t; | |||
| 15 | * with a 10' pole. | 15 | * with a 10' pole. |
| 16 | */ | 16 | */ |
| 17 | #ifndef __statfs_word | 17 | #ifndef __statfs_word |
| 18 | #if BITS_PER_LONG == 64 | 18 | #if __BITS_PER_LONG == 64 |
| 19 | #define __statfs_word long | 19 | #define __statfs_word long |
| 20 | #else | 20 | #else |
| 21 | #define __statfs_word __u32 | 21 | #define __statfs_word __u32 |
diff --git a/include/linux/efi.h b/include/linux/efi.h index 88ec80670d5f..ec45ccd8708a 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -554,7 +554,18 @@ extern int __init efi_setup_pcdp_console(char *); | |||
| 554 | #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 | 554 | #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 |
| 555 | #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 | 555 | #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 |
| 556 | #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 | 556 | #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 |
| 557 | 557 | #define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x0000000000000008 | |
| 558 | #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0000000000000010 | ||
| 559 | #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x0000000000000020 | ||
| 560 | #define EFI_VARIABLE_APPEND_WRITE 0x0000000000000040 | ||
| 561 | |||
| 562 | #define EFI_VARIABLE_MASK (EFI_VARIABLE_NON_VOLATILE | \ | ||
| 563 | EFI_VARIABLE_BOOTSERVICE_ACCESS | \ | ||
| 564 | EFI_VARIABLE_RUNTIME_ACCESS | \ | ||
| 565 | EFI_VARIABLE_HARDWARE_ERROR_RECORD | \ | ||
| 566 | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \ | ||
| 567 | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ | ||
| 568 | EFI_VARIABLE_APPEND_WRITE) | ||
| 558 | /* | 569 | /* |
| 559 | * The type of search to perform when calling boottime->locate_handle | 570 | * The type of search to perform when calling boottime->locate_handle |
| 560 | */ | 571 | */ |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 8a1835855faa..fe5136d81454 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
| @@ -159,7 +159,8 @@ static inline void eth_hw_addr_random(struct net_device *dev) | |||
| 159 | * @addr1: Pointer to a six-byte array containing the Ethernet address | 159 | * @addr1: Pointer to a six-byte array containing the Ethernet address |
| 160 | * @addr2: Pointer other six-byte array containing the Ethernet address | 160 | * @addr2: Pointer other six-byte array containing the Ethernet address |
| 161 | * | 161 | * |
| 162 | * Compare two ethernet addresses, returns 0 if equal | 162 | * Compare two ethernet addresses, returns 0 if equal, non-zero otherwise. |
| 163 | * Unlike memcmp(), it doesn't return a value suitable for sorting. | ||
| 163 | */ | 164 | */ |
| 164 | static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) | 165 | static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) |
| 165 | { | 166 | { |
| @@ -184,10 +185,10 @@ static inline unsigned long zap_last_2bytes(unsigned long value) | |||
| 184 | * @addr1: Pointer to an array of 8 bytes | 185 | * @addr1: Pointer to an array of 8 bytes |
| 185 | * @addr2: Pointer to an other array of 8 bytes | 186 | * @addr2: Pointer to an other array of 8 bytes |
| 186 | * | 187 | * |
| 187 | * Compare two ethernet addresses, returns 0 if equal. | 188 | * Compare two ethernet addresses, returns 0 if equal, non-zero otherwise. |
| 188 | * Same result than "memcmp(addr1, addr2, ETH_ALEN)" but without conditional | 189 | * Unlike memcmp(), it doesn't return a value suitable for sorting. |
| 189 | * branches, and possibly long word memory accesses on CPU allowing cheap | 190 | * The function doesn't need any conditional branches and possibly uses |
| 190 | * unaligned memory reads. | 191 | * word memory accesses on CPU allowing cheap unaligned memory reads. |
| 191 | * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2} | 192 | * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2} |
| 192 | * | 193 | * |
| 193 | * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits. | 194 | * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits. |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 5f3f3be5af09..176a939d1547 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
| @@ -179,6 +179,7 @@ enum { | |||
| 179 | TRACE_EVENT_FL_RECORDED_CMD_BIT, | 179 | TRACE_EVENT_FL_RECORDED_CMD_BIT, |
| 180 | TRACE_EVENT_FL_CAP_ANY_BIT, | 180 | TRACE_EVENT_FL_CAP_ANY_BIT, |
| 181 | TRACE_EVENT_FL_NO_SET_FILTER_BIT, | 181 | TRACE_EVENT_FL_NO_SET_FILTER_BIT, |
| 182 | TRACE_EVENT_FL_IGNORE_ENABLE_BIT, | ||
| 182 | }; | 183 | }; |
| 183 | 184 | ||
| 184 | enum { | 185 | enum { |
| @@ -187,6 +188,7 @@ enum { | |||
| 187 | TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), | 188 | TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), |
| 188 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), | 189 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), |
| 189 | TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), | 190 | TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), |
| 191 | TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), | ||
| 190 | }; | 192 | }; |
| 191 | 193 | ||
| 192 | struct ftrace_event_call { | 194 | struct ftrace_event_call { |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 42378d637ffb..e926df7b54c9 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -996,7 +996,8 @@ extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev, | |||
| 996 | extern void ata_sas_port_destroy(struct ata_port *); | 996 | extern void ata_sas_port_destroy(struct ata_port *); |
| 997 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | 997 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, |
| 998 | struct ata_port_info *, struct Scsi_Host *); | 998 | struct ata_port_info *, struct Scsi_Host *); |
| 999 | extern int ata_sas_async_port_init(struct ata_port *); | 999 | extern void ata_sas_async_probe(struct ata_port *ap); |
| 1000 | extern int ata_sas_sync_probe(struct ata_port *ap); | ||
| 1000 | extern int ata_sas_port_init(struct ata_port *); | 1001 | extern int ata_sas_port_init(struct ata_port *); |
| 1001 | extern int ata_sas_port_start(struct ata_port *ap); | 1002 | extern int ata_sas_port_start(struct ata_port *ap); |
| 1002 | extern void ata_sas_port_stop(struct ata_port *ap); | 1003 | extern void ata_sas_port_stop(struct ata_port *ap); |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 5cbaa20f1659..33900a53c990 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -1403,15 +1403,6 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev) | |||
| 1403 | return 0; | 1403 | return 0; |
| 1404 | } | 1404 | } |
| 1405 | 1405 | ||
| 1406 | #ifndef CONFIG_NET_NS | ||
| 1407 | static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev) | ||
| 1408 | { | ||
| 1409 | skb->dev = dev; | ||
| 1410 | } | ||
| 1411 | #else /* CONFIG_NET_NS */ | ||
| 1412 | void skb_set_dev(struct sk_buff *skb, struct net_device *dev); | ||
| 1413 | #endif | ||
| 1414 | |||
| 1415 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) | 1406 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) |
| 1416 | { | 1407 | { |
| 1417 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | 1408 | #ifdef CONFIG_NET_DSA_TAG_TRAILER |
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h index 05a5d72680be..230a290e1973 100644 --- a/include/linux/netfilter/ipset/ip_set_ahash.h +++ b/include/linux/netfilter/ipset/ip_set_ahash.h | |||
| @@ -99,6 +99,22 @@ struct ip_set_hash { | |||
| 99 | #endif | 99 | #endif |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | static size_t | ||
| 103 | htable_size(u8 hbits) | ||
| 104 | { | ||
| 105 | size_t hsize; | ||
| 106 | |||
| 107 | /* We must fit both into u32 in jhash and size_t */ | ||
| 108 | if (hbits > 31) | ||
| 109 | return 0; | ||
| 110 | hsize = jhash_size(hbits); | ||
| 111 | if ((((size_t)-1) - sizeof(struct htable))/sizeof(struct hbucket) | ||
| 112 | < hsize) | ||
| 113 | return 0; | ||
| 114 | |||
| 115 | return hsize * sizeof(struct hbucket) + sizeof(struct htable); | ||
| 116 | } | ||
| 117 | |||
| 102 | /* Compute htable_bits from the user input parameter hashsize */ | 118 | /* Compute htable_bits from the user input parameter hashsize */ |
| 103 | static u8 | 119 | static u8 |
| 104 | htable_bits(u32 hashsize) | 120 | htable_bits(u32 hashsize) |
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h index 0ddd161f3b06..31d2844e6572 100644 --- a/include/linux/netfilter_bridge.h +++ b/include/linux/netfilter_bridge.h | |||
| @@ -104,9 +104,18 @@ struct bridge_skb_cb { | |||
| 104 | } daddr; | 104 | } daddr; |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| 107 | static inline void br_drop_fake_rtable(struct sk_buff *skb) | ||
| 108 | { | ||
| 109 | struct dst_entry *dst = skb_dst(skb); | ||
| 110 | |||
| 111 | if (dst && (dst->flags & DST_FAKE_RTABLE)) | ||
| 112 | skb_dst_drop(skb); | ||
| 113 | } | ||
| 114 | |||
| 107 | #else | 115 | #else |
| 108 | #define nf_bridge_maybe_copy_header(skb) (0) | 116 | #define nf_bridge_maybe_copy_header(skb) (0) |
| 109 | #define nf_bridge_pad(skb) (0) | 117 | #define nf_bridge_pad(skb) (0) |
| 118 | #define br_drop_fake_rtable(skb) do { } while (0) | ||
| 110 | #endif /* CONFIG_BRIDGE_NETFILTER */ | 119 | #endif /* CONFIG_BRIDGE_NETFILTER */ |
| 111 | 120 | ||
| 112 | #endif /* __KERNEL__ */ | 121 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index c6db9fb33c44..600060e25ec6 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h | |||
| @@ -141,7 +141,7 @@ static inline unsigned __read_seqcount_begin(const seqcount_t *s) | |||
| 141 | unsigned ret; | 141 | unsigned ret; |
| 142 | 142 | ||
| 143 | repeat: | 143 | repeat: |
| 144 | ret = s->sequence; | 144 | ret = ACCESS_ONCE(s->sequence); |
| 145 | if (unlikely(ret & 1)) { | 145 | if (unlikely(ret & 1)) { |
| 146 | cpu_relax(); | 146 | cpu_relax(); |
| 147 | goto repeat; | 147 | goto repeat; |
| @@ -166,6 +166,27 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s) | |||
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | /** | 168 | /** |
| 169 | * raw_seqcount_begin - begin a seq-read critical section | ||
| 170 | * @s: pointer to seqcount_t | ||
| 171 | * Returns: count to be passed to read_seqcount_retry | ||
| 172 | * | ||
| 173 | * raw_seqcount_begin opens a read critical section of the given seqcount. | ||
| 174 | * Validity of the critical section is tested by checking read_seqcount_retry | ||
| 175 | * function. | ||
| 176 | * | ||
| 177 | * Unlike read_seqcount_begin(), this function will not wait for the count | ||
| 178 | * to stabilize. If a writer is active when we begin, we will fail the | ||
| 179 | * read_seqcount_retry() instead of stabilizing at the beginning of the | ||
| 180 | * critical section. | ||
| 181 | */ | ||
| 182 | static inline unsigned raw_seqcount_begin(const seqcount_t *s) | ||
| 183 | { | ||
| 184 | unsigned ret = ACCESS_ONCE(s->sequence); | ||
| 185 | smp_rmb(); | ||
| 186 | return ret & ~1; | ||
| 187 | } | ||
| 188 | |||
| 189 | /** | ||
| 169 | * __read_seqcount_retry - end a seq-read critical section (without barrier) | 190 | * __read_seqcount_retry - end a seq-read critical section (without barrier) |
| 170 | * @s: pointer to seqcount_t | 191 | * @s: pointer to seqcount_t |
| 171 | * @start: count, from read_seqcount_begin | 192 | * @start: count, from read_seqcount_begin |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 775292a66fa4..111f26b6e28b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -1020,7 +1020,7 @@ static inline void skb_queue_splice(const struct sk_buff_head *list, | |||
| 1020 | } | 1020 | } |
| 1021 | 1021 | ||
| 1022 | /** | 1022 | /** |
| 1023 | * skb_queue_splice - join two skb lists and reinitialise the emptied list | 1023 | * skb_queue_splice_init - join two skb lists and reinitialise the emptied list |
| 1024 | * @list: the new list to add | 1024 | * @list: the new list to add |
| 1025 | * @head: the place to add it in the first list | 1025 | * @head: the place to add it in the first list |
| 1026 | * | 1026 | * |
| @@ -1051,7 +1051,7 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list, | |||
| 1051 | } | 1051 | } |
| 1052 | 1052 | ||
| 1053 | /** | 1053 | /** |
| 1054 | * skb_queue_splice_tail - join two skb lists and reinitialise the emptied list | 1054 | * skb_queue_splice_tail_init - join two skb lists and reinitialise the emptied list |
| 1055 | * @list: the new list to add | 1055 | * @list: the new list to add |
| 1056 | * @head: the place to add it in the first list | 1056 | * @head: the place to add it in the first list |
| 1057 | * | 1057 | * |
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 605b0aa8d852..76f439647c4b 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
| @@ -191,7 +191,8 @@ extern void usbnet_cdc_status(struct usbnet *, struct urb *); | |||
| 191 | enum skb_state { | 191 | enum skb_state { |
| 192 | illegal = 0, | 192 | illegal = 0, |
| 193 | tx_start, tx_done, | 193 | tx_start, tx_done, |
| 194 | rx_start, rx_done, rx_cleanup | 194 | rx_start, rx_done, rx_cleanup, |
| 195 | unlink_start | ||
| 195 | }; | 196 | }; |
| 196 | 197 | ||
| 197 | struct skb_data { /* skb->cb is one of these */ | 198 | struct skb_data { /* skb->cb is one of these */ |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index b5c2b6cb0d81..cad374bdcf4b 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
| @@ -59,7 +59,8 @@ struct soc_camera_device { | |||
| 59 | struct soc_camera_host { | 59 | struct soc_camera_host { |
| 60 | struct v4l2_device v4l2_dev; | 60 | struct v4l2_device v4l2_dev; |
| 61 | struct list_head list; | 61 | struct list_head list; |
| 62 | unsigned char nr; /* Host number */ | 62 | struct mutex host_lock; /* Protect during probing */ |
| 63 | unsigned char nr; /* Host number */ | ||
| 63 | void *priv; | 64 | void *priv; |
| 64 | const char *drv_name; | 65 | const char *drv_name; |
| 65 | struct soc_camera_host_ops *ops; | 66 | struct soc_camera_host_ops *ops; |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 262ebd1747d4..a65910bda381 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -191,6 +191,7 @@ struct bt_sock { | |||
| 191 | struct list_head accept_q; | 191 | struct list_head accept_q; |
| 192 | struct sock *parent; | 192 | struct sock *parent; |
| 193 | u32 defer_setup; | 193 | u32 defer_setup; |
| 194 | bool suspended; | ||
| 194 | }; | 195 | }; |
| 195 | 196 | ||
| 196 | struct bt_sock_list { | 197 | struct bt_sock_list { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 6822d2595aff..db1c5df45224 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -314,6 +314,7 @@ struct hci_conn { | |||
| 314 | 314 | ||
| 315 | __u8 remote_cap; | 315 | __u8 remote_cap; |
| 316 | __u8 remote_auth; | 316 | __u8 remote_auth; |
| 317 | bool flush_key; | ||
| 317 | 318 | ||
| 318 | unsigned int sent; | 319 | unsigned int sent; |
| 319 | 320 | ||
| @@ -980,7 +981,7 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); | |||
| 980 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); | 981 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); |
| 981 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); | 982 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); |
| 982 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, | 983 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, |
| 983 | u8 persistent); | 984 | bool persistent); |
| 984 | int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 985 | int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
| 985 | u8 addr_type, u32 flags, u8 *name, u8 name_len, | 986 | u8 addr_type, u32 flags, u8 *name, u8 name_len, |
| 986 | u8 *dev_class); | 987 | u8 *dev_class); |
diff --git a/include/net/dst.h b/include/net/dst.h index ff4da42fcfc6..bed833d9796a 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -59,6 +59,7 @@ struct dst_entry { | |||
| 59 | #define DST_NOCACHE 0x0010 | 59 | #define DST_NOCACHE 0x0010 |
| 60 | #define DST_NOCOUNT 0x0020 | 60 | #define DST_NOCOUNT 0x0020 |
| 61 | #define DST_NOPEER 0x0040 | 61 | #define DST_NOPEER 0x0040 |
| 62 | #define DST_FAKE_RTABLE 0x0080 | ||
| 62 | 63 | ||
| 63 | short error; | 64 | short error; |
| 64 | short obsolete; | 65 | short obsolete; |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 2bdee51ba30d..72522f087375 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -393,7 +393,7 @@ struct ip_vs_protocol { | |||
| 393 | 393 | ||
| 394 | void (*exit)(struct ip_vs_protocol *pp); | 394 | void (*exit)(struct ip_vs_protocol *pp); |
| 395 | 395 | ||
| 396 | void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); | 396 | int (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); |
| 397 | 397 | ||
| 398 | void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); | 398 | void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); |
| 399 | 399 | ||
| @@ -1203,6 +1203,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol, | |||
| 1203 | 1203 | ||
| 1204 | extern int ip_vs_use_count_inc(void); | 1204 | extern int ip_vs_use_count_inc(void); |
| 1205 | extern void ip_vs_use_count_dec(void); | 1205 | extern void ip_vs_use_count_dec(void); |
| 1206 | extern int ip_vs_register_nl_ioctl(void); | ||
| 1207 | extern void ip_vs_unregister_nl_ioctl(void); | ||
| 1206 | extern int ip_vs_control_init(void); | 1208 | extern int ip_vs_control_init(void); |
| 1207 | extern void ip_vs_control_cleanup(void); | 1209 | extern void ip_vs_control_cleanup(void); |
| 1208 | extern struct ip_vs_dest * | 1210 | extern struct ip_vs_dest * |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 6ee44b24864a..a2ef81466b00 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
| @@ -704,4 +704,17 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr) | |||
| 704 | addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); | 704 | addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); |
| 705 | } | 705 | } |
| 706 | 706 | ||
| 707 | /* The cookie is always 0 since this is how it's used in the | ||
| 708 | * pmtu code. | ||
| 709 | */ | ||
| 710 | static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t) | ||
| 711 | { | ||
| 712 | if (t->dst && !dst_check(t->dst, 0)) { | ||
| 713 | dst_release(t->dst); | ||
| 714 | t->dst = NULL; | ||
| 715 | } | ||
| 716 | |||
| 717 | return t->dst; | ||
| 718 | } | ||
| 719 | |||
| 707 | #endif /* __net_sctp_h__ */ | 720 | #endif /* __net_sctp_h__ */ |
diff --git a/include/net/sock.h b/include/net/sock.h index 188532ee88b6..5a0a58ac4126 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -1129,9 +1129,9 @@ sk_sockets_allocated_read_positive(struct sock *sk) | |||
| 1129 | struct proto *prot = sk->sk_prot; | 1129 | struct proto *prot = sk->sk_prot; |
| 1130 | 1130 | ||
| 1131 | if (mem_cgroup_sockets_enabled && sk->sk_cgrp) | 1131 | if (mem_cgroup_sockets_enabled && sk->sk_cgrp) |
| 1132 | return percpu_counter_sum_positive(sk->sk_cgrp->sockets_allocated); | 1132 | return percpu_counter_read_positive(sk->sk_cgrp->sockets_allocated); |
| 1133 | 1133 | ||
| 1134 | return percpu_counter_sum_positive(prot->sockets_allocated); | 1134 | return percpu_counter_read_positive(prot->sockets_allocated); |
| 1135 | } | 1135 | } |
| 1136 | 1136 | ||
| 1137 | static inline int | 1137 | static inline int |
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 5f5ed1b8b41b..f4f1c96dca72 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
| @@ -217,11 +217,29 @@ struct domain_device { | |||
| 217 | struct kref kref; | 217 | struct kref kref; |
| 218 | }; | 218 | }; |
| 219 | 219 | ||
| 220 | struct sas_discovery_event { | 220 | struct sas_work { |
| 221 | struct list_head drain_node; | ||
| 221 | struct work_struct work; | 222 | struct work_struct work; |
| 223 | }; | ||
| 224 | |||
| 225 | static inline void INIT_SAS_WORK(struct sas_work *sw, void (*fn)(struct work_struct *)) | ||
| 226 | { | ||
| 227 | INIT_WORK(&sw->work, fn); | ||
| 228 | INIT_LIST_HEAD(&sw->drain_node); | ||
| 229 | } | ||
| 230 | |||
| 231 | struct sas_discovery_event { | ||
| 232 | struct sas_work work; | ||
| 222 | struct asd_sas_port *port; | 233 | struct asd_sas_port *port; |
| 223 | }; | 234 | }; |
| 224 | 235 | ||
| 236 | static inline struct sas_discovery_event *to_sas_discovery_event(struct work_struct *work) | ||
| 237 | { | ||
| 238 | struct sas_discovery_event *ev = container_of(work, typeof(*ev), work.work); | ||
| 239 | |||
| 240 | return ev; | ||
| 241 | } | ||
| 242 | |||
| 225 | struct sas_discovery { | 243 | struct sas_discovery { |
| 226 | struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; | 244 | struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; |
| 227 | unsigned long pending; | 245 | unsigned long pending; |
| @@ -244,7 +262,7 @@ struct asd_sas_port { | |||
| 244 | struct list_head destroy_list; | 262 | struct list_head destroy_list; |
| 245 | enum sas_linkrate linkrate; | 263 | enum sas_linkrate linkrate; |
| 246 | 264 | ||
| 247 | struct work_struct work; | 265 | struct sas_work work; |
| 248 | 266 | ||
| 249 | /* public: */ | 267 | /* public: */ |
| 250 | int id; | 268 | int id; |
| @@ -270,10 +288,17 @@ struct asd_sas_port { | |||
| 270 | }; | 288 | }; |
| 271 | 289 | ||
| 272 | struct asd_sas_event { | 290 | struct asd_sas_event { |
| 273 | struct work_struct work; | 291 | struct sas_work work; |
| 274 | struct asd_sas_phy *phy; | 292 | struct asd_sas_phy *phy; |
| 275 | }; | 293 | }; |
| 276 | 294 | ||
| 295 | static inline struct asd_sas_event *to_asd_sas_event(struct work_struct *work) | ||
| 296 | { | ||
| 297 | struct asd_sas_event *ev = container_of(work, typeof(*ev), work.work); | ||
| 298 | |||
| 299 | return ev; | ||
| 300 | } | ||
| 301 | |||
| 277 | /* The phy pretty much is controlled by the LLDD. | 302 | /* The phy pretty much is controlled by the LLDD. |
| 278 | * The class only reads those fields. | 303 | * The class only reads those fields. |
| 279 | */ | 304 | */ |
| @@ -333,10 +358,17 @@ struct scsi_core { | |||
| 333 | }; | 358 | }; |
| 334 | 359 | ||
| 335 | struct sas_ha_event { | 360 | struct sas_ha_event { |
| 336 | struct work_struct work; | 361 | struct sas_work work; |
| 337 | struct sas_ha_struct *ha; | 362 | struct sas_ha_struct *ha; |
| 338 | }; | 363 | }; |
| 339 | 364 | ||
| 365 | static inline struct sas_ha_event *to_sas_ha_event(struct work_struct *work) | ||
| 366 | { | ||
| 367 | struct sas_ha_event *ev = container_of(work, typeof(*ev), work.work); | ||
| 368 | |||
| 369 | return ev; | ||
| 370 | } | ||
| 371 | |||
| 340 | enum sas_ha_state { | 372 | enum sas_ha_state { |
| 341 | SAS_HA_REGISTERED, | 373 | SAS_HA_REGISTERED, |
| 342 | SAS_HA_DRAINING, | 374 | SAS_HA_DRAINING, |
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h index cdccd2eb7b6c..77670e823ed8 100644 --- a/include/scsi/sas_ata.h +++ b/include/scsi/sas_ata.h | |||
| @@ -37,7 +37,7 @@ static inline int dev_is_sata(struct domain_device *dev) | |||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); | 39 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); |
| 40 | int sas_ata_init_host_and_port(struct domain_device *found_dev); | 40 | int sas_ata_init(struct domain_device *dev); |
| 41 | void sas_ata_task_abort(struct sas_task *task); | 41 | void sas_ata_task_abort(struct sas_task *task); |
| 42 | void sas_ata_strategy_handler(struct Scsi_Host *shost); | 42 | void sas_ata_strategy_handler(struct Scsi_Host *shost); |
| 43 | void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, | 43 | void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, |
| @@ -52,7 +52,7 @@ static inline int dev_is_sata(struct domain_device *dev) | |||
| 52 | { | 52 | { |
| 53 | return 0; | 53 | return 0; |
| 54 | } | 54 | } |
| 55 | static inline int sas_ata_init_host_and_port(struct domain_device *found_dev) | 55 | static inline int sas_ata_init(struct domain_device *dev) |
| 56 | { | 56 | { |
| 57 | return 0; | 57 | return 0; |
| 58 | } | 58 | } |
diff --git a/init/do_mounts.c b/init/do_mounts.c index 0e93f92a0345..42b0707c3481 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
| @@ -472,7 +472,7 @@ void __init change_floppy(char *fmt, ...) | |||
| 472 | void __init mount_root(void) | 472 | void __init mount_root(void) |
| 473 | { | 473 | { |
| 474 | #ifdef CONFIG_ROOT_NFS | 474 | #ifdef CONFIG_ROOT_NFS |
| 475 | if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) { | 475 | if (ROOT_DEV == Root_NFS) { |
| 476 | if (mount_nfs_root()) | 476 | if (mount_nfs_root()) |
| 477 | return; | 477 | return; |
| 478 | 478 | ||
diff --git a/kernel/compat.c b/kernel/compat.c index 74ff8498809a..d2c67aa49ae6 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
| @@ -372,25 +372,54 @@ asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set) | |||
| 372 | 372 | ||
| 373 | #ifdef __ARCH_WANT_SYS_SIGPROCMASK | 373 | #ifdef __ARCH_WANT_SYS_SIGPROCMASK |
| 374 | 374 | ||
| 375 | asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set, | 375 | /* |
| 376 | compat_old_sigset_t __user *oset) | 376 | * sys_sigprocmask SIG_SETMASK sets the first (compat) word of the |
| 377 | * blocked set of signals to the supplied signal set | ||
| 378 | */ | ||
| 379 | static inline void compat_sig_setmask(sigset_t *blocked, compat_sigset_word set) | ||
| 377 | { | 380 | { |
| 378 | old_sigset_t s; | 381 | memcpy(blocked->sig, &set, sizeof(set)); |
| 379 | long ret; | 382 | } |
| 380 | mm_segment_t old_fs; | ||
| 381 | 383 | ||
| 382 | if (set && get_user(s, set)) | 384 | asmlinkage long compat_sys_sigprocmask(int how, |
| 383 | return -EFAULT; | 385 | compat_old_sigset_t __user *nset, |
| 384 | old_fs = get_fs(); | 386 | compat_old_sigset_t __user *oset) |
| 385 | set_fs(KERNEL_DS); | 387 | { |
| 386 | ret = sys_sigprocmask(how, | 388 | old_sigset_t old_set, new_set; |
| 387 | set ? (old_sigset_t __user *) &s : NULL, | 389 | sigset_t new_blocked; |
| 388 | oset ? (old_sigset_t __user *) &s : NULL); | 390 | |
| 389 | set_fs(old_fs); | 391 | old_set = current->blocked.sig[0]; |
| 390 | if (ret == 0) | 392 | |
| 391 | if (oset) | 393 | if (nset) { |
| 392 | ret = put_user(s, oset); | 394 | if (get_user(new_set, nset)) |
| 393 | return ret; | 395 | return -EFAULT; |
| 396 | new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP)); | ||
| 397 | |||
| 398 | new_blocked = current->blocked; | ||
| 399 | |||
| 400 | switch (how) { | ||
| 401 | case SIG_BLOCK: | ||
| 402 | sigaddsetmask(&new_blocked, new_set); | ||
| 403 | break; | ||
| 404 | case SIG_UNBLOCK: | ||
| 405 | sigdelsetmask(&new_blocked, new_set); | ||
| 406 | break; | ||
| 407 | case SIG_SETMASK: | ||
| 408 | compat_sig_setmask(&new_blocked, new_set); | ||
| 409 | break; | ||
| 410 | default: | ||
| 411 | return -EINVAL; | ||
| 412 | } | ||
| 413 | |||
| 414 | set_current_blocked(&new_blocked); | ||
| 415 | } | ||
| 416 | |||
| 417 | if (oset) { | ||
| 418 | if (put_user(old_set, oset)) | ||
| 419 | return -EFAULT; | ||
| 420 | } | ||
| 421 | |||
| 422 | return 0; | ||
| 394 | } | 423 | } |
| 395 | 424 | ||
| 396 | #endif | 425 | #endif |
diff --git a/kernel/fork.c b/kernel/fork.c index b9372a0bff18..687a15d56243 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | #include <linux/audit.h> | 47 | #include <linux/audit.h> |
| 48 | #include <linux/memcontrol.h> | 48 | #include <linux/memcontrol.h> |
| 49 | #include <linux/ftrace.h> | 49 | #include <linux/ftrace.h> |
| 50 | #include <linux/proc_fs.h> | ||
| 50 | #include <linux/profile.h> | 51 | #include <linux/profile.h> |
| 51 | #include <linux/rmap.h> | 52 | #include <linux/rmap.h> |
| 52 | #include <linux/ksm.h> | 53 | #include <linux/ksm.h> |
| @@ -1464,6 +1465,8 @@ bad_fork_cleanup_io: | |||
| 1464 | if (p->io_context) | 1465 | if (p->io_context) |
| 1465 | exit_io_context(p); | 1466 | exit_io_context(p); |
| 1466 | bad_fork_cleanup_namespaces: | 1467 | bad_fork_cleanup_namespaces: |
| 1468 | if (unlikely(clone_flags & CLONE_NEWPID)) | ||
| 1469 | pid_ns_release_proc(p->nsproxy->pid_ns); | ||
| 1467 | exit_task_namespaces(p); | 1470 | exit_task_namespaces(p); |
| 1468 | bad_fork_cleanup_mm: | 1471 | bad_fork_cleanup_mm: |
| 1469 | if (p->mm) | 1472 | if (p->mm) |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 6080f6bc8c33..3914c1e03cff 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
| @@ -518,6 +518,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) | |||
| 518 | out_unlock: | 518 | out_unlock: |
| 519 | raw_spin_unlock(&desc->lock); | 519 | raw_spin_unlock(&desc->lock); |
| 520 | } | 520 | } |
| 521 | EXPORT_SYMBOL(handle_edge_irq); | ||
| 521 | 522 | ||
| 522 | #ifdef CONFIG_IRQ_EDGE_EOI_HANDLER | 523 | #ifdef CONFIG_IRQ_EDGE_EOI_HANDLER |
| 523 | /** | 524 | /** |
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index d86e254b95eb..192a302d6cfd 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c | |||
| @@ -112,6 +112,7 @@ struct irq_desc *irq_to_desc(unsigned int irq) | |||
| 112 | { | 112 | { |
| 113 | return radix_tree_lookup(&irq_desc_tree, irq); | 113 | return radix_tree_lookup(&irq_desc_tree, irq); |
| 114 | } | 114 | } |
| 115 | EXPORT_SYMBOL(irq_to_desc); | ||
| 115 | 116 | ||
| 116 | static void delete_irq_desc(unsigned int irq) | 117 | static void delete_irq_desc(unsigned int irq) |
| 117 | { | 118 | { |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0533a688ce22..e5212ae294f6 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -6382,6 +6382,8 @@ static int __sdt_alloc(const struct cpumask *cpu_map) | |||
| 6382 | if (!sg) | 6382 | if (!sg) |
| 6383 | return -ENOMEM; | 6383 | return -ENOMEM; |
| 6384 | 6384 | ||
| 6385 | sg->next = sg; | ||
| 6386 | |||
| 6385 | *per_cpu_ptr(sdd->sg, j) = sg; | 6387 | *per_cpu_ptr(sdd->sg, j) = sg; |
| 6386 | 6388 | ||
| 6387 | sgp = kzalloc_node(sizeof(struct sched_group_power), | 6389 | sgp = kzalloc_node(sizeof(struct sched_group_power), |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 079a93ae8a9d..29111da1d100 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
| @@ -294,6 +294,9 @@ static int __ftrace_set_clr_event(const char *match, const char *sub, | |||
| 294 | if (!call->name || !call->class || !call->class->reg) | 294 | if (!call->name || !call->class || !call->class->reg) |
| 295 | continue; | 295 | continue; |
| 296 | 296 | ||
| 297 | if (call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) | ||
| 298 | continue; | ||
| 299 | |||
| 297 | if (match && | 300 | if (match && |
| 298 | strcmp(match, call->name) != 0 && | 301 | strcmp(match, call->name) != 0 && |
| 299 | strcmp(match, call->class->system) != 0) | 302 | strcmp(match, call->class->system) != 0) |
| @@ -1164,7 +1167,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events, | |||
| 1164 | return -1; | 1167 | return -1; |
| 1165 | } | 1168 | } |
| 1166 | 1169 | ||
| 1167 | if (call->class->reg) | 1170 | if (call->class->reg && !(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)) |
| 1168 | trace_create_file("enable", 0644, call->dir, call, | 1171 | trace_create_file("enable", 0644, call->dir, call, |
| 1169 | enable); | 1172 | enable); |
| 1170 | 1173 | ||
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 3dd15e8bc856..e039906b037d 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
| @@ -180,6 +180,7 @@ struct ftrace_event_call __used event_##call = { \ | |||
| 180 | .event.type = etype, \ | 180 | .event.type = etype, \ |
| 181 | .class = &event_class_ftrace_##call, \ | 181 | .class = &event_class_ftrace_##call, \ |
| 182 | .print_fmt = print, \ | 182 | .print_fmt = print, \ |
| 183 | .flags = TRACE_EVENT_FL_IGNORE_ENABLE, \ | ||
| 183 | }; \ | 184 | }; \ |
| 184 | struct ftrace_event_call __used \ | 185 | struct ftrace_event_call __used \ |
| 185 | __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; | 186 | __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5a16423a512c..ae8f708e3d75 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
| @@ -2498,7 +2498,6 @@ retry_avoidcopy: | |||
| 2498 | if (outside_reserve) { | 2498 | if (outside_reserve) { |
| 2499 | BUG_ON(huge_pte_none(pte)); | 2499 | BUG_ON(huge_pte_none(pte)); |
| 2500 | if (unmap_ref_private(mm, vma, old_page, address)) { | 2500 | if (unmap_ref_private(mm, vma, old_page, address)) { |
| 2501 | BUG_ON(page_count(old_page) != 1); | ||
| 2502 | BUG_ON(huge_pte_none(pte)); | 2501 | BUG_ON(huge_pte_none(pte)); |
| 2503 | spin_lock(&mm->page_table_lock); | 2502 | spin_lock(&mm->page_table_lock); |
| 2504 | ptep = huge_pte_offset(mm, address & huge_page_mask(h)); | 2503 | ptep = huge_pte_offset(mm, address & huge_page_mask(h)); |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 31ab9c3f0178..b659260c56ad 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -4507,6 +4507,12 @@ static void mem_cgroup_usage_unregister_event(struct cgroup *cgrp, | |||
| 4507 | swap_buffers: | 4507 | swap_buffers: |
| 4508 | /* Swap primary and spare array */ | 4508 | /* Swap primary and spare array */ |
| 4509 | thresholds->spare = thresholds->primary; | 4509 | thresholds->spare = thresholds->primary; |
| 4510 | /* If all events are unregistered, free the spare array */ | ||
| 4511 | if (!new) { | ||
| 4512 | kfree(thresholds->spare); | ||
| 4513 | thresholds->spare = NULL; | ||
| 4514 | } | ||
| 4515 | |||
| 4510 | rcu_assign_pointer(thresholds->primary, new); | 4516 | rcu_assign_pointer(thresholds->primary, new); |
| 4511 | 4517 | ||
| 4512 | /* To be sure that nobody uses thresholds */ | 4518 | /* To be sure that nobody uses thresholds */ |
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index e53bb8a256b1..1983fb1c7026 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
| @@ -82,8 +82,7 @@ void __init free_bootmem_late(unsigned long addr, unsigned long size) | |||
| 82 | 82 | ||
| 83 | static void __init __free_pages_memory(unsigned long start, unsigned long end) | 83 | static void __init __free_pages_memory(unsigned long start, unsigned long end) |
| 84 | { | 84 | { |
| 85 | int i; | 85 | unsigned long i, start_aligned, end_aligned; |
| 86 | unsigned long start_aligned, end_aligned; | ||
| 87 | int order = ilog2(BITS_PER_LONG); | 86 | int order = ilog2(BITS_PER_LONG); |
| 88 | 87 | ||
| 89 | start_aligned = (start + (BITS_PER_LONG - 1)) & ~(BITS_PER_LONG - 1); | 88 | start_aligned = (start + (BITS_PER_LONG - 1)) & ~(BITS_PER_LONG - 1); |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a712fb9e04ce..918330f71dba 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
| @@ -5203,7 +5203,7 @@ int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write, | |||
| 5203 | int ret; | 5203 | int ret; |
| 5204 | 5204 | ||
| 5205 | ret = proc_dointvec_minmax(table, write, buffer, length, ppos); | 5205 | ret = proc_dointvec_minmax(table, write, buffer, length, ppos); |
| 5206 | if (!write || (ret == -EINVAL)) | 5206 | if (!write || (ret < 0)) |
| 5207 | return ret; | 5207 | return ret; |
| 5208 | for_each_populated_zone(zone) { | 5208 | for_each_populated_zone(zone) { |
| 5209 | for_each_possible_cpu(cpu) { | 5209 | for_each_possible_cpu(cpu) { |
diff --git a/mm/percpu.c b/mm/percpu.c index f47af9123af7..bb4be7435ce3 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
| @@ -1132,20 +1132,20 @@ static void pcpu_dump_alloc_info(const char *lvl, | |||
| 1132 | for (alloc_end += gi->nr_units / upa; | 1132 | for (alloc_end += gi->nr_units / upa; |
| 1133 | alloc < alloc_end; alloc++) { | 1133 | alloc < alloc_end; alloc++) { |
| 1134 | if (!(alloc % apl)) { | 1134 | if (!(alloc % apl)) { |
| 1135 | printk("\n"); | 1135 | printk(KERN_CONT "\n"); |
| 1136 | printk("%spcpu-alloc: ", lvl); | 1136 | printk("%spcpu-alloc: ", lvl); |
| 1137 | } | 1137 | } |
| 1138 | printk("[%0*d] ", group_width, group); | 1138 | printk(KERN_CONT "[%0*d] ", group_width, group); |
| 1139 | 1139 | ||
| 1140 | for (unit_end += upa; unit < unit_end; unit++) | 1140 | for (unit_end += upa; unit < unit_end; unit++) |
| 1141 | if (gi->cpu_map[unit] != NR_CPUS) | 1141 | if (gi->cpu_map[unit] != NR_CPUS) |
| 1142 | printk("%0*d ", cpu_width, | 1142 | printk(KERN_CONT "%0*d ", cpu_width, |
| 1143 | gi->cpu_map[unit]); | 1143 | gi->cpu_map[unit]); |
| 1144 | else | 1144 | else |
| 1145 | printk("%s ", empty_str); | 1145 | printk(KERN_CONT "%s ", empty_str); |
| 1146 | } | 1146 | } |
| 1147 | } | 1147 | } |
| 1148 | printk("\n"); | 1148 | printk(KERN_CONT "\n"); |
| 1149 | } | 1149 | } |
| 1150 | 1150 | ||
| 1151 | /** | 1151 | /** |
| @@ -1650,6 +1650,16 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, | |||
| 1650 | areas[group] = ptr; | 1650 | areas[group] = ptr; |
| 1651 | 1651 | ||
| 1652 | base = min(ptr, base); | 1652 | base = min(ptr, base); |
| 1653 | } | ||
| 1654 | |||
| 1655 | /* | ||
| 1656 | * Copy data and free unused parts. This should happen after all | ||
| 1657 | * allocations are complete; otherwise, we may end up with | ||
| 1658 | * overlapping groups. | ||
| 1659 | */ | ||
| 1660 | for (group = 0; group < ai->nr_groups; group++) { | ||
| 1661 | struct pcpu_group_info *gi = &ai->groups[group]; | ||
| 1662 | void *ptr = areas[group]; | ||
| 1653 | 1663 | ||
| 1654 | for (i = 0; i < gi->nr_units; i++, ptr += ai->unit_size) { | 1664 | for (i = 0; i < gi->nr_units; i++, ptr += ai->unit_size) { |
| 1655 | if (gi->cpu_map[i] == NR_CPUS) { | 1665 | if (gi->cpu_map[i] == NR_CPUS) { |
| @@ -1885,6 +1895,8 @@ void __init setup_per_cpu_areas(void) | |||
| 1885 | fc = __alloc_bootmem(unit_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)); | 1895 | fc = __alloc_bootmem(unit_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)); |
| 1886 | if (!ai || !fc) | 1896 | if (!ai || !fc) |
| 1887 | panic("Failed to allocate memory for percpu areas."); | 1897 | panic("Failed to allocate memory for percpu areas."); |
| 1898 | /* kmemleak tracks the percpu allocations separately */ | ||
| 1899 | kmemleak_free(fc); | ||
| 1888 | 1900 | ||
| 1889 | ai->dyn_size = unit_size; | 1901 | ai->dyn_size = unit_size; |
| 1890 | ai->unit_size = unit_size; | 1902 | ai->unit_size = unit_size; |
| @@ -2040,7 +2040,7 @@ static bool has_cpu_slab(int cpu, void *info) | |||
| 2040 | struct kmem_cache *s = info; | 2040 | struct kmem_cache *s = info; |
| 2041 | struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu); | 2041 | struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu); |
| 2042 | 2042 | ||
| 2043 | return !!(c->page); | 2043 | return c->page || c->partial; |
| 2044 | } | 2044 | } |
| 2045 | 2045 | ||
| 2046 | static void flush_all(struct kmem_cache *s) | 2046 | static void flush_all(struct kmem_cache *s) |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 9988d4abb372..9757c193c86b 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
| @@ -157,7 +157,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb, | |||
| 157 | skb = __vlan_hwaccel_put_tag(skb, vlan_tci); | 157 | skb = __vlan_hwaccel_put_tag(skb, vlan_tci); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | skb_set_dev(skb, vlan_dev_priv(dev)->real_dev); | 160 | skb->dev = vlan_dev_priv(dev)->real_dev; |
| 161 | len = skb->len; | 161 | len = skb->len; |
| 162 | if (netpoll_tx_running(dev)) | 162 | if (netpoll_tx_running(dev)) |
| 163 | return skb->dev->netdev_ops->ndo_start_xmit(skb, skb->dev); | 163 | return skb->dev->netdev_ops->ndo_start_xmit(skb, skb->dev); |
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 72eb187a5f60..6fb68a9743af 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
| @@ -450,7 +450,7 @@ unsigned int bt_sock_poll(struct file *file, struct socket *sock, poll_table *wa | |||
| 450 | sk->sk_state == BT_CONFIG) | 450 | sk->sk_state == BT_CONFIG) |
| 451 | return mask; | 451 | return mask; |
| 452 | 452 | ||
| 453 | if (sock_writeable(sk)) | 453 | if (!bt_sk(sk)->suspended && sock_writeable(sk)) |
| 454 | mask |= POLLOUT | POLLWRNORM | POLLWRBAND; | 454 | mask |= POLLOUT | POLLWRNORM | POLLWRBAND; |
| 455 | else | 455 | else |
| 456 | set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); | 456 | set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 92a857e3786d..d6dc44cd15b0 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
| @@ -1215,40 +1215,40 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr) | |||
| 1215 | return NULL; | 1215 | return NULL; |
| 1216 | } | 1216 | } |
| 1217 | 1217 | ||
| 1218 | static int hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, | 1218 | static bool hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, |
| 1219 | u8 key_type, u8 old_key_type) | 1219 | u8 key_type, u8 old_key_type) |
| 1220 | { | 1220 | { |
| 1221 | /* Legacy key */ | 1221 | /* Legacy key */ |
| 1222 | if (key_type < 0x03) | 1222 | if (key_type < 0x03) |
| 1223 | return 1; | 1223 | return true; |
| 1224 | 1224 | ||
| 1225 | /* Debug keys are insecure so don't store them persistently */ | 1225 | /* Debug keys are insecure so don't store them persistently */ |
| 1226 | if (key_type == HCI_LK_DEBUG_COMBINATION) | 1226 | if (key_type == HCI_LK_DEBUG_COMBINATION) |
| 1227 | return 0; | 1227 | return false; |
| 1228 | 1228 | ||
| 1229 | /* Changed combination key and there's no previous one */ | 1229 | /* Changed combination key and there's no previous one */ |
| 1230 | if (key_type == HCI_LK_CHANGED_COMBINATION && old_key_type == 0xff) | 1230 | if (key_type == HCI_LK_CHANGED_COMBINATION && old_key_type == 0xff) |
| 1231 | return 0; | 1231 | return false; |
| 1232 | 1232 | ||
| 1233 | /* Security mode 3 case */ | 1233 | /* Security mode 3 case */ |
| 1234 | if (!conn) | 1234 | if (!conn) |
| 1235 | return 1; | 1235 | return true; |
| 1236 | 1236 | ||
| 1237 | /* Neither local nor remote side had no-bonding as requirement */ | 1237 | /* Neither local nor remote side had no-bonding as requirement */ |
| 1238 | if (conn->auth_type > 0x01 && conn->remote_auth > 0x01) | 1238 | if (conn->auth_type > 0x01 && conn->remote_auth > 0x01) |
| 1239 | return 1; | 1239 | return true; |
| 1240 | 1240 | ||
| 1241 | /* Local side had dedicated bonding as requirement */ | 1241 | /* Local side had dedicated bonding as requirement */ |
| 1242 | if (conn->auth_type == 0x02 || conn->auth_type == 0x03) | 1242 | if (conn->auth_type == 0x02 || conn->auth_type == 0x03) |
| 1243 | return 1; | 1243 | return true; |
| 1244 | 1244 | ||
| 1245 | /* Remote side had dedicated bonding as requirement */ | 1245 | /* Remote side had dedicated bonding as requirement */ |
| 1246 | if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) | 1246 | if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) |
| 1247 | return 1; | 1247 | return true; |
| 1248 | 1248 | ||
| 1249 | /* If none of the above criteria match, then don't store the key | 1249 | /* If none of the above criteria match, then don't store the key |
| 1250 | * persistently */ | 1250 | * persistently */ |
| 1251 | return 0; | 1251 | return false; |
| 1252 | } | 1252 | } |
| 1253 | 1253 | ||
| 1254 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]) | 1254 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]) |
| @@ -1285,7 +1285,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | |||
| 1285 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len) | 1285 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len) |
| 1286 | { | 1286 | { |
| 1287 | struct link_key *key, *old_key; | 1287 | struct link_key *key, *old_key; |
| 1288 | u8 old_key_type, persistent; | 1288 | u8 old_key_type; |
| 1289 | bool persistent; | ||
| 1289 | 1290 | ||
| 1290 | old_key = hci_find_link_key(hdev, bdaddr); | 1291 | old_key = hci_find_link_key(hdev, bdaddr); |
| 1291 | if (old_key) { | 1292 | if (old_key) { |
| @@ -1328,10 +1329,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | |||
| 1328 | 1329 | ||
| 1329 | mgmt_new_link_key(hdev, key, persistent); | 1330 | mgmt_new_link_key(hdev, key, persistent); |
| 1330 | 1331 | ||
| 1331 | if (!persistent) { | 1332 | if (conn) |
| 1332 | list_del(&key->list); | 1333 | conn->flush_key = !persistent; |
| 1333 | kfree(key); | ||
| 1334 | } | ||
| 1335 | 1334 | ||
| 1336 | return 0; | 1335 | return 0; |
| 1337 | } | 1336 | } |
| @@ -2785,6 +2784,14 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
| 2785 | if (conn) { | 2784 | if (conn) { |
| 2786 | hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF); | 2785 | hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF); |
| 2787 | 2786 | ||
| 2787 | hci_dev_lock(hdev); | ||
| 2788 | if (test_bit(HCI_MGMT, &hdev->dev_flags) && | ||
| 2789 | !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) | ||
| 2790 | mgmt_device_connected(hdev, &conn->dst, conn->type, | ||
| 2791 | conn->dst_type, 0, NULL, 0, | ||
| 2792 | conn->dev_class); | ||
| 2793 | hci_dev_unlock(hdev); | ||
| 2794 | |||
| 2788 | /* Send to upper protocol */ | 2795 | /* Send to upper protocol */ |
| 2789 | l2cap_recv_acldata(conn, skb, flags); | 2796 | l2cap_recv_acldata(conn, skb, flags); |
| 2790 | return; | 2797 | return; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index b37531094c49..1266f78fa8e3 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -1901,6 +1901,8 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff | |||
| 1901 | } | 1901 | } |
| 1902 | 1902 | ||
| 1903 | if (ev->status == 0) { | 1903 | if (ev->status == 0) { |
| 1904 | if (conn->type == ACL_LINK && conn->flush_key) | ||
| 1905 | hci_remove_link_key(hdev, &conn->dst); | ||
| 1904 | hci_proto_disconn_cfm(conn, ev->reason); | 1906 | hci_proto_disconn_cfm(conn, ev->reason); |
| 1905 | hci_conn_del(conn); | 1907 | hci_conn_del(conn); |
| 1906 | } | 1908 | } |
| @@ -2037,6 +2039,12 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff * | |||
| 2037 | 2039 | ||
| 2038 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | 2040 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
| 2039 | 2041 | ||
| 2042 | if (ev->status && conn->state == BT_CONNECTED) { | ||
| 2043 | hci_acl_disconn(conn, 0x13); | ||
| 2044 | hci_conn_put(conn); | ||
| 2045 | goto unlock; | ||
| 2046 | } | ||
| 2047 | |||
| 2040 | if (conn->state == BT_CONFIG) { | 2048 | if (conn->state == BT_CONFIG) { |
| 2041 | if (!ev->status) | 2049 | if (!ev->status) |
| 2042 | conn->state = BT_CONNECTED; | 2050 | conn->state = BT_CONNECTED; |
| @@ -2047,6 +2055,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff * | |||
| 2047 | hci_encrypt_cfm(conn, ev->status, ev->encrypt); | 2055 | hci_encrypt_cfm(conn, ev->status, ev->encrypt); |
| 2048 | } | 2056 | } |
| 2049 | 2057 | ||
| 2058 | unlock: | ||
| 2050 | hci_dev_unlock(hdev); | 2059 | hci_dev_unlock(hdev); |
| 2051 | } | 2060 | } |
| 2052 | 2061 | ||
| @@ -2100,7 +2109,7 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff | |||
| 2100 | goto unlock; | 2109 | goto unlock; |
| 2101 | } | 2110 | } |
| 2102 | 2111 | ||
| 2103 | if (!ev->status) { | 2112 | if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) { |
| 2104 | struct hci_cp_remote_name_req cp; | 2113 | struct hci_cp_remote_name_req cp; |
| 2105 | memset(&cp, 0, sizeof(cp)); | 2114 | memset(&cp, 0, sizeof(cp)); |
| 2106 | bacpy(&cp.bdaddr, &conn->dst); | 2115 | bacpy(&cp.bdaddr, &conn->dst); |
| @@ -2311,6 +2320,7 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk | |||
| 2311 | 2320 | ||
| 2312 | case HCI_OP_USER_PASSKEY_NEG_REPLY: | 2321 | case HCI_OP_USER_PASSKEY_NEG_REPLY: |
| 2313 | hci_cc_user_passkey_neg_reply(hdev, skb); | 2322 | hci_cc_user_passkey_neg_reply(hdev, skb); |
| 2323 | break; | ||
| 2314 | 2324 | ||
| 2315 | case HCI_OP_LE_SET_SCAN_PARAM: | 2325 | case HCI_OP_LE_SET_SCAN_PARAM: |
| 2316 | hci_cc_le_set_scan_param(hdev, skb); | 2326 | hci_cc_le_set_scan_param(hdev, skb); |
| @@ -2868,7 +2878,7 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b | |||
| 2868 | if (conn->state != BT_CONFIG) | 2878 | if (conn->state != BT_CONFIG) |
| 2869 | goto unlock; | 2879 | goto unlock; |
| 2870 | 2880 | ||
| 2871 | if (!ev->status) { | 2881 | if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) { |
| 2872 | struct hci_cp_remote_name_req cp; | 2882 | struct hci_cp_remote_name_req cp; |
| 2873 | memset(&cp, 0, sizeof(cp)); | 2883 | memset(&cp, 0, sizeof(cp)); |
| 2874 | bacpy(&cp.bdaddr, &conn->dst); | 2884 | bacpy(&cp.bdaddr, &conn->dst); |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 94552b33d528..6f9c25b633a6 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
| @@ -4589,6 +4589,11 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
| 4589 | 4589 | ||
| 4590 | if (!status && (chan->state == BT_CONNECTED || | 4590 | if (!status && (chan->state == BT_CONNECTED || |
| 4591 | chan->state == BT_CONFIG)) { | 4591 | chan->state == BT_CONFIG)) { |
| 4592 | struct sock *sk = chan->sk; | ||
| 4593 | |||
| 4594 | bt_sk(sk)->suspended = false; | ||
| 4595 | sk->sk_state_change(sk); | ||
| 4596 | |||
| 4592 | l2cap_check_encryption(chan, encrypt); | 4597 | l2cap_check_encryption(chan, encrypt); |
| 4593 | l2cap_chan_unlock(chan); | 4598 | l2cap_chan_unlock(chan); |
| 4594 | continue; | 4599 | continue; |
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 29122ed28ea9..04e7c172d49c 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
| @@ -592,10 +592,14 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch | |||
| 592 | sk->sk_state = BT_CONFIG; | 592 | sk->sk_state = BT_CONFIG; |
| 593 | chan->state = BT_CONFIG; | 593 | chan->state = BT_CONFIG; |
| 594 | 594 | ||
| 595 | /* or for ACL link, under defer_setup time */ | 595 | /* or for ACL link */ |
| 596 | } else if (sk->sk_state == BT_CONNECT2 && | 596 | } else if ((sk->sk_state == BT_CONNECT2 && |
| 597 | bt_sk(sk)->defer_setup) { | 597 | bt_sk(sk)->defer_setup) || |
| 598 | err = l2cap_chan_check_security(chan); | 598 | sk->sk_state == BT_CONNECTED) { |
| 599 | if (!l2cap_chan_check_security(chan)) | ||
| 600 | bt_sk(sk)->suspended = true; | ||
| 601 | else | ||
| 602 | sk->sk_state_change(sk); | ||
| 599 | } else { | 603 | } else { |
| 600 | err = -EINVAL; | 604 | err = -EINVAL; |
| 601 | } | 605 | } |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 4ef275c69675..4bb03b111122 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
| @@ -2884,7 +2884,7 @@ int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status) | |||
| 2884 | return 0; | 2884 | return 0; |
| 2885 | } | 2885 | } |
| 2886 | 2886 | ||
| 2887 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, u8 persistent) | 2887 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, bool persistent) |
| 2888 | { | 2888 | { |
| 2889 | struct mgmt_ev_new_link_key ev; | 2889 | struct mgmt_ev_new_link_key ev; |
| 2890 | 2890 | ||
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 61f65344e711..a2098e3de500 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
| @@ -47,6 +47,7 @@ int br_dev_queue_push_xmit(struct sk_buff *skb) | |||
| 47 | kfree_skb(skb); | 47 | kfree_skb(skb); |
| 48 | } else { | 48 | } else { |
| 49 | skb_push(skb, ETH_HLEN); | 49 | skb_push(skb, ETH_HLEN); |
| 50 | br_drop_fake_rtable(skb); | ||
| 50 | dev_queue_xmit(skb); | 51 | dev_queue_xmit(skb); |
| 51 | } | 52 | } |
| 52 | 53 | ||
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index dec4f3817133..d7f49b63ab0f 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
| @@ -156,7 +156,7 @@ void br_netfilter_rtable_init(struct net_bridge *br) | |||
| 156 | rt->dst.dev = br->dev; | 156 | rt->dst.dev = br->dev; |
| 157 | rt->dst.path = &rt->dst; | 157 | rt->dst.path = &rt->dst; |
| 158 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); | 158 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); |
| 159 | rt->dst.flags = DST_NOXFRM | DST_NOPEER; | 159 | rt->dst.flags = DST_NOXFRM | DST_NOPEER | DST_FAKE_RTABLE; |
| 160 | rt->dst.ops = &fake_dst_ops; | 160 | rt->dst.ops = &fake_dst_ops; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| @@ -694,11 +694,7 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb, | |||
| 694 | const struct net_device *out, | 694 | const struct net_device *out, |
| 695 | int (*okfn)(struct sk_buff *)) | 695 | int (*okfn)(struct sk_buff *)) |
| 696 | { | 696 | { |
| 697 | struct rtable *rt = skb_rtable(skb); | 697 | br_drop_fake_rtable(skb); |
| 698 | |||
| 699 | if (rt && rt == bridge_parent_rtable(in)) | ||
| 700 | skb_dst_drop(skb); | ||
| 701 | |||
| 702 | return NF_ACCEPT; | 698 | return NF_ACCEPT; |
| 703 | } | 699 | } |
| 704 | 700 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 9bb8f87c4cda..99e1d759f41e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -1617,10 +1617,14 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) | |||
| 1617 | return NET_RX_DROP; | 1617 | return NET_RX_DROP; |
| 1618 | } | 1618 | } |
| 1619 | skb->skb_iif = 0; | 1619 | skb->skb_iif = 0; |
| 1620 | skb_set_dev(skb, dev); | 1620 | skb->dev = dev; |
| 1621 | skb_dst_drop(skb); | ||
| 1621 | skb->tstamp.tv64 = 0; | 1622 | skb->tstamp.tv64 = 0; |
| 1622 | skb->pkt_type = PACKET_HOST; | 1623 | skb->pkt_type = PACKET_HOST; |
| 1623 | skb->protocol = eth_type_trans(skb, dev); | 1624 | skb->protocol = eth_type_trans(skb, dev); |
| 1625 | skb->mark = 0; | ||
| 1626 | secpath_reset(skb); | ||
| 1627 | nf_reset(skb); | ||
| 1624 | return netif_rx(skb); | 1628 | return netif_rx(skb); |
| 1625 | } | 1629 | } |
| 1626 | EXPORT_SYMBOL_GPL(dev_forward_skb); | 1630 | EXPORT_SYMBOL_GPL(dev_forward_skb); |
| @@ -1869,36 +1873,6 @@ void netif_device_attach(struct net_device *dev) | |||
| 1869 | } | 1873 | } |
| 1870 | EXPORT_SYMBOL(netif_device_attach); | 1874 | EXPORT_SYMBOL(netif_device_attach); |
| 1871 | 1875 | ||
| 1872 | /** | ||
| 1873 | * skb_dev_set -- assign a new device to a buffer | ||
| 1874 | * @skb: buffer for the new device | ||
| 1875 | * @dev: network device | ||
| 1876 | * | ||
| 1877 | * If an skb is owned by a device already, we have to reset | ||
| 1878 | * all data private to the namespace a device belongs to | ||
| 1879 | * before assigning it a new device. | ||
| 1880 | */ | ||
| 1881 | #ifdef CONFIG_NET_NS | ||
| 1882 | void skb_set_dev(struct sk_buff *skb, struct net_device *dev) | ||
| 1883 | { | ||
| 1884 | skb_dst_drop(skb); | ||
| 1885 | if (skb->dev && !net_eq(dev_net(skb->dev), dev_net(dev))) { | ||
| 1886 | secpath_reset(skb); | ||
| 1887 | nf_reset(skb); | ||
| 1888 | skb_init_secmark(skb); | ||
| 1889 | skb->mark = 0; | ||
| 1890 | skb->priority = 0; | ||
| 1891 | skb->nf_trace = 0; | ||
| 1892 | skb->ipvs_property = 0; | ||
| 1893 | #ifdef CONFIG_NET_SCHED | ||
| 1894 | skb->tc_index = 0; | ||
| 1895 | #endif | ||
| 1896 | } | ||
| 1897 | skb->dev = dev; | ||
| 1898 | } | ||
| 1899 | EXPORT_SYMBOL(skb_set_dev); | ||
| 1900 | #endif /* CONFIG_NET_NS */ | ||
| 1901 | |||
| 1902 | static void skb_warn_bad_offload(const struct sk_buff *skb) | 1876 | static void skb_warn_bad_offload(const struct sk_buff *skb) |
| 1903 | { | 1877 | { |
| 1904 | static const netdev_features_t null_features = 0; | 1878 | static const netdev_features_t null_features = 0; |
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 5c3c81a609e5..a7cad741df01 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
| @@ -42,13 +42,14 @@ static void send_dm_alert(struct work_struct *unused); | |||
| 42 | * netlink alerts | 42 | * netlink alerts |
| 43 | */ | 43 | */ |
| 44 | static int trace_state = TRACE_OFF; | 44 | static int trace_state = TRACE_OFF; |
| 45 | static DEFINE_SPINLOCK(trace_state_lock); | 45 | static DEFINE_MUTEX(trace_state_mutex); |
| 46 | 46 | ||
| 47 | struct per_cpu_dm_data { | 47 | struct per_cpu_dm_data { |
| 48 | struct work_struct dm_alert_work; | 48 | struct work_struct dm_alert_work; |
| 49 | struct sk_buff *skb; | 49 | struct sk_buff __rcu *skb; |
| 50 | atomic_t dm_hit_count; | 50 | atomic_t dm_hit_count; |
| 51 | struct timer_list send_timer; | 51 | struct timer_list send_timer; |
| 52 | int cpu; | ||
| 52 | }; | 53 | }; |
| 53 | 54 | ||
| 54 | struct dm_hw_stat_delta { | 55 | struct dm_hw_stat_delta { |
| @@ -79,29 +80,53 @@ static void reset_per_cpu_data(struct per_cpu_dm_data *data) | |||
| 79 | size_t al; | 80 | size_t al; |
| 80 | struct net_dm_alert_msg *msg; | 81 | struct net_dm_alert_msg *msg; |
| 81 | struct nlattr *nla; | 82 | struct nlattr *nla; |
| 83 | struct sk_buff *skb; | ||
| 84 | struct sk_buff *oskb = rcu_dereference_protected(data->skb, 1); | ||
| 82 | 85 | ||
| 83 | al = sizeof(struct net_dm_alert_msg); | 86 | al = sizeof(struct net_dm_alert_msg); |
| 84 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); | 87 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); |
| 85 | al += sizeof(struct nlattr); | 88 | al += sizeof(struct nlattr); |
| 86 | 89 | ||
| 87 | data->skb = genlmsg_new(al, GFP_KERNEL); | 90 | skb = genlmsg_new(al, GFP_KERNEL); |
| 88 | genlmsg_put(data->skb, 0, 0, &net_drop_monitor_family, | 91 | |
| 89 | 0, NET_DM_CMD_ALERT); | 92 | if (skb) { |
| 90 | nla = nla_reserve(data->skb, NLA_UNSPEC, sizeof(struct net_dm_alert_msg)); | 93 | genlmsg_put(skb, 0, 0, &net_drop_monitor_family, |
| 91 | msg = nla_data(nla); | 94 | 0, NET_DM_CMD_ALERT); |
| 92 | memset(msg, 0, al); | 95 | nla = nla_reserve(skb, NLA_UNSPEC, |
| 93 | atomic_set(&data->dm_hit_count, dm_hit_limit); | 96 | sizeof(struct net_dm_alert_msg)); |
| 97 | msg = nla_data(nla); | ||
| 98 | memset(msg, 0, al); | ||
| 99 | } else | ||
| 100 | schedule_work_on(data->cpu, &data->dm_alert_work); | ||
| 101 | |||
| 102 | /* | ||
| 103 | * Don't need to lock this, since we are guaranteed to only | ||
| 104 | * run this on a single cpu at a time. | ||
| 105 | * Note also that we only update data->skb if the old and new skb | ||
| 106 | * pointers don't match. This ensures that we don't continually call | ||
| 107 | * synchornize_rcu if we repeatedly fail to alloc a new netlink message. | ||
| 108 | */ | ||
| 109 | if (skb != oskb) { | ||
| 110 | rcu_assign_pointer(data->skb, skb); | ||
| 111 | |||
| 112 | synchronize_rcu(); | ||
| 113 | |||
| 114 | atomic_set(&data->dm_hit_count, dm_hit_limit); | ||
| 115 | } | ||
| 116 | |||
| 94 | } | 117 | } |
| 95 | 118 | ||
| 96 | static void send_dm_alert(struct work_struct *unused) | 119 | static void send_dm_alert(struct work_struct *unused) |
| 97 | { | 120 | { |
| 98 | struct sk_buff *skb; | 121 | struct sk_buff *skb; |
| 99 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 122 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); |
| 123 | |||
| 124 | WARN_ON_ONCE(data->cpu != smp_processor_id()); | ||
| 100 | 125 | ||
| 101 | /* | 126 | /* |
| 102 | * Grab the skb we're about to send | 127 | * Grab the skb we're about to send |
| 103 | */ | 128 | */ |
| 104 | skb = data->skb; | 129 | skb = rcu_dereference_protected(data->skb, 1); |
| 105 | 130 | ||
| 106 | /* | 131 | /* |
| 107 | * Replace it with a new one | 132 | * Replace it with a new one |
| @@ -111,8 +136,10 @@ static void send_dm_alert(struct work_struct *unused) | |||
| 111 | /* | 136 | /* |
| 112 | * Ship it! | 137 | * Ship it! |
| 113 | */ | 138 | */ |
| 114 | genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | 139 | if (skb) |
| 140 | genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | ||
| 115 | 141 | ||
| 142 | put_cpu_var(dm_cpu_data); | ||
| 116 | } | 143 | } |
| 117 | 144 | ||
| 118 | /* | 145 | /* |
| @@ -123,9 +150,11 @@ static void send_dm_alert(struct work_struct *unused) | |||
| 123 | */ | 150 | */ |
| 124 | static void sched_send_work(unsigned long unused) | 151 | static void sched_send_work(unsigned long unused) |
| 125 | { | 152 | { |
| 126 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 153 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); |
| 154 | |||
| 155 | schedule_work_on(smp_processor_id(), &data->dm_alert_work); | ||
| 127 | 156 | ||
| 128 | schedule_work(&data->dm_alert_work); | 157 | put_cpu_var(dm_cpu_data); |
| 129 | } | 158 | } |
| 130 | 159 | ||
| 131 | static void trace_drop_common(struct sk_buff *skb, void *location) | 160 | static void trace_drop_common(struct sk_buff *skb, void *location) |
| @@ -134,8 +163,15 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
| 134 | struct nlmsghdr *nlh; | 163 | struct nlmsghdr *nlh; |
| 135 | struct nlattr *nla; | 164 | struct nlattr *nla; |
| 136 | int i; | 165 | int i; |
| 137 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 166 | struct sk_buff *dskb; |
| 167 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); | ||
| 168 | |||
| 169 | |||
| 170 | rcu_read_lock(); | ||
| 171 | dskb = rcu_dereference(data->skb); | ||
| 138 | 172 | ||
| 173 | if (!dskb) | ||
| 174 | goto out; | ||
| 139 | 175 | ||
| 140 | if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) { | 176 | if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) { |
| 141 | /* | 177 | /* |
| @@ -144,7 +180,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
| 144 | goto out; | 180 | goto out; |
| 145 | } | 181 | } |
| 146 | 182 | ||
| 147 | nlh = (struct nlmsghdr *)data->skb->data; | 183 | nlh = (struct nlmsghdr *)dskb->data; |
| 148 | nla = genlmsg_data(nlmsg_data(nlh)); | 184 | nla = genlmsg_data(nlmsg_data(nlh)); |
| 149 | msg = nla_data(nla); | 185 | msg = nla_data(nla); |
| 150 | for (i = 0; i < msg->entries; i++) { | 186 | for (i = 0; i < msg->entries; i++) { |
| @@ -158,7 +194,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
| 158 | /* | 194 | /* |
| 159 | * We need to create a new entry | 195 | * We need to create a new entry |
| 160 | */ | 196 | */ |
| 161 | __nla_reserve_nohdr(data->skb, sizeof(struct net_dm_drop_point)); | 197 | __nla_reserve_nohdr(dskb, sizeof(struct net_dm_drop_point)); |
| 162 | nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); | 198 | nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); |
| 163 | memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); | 199 | memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); |
| 164 | msg->points[msg->entries].count = 1; | 200 | msg->points[msg->entries].count = 1; |
| @@ -170,6 +206,8 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
| 170 | } | 206 | } |
| 171 | 207 | ||
| 172 | out: | 208 | out: |
| 209 | rcu_read_unlock(); | ||
| 210 | put_cpu_var(dm_cpu_data); | ||
| 173 | return; | 211 | return; |
| 174 | } | 212 | } |
| 175 | 213 | ||
| @@ -214,7 +252,7 @@ static int set_all_monitor_traces(int state) | |||
| 214 | struct dm_hw_stat_delta *new_stat = NULL; | 252 | struct dm_hw_stat_delta *new_stat = NULL; |
| 215 | struct dm_hw_stat_delta *temp; | 253 | struct dm_hw_stat_delta *temp; |
| 216 | 254 | ||
| 217 | spin_lock(&trace_state_lock); | 255 | mutex_lock(&trace_state_mutex); |
| 218 | 256 | ||
| 219 | if (state == trace_state) { | 257 | if (state == trace_state) { |
| 220 | rc = -EAGAIN; | 258 | rc = -EAGAIN; |
| @@ -253,7 +291,7 @@ static int set_all_monitor_traces(int state) | |||
| 253 | rc = -EINPROGRESS; | 291 | rc = -EINPROGRESS; |
| 254 | 292 | ||
| 255 | out_unlock: | 293 | out_unlock: |
| 256 | spin_unlock(&trace_state_lock); | 294 | mutex_unlock(&trace_state_mutex); |
| 257 | 295 | ||
| 258 | return rc; | 296 | return rc; |
| 259 | } | 297 | } |
| @@ -296,12 +334,12 @@ static int dropmon_net_event(struct notifier_block *ev_block, | |||
| 296 | 334 | ||
| 297 | new_stat->dev = dev; | 335 | new_stat->dev = dev; |
| 298 | new_stat->last_rx = jiffies; | 336 | new_stat->last_rx = jiffies; |
| 299 | spin_lock(&trace_state_lock); | 337 | mutex_lock(&trace_state_mutex); |
| 300 | list_add_rcu(&new_stat->list, &hw_stats_list); | 338 | list_add_rcu(&new_stat->list, &hw_stats_list); |
| 301 | spin_unlock(&trace_state_lock); | 339 | mutex_unlock(&trace_state_mutex); |
| 302 | break; | 340 | break; |
| 303 | case NETDEV_UNREGISTER: | 341 | case NETDEV_UNREGISTER: |
| 304 | spin_lock(&trace_state_lock); | 342 | mutex_lock(&trace_state_mutex); |
| 305 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { | 343 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { |
| 306 | if (new_stat->dev == dev) { | 344 | if (new_stat->dev == dev) { |
| 307 | new_stat->dev = NULL; | 345 | new_stat->dev = NULL; |
| @@ -312,7 +350,7 @@ static int dropmon_net_event(struct notifier_block *ev_block, | |||
| 312 | } | 350 | } |
| 313 | } | 351 | } |
| 314 | } | 352 | } |
| 315 | spin_unlock(&trace_state_lock); | 353 | mutex_unlock(&trace_state_mutex); |
| 316 | break; | 354 | break; |
| 317 | } | 355 | } |
| 318 | out: | 356 | out: |
| @@ -368,13 +406,15 @@ static int __init init_net_drop_monitor(void) | |||
| 368 | 406 | ||
| 369 | for_each_present_cpu(cpu) { | 407 | for_each_present_cpu(cpu) { |
| 370 | data = &per_cpu(dm_cpu_data, cpu); | 408 | data = &per_cpu(dm_cpu_data, cpu); |
| 371 | reset_per_cpu_data(data); | 409 | data->cpu = cpu; |
| 372 | INIT_WORK(&data->dm_alert_work, send_dm_alert); | 410 | INIT_WORK(&data->dm_alert_work, send_dm_alert); |
| 373 | init_timer(&data->send_timer); | 411 | init_timer(&data->send_timer); |
| 374 | data->send_timer.data = cpu; | 412 | data->send_timer.data = cpu; |
| 375 | data->send_timer.function = sched_send_work; | 413 | data->send_timer.function = sched_send_work; |
| 414 | reset_per_cpu_data(data); | ||
| 376 | } | 415 | } |
| 377 | 416 | ||
| 417 | |||
| 378 | goto out; | 418 | goto out; |
| 379 | 419 | ||
| 380 | out_unreg: | 420 | out_unreg: |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 4d8ce93cd503..77a59980b579 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
| @@ -1931,7 +1931,7 @@ static int pktgen_device_event(struct notifier_block *unused, | |||
| 1931 | { | 1931 | { |
| 1932 | struct net_device *dev = ptr; | 1932 | struct net_device *dev = ptr; |
| 1933 | 1933 | ||
| 1934 | if (!net_eq(dev_net(dev), &init_net)) | 1934 | if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting) |
| 1935 | return NOTIFY_DONE; | 1935 | return NOTIFY_DONE; |
| 1936 | 1936 | ||
| 1937 | /* It is OK that we do not hold the group lock right now, | 1937 | /* It is OK that we do not hold the group lock right now, |
| @@ -3755,12 +3755,18 @@ static void __exit pg_cleanup(void) | |||
| 3755 | { | 3755 | { |
| 3756 | struct pktgen_thread *t; | 3756 | struct pktgen_thread *t; |
| 3757 | struct list_head *q, *n; | 3757 | struct list_head *q, *n; |
| 3758 | struct list_head list; | ||
| 3758 | 3759 | ||
| 3759 | /* Stop all interfaces & threads */ | 3760 | /* Stop all interfaces & threads */ |
| 3760 | pktgen_exiting = true; | 3761 | pktgen_exiting = true; |
| 3761 | 3762 | ||
| 3762 | list_for_each_safe(q, n, &pktgen_threads) { | 3763 | mutex_lock(&pktgen_thread_lock); |
| 3764 | list_splice(&list, &pktgen_threads); | ||
| 3765 | mutex_unlock(&pktgen_thread_lock); | ||
| 3766 | |||
| 3767 | list_for_each_safe(q, n, &list) { | ||
| 3763 | t = list_entry(q, struct pktgen_thread, th_list); | 3768 | t = list_entry(q, struct pktgen_thread, th_list); |
| 3769 | list_del(&t->th_list); | ||
| 3764 | kthread_stop(t->tsk); | 3770 | kthread_stop(t->tsk); |
| 3765 | kfree(t); | 3771 | kfree(t); |
| 3766 | } | 3772 | } |
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 368515885368..840821b90bcd 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c | |||
| @@ -1044,6 +1044,24 @@ static void lowpan_dev_free(struct net_device *dev) | |||
| 1044 | free_netdev(dev); | 1044 | free_netdev(dev); |
| 1045 | } | 1045 | } |
| 1046 | 1046 | ||
| 1047 | static struct wpan_phy *lowpan_get_phy(const struct net_device *dev) | ||
| 1048 | { | ||
| 1049 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
| 1050 | return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); | ||
| 1051 | } | ||
| 1052 | |||
| 1053 | static u16 lowpan_get_pan_id(const struct net_device *dev) | ||
| 1054 | { | ||
| 1055 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
| 1056 | return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | static u16 lowpan_get_short_addr(const struct net_device *dev) | ||
| 1060 | { | ||
| 1061 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
| 1062 | return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); | ||
| 1063 | } | ||
| 1064 | |||
| 1047 | static struct header_ops lowpan_header_ops = { | 1065 | static struct header_ops lowpan_header_ops = { |
| 1048 | .create = lowpan_header_create, | 1066 | .create = lowpan_header_create, |
| 1049 | }; | 1067 | }; |
| @@ -1053,6 +1071,12 @@ static const struct net_device_ops lowpan_netdev_ops = { | |||
| 1053 | .ndo_set_mac_address = eth_mac_addr, | 1071 | .ndo_set_mac_address = eth_mac_addr, |
| 1054 | }; | 1072 | }; |
| 1055 | 1073 | ||
| 1074 | static struct ieee802154_mlme_ops lowpan_mlme = { | ||
| 1075 | .get_pan_id = lowpan_get_pan_id, | ||
| 1076 | .get_phy = lowpan_get_phy, | ||
| 1077 | .get_short_addr = lowpan_get_short_addr, | ||
| 1078 | }; | ||
| 1079 | |||
| 1056 | static void lowpan_setup(struct net_device *dev) | 1080 | static void lowpan_setup(struct net_device *dev) |
| 1057 | { | 1081 | { |
| 1058 | pr_debug("(%s)\n", __func__); | 1082 | pr_debug("(%s)\n", __func__); |
| @@ -1070,6 +1094,7 @@ static void lowpan_setup(struct net_device *dev) | |||
| 1070 | 1094 | ||
| 1071 | dev->netdev_ops = &lowpan_netdev_ops; | 1095 | dev->netdev_ops = &lowpan_netdev_ops; |
| 1072 | dev->header_ops = &lowpan_header_ops; | 1096 | dev->header_ops = &lowpan_header_ops; |
| 1097 | dev->ml_priv = &lowpan_mlme; | ||
| 1073 | dev->destructor = lowpan_dev_free; | 1098 | dev->destructor = lowpan_dev_free; |
| 1074 | } | 1099 | } |
| 1075 | 1100 | ||
| @@ -1143,6 +1168,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev, | |||
| 1143 | list_add_tail(&entry->list, &lowpan_devices); | 1168 | list_add_tail(&entry->list, &lowpan_devices); |
| 1144 | mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx); | 1169 | mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx); |
| 1145 | 1170 | ||
| 1171 | spin_lock_init(&flist_lock); | ||
| 1172 | |||
| 1146 | register_netdevice(dev); | 1173 | register_netdevice(dev); |
| 1147 | 1174 | ||
| 1148 | return 0; | 1175 | return 0; |
| @@ -1152,11 +1179,20 @@ static void lowpan_dellink(struct net_device *dev, struct list_head *head) | |||
| 1152 | { | 1179 | { |
| 1153 | struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev); | 1180 | struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev); |
| 1154 | struct net_device *real_dev = lowpan_dev->real_dev; | 1181 | struct net_device *real_dev = lowpan_dev->real_dev; |
| 1155 | struct lowpan_dev_record *entry; | 1182 | struct lowpan_dev_record *entry, *tmp; |
| 1156 | struct lowpan_dev_record *tmp; | 1183 | struct lowpan_fragment *frame, *tframe; |
| 1157 | 1184 | ||
| 1158 | ASSERT_RTNL(); | 1185 | ASSERT_RTNL(); |
| 1159 | 1186 | ||
| 1187 | spin_lock(&flist_lock); | ||
| 1188 | list_for_each_entry_safe(frame, tframe, &lowpan_fragments, list) { | ||
| 1189 | del_timer(&frame->timer); | ||
| 1190 | list_del(&frame->list); | ||
| 1191 | dev_kfree_skb(frame->skb); | ||
| 1192 | kfree(frame); | ||
| 1193 | } | ||
| 1194 | spin_unlock(&flist_lock); | ||
| 1195 | |||
| 1160 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); | 1196 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); |
| 1161 | list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) { | 1197 | list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) { |
| 1162 | if (entry->ldev == dev) { | 1198 | if (entry->ldev == dev) { |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index bce36f1a37b4..30b88d7b4bd6 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -1370,6 +1370,8 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l, | |||
| 1370 | 1370 | ||
| 1371 | if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) | 1371 | if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) |
| 1372 | continue; | 1372 | continue; |
| 1373 | if (fi->fib_dead) | ||
| 1374 | continue; | ||
| 1373 | if (fa->fa_info->fib_scope < flp->flowi4_scope) | 1375 | if (fa->fa_info->fib_scope < flp->flowi4_scope) |
| 1374 | continue; | 1376 | continue; |
| 1375 | fib_alias_accessed(fa); | 1377 | fib_alias_accessed(fa); |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 8d25a1c557eb..8f8db724bfaf 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
| @@ -141,7 +141,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, | |||
| 141 | goto rtattr_failure; | 141 | goto rtattr_failure; |
| 142 | 142 | ||
| 143 | if (icsk == NULL) { | 143 | if (icsk == NULL) { |
| 144 | r->idiag_rqueue = r->idiag_wqueue = 0; | 144 | handler->idiag_get_info(sk, r, NULL); |
| 145 | goto out; | 145 | goto out; |
| 146 | } | 146 | } |
| 147 | 147 | ||
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 8bb6adeb62c0..6589e11d57b6 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -851,8 +851,7 @@ new_segment: | |||
| 851 | wait_for_sndbuf: | 851 | wait_for_sndbuf: |
| 852 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | 852 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); |
| 853 | wait_for_memory: | 853 | wait_for_memory: |
| 854 | if (copied) | 854 | tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH); |
| 855 | tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH); | ||
| 856 | 855 | ||
| 857 | if ((err = sk_stream_wait_memory(sk, &timeo)) != 0) | 856 | if ((err = sk_stream_wait_memory(sk, &timeo)) != 0) |
| 858 | goto do_error; | 857 | goto do_error; |
| @@ -3243,7 +3242,7 @@ void __init tcp_init(void) | |||
| 3243 | { | 3242 | { |
| 3244 | struct sk_buff *skb = NULL; | 3243 | struct sk_buff *skb = NULL; |
| 3245 | unsigned long limit; | 3244 | unsigned long limit; |
| 3246 | int max_share, cnt; | 3245 | int max_rshare, max_wshare, cnt; |
| 3247 | unsigned int i; | 3246 | unsigned int i; |
| 3248 | unsigned long jiffy = jiffies; | 3247 | unsigned long jiffy = jiffies; |
| 3249 | 3248 | ||
| @@ -3303,15 +3302,16 @@ void __init tcp_init(void) | |||
| 3303 | tcp_init_mem(&init_net); | 3302 | tcp_init_mem(&init_net); |
| 3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ | 3303 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ |
| 3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); | 3304 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); |
| 3306 | max_share = min(4UL*1024*1024, limit); | 3305 | max_wshare = min(4UL*1024*1024, limit); |
| 3306 | max_rshare = min(6UL*1024*1024, limit); | ||
| 3307 | 3307 | ||
| 3308 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; | 3308 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; |
| 3309 | sysctl_tcp_wmem[1] = 16*1024; | 3309 | sysctl_tcp_wmem[1] = 16*1024; |
| 3310 | sysctl_tcp_wmem[2] = max(64*1024, max_share); | 3310 | sysctl_tcp_wmem[2] = max(64*1024, max_wshare); |
| 3311 | 3311 | ||
| 3312 | sysctl_tcp_rmem[0] = SK_MEM_QUANTUM; | 3312 | sysctl_tcp_rmem[0] = SK_MEM_QUANTUM; |
| 3313 | sysctl_tcp_rmem[1] = 87380; | 3313 | sysctl_tcp_rmem[1] = 87380; |
| 3314 | sysctl_tcp_rmem[2] = max(87380, max_share); | 3314 | sysctl_tcp_rmem[2] = max(87380, max_rshare); |
| 3315 | 3315 | ||
| 3316 | pr_info("Hash tables configured (established %u bind %u)\n", | 3316 | pr_info("Hash tables configured (established %u bind %u)\n", |
| 3317 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); | 3317 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 3ff364065376..257b61789eeb 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -85,7 +85,7 @@ int sysctl_tcp_ecn __read_mostly = 2; | |||
| 85 | EXPORT_SYMBOL(sysctl_tcp_ecn); | 85 | EXPORT_SYMBOL(sysctl_tcp_ecn); |
| 86 | int sysctl_tcp_dsack __read_mostly = 1; | 86 | int sysctl_tcp_dsack __read_mostly = 1; |
| 87 | int sysctl_tcp_app_win __read_mostly = 31; | 87 | int sysctl_tcp_app_win __read_mostly = 31; |
| 88 | int sysctl_tcp_adv_win_scale __read_mostly = 2; | 88 | int sysctl_tcp_adv_win_scale __read_mostly = 1; |
| 89 | EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); | 89 | EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); |
| 90 | 90 | ||
| 91 | int sysctl_tcp_stdurg __read_mostly; | 91 | int sysctl_tcp_stdurg __read_mostly; |
| @@ -495,7 +495,7 @@ static inline void tcp_rcv_rtt_measure(struct tcp_sock *tp) | |||
| 495 | goto new_measure; | 495 | goto new_measure; |
| 496 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) | 496 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) |
| 497 | return; | 497 | return; |
| 498 | tcp_rcv_rtt_update(tp, jiffies - tp->rcv_rtt_est.time, 1); | 498 | tcp_rcv_rtt_update(tp, tcp_time_stamp - tp->rcv_rtt_est.time, 1); |
| 499 | 499 | ||
| 500 | new_measure: | 500 | new_measure: |
| 501 | tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd; | 501 | tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd; |
| @@ -2868,11 +2868,14 @@ static inline void tcp_complete_cwr(struct sock *sk) | |||
| 2868 | 2868 | ||
| 2869 | /* Do not moderate cwnd if it's already undone in cwr or recovery. */ | 2869 | /* Do not moderate cwnd if it's already undone in cwr or recovery. */ |
| 2870 | if (tp->undo_marker) { | 2870 | if (tp->undo_marker) { |
| 2871 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) | 2871 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) { |
| 2872 | tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); | 2872 | tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); |
| 2873 | else /* PRR */ | 2873 | tp->snd_cwnd_stamp = tcp_time_stamp; |
| 2874 | } else if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH) { | ||
| 2875 | /* PRR algorithm. */ | ||
| 2874 | tp->snd_cwnd = tp->snd_ssthresh; | 2876 | tp->snd_cwnd = tp->snd_ssthresh; |
| 2875 | tp->snd_cwnd_stamp = tcp_time_stamp; | 2877 | tp->snd_cwnd_stamp = tcp_time_stamp; |
| 2878 | } | ||
| 2876 | } | 2879 | } |
| 2877 | tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); | 2880 | tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); |
| 2878 | } | 2881 | } |
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c index 8a949f19deb6..a7f86a3cd502 100644 --- a/net/ipv4/udp_diag.c +++ b/net/ipv4/udp_diag.c | |||
| @@ -146,9 +146,17 @@ static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, | |||
| 146 | return udp_dump_one(&udp_table, in_skb, nlh, req); | 146 | return udp_dump_one(&udp_table, in_skb, nlh, req); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, | ||
| 150 | void *info) | ||
| 151 | { | ||
| 152 | r->idiag_rqueue = sk_rmem_alloc_get(sk); | ||
| 153 | r->idiag_wqueue = sk_wmem_alloc_get(sk); | ||
| 154 | } | ||
| 155 | |||
| 149 | static const struct inet_diag_handler udp_diag_handler = { | 156 | static const struct inet_diag_handler udp_diag_handler = { |
| 150 | .dump = udp_diag_dump, | 157 | .dump = udp_diag_dump, |
| 151 | .dump_one = udp_diag_dump_one, | 158 | .dump_one = udp_diag_dump_one, |
| 159 | .idiag_get_info = udp_diag_get_info, | ||
| 152 | .idiag_type = IPPROTO_UDP, | 160 | .idiag_type = IPPROTO_UDP, |
| 153 | }; | 161 | }; |
| 154 | 162 | ||
| @@ -167,6 +175,7 @@ static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr * | |||
| 167 | static const struct inet_diag_handler udplite_diag_handler = { | 175 | static const struct inet_diag_handler udplite_diag_handler = { |
| 168 | .dump = udplite_diag_dump, | 176 | .dump = udplite_diag_dump, |
| 169 | .dump_one = udplite_diag_dump_one, | 177 | .dump_one = udplite_diag_dump_one, |
| 178 | .idiag_get_info = udp_diag_get_info, | ||
| 170 | .idiag_type = IPPROTO_UDPLITE, | 179 | .idiag_type = IPPROTO_UDPLITE, |
| 171 | }; | 180 | }; |
| 172 | 181 | ||
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 585d93ecee2d..6274f0be82b0 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
| @@ -442,8 +442,9 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m | |||
| 442 | 442 | ||
| 443 | daddr = lip->l2tp_addr.s_addr; | 443 | daddr = lip->l2tp_addr.s_addr; |
| 444 | } else { | 444 | } else { |
| 445 | rc = -EDESTADDRREQ; | ||
| 445 | if (sk->sk_state != TCP_ESTABLISHED) | 446 | if (sk->sk_state != TCP_ESTABLISHED) |
| 446 | return -EDESTADDRREQ; | 447 | goto out; |
| 447 | 448 | ||
| 448 | daddr = inet->inet_daddr; | 449 | daddr = inet->inet_daddr; |
| 449 | connected = 1; | 450 | connected = 1; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index d9798a307f20..db8fae51714c 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
| @@ -1210,7 +1210,7 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
| 1210 | struct sk_buff *skb); | 1210 | struct sk_buff *skb); |
| 1211 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); | 1211 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); |
| 1212 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); | 1212 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); |
| 1213 | void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata); | 1213 | void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata); |
| 1214 | 1214 | ||
| 1215 | /* IBSS code */ | 1215 | /* IBSS code */ |
| 1216 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); | 1216 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 401c01f0731e..c20051b7ffcd 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
| @@ -486,6 +486,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
| 486 | /* free all potentially still buffered bcast frames */ | 486 | /* free all potentially still buffered bcast frames */ |
| 487 | local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps_bc_buf); | 487 | local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps_bc_buf); |
| 488 | skb_queue_purge(&sdata->u.ap.ps_bc_buf); | 488 | skb_queue_purge(&sdata->u.ap.ps_bc_buf); |
| 489 | } else if (sdata->vif.type == NL80211_IFTYPE_STATION) { | ||
| 490 | ieee80211_mgd_stop(sdata); | ||
| 489 | } | 491 | } |
| 490 | 492 | ||
| 491 | if (going_down) | 493 | if (going_down) |
| @@ -644,8 +646,6 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
| 644 | 646 | ||
| 645 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 647 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
| 646 | mesh_rmc_free(sdata); | 648 | mesh_rmc_free(sdata); |
| 647 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) | ||
| 648 | ieee80211_mgd_teardown(sdata); | ||
| 649 | 649 | ||
| 650 | flushed = sta_info_flush(local, sdata); | 650 | flushed = sta_info_flush(local, sdata); |
| 651 | WARN_ON(flushed); | 651 | WARN_ON(flushed); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index f76da5b3f5c5..20c680bfc3ae 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -3497,7 +3497,7 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
| 3497 | return 0; | 3497 | return 0; |
| 3498 | } | 3498 | } |
| 3499 | 3499 | ||
| 3500 | void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata) | 3500 | void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata) |
| 3501 | { | 3501 | { |
| 3502 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 3502 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
| 3503 | 3503 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 782a60198df4..e76facc69e95 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
| @@ -1158,7 +1158,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
| 1158 | tx->sta = rcu_dereference(sdata->u.vlan.sta); | 1158 | tx->sta = rcu_dereference(sdata->u.vlan.sta); |
| 1159 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) | 1159 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) |
| 1160 | return TX_DROP; | 1160 | return TX_DROP; |
| 1161 | } else if (info->flags & IEEE80211_TX_CTL_INJECTED) { | 1161 | } else if (info->flags & IEEE80211_TX_CTL_INJECTED || |
| 1162 | tx->sdata->control_port_protocol == tx->skb->protocol) { | ||
| 1162 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); | 1163 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); |
| 1163 | } | 1164 | } |
| 1164 | if (!tx->sta) | 1165 | if (!tx->sta) |
diff --git a/net/netfilter/ipset/ip_set_hash_ip.c b/net/netfilter/ipset/ip_set_hash_ip.c index 5139dea6019e..828ce46cb34b 100644 --- a/net/netfilter/ipset/ip_set_hash_ip.c +++ b/net/netfilter/ipset/ip_set_hash_ip.c | |||
| @@ -364,6 +364,7 @@ hash_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 364 | { | 364 | { |
| 365 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 365 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
| 366 | u8 netmask, hbits; | 366 | u8 netmask, hbits; |
| 367 | size_t hsize; | ||
| 367 | struct ip_set_hash *h; | 368 | struct ip_set_hash *h; |
| 368 | 369 | ||
| 369 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) | 370 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
| @@ -405,9 +406,12 @@ hash_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 405 | h->timeout = IPSET_NO_TIMEOUT; | 406 | h->timeout = IPSET_NO_TIMEOUT; |
| 406 | 407 | ||
| 407 | hbits = htable_bits(hashsize); | 408 | hbits = htable_bits(hashsize); |
| 408 | h->table = ip_set_alloc( | 409 | hsize = htable_size(hbits); |
| 409 | sizeof(struct htable) | 410 | if (hsize == 0) { |
| 410 | + jhash_size(hbits) * sizeof(struct hbucket)); | 411 | kfree(h); |
| 412 | return -ENOMEM; | ||
| 413 | } | ||
| 414 | h->table = ip_set_alloc(hsize); | ||
| 411 | if (!h->table) { | 415 | if (!h->table) { |
| 412 | kfree(h); | 416 | kfree(h); |
| 413 | return -ENOMEM; | 417 | return -ENOMEM; |
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c index 9c27e249c171..e8dbb498af8f 100644 --- a/net/netfilter/ipset/ip_set_hash_ipport.c +++ b/net/netfilter/ipset/ip_set_hash_ipport.c | |||
| @@ -449,6 +449,7 @@ hash_ipport_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 449 | struct ip_set_hash *h; | 449 | struct ip_set_hash *h; |
| 450 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 450 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
| 451 | u8 hbits; | 451 | u8 hbits; |
| 452 | size_t hsize; | ||
| 452 | 453 | ||
| 453 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) | 454 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
| 454 | return -IPSET_ERR_INVALID_FAMILY; | 455 | return -IPSET_ERR_INVALID_FAMILY; |
| @@ -476,9 +477,12 @@ hash_ipport_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 476 | h->timeout = IPSET_NO_TIMEOUT; | 477 | h->timeout = IPSET_NO_TIMEOUT; |
| 477 | 478 | ||
| 478 | hbits = htable_bits(hashsize); | 479 | hbits = htable_bits(hashsize); |
| 479 | h->table = ip_set_alloc( | 480 | hsize = htable_size(hbits); |
| 480 | sizeof(struct htable) | 481 | if (hsize == 0) { |
| 481 | + jhash_size(hbits) * sizeof(struct hbucket)); | 482 | kfree(h); |
| 483 | return -ENOMEM; | ||
| 484 | } | ||
| 485 | h->table = ip_set_alloc(hsize); | ||
| 482 | if (!h->table) { | 486 | if (!h->table) { |
| 483 | kfree(h); | 487 | kfree(h); |
| 484 | return -ENOMEM; | 488 | return -ENOMEM; |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c index 9134057c0728..52f79d8ef741 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportip.c +++ b/net/netfilter/ipset/ip_set_hash_ipportip.c | |||
| @@ -467,6 +467,7 @@ hash_ipportip_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 467 | struct ip_set_hash *h; | 467 | struct ip_set_hash *h; |
| 468 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 468 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
| 469 | u8 hbits; | 469 | u8 hbits; |
| 470 | size_t hsize; | ||
| 470 | 471 | ||
| 471 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) | 472 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
| 472 | return -IPSET_ERR_INVALID_FAMILY; | 473 | return -IPSET_ERR_INVALID_FAMILY; |
| @@ -494,9 +495,12 @@ hash_ipportip_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 494 | h->timeout = IPSET_NO_TIMEOUT; | 495 | h->timeout = IPSET_NO_TIMEOUT; |
| 495 | 496 | ||
| 496 | hbits = htable_bits(hashsize); | 497 | hbits = htable_bits(hashsize); |
| 497 | h->table = ip_set_alloc( | 498 | hsize = htable_size(hbits); |
| 498 | sizeof(struct htable) | 499 | if (hsize == 0) { |
| 499 | + jhash_size(hbits) * sizeof(struct hbucket)); | 500 | kfree(h); |
| 501 | return -ENOMEM; | ||
| 502 | } | ||
| 503 | h->table = ip_set_alloc(hsize); | ||
| 500 | if (!h->table) { | 504 | if (!h->table) { |
| 501 | kfree(h); | 505 | kfree(h); |
| 502 | return -ENOMEM; | 506 | return -ENOMEM; |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c index 5d05e6969862..97583f5af745 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportnet.c +++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c | |||
| @@ -616,6 +616,7 @@ hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 616 | struct ip_set_hash *h; | 616 | struct ip_set_hash *h; |
| 617 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 617 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
| 618 | u8 hbits; | 618 | u8 hbits; |
| 619 | size_t hsize; | ||
| 619 | 620 | ||
| 620 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) | 621 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
| 621 | return -IPSET_ERR_INVALID_FAMILY; | 622 | return -IPSET_ERR_INVALID_FAMILY; |
| @@ -645,9 +646,12 @@ hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 645 | h->timeout = IPSET_NO_TIMEOUT; | 646 | h->timeout = IPSET_NO_TIMEOUT; |
| 646 | 647 | ||
| 647 | hbits = htable_bits(hashsize); | 648 | hbits = htable_bits(hashsize); |
| 648 | h->table = ip_set_alloc( | 649 | hsize = htable_size(hbits); |
| 649 | sizeof(struct htable) | 650 | if (hsize == 0) { |
| 650 | + jhash_size(hbits) * sizeof(struct hbucket)); | 651 | kfree(h); |
| 652 | return -ENOMEM; | ||
| 653 | } | ||
| 654 | h->table = ip_set_alloc(hsize); | ||
| 651 | if (!h->table) { | 655 | if (!h->table) { |
| 652 | kfree(h); | 656 | kfree(h); |
| 653 | return -ENOMEM; | 657 | return -ENOMEM; |
diff --git a/net/netfilter/ipset/ip_set_hash_net.c b/net/netfilter/ipset/ip_set_hash_net.c index 7c3d945517cf..1721cdecc9f9 100644 --- a/net/netfilter/ipset/ip_set_hash_net.c +++ b/net/netfilter/ipset/ip_set_hash_net.c | |||
| @@ -460,6 +460,7 @@ hash_net_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 460 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 460 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
| 461 | struct ip_set_hash *h; | 461 | struct ip_set_hash *h; |
| 462 | u8 hbits; | 462 | u8 hbits; |
| 463 | size_t hsize; | ||
| 463 | 464 | ||
| 464 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) | 465 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
| 465 | return -IPSET_ERR_INVALID_FAMILY; | 466 | return -IPSET_ERR_INVALID_FAMILY; |
| @@ -489,9 +490,12 @@ hash_net_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 489 | h->timeout = IPSET_NO_TIMEOUT; | 490 | h->timeout = IPSET_NO_TIMEOUT; |
| 490 | 491 | ||
| 491 | hbits = htable_bits(hashsize); | 492 | hbits = htable_bits(hashsize); |
| 492 | h->table = ip_set_alloc( | 493 | hsize = htable_size(hbits); |
| 493 | sizeof(struct htable) | 494 | if (hsize == 0) { |
| 494 | + jhash_size(hbits) * sizeof(struct hbucket)); | 495 | kfree(h); |
| 496 | return -ENOMEM; | ||
| 497 | } | ||
| 498 | h->table = ip_set_alloc(hsize); | ||
| 495 | if (!h->table) { | 499 | if (!h->table) { |
| 496 | kfree(h); | 500 | kfree(h); |
| 497 | return -ENOMEM; | 501 | return -ENOMEM; |
diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c index f24037ff4322..33bafc97ca6d 100644 --- a/net/netfilter/ipset/ip_set_hash_netiface.c +++ b/net/netfilter/ipset/ip_set_hash_netiface.c | |||
| @@ -722,6 +722,7 @@ hash_netiface_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 722 | struct ip_set_hash *h; | 722 | struct ip_set_hash *h; |
| 723 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 723 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
| 724 | u8 hbits; | 724 | u8 hbits; |
| 725 | size_t hsize; | ||
| 725 | 726 | ||
| 726 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) | 727 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
| 727 | return -IPSET_ERR_INVALID_FAMILY; | 728 | return -IPSET_ERR_INVALID_FAMILY; |
| @@ -752,9 +753,12 @@ hash_netiface_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 752 | h->ahash_max = AHASH_MAX_SIZE; | 753 | h->ahash_max = AHASH_MAX_SIZE; |
| 753 | 754 | ||
| 754 | hbits = htable_bits(hashsize); | 755 | hbits = htable_bits(hashsize); |
| 755 | h->table = ip_set_alloc( | 756 | hsize = htable_size(hbits); |
| 756 | sizeof(struct htable) | 757 | if (hsize == 0) { |
| 757 | + jhash_size(hbits) * sizeof(struct hbucket)); | 758 | kfree(h); |
| 759 | return -ENOMEM; | ||
| 760 | } | ||
| 761 | h->table = ip_set_alloc(hsize); | ||
| 758 | if (!h->table) { | 762 | if (!h->table) { |
| 759 | kfree(h); | 763 | kfree(h); |
| 760 | return -ENOMEM; | 764 | return -ENOMEM; |
diff --git a/net/netfilter/ipset/ip_set_hash_netport.c b/net/netfilter/ipset/ip_set_hash_netport.c index ce2e77100b64..3a5e198641d6 100644 --- a/net/netfilter/ipset/ip_set_hash_netport.c +++ b/net/netfilter/ipset/ip_set_hash_netport.c | |||
| @@ -572,6 +572,7 @@ hash_netport_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 572 | struct ip_set_hash *h; | 572 | struct ip_set_hash *h; |
| 573 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; | 573 | u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; |
| 574 | u8 hbits; | 574 | u8 hbits; |
| 575 | size_t hsize; | ||
| 575 | 576 | ||
| 576 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) | 577 | if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) |
| 577 | return -IPSET_ERR_INVALID_FAMILY; | 578 | return -IPSET_ERR_INVALID_FAMILY; |
| @@ -601,9 +602,12 @@ hash_netport_create(struct ip_set *set, struct nlattr *tb[], u32 flags) | |||
| 601 | h->timeout = IPSET_NO_TIMEOUT; | 602 | h->timeout = IPSET_NO_TIMEOUT; |
| 602 | 603 | ||
| 603 | hbits = htable_bits(hashsize); | 604 | hbits = htable_bits(hashsize); |
| 604 | h->table = ip_set_alloc( | 605 | hsize = htable_size(hbits); |
| 605 | sizeof(struct htable) | 606 | if (hsize == 0) { |
| 606 | + jhash_size(hbits) * sizeof(struct hbucket)); | 607 | kfree(h); |
| 608 | return -ENOMEM; | ||
| 609 | } | ||
| 610 | h->table = ip_set_alloc(hsize); | ||
| 607 | if (!h->table) { | 611 | if (!h->table) { |
| 608 | kfree(h); | 612 | kfree(h); |
| 609 | return -ENOMEM; | 613 | return -ENOMEM; |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 2555816e7788..00bdb1d9d690 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
| @@ -1924,6 +1924,7 @@ protocol_fail: | |||
| 1924 | control_fail: | 1924 | control_fail: |
| 1925 | ip_vs_estimator_net_cleanup(net); | 1925 | ip_vs_estimator_net_cleanup(net); |
| 1926 | estimator_fail: | 1926 | estimator_fail: |
| 1927 | net->ipvs = NULL; | ||
| 1927 | return -ENOMEM; | 1928 | return -ENOMEM; |
| 1928 | } | 1929 | } |
| 1929 | 1930 | ||
| @@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net) | |||
| 1936 | ip_vs_control_net_cleanup(net); | 1937 | ip_vs_control_net_cleanup(net); |
| 1937 | ip_vs_estimator_net_cleanup(net); | 1938 | ip_vs_estimator_net_cleanup(net); |
| 1938 | IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); | 1939 | IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); |
| 1940 | net->ipvs = NULL; | ||
| 1939 | } | 1941 | } |
| 1940 | 1942 | ||
| 1941 | static void __net_exit __ip_vs_dev_cleanup(struct net *net) | 1943 | static void __net_exit __ip_vs_dev_cleanup(struct net *net) |
| @@ -1993,10 +1995,18 @@ static int __init ip_vs_init(void) | |||
| 1993 | goto cleanup_dev; | 1995 | goto cleanup_dev; |
| 1994 | } | 1996 | } |
| 1995 | 1997 | ||
| 1998 | ret = ip_vs_register_nl_ioctl(); | ||
| 1999 | if (ret < 0) { | ||
| 2000 | pr_err("can't register netlink/ioctl.\n"); | ||
| 2001 | goto cleanup_hooks; | ||
| 2002 | } | ||
| 2003 | |||
| 1996 | pr_info("ipvs loaded.\n"); | 2004 | pr_info("ipvs loaded.\n"); |
| 1997 | 2005 | ||
| 1998 | return ret; | 2006 | return ret; |
| 1999 | 2007 | ||
| 2008 | cleanup_hooks: | ||
| 2009 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); | ||
| 2000 | cleanup_dev: | 2010 | cleanup_dev: |
| 2001 | unregister_pernet_device(&ipvs_core_dev_ops); | 2011 | unregister_pernet_device(&ipvs_core_dev_ops); |
| 2002 | cleanup_sub: | 2012 | cleanup_sub: |
| @@ -2012,6 +2022,7 @@ exit: | |||
| 2012 | 2022 | ||
| 2013 | static void __exit ip_vs_cleanup(void) | 2023 | static void __exit ip_vs_cleanup(void) |
| 2014 | { | 2024 | { |
| 2025 | ip_vs_unregister_nl_ioctl(); | ||
| 2015 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); | 2026 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); |
| 2016 | unregister_pernet_device(&ipvs_core_dev_ops); | 2027 | unregister_pernet_device(&ipvs_core_dev_ops); |
| 2017 | unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ | 2028 | unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index b3afe189af61..f5589987fc80 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
| @@ -3680,7 +3680,7 @@ int __net_init ip_vs_control_net_init_sysctl(struct net *net) | |||
| 3680 | return 0; | 3680 | return 0; |
| 3681 | } | 3681 | } |
| 3682 | 3682 | ||
| 3683 | void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) | 3683 | void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) |
| 3684 | { | 3684 | { |
| 3685 | struct netns_ipvs *ipvs = net_ipvs(net); | 3685 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 3686 | 3686 | ||
| @@ -3692,7 +3692,7 @@ void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) | |||
| 3692 | #else | 3692 | #else |
| 3693 | 3693 | ||
| 3694 | int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } | 3694 | int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } |
| 3695 | void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) { } | 3695 | void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { } |
| 3696 | 3696 | ||
| 3697 | #endif | 3697 | #endif |
| 3698 | 3698 | ||
| @@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net) | |||
| 3750 | free_percpu(ipvs->tot_stats.cpustats); | 3750 | free_percpu(ipvs->tot_stats.cpustats); |
| 3751 | } | 3751 | } |
| 3752 | 3752 | ||
| 3753 | int __init ip_vs_control_init(void) | 3753 | int __init ip_vs_register_nl_ioctl(void) |
| 3754 | { | 3754 | { |
| 3755 | int idx; | ||
| 3756 | int ret; | 3755 | int ret; |
| 3757 | 3756 | ||
| 3758 | EnterFunction(2); | ||
| 3759 | |||
| 3760 | /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | ||
| 3761 | for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | ||
| 3762 | INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | ||
| 3763 | INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | ||
| 3764 | } | ||
| 3765 | |||
| 3766 | smp_wmb(); /* Do we really need it now ? */ | ||
| 3767 | |||
| 3768 | ret = nf_register_sockopt(&ip_vs_sockopts); | 3757 | ret = nf_register_sockopt(&ip_vs_sockopts); |
| 3769 | if (ret) { | 3758 | if (ret) { |
| 3770 | pr_err("cannot register sockopt.\n"); | 3759 | pr_err("cannot register sockopt.\n"); |
| @@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void) | |||
| 3776 | pr_err("cannot register Generic Netlink interface.\n"); | 3765 | pr_err("cannot register Generic Netlink interface.\n"); |
| 3777 | goto err_genl; | 3766 | goto err_genl; |
| 3778 | } | 3767 | } |
| 3779 | |||
| 3780 | ret = register_netdevice_notifier(&ip_vs_dst_notifier); | ||
| 3781 | if (ret < 0) | ||
| 3782 | goto err_notf; | ||
| 3783 | |||
| 3784 | LeaveFunction(2); | ||
| 3785 | return 0; | 3768 | return 0; |
| 3786 | 3769 | ||
| 3787 | err_notf: | ||
| 3788 | ip_vs_genl_unregister(); | ||
| 3789 | err_genl: | 3770 | err_genl: |
| 3790 | nf_unregister_sockopt(&ip_vs_sockopts); | 3771 | nf_unregister_sockopt(&ip_vs_sockopts); |
| 3791 | err_sock: | 3772 | err_sock: |
| 3792 | return ret; | 3773 | return ret; |
| 3793 | } | 3774 | } |
| 3794 | 3775 | ||
| 3776 | void ip_vs_unregister_nl_ioctl(void) | ||
| 3777 | { | ||
| 3778 | ip_vs_genl_unregister(); | ||
| 3779 | nf_unregister_sockopt(&ip_vs_sockopts); | ||
| 3780 | } | ||
| 3781 | |||
| 3782 | int __init ip_vs_control_init(void) | ||
| 3783 | { | ||
| 3784 | int idx; | ||
| 3785 | int ret; | ||
| 3786 | |||
| 3787 | EnterFunction(2); | ||
| 3788 | |||
| 3789 | /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | ||
| 3790 | for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | ||
| 3791 | INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | ||
| 3792 | INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | ||
| 3793 | } | ||
| 3794 | |||
| 3795 | smp_wmb(); /* Do we really need it now ? */ | ||
| 3796 | |||
| 3797 | ret = register_netdevice_notifier(&ip_vs_dst_notifier); | ||
| 3798 | if (ret < 0) | ||
| 3799 | return ret; | ||
| 3800 | |||
| 3801 | LeaveFunction(2); | ||
| 3802 | return 0; | ||
| 3803 | } | ||
| 3804 | |||
| 3795 | 3805 | ||
| 3796 | void ip_vs_control_cleanup(void) | 3806 | void ip_vs_control_cleanup(void) |
| 3797 | { | 3807 | { |
| 3798 | EnterFunction(2); | 3808 | EnterFunction(2); |
| 3799 | unregister_netdevice_notifier(&ip_vs_dst_notifier); | 3809 | unregister_netdevice_notifier(&ip_vs_dst_notifier); |
| 3800 | ip_vs_genl_unregister(); | ||
| 3801 | nf_unregister_sockopt(&ip_vs_sockopts); | ||
| 3802 | LeaveFunction(2); | 3810 | LeaveFunction(2); |
| 3803 | } | 3811 | } |
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c index 538d74ee4f68..e39f693dd3e4 100644 --- a/net/netfilter/ipvs/ip_vs_ftp.c +++ b/net/netfilter/ipvs/ip_vs_ftp.c | |||
| @@ -439,6 +439,8 @@ static int __net_init __ip_vs_ftp_init(struct net *net) | |||
| 439 | struct ip_vs_app *app; | 439 | struct ip_vs_app *app; |
| 440 | struct netns_ipvs *ipvs = net_ipvs(net); | 440 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 441 | 441 | ||
| 442 | if (!ipvs) | ||
| 443 | return -ENOENT; | ||
| 442 | app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); | 444 | app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); |
| 443 | if (!app) | 445 | if (!app) |
| 444 | return -ENOMEM; | 446 | return -ENOMEM; |
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index 0f16283fd058..caa43704e55e 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c | |||
| @@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net) | |||
| 551 | { | 551 | { |
| 552 | struct netns_ipvs *ipvs = net_ipvs(net); | 552 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 553 | 553 | ||
| 554 | if (!ipvs) | ||
| 555 | return -ENOENT; | ||
| 556 | |||
| 554 | if (!net_eq(net, &init_net)) { | 557 | if (!net_eq(net, &init_net)) { |
| 555 | ipvs->lblc_ctl_table = kmemdup(vs_vars_table, | 558 | ipvs->lblc_ctl_table = kmemdup(vs_vars_table, |
| 556 | sizeof(vs_vars_table), | 559 | sizeof(vs_vars_table), |
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index eec797f8cce7..548bf37aa29e 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
| @@ -745,6 +745,9 @@ static int __net_init __ip_vs_lblcr_init(struct net *net) | |||
| 745 | { | 745 | { |
| 746 | struct netns_ipvs *ipvs = net_ipvs(net); | 746 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 747 | 747 | ||
| 748 | if (!ipvs) | ||
| 749 | return -ENOENT; | ||
| 750 | |||
| 748 | if (!net_eq(net, &init_net)) { | 751 | if (!net_eq(net, &init_net)) { |
| 749 | ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, | 752 | ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, |
| 750 | sizeof(vs_vars_table), | 753 | sizeof(vs_vars_table), |
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c index f843a8833250..ed835e67a07e 100644 --- a/net/netfilter/ipvs/ip_vs_proto.c +++ b/net/netfilter/ipvs/ip_vs_proto.c | |||
| @@ -59,9 +59,6 @@ static int __used __init register_ip_vs_protocol(struct ip_vs_protocol *pp) | |||
| 59 | return 0; | 59 | return 0; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | #if defined(CONFIG_IP_VS_PROTO_TCP) || defined(CONFIG_IP_VS_PROTO_UDP) || \ | ||
| 63 | defined(CONFIG_IP_VS_PROTO_SCTP) || defined(CONFIG_IP_VS_PROTO_AH) || \ | ||
| 64 | defined(CONFIG_IP_VS_PROTO_ESP) | ||
| 65 | /* | 62 | /* |
| 66 | * register an ipvs protocols netns related data | 63 | * register an ipvs protocols netns related data |
| 67 | */ | 64 | */ |
| @@ -81,12 +78,18 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp) | |||
| 81 | ipvs->proto_data_table[hash] = pd; | 78 | ipvs->proto_data_table[hash] = pd; |
| 82 | atomic_set(&pd->appcnt, 0); /* Init app counter */ | 79 | atomic_set(&pd->appcnt, 0); /* Init app counter */ |
| 83 | 80 | ||
| 84 | if (pp->init_netns != NULL) | 81 | if (pp->init_netns != NULL) { |
| 85 | pp->init_netns(net, pd); | 82 | int ret = pp->init_netns(net, pd); |
| 83 | if (ret) { | ||
| 84 | /* unlink an free proto data */ | ||
| 85 | ipvs->proto_data_table[hash] = pd->next; | ||
| 86 | kfree(pd); | ||
| 87 | return ret; | ||
| 88 | } | ||
| 89 | } | ||
| 86 | 90 | ||
| 87 | return 0; | 91 | return 0; |
| 88 | } | 92 | } |
| 89 | #endif | ||
| 90 | 93 | ||
| 91 | /* | 94 | /* |
| 92 | * unregister an ipvs protocol | 95 | * unregister an ipvs protocol |
| @@ -316,22 +319,35 @@ ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, | |||
| 316 | */ | 319 | */ |
| 317 | int __net_init ip_vs_protocol_net_init(struct net *net) | 320 | int __net_init ip_vs_protocol_net_init(struct net *net) |
| 318 | { | 321 | { |
| 322 | int i, ret; | ||
| 323 | static struct ip_vs_protocol *protos[] = { | ||
| 319 | #ifdef CONFIG_IP_VS_PROTO_TCP | 324 | #ifdef CONFIG_IP_VS_PROTO_TCP |
| 320 | register_ip_vs_proto_netns(net, &ip_vs_protocol_tcp); | 325 | &ip_vs_protocol_tcp, |
| 321 | #endif | 326 | #endif |
| 322 | #ifdef CONFIG_IP_VS_PROTO_UDP | 327 | #ifdef CONFIG_IP_VS_PROTO_UDP |
| 323 | register_ip_vs_proto_netns(net, &ip_vs_protocol_udp); | 328 | &ip_vs_protocol_udp, |
| 324 | #endif | 329 | #endif |
| 325 | #ifdef CONFIG_IP_VS_PROTO_SCTP | 330 | #ifdef CONFIG_IP_VS_PROTO_SCTP |
| 326 | register_ip_vs_proto_netns(net, &ip_vs_protocol_sctp); | 331 | &ip_vs_protocol_sctp, |
| 327 | #endif | 332 | #endif |
| 328 | #ifdef CONFIG_IP_VS_PROTO_AH | 333 | #ifdef CONFIG_IP_VS_PROTO_AH |
| 329 | register_ip_vs_proto_netns(net, &ip_vs_protocol_ah); | 334 | &ip_vs_protocol_ah, |
| 330 | #endif | 335 | #endif |
| 331 | #ifdef CONFIG_IP_VS_PROTO_ESP | 336 | #ifdef CONFIG_IP_VS_PROTO_ESP |
| 332 | register_ip_vs_proto_netns(net, &ip_vs_protocol_esp); | 337 | &ip_vs_protocol_esp, |
| 333 | #endif | 338 | #endif |
| 339 | }; | ||
| 340 | |||
| 341 | for (i = 0; i < ARRAY_SIZE(protos); i++) { | ||
| 342 | ret = register_ip_vs_proto_netns(net, protos[i]); | ||
| 343 | if (ret < 0) | ||
| 344 | goto cleanup; | ||
| 345 | } | ||
| 334 | return 0; | 346 | return 0; |
| 347 | |||
| 348 | cleanup: | ||
| 349 | ip_vs_protocol_net_cleanup(net); | ||
| 350 | return ret; | ||
| 335 | } | 351 | } |
| 336 | 352 | ||
| 337 | void __net_exit ip_vs_protocol_net_cleanup(struct net *net) | 353 | void __net_exit ip_vs_protocol_net_cleanup(struct net *net) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c index 1fbf7a2816f5..9f3fb751c491 100644 --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c | |||
| @@ -1090,7 +1090,7 @@ out: | |||
| 1090 | * timeouts is netns related now. | 1090 | * timeouts is netns related now. |
| 1091 | * --------------------------------------------- | 1091 | * --------------------------------------------- |
| 1092 | */ | 1092 | */ |
| 1093 | static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | 1093 | static int __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) |
| 1094 | { | 1094 | { |
| 1095 | struct netns_ipvs *ipvs = net_ipvs(net); | 1095 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 1096 | 1096 | ||
| @@ -1098,6 +1098,9 @@ static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
| 1098 | spin_lock_init(&ipvs->sctp_app_lock); | 1098 | spin_lock_init(&ipvs->sctp_app_lock); |
| 1099 | pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts, | 1099 | pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts, |
| 1100 | sizeof(sctp_timeouts)); | 1100 | sizeof(sctp_timeouts)); |
| 1101 | if (!pd->timeout_table) | ||
| 1102 | return -ENOMEM; | ||
| 1103 | return 0; | ||
| 1101 | } | 1104 | } |
| 1102 | 1105 | ||
| 1103 | static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd) | 1106 | static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c index ef8641f7af83..cd609cc62721 100644 --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c | |||
| @@ -677,7 +677,7 @@ void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp) | |||
| 677 | * timeouts is netns related now. | 677 | * timeouts is netns related now. |
| 678 | * --------------------------------------------- | 678 | * --------------------------------------------- |
| 679 | */ | 679 | */ |
| 680 | static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | 680 | static int __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) |
| 681 | { | 681 | { |
| 682 | struct netns_ipvs *ipvs = net_ipvs(net); | 682 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 683 | 683 | ||
| @@ -685,7 +685,10 @@ static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
| 685 | spin_lock_init(&ipvs->tcp_app_lock); | 685 | spin_lock_init(&ipvs->tcp_app_lock); |
| 686 | pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts, | 686 | pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts, |
| 687 | sizeof(tcp_timeouts)); | 687 | sizeof(tcp_timeouts)); |
| 688 | if (!pd->timeout_table) | ||
| 689 | return -ENOMEM; | ||
| 688 | pd->tcp_state_table = tcp_states; | 690 | pd->tcp_state_table = tcp_states; |
| 691 | return 0; | ||
| 689 | } | 692 | } |
| 690 | 693 | ||
| 691 | static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd) | 694 | static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c index f4b7262896bb..2fedb2dcb3d1 100644 --- a/net/netfilter/ipvs/ip_vs_proto_udp.c +++ b/net/netfilter/ipvs/ip_vs_proto_udp.c | |||
| @@ -467,7 +467,7 @@ udp_state_transition(struct ip_vs_conn *cp, int direction, | |||
| 467 | cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; | 467 | cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; |
| 468 | } | 468 | } |
| 469 | 469 | ||
| 470 | static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) | 470 | static int __udp_init(struct net *net, struct ip_vs_proto_data *pd) |
| 471 | { | 471 | { |
| 472 | struct netns_ipvs *ipvs = net_ipvs(net); | 472 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 473 | 473 | ||
| @@ -475,6 +475,9 @@ static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
| 475 | spin_lock_init(&ipvs->udp_app_lock); | 475 | spin_lock_init(&ipvs->udp_app_lock); |
| 476 | pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts, | 476 | pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts, |
| 477 | sizeof(udp_timeouts)); | 477 | sizeof(udp_timeouts)); |
| 478 | if (!pd->timeout_table) | ||
| 479 | return -ENOMEM; | ||
| 480 | return 0; | ||
| 478 | } | 481 | } |
| 479 | 482 | ||
| 480 | static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd) | 483 | static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index 59530e93fa58..3746d8b9a478 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
| @@ -227,7 +227,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | 229 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT |
| 230 | if (info->timeout) { | 230 | if (info->timeout[0]) { |
| 231 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; | 231 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; |
| 232 | struct nf_conn_timeout *timeout_ext; | 232 | struct nf_conn_timeout *timeout_ext; |
| 233 | 233 | ||
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index e44e631ea952..e66341ec455c 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
| @@ -321,7 +321,7 @@ static int queue_userspace_packet(int dp_ifindex, struct sk_buff *skb, | |||
| 321 | return -ENOMEM; | 321 | return -ENOMEM; |
| 322 | 322 | ||
| 323 | nskb = __vlan_put_tag(nskb, vlan_tx_tag_get(nskb)); | 323 | nskb = __vlan_put_tag(nskb, vlan_tx_tag_get(nskb)); |
| 324 | if (!skb) | 324 | if (!nskb) |
| 325 | return -ENOMEM; | 325 | return -ENOMEM; |
| 326 | 326 | ||
| 327 | nskb->vlan_tci = 0; | 327 | nskb->vlan_tci = 0; |
| @@ -421,6 +421,19 @@ static int validate_sample(const struct nlattr *attr, | |||
| 421 | return validate_actions(actions, key, depth + 1); | 421 | return validate_actions(actions, key, depth + 1); |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | static int validate_tp_port(const struct sw_flow_key *flow_key) | ||
| 425 | { | ||
| 426 | if (flow_key->eth.type == htons(ETH_P_IP)) { | ||
| 427 | if (flow_key->ipv4.tp.src && flow_key->ipv4.tp.dst) | ||
| 428 | return 0; | ||
| 429 | } else if (flow_key->eth.type == htons(ETH_P_IPV6)) { | ||
| 430 | if (flow_key->ipv6.tp.src && flow_key->ipv6.tp.dst) | ||
| 431 | return 0; | ||
| 432 | } | ||
| 433 | |||
| 434 | return -EINVAL; | ||
| 435 | } | ||
| 436 | |||
| 424 | static int validate_set(const struct nlattr *a, | 437 | static int validate_set(const struct nlattr *a, |
| 425 | const struct sw_flow_key *flow_key) | 438 | const struct sw_flow_key *flow_key) |
| 426 | { | 439 | { |
| @@ -462,18 +475,13 @@ static int validate_set(const struct nlattr *a, | |||
| 462 | if (flow_key->ip.proto != IPPROTO_TCP) | 475 | if (flow_key->ip.proto != IPPROTO_TCP) |
| 463 | return -EINVAL; | 476 | return -EINVAL; |
| 464 | 477 | ||
| 465 | if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst) | 478 | return validate_tp_port(flow_key); |
| 466 | return -EINVAL; | ||
| 467 | |||
| 468 | break; | ||
| 469 | 479 | ||
| 470 | case OVS_KEY_ATTR_UDP: | 480 | case OVS_KEY_ATTR_UDP: |
| 471 | if (flow_key->ip.proto != IPPROTO_UDP) | 481 | if (flow_key->ip.proto != IPPROTO_UDP) |
| 472 | return -EINVAL; | 482 | return -EINVAL; |
| 473 | 483 | ||
| 474 | if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst) | 484 | return validate_tp_port(flow_key); |
| 475 | return -EINVAL; | ||
| 476 | break; | ||
| 477 | 485 | ||
| 478 | default: | 486 | default: |
| 479 | return -EINVAL; | 487 | return -EINVAL; |
| @@ -1641,10 +1649,9 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) | |||
| 1641 | reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq, | 1649 | reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq, |
| 1642 | OVS_VPORT_CMD_NEW); | 1650 | OVS_VPORT_CMD_NEW); |
| 1643 | if (IS_ERR(reply)) { | 1651 | if (IS_ERR(reply)) { |
| 1644 | err = PTR_ERR(reply); | ||
| 1645 | netlink_set_err(init_net.genl_sock, 0, | 1652 | netlink_set_err(init_net.genl_sock, 0, |
| 1646 | ovs_dp_vport_multicast_group.id, err); | 1653 | ovs_dp_vport_multicast_group.id, PTR_ERR(reply)); |
| 1647 | return 0; | 1654 | goto exit_unlock; |
| 1648 | } | 1655 | } |
| 1649 | 1656 | ||
| 1650 | genl_notify(reply, genl_info_net(info), info->snd_pid, | 1657 | genl_notify(reply, genl_info_net(info), info->snd_pid, |
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 1252c3081ef1..2a11ec2383ee 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
| @@ -183,7 +183,8 @@ void ovs_flow_used(struct sw_flow *flow, struct sk_buff *skb) | |||
| 183 | u8 tcp_flags = 0; | 183 | u8 tcp_flags = 0; |
| 184 | 184 | ||
| 185 | if (flow->key.eth.type == htons(ETH_P_IP) && | 185 | if (flow->key.eth.type == htons(ETH_P_IP) && |
| 186 | flow->key.ip.proto == IPPROTO_TCP) { | 186 | flow->key.ip.proto == IPPROTO_TCP && |
| 187 | likely(skb->len >= skb_transport_offset(skb) + sizeof(struct tcphdr))) { | ||
| 187 | u8 *tcp = (u8 *)tcp_hdr(skb); | 188 | u8 *tcp = (u8 *)tcp_hdr(skb); |
| 188 | tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK; | 189 | tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK; |
| 189 | } | 190 | } |
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 5da548fa7ae9..ebd22966f748 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
| @@ -408,10 +408,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
| 408 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { | 408 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { |
| 409 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || | 409 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || |
| 410 | (skb->ip_summed == CHECKSUM_PARTIAL && | 410 | (skb->ip_summed == CHECKSUM_PARTIAL && |
| 411 | skb_checksum_help(skb))) { | 411 | skb_checksum_help(skb))) |
| 412 | sch->qstats.drops++; | 412 | return qdisc_drop(skb, sch); |
| 413 | return NET_XMIT_DROP; | ||
| 414 | } | ||
| 415 | 413 | ||
| 416 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); | 414 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); |
| 417 | } | 415 | } |
diff --git a/net/sctp/output.c b/net/sctp/output.c index 817174eb5f41..8fc4dcd294ab 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
| @@ -377,9 +377,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) | |||
| 377 | */ | 377 | */ |
| 378 | skb_set_owner_w(nskb, sk); | 378 | skb_set_owner_w(nskb, sk); |
| 379 | 379 | ||
| 380 | /* The 'obsolete' field of dst is set to 2 when a dst is freed. */ | 380 | if (!sctp_transport_dst_check(tp)) { |
| 381 | if (!dst || (dst->obsolete > 1)) { | ||
| 382 | dst_release(dst); | ||
| 383 | sctp_transport_route(tp, NULL, sctp_sk(sk)); | 381 | sctp_transport_route(tp, NULL, sctp_sk(sk)); |
| 384 | if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) { | 382 | if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) { |
| 385 | sctp_assoc_sync_pmtu(asoc); | 383 | sctp_assoc_sync_pmtu(asoc); |
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 3889330b7b04..b026ba0c6992 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
| @@ -226,23 +226,6 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) | |||
| 226 | transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; | 226 | transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | /* this is a complete rip-off from __sk_dst_check | ||
| 230 | * the cookie is always 0 since this is how it's used in the | ||
| 231 | * pmtu code | ||
| 232 | */ | ||
| 233 | static struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t) | ||
| 234 | { | ||
| 235 | struct dst_entry *dst = t->dst; | ||
| 236 | |||
| 237 | if (dst && dst->obsolete && dst->ops->check(dst, 0) == NULL) { | ||
| 238 | dst_release(t->dst); | ||
| 239 | t->dst = NULL; | ||
| 240 | return NULL; | ||
| 241 | } | ||
| 242 | |||
| 243 | return dst; | ||
| 244 | } | ||
| 245 | |||
| 246 | void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) | 229 | void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) |
| 247 | { | 230 | { |
| 248 | struct dst_entry *dst; | 231 | struct dst_entry *dst; |
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index ca8cad8251c7..782bfe1b6465 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c | |||
| @@ -242,12 +242,13 @@ EXPORT_SYMBOL_GPL(gss_mech_get_by_pseudoflavor); | |||
| 242 | int gss_mech_list_pseudoflavors(rpc_authflavor_t *array_ptr) | 242 | int gss_mech_list_pseudoflavors(rpc_authflavor_t *array_ptr) |
| 243 | { | 243 | { |
| 244 | struct gss_api_mech *pos = NULL; | 244 | struct gss_api_mech *pos = NULL; |
| 245 | int i = 0; | 245 | int j, i = 0; |
| 246 | 246 | ||
| 247 | spin_lock(®istered_mechs_lock); | 247 | spin_lock(®istered_mechs_lock); |
| 248 | list_for_each_entry(pos, ®istered_mechs, gm_list) { | 248 | list_for_each_entry(pos, ®istered_mechs, gm_list) { |
| 249 | array_ptr[i] = pos->gm_pfs->pseudoflavor; | 249 | for (j=0; j < pos->gm_pf_num; j++) { |
| 250 | i++; | 250 | array_ptr[i++] = pos->gm_pfs[j].pseudoflavor; |
| 251 | } | ||
| 251 | } | 252 | } |
| 252 | spin_unlock(®istered_mechs_lock); | 253 | spin_unlock(®istered_mechs_lock); |
| 253 | return i; | 254 | return i; |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 67972462a543..adf2990acebf 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -176,16 +176,22 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, const char *dir_name) | |||
| 176 | return 0; | 176 | return 0; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | 179 | static inline int rpc_clnt_skip_event(struct rpc_clnt *clnt, unsigned long event) |
| 180 | struct super_block *sb) | 180 | { |
| 181 | if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || | ||
| 182 | ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) | ||
| 183 | return 1; | ||
| 184 | return 0; | ||
| 185 | } | ||
| 186 | |||
| 187 | static int __rpc_clnt_handle_event(struct rpc_clnt *clnt, unsigned long event, | ||
| 188 | struct super_block *sb) | ||
| 181 | { | 189 | { |
| 182 | struct dentry *dentry; | 190 | struct dentry *dentry; |
| 183 | int err = 0; | 191 | int err = 0; |
| 184 | 192 | ||
| 185 | switch (event) { | 193 | switch (event) { |
| 186 | case RPC_PIPEFS_MOUNT: | 194 | case RPC_PIPEFS_MOUNT: |
| 187 | if (clnt->cl_program->pipe_dir_name == NULL) | ||
| 188 | break; | ||
| 189 | dentry = rpc_setup_pipedir_sb(sb, clnt, | 195 | dentry = rpc_setup_pipedir_sb(sb, clnt, |
| 190 | clnt->cl_program->pipe_dir_name); | 196 | clnt->cl_program->pipe_dir_name); |
| 191 | BUG_ON(dentry == NULL); | 197 | BUG_ON(dentry == NULL); |
| @@ -208,6 +214,20 @@ static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | |||
| 208 | return err; | 214 | return err; |
| 209 | } | 215 | } |
| 210 | 216 | ||
| 217 | static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | ||
| 218 | struct super_block *sb) | ||
| 219 | { | ||
| 220 | int error = 0; | ||
| 221 | |||
| 222 | for (;; clnt = clnt->cl_parent) { | ||
| 223 | if (!rpc_clnt_skip_event(clnt, event)) | ||
| 224 | error = __rpc_clnt_handle_event(clnt, event, sb); | ||
| 225 | if (error || clnt == clnt->cl_parent) | ||
| 226 | break; | ||
| 227 | } | ||
| 228 | return error; | ||
| 229 | } | ||
| 230 | |||
| 211 | static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) | 231 | static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) |
| 212 | { | 232 | { |
| 213 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | 233 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); |
| @@ -215,10 +235,12 @@ static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) | |||
| 215 | 235 | ||
| 216 | spin_lock(&sn->rpc_client_lock); | 236 | spin_lock(&sn->rpc_client_lock); |
| 217 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { | 237 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { |
| 218 | if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || | 238 | if (clnt->cl_program->pipe_dir_name == NULL) |
| 219 | ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) | 239 | break; |
| 240 | if (rpc_clnt_skip_event(clnt, event)) | ||
| 241 | continue; | ||
| 242 | if (atomic_inc_not_zero(&clnt->cl_count) == 0) | ||
| 220 | continue; | 243 | continue; |
| 221 | atomic_inc(&clnt->cl_count); | ||
| 222 | spin_unlock(&sn->rpc_client_lock); | 244 | spin_unlock(&sn->rpc_client_lock); |
| 223 | return clnt; | 245 | return clnt; |
| 224 | } | 246 | } |
| @@ -257,6 +279,14 @@ void rpc_clients_notifier_unregister(void) | |||
| 257 | return rpc_pipefs_notifier_unregister(&rpc_clients_block); | 279 | return rpc_pipefs_notifier_unregister(&rpc_clients_block); |
| 258 | } | 280 | } |
| 259 | 281 | ||
| 282 | static void rpc_clnt_set_nodename(struct rpc_clnt *clnt, const char *nodename) | ||
| 283 | { | ||
| 284 | clnt->cl_nodelen = strlen(nodename); | ||
| 285 | if (clnt->cl_nodelen > UNX_MAXNODENAME) | ||
| 286 | clnt->cl_nodelen = UNX_MAXNODENAME; | ||
| 287 | memcpy(clnt->cl_nodename, nodename, clnt->cl_nodelen); | ||
| 288 | } | ||
| 289 | |||
| 260 | static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt) | 290 | static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt) |
| 261 | { | 291 | { |
| 262 | const struct rpc_program *program = args->program; | 292 | const struct rpc_program *program = args->program; |
| @@ -337,10 +367,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
| 337 | } | 367 | } |
| 338 | 368 | ||
| 339 | /* save the nodename */ | 369 | /* save the nodename */ |
| 340 | clnt->cl_nodelen = strlen(init_utsname()->nodename); | 370 | rpc_clnt_set_nodename(clnt, utsname()->nodename); |
| 341 | if (clnt->cl_nodelen > UNX_MAXNODENAME) | ||
| 342 | clnt->cl_nodelen = UNX_MAXNODENAME; | ||
| 343 | memcpy(clnt->cl_nodename, init_utsname()->nodename, clnt->cl_nodelen); | ||
| 344 | rpc_register_client(clnt); | 371 | rpc_register_client(clnt); |
| 345 | return clnt; | 372 | return clnt; |
| 346 | 373 | ||
| @@ -499,6 +526,7 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
| 499 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); | 526 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); |
| 500 | if (err != 0) | 527 | if (err != 0) |
| 501 | goto out_no_path; | 528 | goto out_no_path; |
| 529 | rpc_clnt_set_nodename(new, utsname()->nodename); | ||
| 502 | if (new->cl_auth) | 530 | if (new->cl_auth) |
| 503 | atomic_inc(&new->cl_auth->au_count); | 531 | atomic_inc(&new->cl_auth->au_count); |
| 504 | atomic_inc(&clnt->cl_count); | 532 | atomic_inc(&clnt->cl_count); |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 0af37fc46818..3b62cf288031 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
| @@ -1126,19 +1126,20 @@ rpc_fill_super(struct super_block *sb, void *data, int silent) | |||
| 1126 | return -ENOMEM; | 1126 | return -ENOMEM; |
| 1127 | dprintk("RPC: sending pipefs MOUNT notification for net %p%s\n", net, | 1127 | dprintk("RPC: sending pipefs MOUNT notification for net %p%s\n", net, |
| 1128 | NET_NAME(net)); | 1128 | NET_NAME(net)); |
| 1129 | sn->pipefs_sb = sb; | ||
| 1129 | err = blocking_notifier_call_chain(&rpc_pipefs_notifier_list, | 1130 | err = blocking_notifier_call_chain(&rpc_pipefs_notifier_list, |
| 1130 | RPC_PIPEFS_MOUNT, | 1131 | RPC_PIPEFS_MOUNT, |
| 1131 | sb); | 1132 | sb); |
| 1132 | if (err) | 1133 | if (err) |
| 1133 | goto err_depopulate; | 1134 | goto err_depopulate; |
| 1134 | sb->s_fs_info = get_net(net); | 1135 | sb->s_fs_info = get_net(net); |
| 1135 | sn->pipefs_sb = sb; | ||
| 1136 | return 0; | 1136 | return 0; |
| 1137 | 1137 | ||
| 1138 | err_depopulate: | 1138 | err_depopulate: |
| 1139 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, | 1139 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, |
| 1140 | RPC_PIPEFS_UMOUNT, | 1140 | RPC_PIPEFS_UMOUNT, |
| 1141 | sb); | 1141 | sb); |
| 1142 | sn->pipefs_sb = NULL; | ||
| 1142 | __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF); | 1143 | __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF); |
| 1143 | return err; | 1144 | return err; |
| 1144 | } | 1145 | } |
diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c index 64417a733220..d8c670c9d62c 100644 --- a/sound/pci/echoaudio/echoaudio_dsp.c +++ b/sound/pci/echoaudio/echoaudio_dsp.c | |||
| @@ -475,7 +475,7 @@ static int load_firmware(struct echoaudio *chip) | |||
| 475 | const struct firmware *fw; | 475 | const struct firmware *fw; |
| 476 | int box_type, err; | 476 | int box_type, err; |
| 477 | 477 | ||
| 478 | if (snd_BUG_ON(!chip->dsp_code_to_load || !chip->comm_page)) | 478 | if (snd_BUG_ON(!chip->comm_page)) |
| 479 | return -EPERM; | 479 | return -EPERM; |
| 480 | 480 | ||
| 481 | /* See if the ASIC is present and working - only if the DSP is already loaded */ | 481 | /* See if the ASIC is present and working - only if the DSP is already loaded */ |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 7a8fcc4c15f8..841475cc13b6 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
| @@ -5444,10 +5444,6 @@ int snd_hda_suspend(struct hda_bus *bus) | |||
| 5444 | list_for_each_entry(codec, &bus->codec_list, list) { | 5444 | list_for_each_entry(codec, &bus->codec_list, list) { |
| 5445 | if (hda_codec_is_power_on(codec)) | 5445 | if (hda_codec_is_power_on(codec)) |
| 5446 | hda_call_codec_suspend(codec); | 5446 | hda_call_codec_suspend(codec); |
| 5447 | else /* forcibly change the power to D3 even if not used */ | ||
| 5448 | hda_set_power_state(codec, | ||
| 5449 | codec->afg ? codec->afg : codec->mfg, | ||
| 5450 | AC_PWRST_D3); | ||
| 5451 | if (codec->patch_ops.post_suspend) | 5447 | if (codec->patch_ops.post_suspend) |
| 5452 | codec->patch_ops.post_suspend(codec); | 5448 | codec->patch_ops.post_suspend(codec); |
| 5453 | } | 5449 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c19e71a94e1b..1f350522bed4 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -783,11 +783,13 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus, | |||
| 783 | { | 783 | { |
| 784 | struct azx *chip = bus->private_data; | 784 | struct azx *chip = bus->private_data; |
| 785 | unsigned long timeout; | 785 | unsigned long timeout; |
| 786 | unsigned long loopcounter; | ||
| 786 | int do_poll = 0; | 787 | int do_poll = 0; |
| 787 | 788 | ||
| 788 | again: | 789 | again: |
| 789 | timeout = jiffies + msecs_to_jiffies(1000); | 790 | timeout = jiffies + msecs_to_jiffies(1000); |
| 790 | for (;;) { | 791 | |
| 792 | for (loopcounter = 0;; loopcounter++) { | ||
| 791 | if (chip->polling_mode || do_poll) { | 793 | if (chip->polling_mode || do_poll) { |
| 792 | spin_lock_irq(&chip->reg_lock); | 794 | spin_lock_irq(&chip->reg_lock); |
| 793 | azx_update_rirb(chip); | 795 | azx_update_rirb(chip); |
| @@ -803,7 +805,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus, | |||
| 803 | } | 805 | } |
| 804 | if (time_after(jiffies, timeout)) | 806 | if (time_after(jiffies, timeout)) |
| 805 | break; | 807 | break; |
| 806 | if (bus->needs_damn_long_delay) | 808 | if (bus->needs_damn_long_delay || loopcounter > 3000) |
| 807 | msleep(2); /* temporary workaround */ | 809 | msleep(2); /* temporary workaround */ |
| 808 | else { | 810 | else { |
| 809 | udelay(10); | 811 | udelay(10); |
| @@ -2351,6 +2353,17 @@ static void azx_power_notify(struct hda_bus *bus) | |||
| 2351 | * power management | 2353 | * power management |
| 2352 | */ | 2354 | */ |
| 2353 | 2355 | ||
| 2356 | static int snd_hda_codecs_inuse(struct hda_bus *bus) | ||
| 2357 | { | ||
| 2358 | struct hda_codec *codec; | ||
| 2359 | |||
| 2360 | list_for_each_entry(codec, &bus->codec_list, list) { | ||
| 2361 | if (snd_hda_codec_needs_resume(codec)) | ||
| 2362 | return 1; | ||
| 2363 | } | ||
| 2364 | return 0; | ||
| 2365 | } | ||
| 2366 | |||
| 2354 | static int azx_suspend(struct pci_dev *pci, pm_message_t state) | 2367 | static int azx_suspend(struct pci_dev *pci, pm_message_t state) |
| 2355 | { | 2368 | { |
| 2356 | struct snd_card *card = pci_get_drvdata(pci); | 2369 | struct snd_card *card = pci_get_drvdata(pci); |
| @@ -2397,7 +2410,8 @@ static int azx_resume(struct pci_dev *pci) | |||
| 2397 | return -EIO; | 2410 | return -EIO; |
| 2398 | azx_init_pci(chip); | 2411 | azx_init_pci(chip); |
| 2399 | 2412 | ||
| 2400 | azx_init_chip(chip, 1); | 2413 | if (snd_hda_codecs_inuse(chip->bus)) |
| 2414 | azx_init_chip(chip, 1); | ||
| 2401 | 2415 | ||
| 2402 | snd_hda_resume(chip->bus); | 2416 | snd_hda_resume(chip->bus); |
| 2403 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 2417 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 818f90bc7d57..7810913d07a0 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -5405,6 +5405,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
| 5405 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | 5405 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 5406 | ALC882_FIXUP_ACER_ASPIRE_4930G), | 5406 | ALC882_FIXUP_ACER_ASPIRE_4930G), |
| 5407 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), | 5407 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), |
| 5408 | SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G", | ||
| 5409 | ALC882_FIXUP_ACER_ASPIRE_4930G), | ||
| 5408 | SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE), | 5410 | SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE), |
| 5409 | SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G), | 5411 | SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G), |
| 5410 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), | 5412 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), |
| @@ -5438,6 +5440,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { | |||
| 5438 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), | 5440 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), |
| 5439 | 5441 | ||
| 5440 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), | 5442 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), |
| 5443 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), | ||
| 5441 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), | 5444 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), |
| 5442 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3", ALC889_FIXUP_CD), | 5445 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3", ALC889_FIXUP_CD), |
| 5443 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), | 5446 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), |
| @@ -5638,13 +5641,13 @@ static int patch_alc262(struct hda_codec *codec) | |||
| 5638 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | 5641 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 5639 | } | 5642 | } |
| 5640 | #endif | 5643 | #endif |
| 5641 | alc_auto_parse_customize_define(codec); | ||
| 5642 | |||
| 5643 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | 5644 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 5644 | 5645 | ||
| 5645 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); | 5646 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
| 5646 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | 5647 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 5647 | 5648 | ||
| 5649 | alc_auto_parse_customize_define(codec); | ||
| 5650 | |||
| 5648 | /* automatic parse from the BIOS config */ | 5651 | /* automatic parse from the BIOS config */ |
| 5649 | err = alc262_parse_auto_config(codec); | 5652 | err = alc262_parse_auto_config(codec); |
| 5650 | if (err < 0) | 5653 | if (err < 0) |
| @@ -6249,8 +6252,6 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 6249 | 6252 | ||
| 6250 | spec->mixer_nid = 0x0b; | 6253 | spec->mixer_nid = 0x0b; |
| 6251 | 6254 | ||
| 6252 | alc_auto_parse_customize_define(codec); | ||
| 6253 | |||
| 6254 | err = alc_codec_rename_from_preset(codec); | 6255 | err = alc_codec_rename_from_preset(codec); |
| 6255 | if (err < 0) | 6256 | if (err < 0) |
| 6256 | goto error; | 6257 | goto error; |
| @@ -6283,6 +6284,8 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 6283 | alc269_fixup_tbl, alc269_fixups); | 6284 | alc269_fixup_tbl, alc269_fixups); |
| 6284 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | 6285 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 6285 | 6286 | ||
| 6287 | alc_auto_parse_customize_define(codec); | ||
| 6288 | |||
| 6286 | /* automatic parse from the BIOS config */ | 6289 | /* automatic parse from the BIOS config */ |
| 6287 | err = alc269_parse_auto_config(codec); | 6290 | err = alc269_parse_auto_config(codec); |
| 6288 | if (err < 0) | 6291 | if (err < 0) |
| @@ -6859,8 +6862,6 @@ static int patch_alc662(struct hda_codec *codec) | |||
| 6859 | /* handle multiple HPs as is */ | 6862 | /* handle multiple HPs as is */ |
| 6860 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; | 6863 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; |
| 6861 | 6864 | ||
| 6862 | alc_auto_parse_customize_define(codec); | ||
| 6863 | |||
| 6864 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 6865 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 6865 | 6866 | ||
| 6866 | err = alc_codec_rename_from_preset(codec); | 6867 | err = alc_codec_rename_from_preset(codec); |
| @@ -6877,6 +6878,9 @@ static int patch_alc662(struct hda_codec *codec) | |||
| 6877 | alc_pick_fixup(codec, alc662_fixup_models, | 6878 | alc_pick_fixup(codec, alc662_fixup_models, |
| 6878 | alc662_fixup_tbl, alc662_fixups); | 6879 | alc662_fixup_tbl, alc662_fixups); |
| 6879 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | 6880 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
| 6881 | |||
| 6882 | alc_auto_parse_customize_define(codec); | ||
| 6883 | |||
| 6880 | /* automatic parse from the BIOS config */ | 6884 | /* automatic parse from the BIOS config */ |
| 6881 | err = alc662_parse_auto_config(codec); | 6885 | err = alc662_parse_auto_config(codec); |
| 6882 | if (err < 0) | 6886 | if (err < 0) |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 4742cac26aa9..2cb1e08f962a 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -4415,9 +4415,9 @@ static int stac92xx_init(struct hda_codec *codec) | |||
| 4415 | def_conf = get_defcfg_connect(def_conf); | 4415 | def_conf = get_defcfg_connect(def_conf); |
| 4416 | /* skip any ports that don't have jacks since presence | 4416 | /* skip any ports that don't have jacks since presence |
| 4417 | * detection is useless */ | 4417 | * detection is useless */ |
| 4418 | if (def_conf != AC_JACK_PORT_COMPLEX) { | 4418 | if (def_conf != AC_JACK_PORT_NONE && |
| 4419 | if (def_conf != AC_JACK_PORT_NONE) | 4419 | !is_jack_detectable(codec, nid)) { |
| 4420 | stac_toggle_power_map(codec, nid, 1); | 4420 | stac_toggle_power_map(codec, nid, 1); |
| 4421 | continue; | 4421 | continue; |
| 4422 | } | 4422 | } |
| 4423 | if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) { | 4423 | if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) { |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index b68cdec03b9e..0b2aea2ce172 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
| @@ -5170,6 +5170,7 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp) | |||
| 5170 | strcpy(hw->name, "HDSP hwdep interface"); | 5170 | strcpy(hw->name, "HDSP hwdep interface"); |
| 5171 | 5171 | ||
| 5172 | hw->ops.ioctl = snd_hdsp_hwdep_ioctl; | 5172 | hw->ops.ioctl = snd_hdsp_hwdep_ioctl; |
| 5173 | hw->ops.ioctl_compat = snd_hdsp_hwdep_ioctl; | ||
| 5173 | 5174 | ||
| 5174 | return 0; | 5175 | return 0; |
| 5175 | } | 5176 | } |
diff --git a/sound/soc/blackfin/bf5xx-ssm2602.c b/sound/soc/blackfin/bf5xx-ssm2602.c index df3ac73f8778..b39ad356b92b 100644 --- a/sound/soc/blackfin/bf5xx-ssm2602.c +++ b/sound/soc/blackfin/bf5xx-ssm2602.c | |||
| @@ -99,6 +99,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = { | |||
| 99 | .platform_name = "bfin-i2s-pcm-audio", | 99 | .platform_name = "bfin-i2s-pcm-audio", |
| 100 | .codec_name = "ssm2602.0-001b", | 100 | .codec_name = "ssm2602.0-001b", |
| 101 | .ops = &bf5xx_ssm2602_ops, | 101 | .ops = &bf5xx_ssm2602_ops, |
| 102 | .dai_fmt = BF5XX_SSM2602_DAIFMT, | ||
| 102 | }, | 103 | }, |
| 103 | { | 104 | { |
| 104 | .name = "ssm2602", | 105 | .name = "ssm2602", |
| @@ -108,6 +109,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = { | |||
| 108 | .platform_name = "bfin-i2s-pcm-audio", | 109 | .platform_name = "bfin-i2s-pcm-audio", |
| 109 | .codec_name = "ssm2602.0-001b", | 110 | .codec_name = "ssm2602.0-001b", |
| 110 | .ops = &bf5xx_ssm2602_ops, | 111 | .ops = &bf5xx_ssm2602_ops, |
| 112 | .dai_fmt = BF5XX_SSM2602_DAIFMT, | ||
| 111 | }, | 113 | }, |
| 112 | }; | 114 | }; |
| 113 | 115 | ||
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 07c44b71f096..3686417f5ea5 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c | |||
| @@ -568,22 +568,22 @@ static const struct snd_kcontrol_new cs42l73_snd_controls[] = { | |||
| 568 | attn_tlv), | 568 | attn_tlv), |
| 569 | 569 | ||
| 570 | SOC_SINGLE_TLV("SPK-IP Mono Volume", | 570 | SOC_SINGLE_TLV("SPK-IP Mono Volume", |
| 571 | CS42L73_SPKMIPMA, 0, 0x3E, 1, attn_tlv), | 571 | CS42L73_SPKMIPMA, 0, 0x3F, 1, attn_tlv), |
| 572 | SOC_SINGLE_TLV("SPK-XSP Mono Volume", | 572 | SOC_SINGLE_TLV("SPK-XSP Mono Volume", |
| 573 | CS42L73_SPKMXSPA, 0, 0x3E, 1, attn_tlv), | 573 | CS42L73_SPKMXSPA, 0, 0x3F, 1, attn_tlv), |
| 574 | SOC_SINGLE_TLV("SPK-ASP Mono Volume", | 574 | SOC_SINGLE_TLV("SPK-ASP Mono Volume", |
| 575 | CS42L73_SPKMASPA, 0, 0x3E, 1, attn_tlv), | 575 | CS42L73_SPKMASPA, 0, 0x3F, 1, attn_tlv), |
| 576 | SOC_SINGLE_TLV("SPK-VSP Mono Volume", | 576 | SOC_SINGLE_TLV("SPK-VSP Mono Volume", |
| 577 | CS42L73_SPKMVSPMA, 0, 0x3E, 1, attn_tlv), | 577 | CS42L73_SPKMVSPMA, 0, 0x3F, 1, attn_tlv), |
| 578 | 578 | ||
| 579 | SOC_SINGLE_TLV("ESL-IP Mono Volume", | 579 | SOC_SINGLE_TLV("ESL-IP Mono Volume", |
| 580 | CS42L73_ESLMIPMA, 0, 0x3E, 1, attn_tlv), | 580 | CS42L73_ESLMIPMA, 0, 0x3F, 1, attn_tlv), |
| 581 | SOC_SINGLE_TLV("ESL-XSP Mono Volume", | 581 | SOC_SINGLE_TLV("ESL-XSP Mono Volume", |
| 582 | CS42L73_ESLMXSPA, 0, 0x3E, 1, attn_tlv), | 582 | CS42L73_ESLMXSPA, 0, 0x3F, 1, attn_tlv), |
| 583 | SOC_SINGLE_TLV("ESL-ASP Mono Volume", | 583 | SOC_SINGLE_TLV("ESL-ASP Mono Volume", |
| 584 | CS42L73_ESLMASPA, 0, 0x3E, 1, attn_tlv), | 584 | CS42L73_ESLMASPA, 0, 0x3F, 1, attn_tlv), |
| 585 | SOC_SINGLE_TLV("ESL-VSP Mono Volume", | 585 | SOC_SINGLE_TLV("ESL-VSP Mono Volume", |
| 586 | CS42L73_ESLMVSPMA, 0, 0x3E, 1, attn_tlv), | 586 | CS42L73_ESLMVSPMA, 0, 0x3F, 1, attn_tlv), |
| 587 | 587 | ||
| 588 | SOC_ENUM("IP Digital Swap/Mono Select", ip_swap_enum), | 588 | SOC_ENUM("IP Digital Swap/Mono Select", ip_swap_enum), |
| 589 | 589 | ||
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 16d55f91a653..df1e07ffac32 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
| @@ -472,7 +472,7 @@ static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
| 472 | static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, | 472 | static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, |
| 473 | enum snd_soc_bias_level level) | 473 | enum snd_soc_bias_level level) |
| 474 | { | 474 | { |
| 475 | u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0xff7f; | 475 | u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0x17f; |
| 476 | 476 | ||
| 477 | switch (level) { | 477 | switch (level) { |
| 478 | case SND_SOC_BIAS_ON: | 478 | case SND_SOC_BIAS_ON: |
| @@ -491,7 +491,7 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, | |||
| 491 | case SND_SOC_BIAS_OFF: | 491 | case SND_SOC_BIAS_OFF: |
| 492 | /* everything off, dac mute, inactive */ | 492 | /* everything off, dac mute, inactive */ |
| 493 | snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0); | 493 | snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0); |
| 494 | snd_soc_write(codec, TLV320AIC23_PWR, 0xffff); | 494 | snd_soc_write(codec, TLV320AIC23_PWR, 0x1ff); |
| 495 | break; | 495 | break; |
| 496 | } | 496 | } |
| 497 | codec->dapm.bias_level = level; | 497 | codec->dapm.bias_level = level; |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 8c4c9591ec05..aa12c6b6beeb 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
| @@ -60,7 +60,7 @@ struct wm8350_jack_data { | |||
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | struct wm8350_data { | 62 | struct wm8350_data { |
| 63 | struct snd_soc_codec codec; | 63 | struct wm8350 *wm8350; |
| 64 | struct wm8350_output out1; | 64 | struct wm8350_output out1; |
| 65 | struct wm8350_output out2; | 65 | struct wm8350_output out2; |
| 66 | struct wm8350_jack_data hpl; | 66 | struct wm8350_jack_data hpl; |
| @@ -1309,7 +1309,7 @@ static void wm8350_hp_work(struct wm8350_data *priv, | |||
| 1309 | struct wm8350_jack_data *jack, | 1309 | struct wm8350_jack_data *jack, |
| 1310 | u16 mask) | 1310 | u16 mask) |
| 1311 | { | 1311 | { |
| 1312 | struct wm8350 *wm8350 = priv->codec.control_data; | 1312 | struct wm8350 *wm8350 = priv->wm8350; |
| 1313 | u16 reg; | 1313 | u16 reg; |
| 1314 | int report; | 1314 | int report; |
| 1315 | 1315 | ||
| @@ -1342,7 +1342,7 @@ static void wm8350_hpr_work(struct work_struct *work) | |||
| 1342 | static irqreturn_t wm8350_hp_jack_handler(int irq, void *data) | 1342 | static irqreturn_t wm8350_hp_jack_handler(int irq, void *data) |
| 1343 | { | 1343 | { |
| 1344 | struct wm8350_data *priv = data; | 1344 | struct wm8350_data *priv = data; |
| 1345 | struct wm8350 *wm8350 = priv->codec.control_data; | 1345 | struct wm8350 *wm8350 = priv->wm8350; |
| 1346 | struct wm8350_jack_data *jack = NULL; | 1346 | struct wm8350_jack_data *jack = NULL; |
| 1347 | 1347 | ||
| 1348 | switch (irq - wm8350->irq_base) { | 1348 | switch (irq - wm8350->irq_base) { |
| @@ -1427,7 +1427,7 @@ EXPORT_SYMBOL_GPL(wm8350_hp_jack_detect); | |||
| 1427 | static irqreturn_t wm8350_mic_handler(int irq, void *data) | 1427 | static irqreturn_t wm8350_mic_handler(int irq, void *data) |
| 1428 | { | 1428 | { |
| 1429 | struct wm8350_data *priv = data; | 1429 | struct wm8350_data *priv = data; |
| 1430 | struct wm8350 *wm8350 = priv->codec.control_data; | 1430 | struct wm8350 *wm8350 = priv->wm8350; |
| 1431 | u16 reg; | 1431 | u16 reg; |
| 1432 | int report = 0; | 1432 | int report = 0; |
| 1433 | 1433 | ||
| @@ -1536,6 +1536,8 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) | |||
| 1536 | return -ENOMEM; | 1536 | return -ENOMEM; |
| 1537 | snd_soc_codec_set_drvdata(codec, priv); | 1537 | snd_soc_codec_set_drvdata(codec, priv); |
| 1538 | 1538 | ||
| 1539 | priv->wm8350 = wm8350; | ||
| 1540 | |||
| 1539 | for (i = 0; i < ARRAY_SIZE(supply_names); i++) | 1541 | for (i = 0; i < ARRAY_SIZE(supply_names); i++) |
| 1540 | priv->supplies[i].supply = supply_names[i]; | 1542 | priv->supplies[i].supply = supply_names[i]; |
| 1541 | 1543 | ||
| @@ -1544,7 +1546,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) | |||
| 1544 | if (ret != 0) | 1546 | if (ret != 0) |
| 1545 | return ret; | 1547 | return ret; |
| 1546 | 1548 | ||
| 1547 | wm8350->codec.codec = codec; | ||
| 1548 | codec->control_data = wm8350; | 1549 | codec->control_data = wm8350; |
| 1549 | 1550 | ||
| 1550 | /* Put the codec into reset if it wasn't already */ | 1551 | /* Put the codec into reset if it wasn't already */ |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 6c1fe3afd4b5..2de12ebe43b5 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
| @@ -1144,7 +1144,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w, | |||
| 1144 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | 1144 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, |
| 1145 | WM8994_AIF2DACL_ENA | | 1145 | WM8994_AIF2DACL_ENA | |
| 1146 | WM8994_AIF2DACR_ENA, 0); | 1146 | WM8994_AIF2DACR_ENA, 0); |
| 1147 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | 1147 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, |
| 1148 | WM8994_AIF2ADCL_ENA | | 1148 | WM8994_AIF2ADCL_ENA | |
| 1149 | WM8994_AIF2ADCR_ENA, 0); | 1149 | WM8994_AIF2ADCR_ENA, 0); |
| 1150 | 1150 | ||
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index f13f2886339c..6c028c470601 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
| @@ -1035,7 +1035,7 @@ void wm_hubs_set_bias_level(struct snd_soc_codec *codec, | |||
| 1035 | enum snd_soc_bias_level level) | 1035 | enum snd_soc_bias_level level) |
| 1036 | { | 1036 | { |
| 1037 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); | 1037 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
| 1038 | int val; | 1038 | int mask, val; |
| 1039 | 1039 | ||
| 1040 | switch (level) { | 1040 | switch (level) { |
| 1041 | case SND_SOC_BIAS_STANDBY: | 1041 | case SND_SOC_BIAS_STANDBY: |
| @@ -1047,6 +1047,13 @@ void wm_hubs_set_bias_level(struct snd_soc_codec *codec, | |||
| 1047 | case SND_SOC_BIAS_ON: | 1047 | case SND_SOC_BIAS_ON: |
| 1048 | /* Turn off any unneded single ended outputs */ | 1048 | /* Turn off any unneded single ended outputs */ |
| 1049 | val = 0; | 1049 | val = 0; |
| 1050 | mask = 0; | ||
| 1051 | |||
| 1052 | if (hubs->lineout1_se) | ||
| 1053 | mask |= WM8993_LINEOUT1N_ENA | WM8993_LINEOUT1P_ENA; | ||
| 1054 | |||
| 1055 | if (hubs->lineout2_se) | ||
| 1056 | mask |= WM8993_LINEOUT2N_ENA | WM8993_LINEOUT2P_ENA; | ||
| 1050 | 1057 | ||
| 1051 | if (hubs->lineout1_se && hubs->lineout1n_ena) | 1058 | if (hubs->lineout1_se && hubs->lineout1n_ena) |
| 1052 | val |= WM8993_LINEOUT1N_ENA; | 1059 | val |= WM8993_LINEOUT1N_ENA; |
| @@ -1061,11 +1068,7 @@ void wm_hubs_set_bias_level(struct snd_soc_codec *codec, | |||
| 1061 | val |= WM8993_LINEOUT2P_ENA; | 1068 | val |= WM8993_LINEOUT2P_ENA; |
| 1062 | 1069 | ||
| 1063 | snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_3, | 1070 | snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_3, |
| 1064 | WM8993_LINEOUT1N_ENA | | 1071 | mask, val); |
| 1065 | WM8993_LINEOUT1P_ENA | | ||
| 1066 | WM8993_LINEOUT2N_ENA | | ||
| 1067 | WM8993_LINEOUT2P_ENA, | ||
| 1068 | val); | ||
| 1069 | 1072 | ||
| 1070 | /* Remove the input clamps */ | 1073 | /* Remove the input clamps */ |
| 1071 | snd_soc_update_bits(codec, WM8993_INPUTS_CLAMP_REG, | 1074 | snd_soc_update_bits(codec, WM8993_INPUTS_CLAMP_REG, |
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index a59bd352d342..5a649da9122a 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
| @@ -401,6 +401,10 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
| 401 | } | 401 | } |
| 402 | 402 | ||
| 403 | out: | 403 | out: |
| 404 | /* free preallocated buffers in case of error */ | ||
| 405 | if (ret) | ||
| 406 | omap_pcm_free_dma_buffers(pcm); | ||
| 407 | |||
| 404 | return ret; | 408 | return ret; |
| 405 | } | 409 | } |
| 406 | 410 | ||
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index 72185078ddf8..79fbeea99d46 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c | |||
| @@ -166,7 +166,7 @@ static struct snd_soc_dai_driver s3c2412_i2s_dai = { | |||
| 166 | 166 | ||
| 167 | static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev) | 167 | static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev) |
| 168 | { | 168 | { |
| 169 | return snd_soc_register_dai(&pdev->dev, &s3c2412_i2s_dai); | 169 | return s3c_i2sv2_register_dai(&pdev->dev, -1, &s3c2412_i2s_dai); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev) | 172 | static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev) |
diff --git a/sound/soc/sh/migor.c b/sound/soc/sh/migor.c index 9d9ad8d61c0a..8526e1edaf45 100644 --- a/sound/soc/sh/migor.c +++ b/sound/soc/sh/migor.c | |||
| @@ -35,7 +35,7 @@ static unsigned long siumckb_recalc(struct clk *clk) | |||
| 35 | return codec_freq; | 35 | return codec_freq; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | static struct clk_ops siumckb_clk_ops = { | 38 | static struct sh_clk_ops siumckb_clk_ops = { |
| 39 | .recalc = siumckb_recalc, | 39 | .recalc = siumckb_recalc, |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1d6a80c9f4c2..c88d9741b9e7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -3625,10 +3625,10 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
| 3625 | int i, ret; | 3625 | int i, ret; |
| 3626 | 3626 | ||
| 3627 | num_routes = of_property_count_strings(np, propname); | 3627 | num_routes = of_property_count_strings(np, propname); |
| 3628 | if (num_routes & 1) { | 3628 | if (num_routes < 0 || num_routes & 1) { |
| 3629 | dev_err(card->dev, | 3629 | dev_err(card->dev, |
| 3630 | "Property '%s's length is not even\n", | 3630 | "Property '%s' does not exist or its length is not even\n", |
| 3631 | propname); | 3631 | propname); |
| 3632 | return -EINVAL; | 3632 | return -EINVAL; |
| 3633 | } | 3633 | } |
| 3634 | num_routes /= 2; | 3634 | num_routes /= 2; |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 9bf3fc759344..92271d32bc30 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -774,10 +774,10 @@ $(OUTPUT)perf.o perf.spec \ | |||
| 774 | # over the general rule for .o | 774 | # over the general rule for .o |
| 775 | 775 | ||
| 776 | $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS | 776 | $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS |
| 777 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | 777 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -w $< |
| 778 | 778 | ||
| 779 | $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS | 779 | $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS |
| 780 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $< | 780 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -w $< |
| 781 | 781 | ||
| 782 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS | 782 | $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS |
| 783 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< | 783 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index c941bb640f49..1e5e9b270f5e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
| @@ -283,6 +283,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel, | |||
| 283 | { | 283 | { |
| 284 | struct perf_event_attr *attr = &evsel->attr; | 284 | struct perf_event_attr *attr = &evsel->attr; |
| 285 | struct xyarray *group_fd = NULL; | 285 | struct xyarray *group_fd = NULL; |
| 286 | bool exclude_guest_missing = false; | ||
| 287 | int ret; | ||
| 286 | 288 | ||
| 287 | if (group && evsel != first) | 289 | if (group && evsel != first) |
| 288 | group_fd = first->fd; | 290 | group_fd = first->fd; |
| @@ -293,16 +295,39 @@ static int create_perf_stat_counter(struct perf_evsel *evsel, | |||
| 293 | 295 | ||
| 294 | attr->inherit = !no_inherit; | 296 | attr->inherit = !no_inherit; |
| 295 | 297 | ||
| 296 | if (system_wide) | 298 | retry: |
| 297 | return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, | 299 | if (exclude_guest_missing) |
| 300 | evsel->attr.exclude_guest = evsel->attr.exclude_host = 0; | ||
| 301 | |||
| 302 | if (system_wide) { | ||
| 303 | ret = perf_evsel__open_per_cpu(evsel, evsel_list->cpus, | ||
| 298 | group, group_fd); | 304 | group, group_fd); |
| 305 | if (ret) | ||
| 306 | goto check_ret; | ||
| 307 | return 0; | ||
| 308 | } | ||
| 309 | |||
| 299 | if (!target_pid && !target_tid && (!group || evsel == first)) { | 310 | if (!target_pid && !target_tid && (!group || evsel == first)) { |
| 300 | attr->disabled = 1; | 311 | attr->disabled = 1; |
| 301 | attr->enable_on_exec = 1; | 312 | attr->enable_on_exec = 1; |
| 302 | } | 313 | } |
| 303 | 314 | ||
| 304 | return perf_evsel__open_per_thread(evsel, evsel_list->threads, | 315 | ret = perf_evsel__open_per_thread(evsel, evsel_list->threads, |
| 305 | group, group_fd); | 316 | group, group_fd); |
| 317 | if (!ret) | ||
| 318 | return 0; | ||
| 319 | /* fall through */ | ||
| 320 | check_ret: | ||
| 321 | if (ret && errno == EINVAL) { | ||
| 322 | if (!exclude_guest_missing && | ||
| 323 | (evsel->attr.exclude_guest || evsel->attr.exclude_host)) { | ||
| 324 | pr_debug("Old kernel, cannot exclude " | ||
| 325 | "guest or host samples.\n"); | ||
| 326 | exclude_guest_missing = true; | ||
| 327 | goto retry; | ||
| 328 | } | ||
| 329 | } | ||
| 330 | return ret; | ||
| 306 | } | 331 | } |
| 307 | 332 | ||
| 308 | /* | 333 | /* |
| @@ -463,8 +488,13 @@ static int run_perf_stat(int argc __used, const char **argv) | |||
| 463 | 488 | ||
| 464 | list_for_each_entry(counter, &evsel_list->entries, node) { | 489 | list_for_each_entry(counter, &evsel_list->entries, node) { |
| 465 | if (create_perf_stat_counter(counter, first) < 0) { | 490 | if (create_perf_stat_counter(counter, first) < 0) { |
| 491 | /* | ||
| 492 | * PPC returns ENXIO for HW counters until 2.6.37 | ||
| 493 | * (behavior changed with commit b0a873e). | ||
| 494 | */ | ||
| 466 | if (errno == EINVAL || errno == ENOSYS || | 495 | if (errno == EINVAL || errno == ENOSYS || |
| 467 | errno == ENOENT || errno == EOPNOTSUPP) { | 496 | errno == ENOENT || errno == EOPNOTSUPP || |
| 497 | errno == ENXIO) { | ||
| 468 | if (verbose) | 498 | if (verbose) |
| 469 | ui__warning("%s event is not supported by the kernel.\n", | 499 | ui__warning("%s event is not supported by the kernel.\n", |
| 470 | event_name(counter)); | 500 | event_name(counter)); |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 4c7c2d73251f..c0b70c697a36 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
| @@ -296,7 +296,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
| 296 | if (mkdir_p(filename, 0755)) | 296 | if (mkdir_p(filename, 0755)) |
| 297 | goto out_free; | 297 | goto out_free; |
| 298 | 298 | ||
| 299 | snprintf(filename + len, sizeof(filename) - len, "/%s", sbuild_id); | 299 | snprintf(filename + len, size - len, "/%s", sbuild_id); |
| 300 | 300 | ||
| 301 | if (access(filename, F_OK)) { | 301 | if (access(filename, F_OK)) { |
| 302 | if (is_kallsyms) { | 302 | if (is_kallsyms) { |
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 95d6a6f7c33a..4915408f6a98 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -183,6 +183,9 @@ my %force_config; | |||
| 183 | # do not force reboots on config problems | 183 | # do not force reboots on config problems |
| 184 | my $no_reboot = 1; | 184 | my $no_reboot = 1; |
| 185 | 185 | ||
| 186 | # reboot on success | ||
| 187 | my $reboot_success = 0; | ||
| 188 | |||
| 186 | my %option_map = ( | 189 | my %option_map = ( |
| 187 | "MACHINE" => \$machine, | 190 | "MACHINE" => \$machine, |
| 188 | "SSH_USER" => \$ssh_user, | 191 | "SSH_USER" => \$ssh_user, |
| @@ -2192,7 +2195,7 @@ sub run_bisect { | |||
| 2192 | } | 2195 | } |
| 2193 | 2196 | ||
| 2194 | # Are we looking for where it worked, not failed? | 2197 | # Are we looking for where it worked, not failed? |
| 2195 | if ($reverse_bisect) { | 2198 | if ($reverse_bisect && $ret >= 0) { |
| 2196 | $ret = !$ret; | 2199 | $ret = !$ret; |
| 2197 | } | 2200 | } |
| 2198 | 2201 | ||
| @@ -3469,6 +3472,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3469 | 3472 | ||
| 3470 | # Do not reboot on failing test options | 3473 | # Do not reboot on failing test options |
| 3471 | $no_reboot = 1; | 3474 | $no_reboot = 1; |
| 3475 | $reboot_success = 0; | ||
| 3472 | 3476 | ||
| 3473 | $iteration = $i; | 3477 | $iteration = $i; |
| 3474 | 3478 | ||
| @@ -3554,9 +3558,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3554 | die "failed to checkout $checkout"; | 3558 | die "failed to checkout $checkout"; |
| 3555 | } | 3559 | } |
| 3556 | 3560 | ||
| 3561 | $no_reboot = 0; | ||
| 3562 | |||
| 3557 | # A test may opt to not reboot the box | 3563 | # A test may opt to not reboot the box |
| 3558 | if ($reboot_on_success) { | 3564 | if ($reboot_on_success) { |
| 3559 | $no_reboot = 0; | 3565 | $reboot_success = 1; |
| 3560 | } | 3566 | } |
| 3561 | 3567 | ||
| 3562 | if ($test_type eq "bisect") { | 3568 | if ($test_type eq "bisect") { |
| @@ -3600,7 +3606,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3600 | 3606 | ||
| 3601 | if ($opt{"POWEROFF_ON_SUCCESS"}) { | 3607 | if ($opt{"POWEROFF_ON_SUCCESS"}) { |
| 3602 | halt; | 3608 | halt; |
| 3603 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) { | 3609 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot && $reboot_success) { |
| 3604 | reboot_to_good; | 3610 | reboot_to_good; |
| 3605 | } elsif (defined($switch_to_good)) { | 3611 | } elsif (defined($switch_to_good)) { |
| 3606 | # still need to get to the good kernel | 3612 | # still need to get to the good kernel |
